diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000..41534ed7ba --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: processing +custom: https://processingfoundation.org diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml new file mode 100644 index 0000000000..5ed1e8ee84 --- /dev/null +++ b/.github/workflows/lock.yml @@ -0,0 +1,29 @@ +name: 'Lock Threads' + +on: + schedule: + - cron: '0 6 * * *' + +permissions: + contents: read + +jobs: + lock: + permissions: + issues: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: dessant/lock-threads@v2.0.1 + with: + github-token: ${{ github.token }} + issue-lock-inactive-days: '30' + issue-lock-comment: > + This issue has been automatically locked. To avoid confusion + with reports that have already been resolved, closed issues + are automatically locked 30 days after the last comment. + Please open a new issue for related bugs. + pr-lock-comment: > + This pull request has been automatically locked. + Pull requests that have been closed are automatically + locked 30 days after the last comment. diff --git a/.gitignore b/.gitignore index 528a5fbbbc..cd99249298 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,75 @@ ._* *~ /build/shared/reference.zip + +# temporary, until we complete the move to IntelliJ +*.iml +/.idea + +# via https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..afb13c6f19 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,24 @@ +## Welcome to Processing! + +### Bug Report? + +We have a page on [troubleshooting](https://github.com/processing/processing/wiki/Troubleshooting) common problems. Check there first! + +We also host an [online forum](https://forum.processing.org) for coding questions, which is also helpful for general "getting started" queries. + +If you don't find an answer, please let us know by [filing an issue](https://github.com/processing/processing/issues). We can only fix the things we've heard about. + +Please keep the tone polite. This project is volunteer work done in our free time. We give it away at no cost. We do this because we think it's important for the community and enjoy it. Complaints that things *suck* are *annoying* or lectures about things that *must* be fixed are... weird things to hear from strangers at best, demotivating at worst. + +### Want to Help? + +Great! The number of contributors on this project is *tiny*, especially relative to the number of users. There are [only 2 or 3 people](https://github.com/processing/processing/graphs/contributors) who actively work on this repository, for instance. We need help! + +How to start: + +* Issues marked [help](https://github.com/processing/processing/issues?q=is%3Aissue+is%3Aopen+label%3Ahelp) are a good place to start, because they're something that's isolated enough that someone can jump into it without significant reworking of other code. +* Mind the [style guidelines](https://github.com/processing/processing/wiki/Style-Guidelines) when submitting pull requests. Otherwise someone else will have to reformat your code so that it fits everything else (or we'll have to reject it if it'll take us too long to clean it up). + +### Other Details + +This document was hastily thrown together in an attempt to improve the bug reporting process. It needs more detail about our intent with the project, the community behind it, our values, and an explanation of how the code itself is designed. \ No newline at end of file diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md new file mode 100644 index 0000000000..bc9287c602 --- /dev/null +++ b/ISSUE_TEMPLATE.md @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + +## Description + + + +## Expected Behavior + + + +## Current Behavior + + +## Steps to Reproduce + + +1. +2. +3. + +## Your Environment + + + +* Processing version: +* Operating System and OS version: +* Other information: + +## Possible Causes / Solutions + diff --git a/README.md b/README.md index 1c3e154ec0..ece7d3ab72 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,48 @@ -Processing + + +>[!WARNING] +> # Development has moved to [a new repository](https://github.com/processing/processing4/). + +Since the release of Processing 3.5.4 in January 2020, development has continued in a new repository: [processing/processing4](https://github.com/processing/processing4/). + +We chose to move to a new repository so that we could clean out old files accumulated over the last 20 years. + +To report bugs or request features, please open a [new issue](https://github.com/processing/processing4/issues/new/choose) on the Processing 4 repository. + + + + +~~Processing~~ ========== -This is the official source code for the [Processing](http://processing.org) Development Environment (PDE), -the “core” and the libraries that are included with the [download](http://processing.org/download). +~~This is the official source code for the [Processing](http://processing.org) Development Environment (PDE), +the “core” and the libraries that are included with the [download](http://processing.org/download).~~ + +~~__I've found a bug!__~~ +~~Let us know [here](https://github.com/processing/processing/issues) (after first checking if someone has already posted a similar problem). +If it's a reference, web site, or examples issue, take that up with folks [here](https://github.com/processing/processing-docs/issues). +There are also separate locations for [Android Mode](https://github.com/processing/processing-android/issues), or the [Video](https://github.com/processing/processing-video/issues) and [Sound](https://github.com/processing/processing-sound/issues) libraries. +The [processing.js](http://processingjs.org) project is not affiliated with us, but you can find their issue tracker [here](https://github.com/processing-js/processing-js/issues).~~ -__I've found a bug!__ -Let us know [here](https://github.com/processing/processing/issues) (after first checking if someone has already posted a similar problem). -If it's a documentation, web site, or examples problem, take that up with folks [here](https://github.com/processing/processing-docs/issues). -There are also separate locations for [Android Mode](https://github.com/processing/processing-android/issues), or the [Video](https://github.com/processing/processing-video/issues) and [Sound](https://github.com/processing/processing-sound/issues) libraries. -The [processing.js](http://processingjs.org) project is not affiliated with us, but you can find their issue tracker [here](https://github.com/processing-js/processing-js/issues). +~~__Locked Issues__ +Where possible, I've started locking issues once resolved. This helps reduce the amount of noise from folks adding to an issue that's been closed for years. Because this project has existed for a long time and we have thousands of closed issues, lots of them may sound similar to an issue you're having. But if there's a new problem, it'll be missed if it's lost in a comment added to an already closed issue. I don't like to lock issues because it cuts off conversation, but it's better than legitimate problems being missed. Once an issue has been resolved for 30 days, it will automatically lock.~~ -__That [processing-bugs](https://github.com/processing-bugs) fella is a damn liar.__ -The issues list has been imported from Google Code, so there are many spurious references -amongst them since the numbering changed. Basically, any time you see references to +~~__That [processing-bugs](https://github.com/processing-bugs) fella is suspicious.__ +The issues list has been imported from Google Code, so there are many spurious references +amongst them since the numbering changed. Basically, any time you see references to changes made by [processing-bugs](https://github.com/processing-bugs), it may be somewhat suspect. -Over time this will clean itself up as bugs are fixed and new issues are added from within Github. -Help speed this process along by helping us! +Over time this will clean itself up as bugs are fixed and new issues are added from within GitHub. +Help speed this process along by helping us!~~ -__Please help.__ -The instructions for building the source [are here](https://github.com/processing/processing/wiki/Build-Instructions). -Please help us fix problems, and if you're submitting code, following the [style guidelines](https://github.com/processing/processing/wiki/Style-Guidelines) helps save us a lot of time. +~~__Please help.__ +The instructions for building the source [are here](https://github.com/processing/processing/wiki/Build-Instructions). +Please help us fix problems, and if you're submitting code, following the [style guidelines](https://github.com/processing/processing/wiki/Style-Guidelines) helps save me a lot of time.~~ -__And finally...__ -Someday we'll also fix all these bugs, throw together hundreds of unit tests, and get rich off all this stuff that we're giving away for free. But not today. +~~__And finally...__ +Someday we'll also fix all these bugs, throw together hundreds of unit tests, and get rich off all this stuff that we're giving away for free. But not today.~~ -So in the meantime, I ask for your patience, -[participation](https://github.com/processing/processing/wiki/Project-List), -and [patches](https://github.com/processing/processing/pulls). +~~So in the meantime, I ask for your patience, +[participation](https://github.com/processing/processing/wiki/Project-List), +and [patches](https://github.com/processing/processing/pulls).~~ -Ben Fry, 6 August 2015 +~~Ben Fry, 20 January 2019~~ diff --git a/app/.classpath b/app/.classpath index d63b38f43f..72c3737104 100644 --- a/app/.classpath +++ b/app/.classpath @@ -4,6 +4,7 @@ + diff --git a/app/.settings/org.eclipse.jdt.core.prefs b/app/.settings/org.eclipse.jdt.core.prefs index aee82626e8..af36b24305 100644 --- a/app/.settings/org.eclipse.jdt.core.prefs +++ b/app/.settings/org.eclipse.jdt.core.prefs @@ -6,9 +6,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -93,8 +93,13 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false +org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false +org.eclipse.jdt.core.formatter.align_with_spaces=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 @@ -103,24 +108,39 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=36 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 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_relational_operator=0 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 +org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=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 @@ -129,6 +149,7 @@ 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_statement_group_in_switch=0 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 @@ -138,32 +159,38 @@ 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_lambda_body=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.align_tags_descriptions_grouped=false +org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=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.count_line_length_from_starting_position=false org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_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.indent_tag_description=false org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=1 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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 @@ -176,6 +203,7 @@ 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_annotation_on_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert @@ -185,6 +213,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=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 @@ -198,11 +227,15 @@ 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_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=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_bitwise_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 @@ -229,9 +262,14 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declar 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_switch_case_expressions=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_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_not_operator=do not 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 @@ -256,13 +294,20 @@ 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_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=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_bitwise_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 @@ -306,9 +351,13 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_decla 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_switch_case_expressions=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_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=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 @@ -345,9 +394,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser 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_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=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 @@ -359,20 +411,59 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_decla org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never 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_enum_constant_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false +org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.lineSplit=80 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines 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.text_block_indentation=0 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true +org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true +org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/app/.settings/org.eclipse.jdt.ui.prefs b/app/.settings/org.eclipse.jdt.ui.prefs index 7f5ba1ed84..66aaa0890e 100644 --- a/app/.settings/org.eclipse.jdt.ui.prefs +++ b/app/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,3 @@ eclipse.preferences.version=1 formatter_profile=_processing -formatter_settings_version=12 +formatter_settings_version=18 diff --git a/app/build.xml b/app/build.xml index de7fd993db..b6d97218ab 100644 --- a/app/build.xml +++ b/app/build.xml @@ -28,8 +28,8 @@ - diff --git a/app/lib/jna-platform.jar b/app/lib/jna-platform.jar new file mode 100644 index 0000000000..d0fd2e4f52 Binary files /dev/null and b/app/lib/jna-platform.jar differ diff --git a/app/lib/jna.jar b/app/lib/jna.jar index 748adb001b..25243176ea 100644 Binary files a/app/lib/jna.jar and b/app/lib/jna.jar differ diff --git a/app/lib/jna.txt b/app/lib/jna.txt new file mode 100644 index 0000000000..4dbac83c25 --- /dev/null +++ b/app/lib/jna.txt @@ -0,0 +1,4 @@ +The JAR file is JNA 4.2.0 + +You can find the corresponding file for Maven here: +https://maven.java.net/content/repositories/releases/net/java/dev/jna/jna/4.2.0/ diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index cb6690ab11..5d9b0a114c 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2012-19 The Processing Foundation Copyright (c) 2004-12 Ben Fry and Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology @@ -28,8 +28,10 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.*; +import java.lang.reflect.InvocationTargetException; import java.text.SimpleDateFormat; import java.util.*; +import java.util.Map.Entry; import javax.swing.JFileChooser; import javax.swing.JMenu; @@ -39,6 +41,7 @@ import javax.swing.tree.DefaultMutableTreeNode; import processing.app.contrib.*; +import processing.app.tools.Tool; import processing.app.ui.*; import processing.core.*; import processing.data.StringList; @@ -53,14 +56,17 @@ public class Base { // Added accessors for 0218 because the UpdateCheck class was not properly // updating the values, due to javac inlining the static final values. - static private final int REVISION = 243; + static private final int REVISION = 271; /** This might be replaced by main() if there's a lib/version.txt file. */ - static private String VERSION_NAME = "0243"; //$NON-NLS-1$ + static private String VERSION_NAME = "0271"; //$NON-NLS-1$ /** Set true if this a proper release rather than a numbered revision. */ - /** True if heavy debugging error/log messages are enabled */ - static public boolean DEBUG = false; -// static public boolean DEBUG = true; + /** + * True if heavy debugging error/log messages are enabled. Set to true + * if an empty file named 'debug' is found in the settings folder. + * See implementation in createAndShowGUI(). + */ + static public boolean DEBUG; static private boolean commandLine; @@ -110,10 +116,32 @@ static public void main(final String[] args) { public void run() { try { createAndShowGUI(args); + } catch (Throwable t) { - Messages.showBadnessTrace("It was not meant to be", - "A serious problem happened during startup. Please report:\n" + - "http://github.com/processing/processing/issues/new", t, true); + // Windows Defender has been insisting on destroying each new + // release by removing core.jar and other files. Yay! + // https://github.com/processing/processing/issues/5537 + if (Platform.isWindows()) { + String mess = t.getMessage(); + String missing = null; + if (mess.contains("Could not initialize class com.sun.jna.Native")) { + missing = "jnidispatch.dll"; + } else if (mess.contains("NoClassDefFoundError: processing/core/PApplet")) { + missing = "core.jar"; + } + if (missing != null) { + Messages.showError("Necessary files are missing", + "A file required by Processing (" + missing + ") is missing.\n\n" + + "Make sure that you're not trying to run Processing from inside\n" + + "the .zip file you downloaded, and check that Windows Defender\n" + + "hasn't removed files from the Processing folder.\n\n" + + "(It sometimes flags parts of Processing as a trojan or virus.\n" + + "It is neither, but Microsoft has ignored our pleas for help.)", t); + } + } + Messages.showTrace("Unknown Problem", + "A serious error happened during startup. Please report:\n" + + "http://github.com/processing/processing/issues/new", t, true); } } }); @@ -127,7 +155,6 @@ static private void createAndShowGUI(String[] args) { String version = PApplet.loadStrings(versionFile)[0]; if (!version.equals(VERSION_NAME)) { VERSION_NAME = version; -// RELEASE = true; } } } catch (Exception e) { @@ -135,6 +162,19 @@ static private void createAndShowGUI(String[] args) { } Platform.init(); + // call after Platform.init() because we need the settings folder + Console.startup(); + + // Set the debug flag based on a file being present in the settings folder + File debugFile = getSettingsFile("debug.txt"); + /* + if (debugFile.isDirectory()) { + // if it's a directory, it's a leftover from older releases, clear it + Util.removeDir(debugFile); + } else*/ + if (debugFile.exists()) { + DEBUG = true; + } // Use native popups so they don't look so crappy on OS X JPopupMenu.setDefaultLightWeightPopupEnabled(false); @@ -161,6 +201,7 @@ static private void createAndShowGUI(String[] args) { boolean sketchbookPrompt = false; if (Preferences.getBoolean("welcome.show")) { + // only ask once about split sketchbooks if (!Preferences.getBoolean("welcome.seen")) { // Check if there's a 2.0 sketchbook present String oldPath = Preferences.getOldSketchbookPath(); @@ -171,9 +212,9 @@ static private void createAndShowGUI(String[] args) { sketchbookPrompt = true; } else if (oldPath.equals(newPath)) { - // If both exist and are identical, then the user has been using - // alpha releases of 3.x and needs to be warned about the larger - // changes in this release. + // If both exist and are identical, then the user has used + // pre-releases of 3.x and needs to be warned about the + // larger changes in this release. sketchbookPrompt = true; } } @@ -183,7 +224,6 @@ static private void createAndShowGUI(String[] args) { // Get the sketchbook path, and make sure it's set properly locateSketchbookFolder(); - // Create a location for untitled sketches try { untitledFolder = Util.createTempFolder("untitled", "sketches", null); @@ -194,29 +234,28 @@ static private void createAndShowGUI(String[] args) { "That's gonna prevent us from continuing.", e); } - Messages.log("about to create base..."); //$NON-NLS-1$ + Messages.log("About to create Base..."); //$NON-NLS-1$ try { final Base base = new Base(args); + Messages.log("Base() constructor succeeded"); + // Prevent more than one copy of the PDE from running. SingleInstance.startServer(base); // Needs to be shown after the first editor window opens, so that it // shows up on top, and doesn't prevent an editor window from opening. if (Preferences.getBoolean("welcome.show")) { - final boolean prompt = sketchbookPrompt; - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - new Welcome(base, prompt); - } catch (IOException e) { - Messages.showBadnessTrace("Unwelcoming", - "Please report this error to\n" + - "https://github.com/processing/processing/issues", e, false); - } - } - }); + try { + new Welcome(base, sketchbookPrompt); + } catch (IOException e) { + Messages.showTrace("Unwelcoming", + "Please report this error to\n" + + "https://github.com/processing/processing/issues", e, false); + } } + checkDriverBug(); + } catch (Throwable t) { // Catch-all to pick up badness during startup. if (t.getCause() != null) { @@ -224,10 +263,56 @@ public void run() { // show this one so that it's not truncated in the error window. t = t.getCause(); } - Messages.showBadnessTrace("We're off on the wrong foot", - "An error occurred during startup.", t, true); + Messages.showTrace("We're off on the wrong foot", + "An error occurred during startup.", t, true); } - Messages.log("done creating base..."); //$NON-NLS-1$ + Messages.log("Done creating Base..."); //$NON-NLS-1$ + } + } + + + // Remove this code in a couple months [fry 170211] + // https://github.com/processing/processing/issues/4853 + // Or maybe not, if NVIDIA keeps doing this [fry 170423] + // https://github.com/processing/processing/issues/4997 + static private void checkDriverBug() { + if (System.getProperty("os.name").contains("Windows 10")) { + new Thread(new Runnable() { + public void run() { + try { + Process p = Runtime.getRuntime().exec("powershell Get-WmiObject Win32_PnPSignedDriver| select devicename, driverversion | where {$_.devicename -like \\\"*nvidia*\\\"}"); + BufferedReader reader = PApplet.createReader(p.getInputStream()); + String line = null; + while ((line = reader.readLine()) != null) { + if (line.contains("3.7849")) { + EventQueue.invokeLater(new Runnable() { + public void run() { + Messages.showWarning("NVIDIA screwed up", + "Due to an NVIDIA bug, you need to update your graphics drivers,\n" + + "otherwise you won't be able to run any sketches. Update here:\n" + + "http://nvidia.custhelp.com/app/answers/detail/a_id/4378\n" + + "or read background about the issue at this link:\n" + + "https://github.com/processing/processing/issues/4853"); + } + }); + } else if (line.contains("3.8165")) { + EventQueue.invokeLater(new Runnable() { + public void run() { + Messages.showWarning("NVIDIA screwed up again", + "Due to an NVIDIA bug, you need to update your graphics drivers,\n" + + "otherwise you won't be able to run any sketches. Update here:\n" + + "http://nvidia.custhelp.com/app/answers/detail/a_id/4453/\n" + + "or read background about the issue at this link:\n" + + "https://github.com/processing/processing/issues/4997"); + } + }); + } + } + } catch (Exception e) { + Messages.loge("Problem checking NVIDIA driver", e); + } + } + }).start(); } } @@ -266,7 +351,8 @@ static public boolean isCommandLine() { public Base(String[] args) throws Exception { - ContributionManager.cleanup(this); + ContributionManager.init(this); + buildCoreModes(); rebuildContribModes(); rebuildContribExamples(); @@ -311,6 +397,8 @@ public Base(String[] args) throws Exception { // Check if any files were passed in on the command line for (int i = 0; i < args.length; i++) { + Messages.logf("Parsing command line... args[%d] = '%s'", i, args[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 @@ -320,6 +408,7 @@ public Base(String[] args) throws Exception { try { File file = new File(args[i]); path = file.getCanonicalPath(); + Messages.logf("Changing %s to canonical %s", i, args[i], path); } catch (IOException e) { e.printStackTrace(); } @@ -331,14 +420,17 @@ public Base(String[] args) throws Exception { // Create a new empty window (will be replaced with any files to be opened) if (!opened) { -// System.out.println("opening a new window"); + Messages.log("Calling handleNew() to open a new window"); handleNew(); -// } else { -// System.out.println("something else was opened"); + } else { + Messages.log("No handleNew(), something passed on the command line"); } // check for updates new UpdateCheck(this); + + ContributionListing cl = ContributionListing.getInstance(); + cl.downloadAvailableList(this, new ContribProgressMonitor() { }); } @@ -372,9 +464,76 @@ void buildCoreModes() { */ void rebuildContribModes() { if (modeContribs == null) { - modeContribs = new ArrayList(); + modeContribs = new ArrayList<>(); } - ModeContribution.loadMissing(this); + File modesFolder = getSketchbookModesFolder(); + List contribModes = getModeContribs(); + + Map known = new HashMap<>(); + for (ModeContribution contrib : contribModes) { + known.put(contrib.getFolder(), contrib); + } + File[] potential = ContributionType.MODE.listCandidates(modesFolder); + // If modesFolder does not exist or is inaccessible (folks might like to + // mess with folders then report it as a bug) 'potential' will be null. + if (potential != null) { + for (File folder : potential) { + if (!known.containsKey(folder)) { + try { + contribModes.add(new ModeContribution(this, folder, null)); + } catch (NoSuchMethodError nsme) { + System.err.println(folder.getName() + " is not compatible with this version of Processing"); + if (DEBUG) nsme.printStackTrace(); + } catch (NoClassDefFoundError ncdfe) { + System.err.println(folder.getName() + " is not compatible with this version of Processing"); + if (DEBUG) ncdfe.printStackTrace(); + } catch (InvocationTargetException ite) { + System.err.println(folder.getName() + " could not be loaded and may not compatible with this version of Processing"); + if (DEBUG) ite.printStackTrace(); + } catch (IgnorableException ig) { + Messages.log(ig.getMessage()); + if (DEBUG) ig.printStackTrace(); + } catch (Throwable e) { + System.err.println("Could not load Mode from " + folder); + e.printStackTrace(); + } + } else { + known.remove(folder); // remove this item as already been seen + } + } + } + + // This allows you to build and test your Mode code from Eclipse. + // -Dusemode=com.foo.FrobMode:/path/to/FrobMode + final String useMode = System.getProperty("usemode"); + if (useMode != null) { + final String[] modeInfo = useMode.split(":", 2); + final String modeClass = modeInfo[0]; + final String modeResourcePath = modeInfo[1]; + System.out.println("Attempting to load " + modeClass + " with resources at " + modeResourcePath); + ModeContribution mc = ModeContribution.load(this, new File(modeResourcePath), modeClass); + contribModes.add(mc); + File key = getFileForContrib(mc, known); + if (key != null) { + known.remove(key); + } + } + if (known.size() != 0) { + for (ModeContribution mc : known.values()) { + System.out.println("Extraneous Mode entry: " + mc.getName()); + } + } + } + + + static private File getFileForContrib(ModeContribution contrib, + Map known) { + for (Entry entry : known.entrySet()) { + if (entry.getValue() == contrib) { + return entry.getKey(); + } + } + return null; } @@ -385,7 +544,7 @@ void rebuildContribModes() { */ void rebuildContribExamples() { if (exampleContribs == null) { - exampleContribs = new ArrayList(); + exampleContribs = new ArrayList<>(); } ExamplesContribution.loadMissing(this); } @@ -394,6 +553,20 @@ void rebuildContribExamples() { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + /** + * Tools require an 'Editor' object when they're instantiated, but the + * activeEditor will be null when the first Editor that opens is creating + * its Tools menu. This will temporarily set the activeEditor to the one + * that's opening so that we don't go all NPE on startup. If there's already + * an active editor, then this does nothing. + */ + public void checkFirstEditor(Editor editor) { + if (activeEditor == null) { + activeEditor = editor; + } + } + + /** Returns the front most, active editor window. */ public Editor getActiveEditor() { return activeEditor; @@ -406,10 +579,13 @@ public List getEditors() { } - // 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. + /** + * Called when a window is activated. Because of variations in native + * windowing systems, no guarantees about changes to the focused and active + * Windows can be made. Never assume that this Window is the focused or + * active Window until this Window actually receives a WINDOW_GAINED_FOCUS + * or WINDOW_ACTIVATED event. + */ public void handleActivated(Editor whichEditor) { activeEditor = whichEditor; @@ -425,13 +601,285 @@ public void handleActivated(Editor whichEditor) { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + public void refreshContribs(ContributionType ct) { + if (ct == ContributionType.LIBRARY) { + for (Mode m : getModeList()) { + m.rebuildImportMenu(); + } + + } else if (ct == ContributionType.MODE) { + rebuildContribModes(); + for (Editor editor : editors) { + editor.rebuildModePopup(); + } + + } else if (ct == ContributionType.TOOL) { + rebuildToolList(); + for (Editor editor : editors) { + populateToolsMenu(editor.getToolMenu()); + } + + } else if (ct == ContributionType.EXAMPLES) { + rebuildContribExamples(); + for (Mode m : getModeList()) { + m.rebuildExamplesFrame(); + } + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + private int updatesAvailable = 0; + + + public void setUpdatesAvailable(int n) { + updatesAvailable = n; + synchronized (editors) { + for (Editor e : editors) { + e.setUpdatesAvailable(n); + } + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + List internalTools; + List coreTools; + List contribTools; + + + public List getCoreTools() { + return coreTools; + } + + + public List getToolContribs() { + return contribTools; + } + + + public void removeToolContrib(ToolContribution tc) { + contribTools.remove(tc); + } + + + public void rebuildToolList() { + // Only do this once because the list of internal tools will never change + if (internalTools == null) { + internalTools = new ArrayList<>(); + + initInternalTool("processing.app.tools.CreateFont"); + initInternalTool("processing.app.tools.ColorSelector"); + initInternalTool("processing.app.tools.Archiver"); + + if (Platform.isMacOS()) { + initInternalTool("processing.app.tools.InstallCommander"); + } + } + + // No need to reload these either + if (coreTools == null) { + coreTools = ToolContribution.loadAll(Base.getToolsFolder()); + for (Tool tool : coreTools) { + tool.init(this); + } + } + + // Rebuilt when new tools installed, etc + contribTools = ToolContribution.loadAll(Base.getSketchbookToolsFolder()); + for (Tool tool : contribTools) { + try { + tool.init(this); + + // With the exceptions, we can't call statusError because the window + // isn't completely set up yet. Also not gonna pop up a warning because + // people may still be running different versions of Processing. + + } catch (VerifyError ve) { + System.err.println("\"" + tool.getMenuTitle() + "\" is not " + + "compatible with this version of Processing"); + + } catch (NoSuchMethodError nsme) { + System.err.println("\"" + tool.getMenuTitle() + "\" is not " + + "compatible with this version of Processing"); + System.err.println("The " + nsme.getMessage() + " method no longer exists."); + Messages.loge("Incompatible Tool found during tool.init()", nsme); + + } catch (NoClassDefFoundError ncdfe) { + System.err.println("\"" + tool.getMenuTitle() + "\" is not " + + "compatible with this version of Processing"); + System.err.println("The " + ncdfe.getMessage() + " class is no longer available."); + Messages.loge("Incompatible Tool found during tool.init()", ncdfe); + + } catch (AbstractMethodError ame) { + System.err.println("\"" + tool.getMenuTitle() + "\" is not " + + "compatible with this version of Processing"); +// ame.printStackTrace(); + + } catch (Error err) { + System.err.println("An error occurred inside \"" + tool.getMenuTitle() + "\""); + err.printStackTrace(); + + } catch (Exception ex) { + System.err.println("An exception occurred inside \"" + tool.getMenuTitle() + "\""); + ex.printStackTrace(); + } + } + } + + + protected void initInternalTool(String className) { + try { + Class toolClass = Class.forName(className); + final Tool tool = (Tool) + toolClass.getDeclaredConstructor().newInstance(); + + tool.init(this); + internalTools.add(tool); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /* + Iterator editorIter = base.getEditors().iterator(); + while (editorIter.hasNext()) { + Editor editor = editorIter.next(); + List contribTools = editor.getToolContribs(); + for (ToolContribution toolContrib : contribTools) { + if (toolContrib.getName().equals(this.name)) { + try { + ((URLClassLoader) toolContrib.loader).close(); + editor.removeToolContrib(toolContrib); + break; + } catch (IOException e) { + e.printStackTrace(); + } + } + } + */ + + + public void clearToolMenus() { + for (Editor ed : editors) { + ed.clearToolMenu(); + } + } + + + public void populateToolsMenu(JMenu toolsMenu) { + // If this is the first run, need to build out the lists + if (internalTools == null) { + rebuildToolList(); + } +// coreTools = ToolContribution.loadAll(Base.getToolsFolder()); +// contribTools = ToolContribution.loadAll(Base.getSketchbookToolsFolder()); + +// Collections.sort(coreTools); +// Collections.sort(contribTools); +// Collections.sort(coreTools, new Comparator() { +// @Override +// public int compare(ToolContribution o1, ToolContribution o2) { +// return o1.getMenuTitle().compareTo(o2.getMenuTitle()); +// } +// }); + toolsMenu.removeAll(); + for (Tool tool : internalTools) { + toolsMenu.add(createToolItem(tool)); + } + toolsMenu.addSeparator(); + + if (coreTools.size() > 0) { + for (Tool tool : coreTools) { + toolsMenu.add(createToolItem(tool)); + } + toolsMenu.addSeparator(); + } + + if (contribTools.size() > 0) { + for (Tool tool : contribTools) { + toolsMenu.add(createToolItem(tool)); + } + toolsMenu.addSeparator(); + } + + JMenuItem item = new JMenuItem(Language.text("menu.tools.add_tool")); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + ContributionManager.openTools(); + } + }); + toolsMenu.add(item); + } + + + /* + static public void addTools(JMenu menu, List tools) { + Map toolItems = new HashMap(); + + for (final Tool tool : tools) { + // If init() fails, the item won't be added to the menu + addToolItem(tool, toolItems); + } + + List toolList = new ArrayList(toolItems.keySet()); + if (toolList.size() > 0) { + if (menu.getItemCount() != 0) { + menu.addSeparator(); + } + Collections.sort(toolList); + for (String title : toolList) { + menu.add(toolItems.get(title)); + } + } + } + */ + + + JMenuItem createToolItem(final Tool tool) { //, Map toolItems) { + String title = tool.getMenuTitle(); + final JMenuItem item = new JMenuItem(title); + item.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + try { + tool.run(); + + } catch (NoSuchMethodError nsme) { + activeEditor.statusError("\"" + tool.getMenuTitle() + "\" is not" + + "compatible with this version of Processing"); + //nsme.printStackTrace(); + Messages.loge("Incompatible tool found during tool.run()", nsme); + item.setEnabled(false); + + } catch (Exception ex) { + activeEditor.statusError("An error occurred inside \"" + tool.getMenuTitle() + "\""); + ex.printStackTrace(); + item.setEnabled(false); + } + } + }); + //toolItems.put(title, item); + return item; + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + public List getModeContribs() { return modeContribs; } public List getModeList() { - ArrayList allModes = new ArrayList(); + List allModes = new ArrayList<>(); allModes.addAll(Arrays.asList(coreModes)); if (modeContribs != null) { for (ModeContribution contrib : modeContribs) { @@ -448,14 +896,14 @@ public List getExampleContribs() { private List getInstalledContribs() { - List contributions = new ArrayList(); + List contributions = new ArrayList<>(); List modeContribs = getModeContribs(); contributions.addAll(modeContribs); for (ModeContribution modeContrib : modeContribs) { Mode mode = modeContrib.getMode(); - contributions.addAll(new ArrayList(mode.contribLibraries)); + contributions.addAll(new ArrayList<>(mode.contribLibraries)); } // TODO this duplicates code in Editor, but it's not editor-specific @@ -476,11 +924,11 @@ public byte[] getInstalledContribsInfo() { String entry = c.getTypeName() + "=" + PApplet.urlEncode(String.format("name=%s\nurl=%s\nrevision=%d\nversion=%s", c.getName(), c.getUrl(), - c.getVersion(), c.getPrettyVersion())); + c.getVersion(), c.getBenignVersion())); entries.append(entry); } String joined = - "id=" + Preferences.get("update.id") + "&" + entries.join("&"); + "id=" + UpdateCheck.getUpdateID() + "&" + entries.join("&"); // StringBuilder sb = new StringBuilder(); // try { // // Truly ridiculous attempt to shove everything into a GET request. @@ -538,14 +986,16 @@ public Mode getNextMode() { /** * The call has already checked to make sure this sketch is not modified, * now change the mode. + * @return true if mode is changed. */ - public void changeMode(Mode mode) { - if (activeEditor.getMode() != mode) { + public boolean changeMode(Mode mode) { + Mode oldMode = activeEditor.getMode(); + if (oldMode != mode) { Sketch sketch = activeEditor.getSketch(); nextMode = mode; if (sketch.isUntitled()) { - // If no changes have been made, just close and start fresh. + // The current sketch is empty, just close and start fresh. // (Otherwise the editor would lose its 'untitled' status.) handleClose(activeEditor, true); handleNew(); @@ -554,20 +1004,30 @@ public void changeMode(Mode mode) { // If the current editor contains file extensions that the new mode can handle, then // write a sketch.properties file with the new mode specified, and reopen. boolean newModeCanHandleCurrentSource = true; - for (final SketchCode code: sketch.getCode()) { + for (final SketchCode code : sketch.getCode()) { if (!mode.validExtension(code.getExtension())) { newModeCanHandleCurrentSource = false; break; } } - if (newModeCanHandleCurrentSource) { + if (!newModeCanHandleCurrentSource) { + return false; + } else { final File props = new File(sketch.getCodeFolder(), "sketch.properties"); saveModeSettings(props, nextMode); handleClose(activeEditor, true); - handleOpen(sketch.getMainFilePath()); + Editor editor = handleOpen(sketch.getMainFilePath()); + if (editor == null) { + // the Mode change failed (probably code that's out of date) + // re-open the sketch using the mode we were in before + saveModeSettings(props, oldMode); + handleOpen(sketch.getMainFilePath()); + return false; + } } } } + return true; } @@ -607,7 +1067,7 @@ private static ModeInfo modeInfoFor(final File sketch) { private Mode promptForMode(final File sketch, final ModeInfo preferredMode) { final String extension = sketch.getName().substring(sketch.getName().lastIndexOf('.') + 1); - final List possibleModes = new ArrayList(); + final List possibleModes = new ArrayList<>(); for (final Mode mode : getModeList()) { if (mode.canEdit(sketch)) { possibleModes.add(mode); @@ -620,15 +1080,15 @@ private Mode promptForMode(final File sketch, final ModeInfo preferredMode) { } if (possibleModes.size() == 0) { if (preferredMode == null) { - Messages.showWarning("Modeless Dialog", - "I don't know how to open a sketch with the \"" - + extension - + "\"\nfile extension. You'll have to install a different" - + "\nProcessing mode for that."); + final String msg = + "I don't know how to open a sketch with the \"" + extension + "\"\n" + + "file extension. You'll have to install a different\n" + + "Mode for that."; + Messages.showWarning("Modeless Dialog", msg); } else { Messages.showWarning("Modeless Dialog", - "You'll have to install " - + preferredMode.title + " Mode " + "\nin order to open that sketch."); + "Install " + preferredMode.title + " Mode " + + "to open this sketch."); } return null; } @@ -735,12 +1195,17 @@ public void handleNew() { // Make the directory for the new sketch newbieDir.mkdirs(); + // Add any template files from the Mode itself + File newbieFile = nextMode.addTemplateFiles(newbieDir, newbieName); + + /* // Make an empty pde file File newbieFile = new File(newbieDir, newbieName + "." + nextMode.getDefaultExtension()); //$NON-NLS-1$ if (!newbieFile.createNewFile()) { throw new IOException(newbieFile + " already exists."); } + */ // Create sketch properties file if it's not the default mode. if (!nextMode.equals(getDefaultMode())) { @@ -762,9 +1227,9 @@ public void handleNew() { * Prompt for a sketch to open, and open it in a new window. */ public void handleOpenPrompt() { - final ArrayList extensions = new ArrayList(); + final StringList extensions = new StringList(); for (Mode mode : getModeList()) { - extensions.add(mode.getDefaultExtension()); + extensions.append(mode.getDefaultExtension()); } @@ -894,6 +1359,8 @@ protected Editor handleOpen(String path, boolean untitled, try { Editor editor = nextMode.createEditor(this, path, state); + editor.setUpdatesAvailable(updatesAvailable); + // opened successfully, let's go to work editor.getSketch().setUntitled(untitled); editors.add(editor); @@ -906,7 +1373,7 @@ protected Editor handleOpen(String path, boolean untitled, return editor; } catch (EditorException ee) { - if (!ee.getMessage().equals("")) { // blank if the user canceled + if (ee.getMessage() != null) { // null if the user canceled Messages.showWarning("Error opening sketch", ee.getMessage(), ee); } } catch (NoSuchMethodError nsme) { @@ -915,16 +1382,41 @@ protected Editor handleOpen(String path, boolean untitled, "Try updating the Mode or contact its author for a new version.", nsme); } catch (Throwable t) { if (nextMode.equals(getDefaultMode())) { - Messages.showBadnessTrace("Serious Problem", - "An unexpected, unknown, and unrecoverable error occurred\n" + - "while opening a new editor window. Please report this.", t, true); + Messages.showTrace("Serious Problem", + "An unexpected, unknown, and unrecoverable error occurred\n" + + "while opening a new editor window. Please report this.", t, true); } else { - Messages.showBadnessTrace("Mode Problems", - "A nasty error occurred while trying to use " + nextMode.getTitle() + ".\n" + - "It may not be compatible with this version of Processing.\n" + - "Try updating the Mode or contact its author for a new version.", t, false); + Messages.showTrace("Mode Problems", + "A nasty error occurred while trying to use " + nextMode.getTitle() + ".\n" + + "It may not be compatible with this version of Processing.\n" + + "Try updating the Mode or contact its author for a new version.", t, false); } } + if (editors.isEmpty()) { + Mode defaultMode = getDefaultMode(); + if (nextMode == defaultMode) { + // unreachable? hopefully? + Messages.showError("Editor Problems", + "An error occurred while trying to change modes.\n" + + "We'll have to quit for now because it's an\n" + + "unfortunate bit of indigestion with the default Mode.", + null); + } else { + // Don't leave the user hanging or the PDE locked up + // https://github.com/processing/processing/issues/4467 + if (untitled) { + nextMode = defaultMode; + handleNew(); + return null; // ignored by any caller + + } else { + // This null response will be kicked back to changeMode(), + // signaling it to re-open the sketch in the default Mode. + return null; + } + } + } + /* if (editors.isEmpty()) { // if the bad mode is the default mode, don't go into an infinite loop @@ -943,10 +1435,10 @@ protected Editor handleOpen(String path, boolean untitled, */ } catch (Throwable t) { - Messages.showBadnessTrace("Terrible News", - "A serious error occurred while " + - "trying to create a new editor window.", t, - nextMode == getDefaultMode()); // quit if default + Messages.showTrace("Terrible News", + "A serious error occurred while " + + "trying to create a new editor window.", t, + nextMode == getDefaultMode()); // quit if default nextMode = getDefaultMode(); } return null; @@ -1011,8 +1503,8 @@ public boolean handleClose(Editor editor, boolean modeSwitch) { Preferences.unset("server.port"); //$NON-NLS-1$ Preferences.unset("server.key"); //$NON-NLS-1$ - // This will store the sketch count as zero - editors.remove(editor); +// // This will store the sketch count as zero +// editors.remove(editor); // System.out.println("editors size now " + editors.size()); // storeSketches(); @@ -1066,6 +1558,9 @@ public boolean handleQuit() { // Save out the current prefs state Preferences.save(); + // Finished with this guy + Console.shutdown(); + if (!Platform.isMacOS()) { // If this was fired from the menu or an AppleEvent (the Finder), // then Mac OS X will send the terminate signal itself. @@ -1204,6 +1699,15 @@ protected boolean addSketches(JMenu menu, File folder, return false; // let's not go there } + if (folder.getName().equals("sdk")) { + // This could be Android's SDK folder. Let's double check: + File suspectSDKPath = new File(folder.getParent(), folder.getName()); + File expectedSDKPath = new File(sketchbookFolder, "android" + File.separator + "sdk"); + if (expectedSDKPath.getAbsolutePath().equals(suspectSDKPath.getAbsolutePath())) { + return false; // Most likely the SDK folder, skip it + } + } + String[] list = folder.list(); // If a bad folder or unreadable or whatever, this will come back null if (list == null) { @@ -1404,18 +1908,21 @@ static public File getSettingsFolder() { try { settingsFolder = Platform.getSettingsFolder(); - } catch (Exception e) { - Messages.showError("Problem getting the settings folder", - "Error getting the Processing the settings folder.", e); - } - // create the folder if it doesn't exist already - if (!settingsFolder.exists()) { - if (!settingsFolder.mkdirs()) { - Messages.showError("Settings issues", - "Processing cannot run because it could not\n" + - "create a folder to store your settings.", null); + // create the folder if it doesn't exist already + if (!settingsFolder.exists()) { + if (!settingsFolder.mkdirs()) { + Messages.showError("Settings issues", + "Processing cannot run because it could not\n" + + "create a folder to store your settings.\n" + + settingsFolder.getAbsolutePath(), null); + } } + } catch (Exception e) { + Messages.showTrace("An rare and unknowable thing happened", + "Could not get the settings folder. Please report:\n" + + "http://github.com/processing/processing/issues/new", + e, true); } return settingsFolder; } @@ -1449,7 +1956,7 @@ static public void locateSketchbookFolder() { "Processing will switch to the default sketchbook\n" + "location, and create a new sketchbook folder if\n" + "necessary. Processing will then stop talking\n" + - "about himself in the third person.", null); + "about itself in the third person.", null); sketchbookFolder = null; } } @@ -1482,6 +1989,7 @@ static protected void makeSketchbookSubfolders() { getSketchbookToolsFolder().mkdirs(); getSketchbookModesFolder().mkdirs(); getSketchbookExamplesFolder().mkdirs(); + getSketchbookTemplatesFolder().mkdirs(); } @@ -1510,6 +2018,11 @@ static public File getSketchbookExamplesFolder() { } + static public File getSketchbookTemplatesFolder() { + return new File(sketchbookFolder, "templates"); + } + + static protected File getDefaultSketchbookFolder() { File sketchbookFolder = null; try { diff --git a/app/src/processing/app/BaseSplash.java b/app/src/processing/app/BaseSplash.java new file mode 100644 index 0000000000..5dc125f6a1 --- /dev/null +++ b/app/src/processing/app/BaseSplash.java @@ -0,0 +1,24 @@ +package processing.app; + +import java.io.File; + +import processing.app.ui.SplashWindow; +import processing.app.ui.Toolkit; + + +public class BaseSplash { + static public void main(String[] args) { + try { + final boolean hidpi = Toolkit.highResImages(); + final String filename = "lib/about-" + (hidpi ? 2 : 1) + "x.png"; + File splashFile = Platform.getContentFile(filename); + SplashWindow.splash(splashFile.toURI().toURL(), hidpi); + SplashWindow.invokeMain("processing.app.Base", args); + SplashWindow.disposeSplash(); + } catch (Exception e) { + e.printStackTrace(); + // !@#!@$$! umm + //SplashWindow.invokeMain("processing.app.Base", args); + } + } +} \ No newline at end of file diff --git a/app/src/processing/app/Console.java b/app/src/processing/app/Console.java new file mode 100644 index 0000000000..73b652f337 --- /dev/null +++ b/app/src/processing/app/Console.java @@ -0,0 +1,261 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2012-16 The Processing Foundation + Copyright (c) 2004-12 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 java.text.SimpleDateFormat; +import java.util.Date; + + +/** + * Non-GUI handling of System.out and System.err redirection. + *

+ * Be careful when debugging this class, because if it's throwing exceptions, + * don't take over System.err, and debug while watching just System.out + * or just call println() or whatever directly to systemOut or systemErr. + *

+ * Also note that encodings will not work properly when run from Eclipse. This + * means that if you use non-ASCII characters in a println() or some such, + * the characters won't print properly in the Processing and/or Eclipse console. + * It seems that Eclipse's console-grabbing and that of Processing don't + * get along with one another. Use 'ant run' to work on encoding-related issues. + */ +public class Console { + // 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. + + /** The original System.out */ + static PrintStream systemOut; + /** The original System.err */ + static PrintStream systemErr; + + /** Our replacement System.out */ + static PrintStream consoleOut; + /** Our replacement System.err */ + static PrintStream consoleErr; + + /** All stdout also written to a file */ + static OutputStream stdoutFile; + /** All stderr also written to a file */ + static OutputStream stderrFile; + + /** stdout listener for the currently active Editor */ + static OutputStream editorOut; + /** stderr listener for the currently active Editor */ + static OutputStream editorErr; + + + static public void startup() { + if (systemOut != null) { + // TODO fix this dreadful style choice in how the Console is initialized + // (This is not good code.. startup() should gracefully deal with this. + // It's just a low priority relative to the likelihood of trouble.) + new Exception("startup() called more than once").printStackTrace(systemErr); + return; + } + systemOut = System.out; + systemErr = System.err; + + // placing everything inside a try block because this can be a dangerous + // time for the lights to blink out and crash for and obscure reason. + try { + SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd_HHmmss"); + // Moving away from a random string in 0256 (and adding hms) because + // the random digits looked like times anyway, causing confusion. + //String randy = String.format("%04d", (int) (1000 * Math.random())); + //final String stamp = formatter.format(new Date()) + "_" + randy; + final String stamp = formatter.format(new Date()); + + File consoleDir = Base.getSettingsFile("console"); + if (consoleDir.exists()) { + // clear old debug files + File[] stdFiles = consoleDir.listFiles(new FileFilter() { + final String todayPrefix = stamp.substring(0, 4); + + public boolean accept(File file) { + if (!file.isDirectory()) { + String name = file.getName(); + if (name.endsWith(".err") || name.endsWith(".out")) { + // don't delete any of today's debug messages + return !name.startsWith(todayPrefix); + } + } + return false; + } + }); + // Remove any files that aren't from today + for (File file : stdFiles) { + file.delete(); + } + } else { + consoleDir.mkdirs(); + consoleDir.setWritable(true, false); + } + + File outFile = new File(consoleDir, stamp + ".out"); + outFile.setWritable(true, false); + stdoutFile = new FileOutputStream(outFile); + File errFile = new File(consoleDir, stamp + ".err"); + errFile.setWritable(true, false); + stderrFile = new FileOutputStream(errFile); + + consoleOut = new PrintStream(new ConsoleStream(false)); + consoleErr = new PrintStream(new ConsoleStream(true)); + + System.setOut(consoleOut); + System.setErr(consoleErr); + + } catch (Exception e) { + stdoutFile = null; + stderrFile = null; + + consoleOut = null; + consoleErr = null; + + System.setOut(systemOut); + System.setErr(systemErr); + + e.printStackTrace(); + } + } + + + static public void setEditor(OutputStream out, OutputStream err) { + editorOut = out; + editorErr = err; + } + + + static public void systemOut(String what) { + systemOut.println(what); + } + + + static public void systemErr(String what) { + systemErr.println(what); + } + + + /** + * 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. + */ + static public void shutdown() { + // replace original streams to remove references to console's streams + System.setOut(systemOut); + System.setErr(systemErr); + + cleanup(consoleOut); + cleanup(consoleErr); + + // also have to close the original FileOutputStream + // otherwise it won't be shut down completely + cleanup(stdoutFile); + cleanup(stderrFile); + } + + + static private void cleanup(OutputStream output) { + try { + if (output != null) { + output.flush(); + output.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + static class ConsoleStream extends OutputStream { + boolean err; // whether stderr or stdout + byte single[] = new byte[1]; + + public ConsoleStream(boolean err) { + this.err = err; + } + + public void close() { } + + public void flush() { } + + public void write(byte b[]) { // appears never to be used + write(b, 0, b.length); + } + + public void write(byte b[], int offset, int length) { + // First write to the original stdout/stderr + if (err) { + systemErr.write(b, offset, length); + } else { + systemOut.write(b, offset, length); + } + + // Write to the files that are storing this information + writeFile(b, offset, length); + + // Write to the console of the current Editor, if any + try { + if (err) { + if (editorErr != null) { + editorErr.write(b, offset, length); + } + } else { + if (editorOut != null) { + editorOut.write(b, offset, length); + } + } + } catch (IOException e) { + // Avoid this function being called in a recursive, infinite loop + e.printStackTrace(systemErr); + } + } + + public void writeFile(byte b[], int offset, int length) { + final OutputStream echo = err ? stderrFile : stdoutFile; + if (echo != null) { + try { + echo.write(b, offset, length); + echo.flush(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + public void write(int b) { + single[0] = (byte) b; + write(single, 0, 1); + } + } +} \ No newline at end of file diff --git a/app/src/processing/app/Language.java b/app/src/processing/app/Language.java index 5fab731c18..06be82fc5a 100644 --- a/app/src/processing/app/Language.java +++ b/app/src/processing/app/Language.java @@ -87,18 +87,22 @@ private Language() { static private String[] listSupported() { // List of languages in alphabetical order. (Add yours here.) - // Also remember to add it to the corresponding build/build.xml rule. + // Also remember to add it to build/shared/lib/languages/languages.txt. final String[] SUPPORTED = { + "ar", // Arabic "de", // German, Deutsch "en", // English "el", // Greek "es", // Spanish "fr", // French, Français + "it", // Italiano, Italian "ja", // Japanese "ko", // Korean "nl", // Dutch, Nederlands "pt", // Portuguese + "ru", // Russian "tr", // Turkish + "uk", // Ukrainian "zh" // Chinese }; return SUPPORTED; @@ -145,6 +149,7 @@ static private String loadLanguage() { static public void saveLanguage(String language) { try { Util.saveFile(language, prefFile); + prefFile.setWritable(true, false); } catch (Exception e) { e.printStackTrace(); } @@ -212,6 +217,14 @@ static public String pluralize(String key, int count) { } + /** + * @param which either yes, no, cancel, ok, or browse + */ + static public String getPrompt(String which) { + return Language.text("prompt." + which); + } + + /** Get all available languages */ static public Map getLanguages() { return init().languages; @@ -227,6 +240,18 @@ static public String getLanguage() { } + /** + * Is this a CJK language where Input Method support is suggested/required? + * @return true if the user is running in Japanese, Korean, or Chinese + */ + static public boolean useInputMethod() { + final String language = getLanguage(); + return (language.equals("ja") || + language.equals("ko") || + language.equals("zh")); + } + + // /** Set new language (called by Preferences) */ // static public void setLanguage(String language) { // this.language = language; @@ -307,6 +332,9 @@ static class LanguageBundle { void read(File additions) { String[] lines = PApplet.loadStrings(additions); + if (lines == null) { + throw new NullPointerException("File not found:\n" + additions.getAbsolutePath()); + } //for (String line : lines) { for (int i = 0; i < lines.length; i++) { String line = lines[i]; diff --git a/app/src/processing/app/Library.java b/app/src/processing/app/Library.java index 7a5eb0dd9e..34bc6360e1 100644 --- a/app/src/processing/app/Library.java +++ b/app/src/processing/app/Library.java @@ -28,7 +28,7 @@ public class Library extends LocalContribution { StringList packageList; /** Per-platform exports for this library. */ - HashMap exportList; + HashMap exportList; /** Applet exports (cross-platform by definition). */ String[] appletExportList; @@ -71,6 +71,7 @@ public boolean accept(File dir, String name) { if (name.equals("linux32")) return false; if (name.equals("linux64")) return false; if (name.equals("linux-armv6hf")) return false; + if (name.equals("linux-arm64")) return false; if (name.equals("android")) return false; } return true; @@ -115,11 +116,19 @@ private Library(File folder, String groupName) { examplesFolder = new File(folder, "examples"); referenceFile = new File(folder, "reference/index.html"); + handle(); + } + + + /** + * Handles all the Java-specific parsing for library handling. + */ + protected void handle() { File exportSettings = new File(libraryFolder, "export.txt"); StringDict exportTable = exportSettings.exists() ? Util.readSettings(exportSettings) : new StringDict(); - exportList = new HashMap(); + exportList = new HashMap<>(); // get the list of files just in the library root String[] baseList = libraryFolder.list(standardFilter); @@ -165,6 +174,12 @@ private Library(File folder, String groupName) { nativeLibraryFolder = hostLibrary; } } + if (hostPlatform.equals("linux") && System.getProperty("os.arch").equals("aarch64")) { + hostLibrary = new File(libraryFolder, "linux-arm64"); + if (hostLibrary.exists()) { + nativeLibraryFolder = hostLibrary; + } + } // save that folder for later use nativeLibraryPath = nativeLibraryFolder.getAbsolutePath(); @@ -174,7 +189,8 @@ private Library(File folder, String groupName) { String platformName = platformNames[i]; String platformName32 = platformName + "32"; String platformName64 = platformName + "64"; - String platformNameArmv6hh = platformName + "-armv6hf"; + String platformNameArmv6hf = platformName + "-armv6hf"; + String platformNameArm64 = platformName + "-arm64"; // First check for things like 'application.macosx=' or 'application.windows32' in the export.txt file. // These will override anything in the platform-specific subfolders. @@ -186,6 +202,8 @@ private Library(File folder, String groupName) { String[] platformList64 = platform64 == null ? null : PApplet.splitTokens(platform64, ", "); String platformArmv6hf = exportTable.get("application." + platformName + "-armv6hf"); String[] platformListArmv6hf = platformArmv6hf == null ? null : PApplet.splitTokens(platformArmv6hf, ", "); + String platformArm64 = exportTable.get("application." + platformName + "-arm64"); + String[] platformListArm64 = platformArm64 == null ? null : PApplet.splitTokens(platformArm64, ", "); // If nothing specified in the export.txt entries, look for the platform-specific folders. if (platformAll == null) { @@ -198,16 +216,19 @@ private Library(File folder, String groupName) { platformList64 = listPlatformEntries(libraryFolder, platformName64, baseList); } if (platformListArmv6hf == null) { - platformListArmv6hf = listPlatformEntries(libraryFolder, platformNameArmv6hh, baseList); + platformListArmv6hf = listPlatformEntries(libraryFolder, platformNameArmv6hf, baseList); + } + if (platformListArm64 == null) { + platformListArm64 = listPlatformEntries(libraryFolder, platformNameArm64, baseList); } - if (platformList32 != null || platformList64 != null || platformListArmv6hf != null) { + if (platformList32 != null || platformList64 != null || platformListArmv6hf != null || platformListArm64 != null) { multipleArch[i] = true; } // if there aren't any relevant imports specified or in their own folders, // then use the baseList (root of the library folder) as the default. - if (platformList == null && platformList32 == null && platformList64 == null && platformListArmv6hf == null) { + if (platformList == null && platformList32 == null && platformList64 == null && platformListArmv6hf == null && platformListArm64 == null) { exportList.put(platformName, baseList); } else { @@ -223,7 +244,10 @@ private Library(File folder, String groupName) { exportList.put(platformName64, platformList64); } if (platformListArmv6hf != null) { - exportList.put(platformNameArmv6hh, platformListArmv6hf); + exportList.put(platformNameArmv6hf, platformListArmv6hf); + } + if (platformListArm64 != null) { + exportList.put(platformNameArm64, platformListArm64); } } } @@ -258,7 +282,7 @@ static String[] listPlatformEntries(File libraryFolder, String folderName, Strin } - static protected HashMap packageWarningMap = new HashMap(); + static protected HashMap packageWarningMap = new HashMap<>(); /** * Add the packages provided by this library to the master list that maps @@ -274,7 +298,7 @@ public void addPackageList(Map> importToLibraryTable) { // Library library = importToLibraryTable.get(pkg); List libraries = importToLibraryTable.get(pkg); if (libraries == null) { - libraries = new ArrayList(); + libraries = new ArrayList<>(); importToLibraryTable.put(pkg, libraries); } else { if (Base.DEBUG) { @@ -338,10 +362,13 @@ public String getClassPath() { cp.append(File.pathSeparatorChar); cp.append(new File(libraryFolder, jar).getAbsolutePath()); } - jarHeads = new File(nativeLibraryPath).list(jarFilter); - for (String jar : jarHeads) { - cp.append(File.pathSeparatorChar); - cp.append(new File(nativeLibraryPath, jar).getAbsolutePath()); + File nativeLibraryFolder = new File(nativeLibraryPath); + if (!libraryFolder.equals(nativeLibraryFolder)) { + jarHeads = new File(nativeLibraryPath).list(jarFilter); + for (String jar : jarHeads) { + cp.append(File.pathSeparatorChar); + cp.append(new File(nativeLibraryPath, jar).getAbsolutePath()); + } } //cp.setLength(cp.length() - 1); // remove the last separator return cp.toString(); @@ -401,6 +428,9 @@ public String[] getApplicationExportList(int platform, String variant) { } else if (variant.equals("armv6hf")) { String[] pieces = exportList.get(platformName + "-armv6hf"); if (pieces != null) return pieces; + } else if (variant.equals("arm64")) { + String[] pieces = exportList.get(platformName + "-arm64"); + if (pieces != null) return pieces; } return exportList.get(platformName); } @@ -431,12 +461,7 @@ public boolean supportsArch(int platform, String variant) { static public boolean hasMultipleArch(int platform, List libraries) { - for (Library library : libraries) { - if (library.hasMultipleArch(platform)) { - return true; - } - } - return false; + return libraries.stream().anyMatch(library -> library.hasMultipleArch(platform)); } @@ -445,24 +470,26 @@ static public boolean hasMultipleArch(int platform, List libraries) { static protected FilenameFilter junkFolderFilter = new FilenameFilter() { public boolean accept(File dir, String name) { - // skip .DS_Store files, .svn folders, etc + // skip .DS_Store files, .svn and .git folders, etc if (name.charAt(0) == '.') return false; - if (name.equals("CVS")) return false; - return (new File(dir, name).isDirectory()); + if (name.equals("CVS")) return false; // old skool + return new File(dir, name).isDirectory(); } }; static public List discover(File folder) { - List libraries = new ArrayList(); + List libraries = new ArrayList<>(); String[] folderNames = folder.list(junkFolderFilter); - // if a bad folder or something like that, this might come back null + // if a bad folder or unreadable, folderNames might be null if (folderNames != null) { // alphabetize list, since it's not always alpha order // replaced hella slow bubble sort with this feller for 0093 Arrays.sort(folderNames, String.CASE_INSENSITIVE_ORDER); + // TODO some weirdness because ContributionType.LIBRARY.isCandidate() + // handles some, but not all, of this [fry 200116] for (String potentialName : folderNames) { File baseFolder = new File(folder, potentialName); File libraryFolder = new File(baseFolder, "library"); @@ -475,11 +502,10 @@ static public List discover(File folder) { libraries.add(baseFolder); } else { - String mess = "The library \"" - + potentialName - + "\" 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)"; + final String mess = + "The library \"" + potentialName + "\" 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)"; Messages.showMessage("Ignoring bad library name", mess); continue; } @@ -491,14 +517,15 @@ static public List discover(File folder) { static public List list(File folder) { - List libraries = new ArrayList(); - List librariesFolders = new ArrayList(); + List libraries = new ArrayList<>(); + List librariesFolders = new ArrayList<>(); librariesFolders.addAll(discover(folder)); for (File baseFolder : librariesFolders) { libraries.add(new Library(baseFolder)); } + /* // Support libraries inside of one level of subfolders? I believe this was // the compromise for supporting library groups, but probably a bad idea // because it's not compatible with the Manager. @@ -515,6 +542,7 @@ static public List list(File folder) { } } } + */ return libraries; } diff --git a/app/src/processing/app/Messages.java b/app/src/processing/app/Messages.java index 3be3f312e4..d8c78d43f1 100644 --- a/app/src/processing/app/Messages.java +++ b/app/src/processing/app/Messages.java @@ -155,8 +155,8 @@ static public void showError(String title, String message, Throwable e) { /** * Testing a new warning window that includes the stack trace. */ - static void showBadnessTrace(String title, String message, - Throwable t, boolean fatal) { + static public void showTrace(String title, String message, + Throwable t, boolean fatal) { if (title == null) title = fatal ? "Error" : "Warning"; if (Base.isCommandLine()) { @@ -265,6 +265,34 @@ static public int showYesNoQuestion(Frame editor, String title, "
" + secondary, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); + } else { + int result = showCustomQuestion(editor, title, primary, secondary, + 0, "Yes", "No"); + if (result == 0) { + return JOptionPane.YES_OPTION; + } else if (result == 1) { + return JOptionPane.NO_OPTION; + } else { + return JOptionPane.CLOSED_OPTION; + } + } + } + + + /** + * @param highlight A valid array index for options[] that specifies the + * default (i.e. safe) choice. + * @return The (zero-based) index of the selected value, -1 otherwise. + */ + static public int showCustomQuestion(Frame editor, String title, + String primary, String secondary, + int highlight, String... options) { + Object result; + if (!Platform.isMacOS()) { + return JOptionPane.showOptionDialog(editor, + "" + primary + "
" + secondary, title, + JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, + options, options[highlight]); } else { // Pane formatting adapted from the Quaqua guide // http://www.randelshofer.ch/quaqua/guide/joptionpane.html @@ -275,29 +303,23 @@ static public int showYesNoQuestion(Frame editor, String title, "p { font: 11pt \"Lucida Grande\"; margin-top: 8px; width: 300px }"+ " " + "" + primary + "" + - "

" + secondary + "

", + "

" + secondary, // + "

", JOptionPane.QUESTION_MESSAGE); - String[] options = new String[] { - "Yes", "No" - }; pane.setOptions(options); // highlight the safest option ala apple hig - pane.setInitialValue(options[0]); + pane.setInitialValue(options[highlight]); JDialog dialog = pane.createDialog(editor, null); dialog.setVisible(true); - Object result = pane.getValue(); - if (result == options[0]) { - return JOptionPane.YES_OPTION; - } else if (result == options[1]) { - return JOptionPane.NO_OPTION; - } else { - return JOptionPane.CLOSED_OPTION; - } + result = pane.getValue(); } + for (int i = 0; i < options.length; i++) { + if (result != null && result.equals(options[i])) return i; + } + return -1; } @@ -327,7 +349,9 @@ static public void logf(String message, Object... args) { static public void loge(String message, Throwable e) { if (Base.DEBUG) { - System.err.println(message); + if (message != null) { + System.err.println(message); + } e.printStackTrace(); } } @@ -335,7 +359,7 @@ static public void loge(String message, Throwable e) { static public void loge(String message) { if (Base.DEBUG) { - System.out.println(message); + System.err.println(message); } } -} \ No newline at end of file +} diff --git a/app/src/processing/app/Mode.java b/app/src/processing/app/Mode.java index 148d571f25..9c87f7232b 100644 --- a/app/src/processing/app/Mode.java +++ b/app/src/processing/app/Mode.java @@ -53,8 +53,7 @@ public abstract class Mode { protected File folder; protected TokenMarker tokenMarker; - protected Map keywordToReference = - new HashMap(); + protected Map keywordToReference = new HashMap<>(); protected Settings theme; // protected Formatter formatter; @@ -166,7 +165,13 @@ protected void loadKeywords(File keywordFile, if (htmlFilename.endsWith("_")) { keyword += "_"; } - keywordToReference.put(keyword, htmlFilename); + // Allow the bare size() command to override the lookup + // for StringList.size() and others, but not vice-versa. + // https://github.com/processing/processing/issues/4224 + boolean seen = keywordToReference.containsKey(keyword); + if (!seen || (seen && keyword.equals(htmlFilename))) { + keywordToReference.put(keyword, htmlFilename); + } } } } @@ -206,11 +211,17 @@ public void setupGUI() { theme.load(modeTheme); } + // Against my better judgment, adding the ability to override themes + // https://github.com/processing/processing/issues/5445 + File sketchbookTheme = + new File(Base.getSketchbookFolder(), "theme.txt"); + if (sketchbookTheme.exists()) { + theme.load(sketchbookTheme); + } + // other things that have to be set explicitly for the defaults theme.setColor("run.window.bgcolor", SystemColor.control); -// loadBackground(); - } catch (IOException e) { Messages.showError("Problem loading theme.txt", "Could not load theme.txt, please re-install Processing", e); @@ -228,6 +239,71 @@ public InputStream getContentStream(String path) throws FileNotFoundException { } + /** + * Add files to a folder to create an empty sketch. This can be overridden + * to add template files to a sketch for Modes that need them. + * + * @param sketchFolder the directory where the new sketch should live + * @param sketchName the name of the new sketch + * @return the main file for the sketch to be opened via handleOpen() + * @throws IOException if the file somehow already exists + */ + public File addTemplateFiles(File sketchFolder, + String sketchName) throws IOException { + // Make an empty .pde file + File newbieFile = + new File(sketchFolder, sketchName + "." + getDefaultExtension()); + + try { + // First see if the user has overridden the default template + File templateFolder = checkSketchbookTemplate(); + + // Next see if the Mode has its own template + if (templateFolder == null) { + templateFolder = getTemplateFolder(); + } + if (templateFolder.exists()) { + Util.copyDir(templateFolder, sketchFolder); + File templateFile = + new File(sketchFolder, "sketch." + getDefaultExtension()); + if (!templateFile.renameTo(newbieFile)) { + System.err.println("Error while assigning the sketch template."); + } + } else { + if (!newbieFile.createNewFile()) { + System.err.println(newbieFile + " already exists."); + } + } + } catch (Exception e) { + // just spew out this error and try to recover below + e.printStackTrace(); + } + return newbieFile; + } + + + /** + * See if the user has their own template for this Mode. If the default + * extension is "pde", this will look for a file called sketch.pde to use + * as the template for all sketches. + */ + protected File checkSketchbookTemplate() { + File user = new File(Base.getSketchbookTemplatesFolder(), getTitle()); + if (user.exists()) { + File template = new File(user, "sketch." + getDefaultExtension()); + if (template.exists() && template.canRead()) { + return user; + } + } + return null; + } + + + public File getTemplateFolder() { + return getContentFile("template"); + } + + /** * Return the pretty/printable/menu name for this mode. This is separate from * the single word name of the folder that contains this mode. It could even @@ -282,11 +358,11 @@ public File getReferenceFolder() { public void rebuildLibraryList() { //new Exception("Rebuilding library list").printStackTrace(System.out); // reset the table mapping imports to libraries - importToLibraryTable = new HashMap>(); + Map> newTable = new HashMap<>(); Library core = getCoreLibrary(); if (core != null) { - core.addPackageList(importToLibraryTable); + core.addPackageList(newTable); } coreLibraries = Library.list(librariesFolder); @@ -304,24 +380,19 @@ public void rebuildLibraryList() { coreLibraries.addAll(foundationLibraries); contribLibraries.removeAll(foundationLibraries); - /* - File sketchbookLibs = Base.getSketchbookLibrariesFolder(); - File videoFolder = new File(sketchbookLibs, "video"); - if (videoFolder.exists()) { - coreLibraries.add(new Library(videoFolder)); - } - File soundFolder = new File(sketchbookLibs, "sound"); - if (soundFolder.exists()) { - coreLibraries.add(new Library(soundFolder)); - } - */ - for (Library lib : coreLibraries) { - lib.addPackageList(importToLibraryTable); + lib.addPackageList(newTable); } for (Library lib : contribLibraries) { - lib.addPackageList(importToLibraryTable); + lib.addPackageList(newTable); + } + + // Make this Map thread-safe + importToLibraryTable = Collections.unmodifiableMap(newTable); + + if (base != null) { + base.getEditors().forEach(Editor::librariesChanged); } } @@ -416,7 +487,7 @@ public void actionPerformed(ActionEvent e) { item = new JMenuItem(Language.text("examples.add_examples")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - ContributionManager.openExampleManager(base.getActiveEditor()); + ContributionManager.openExamples(); } }); toolbarMenu.add(item); @@ -492,7 +563,7 @@ public void rebuildImportMenu() { //JMenu importMenu) { JMenuItem addLib = new JMenuItem(Language.text("menu.library.add_library")); addLib.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - ContributionManager.openLibraryManager(base.getActiveEditor()); + ContributionManager.openLibraries(); } }); importMenu.add(addLib); @@ -534,7 +605,7 @@ public void actionPerformed(ActionEvent e) { contrib.setEnabled(false); importMenu.add(contrib); - HashMap subfolders = new HashMap(); + HashMap subfolders = new HashMap<>(); for (Library library : contribLibraries) { JMenuItem item = new JMenuItem(library.getName()); @@ -560,6 +631,18 @@ public void actionPerformed(ActionEvent e) { } + /** + * Require examples to explicitly state that they're compatible with this + * Mode before they're included. Helpful for Modes like p5js or Python + * where the .java examples cannot be used. + * @since 3.2 + * @return true if an examples package must list this Mode's identifier + */ + public boolean requireExampleCompatibility() { + return false; + } + + /** * Override this to control the order of the first set of example folders * and how they appear in the examples window. @@ -580,6 +663,7 @@ public void rebuildExamplesFrame() { if (visible) { bounds = examplesFrame.getBounds(); examplesFrame.setVisible(false); + examplesFrame.dispose(); } examplesFrame = null; if (visible) { @@ -615,11 +699,19 @@ public DefaultMutableTreeNode buildSketchbookTree() { /** Sketchbook has changed, update it on next viewing. */ public void rebuildSketchbookFrame() { - boolean wasVisible = - (sketchbookFrame == null) ? false : sketchbookFrame.isVisible(); - sketchbookFrame = null; // Force a rebuild - if (wasVisible) { - showSketchbookFrame(); + if (sketchbookFrame != null) { + boolean visible = sketchbookFrame.isVisible(); + Rectangle bounds = null; + if (visible) { + bounds = sketchbookFrame.getBounds(); + sketchbookFrame.setVisible(false); + sketchbookFrame.dispose(); + } + sketchbookFrame = null; + if (visible) { + showSketchbookFrame(); + sketchbookFrame.setBounds(bounds); + } } } @@ -667,6 +759,12 @@ public Image loadImage(String filename) { } + public Image loadImageX(String filename) { + final int res = Toolkit.highResImages() ? 2 : 1; + return loadImage(filename + "-" + res + "x.png"); + } + + // public EditorButton loadButton(String name) { // return new EditorButton(this, name); // } @@ -686,16 +784,24 @@ public String lookupReference(String keyword) { } - //public TokenMarker getTokenMarker() throws IOException { - // File keywordsFile = new File(folder, "keywords.txt"); - // return new PdeKeywords(keywordsFile); - //} + /** + * Specialized version of getTokenMarker() that can be overridden to + * provide different TokenMarker objects for different file types. + * @since 3.2 + * @param code the code for which we need a TokenMarker + */ + public TokenMarker getTokenMarker(SketchCode code) { + return getTokenMarker(); + } + + public TokenMarker getTokenMarker() { return tokenMarker; } + protected TokenMarker createTokenMarker() { - return new PdeKeywords(); + return new PdeTokenMarker(); } @@ -918,9 +1024,14 @@ public void prepareExportFolder(File targetFolder) { if (targetFolder != null) { // Nuke the old applet/application folder because it can cause trouble if (Preferences.getBoolean("export.delete_target_folder")) { -// System.out.println("temporarily skipping deletion of " + targetFolder); - Util.removeDir(targetFolder); - // targetFolder.renameTo(dest); + if (targetFolder.exists()) { + try { + Platform.deleteFile(targetFolder); + } catch (IOException e) { + // ignore errors/continue; likely to be ok + e.printStackTrace(); + } + } } // Create a fresh output folder (needed before preproc is run next) targetFolder.mkdirs(); diff --git a/app/src/processing/app/Platform.java b/app/src/processing/app/Platform.java index 46941f2bc6..16a31bf80e 100644 --- a/app/src/processing/app/Platform.java +++ b/app/src/processing/app/Platform.java @@ -26,11 +26,11 @@ import java.io.File; import java.io.FilenameFilter; import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; import java.util.HashMap; import java.util.Map; -import com.sun.jna.Library; -import com.sun.jna.Native; import com.sun.jna.platform.FileUtils; import processing.app.platform.DefaultPlatform; @@ -41,14 +41,14 @@ public class Platform { static DefaultPlatform inst; - static Map platformNames = new HashMap(); + static Map platformNames = new HashMap<>(); static { platformNames.put(PConstants.WINDOWS, "windows"); //$NON-NLS-1$ platformNames.put(PConstants.MACOSX, "macosx"); //$NON-NLS-1$ platformNames.put(PConstants.LINUX, "linux"); //$NON-NLS-1$ } - static Map platformIndices = new HashMap(); + static Map platformIndices = new HashMap<>(); static { platformIndices.put("windows", PConstants.WINDOWS); //$NON-NLS-1$ platformIndices.put("macosx", PConstants.MACOSX); //$NON-NLS-1$ @@ -86,7 +86,7 @@ static public void init() { } else if (Platform.isLinux()) { platformClass = Class.forName("processing.app.platform.LinuxPlatform"); //$NON-NLS-1$ } - inst = (DefaultPlatform) platformClass.newInstance(); + inst = (DefaultPlatform) platformClass.getDeclaredConstructor().newInstance(); } catch (Exception e) { Messages.showError("Problem Setting the Platform", "An unknown error occurred while trying to load\n" + @@ -150,7 +150,7 @@ static public void openURL(String url) { } catch (Exception e) { Messages.showWarning("Problem Opening URL", - "Could not open the URL\n" + url, e); + "Could not open the URL\n" + url, e); } } @@ -195,6 +195,7 @@ static public int getNativeBits() { * Return the value of the os.arch property */ static public String getNativeArch() { + // This will return "arm" for 32-bit ARM, "aarch64" for 64-bit ARM (both on Linux) return System.getProperty("os.arch"); } @@ -211,8 +212,12 @@ static public String getVariant() { static public String getVariant(int platform, String arch, int bits) { if (platform == PConstants.LINUX && bits == 32 && "arm".equals(Platform.getNativeArch())) { - return "armv6hf"; // assume armv6hf for now + return "armv6hf"; // assume armv6hf + } else if (platform == PConstants.LINUX && + bits == 64 && "aarch64".equals(Platform.getNativeArch())) { + return "arm64"; } + return Integer.toString(bits); // 32 or 64 } @@ -283,18 +288,25 @@ static public boolean isLinux() { static public File getContentFile(String name) { if (processingRoot == null) { // Get the path to the .jar file that contains Base.class - String path = Base.class.getProtectionDomain().getCodeSource().getLocation().getPath(); - // Path may have URL encoding, so remove it - String decodedPath = PApplet.urlDecode(path); + URL pathURL = + Base.class.getProtectionDomain().getCodeSource().getLocation(); + // Decode URL + String decodedPath; + try { + decodedPath = pathURL.toURI().getSchemeSpecificPart(); + } catch (URISyntaxException e) { + e.printStackTrace(); + return null; + } if (decodedPath.contains("/app/bin")) { // This means we're in Eclipse + final File build = new File(decodedPath, "../../build").getAbsoluteFile(); if (Platform.isMacOS()) { - processingRoot = - new File(path, "../../build/macosx/work/Processing.app/Contents/Java"); + processingRoot = new File(build, "macosx/work/Processing.app/Contents/Java"); } else if (Platform.isWindows()) { - processingRoot = new File(path, "../../build/windows/work"); + processingRoot = new File(build, "windows/work"); } else if (Platform.isLinux()) { - processingRoot = new File(path, "../../build/linux/work"); + processingRoot = new File(build, "linux/work"); } } else { // The .jar file will be in the lib folder @@ -313,7 +325,7 @@ static public File getContentFile(String name) { System.err.println("Could not find lib folder via " + jarFolder.getAbsolutePath() + ", switching to user.dir"); - processingRoot = new File(System.getProperty("user.dir")); + processingRoot = new File(""); // resolves to "user.dir" } } } @@ -379,29 +391,25 @@ static public boolean deleteFile(File file) throws IOException { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - public interface CLibrary extends Library { - CLibrary INSTANCE = (CLibrary)Native.loadLibrary("c", CLibrary.class); - int setenv(String name, String value, int overwrite); - String getenv(String name); - int unsetenv(String name); - int putenv(String string); + static public void setenv(String variable, String value) { + inst.setenv(variable, value); } - static public void setenv(String variable, String value) { - CLibrary clib = CLibrary.INSTANCE; - clib.setenv(variable, value, 1); + static public String getenv(String variable) { + return inst.getenv(variable); } - static public String getenv(String variable) { - CLibrary clib = CLibrary.INSTANCE; - return clib.getenv(variable); + static public int unsetenv(String variable) { + return inst.unsetenv(variable); } - public int unsetenv(String variable) { - CLibrary clib = CLibrary.INSTANCE; - return clib.unsetenv(variable); + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + static public int getSystemDPI() { + return inst.getSystemDPI(); } } \ No newline at end of file diff --git a/app/src/processing/app/Preferences.java b/app/src/processing/app/Preferences.java index a963d22b60..1b05083e19 100644 --- a/app/src/processing/app/Preferences.java +++ b/app/src/processing/app/Preferences.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2014 The Processing Foundation + Copyright (c) 2014-19 The Processing Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 @@ -53,7 +53,7 @@ public class Preferences { static final String PREFS_FILE = "preferences.txt"; //$NON-NLS-1$ static Map defaults; - static Map table = new HashMap(); + static Map table = new HashMap<>(); static File preferencesFile; @@ -68,39 +68,21 @@ static public void init() { load(Base.getLibStream(DEFAULTS_FILE)); } catch (Exception e) { Messages.showError(null, "Could not read default settings.\n" + - "You'll need to reinstall Processing.", e); + "You'll need to reinstall Processing.", e); } - /* provisionally removed in 3.0a6, see changes in load() - - // check for platform-specific properties in the defaults - String platformExt = "." + PConstants.platformNames[PApplet.platform]; //$NON-NLS-1$ - int platformExtLength = platformExt.length(); - - // Get a list of keys that are specific to this platform - ArrayList platformKeys = new ArrayList(); - for (String key : table.keySet()) { - if (key.endsWith(platformExt)) { - platformKeys.add(key); - } - } - - // Use those platform-specific keys to override - for (String key : platformKeys) { - // this is a key specific to a particular platform - String actualKey = key.substring(0, key.length() - platformExtLength); - String value = get(key); - set(actualKey, value); - } - */ - // Clone the defaults, then override any them with the user's preferences. // This ensures that any new/added preference will be present. - defaults = new HashMap(table); + defaults = new HashMap<>(table); // other things that have to be set explicitly for the defaults setColor("run.window.bgcolor", SystemColor.control); //$NON-NLS-1$ + // For CJK users, enable IM support by default + if (Language.useInputMethod()) { + setBoolean("editor.input_method_support", true); + } + // next load user preferences file preferencesFile = Base.getSettingsFile(PREFS_FILE); boolean firstRun = !preferencesFile.exists(); @@ -127,9 +109,12 @@ static public void init() { PApplet.useNativeSelect = Preferences.getBoolean("chooser.files.native"); //$NON-NLS-1$ - // Use the system proxy settings by default - // https://github.com/processing/processing/issues/2643 - System.setProperty("java.net.useSystemProxies", "true"); + // Adding option to disable this in case it's getting in the way + if (get("proxy.system").equals("true")) { + // Use the system proxy settings by default + // https://github.com/processing/processing/issues/2643 + System.setProperty("java.net.useSystemProxies", "true"); + } // Set HTTP, HTTPS, and SOCKS proxies for individuals // who want/need to override the system setting @@ -225,23 +210,47 @@ static protected boolean isPlatformSpecific(String key, String value, static public void save() { - // 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); - - String[] keyList = table.keySet().toArray(new String[table.size()]); - // Sorting is really helpful for debugging, diffing, and finding keys - keyList = PApplet.sort(keyList); - for (String key : keyList) { - writer.println(key + "=" + table.get(key)); //$NON-NLS-1$ - } + // On startup it'll be null, don't worry about it. It's trying to update + // the prefs for the open sketch before Preferences.init() has been called. + if (preferencesFile != null) { + try { + File dir = preferencesFile.getParentFile(); + File preferencesTemp = File.createTempFile("preferences", ".txt", dir); + preferencesTemp.setWritable(true, false); + + // Fix for 0163 to properly use Unicode when writing preferences.txt + PrintWriter writer = PApplet.createWriter(preferencesTemp); + + String[] keyList = table.keySet().toArray(new String[table.size()]); + // Sorting is really helpful for debugging, diffing, and finding keys + keyList = PApplet.sort(keyList); + for (String key : keyList) { + writer.println(key + "=" + table.get(key)); //$NON-NLS-1$ + } + writer.flush(); + writer.close(); + + // Rename preferences.txt to preferences.old + File oldPreferences = new File(dir, "preferences.old"); + if (oldPreferences.exists()) { + if (!oldPreferences.delete()) { + throw new IOException("Could not delete preferences.old"); + } + } + if (preferencesFile.exists() && + !preferencesFile.renameTo(oldPreferences)) { + throw new IOException("Could not replace preferences.old"); + } + // Make the temporary file into the real preferences + if (!preferencesTemp.renameTo(preferencesFile)) { + throw new IOException("Could not move preferences file into place"); + } - writer.flush(); - writer.close(); + } catch (IOException e) { + Messages.showWarning("Preferences", + "Could not save the Preferences file.", e); + } + } } diff --git a/app/src/processing/app/contrib/ContributionChangeListener.java b/app/src/processing/app/Problem.java similarity index 55% rename from app/src/processing/app/contrib/ContributionChangeListener.java rename to app/src/processing/app/Problem.java index 66283e50bc..cb12ad5e3e 100644 --- a/app/src/processing/app/contrib/ContributionChangeListener.java +++ b/app/src/processing/app/Problem.java @@ -2,9 +2,7 @@ /* Part of the Processing project - http://processing.org - - Copyright (c) 2013 The Processing Foundation - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2012-16 The Processing Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 @@ -15,15 +13,23 @@ 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 + 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. */ -package processing.app.contrib; +package processing.app; + + +public interface Problem { + public boolean isError(); + public boolean isWarning(); -public interface ContributionChangeListener { - public void contributionAdded(Contribution Contribution); - public void contributionRemoved(Contribution Contribution); - public void contributionChanged(Contribution oldLib, Contribution newLib); + public int getTabIndex(); + public int getLineNumber(); // 0-indexed + public String getMessage(); + + public int getStartOffset(); + public int getStopOffset(); } + diff --git a/app/src/processing/app/RunnerListenerEdtAdapter.java b/app/src/processing/app/RunnerListenerEdtAdapter.java new file mode 100644 index 0000000000..a436eefbca --- /dev/null +++ b/app/src/processing/app/RunnerListenerEdtAdapter.java @@ -0,0 +1,48 @@ +package processing.app; + +import java.awt.EventQueue; + +public class RunnerListenerEdtAdapter implements RunnerListener { + + private RunnerListener wrapped; + + public RunnerListenerEdtAdapter(RunnerListener wrapped) { + this.wrapped = wrapped; + } + + @Override + public void statusError(String message) { + EventQueue.invokeLater(() -> wrapped.statusError(message)); + } + + @Override + public void statusError(Exception exception) { + EventQueue.invokeLater(() -> wrapped.statusError(exception)); + } + + @Override + public void statusNotice(String message) { + EventQueue.invokeLater(() -> wrapped.statusNotice(message)); + } + + @Override + public void startIndeterminate() { + EventQueue.invokeLater(() -> wrapped.startIndeterminate()); + } + + @Override + public void stopIndeterminate() { + EventQueue.invokeLater(() -> wrapped.stopIndeterminate()); + } + + @Override + public void statusHalt() { + EventQueue.invokeLater(() -> wrapped.statusHalt()); + } + + @Override + public boolean isHalted() { + return wrapped.isHalted(); + } +} + diff --git a/app/src/processing/app/Settings.java b/app/src/processing/app/Settings.java index 4b155a5edb..efd016f231 100644 --- a/app/src/processing/app/Settings.java +++ b/app/src/processing/app/Settings.java @@ -205,6 +205,7 @@ public Font getFont(String attr) { style |= Font.ITALIC; } int size = PApplet.parseInt(pieces[2], 12); + size = Toolkit.zoom(size); // replace bad font with the default from lib/preferences.txt if (replace) { diff --git a/app/src/processing/app/SingleInstance.java b/app/src/processing/app/SingleInstance.java index a875e87c03..d9409d1526 100644 --- a/app/src/processing/app/SingleInstance.java +++ b/app/src/processing/app/SingleInstance.java @@ -21,6 +21,7 @@ */ package processing.app; +import java.awt.EventQueue; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; @@ -28,8 +29,6 @@ import java.net.ServerSocket; import java.net.Socket; -import javax.swing.SwingUtilities; - import processing.core.PApplet; @@ -38,8 +37,6 @@ * Processing from running simultaneously. If there's already an instance * running, it'll handle opening a new empty sketch, or any files that had * been passed in on the command line. - * - * @author Peter Kalauskas, Ben Fry */ public class SingleInstance { static final String SERVER_PORT = "instance_server.port"; @@ -58,15 +55,17 @@ static boolean alreadyRunning(String[] args) { } -// static void startServer(final Platform platform) { static void startServer(final Base base) { try { - final ServerSocket ss = new ServerSocket(0, 0, InetAddress.getByName(null)); + Messages.log("Opening SingleInstance socket"); + final ServerSocket ss = + new ServerSocket(0, 0, InetAddress.getLoopbackAddress()); Preferences.set(SERVER_PORT, "" + ss.getLocalPort()); final String key = "" + Math.random(); Preferences.set(SERVER_KEY, key); Preferences.save(); + Messages.log("Starting SingleInstance thread"); new Thread(new Runnable() { public void run() { while (true) { @@ -75,11 +74,9 @@ public void run() { final BufferedReader reader = PApplet.createReader(s.getInputStream()); String receivedKey = reader.readLine(); Messages.log(this, "key is " + key + ", received is " + receivedKey); -// Base.log(this, "platform base is " + platform.base); -// if (platform.base != null) { if (key.equals(receivedKey)) { - SwingUtilities.invokeLater(new Runnable() { + EventQueue.invokeLater(new Runnable() { public void run() { try { Messages.log(this, "about to read line"); @@ -125,15 +122,17 @@ public void run() { static boolean sendArguments(String[] args) { //, long timeout) { try { + Messages.log("Checking to see if Processing is already running"); int port = Preferences.getInteger(SERVER_PORT); String key = Preferences.get(SERVER_KEY); Socket socket = null; try { - socket = new Socket(InetAddress.getByName(null), port); + socket = new Socket(InetAddress.getLoopbackAddress(), port); } catch (Exception ignored) { } if (socket != null) { + Messages.log("Processing is already running, sending command line"); PrintWriter writer = PApplet.createWriter(socket.getOutputStream()); writer.println(key); for (String arg : args) { @@ -144,9 +143,9 @@ static boolean sendArguments(String[] args) { //, long timeout) { return true; } } catch (IOException e) { - System.err.println("Error sending commands to other instance."); - e.printStackTrace(); + Messages.loge("Error sending commands to other instance", e); } + Messages.log("Processing is not already running (or could not connect)"); return false; } } diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java index 4e059e3dbc..e686dc1823 100644 --- a/app/src/processing/app/Sketch.java +++ b/app/src/processing/app/Sketch.java @@ -24,21 +24,27 @@ package processing.app; import processing.app.ui.Editor; -import processing.app.ui.ProgressFrame; import processing.app.ui.Recent; import processing.app.ui.Toolkit; import processing.core.*; +import java.awt.Color; import java.awt.Component; import java.awt.Container; +import java.awt.EventQueue; import java.awt.FileDialog; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.io.*; +import java.util.ArrayList; import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; import javax.swing.*; +import javax.swing.border.EmptyBorder; /** @@ -85,6 +91,8 @@ public class Sketch { /** Moved out of Editor and into here for cleaner access. */ private boolean untitled; + /** true if we've posted a "sketch disappeared" warning */ + private boolean disappearedWarning; /** * Used by the command-line version to create a sketch object. @@ -117,6 +125,7 @@ protected void load(String path) { int suffixLength = mode.getDefaultExtension().length() + 1; name = mainFilename.substring(0, mainFilename.length() - suffixLength); folder = new File(new File(path).getParent()); + disappearedWarning = false; load(); } @@ -139,16 +148,46 @@ 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(); + List filenames = new ArrayList<>(); + List extensions = new ArrayList<>(); + + getSketchCodeFiles(filenames, extensions); + + codeCount = filenames.size(); + code = new SketchCode[codeCount]; + + for (int i = 0; i < codeCount; i++) { + String filename = filenames.get(i); + String extension = extensions.get(i); + code[i] = new SketchCode(new File(folder, filename), extension); + } + + // 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; + } + } - // reset these because load() may be called after an - // external editor event. (fix for 0099) - codeCount = 0; + // sort the entries at the top + sortCode(); + + // set the main file to be the current tab + if (editor != null) { + setCurrentCode(0); + } + } - code = new SketchCode[list.length]; - String[] extensions = mode.getExtensions(); + public void getSketchCodeFiles(List outFilenames, + List outExtensions) { + // get list of files in the sketch folder + String list[] = folder.list(); for (String filename : list) { // Ignoring the dot prefix files is especially important to avoid files @@ -162,41 +201,19 @@ protected void load() { // figure out the name without any extension String base = filename; // now strip off the .pde and .java extensions - for (String extension : extensions) { + for (String extension : mode.getExtensions()) { 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 (isSanitaryName(base)) { - code[codeCount++] = - new SketchCode(new File(folder, filename), extension); + if (outFilenames != null) outFilenames.add(filename); + if (outExtensions != null) outExtensions.add(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); - } } @@ -213,6 +230,20 @@ public void reload() { } + /** + * Load a tab that the user added to the sketch or modified with an external + * editor. + */ + public void loadNewTab(String filename, String ext, boolean newAddition) { + if (newAddition) { + insertCode(new SketchCode(new File(folder, filename), ext)); + } else { + replaceCode(new SketchCode(new File(folder, filename), ext)); + } + sortCode(); + } + + protected void replaceCode(SketchCode newCode) { for (int i = 0; i < codeCount; i++) { if (code[i].getFileName().equals(newCode.getFileName())) { @@ -397,8 +428,8 @@ public void keyTyped(KeyEvent event) { JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[] { - Toolkit.PROMPT_OK, - Toolkit.PROMPT_CANCEL }, + Language.getPrompt("ok"), + Language.getPrompt("cancel") }, field); if (userReply == JOptionPane.OK_OPTION) { @@ -542,7 +573,7 @@ protected void nameCode(String newName) { code[i].setFolder(newFolder); } // Update internal state to reflect the new location - updateInternal(sanitaryName, newFolder); + updateInternal(sanitaryName, newFolder, renamingCode); // File newMainFile = new File(newFolder, newName + ".pde"); // String newMainFilePath = newMainFile.getAbsolutePath(); @@ -643,9 +674,10 @@ public void handleDeleteCode() { // get the changes into the sketchbook menu //sketchbook.rebuildMenus(); - // make a new sketch, and i think this will rebuild the sketch menu + // make a new sketch and rebuild the sketch menu //editor.handleNewUnchecked(); //editor.handleClose2(); + editor.getBase().rebuildSketchbookMenus(); editor.getBase().handleClose(editor, false); } else { @@ -660,17 +692,22 @@ public void handleDeleteCode() { // remove code from the list removeCode(current); + // update the tabs + editor.rebuildHeader(); + // just set current tab to the main tab setCurrentCode(0); - // update the tabs - editor.rebuildHeader(); } } } - protected void removeCode(SketchCode which) { + /** + * Remove a SketchCode from the list of files without deleting its file. + * @see #handleDeleteCode() + */ + public void removeCode(SketchCode which) { // remove it from the internal list of files // resort internal list of files for (int i = 0; i < codeCount; i++) { @@ -742,6 +779,16 @@ public boolean isModified() { } + /** + * Ensure that all SketchCodes are up-to-date, so that sc.save() works. + */ + public void updateSketchCodes() { +// if (current.isModified()) { + current.setProgram(editor.getText()); +// } + } + + /** * Save all code in the current sketch. This just forces the files to save * in place, so if it's an untitled (un-saved) sketch, saveAs() should be @@ -752,9 +799,7 @@ public boolean save() throws IOException { ensureExistence(); // first get the contents of the editor text area -// if (current.isModified()) { - current.setProgram(editor.getText()); -// } + updateSketchCodes(); // don't do anything if not actually modified //if (!modified) return false; @@ -791,9 +836,10 @@ public boolean save() throws IOException { public boolean saveAs() throws IOException { String newParentDir = null; String newName = null; + String oldName = folder.getName(); - final String oldName2 = folder.getName(); - // TODO rewrite this to use shared version from PApplet + // TODO rewrite this to use shared version from PApplet (But because that + // specifies a callback function, this needs to wait until the refactoring) final String PROMPT = Language.text("save"); if (Preferences.getBoolean("chooser.files.native")) { // get new name for folder @@ -805,8 +851,8 @@ public boolean saveAs() throws IOException { // default to the parent folder of where this was fd.setDirectory(folder.getParent()); } - String oldName = folder.getName(); - fd.setFile(oldName); + String oldFolderName = folder.getName(); + fd.setFile(oldFolderName); fd.setVisible(true); newParentDir = fd.getDirectory(); newName = fd.getFile(); @@ -868,7 +914,7 @@ public boolean saveAs() throws IOException { // 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 { @@ -895,9 +941,7 @@ public boolean saveAs() throws IOException { // 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()); - } + updateSketchCodes(); File[] copyItems = folder.listFiles(new FileFilter() { public boolean accept(File file) { @@ -907,9 +951,12 @@ public boolean accept(File file) { return false; } // list of files/folders to be ignored during "save as" - for (String ignorable : mode.getIgnorable()) { - if (name.equals(ignorable)) { - return false; + String[] ignorable = mode.getIgnorable(); + if (ignorable != null) { + for (String ignore : ignorable) { + if (name.equals(ignore)) { + return false; + } } } // ignore the extensions for code, since that'll be copied below @@ -927,21 +974,9 @@ public boolean accept(File file) { } }); + startSaveAsThread(oldName, newName, newFolder, copyItems); - final File newFolder2 = newFolder; - final File[] copyItems2 = copyItems; - final String newName2 = newName; - - // Create a new event dispatch thread- to display ProgressBar - // while Saving As - javax.swing.SwingUtilities.invokeLater(new Runnable() { - public void run() { - new ProgressFrame(copyItems2, newFolder2, oldName2, newName2, editor); - } - }); - - - // save the other tabs to their new location + // save the other tabs to their new location (main tab saved below) for (int i = 1; i < codeCount; i++) { File newFile = new File(newFolder, code[i].getFileName()); code[i].saveAs(newFile); @@ -950,15 +985,17 @@ public void run() { // While the old path to the main .pde is still set, remove the entry from // the Recent menu so that it's not sticking around after the rename. // If untitled, it won't be in the menu, so there's no point. - if (!isUntitled()) { - Recent.remove(editor); - } +// if (!isUntitled()) { +// Recent.remove(editor); +// } + // Folks didn't like this behavior, so shutting it off + // https://github.com/processing/processing/issues/5902 // save the main tab with its new name File newFile = new File(newFolder, newName + "." + mode.getDefaultExtension()); code[0].saveAs(newFile); - updateInternal(newName, newFolder); + updateInternal(newName, newFolder, false); // Make sure that it's not an untitled sketch setUntitled(false); @@ -971,11 +1008,193 @@ public void run() { } + AtomicBoolean saving = new AtomicBoolean(); + + public boolean isSaving() { + return saving.get(); + } + + + /** + * Kick off a background thread to copy everything *but* the .pde files. + * Due to the poor way (dating back to the late 90s with DBN) that our + * save() and saveAs() methods have been implemented to return booleans, + * there isn't a good way to return a value to the calling thread without + * a good bit of refactoring (that should be done at some point). + * As a result, this method will return 'true' before the full "Save As" + * has completed, which will cause problems in weird cases. + * + * For instance, the threading will cause problems while saving an untitled + * sketch that has an enormous data folder while quitting. The save thread to + * move those data folder files won't have finished before this returns true, + * and the PDE may quit before the SwingWorker completes its job. + * + * 3843 + */ + void startSaveAsThread(final String oldName, final String newName, + final File newFolder, final File[] copyItems) { + saving.set(true); + EventQueue.invokeLater(new Runnable() { + public void run() { + final JFrame frame = + new JFrame("Saving \u201C" + newName + "\u201C..."); + frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); + + Box box = Box.createVerticalBox(); + box.setBorder(new EmptyBorder(16, 16, 16, 16)); + + if (Platform.isMacOS()) { + frame.setBackground(Color.WHITE); + } + + JLabel label = + new JLabel("Saving additional files from the sketch folder..."); + box.add(label); + box.add(Box.createVerticalStrut(8)); + + final JProgressBar progressBar = new JProgressBar(0, 100); + // no luck, stuck with ugly on OS X + //progressBar.putClientProperty("JComponent.sizeVariant", "regular"); + progressBar.setValue(0); + progressBar.setStringPainted(true); + box.add(progressBar); + + frame.getContentPane().add(box); + frame.pack(); + frame.setLocationRelativeTo(editor); + Toolkit.setIcon(frame); + frame.setVisible(true); + + new SwingWorker() { + + @Override + protected Void doInBackground() throws Exception { + addPropertyChangeListener(new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if ("progress".equals(evt.getPropertyName())) { + progressBar.setValue((Integer) evt.getNewValue()); + } + } + }); + + long totalSize = 0; + for (File copyable : copyItems) { + totalSize += Util.calcSize(copyable); + } + + long progress = 0; + setProgress(0); + for (File copyable : copyItems) { + if (copyable.isDirectory()) { + copyDir(copyable, + new File(newFolder, copyable.getName()), + progress, totalSize); + progress += Util.calcSize(copyable); + } else { + copyFile(copyable, + new File(newFolder, copyable.getName()), + progress, totalSize); + if (Util.calcSize(copyable) < 512 * 1024) { + // If the file length > 0.5MB, the copyFile() function has + // been redesigned to change progress every 0.5MB so that + // the progress bar doesn't stagnate during that time + progress += Util.calcSize(copyable); + setProgress((int) (progress * 100L / totalSize)); + } + } + } + saving.set(false); + return null; + } + + + /** + * Overloaded copyFile that is called whenever a Save As is being done, + * so that the ProgressBar is updated for very large files as well. + */ + void copyFile(File sourceFile, File targetFile, + long progress, long totalSize) throws IOException { + BufferedInputStream from = + new BufferedInputStream(new FileInputStream(sourceFile)); + BufferedOutputStream to = + new BufferedOutputStream(new FileOutputStream(targetFile)); + byte[] buffer = new byte[16 * 1024]; + int bytesRead; + int progRead = 0; + while ((bytesRead = from.read(buffer)) != -1) { + to.write(buffer, 0, bytesRead); + progRead += bytesRead; + if (progRead >= 512 * 1024) { // to update progress bar every 0.5MB + progress += progRead; + //progressBar.setValue((int) Math.min(Math.ceil(progress * 100.0 / totalSize), 100)); + setProgress((int) (100L * progress / totalSize)); + progRead = 0; + } + } + // Final update to progress bar + setProgress((int) (100L * progress / totalSize)); + + from.close(); + from = null; + to.flush(); + to.close(); + to = null; + + targetFile.setLastModified(sourceFile.lastModified()); + targetFile.setExecutable(sourceFile.canExecute()); + } + + + long copyDir(File sourceDir, File targetDir, + long progress, long totalSize) throws IOException { + // Overloaded copyDir so that the Save As progress bar gets updated when the + // files are in folders as well (like in the data folder) + if (sourceDir.equals(targetDir)) { + final String urDum = "source and target directories are identical"; + throw new IllegalArgumentException(urDum); + } + targetDir.mkdirs(); + String files[] = sourceDir.list(); + for (String filename : files) { + // Ignore dot files (.DS_Store), dot folders (.svn) while copying + if (filename.charAt(0) == '.') { + continue; + } + + File source = new File(sourceDir, filename); + File target = new File(targetDir, filename); + if (source.isDirectory()) { + progress = copyDir(source, target, progress, totalSize); + //progressBar.setValue((int) Math.min(Math.ceil(progress * 100.0 / totalSize), 100)); + setProgress((int) (100L * progress / totalSize)); + target.setLastModified(source.lastModified()); + } else { + copyFile(source, target, progress, totalSize); + progress += source.length(); + //progressBar.setValue((int) Math.min(Math.ceil(progress * 100.0 / totalSize), 100)); + setProgress((int) (100L * progress / totalSize)); + } + } + return progress; + } + + + @Override + public void done() { + frame.dispose(); + editor.statusNotice(Language.text("editor.status.saving.done")); + } + }.execute(); + } + }); + } + /** * Update internal state for new sketch name or folder location. */ - protected void updateInternal(String sketchName, File sketchFolder) { + protected void updateInternal(String sketchName, File sketchFolder, + boolean renaming) { // reset all the state information for the sketch object String oldPath = getMainFilePath(); primaryFile = code[0].getFile(); @@ -984,6 +1203,7 @@ protected void updateInternal(String sketchName, File sketchFolder) { name = sketchName; folder = sketchFolder; + disappearedWarning = false; codeFolder = new File(folder, "code"); dataFolder = new File(folder, "data"); @@ -996,7 +1216,11 @@ protected void updateInternal(String sketchName, File sketchFolder) { // System.out.println("modified is now " + modified); editor.updateTitle(); editor.getBase().rebuildSketchbookMenus(); - Recent.rename(editor, oldPath); + if (renaming) { + // only update the Recent menu if it's a rename, not a Save As + // https://github.com/processing/processing/issues/5902 + Recent.rename(editor, oldPath); + } // editor.header.rebuild(); } @@ -1060,18 +1284,21 @@ public boolean addFile(File sourceFile) { String codeExtension = null; boolean replacement = false; + boolean isCode = 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(".dylib") || filename.toLowerCase().endsWith(".jnilib") || filename.toLowerCase().endsWith(".so")) { //if (!codeFolder.exists()) codeFolder.mkdirs(); prepareCodeFolder(); destFile = new File(codeFolder, filename); - + isCode = true; } else { for (String extension : mode.getExtensions()) { String lower = filename.toLowerCase(); @@ -1141,6 +1368,10 @@ public boolean addFile(File sourceFile) { } } + if (isCode) { + editor.codeFolderChanged(); + } + if (codeExtension != null) { SketchCode newCode = new SketchCode(destFile, codeExtension); @@ -1184,8 +1415,8 @@ public void setCurrentCode(int which) { // System.out.println(current.visited); // } // if current is null, then this is the first setCurrent(0) - if (((currentIndex == which) && (current != null)) - || which >= codeCount || which < 0) { + if (which < 0 || which >= codeCount || + ((currentIndex == which) && (current == code[currentIndex]))) { return; } @@ -1278,28 +1509,34 @@ public void prepareBuild(File targetFolder) throws SketchException { /** - * 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. + * Make sure the sketch hasn't been moved or deleted by a nefarious user. + * If they did, try to re-create it and save. Only checks whether the + * main folder is still around, but not its contents. */ public void ensureExistence() { if (!folder.exists()) { - // Disaster recovery, try to salvage what's there already. - Messages.showWarning(Language.text("ensure_exist.messages.missing_sketch"), - Language.text("ensure_exist.messages.missing_sketch.description")); - try { - folder.mkdirs(); - modified = true; + // Avoid an infinite loop if we've already warned about this + // https://github.com/processing/processing/issues/4805 + if (!disappearedWarning) { + disappearedWarning = true; + + // Disaster recovery, try to salvage what's there already. + Messages.showWarning(Language.text("ensure_exist.messages.missing_sketch"), + Language.text("ensure_exist.messages.missing_sketch.description")); + try { + folder.mkdirs(); + modified = true; + + for (int i = 0; i < codeCount; i++) { + code[i].save(); // this will force a save + } + calcModified(); - for (int i = 0; i < codeCount; i++) { - code[i].save(); // this will force a save + } catch (Exception e) { + // disappearedWarning prevents infinite loop in this scenario + Messages.showWarning(Language.text("ensure_exist.messages.unrecoverable"), + Language.text("ensure_exist.messages.unrecoverable.description"), e); } - calcModified(); - - } catch (Exception e) { - Messages.showWarning(Language.text("ensure_exist.messages.unrecoverable"), - Language.text("ensure_exist.messages.unrecoverable.description"), e); } } } diff --git a/app/src/processing/app/SketchCode.java b/app/src/processing/app/SketchCode.java index 11e34eb5b3..59ed06652e 100644 --- a/app/src/processing/app/SketchCode.java +++ b/app/src/processing/app/SketchCode.java @@ -26,6 +26,7 @@ import java.io.*; +import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.undo.*; @@ -223,6 +224,11 @@ public Document getDocument() { } + public String getDocumentText() throws BadLocationException { + return document.getText(0, document.getLength()); + } + + public void setDocument(Document d) { document = d; } @@ -277,6 +283,12 @@ public long lastVisited() { public void load() throws IOException { program = Util.loadFile(file); + if (program == null) { + System.err.println("There was a problem loading " + file); + System.err.println("This may happen because you don't have permissions to read the file, or the file has gone missing."); + throw new IOException("Cannot read or access " + file); + } + // Remove NUL characters because they'll cause problems, // and their presence is very difficult to debug. // https://github.com/processing/processing/issues/1973 @@ -286,7 +298,7 @@ public void load() throws IOException { savedProgram = program; // This used to be the "Fix Encoding and Reload" warning, but since that - // tool has been removed, it just rambles about text editors and encodings. + // tool has been removed, let's ramble about text editors and encodings. if (program.indexOf('\uFFFD') != -1) { System.err.println(file.getName() + " contains unrecognized characters."); System.err.println("You should re-open " + file.getName() + @@ -296,7 +308,7 @@ public void load() throws IOException { System.err.println(); } - lastModified = file.lastModified(); + setLastModified(); setModified(false); } @@ -324,7 +336,7 @@ public void saveAs(File newFile) throws IOException { savedProgram = program; file = newFile; makePrettyName(); - lastModified = file.lastModified(); + setLastModified(); setModified(false); } @@ -337,11 +349,21 @@ public void setFolder(File sketchFolder) { file = new File(sketchFolder, file.getName()); } + + /** + * Set the last known modification time, so that we're not re-firing + * "hey, this is modified!" events incessantly. + */ + public void setLastModified() { + lastModified = file.lastModified(); + } + + /** * Used to determine whether this file was modified externally * @return The time the file was last modified */ - public long lastModified(){ + public long getLastModified() { return lastModified; } } diff --git a/app/src/processing/app/SketchException.java b/app/src/processing/app/SketchException.java index ccf8b924e6..4a32d2e79d 100644 --- a/app/src/processing/app/SketchException.java +++ b/app/src/processing/app/SketchException.java @@ -130,6 +130,11 @@ public void hideStackTrace() { } + public boolean isStackTraceEnabled() { + return showStackTrace; + } + + /** * Nix the java.lang crap out of an exception message * because it scares the children. diff --git a/app/src/processing/app/UpdateCheck.java b/app/src/processing/app/UpdateCheck.java index 4c8d2d5a16..5103f5d856 100644 --- a/app/src/processing/app/UpdateCheck.java +++ b/app/src/processing/app/UpdateCheck.java @@ -83,7 +83,12 @@ public void run() { } - public void updateCheck() throws IOException, InterruptedException { + /** + * Turned into a separate method so that anyone needed update.id will get + * a legit answer. Had a problem with the contribs script where the id + * wouldn't be set so a null id would be sent to the contribs server. + */ + static public long getUpdateID() { // generate a random id in case none exists yet Random r = new Random(); long id = r.nextLong(); @@ -94,8 +99,12 @@ public void updateCheck() throws IOException, InterruptedException { } else { Preferences.set("update.id", String.valueOf(id)); } + return id; + } - String info = PApplet.urlEncode(id + "\t" + + + public void updateCheck() throws IOException, InterruptedException { + String info = PApplet.urlEncode(getUpdateID() + "\t" + PApplet.nf(Base.getRevision(), 4) + "\t" + System.getProperty("java.version") + "\t" + System.getProperty("java.vendor") + "\t" + @@ -180,7 +189,7 @@ protected boolean promptToOpenContributionManager() { options, options[0]); if (result == JOptionPane.YES_OPTION) { - ContributionManager.openUpdates(base.getActiveEditor()); + ContributionManager.openUpdates(); return true; } diff --git a/app/src/processing/app/Util.java b/app/src/processing/app/Util.java index 0eb42201ce..fefc3b8b71 100644 --- a/app/src/processing/app/Util.java +++ b/app/src/processing/app/Util.java @@ -23,8 +23,8 @@ package processing.app; import java.io.*; +import java.nio.file.Files; import java.util.Enumeration; -import java.util.Vector; import java.util.zip.*; import processing.core.PApplet; @@ -74,7 +74,7 @@ static public byte[] loadBytesRaw(File file) throws IOException { */ static public StringDict readSettings(File inputFile) { if (!inputFile.exists()) { - if (Base.DEBUG) System.err.println(inputFile + " does not exist."); + Messages.loge(inputFile + " does not exist inside readSettings()"); return null; } String lines[] = PApplet.loadStrings(inputFile); @@ -162,12 +162,11 @@ static public String loadFile(File file) throws IOException { * Spew the contents of a String object out to a file. As of 3.0 beta 2, * this will replace and write \r\n for newlines on Windows. * https://github.com/processing/processing/issues/3455 + * As of 3.3.7, this puts a newline at the end of the file, + * per good practice/POSIX: https://stackoverflow.com/a/729795 */ - static public void saveFile(String str, File file) throws IOException { - if (Platform.isWindows()) { - String[] lines = str.split("\\r?\\n"); - str = PApplet.join(lines, "\r\n"); - } + static public void saveFile(String text, File file) throws IOException { + String[] lines = text.split("\\r?\\n"); File temp = File.createTempFile(file.getName(), null, file.getParentFile()); try { // fix from cjwant to prevent symlinks from being destroyed. @@ -178,9 +177,11 @@ static public void saveFile(String str, File file) throws IOException { throw new IOException("Could not resolve canonical representation of " + file.getAbsolutePath()); } - // Can't use saveStrings() here b/c Windows will add a ^M to the file + // Could use saveStrings(), but the we wouldn't be able to checkError() PrintWriter writer = PApplet.createWriter(temp); - writer.print(str); + for (String line : lines) { + writer.println(line); + } boolean error = writer.checkError(); // calls flush() writer.close(); // attempt to close regardless if (error) { @@ -301,42 +302,53 @@ static public void copyDirNative(File sourceDir, /** * Remove all files in a directory and the directory itself. + * Prints error messages with failed filenames. Does not follow symlinks. */ - static public void removeDir(File dir) { - if (dir.exists()) { - removeDescendants(dir); - if (!dir.delete()) { - System.err.println("Could not delete " + dir); - } - } + static public boolean removeDir(File dir) { + return removeDir(dir, true); } - /** - * 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) + * Remove all files in a directory and the directory itself. + * Optinally prints error messages with failed filenames. + * Does not follow symlinks. */ - 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); + static public boolean removeDir(File dir, boolean printErrorMessages) { + if (!dir.exists()) return true; + + boolean result = true; + if (!Files.isSymbolicLink(dir.toPath())) { + File[] files = dir.listFiles(); + if (files != null) { + for (File child : files) { + if (child.isFile()) { + boolean deleted = child.delete(); + if (!deleted && printErrorMessages) { + System.err.println("Could not delete " + child.getAbsolutePath()); + } + result &= deleted; + } else if (child.isDirectory()) { + result &= removeDir(child, printErrorMessages); } } - } else { - removeDir(dead); - //dead.delete(); } } + boolean deleted = dir.delete(); + if (!deleted && printErrorMessages) { + System.err.println("Could not delete " + dir.getAbsolutePath()); + } + result &= deleted; + return result; + } + + + /** + * Function to return the length of the file, or entire directory, including + * the component files and sub-folders if passed. + * @param file The file or folder to calculate + */ + static public long calcSize(File file) { + return file.isFile() ? file.length() : Util.calcFolderSize(file); } @@ -345,7 +357,7 @@ static public void removeDescendants(File dir) { * Used to determine whether sketches are empty or not. * Note that the function calls itself recursively. */ - static public int calcFolderSize(File folder) { + static public long calcFolderSize(File folder) { int size = 0; String files[] = folder.list(); @@ -367,61 +379,55 @@ static public int calcFolderSize(File folder) { } -// /** -// * 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); -// } - - + /** + * 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. + * @param relative true return relative paths instead of absolute paths + */ static public String[] listFiles(File folder, boolean relative) { - String path = folder.getAbsolutePath(); - Vector vector = new Vector(); - listFiles(relative ? (path + File.separator) : "", path, null, vector); - String outgoing[] = new String[vector.size()]; - vector.copyInto(outgoing); - return outgoing; + return listFiles(folder, relative, null); } - static public String[] listFiles(File folder, boolean relative, String extension) { - String path = folder.getAbsolutePath(); - Vector vector = new Vector(); + static public String[] listFiles(File folder, boolean relative, + String extension) { if (extension != null) { if (!extension.startsWith(".")) { extension = "." + extension; } } - listFiles(relative ? (path + File.separator) : "", path, extension, vector); - String outgoing[] = new String[vector.size()]; - vector.copyInto(outgoing); - return outgoing; + + StringList list = new StringList(); + listFilesImpl(folder, relative, extension, list); + + if (relative) { + String[] outgoing = new String[list.size()]; + // remove the slash (or backslash) as well + int prefixLength = folder.getAbsolutePath().length() + 1; + for (int i = 0; i < outgoing.length; i++) { + outgoing[i] = list.get(i).substring(prefixLength); + } + return outgoing; + } + return list.array(); } - static protected void listFiles(String basePath, - String path, String extension, - Vector vector) { - File folder = new File(path); - String[] list = folder.list(); - if (list != null) { - for (String item : list) { - if (item.charAt(0) == '.') continue; - if (extension == null || item.toLowerCase().endsWith(extension)) { - File file = new File(path, item); - String newPath = file.getAbsolutePath(); - if (newPath.startsWith(basePath)) { - newPath = newPath.substring(basePath.length()); - } - // only add if no ext or match - if (extension == null || item.toLowerCase().endsWith(extension)) { - vector.add(newPath); - } - if (file.isDirectory()) { // use absolute path - listFiles(basePath, file.getAbsolutePath(), extension, vector); + static void listFilesImpl(File folder, boolean relative, + String extension, StringList list) { + File[] items = folder.listFiles(); + if (items != null) { + for (File item : items) { + String name = item.getName(); + if (name.charAt(0) != '.') { + if (item.isDirectory()) { + listFilesImpl(item, relative, extension, list); + + } else { // a file + if (extension == null || name.endsWith(extension)) { + list.append(item.getAbsolutePath()); + } } } } @@ -553,15 +559,14 @@ static private void packageListFromZip(String filename, StringList list) { if (!entry.isDirectory()) { String name = entry.getName(); - if (name.endsWith(".class")) { + // Avoid META-INF because some jokers but .class files in there + // https://github.com/processing/processing/issues/5778 + if (name.endsWith(".class") && !name.startsWith("META-INF/")) { int slash = name.lastIndexOf('/'); - if (slash == -1) continue; - - String pname = name.substring(0, slash); -// if (map.get(pname) == null) { -// map.put(pname, new Object()); -// } - list.appendUnique(pname); + if (slash != -1) { + String packageName = name.substring(0, slash); + list.appendUnique(packageName); + } } } } @@ -609,24 +614,31 @@ static private void packageListFromFolder(File dir, String sofar, } + /** + * Extract the contents of a .zip archive into a folder. + * Ignores (does not extract) any __MACOSX files from macOS archives. + */ static public void unzip(File zipFile, File dest) { try { FileInputStream fis = new FileInputStream(zipFile); CheckedInputStream checksum = new CheckedInputStream(fis, new Adler32()); ZipInputStream zis = new ZipInputStream(new BufferedInputStream(checksum)); - ZipEntry next = null; - while ((next = zis.getNextEntry()) != null) { - File currentFile = new File(dest, next.getName()); - if (next.isDirectory()) { - currentFile.mkdirs(); - } else { - File parentDir = currentFile.getParentFile(); - // Sometimes the directory entries aren't already created - if (!parentDir.exists()) { - parentDir.mkdirs(); + ZipEntry entry = null; + while ((entry = zis.getNextEntry()) != null) { + final String name = entry.getName(); + if (!name.startsWith(("__MACOSX"))) { + File currentFile = new File(dest, name); + if (entry.isDirectory()) { + currentFile.mkdirs(); + } else { + File parentDir = currentFile.getParentFile(); + // Sometimes the directory entries aren't already created + if (!parentDir.exists()) { + parentDir.mkdirs(); + } + currentFile.createNewFile(); + unzipEntry(zis, currentFile); } - currentFile.createNewFile(); - unzipEntry(zis, currentFile); } } } catch (Exception e) { @@ -645,4 +657,21 @@ static protected void unzipEntry(ZipInputStream zin, File f) throws IOException out.flush(); out.close(); } + + + static public byte[] gzipEncode(byte[] what) throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + GZIPOutputStream output = new GZIPOutputStream(baos); + PApplet.saveStream(output, new ByteArrayInputStream(what)); + output.close(); + return baos.toByteArray(); + } + + + static public final boolean containsNonASCII(String what) { + for (char c : what.toCharArray()) { + if (c < 32 || c > 127) return true; + } + return false; + } } diff --git a/app/src/processing/app/contrib/AvailableContribution.java b/app/src/processing/app/contrib/AvailableContribution.java index 4fd16f8fc2..4d5240c451 100644 --- a/app/src/processing/app/contrib/AvailableContribution.java +++ b/app/src/processing/app/contrib/AvailableContribution.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013-15 The Processing Foundation + Copyright (c) 2013-20 The Processing Foundation Copyright (c) 2011-12 Ben Fry and Casey Reas This program is free software; you can redistribute it and/or modify @@ -49,9 +49,9 @@ public AvailableContribution(ContributionType type, StringDict params) { imports = parseImports(params); name = params.get("name"); authors = params.get("authors"); - if (authors == null) { - authors = params.get("authorList"); - } +// if (authors == null) { +// authors = params.get("authorList"); +// } url = params.get("url"); sentence = params.get("sentence"); paragraph = params.get("paragraph"); @@ -61,7 +61,7 @@ public AvailableContribution(ContributionType type, StringDict params) { version = PApplet.parseInt(versionStr, 0); } - prettyVersion = params.get("prettyVersion"); + setPrettyVersion(params.get("prettyVersion")); String lastUpdatedStr = params.get("lastUpdated"); if (lastUpdatedStr != null) { @@ -99,7 +99,6 @@ public LocalContribution install(Base base, File contribArchive, // Unzip the file into the modes, tools, or libraries folder inside the // sketchbook. Unzipping to /tmp is problematic because it may be on // another file system, so move/rename operations will break. -// File sketchbookContribFolder = type.getSketchbookFolder(); File tempFolder = null; try { @@ -110,84 +109,61 @@ public LocalContribution install(Base base, File contribArchive, return null; } Util.unzip(contribArchive, tempFolder); -// System.out.println("temp folder is " + tempFolder); -// Base.openFolder(tempFolder); // Now go looking for a legit contrib inside what's been unpacked. File contribFolder = null; - // Sometimes contrib authors place all their folders in the base directory - // of the .zip file instead of in single folder as the guidelines suggest. - if (type.isCandidate(tempFolder)) { - /* - // Can't just rename the temp folder, because a contrib with this name - // may already exist. Instead, create a new temp folder, and rename the - // old one to be the correct folder. - File enclosingFolder = null; - try { - enclosingFolder = Base.createTempFolder(type.toString(), "tmp", sketchbookContribFolder); - } catch (IOException e) { - status.setErrorMessage("Could not create a secondary folder to install."); - return null; - } - contribFolder = new File(enclosingFolder, getName()); - tempFolder.renameTo(contribFolder); - tempFolder = enclosingFolder; - */ + /* + if (!type.isCandidate(tempFolder)) { if (status != null) { status.setErrorMessage(Language.interpolate("contrib.errors.needs_repackage", getName(), type.getTitle())); } return null; } + */ -// if (contribFolder == null) { - // Find the first legitimate looking folder in what we just unzipped - contribFolder = type.findCandidate(tempFolder); -// } LocalContribution installedContrib = null; - + // Find the first legitimate folder in what we just unzipped + contribFolder = type.findCandidate(tempFolder); if (contribFolder == null) { if (status != null) { status.setErrorMessage(Language.interpolate("contrib.errors.no_contribution_found", type)); } - } else { File propFile = new File(contribFolder, type + ".properties"); - if (writePropertiesFile(propFile)) { - // 1. contribFolder now has a legit contribution, load it to get info. + if (!propFile.exists()) { + status.setErrorMessage("This contribution is missing " + + propFile.getName() + + ", please contact the author for a fix."); + + } else if (writePropertiesFile(propFile)) { + // contribFolder now has a legit contribution, load it to get info. LocalContribution newContrib = type.load(base, contribFolder); - // 1.1. get info we need to delete the newContrib folder later + // get info we need to delete the newContrib folder later File newContribFolder = newContrib.getFolder(); - // 2. Check to make sure nothing has the same name already, + // Check to make sure nothing has the same name already, // backup old if needed, then move things into place and reload. installedContrib = newContrib.copyAndLoad(base, confirmReplace, status); - // Restart no longer needed. Yay! -// if (newContrib != null && type.requiresRestart()) { -// installedContrib.setRestartFlag(); -// //status.setMessage("Restart Processing to finish the installation."); -// } - - // 3.1 Unlock all the jars if it is a mode or tool + // Unlock all the jars if it is a mode or tool if (newContrib.getType() == ContributionType.MODE) { - ((ModeContribution)newContrib).clearClassLoader(base); - } - else if (newContrib.getType() == ContributionType.TOOL) { - ((ToolContribution)newContrib).clearClassLoader(base); + ((ModeContribution) newContrib).clearClassLoader(base); + + } else if (newContrib.getType() == ContributionType.TOOL) { + ((ToolContribution) newContrib).clearClassLoader(); } - // 3.2 Delete the newContrib, do a garbage collection, hope and pray + // Delete the newContrib, do a garbage collection, hope and pray // that Java will unlock the temp folder on Windows now newContrib = null; System.gc(); - if (Platform.isWindows()) { - // we'll even give it a second to finish up ... because file ops are - // just that flaky on Windows. + // we'll even give it a second to finish up, + // because file ops are just that flaky on Windows. try { Thread.sleep(1000); } catch (InterruptedException e) { @@ -195,8 +171,8 @@ else if (newContrib.getType() == ContributionType.TOOL) { } } - // 4. Okay, now actually delete that temp folder - Util.removeDir(newContribFolder); + // delete the contrib folder inside the libraryXXXXXXtmp folder + Util.removeDir(newContribFolder, false); } else { if (status != null) { @@ -207,7 +183,7 @@ else if (newContrib.getType() == ContributionType.TOOL) { // Remove any remaining boogers if (tempFolder.exists()) { - Util.removeDir(tempFolder); + Util.removeDir(tempFolder, false); } return installedContrib; } @@ -231,9 +207,6 @@ public ContributionType getType() { * manager. However, it also ensures that valid fields in the properties file * aren't overwritten, since the properties file may be more recent than the * contributions.txt file. - * - * @param propFile - * @return */ public boolean writePropertiesFile(File propFile) { try { @@ -256,9 +229,9 @@ public boolean writePropertiesFile(File propFile) { StringList importsList = parseImports(properties); String authors = properties.get(AUTHORS_PROPERTY); - if (authors == null) { - authors = properties.get("authorList"); // before 3.0a11 - } +// if (authors == null) { +// authors = properties.get("authorList"); // before 3.0a11 +// } if (authors == null || authors.isEmpty()) { authors = getAuthorList(); } @@ -283,13 +256,14 @@ public boolean writePropertiesFile(File propFile) { version = Integer.parseInt(properties.get("version")); } catch (NumberFormatException e) { version = getVersion(); - System.err.println("The version number for “" + name + "” is not set properly."); + System.err.println("The version number for “" + name + "” is not a number."); System.err.println("Please contact the author to fix it according to the guidelines."); } String prettyVersion = properties.get("prettyVersion"); - if (prettyVersion == null || prettyVersion.isEmpty()) - prettyVersion = getPrettyVersion(); + if (prettyVersion != null && prettyVersion.isEmpty()) { + prettyVersion = null; + } String compatibleContribsList = null; if (getType() == ContributionType.EXAMPLES) { @@ -336,7 +310,9 @@ public boolean writePropertiesFile(File propFile) { writer.println("sentence=" + sentence); writer.println("paragraph=" + paragraph); writer.println("version=" + version); - writer.println("prettyVersion=" + prettyVersion); + if (prettyVersion != null) { + writer.println("prettyVersion=" + prettyVersion); + } writer.println("lastUpdated=" + lastUpdated); writer.println("minRevision=" + minRev); writer.println("maxRevision=" + maxRev); diff --git a/app/src/processing/app/contrib/ContribProgressBar.java b/app/src/processing/app/contrib/ContribProgressBar.java index 47371c84bc..8a0d41c3b6 100644 --- a/app/src/processing/app/contrib/ContribProgressBar.java +++ b/app/src/processing/app/contrib/ContribProgressBar.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013-15 The Processing Foundation + Copyright (c) 2013-20 The Processing Foundation Copyright (c) 2011-12 Ben Fry and Casey Reas This program is free software; you can redistribute it and/or modify @@ -21,6 +21,9 @@ */ package processing.app.contrib; +import java.awt.EventQueue; +import java.lang.reflect.InvocationTargetException; + import javax.swing.JProgressBar; @@ -48,10 +51,50 @@ public void setProgress(int value) { } @Override - public void finished() { + public final void finished() { super.finished(); - finishedAction(); + try { + EventQueue.invokeAndWait(new Runnable() { + @Override + public void run() { + finishedAction(); + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + Throwable cause = e.getCause(); + if (cause instanceof RuntimeException) { + throw (RuntimeException) cause; + } else { + cause.printStackTrace(); + } + } } public abstract void finishedAction(); + + @Override + public final void cancel() { + super.cancel(); + try { + EventQueue.invokeAndWait(new Runnable() { + @Override + public void run() { + cancelAction(); + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + Throwable cause = e.getCause(); + if (cause instanceof RuntimeException) { + throw (RuntimeException) cause; + } else { + cause.printStackTrace(); + } + } + } + + public void cancelAction() { } } diff --git a/app/src/processing/app/contrib/ContribProgressMonitor.java b/app/src/processing/app/contrib/ContribProgressMonitor.java index 8e627d957d..4c897e22ae 100644 --- a/app/src/processing/app/contrib/ContribProgressMonitor.java +++ b/app/src/processing/app/contrib/ContribProgressMonitor.java @@ -26,7 +26,7 @@ // This code seems like it's adapted from old example code found on the web. // https://github.com/processing/processing/issues/3176 -abstract class ContribProgressMonitor { +public abstract class ContribProgressMonitor { static final int UNKNOWN = -1; boolean canceled = false; boolean error = false; diff --git a/app/src/processing/app/contrib/Contribution.java b/app/src/processing/app/contrib/Contribution.java index ddd2cf537a..aa401375e6 100644 --- a/app/src/processing/app/contrib/Contribution.java +++ b/app/src/processing/app/contrib/Contribution.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013-15 The Processing Foundation + Copyright (c) 2013-16 The Processing Foundation Copyright (c) 2011-12 Ben Fry and Casey Reas This program is free software; you can redistribute it and/or modify @@ -158,21 +158,41 @@ public int getVersion() { } - // "1.0.2" + public void setPrettyVersion(String pretty) { + if (pretty != null) { + // some entries were written as "null", causing that to show in the ui + if (pretty.equals("null") || pretty.length() == 0) { + pretty = null; + } + } + prettyVersion = pretty; + } + + + // "1.0.2" or null if not present public String getPrettyVersion() { return prettyVersion; } + + // returns prettyVersion, or "" if null + public String getBenignVersion() { + return (prettyVersion != null) ? prettyVersion : ""; + } + + // 1402805757 public long getLastUpdated() { return lastUpdated; } + // 0 public int getMinRevision() { return minRevision; } + // 227 public int getMaxRevision() { return maxRevision; @@ -316,9 +336,59 @@ static StringList parseImports(StringDict properties) { } + /** + * Helper function that creates a StringList of the compatible Modes + * for this Contribution. + */ + static StringList parseModeList(StringDict properties) { + String unparsedModes = properties.get(MODES_PROPERTY); + + // Workaround for 3.0 alpha/beta bug for 3.0b2 + if ("null".equals(unparsedModes)) { + properties.remove(MODES_PROPERTY); + unparsedModes = null; + } + + StringList outgoing = new StringList(); + if (unparsedModes != null) { + outgoing.append(PApplet.trim(PApplet.split(unparsedModes, ','))); + } + return outgoing; + } + + static private String translateCategory(String cat) { // Converts Other to other, I/O to i_o, Video & Vision to video_vision String cleaned = cat.replaceAll("[\\W]+", "_").toLowerCase(); return Language.text("contrib.category." + cleaned); } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + @Override + public boolean equals(Object o) { + if (this == o) return true; + + if (o instanceof Contribution) { + Contribution that = (Contribution) o; + return name.toLowerCase().equals(that.name.toLowerCase()); + } + return false; + } + + + @Override + public int hashCode() { + return name.toLowerCase().hashCode(); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + public interface Filter { + boolean matches(Contribution contrib); + } } diff --git a/app/src/processing/app/contrib/ContributionFilter.java b/app/src/processing/app/contrib/ContributionFilter.java deleted file mode 100644 index 0419b7a69a..0000000000 --- a/app/src/processing/app/contrib/ContributionFilter.java +++ /dev/null @@ -1,5 +0,0 @@ -package processing.app.contrib; - -interface ContributionFilter { - boolean matches(Contribution contrib); -} \ No newline at end of file diff --git a/app/src/processing/app/contrib/ContributionListPanel.java b/app/src/processing/app/contrib/ContributionListPanel.java deleted file mode 100644 index af24b4c6ee..0000000000 --- a/app/src/processing/app/contrib/ContributionListPanel.java +++ /dev/null @@ -1,681 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* - Part of the Processing project - http://processing.org - - Copyright (c) 2013 The Processing Foundation - Copyright (c) 2011-12 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 version 2 - as published by the Free Software Foundation. - - 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.contrib; - -import java.awt.*; -import java.util.List; -import java.util.*; -import java.util.Map.Entry; - -import javax.swing.*; -import javax.swing.RowSorter.SortKey; -import javax.swing.border.Border; -import javax.swing.event.*; -import javax.swing.table.*; - -import processing.app.Base; -import processing.app.Platform; -import processing.app.ui.Toolkit; - - -// The "Scrollable" implementation and its methods here take care of preventing -// the scrolling area from running exceptionally slowly. Not sure why they're -// necessary in the first place, however; seems like odd behavior. -// It also allows the description text in the panels to wrap properly. - -public class ContributionListPanel extends JPanel implements Scrollable, ContributionChangeListener { - - ContributionTab contributionTab; - TreeMap panelByContribution; - - static HyperlinkListener nullHyperlinkListener = new HyperlinkListener() { - public void hyperlinkUpdate(HyperlinkEvent e) { } - }; - - private ContributionPanel selectedPanel; -// protected JPanel statusPlaceholder; -// private StatusPanel status; - protected ContributionFilter filter; -// private ContributionListing contribListing; - protected ContributionListing contribListing = ContributionListing.getInstance(); - protected JTable table; - DefaultTableModel dtm; - - public ContributionListPanel() { - // TODO Auto-generated constructor stub - } - public ContributionListPanel(final ContributionTab contributionTab, - ContributionFilter filter) { - super(); - this.contributionTab = contributionTab; - this.filter = filter; - -// contribListing = ContributionListing.getInstance(); - - setLayout(new GridBagLayout()); - setOpaque(true); - setBackground(Color.WHITE); - - panelByContribution = new TreeMap(contribListing.getComparator()); - -// statusPlaceholder = new JPanel(); -// statusPlaceholder.setVisible(false); -// status = new StatusPanel(null); - - - dtm = new MyTableModel(); - table = new JTable(dtm){ - @Override - public Component prepareRenderer( - TableCellRenderer renderer, int row, int column) { - Component c = super.prepareRenderer(renderer, row, column); - if (isRowSelected(row)) { - c.setBackground(new Color(0xe0fffd)); - } else { - c.setBackground(Color.white); - } - return c; - } - }; - - // There is a space before Status - String[] colName = { " Status", "Name", "Author" }; - dtm.setColumnIdentifiers(colName); - JScrollPane scrollPane = new JScrollPane(table); - table.setFillsViewportHeight(true); -// table.setBorder(); - table.setDefaultRenderer(Contribution.class, new StatusRendere()); - table.setFont(Toolkit.getSansFont(14, Font.PLAIN)); - table.setRowHeight(28); - table.setRowMargin(6); - table.getColumnModel().setColumnMargin(0); - table.getColumnModel().getColumn(0).setMaxWidth(60); - table.getColumnModel().getColumn(2).setMinWidth(ContributionManagerDialog.AUTHOR_WIDTH); - table.getColumnModel().getColumn(2).setMaxWidth(ContributionManagerDialog.AUTHOR_WIDTH); - table.setShowGrid(false); - table.setColumnSelectionAllowed(false); - table.setCellSelectionEnabled(false); - table.setAutoCreateColumnsFromModel(true); - table.setAutoCreateRowSorter(false); - table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - table.getSelectionModel() - .addListSelectionListener(new ListSelectionListener() { - public void valueChanged(ListSelectionEvent event) { - //TODO this executes 2 times when clicked and 1 time when traversed using arrow keys - //Ideally this should always be true but while clearing the table something fishy is going on - if (table.getSelectedRow() != -1) { - setSelectedPanel(panelByContribution.get(table.getValueAt(table - .getSelectedRow(), 0))); - table.requestFocusInWindow(); - } - } - }); - - TableRowSorter sorter = new TableRowSorter(table.getModel()); - table.setRowSorter(sorter); - sorter.setComparator(1, contribListing.getComparator()); - sorter.setComparator(2, new Comparator() { - - @Override - public int compare(Contribution o1, Contribution o2) { - return getAuthorNameWithoutMarkup(o1.getAuthorList()) - .compareTo(getAuthorNameWithoutMarkup(o2.getAuthorList())); - } - }); - sorter.setComparator(0, new Comparator() { - - @Override - public int compare(Contribution o1, Contribution o2) { - int pos1 = 0; - if (o1.isInstalled()) { - pos1 = 1; - if (contribListing.hasUpdates(o1)) { - pos1 = 2; - } - if (!o1.isCompatible(Base.getRevision())) { - pos1 = 3; - } - } else { - pos1 = 4; - } - int pos2 = 0; - if (o2.isInstalled()) { - pos2 = 1; - if (contribListing.hasUpdates(o2)) { - pos2 = 2; - } - if (!o2.isCompatible(Base.getRevision())) { - pos2 = 3; - } - } else { - pos2 = 4; - } - return pos1 - pos2; - } - }); - table.getTableHeader().setDefaultRenderer(new MyColumnHeaderRenderer()); - - GroupLayout layout = new GroupLayout(this); - layout.setHorizontalGroup(layout.createParallelGroup().addComponent(scrollPane)); - layout.setVerticalGroup(layout.createSequentialGroup().addComponent(scrollPane)); - - this.setLayout(layout); - table.setVisible(true); - - } - - class MyColumnHeaderRenderer extends DefaultTableCellRenderer { - - /** - * Constructs a DefaultTableHeaderCellRenderer. - *

- * The horizontal alignment and text position are set as appropriate to a - * table header cell, and the opaque property is set to false. - */ - public MyColumnHeaderRenderer() { -// setHorizontalAlignment(CENTER); - setHorizontalTextPosition(LEFT); -// setVerticalAlignment(BOTTOM); - setOpaque(true); - } - - /** - * Returns the default table header cell renderer. - *

- * If the column is sorted, the appropriate icon is retrieved from the - * current Look and Feel, and a border appropriate to a table header cell - * is applied. - *

- * Subclasses may override this method to provide custom content or - * formatting. - * - * @param table the JTable. - * @param value the value to assign to the header cell - * @param isSelected This parameter is ignored. - * @param hasFocus This parameter is ignored. - * @param row This parameter is ignored. - * @param column the column of the header cell to render - * @return the default table header cell renderer - */ - @Override - public Component getTableCellRendererComponent(JTable table, Object value, - boolean isSelected, boolean hasFocus, int row, int column) { - super.getTableCellRendererComponent(table, value, - isSelected, hasFocus, row, column); - JTableHeader tableHeader = table.getTableHeader(); - if (tableHeader != null) { - setForeground(tableHeader.getForeground()); - } - setIcon(getIcon(table, column)); - if (column % 2 == 0) { - setBackground(new Color(0xdfdfdf)); - } else { - setBackground(new Color(0xebebeb)); - } - setBorder(null); - return this; - } - - /** - * Overloaded to return an icon suitable to the primary sorted column, or null if - * the column is not the primary sort key. - * - * @param table the JTable. - * @param column the column index. - * @return the sort icon, or null if the column is unsorted. - */ - protected Icon getIcon(JTable table, int column) { - SortKey sortKey = getSortKey(table, column); - if (sortKey != null && table.convertColumnIndexToView(sortKey.getColumn()) == column) { - switch (sortKey.getSortOrder()) { - case ASCENDING: - return UIManager.getIcon("Table.ascendingSortIcon"); - case DESCENDING: - return UIManager.getIcon("Table.descendingSortIcon"); - } - } - return null; - } - - /** - * Returns the current sort key, or null if the column is unsorted. - * - * @param table the table - * @param column the column index - * @return the SortKey, or null if the column is unsorted - */ - protected SortKey getSortKey(JTable table, int column) { - RowSorter rowSorter = table.getRowSorter(); - if (rowSorter == null) { - return null; - } - - List sortedColumns = rowSorter.getSortKeys(); - if (sortedColumns.size() > 0) { - return (SortKey) sortedColumns.get(0); - } - return null; - } -} - - class StatusRendere extends DefaultTableCellRenderer { - - @Override - public void setVerticalAlignment(int alignment) { - super.setVerticalAlignment(SwingConstants.CENTER); - } - @Override - public Component getTableCellRendererComponent(JTable table, Object value, - boolean isSelected, - boolean hasFocus, int row, - int column) { - Contribution contribution = (Contribution) value; - JLabel label = new JLabel(); - if (column == 0) { - Icon icon = null; - label.setBorder(BorderFactory.createEmptyBorder(2, 17, 0, 0)); - label.setFont(Toolkit.getSansFont(14, Font.PLAIN)); - if (contribution.isInstalled()) { - icon = Toolkit.getLibIcon("manager/up-to-date.png"); - if (contribListing.hasUpdates(contribution)) { - icon = Toolkit.getLibIcon("manager/update-available.png"); - } - if (!contribution.isCompatible(Base.getRevision())) { - icon = Toolkit.getLibIcon("manager/incompatible.png"); - } - } - label.setIcon(icon); - if (isSelected) { - label.setBackground(new Color(0xe0fffd)); - } - label.setOpaque(true); -// return table.getDefaultRenderer(Icon.class).getTableCellRendererComponent(table, icon, isSelected, false, row, column); - } else if (column == 1) { - // Generating ellipses based on fontMetrics - FontMetrics fontMetrics = table.getFontMetrics(table.getFont()); - int colSize = table.getColumnModel().getColumn(1).getWidth(); - String sentence = contribution.getSentence(); - int currentWidth = table.getFontMetrics(table.getFont().deriveFont(Font.BOLD)).stringWidth(contribution.getName() + " | "); - int ellipsesWidth = fontMetrics.stringWidth("..."); - String name = "" + contribution.getName(); - if (sentence == null) { - label.setText(name + ""); - } else { - sentence = " | " + sentence; - currentWidth += ellipsesWidth; - int i = 0; - for (i = 0; i < sentence.length(); i++) { - currentWidth += fontMetrics.charWidth(sentence.charAt(i)); - if (currentWidth >= colSize) { - break; - } - } - // Adding ellipses only if text doesn't fits into the column - if(i != sentence.length()){ - label.setText(name + sentence.substring(0, i) + "..."); - }else { - label.setText(name + sentence + ""); - } - } - if (!contribution.isCompatible(Base.getRevision())) { - label.setForeground(Color.LIGHT_GRAY); - } - if (table.isRowSelected(row)) { - label.setBackground(new Color(0xe0fffd)); - } - label.setFont(ContributionManagerDialog.myFont); - label.setOpaque(true); - } else { - label = new JLabel( - contribution.isSpecial() ? Toolkit - .getLibIcon("icons/pde-16.png") : null); - String authorList = contribution.getAuthorList(); - String name = getAuthorNameWithoutMarkup(authorList); - label.setText(name.toString()); - label.setHorizontalAlignment(SwingConstants.LEFT); - if(!contribution.isCompatible(Base.getRevision())){ - label.setForeground(Color.LIGHT_GRAY); - }else{ - label.setForeground(Color.BLACK); - } - if (table.isRowSelected(row)) { - label.setBackground(new Color(0xe0fffd)); - } - label.setFont(Toolkit.getSansFont(14, Font.BOLD)); - label.setOpaque(true); - } - return label; - } - } - private class MyTableModel extends DefaultTableModel{ - MyTableModel() { - super(0,0); - } - @Override - public boolean isCellEditable(int row, int column) { - return false; - } - @Override - public Class getColumnClass(int columnIndex) { - return Contribution.class; - } - } - - String getAuthorNameWithoutMarkup(String authorList) { - StringBuilder name = new StringBuilder(""); - if (authorList != null) { - for (int i = 0; i < authorList.length(); i++) { - - if (authorList.charAt(i) == '[' || authorList.charAt(i) == ']') { - continue; - } - if (authorList.charAt(i) == '(') { - i++; - while (authorList.charAt(i) != ')') { - i++; - } - } else { - name.append(authorList.charAt(i)); - } - } - } - return name.toString(); - } - - void updatePanelOrdering(Set contributionsSet) { - /* int row = 0; - for (Entry entry : panelByContribution.entrySet()) { - GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 1; - c.gridx = 0; - c.gridy = row++; - c.anchor = GridBagConstraints.NORTH; - - add(entry.getValue(), c); - } - - GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.BOTH; - c.weightx = 1; - c.weighty = 1; - c.gridx = 0; - c.gridy = row++; - c.anchor = GridBagConstraints.NORTH; - add(status, c);*/ -// System.out.println(dtm.getDataVector()); - dtm.getDataVector().removeAllElements(); - dtm.fireTableDataChanged(); - int rowCount = 0; - for (Contribution entry : contributionsSet) { - ((MyTableModel) table.getModel()).addRow(new Object[] { - entry, entry, entry }); - if (selectedPanel != null && entry.getName() - .equals(selectedPanel.getContrib().getName())) { - table.setRowSelectionInterval(rowCount, rowCount); - } - rowCount++; - } - } - - - public void contributionAdded(final Contribution contribution) { - if (filter.matches(contribution)) { - EventQueue.invokeLater(new Runnable() { - public void run() { - if (!panelByContribution.containsKey(contribution)) { - ContributionPanel newPanel = new ContributionPanel(ContributionListPanel.this); - synchronized (panelByContribution) { - panelByContribution.put(contribution, newPanel); - } - if (newPanel != null) { - newPanel.setContribution(contribution); - add(newPanel); - updatePanelOrdering(panelByContribution.keySet()); - updateColors(); // XXX this is the place - } - } - } - }); - } - } - - - public void contributionRemoved(final Contribution contribution) { - EventQueue.invokeLater(new Runnable() { - public void run() { - synchronized (panelByContribution) { - ContributionPanel panel = panelByContribution.get(contribution); - if (panel != null) { - remove(panel); - panelByContribution.remove(contribution); - } - } - updatePanelOrdering(panelByContribution.keySet()); - updateColors(); - updateUI(); - } - }); - } - - - public void contributionChanged(final Contribution oldContrib, - final Contribution newContrib) { - EventQueue.invokeLater(new Runnable() { - public void run() { - synchronized (panelByContribution) { - ContributionPanel panel = panelByContribution.get(oldContrib); - if (panel == null) { - contributionAdded(newContrib); - } else { - panelByContribution.remove(oldContrib); - panel.setContribution(newContrib); - panelByContribution.put(newContrib, panel); - updatePanelOrdering(panelByContribution.keySet()); - } - } - } - }); - } - - - public void filterLibraries(List filteredContributions) { - synchronized (panelByContribution) { - /*Set hiddenPanels = - new TreeSet(contribListing.getComparator()); - hiddenPanels.addAll(panelByContribution.keySet()); - - for (Contribution info : filteredContributions) { - ContributionPanel panel = panelByContribution.get(info); - if (panel != null) { - panel.setVisible(true); - hiddenPanels.remove(info); - } - } - - for (Contribution info : hiddenPanels) { - ContributionPanel panel = panelByContribution.get(info); - if (panel != null) { - panel.setVisible(false); - } - }*/ - TreeSet panelInThisTab = new TreeSet(contribListing.getComparator()); - for (Contribution contribution : filteredContributions) { - if(contribution.getType() == this.contributionTab.contributionType){ - panelInThisTab.add(contribution); - } - } - updatePanelOrdering(panelInThisTab); - } - } - - - protected void setSelectedPanel(ContributionPanel contributionPanel) { - contributionTab.updateStatusPanel(contributionPanel); - if (selectedPanel == contributionPanel) { - selectedPanel.setSelected(true); - - } else { - - ContributionPanel lastSelected = selectedPanel; - selectedPanel = contributionPanel; - - if (lastSelected != null) { - lastSelected.setSelected(false); - } - contributionPanel.setSelected(true); - - updateColors(); - requestFocusInWindow(); - } - } - - - protected ContributionPanel getSelectedPanel() { - return selectedPanel; - } - - - /** - * Updates the colors of all library panels that are visible. - */ - protected void updateColors() { - int count = 0; - synchronized (panelByContribution) { - for (Entry entry : panelByContribution.entrySet()) { - ContributionPanel panel = entry.getValue(); - - if (panel.isVisible() && panel.isSelected()) { - panel.setBackground(UIManager.getColor("List.selectionBackground")); - panel.setForeground(UIManager.getColor("List.selectionForeground")); - panel.setBorder(UIManager.getBorder("List.focusCellHighlightBorder")); - count++; - - } else { - Border border = null; - if (panel.isVisible()) { - if (Platform.isMacOS()) { - if (count % 2 == 1) { - border = UIManager.getBorder("List.oddRowBackgroundPainter"); - } else { - border = UIManager.getBorder("List.evenRowBackgroundPainter"); - } - } else { - if (count % 2 == 1) { - panel.setBackground(new Color(219, 224, 229)); - } else { - panel.setBackground(new Color(241, 241, 241)); - } - } - count++; - } - - if (border == null) { - border = BorderFactory.createEmptyBorder(1, 1, 1, 1); - } - panel.setBorder(border); - panel.setForeground(UIManager.getColor("List.foreground")); - } - } - } - } - - - public Dimension getPreferredScrollableViewportSize() { - return getPreferredSize(); - } - - - /** - * Amount to scroll to reveal a new page of items - */ - public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { - if (orientation == SwingConstants.VERTICAL) { - int blockAmount = visibleRect.height; - if (direction > 0) { - visibleRect.y += blockAmount; - } else { - visibleRect.y -= blockAmount; - } - - blockAmount += getScrollableUnitIncrement(visibleRect, orientation, direction); - return blockAmount; - } - return 0; - } - - - /** - * Amount to scroll to reveal the rest of something we are on or a new item - */ - public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { - if (orientation == SwingConstants.VERTICAL) { - int lastHeight = 0, height = 0; - int bottomOfScrollArea = visibleRect.y + visibleRect.height; - - for (Component c : getComponents()) { - if (c.isVisible()) { - if (c instanceof ContributionPanel) { - Dimension d = c.getPreferredSize(); - - int nextHeight = height + d.height; - - if (direction > 0) { - // scrolling down - if (nextHeight > bottomOfScrollArea) { - return nextHeight - bottomOfScrollArea; - } - } else { - // scrolling up - if (nextHeight > visibleRect.y) { - if (visibleRect.y != height) { - return visibleRect.y - height; - } else { - return visibleRect.y - lastHeight; - } - } - } - - lastHeight = height; - height = nextHeight; - } - } - } - } - return 0; - } - - - public boolean getScrollableTracksViewportHeight() { - return false; - } - - - public boolean getScrollableTracksViewportWidth() { - return true; - } - - - public int getNoOfRows() { - return panelByContribution.size(); - } -} diff --git a/app/src/processing/app/contrib/ContributionListing.java b/app/src/processing/app/contrib/ContributionListing.java index 8a6e5cbb05..6f35ca3fd7 100644 --- a/app/src/processing/app/contrib/ContributionListing.java +++ b/app/src/processing/app/contrib/ContributionListing.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013-15 The Processing Foundation + Copyright (c) 2013-16 The Processing Foundation Copyright (c) 2011-12 Ben Fry and Casey Reas This program is free software; you can redistribute it and/or modify @@ -21,7 +21,9 @@ */ package processing.app.contrib; +import java.awt.EventQueue; import java.io.*; +import java.lang.reflect.InvocationTargetException; import java.net.*; import java.text.Normalizer; import java.util.*; @@ -36,41 +38,45 @@ public class ContributionListing { - // Stable URL that will redirect to wherever we're hosting the file + static volatile ContributionListing singleInstance; + + /** Stable URL that will redirect to wherever the file is hosted */ static final String LISTING_URL = "http://download.processing.org/contribs"; static final String LOCAL_FILENAME = "contribs.txt"; - static volatile ContributionListing singleInstance; - + /** Location of the listing file on disk, will be read and written. */ File listingFile; - List listeners; + + List listeners; List advertisedContributions; Map> librariesByCategory; - public Map librariesByImportHeader; - List allContributions; - boolean hasDownloadedLatestList; - boolean hasListDownloadFailed; + Map librariesByImportHeader; + // TODO: Every contribution is getting added twice + // and nothing is replaced ever. + Set allContributions; + boolean listDownloaded; + boolean listDownloadFailed; ReentrantLock downloadingListingLock; private ContributionListing() { - listeners = new ArrayList(); - advertisedContributions = new ArrayList(); - librariesByCategory = new HashMap>(); - librariesByImportHeader = new HashMap(); - allContributions = new ArrayList(); + listeners = new ArrayList<>(); + advertisedContributions = new ArrayList<>(); + librariesByCategory = new HashMap<>(); + librariesByImportHeader = new HashMap<>(); + allContributions = new LinkedHashSet<>(); downloadingListingLock = new ReentrantLock(); //listingFile = Base.getSettingsFile("contributions.txt"); listingFile = Base.getSettingsFile(LOCAL_FILENAME); - listingFile.setWritable(true); + listingFile.setWritable(true, false); if (listingFile.exists()) { setAdvertisedList(listingFile); } } - public static ContributionListing getInstance() { + static public ContributionListing getInstance() { if (singleInstance == null) { synchronized (ContributionListing.class) { if (singleInstance == null) { @@ -82,7 +88,7 @@ public static ContributionListing getInstance() { } - void setAdvertisedList(File file) { + private void setAdvertisedList(File file) { listingFile = file; advertisedContributions.clear(); @@ -90,7 +96,6 @@ void setAdvertisedList(File file) { for (Contribution contribution : advertisedContributions) { addContribution(contribution); } - Collections.sort(allContributions, nameComparator); } @@ -98,8 +103,8 @@ void setAdvertisedList(File file) { * Adds the installed libraries to the listing of libraries, replacing any * pre-existing libraries by the same name as one in the list. */ - protected void updateInstalledList(List installedContributions) { - for (Contribution contribution : installedContributions) { + protected void updateInstalledList(List installed) { + for (Contribution contribution : installed) { Contribution existingContribution = getContribution(contribution); if (existingContribution != null) { replaceContribution(existingContribution, contribution); @@ -127,17 +132,14 @@ protected void replaceContribution(Contribution oldLib, Contribution newLib) { if (oldLib.getImports() != null) { for (String importName : oldLib.getImports()) { - if (librariesByImportHeader.containsKey(importName)) { - librariesByImportHeader.put(importName, newLib); + if (getLibrariesByImportHeader().containsKey(importName)) { + getLibrariesByImportHeader().put(importName, newLib); } } } - for (int i = 0; i < allContributions.size(); i++) { - if (allContributions.get(i) == oldLib) { - allContributions.set(i, newLib); - } - } + allContributions.remove(oldLib); + allContributions.add(newLib); notifyChange(oldLib, newLib); } @@ -147,23 +149,22 @@ protected void replaceContribution(Contribution oldLib, Contribution newLib) { private void addContribution(Contribution contribution) { if (contribution.getImports() != null) { for (String importName : contribution.getImports()) { - librariesByImportHeader.put(importName, contribution); + getLibrariesByImportHeader().put(importName, contribution); } } for (String category : contribution.getCategories()) { if (librariesByCategory.containsKey(category)) { List list = librariesByCategory.get(category); list.add(contribution); - Collections.sort(list, nameComparator); + Collections.sort(list, COMPARATOR); } else { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); list.add(contribution); librariesByCategory.put(category, list); } allContributions.add(contribution); notifyAdd(contribution); - Collections.sort(allContributions, nameComparator); } } @@ -176,7 +177,7 @@ protected void removeContribution(Contribution contribution) { } if (contribution.getImports() != null) { for (String importName : contribution.getImports()) { - librariesByImportHeader.remove(importName); + getLibrariesByImportHeader().remove(importName); } } allContributions.remove(contribution); @@ -196,20 +197,20 @@ private Contribution getContribution(Contribution contribution) { protected AvailableContribution getAvailableContribution(Contribution info) { - Iterator iter = advertisedContributions.iterator(); - while(iter.hasNext()) { - AvailableContribution advertised = iter.next(); - if (advertised.getType() == info.getType() && - advertised.getName().equals(info.getName())) { - return advertised; + synchronized (advertisedContributions) { + for (AvailableContribution advertised : advertisedContributions) { + if (advertised.getType() == info.getType() && + advertised.getName().equals(info.getName())) { + return advertised; + } } } return null; } - protected Set getCategories(ContributionFilter filter) { - Set outgoing = new HashSet(); + protected Set getCategories(Contribution.Filter filter) { + Set outgoing = new HashSet<>(); Set categorySet = librariesByCategory.keySet(); for (String categoryName : categorySet) { @@ -217,7 +218,7 @@ protected Set getCategories(ContributionFilter filter) { if (filter.matches(contrib)) { // TODO still not sure why category would be coming back null [fry] // http://code.google.com/p/processing/issues/detail?id=1387 - if (categoryName != null && categoryName.trim().length() != 0) { + if (categoryName != null && !categoryName.trim().isEmpty()) { outgoing.add(categoryName); } break; @@ -228,47 +229,11 @@ protected Set getCategories(ContributionFilter filter) { } -// public List getAllContributions() { -// return new ArrayList(allContributions); -// } - - -// public List getLibararies(String category) { -// ArrayList libinfos = -// new ArrayList(librariesByCategory.get(category)); -// Collections.sort(libinfos, nameComparator); -// return libinfos; -// } - - - protected List getFilteredLibraryList(String category, List filters) { - ArrayList filteredList = - new ArrayList(allContributions); - - Iterator it = filteredList.iterator(); - while (it.hasNext()) { - Contribution libInfo = it.next(); - //if (category != null && !category.equals(libInfo.getCategory())) { - if (category != null && !libInfo.hasCategory(category)) { - it.remove(); - } else { - for (String filter : filters) { - if (!matches(libInfo, filter)) { - it.remove(); - break; - } - } - } - } - return filteredList; - } - - - private boolean matches(Contribution contrib, String filter) { - int colon = filter.indexOf(":"); + public boolean matches(Contribution contrib, String typed) { + int colon = typed.indexOf(":"); if (colon != -1) { - String isText = filter.substring(0, colon); - String property = filter.substring(colon + 1); + String isText = typed.substring(0, colon); + String property = typed.substring(colon + 1); // Chances are the person is still typing the property, so rather than // make the list flash empty (because nothing contains "is:" or "has:", @@ -278,28 +243,37 @@ private boolean matches(Contribution contrib, String filter) { } if ("is".equals(isText) || "has".equals(isText)) { - return hasProperty(contrib, filter.substring(colon + 1)); + return hasProperty(contrib, typed.substring(colon + 1)); } else if ("not".equals(isText)) { - return !hasProperty(contrib, filter.substring(colon + 1)); + return !hasProperty(contrib, typed.substring(colon + 1)); } } - filter = ".*" + filter.toLowerCase() + ".*"; + typed = ".*" + typed.toLowerCase() + ".*"; - return contrib.getAuthorList() != null && deAccent(contrib.getAuthorList().toLowerCase()).matches(filter) - || contrib.getSentence() != null && deAccent(contrib.getSentence().toLowerCase()).matches(filter) - || contrib.getParagraph() != null && deAccent(contrib.getParagraph().toLowerCase()).matches(filter) - || contrib.hasCategory(filter) - || contrib.getName() != null && deAccent(contrib.getName().toLowerCase()).matches(filter); + return (matchField(contrib.getName(), typed) || + matchField(contrib.getAuthorList(), typed) || + matchField(contrib.getSentence(), typed) || + matchField(contrib.getParagraph(), typed) || + contrib.hasCategory(typed)); } - public String deAccent(String str) { + + static private boolean matchField(String field, String typed) { + return (field != null) && + removeAccents(field.toLowerCase()).matches(typed); + } + + + // TODO is this removing characters with accents, not ascii normalizing them? [fry] + static private String removeAccents(String str) { String nfdNormalizedString = Normalizer.normalize(str, Normalizer.Form.NFD); Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+"); return pattern.matcher(nfdNormalizedString).replaceAll(""); } - private boolean isProperty(String property) { + + static private boolean isProperty(String property) { return property.startsWith("updat") || property.startsWith("upgrad") || property.startsWith("instal") && !property.startsWith("installabl") || property.equals("tool") || property.startsWith("lib") @@ -324,60 +298,55 @@ private boolean hasProperty(Contribution contrib, String property) { } if (property.startsWith("lib")) { return contrib.getType() == ContributionType.LIBRARY; -// return contrib.getType() == Contribution.Type.LIBRARY -// || contrib.getType() == Contribution.Type.LIBRARY_COMPILATION; } if (property.equals("mode")) { return contrib.getType() == ContributionType.MODE; } -// if (property.equals("compilation")) { -// return contrib.getType() == Contribution.Type.LIBRARY_COMPILATION; -// } - return false; } - protected List getCompatibleContributionList(List filteredLibraries, boolean filter) { - ArrayList filteredList = - new ArrayList(filteredLibraries); - - if (!filter) - return filteredList; - - Iterator it = filteredList.iterator(); - while (it.hasNext()) { - Contribution libInfo = it.next(); - if (!libInfo.isCompatible(Base.getRevision())) { - it.remove(); + /* + protected List listCompatible(List contribs, boolean filter) { + List filteredList = + new ArrayList(contribs); + + if (filter) { + Iterator it = filteredList.iterator(); + while (it.hasNext()) { + Contribution libInfo = it.next(); + if (!libInfo.isCompatible(Base.getRevision())) { + it.remove(); + } } } return filteredList; } + */ private void notifyRemove(Contribution contribution) { - for (ContributionChangeListener listener : listeners) { + for (ChangeListener listener : listeners) { listener.contributionRemoved(contribution); } } private void notifyAdd(Contribution contribution) { - for (ContributionChangeListener listener : listeners) { + for (ChangeListener listener : listeners) { listener.contributionAdded(contribution); } } private void notifyChange(Contribution oldLib, Contribution newLib) { - for (ContributionChangeListener listener : listeners) { + for (ChangeListener listener : listeners) { listener.contributionChanged(oldLib, newLib); } } - protected void addContributionListener(ContributionChangeListener listener) { + protected void addListener(ChangeListener listener) { for (Contribution contrib : allContributions) { listener.contributionAdded(contrib); } @@ -385,31 +354,20 @@ protected void addContributionListener(ContributionChangeListener listener) { } - /* - private void removeContributionListener(ContributionChangeListener listener) { - listeners.remove(listener); - } - - - private ArrayList getContributionListeners() { - return new ArrayList(listeners); - } - */ - - /** * Starts a new thread to download the advertised list of contributions. * Only one instance will run at a time. */ - protected void downloadAvailableList(final Base base, - final ContribProgressMonitor progress) { + public void downloadAvailableList(final Base base, + final ContribProgressMonitor progress) { + + // TODO: replace with SwingWorker [jv] new Thread(new Runnable() { public void run() { downloadingListingLock.lock(); - URL url = null; try { - url = new URL(LISTING_URL); + URL url = new URL(LISTING_URL); // testing port // url = new URL("http", "download.processing.org", 8989, "/contribs"); @@ -423,7 +381,7 @@ public void run() { // System.out.println(contribInfo.length() + " " + contribInfo); File tempContribFile = Base.getSettingsFile("contribs.tmp"); - tempContribFile.setWritable(true); + tempContribFile.setWritable(true, false); ContributionManager.download(url, base.getInstalledContribsInfo(), tempContribFile, progress); if (!progress.isCanceled() && !progress.isError()) { @@ -431,157 +389,78 @@ public void run() { listingFile.delete(); // may silently fail, but below may still work } if (tempContribFile.renameTo(listingFile)) { - hasDownloadedLatestList = true; - hasListDownloadFailed = false; - setAdvertisedList(listingFile); + listDownloaded = true; + listDownloadFailed = false; + try { + // TODO: run this in SwingWorker done() [jv] + EventQueue.invokeAndWait(new Runnable() { + @Override + public void run() { + setAdvertisedList(listingFile); + base.setUpdatesAvailable(countUpdates(base)); + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + Throwable cause = e.getCause(); + if (cause instanceof RuntimeException) { + throw (RuntimeException) cause; + } else { + cause.printStackTrace(); + } + } } else { - hasListDownloadFailed = true; + listDownloadFailed = true; } } } catch (MalformedURLException e) { progress.error(e); progress.finished(); + } finally { + downloadingListingLock.unlock(); } - downloadingListingLock.unlock(); } }, "Contribution List Downloader").start(); } - /* - boolean hasUpdates() { - for (Contribution info : allContributions) { - if (hasUpdates(info)) { - return true; - } - } - return false; - } - */ - - - /** - * TODO This needs to be called when the listing loads, and also whenever - * the contribs list has been updated (for whatever reason). In addition, - * the caller (presumably Base) should update all Editor windows with the - * correct information on the number of items available. - * @return The number of contributions that have available updates. - */ - int countUpdates(Base base) { - int count = 0; - for (ModeContribution mc : base.getModeContribs()) { - if (hasUpdates(mc)) { - count++; - } - } - for (Library lib : base.getActiveEditor().getMode().contribLibraries) { - if (hasUpdates(lib)) { - count++; - } - } - for (ToolContribution tc : base.getActiveEditor().getToolContribs()) { - if (hasUpdates(tc)) { - count++; - } - } - return count; - } - - - boolean hasUpdates(Base base) { - for (ModeContribution mc : base.getModeContribs()) { - if (hasUpdates(mc)) { - return true; - } - } - for (Library lib : base.getActiveEditor().getMode().contribLibraries) { - if (hasUpdates(lib)) { - return true; - } - } - for (ToolContribution tc : base.getActiveEditor().getToolContribs()) { - if (hasUpdates(tc)) { - return true; - } - } - return false; - } - - - boolean hasUpdates(Contribution contribution) { + protected boolean hasUpdates(Contribution contribution) { if (contribution.isInstalled()) { Contribution advertised = getAvailableContribution(contribution); if (advertised == null) { return false; } - return advertised.getVersion() > contribution.getVersion(); + return advertised.getVersion() > contribution.getVersion() + && advertised.isCompatible(Base.getRevision()); } return false; } - String getLatestVersion(Contribution contribution) { + protected String getLatestPrettyVersion(Contribution contribution) { Contribution newestContrib = getAvailableContribution(contribution); - if(newestContrib == null){ + if (newestContrib == null) { return null; } - String latestVersion = newestContrib.getPrettyVersion(); - if (latestVersion != null && !latestVersion.isEmpty()) { - if (latestVersion.toLowerCase().startsWith("build")) // For Python mode - return ("v" + latestVersion.substring(5, latestVersion.indexOf(',')) - .trim()); - else if (latestVersion.toLowerCase().startsWith("v")) // For ketai library - return latestVersion; - else - return ("v" + latestVersion); - } - else - return null; + return newestContrib.getPrettyVersion(); } - - boolean hasDownloadedLatestList() { - return hasDownloadedLatestList; + protected boolean hasDownloadedLatestList() { + return listDownloaded; } - boolean hasListDownloadFailed() { - return hasListDownloadFailed; + protected boolean hasListDownloadFailed() { + return listDownloadFailed; } -// /** -// * @return a lowercase string with all non-alphabetic characters removed -// */ -// static protected String normalize(String s) { -// return s.toLowerCase().replaceAll("^\\p{Lower}", ""); -// } - - -// /** -// * @return the proper, valid name of this category to be displayed in the UI -// * (e.g. "Typography / Geometry"). "Unknown" if the category null. -// */ -// static public String getCategory(String category) { -// if (category == null) { -// return "Unknown"; -// } -// String normCatName = normalize(category); -// -// for (String validCatName : validCategories) { -// String normValidCatName = normalize(validCatName); -// if (normValidCatName.equals(normCatName)) { -// return validCatName; -// } -// } -// return category; -// } - - - ArrayList parseContribList(File file) { - ArrayList outgoing = new ArrayList(); + private List parseContribList(File file) { + List outgoing = + new ArrayList<>(); if (file != null && file.exists()) { String[] lines = PApplet.loadStrings(file); @@ -594,7 +473,7 @@ ArrayList parseContribList(File file) { System.err.println("Error in contribution listing file on line " + (start+1)); // Scan forward for the next blank line int end = ++start; - while (end < lines.length && lines[end].trim().length() != 0) { + while (end < lines.length && !lines[end].trim().isEmpty()) { end++; } start = end + 1; @@ -602,7 +481,7 @@ ArrayList parseContribList(File file) { } else { // Scan forward for the next blank line int end = ++start; - while (end < lines.length && lines[end].trim().length() != 0) { + while (end < lines.length && !lines[end].trim().isEmpty()) { end++; } @@ -617,19 +496,59 @@ ArrayList parseContribList(File file) { } -// boolean isDownloadingListing() { -// return downloadingListingLock.isLocked(); -// } + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - public Comparator getComparator() { - return nameComparator; + /** + * TODO This needs to be called when the listing loads, and also whenever + * the contribs list has been updated (for whatever reason). In addition, + * the caller (presumably Base) should update all Editor windows with the + * correct information on the number of items available. + * @return The number of contributions that have available updates. + */ + public int countUpdates(Base base) { + int count = 0; + for (ModeContribution mc : base.getModeContribs()) { + if (hasUpdates(mc)) { + count++; + } + } + for (Library lib : base.getActiveEditor().getMode().contribLibraries) { + if (hasUpdates(lib)) { + count++; + } + } + for (Library lib : base.getActiveEditor().getMode().coreLibraries) { + if (hasUpdates(lib)) { + count++; + } + } + for (ToolContribution tc : base.getToolContribs()) { + if (hasUpdates(tc)) { + count++; + } + } + for (ExamplesContribution ec : base.getExampleContribs()) { + if (hasUpdates(ec)) { + count++; + } + } + return count; } - static Comparator nameComparator = new Comparator() { - public int compare(Contribution o1, Contribution o2) { - return o1.getName().toLowerCase().compareTo(o2.getName().toLowerCase()); - } - }; + /** Used by JavaEditor to auto-import */ + public Map getLibrariesByImportHeader() { + return librariesByImportHeader; + } + + + static public Comparator COMPARATOR = Comparator.comparing(o -> o.getName().toLowerCase()); + + + public interface ChangeListener { + public void contributionAdded(Contribution Contribution); + public void contributionRemoved(Contribution Contribution); + public void contributionChanged(Contribution oldLib, Contribution newLib); + } } diff --git a/app/src/processing/app/contrib/ContributionManager.java b/app/src/processing/app/contrib/ContributionManager.java index 559bce6657..af9c4d8995 100644 --- a/app/src/processing/app/contrib/ContributionManager.java +++ b/app/src/processing/app/contrib/ContributionManager.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013 The Processing Foundation + Copyright (c) 2013-20 The Processing Foundation Copyright (c) 2011-12 Ben Fry and Casey Reas This program is free software; you can redistribute it and/or modify @@ -21,10 +21,11 @@ */ package processing.app.contrib; +import java.awt.EventQueue; import java.io.*; +import java.lang.reflect.InvocationTargetException; import java.net.*; import java.util.*; -import java.util.zip.GZIPOutputStream; import javax.swing.SwingWorker; @@ -38,11 +39,7 @@ public class ContributionManager { - static public final ContributionListing contribListing; - - static { - contribListing = ContributionListing.getInstance(); - } + static ContributionListing listing; /** @@ -63,8 +60,8 @@ static boolean download(URL source, byte[] post, File dest, ContribProgressMonitor progress) { boolean success = false; try { - HttpURLConnection conn = (HttpURLConnection) source.openConnection(); + // Will not handle a protocol change (see below) HttpURLConnection.setFollowRedirects(true); conn.setConnectTimeout(15 * 1000); conn.setReadTimeout(60 * 1000); @@ -72,9 +69,9 @@ static boolean download(URL source, byte[] post, if (post == null) { conn.setRequestMethod("GET"); conn.connect(); - } else { - post = gzipEncode(post); + } else { + post = Util.gzipEncode(post); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Content-Encoding", "gzip"); @@ -93,27 +90,37 @@ static boolean download(URL source, byte[] post, progress.startTask(Language.text("contrib.progress.downloading"), fileSize); } - InputStream in = conn.getInputStream(); - FileOutputStream out = new FileOutputStream(dest); + int response = conn.getResponseCode(); + // Default won't follow HTTP -> HTTPS redirects for security reasons + // http://stackoverflow.com/a/1884427 + if (response >= 300 && response < 400) { + // Handle SSL redirects from HTTP sources + // https://github.com/processing/processing/issues/5554 + String newLocation = conn.getHeaderField("Location"); + return download(new URL(newLocation), post, dest, progress); - byte[] b = new byte[8192]; - int amount; - if (progress != null) { - int total = 0; - while (!progress.isCanceled() && (amount = in.read(b)) != -1) { - out.write(b, 0, amount); - total += amount; - progress.setProgress(total); - } } else { - while ((amount = in.read(b)) != -1) { - out.write(b, 0, amount); + InputStream in = conn.getInputStream(); + FileOutputStream out = new FileOutputStream(dest); + + byte[] b = new byte[8192]; + int amount; + if (progress != null) { + int total = 0; + while (!progress.isCanceled() && (amount = in.read(b)) != -1) { + out.write(b, 0, amount); + total += amount; + progress.setProgress(total); + } + } else { + while ((amount = in.read(b)) != -1) { + out.write(b, 0, amount); + } } + out.flush(); + out.close(); + success = true; } - out.flush(); - out.close(); - success = true; - } catch (SocketTimeoutException ste) { if (progress != null) { progress.error(ste); @@ -124,8 +131,6 @@ static boolean download(URL source, byte[] post, progress.error(ioe); progress.cancel(); } - // Hiding stack trace. An error has been shown where needed. -// ioe.printStackTrace(); } if (progress != null) { progress.finished(); @@ -134,15 +139,6 @@ static boolean download(URL source, byte[] post, } - static private byte[] gzipEncode(byte[] what) throws IOException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - GZIPOutputStream output = new GZIPOutputStream(baos); - PApplet.saveStream(output, new ByteArrayInputStream(what)); - output.close(); - return baos.toByteArray(); - } - - /** * Non-blocking call to download and install a contribution in a new thread. * @@ -154,13 +150,13 @@ static private byte[] gzipEncode(byte[] what) throws IOException { * old version of a contribution that is being updated). Must not be * null. */ - static void downloadAndInstall(final Editor editor, + static void downloadAndInstall(final Base base, final URL url, final AvailableContribution ad, final ContribProgressBar downloadProgress, final ContribProgressBar installProgress, final StatusPanel status) { - + // TODO: replace with SwingWorker [jv] new Thread(new Runnable() { public void run() { String filename = url.getFile(); @@ -174,22 +170,37 @@ public void run() { if (!downloadProgress.isCanceled() && !downloadProgress.isError()) { installProgress.startTask(Language.text("contrib.progress.installing"), ContribProgressMonitor.UNKNOWN); - LocalContribution contribution = - ad.install(editor.getBase(), contribZip, false, status); + final LocalContribution contribution = + ad.install(base, contribZip, false, status); if (contribution != null) { - contribListing.replaceContribution(ad, contribution); - if (contribution.getType() == ContributionType.MODE) { - List contribModes = editor.getBase().getModeContribs(); - if (!contribModes.contains(contribution)) { - contribModes.add((ModeContribution) contribution); - } + try { + // TODO: run this in SwingWorker done() [jv] + EventQueue.invokeAndWait(new Runnable() { + @Override + public void run() { + listing.replaceContribution(ad, contribution); + /* + if (contribution.getType() == ContributionType.MODE) { + List contribModes = editor.getBase().getModeContribs(); + if (!contribModes.contains(contribution)) { + contribModes.add((ModeContribution) contribution); + } + } + */ + base.refreshContribs(contribution.getType()); + base.setUpdatesAvailable(listing.countUpdates(base)); + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + throw (Exception) e.getCause(); } - refreshInstalled(editor); } installProgress.finished(); - } - else { + + } else { if (downloadProgress.exception instanceof SocketTimeoutException) { status.setErrorMessage(Language .interpolate("contrib.errors.contrib_download.timeout", @@ -202,7 +213,6 @@ public void run() { } contribZip.delete(); - //} catch (NoClassDefFoundError ncdfe) { } catch (Exception e) { String msg = null; if (e instanceof RuntimeException) { @@ -218,6 +228,8 @@ public void run() { if (msg == null) { msg = Language.interpolate("contrib.errors.download_and_install", ad.getName()); + // Something unexpected, so print the trace + e.printStackTrace(); } status.setErrorMessage(msg); downloadProgress.cancel(); @@ -240,14 +252,12 @@ public void run() { * procedure is not of importance, such as if a contribution has to be * installed at startup time. * - * @param url - * Direct link to the contribution. - * @param ad - * The AvailableContribution to be downloaded and installed. + * @param url Direct link to the contribution. + * @param ad The AvailableContribution to be downloaded and installed. */ static void downloadAndInstallOnStartup(final Base base, final URL url, final AvailableContribution ad) { - + // TODO: replace with SwingWorker [jv] new Thread(new Runnable() { public void run() { String filename = url.getFile(); @@ -259,29 +269,36 @@ public void run() { try { download(url, null, contribZip, null); - LocalContribution contribution = ad.install(base, contribZip, + final LocalContribution contribution = ad.install(base, contribZip, false, null); if (contribution != null) { - contribListing.replaceContribution(ad, contribution); - if (contribution.getType() == ContributionType.MODE) { - List contribModes = base.getModeContribs(); - if (contribModes != null && !contribModes.contains(contribution)) { - contribModes.add((ModeContribution) contribution); + try { + // TODO: run this in SwingWorker done() [jv] + EventQueue.invokeAndWait(new Runnable() { + @Override + public void run() { + listing.replaceContribution(ad, contribution); + base.refreshContribs(contribution.getType()); + base.setUpdatesAvailable(listing.countUpdates(base)); + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + Throwable cause = e.getCause(); + if (cause instanceof RuntimeException) { + throw (RuntimeException) cause; + } else { + cause.printStackTrace(); } } - if (base.getActiveEditor() != null) { - refreshInstalled(base.getActiveEditor()); - } } contribZip.delete(); - handleUpdateFailedMarkers(ad, filename.substring(0, filename.lastIndexOf('.'))); } catch (Exception e) { -// Chuck the stack trace. The user might have no idea why it is appearing, or what (s)he did wrong... -// e.printStackTrace(); String arg = "contrib.startup.errors.download_install"; System.err.println(Language.interpolate(arg, ad.getName())); } @@ -294,42 +311,47 @@ public void run() { } -/** - * After install, this function checks whether everything went properly or not. - * If not, it adds a marker file so that the next time Processing is started, installPreviouslyFailed() - * can install the contribution. - * @param ac - * The contribution just installed. - * @param filename - * The name of the folder in which the contribution is supposed to be stored. - */ - static private void handleUpdateFailedMarkers(final AvailableContribution ac, String filename) { - - File contribLocn = ac.getType().getSketchbookFolder(); + /** + * After install, this function checks whether everything went properly. + * If not, it adds a marker file so that the next time Processing is started, + * installPreviouslyFailed() can install the contribution. + * @param c the contribution just installed + * @param filename name of the folder for the contribution + */ + static private void handleUpdateFailedMarkers(final AvailableContribution c, + String filename) { + File typeFolder = c.getType().getSketchbookFolder(); - for (File contribDir : contribLocn.listFiles()) + for (File contribDir : typeFolder.listFiles()) { if (contribDir.isDirectory()) { + /* File[] contents = contribDir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String file) { - return file.equals(ac.getType() + ".properties"); + return file.equals(c.getType() + ".properties"); } }); - if (contents.length > 0 && Util.readSettings(contents[0]).get("name").equals(ac.getName())) { + if (contents.length > 0 && Util.readSettings(contents[0]).get("name").equals(c.getName())) { return; } + */ + File propsFile = new File(contribDir, c.getType() + ".properties"); + if (propsFile.exists()) { + StringDict props = Util.readSettings(propsFile); + if (c.getName().equals(props.get("name"))) { + return; + } + } } + } try { - new File(contribLocn, ac.getName()).createNewFile(); + new File(typeFolder, c.getName()).createNewFile(); } catch (IOException e) { -// Again, forget about the stack trace. The user ain't done wrong -// e.printStackTrace(); String arg = "contrib.startup.errors.new_marker"; - System.err.println(Language.interpolate(arg, ac.getName())); + System.err.println(Language.interpolate(arg, c.getName())); } - } @@ -339,29 +361,28 @@ public boolean accept(File dir, String file) { * anything and providing feedback via the console status area, such as when * the user tries to run a sketch that imports uninstaled libraries. * - * @param aList - * The list of AvailableContributions to be downloaded and installed. + * @param list The list of AvailableContributions to be downloaded and installed. */ - public static void downloadAndInstallOnImport(final Base base, - final List aList) { - - // To avoid the user from modifying stuff, since this function is only called - // during pre-processing - base.getActiveEditor().getTextArea().setEditable(false); + static public void downloadAndInstallOnImport(final Base base, + final List list) { + // To avoid the user from modifying stuff, since this function is only + // called during pre-processing + Editor editor = base.getActiveEditor(); + editor.getTextArea().setEditable(false); // base.getActiveEditor().getConsole().clear(); - ArrayList installedLibList = new ArrayList(); + List installedLibList = new ArrayList<>(); // boolean variable to check if previous lib was installed successfully, // to give the user an idea about progress being made. boolean isPrevDone = false; - for (AvailableContribution ad : aList) { - if (ad.getType() != ContributionType.LIBRARY) { + for (final AvailableContribution contrib : list) { + if (contrib.getType() != ContributionType.LIBRARY) { continue; } try { - URL url = new URL(ad.link); + URL url = new URL(contrib.link); String filename = url.getFile(); filename = filename.substring(filename.lastIndexOf('/') + 1); try { @@ -373,17 +394,16 @@ public static void downloadAndInstallOnImport(final Base base, // Use the console to let the user know what's happening // The slightly complex if-else is required to let the user know when // one install is completed and the next download has begun without - // interfereing with occur status messages that may arise in the meanwhile - String statusMsg = base.getActiveEditor().getStatusMessage(); + // interfering with other status messages that may arise in the meanwhile + String statusMsg = editor.getStatusMessage(); if (isPrevDone) { String status = statusMsg + " " - + Language.interpolate("contrib.import.progress.download", ad.name); - base.getActiveEditor().statusNotice(status); - } - else { + + Language.interpolate("contrib.import.progress.download", contrib.name); + editor.statusNotice(status); + } else { String arg = "contrib.import.progress.download"; - String status = Language.interpolate(arg, ad.name); - base.getActiveEditor().statusNotice(status); + String status = Language.interpolate(arg, contrib.name); + editor.statusNotice(status); } isPrevDone = false; @@ -391,40 +411,55 @@ public static void downloadAndInstallOnImport(final Base base, download(url, null, contribZip, null); String arg = "contrib.import.progress.install"; - base.getActiveEditor().statusNotice(Language.interpolate(arg,ad.name)); - LocalContribution contribution = ad.install(base, contribZip, - false, null); + editor.statusNotice(Language.interpolate(arg,contrib.name)); + final LocalContribution contribution = + contrib.install(base, contribZip, false, null); if (contribution != null) { - contribListing.replaceContribution(ad, contribution); - if (base.getActiveEditor() != null) { - refreshInstalled(base.getActiveEditor()); + try { + EventQueue.invokeAndWait(new Runnable() { + @Override + public void run() { + listing.replaceContribution(contrib, contribution); + base.refreshContribs(contribution.getType()); + base.setUpdatesAvailable(listing.countUpdates(base)); + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + Throwable cause = e.getCause(); + if (cause instanceof RuntimeException) { + throw (RuntimeException) cause; + } else { + cause.printStackTrace(); + } } } contribZip.delete(); - installedLibList.add(ad.name); + installedLibList.add(contrib.name); isPrevDone = true; arg = "contrib.import.progress.done"; - base.getActiveEditor().statusNotice(Language.interpolate(arg,ad.name)); + editor.statusNotice(Language.interpolate(arg,contrib.name)); } catch (Exception e) { String arg = "contrib.startup.errors.download_install"; - System.err.println(Language.interpolate(arg, ad.getName())); + System.err.println(Language.interpolate(arg, contrib.getName())); } } catch (IOException e) { String arg = "contrib.startup.errors.temp_dir"; - System.err.println(Language.interpolate(arg,ad.getName())); + System.err.println(Language.interpolate(arg,contrib.getName())); } } catch (MalformedURLException e1) { System.err.println(Language.interpolate("contrib.import.errors.link", - ad.getName())); + contrib.getName())); } } - base.getActiveEditor().getTextArea().setEditable(true); - base.getActiveEditor().statusEmpty(); + editor.getTextArea().setEditable(true); + editor.statusEmpty(); System.out.println(Language.text("contrib.import.progress.final_list")); for (String l : installedLibList) { System.out.println(" * " + l); @@ -432,17 +467,16 @@ public static void downloadAndInstallOnImport(final Base base, } - static public void refreshInstalled(Editor e) { - - Iterator iter = e.getBase().getEditors().iterator(); - while (iter.hasNext()) { - Editor ed = iter.next(); + /* + static void refreshInstalled(Editor e) { + for (Editor ed : e.getBase().getEditors()) { ed.getMode().rebuildImportMenu(); ed.getMode().rebuildExamplesFrame(); ed.rebuildToolMenu(); ed.rebuildModeMenu(); } } + */ /** @@ -501,8 +535,7 @@ static public String getFileName(File libFile) { * and remove any "requires restart" flags. * Also updates all entries previously marked for update. */ - static public void cleanup(final Base base) throws Exception { - + static private void cleanup(final Base base) throws Exception { deleteTemp(Base.getSketchbookModesFolder()); deleteTemp(Base.getSketchbookToolsFolder()); @@ -520,7 +553,9 @@ static public void cleanup(final Base base) throws Exception { @Override protected Void doInBackground() throws Exception { try { - Thread.sleep(1 * 1000); + // TODO: pls explain the sleep and why this runs on a worker thread, + // but a couple of lines above on EDT [jv] + Thread.sleep(1000); installPreviouslyFailed(base, Base.getSketchbookToolsFolder()); } catch (InterruptedException e) { e.printStackTrace(); @@ -530,8 +565,6 @@ protected Void doInBackground() throws Exception { }; s.execute(); - - clearRestartFlags(Base.getSketchbookModesFolder()); clearRestartFlags(Base.getSketchbookToolsFolder()); } @@ -545,36 +578,32 @@ protected Void doInBackground() throws Exception { * @param root */ static private void deleteTemp(File root) { - - LinkedList deleteList = new LinkedList(); - - for (File f : root.listFiles()) - if (f.getName().matches(root.getName().substring(0, 4) + "\\d*" + "tmp")) - deleteList.add(f); - - Iterator folderIter = deleteList.iterator(); - - while (folderIter.hasNext()) { - Util.removeDir(folderIter.next()); + String pattern = root.getName().substring(0, 4) + "\\d*" + "tmp"; + File[] possible = root.listFiles(); + if (possible != null) { + for (File f : possible) { + if (f.getName().matches(pattern)) { + Util.removeDir(f); + } + } } } /** * Deletes all the modes/tools/libs that are flagged for removal. - * - * @param root - * @throws Exception */ static private void deleteFlagged(File root) throws Exception { File[] markedForDeletion = root.listFiles(new FileFilter() { public boolean accept(File folder) { - return (folder.isDirectory() && LocalContribution - .isDeletionFlagged(folder)); + return (folder.isDirectory() && + LocalContribution.isDeletionFlagged(folder)); } }); - for (File folder : markedForDeletion) { - Util.removeDir(folder); + if (markedForDeletion != null) { + for (File folder : markedForDeletion) { + Util.removeDir(folder); + } } } @@ -582,50 +611,52 @@ public boolean accept(File folder) { /** * Installs all the modes/tools whose installation failed during an * auto-update the previous time Processing was started up. - * - * @param base - * @param root - * @throws Exception */ static private void installPreviouslyFailed(Base base, File root) throws Exception { File[] installList = root.listFiles(new FileFilter() { public boolean accept(File folder) { - return (folder.isFile()); + return folder.isFile(); } }); - for (File file : installList) { - Iterator iter = contribListing.advertisedContributions.iterator(); - while (iter.hasNext()) { - AvailableContribution availableContrib = iter.next(); - if (file.getName().equals(availableContrib.getName())) { - file.delete(); - installOnStartUp(base, availableContrib); - contribListing - .replaceContribution(availableContrib, availableContrib); + // https://github.com/processing/processing/issues/5823 + if (installList != null) { + for (File file : installList) { + for (AvailableContribution contrib : listing.advertisedContributions) { + if (file.getName().equals(contrib.getName())) { + file.delete(); + installOnStartUp(base, contrib); + EventQueue.invokeAndWait(() -> { + listing.replaceContribution(contrib, contrib); + }); + } } } + } else { + System.err.println("Could not read " + root); } } /** * Updates all the flagged modes/tools. - * - * @param base - * @param root - * @throws Exception */ static private void updateFlagged(Base base, File root) throws Exception { File[] markedForUpdate = root.listFiles(new FileFilter() { public boolean accept(File folder) { - return (folder.isDirectory() && LocalContribution - .isUpdateFlagged(folder)); + return (folder.isDirectory() && + LocalContribution.isUpdateFlagged(folder)); } }); - ArrayList updateContribsNames = new ArrayList(); - LinkedList updateContribsList = new LinkedList(); + List updateContribsNames = new ArrayList<>(); + List updateContribsList = new LinkedList<>(); + + // TODO This is bad code... This root.getName() stuff to get the folder + // type, plus "libraries.properties" (not the correct file name), + // and I have no idea what "putting this here, in just in case" means. + // Not sure the function here so I'm not fixing it at the moment, + // but this whole function could use some cleaning. [fry 180105] String type = root.getName().substring(root.getName().lastIndexOf('/') + 1); String propFileName = null; @@ -643,7 +674,7 @@ else if (type.equalsIgnoreCase("libraries")) //putting this here, just in case Util.removeDir(folder); } - Iterator iter = contribListing.advertisedContributions.iterator(); + Iterator iter = listing.advertisedContributions.iterator(); while (iter.hasNext()) { AvailableContribution availableContribs = iter.next(); if (updateContribsNames.contains(availableContribs.getName())) { @@ -655,7 +686,7 @@ else if (type.equalsIgnoreCase("libraries")) //putting this here, just in case while (iter2.hasNext()) { AvailableContribution contribToUpdate = iter2.next(); installOnStartUp(base, contribToUpdate); - contribListing.replaceContribution(contribToUpdate, contribToUpdate); + listing.replaceContribution(contribToUpdate, contribToUpdate); } } @@ -692,43 +723,72 @@ public boolean accept(File folder) { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - static ContributionManagerDialog contributionManagerFrame = - new ContributionManagerDialog(); + static ManagerFrame managerDialog; + + + static public void init(Base base) throws Exception { + listing = ContributionListing.getInstance(); // Moved here to make sure it runs on EDT [jv 170121] + managerDialog = new ManagerFrame(base); + cleanup(base); + } /** - * Show the library installer window. + * Show the Library installer window. */ - static public void openLibraryManager(Editor editor) { - contributionManagerFrame.showFrame(editor, ContributionType.LIBRARY); + static public void openLibraries() { + managerDialog.showFrame(ContributionType.LIBRARY); } /** - * Show the tool installer window. + * Show the Mode installer window. */ - static public void openToolManager(Editor editor) { - contributionManagerFrame.showFrame(editor, ContributionType.TOOL); + static public void openModes() { + managerDialog.showFrame(ContributionType.MODE); } /** - * Show the mode installer window. + * Show the Tool installer window. */ - static public void openModeManager(Editor editor) { - contributionManagerFrame.showFrame(editor, ContributionType.MODE); + static public void openTools() { + managerDialog.showFrame(ContributionType.TOOL); } /** - * Show the examples installer window. + * Show the Examples installer window. */ - static public void openExampleManager(Editor editor) { - contributionManagerFrame.showFrame(editor, ContributionType.EXAMPLES); + static public void openExamples() { + managerDialog.showFrame(ContributionType.EXAMPLES); } - static public void openUpdates(Editor editor) { - contributionManagerFrame.showFrame(editor, null); + /** + * Open the updates panel. + */ + static public void openUpdates() { + managerDialog.showFrame(null); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + static int getTypeIndex(ContributionType contributionType) { + int index; + if (contributionType == ContributionType.LIBRARY) { + index = 0; + } else if (contributionType == ContributionType.MODE) { + index = 1; + } else if (contributionType == ContributionType.TOOL) { + index = 2; + } else if (contributionType == ContributionType.EXAMPLES) { + index = 3; + } else { + index = 4; + } + return index; } } diff --git a/app/src/processing/app/contrib/ContributionManagerDialog.java b/app/src/processing/app/contrib/ContributionManagerDialog.java deleted file mode 100644 index 2bb5c91b4c..0000000000 --- a/app/src/processing/app/contrib/ContributionManagerDialog.java +++ /dev/null @@ -1,895 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* - Part of the Processing project - http://processing.org - - Copyright (c) 2013 The Processing Foundation - Copyright (c) 2011-12 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 version 2 - as published by the Free Software Foundation. - - 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.contrib; - -import java.awt.*; -import java.awt.event.*; -import java.io.File; -import java.io.IOException; -import java.lang.management.ManagementFactory; -import java.util.*; - -import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.plaf.basic.BasicTabbedPaneUI; - -import processing.app.*; -import processing.app.ui.Editor; -import processing.app.ui.Toolkit; - - -/** - * This class is the main Contribution Manager Dialog. - * It contains all the contributions tab and the update tab. - */ -public class ContributionManagerDialog { - static final String ANY_CATEGORY = Language.text("contrib.all"); - static final int TAB_WIDTH = 100; - static final int TAB_HEIGHT = 34; - static final int AUTHOR_WIDTH = 240; - static final int STATUS_WIDTH = 60; - static final int FILTER_WIDTH = 180; - - JFrame dialog; - JTabbedPane tabbedPane; - String title; - JButton restartButton; - - // the calling editor, so updates can be applied - Editor editor; - - //The tabs - ContributionTab toolsContributionTab; - ContributionTab librariesContributionTab; - ContributionTab examplesContributionTab; - ContributionTab modesContributionTab; - UpdateContributionTab updatesContributionTab; - JLabel numberLabel; - - ContributionListing contributionListing = ContributionListing.getInstance(); - - private JLabel[] tabLabels; - - private JPanel updateTabPanel; - - private JLabel updateTabLabel; - - static Font myFont; - - - public ContributionManagerDialog() { - myFont = Toolkit.getSansFont(14, Font.PLAIN); -// GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(myFont); - numberLabel = new JLabel(Toolkit.getLibIcon("manager/notification.png"), SwingConstants.CENTER); - toolsContributionTab = new ContributionTab(ContributionType.TOOL, this); - librariesContributionTab = new ContributionTab(ContributionType.LIBRARY, this); - modesContributionTab = new ContributionTab(ContributionType.MODE, this); - examplesContributionTab = new ContributionTab(ContributionType.EXAMPLES, this); - updatesContributionTab = new UpdateContributionTab(null, this); - } - - - /* - public boolean hasUpdates() { - return toolsContributionTab.hasUpdates() - || librariesContributionTab.hasUpdates() - || examplesContributionTab.hasUpdates() - || modesContributionTab.hasUpdates(); - } - */ - - - public boolean hasUpdates(Base base) { - return toolsContributionTab.hasUpdates(base) - || modesContributionTab.hasUpdates(base) - || librariesContributionTab.hasUpdates(base) - || examplesContributionTab.hasUpdates(base); - } - - - public void showFrame(Editor editor, ContributionType contributionType) { - this.editor = editor; - - //Calculating index to switch to the required tab - int index; - if (contributionType == ContributionType.TOOL) { - index = 0; - } else if (contributionType == ContributionType.LIBRARY) { - index = 1; - } else if (contributionType == ContributionType.MODE) { - index = 2; - } else if (contributionType == ContributionType.EXAMPLES) { - index = 3; - } else { - index = 4; - } - if (dialog == null) { - makeFrame(editor); - // done before as downloadAndUpdateContributionListing() - // requires the current selected tab - tabbedPane.setSelectedIndex(index); - downloadAndUpdateContributionListing(editor.getBase()); - if (index != 4) { - Component selected = - tabbedPane.getTabComponentAt(tabbedPane.getSelectedIndex()); - selected.setBackground(new Color(0xe0fffd)); - selected.setForeground(Color.BLACK); - } else { - updateTabPanel.setBackground(new Color(0xe0fffd)); - updateTabLabel.setForeground(Color.BLACK); - } - } - tabbedPane.setSelectedIndex(index); - dialog.setVisible(true); - } - - - public void makeFrame(final Editor editor) { - dialog = new JFrame(title); - dialog.setMinimumSize(new Dimension(750, 500)); - tabbedPane = new JTabbedPane(); - - makeAndShowTab(false, true); - - tabbedPane.addTab("Tools", null, toolsContributionTab.panel, "Tools"); - tabbedPane.setMnemonicAt(0, KeyEvent.VK_1); - - tabbedPane.addTab("Libraries", null, librariesContributionTab.panel, - "Libraries"); - tabbedPane.setMnemonicAt(1, KeyEvent.VK_2); - - tabbedPane.addTab("Modes", null, modesContributionTab.panel, "Modes"); - tabbedPane.setMnemonicAt(2, KeyEvent.VK_3); - - tabbedPane.addTab("Examples", null, examplesContributionTab.panel, - "Examples"); - tabbedPane.setMnemonicAt(3, KeyEvent.VK_4); - - tabbedPane.addTab("Updates", null, updatesContributionTab.panel, "Updates"); - tabbedPane.setMnemonicAt(3, KeyEvent.VK_5); - tabbedPane.setUI(new SpacedTabbedPaneUI()); - tabbedPane.setBackground(new Color(0x132638)); - tabbedPane.setOpaque(true); -// tabbedPane.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2)); - - makeAndSetTabComponents(); - - tabbedPane.addChangeListener(new ChangeListener() { - - @Override - public void stateChanged(ChangeEvent e) { - for(int i = 0 ; i < 4; i++){ - tabLabels[i].setBackground(new Color(0x2d4251)); - tabLabels[i].setForeground(Color.WHITE); - } - updateTabPanel.setBackground(new Color(0x2d4251)); - updateTabLabel.setForeground(Color.WHITE); - int currentIndex = tabbedPane.getSelectedIndex(); - if(currentIndex != 4){ - tabbedPane.getTabComponentAt(tabbedPane.getSelectedIndex()).setBackground(new Color(0xe0fffd)); - tabbedPane.getTabComponentAt(tabbedPane.getSelectedIndex()).setForeground(Color.BLACK); - }else{ - updateTabPanel.setBackground(new Color(0xe0fffd)); - updateTabLabel.setForeground(Color.BLACK); - } -// // When the tab is changed update status to the current selected panel -// ContributionPanel currentPanel = getActiveTab().contributionListPanel -// .getSelectedPanel(); -// if (currentPanel != null) { -// getActiveTab().contributionListPanel.setSelectedPanel(currentPanel); -// } - } - }); - - -// tabbedPane.setSize(450, 400); - setLayout(); - - restartButton = new JButton(Language.text("contrib.restart")); - restartButton.setVisible(false); - restartButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent arg0) { - - Iterator iter = editor.getBase().getEditors().iterator(); - while (iter.hasNext()) { - Editor ed = iter.next(); - if (ed.getSketch().isModified()) { - int option = Messages.showYesNoQuestion(editor, title, Language - .text("contrib.unsaved_changes"), Language - .text("contrib.unsaved_changes.prompt")); - - if (option == JOptionPane.NO_OPTION) - return; - else - break; - } - } - - // Thanks to http://stackoverflow.com/a/4160543 - StringBuilder cmd = new StringBuilder(); - cmd.append(System.getProperty("java.home") + File.separator + "bin" - + File.separator + "java "); - for (String jvmArg : ManagementFactory.getRuntimeMXBean() - .getInputArguments()) { - cmd.append(jvmArg + " "); - } - cmd.append("-cp ") - .append(ManagementFactory.getRuntimeMXBean().getClassPath()) - .append(" "); - cmd.append(Base.class.getName()); - - try { - Runtime.getRuntime().exec(cmd.toString()); - System.exit(0); - } catch (IOException e) { - e.printStackTrace(); - } - - } - - }); - - Toolkit.setIcon(dialog); - registerDisposeListeners(); - - dialog.pack(); - dialog.setLocationRelativeTo(null); - } - - - private void makeAndSetTabComponents() { - final String[] tabTitles = { - "Tools", "Libraries", "Modes", "Examples", "Updates" - }; - tabLabels = new JLabel[4]; - - for(int i = 0 ; i < 4; i++){ - final int temp = i; - tabLabels[i] = new JLabel(tabTitles[i]){ - @Override - protected void paintComponent(Graphics g) { - g.setClip(Toolkit.createRoundRect(0, 0, - getWidth(), getHeight(), - temp == 0 ? 6 : 0, - temp == 3 ? 6 : 0, - 0, 0)); - super.paintComponent(g); - } - }; - tabLabels[i].setForeground(Color.WHITE); - tabLabels[i].setBackground(new Color(0x2d4251)); - tabLabels[i].setOpaque(true); - tabLabels[i].setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); - tabLabels[i].setPreferredSize(new Dimension(TAB_WIDTH, TAB_HEIGHT)); - tabLabels[i].setHorizontalAlignment(SwingConstants.CENTER); - tabLabels[i].setFont(Toolkit.getSansFont(14, Font.BOLD)); - tabbedPane.setTabComponentAt(i, tabLabels[i]); - } - - updateTabPanel = new JPanel() { - @Override - protected void paintComponent(Graphics g) { - g.setClip(Toolkit.createRoundRect(0, 0, getWidth(), getHeight(), - 6, 6, 0, 0)); - super.paintComponent(g); - } - };; - updateTabLabel = new JLabel("Updates"); - updateTabLabel.setFont(Toolkit.getSansFont(14, Font.BOLD)); - numberLabel.setVerticalTextPosition(SwingConstants.CENTER); - numberLabel.setHorizontalTextPosition(SwingConstants.CENTER); - numberLabel.setFont(Toolkit.getSansFont(14, Font.BOLD)); - numberLabel.setForeground(Color.WHITE); - updateTabPanel.setOpaque(true); - updateTabPanel.setBackground(new Color(0x2d4251)); - updateTabLabel.setForeground(Color.WHITE); - updateTabPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); - updateTabPanel.setPreferredSize(new Dimension(TAB_WIDTH, TAB_HEIGHT)); -// updateTabPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory -// .createMatteBorder(0, 2, 0, 0, Color.BLACK), BorderFactory -// .createEmptyBorder(4, 4, 4, 4))); - tabbedPane.setTabComponentAt(4, updateTabPanel); - -// JLabel tabLabels[] = new JLabel[4]; -// for(int i = 0 ; i < tabLabels.length;i++){ -// tabLabels[i] = new JLabel(tabTitles[i]); -// tabLabels[i] -// .setBorder(BorderFactory.createCompoundBorder(BorderFactory -// .createMatteBorder(0, (i == 0 ? 0 : 2), 0, (i == 3 ? 2 : 0), -// Color.BLACK), BorderFactory -// .createEmptyBorder(4, 4, 4, 4))); -// tabbedPane.setTabComponentAt(i, tabLabels[i]); -// } - - GroupLayout tabLayout = new GroupLayout(updateTabPanel); - tabLayout.setAutoCreateGaps(true); - updateTabPanel.setLayout(tabLayout); - tabLayout.setHorizontalGroup(tabLayout - .createSequentialGroup() - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, - GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) - .addComponent(updateTabLabel) - .addComponent(numberLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, - GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); - tabLayout.setVerticalGroup(tabLayout - .createParallelGroup(GroupLayout.Alignment.CENTER) - .addComponent(numberLabel).addComponent(updateTabLabel)); - - numberLabel.setVisible(false); - } - - - // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - - - public class SpacedTabbedPaneUI extends BasicTabbedPaneUI { - protected Color hazAlfa(int fila) { - int alfa = 0; - if (fila >= 0) { - alfa = 50 + (fila > 7 ? 70 : 10 * fila); - } - return new Color(0, 0, 0, alfa); - } - - - @Override - protected void installDefaults() { - UIManager.put("TabbedPane.selected", Color.BLACK); - UIManager.put("TabbedPane.tabsOverlapBorder" , true); - super.installDefaults(); - tabInsets = new Insets(0, 0, 0, 0); - contentBorderInsets = new Insets(0, 0, 0, 0); - tabAreaInsets = new Insets(0, 0, 0, 0); - selectedTabPadInsets = new Insets(0, 0, 0, 0); - } -// @Override -// protected int getTabLabelShiftX(int tabPlacement, int tabIndex, -// boolean isSelected) { -// return 0; -// } -// @Override -// protected int getTabLabelShiftY(int tabPlacement, int tabIndex, -// boolean isSelected) { -// return 3; -// } -// @Override -// protected void paintTab(Graphics g, int tabPlacement, -// Rectangle[] rects, int tabIndex, -// Rectangle iconRect, Rectangle textRect) { -// Graphics2D g2 = (Graphics2D) g; -// g2.fill(Toolkit.createRoundRect(rects[tabIndex].x, rects[tabIndex].y, -// rects[tabIndex].x + rects[tabIndex].width, rects[tabIndex].y + rects[tabIndex].height, -// 6, -// 6, -// 0, 0)); -// } - @Override - protected void paintTabBackground(Graphics g, int tabPlacement, - int tabIndex, int x, int y, int w, int h, - boolean isSelected) { - return; - } - @Override - protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, - int x, int y, int w, int h, boolean isSelected) { - return; - } - @Override - protected void paintFocusIndicator(Graphics g, int tabPlacement, - Rectangle[] rects, int tabIndex, - Rectangle iconRect, Rectangle textRect, - boolean isSelected) { - return; - } - - @Override - protected LayoutManager createLayoutManager() { - return new BasicTabbedPaneUI.TabbedPaneLayout() { - - @Override - public void addLayoutComponent(String name, Component comp) { - // TODO Auto-generated method stub - super.addLayoutComponent(name, comp); - } - @Override - protected void calculateTabRects(int tabPlacement, int tabCount) { - super.calculateTabRects(tabPlacement, tabCount); - rects[0].x -= 2; - rects[1].x -= 1; - rects[2].x -= 1; - rects[3].x -= 1; - rects[4].x = tabbedPane.getWidth() - rects[4].width + 1; - } - }; - } - } - - - // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - - - private void setLayout() { - GroupLayout layout = new GroupLayout(dialog.getContentPane()); - dialog.getContentPane().setLayout(layout); - dialog.setResizable(true); - layout.setAutoCreateContainerGaps(true); - layout.setHorizontalGroup(layout.createParallelGroup().addComponent(tabbedPane)); - layout.setVerticalGroup(layout.createParallelGroup().addComponent(tabbedPane)); - layout.setHonorsVisibility(tabbedPane, true); - //TODO set color here - dialog.getContentPane().setBackground(new Color(0x132638)); - dialog.validate(); - dialog.repaint(); - } - - - /** - * Close the window after an OK or Cancel. - */ - protected void disposeFrame() { - dialog.dispose(); - editor = null; - } - - -/* *//** - * Creates and arranges the Swing components in the dialog. - * - * @param panel1 - *//* - private void createComponents(JPanel panel1) { - dialog.setResizable(true); - - Container pane = panel1; -// pane.setLayout(new GridBagLayout()); -// -// { // Shows "Filter by Category" and the combo box for selecting a category -// GridBagConstraints c = new GridBagConstraints(); -// c.gridx = 0; -// c.gridy = 0; - pane.setLayout(new BorderLayout()); - - JPanel filterPanel = new JPanel(); - filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.X_AXIS)); -// pane.add(filterPanel, c); - pane.add(filterPanel, BorderLayout.NORTH); - - filterPanel.add(Box.createHorizontalStrut(6)); - - JLabel categoryLabel = new JLabel(Language.text("contrib.category")); - filterPanel.add(categoryLabel); - - filterPanel.add(Box.createHorizontalStrut(5)); - - categoryChooser = new JComboBox(); - categoryChooser.setMaximumRowCount(20); - updateCategoryChooser(); -// filterPanel.add(categoryChooser, c); - filterPanel.add(categoryChooser); - categoryChooser.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent e) { - category = (String) categoryChooser.getSelectedItem(); - if (ContributionManagerDialog.ANY_CATEGORY.equals(category)) { - category = null; - } - filterLibraries(category, filterField.filters, isCompatibilityFilter); - contributionListPanel.updateColors(); - } - }); - - filterPanel.add(Box.createHorizontalStrut(5)); -// filterPanel.add(Box.createHorizontalGlue()); - filterField = new FilterField(); - filterPanel.add(filterField); - - filterPanel.add(Box.createHorizontalStrut(5)); - - final JCheckBox compatibleContrib = new JCheckBox(compatibleCheckboxLabel); - compatibleContrib.addItemListener(new ItemListener() { - - @Override - public void itemStateChanged(ItemEvent arg0) { - isCompatibilityFilter = compatibleContrib.isSelected(); - filterLibraries(category, filterField.filters, isCompatibilityFilter); - contributionListPanel.updateColors(); - } - }); - filterPanel.add(compatibleContrib); -// filterPanel.add(Box.createHorizontalGlue()); -// } - //filterPanel.setBorder(new EmptyBorder(13, 13, 13, 13)); - filterPanel.setBorder(new EmptyBorder(7, 7, 7, 7)); - -// { // The scroll area containing the contribution listing and the status bar. -// GridBagConstraints c = new GridBagConstraints(); -// c.fill = GridBagConstraints.BOTH; -// c.gridx = 0; -// c.gridy = 1; -// c.gridwidth = 2; -// c.weighty = 1; -// c.weightx = 1; - - scrollPane = new JScrollPane(); - scrollPane.setPreferredSize(new Dimension(300, 300)); - scrollPane.setViewportView(contributionListPanel); -// scrollPane.getViewport().setOpaque(true); -// scrollPane.getViewport().setBackground(contributionListPanel.getBackground()); - scrollPane - .setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); - scrollPane - .setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); -// scrollPane.setBorder(new EmptyBorder(0, 7, 0, 7)); - pane.add(scrollPane, BorderLayout.CENTER); - - pane.add(Box.createHorizontalStrut(10), BorderLayout.WEST); - pane.add(Box.createHorizontalStrut(10), BorderLayout.EAST); - - status = new StatusPanel(); -// status.setBorder(new EmptyBorder(7, 7, 7, 7)); - - JPanel statusRestartPane = new JPanel(); - statusRestartPane.setLayout(new BorderLayout()); - - statusRestartPane.setBorder(new EmptyBorder(7, 7, 7, 7)); - statusRestartPane.setOpaque(false); - - statusRestartPane.add(status, BorderLayout.WEST); - statusRestartPane.add(progressBar, BorderLayout.LINE_END); - - Adding both of these to EAST shouldn't pose too much of a problem, - // since they can never get added together. - statusRestartPane.add(restartButton, BorderLayout.EAST); - statusRestartPane.add(retryConnectingButton, BorderLayout.EAST); - - pane.add(statusRestartPane, BorderLayout.SOUTH); - -// status = new StatusPanel(); -// status.setBorder(BorderFactory.createEtchedBorder()); - -// final JLayeredPane layeredPane = new JLayeredPane(); -// layeredPane.add(scrollPane, JLayeredPane.DEFAULT_LAYER); -// layeredPane.add(status, JLayeredPane.PALETTE_LAYER); -// -// layeredPane.addComponentListener(new ComponentAdapter() { -// -// void resizeLayers() { -// scrollPane.setSize(layeredPane.getSize()); -// scrollPane.updateUI(); -// } -// -// public void componentShown(ComponentEvent e) { -// resizeLayers(); -// } -// -// public void componentResized(ComponentEvent arg0) { -// resizeLayers(); -// } -// }); -// -// final JViewport viewport = scrollPane.getViewport(); -// viewport.addComponentListener(new ComponentAdapter() { -// void resizeLayers() { -// status.setLocation(0, viewport.getHeight() - 18); -// -// Dimension d = viewport.getSize(); -// d.height = 20; -// d.width += 3; -// status.setSize(d); -// } -// public void componentShown(ComponentEvent e) { -// resizeLayers(); -// } -// public void componentResized(ComponentEvent e) { -// resizeLayers(); -// } -// }); -// -// pane.add(layeredPane, c); -// } - -// { // The filter text area -// GridBagConstraints c = new GridBagConstraints(); -// c.gridx = 0; -// c.gridy = 2; -// c.gridwidth = 2; -// c.weightx = 1; -// c.fill = GridBagConstraints.HORIZONTAL; -// filterField = new FilterField(); -// -// pane.add(filterField, c); -// } - - dialog.setMinimumSize(new Dimension(450, 400)); - } - - private void updateCategoryChooser() { - if (categoryChooser != null) { - ArrayList categories; - categoryChooser.removeAllItems(); - categories = new ArrayList(contribListing.getCategories(filter)); -// for (int i = 0; i < categories.size(); i++) { -// System.out.println(i + " category: " + categories.get(i)); -// } - Collections.sort(categories); -// categories.add(0, ContributionManagerDialog.ANY_CATEGORY); - boolean categoriesFound = false; - categoryChooser.addItem(ContributionManagerDialog.ANY_CATEGORY); - for (String s : categories) { - categoryChooser.addItem(s); - if (!s.equals("Unknown")) { - categoriesFound = true; - } - } - categoryChooser.setEnabled(categoriesFound); - } - } -*/ - - - private void registerDisposeListeners() { - dialog.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { - disposeFrame(); - } - }); - // handle window closing commands for ctrl/cmd-W or hitting ESC. - Toolkit.registerWindowCloseKeys(dialog.getRootPane(), new ActionListener() { - public void actionPerformed(ActionEvent actionEvent) { - disposeFrame(); - } - }); - - dialog.getContentPane().addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent e) { - //System.out.println(e); - KeyStroke wc = Toolkit.WINDOW_CLOSE_KEYSTROKE; - if ((e.getKeyCode() == KeyEvent.VK_ESCAPE) - || (KeyStroke.getKeyStrokeForEvent(e).equals(wc))) { - disposeFrame(); - } - } - }); - } - - - /*protected void filterLibraries(String category, List filters) { - List filteredLibraries = contribListing - .getFilteredLibraryList(category, filters); - contributionListPanel.filterLibraries(filteredLibraries); - } - - protected void filterLibraries(String category, List filters, - boolean isCompatibilityFilter) { - List filteredLibraries = contribListing - .getFilteredLibraryList(category, filters); - filteredLibraries = contribListing - .getCompatibleContributionList(filteredLibraries, isCompatibilityFilter); - contributionListPanel.filterLibraries(filteredLibraries); - } -*/ - /*protected void updateContributionListing() { - if (editor != null) { - ArrayList contributions = new ArrayList(); - - ArrayList libraries = new ArrayList( - editor.getMode().contribLibraries); - contributions.addAll(libraries); - - //ArrayList tools = editor.contribTools; - List tools = editor.getToolContribs(); - contributions.addAll(tools); - - List modes = editor.getBase().getModeContribs(); - contributions.addAll(modes); - - List examples = editor.getBase() - .getExampleContribs(); - contributions.addAll(examples); - -// ArrayList compilations = LibraryCompilation.list(libraries); -// -// // Remove libraries from the list that are part of a compilations -// for (LibraryCompilation compilation : compilations) { -// Iterator it = libraries.iterator(); -// while (it.hasNext()) { -// Library current = it.next(); -// if (compilation.getFolder().equals(current.getFolder().getParentFile())) { -// it.remove(); -// } -// } -// } - - contribListing.updateInstalledList(contributions); - } - } -*/ - - - protected void downloadAndUpdateContributionListing(Base base) { - //activeTab is required now but should be removed - //as there is only one instance of contribListing and it should be present in this class - final ContributionTab activeTab = getActiveTab(); - activeTab.contribListing.downloadAvailableList(base, new ContribProgressBar( - activeTab.progressBar) { - - @Override - public void startTask(String name, int maxValue) { - super.startTask(name, maxValue); - progressBar.setVisible(true); - progressBar.setString(null); - } - - @Override - public void setProgress(int value) { - super.setProgress(value); -// int percent = 100 * value / this.max; - progressBar.setValue(value); - } - - @Override - public void finishedAction() { - progressBar.setVisible(false); - activeTab.updateContributionListing(); - activeTab.updateCategoryChooser(); - - - if (error) { - exception.printStackTrace(); - makeAndShowTab(true,false); - } else { - makeAndShowTab(false, false); - } - } - }); - } - - - void makeAndShowTab(boolean activateErrorPanel, boolean isLoading) { - toolsContributionTab.showFrame(editor, activateErrorPanel, isLoading); - librariesContributionTab.showFrame(editor, activateErrorPanel, isLoading); - modesContributionTab.showFrame(editor, activateErrorPanel, isLoading); - examplesContributionTab.showFrame(editor, activateErrorPanel, isLoading); - updatesContributionTab.showFrame(editor, activateErrorPanel, isLoading); - } - - - /** - * - * @return the currently selected tab - */ - public ContributionTab getActiveTab() { - switch (tabbedPane.getSelectedIndex()) { - case 0: - return toolsContributionTab; - case 1: - return librariesContributionTab; - case 2: - return modesContributionTab; - case 3: - return examplesContributionTab; - default: - return updatesContributionTab; - } - } - - -/* - protected void setFilterText(String filter) { - if (filter == null || filter.isEmpty()) { - filterField.setText(""); - filterField.showingHint = true; - } else { - filterField.setText(filter); - filterField.showingHint = false; - } - filterField.applyFilter(); - } - -// private JPanel getPlaceholder() { -// return contributionListPanel.statusPlaceholder; -// } - - class FilterField extends JTextField { - String filterHint; - - boolean showingHint; - - List filters; - - public FilterField() { - super(Language.text("contrib.filter_your_search")); - filterHint = Language.text("contrib.filter_your_search"); - - showingHint = true; - filters = new ArrayList(); - updateStyle(); - - addFocusListener(new FocusListener() { - public void focusLost(FocusEvent focusEvent) { - if (filterField.getText().isEmpty()) { - showingHint = true; - } - updateStyle(); - } - - public void focusGained(FocusEvent focusEvent) { - if (showingHint) { - showingHint = false; - filterField.setText(""); - } - updateStyle(); - } - }); - - getDocument().addDocumentListener(new DocumentListener() { - public void removeUpdate(DocumentEvent e) { - applyFilter(); - } - - public void insertUpdate(DocumentEvent e) { - applyFilter(); - } - - public void changedUpdate(DocumentEvent e) { - applyFilter(); - } - }); - } - - public void applyFilter() { - String filter = filterField.getFilterText(); - filter = filter.toLowerCase(); - - // Replace anything but 0-9, a-z, or : with a space - filter = filter.replaceAll("[^\\x30-\\x39^\\x61-\\x7a^\\x3a]", " "); - filters = Arrays.asList(filter.split(" ")); - filterLibraries(category, filters, isCompatibilityFilter); - - contributionListPanel.updateColors(); - } - - public String getFilterText() { - return showingHint ? "" : getText(); - } - - public void updateStyle() { - if (showingHint) { - setText(filterHint); - // setForeground(UIManager.getColor("TextField.light")); // too light - setForeground(Color.gray); - setFont(getFont().deriveFont(Font.ITALIC)); - } else { - setForeground(UIManager.getColor("TextField.foreground")); - setFont(getFont().deriveFont(Font.PLAIN)); - } - } - }*/ - - - public boolean hasAlreadyBeenOpened() { - return dialog != null; - } -} diff --git a/app/src/processing/app/contrib/ContributionTab.java b/app/src/processing/app/contrib/ContributionTab.java index d4623b02bd..9028e0644d 100644 --- a/app/src/processing/app/contrib/ContributionTab.java +++ b/app/src/processing/app/contrib/ContributionTab.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013 The Processing Foundation + Copyright (c) 2012-15 The Processing Foundation Copyright (c) 2011-12 Ben Fry and Casey Reas This program is free software; you can redistribute it and/or modify @@ -23,34 +23,33 @@ package processing.app.contrib; import java.awt.Color; +import java.awt.Cursor; import java.awt.Dimension; -import java.awt.Font; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.event.*; -import javax.swing.text.*; import processing.app.*; import processing.app.ui.Editor; import processing.app.ui.Toolkit; -public class ContributionTab { +public class ContributionTab extends JPanel { static final String ANY_CATEGORY = Language.text("contrib.all"); + static final int FILTER_WIDTH = Toolkit.zoom(180); - ContributionType contributionType; - ContributionManagerDialog contributionManagerDialog; - JPanel panel; - String title; - ContributionFilter filter; + ContributionType contribType; + ManagerFrame contribDialog; + + Contribution.Filter filter; JComboBox categoryChooser; - JScrollPane scrollPane; - ContributionListPanel contributionListPanel; + ListPanel contributionListPanel; StatusPanel statusPanel; FilterField filterField; - JButton restartButton; + // TODO: remove or initialize restartButton + //JButton restartButton; JLabel categoryLabel; JLabel loaderLabel; @@ -67,149 +66,69 @@ public class ContributionTab { JProgressBar progressBar; - public ContributionTab(ContributionType type,ContributionManagerDialog contributionManagerDialog) { - if (type == ContributionType.MODE) { - title = Language.text("contrib.manager_title.mode"); - } else if (type == ContributionType.TOOL) { - title = Language.text("contrib.manager_title.tool"); - } else if (type == ContributionType.LIBRARY) { - title = Language.text("contrib.manager_title.library"); - } else if (type == ContributionType.EXAMPLES) { - title = Language.text("contrib.manager_title.examples"); - } - - filter = type.createFilter(); - this.contributionType = type; - this.contributionManagerDialog = contributionManagerDialog; - contribListing = ContributionListing.getInstance(); - statusPanel = new StatusPanel(650,this); - contributionListPanel = new ContributionListPanel(this, filter); - contribListing.addContributionListener(contributionListPanel); - } + public ContributionTab() { } - public ContributionTab() { - // TODO Auto-generated constructor stub - } - - - /* - public boolean hasUpdates() { - return contribListing.hasUpdates(); - } - */ + public ContributionTab(ManagerFrame dialog, ContributionType type) { + this.contribDialog = dialog; + this.contribType = type; + filter = contrib -> contrib.getType() == contribType; - public boolean hasUpdates(Base base) { - return contribListing.hasUpdates(base); + contribListing = ContributionListing.getInstance(); + statusPanel = new StatusPanel(this, 650); + contributionListPanel = new ListPanel(this, filter, false); + contribListing.addListener(contributionListPanel); } -// protected JPanel makeTextPanel(String text) { -// JPanel panel = new JPanel(false); -// JLabel filler = new JLabel(text); -// filler.setHorizontalAlignment(JLabel.CENTER); -// panel.setLayout(new GridLayout(1, 1)); -// panel.add(filler); -// return panel; -// } - - + public void showFrame(final Editor editor, boolean error, boolean loading) { + this.editor = editor; + setLayout(error, loading); + contributionListPanel.setVisible(!loading); + loaderLabel.setVisible(loading); + errorPanel.setVisible(error); - public void showFrame(final Editor editor, boolean activateErrorPanel, - final boolean isLoading) { - this.editor = editor; - if (panel == null) { - setLayout(editor, activateErrorPanel, isLoading); - } - contributionListPanel.setVisible(!isLoading); - loaderLabel.setVisible(isLoading); - errorPanel.setVisible(activateErrorPanel); - panel.validate(); - panel.repaint(); + validate(); + repaint(); } - public void setLayout(final Editor editor, boolean activateErrorPanel, boolean isLoading) { - if(panel == null){ + protected void setLayout(boolean activateErrorPanel, + boolean isLoading) { + if (progressBar == null) { progressBar = new JProgressBar(); progressBar.setVisible(false); + createComponents(); - panel = new JPanel(false); + buildErrorPanel(); + loaderLabel = new JLabel(Toolkit.getLibIcon("manager/loader.gif")); loaderLabel.setOpaque(false); loaderLabel.setBackground(Color.WHITE); } - /*restartButton = new JButton(Language.text("contrib.restart")); - restartButton.setVisible(false); - restartButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent arg0) { - - Iterator iter = editor.getBase().getEditors().iterator(); - while (iter.hasNext()) { - Editor ed = iter.next(); - if (ed.getSketch().isModified()) { - int option = Base - .showYesNoQuestion(editor, title, - Language.text("contrib.unsaved_changes"), - Language.text("contrib.unsaved_changes.prompt")); - - if (option == JOptionPane.NO_OPTION) - return; - else - break; - } - } - - // Thanks to http://stackoverflow.com/a/4160543 - StringBuilder cmd = new StringBuilder(); - cmd.append(System.getProperty("java.home") + File.separator + "bin" - + File.separator + "java "); - for (String jvmArg : ManagementFactory.getRuntimeMXBean() - .getInputArguments()) { - cmd.append(jvmArg + " "); - } - cmd.append("-cp ") - .append(ManagementFactory.getRuntimeMXBean().getClassPath()) - .append(" "); - cmd.append(Base.class.getName()); - - try { - Runtime.getRuntime().exec(cmd.toString()); - System.exit(0); - } catch (IOException e) { - e.printStackTrace(); - } - - } - - });*/ + int scrollBarWidth = contributionListPanel.scrollPane.getVerticalScrollBar().getPreferredSize().width; - - GroupLayout layout = new GroupLayout(panel); - panel.setLayout(layout); + GroupLayout layout = new GroupLayout(this); + setLayout(layout); // layout.setAutoCreateContainerGaps(true); // layout.setAutoCreateGaps(true); layout.setHorizontalGroup(layout .createParallelGroup(GroupLayout.Alignment.CENTER) .addGroup(layout .createSequentialGroup() - .addGap(ContributionManagerDialog.STATUS_WIDTH) + .addGap(ManagerFrame.STATUS_WIDTH) .addComponent(filterField, - ContributionManagerDialog.FILTER_WIDTH, - ContributionManagerDialog.FILTER_WIDTH, - ContributionManagerDialog.FILTER_WIDTH) + FILTER_WIDTH, FILTER_WIDTH, FILTER_WIDTH) // .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addComponent(categoryChooser, - ContributionManagerDialog.AUTHOR_WIDTH - 10, - ContributionManagerDialog.AUTHOR_WIDTH - 10, - ContributionManagerDialog.AUTHOR_WIDTH - 10) - .addContainerGap()).addComponent(loaderLabel) + ManagerFrame.AUTHOR_WIDTH, + ManagerFrame.AUTHOR_WIDTH, + ManagerFrame.AUTHOR_WIDTH) + .addGap(scrollBarWidth)).addComponent(loaderLabel) .addComponent(contributionListPanel).addComponent(errorPanel) .addComponent(statusPanel)); @@ -227,87 +146,84 @@ public void actionPerformed(ActionEvent arg0) { .addComponent(statusPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); layout.linkSize(SwingConstants.VERTICAL, categoryChooser, filterField); + + // these will occupy space even if not visible layout.setHonorsVisibility(contributionListPanel, false); + layout.setHonorsVisibility(categoryChooser, false); - panel.setBackground(Color.WHITE); - panel.setBorder(null); - } + setBackground(Color.WHITE); + setBorder(null); + } - /** Creates and arranges the Swing components in the dialog. - */ private void createComponents() { + categoryLabel = new JLabel(Language.text("contrib.category")); - categoryLabel = new JLabel(Language.text("contrib.category")); + categoryChooser = new JComboBox(); + categoryChooser.setMaximumRowCount(20); + categoryChooser.setFont(ManagerFrame.NORMAL_PLAIN); - categoryChooser = new JComboBox(); - categoryChooser.setMaximumRowCount(20); - categoryChooser.setFont(Toolkit.getSansFont(14, Font.PLAIN)); + updateCategoryChooser(); - updateCategoryChooser(); - - categoryChooser.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent e) { - category = (String) categoryChooser.getSelectedItem(); - if (ContributionManagerDialog.ANY_CATEGORY.equals(category)) { - category = null; - } - filterLibraries(category, filterField.filters); - contributionListPanel.updateColors(); + categoryChooser.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + category = (String) categoryChooser.getSelectedItem(); + if (ManagerFrame.ANY_CATEGORY.equals(category)) { + category = null; } - }); - - filterField = new FilterField(); + filterLibraries(category, filterField.filters); + contributionListPanel.updateColors(); + } + }); - buildErrorPanel(); + filterField = new FilterField(); + // TODO: initialize restartButton, whatever it is + // restartButton = ??? } - void buildErrorPanel(){ + + + protected void buildErrorPanel() { errorPanel = new JPanel(); GroupLayout layout = new GroupLayout(errorPanel); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); errorPanel.setLayout(layout); -// errorPanel.setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, Color.BLACK)); errorMessage = new JTextPane(); errorMessage.setEditable(false); errorMessage.setContentType("text/html"); - errorMessage.setText("Could not connect to the Processing server.
" + errorMessage.setText("

Could not connect to the Processing server.
" + "Contributions cannot be installed or updated without an Internet connection.
" - + "Please verify your network connection again, then try connecting again."); - errorMessage.setFont(Toolkit.getSansFont(14, Font.PLAIN)); - errorMessage.setMaximumSize(new Dimension(550, 50)); + + "Please verify your network connection again, then try connecting again.
"); + DetailPanel.setTextStyle(errorMessage, "1em"); + Dimension dim = new Dimension(550, 60); + errorMessage.setMaximumSize(dim); + errorMessage.setMinimumSize(dim); errorMessage.setOpaque(false); + /* StyledDocument doc = errorMessage.getStyledDocument(); SimpleAttributeSet center = new SimpleAttributeSet(); StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER); doc.setParagraphAttributes(0, doc.getLength(), center, false); + */ - - closeButton = new JButton("X"); + closeButton = Toolkit.createIconButton("manager/close"); closeButton.setContentAreaFilled(false); closeButton.addActionListener(new ActionListener() { - - @Override public void actionPerformed(ActionEvent e) { - contributionManagerDialog.makeAndShowTab(false, false); + contribDialog.makeAndShowTab(false, false); } }); tryAgainButton = new JButton("Try Again"); - tryAgainButton.setFont(Toolkit.getSansFont(14, Font.PLAIN)); -// tryAgainButton.setContentAreaFilled(false); -// tryAgainButton.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK, 1),BorderFactory.createEmptyBorder(3, 0, 3, 0))); + tryAgainButton.setFont(ManagerFrame.NORMAL_PLAIN); tryAgainButton.addActionListener(new ActionListener() { - - @Override public void actionPerformed(ActionEvent e) { - contributionManagerDialog.makeAndShowTab(false, true); - contributionManagerDialog.downloadAndUpdateContributionListing(editor.getBase()); + contribDialog.makeAndShowTab(false, true); + contribDialog.downloadAndUpdateContributionListing(editor.getBase()); } }); - layout.setHorizontalGroup(layout - .createSequentialGroup() + layout.setHorizontalGroup(layout.createSequentialGroup() .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addGroup(layout @@ -319,8 +235,7 @@ public void actionPerformed(ActionEvent e) { .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addComponent(closeButton)); - layout.setVerticalGroup(layout - .createSequentialGroup() + layout.setVerticalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup().addComponent(errorMessage) .addComponent(closeButton)).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(tryAgainButton)); errorPanel.setBackground(Color.PINK); @@ -328,7 +243,6 @@ public void actionPerformed(ActionEvent e) { } - protected void updateCategoryChooser() { if (categoryChooser != null) { ArrayList categories; @@ -340,32 +254,22 @@ protected void updateCategoryChooser() { Collections.sort(categories); // categories.add(0, ContributionManagerDialog.ANY_CATEGORY); boolean categoriesFound = false; - categoryChooser.addItem(ContributionManagerDialog.ANY_CATEGORY); + categoryChooser.addItem(ManagerFrame.ANY_CATEGORY); for (String s : categories) { categoryChooser.addItem(s); if (!s.equals(Contribution.UNKNOWN_CATEGORY)) { categoriesFound = true; } } - categoryChooser.setEnabled(categoriesFound); + categoryChooser.setVisible(categoriesFound); } } protected void filterLibraries(String category, List filters) { - List filteredLibraries = - contribListing.getFilteredLibraryList(category, filters); - contributionListPanel.filterLibraries(filteredLibraries); + contributionListPanel.filterLibraries(category, filters); } -/* - protected void filterLibraries(String category, List filters, boolean isCompatibilityFilter) { - List filteredLibraries = - contribListing.getFilteredLibraryList(category, filters); - filteredLibraries = contribListing.getCompatibleContributionList(filteredLibraries, isCompatibilityFilter); - contributionListPanel.filterLibraries(filteredLibraries); - }*/ - protected void updateContributionListing() { if (editor != null) { @@ -373,16 +277,29 @@ protected void updateContributionListing() { List libraries = new ArrayList(editor.getMode().contribLibraries); + + // Only add core libraries that are installed in the sketchbook + // https://github.com/processing/processing/issues/3688 + //libraries.addAll(editor.getMode().coreLibraries); + final String sketchbookPath = + Base.getSketchbookLibrariesFolder().getAbsolutePath(); + for (Library lib : editor.getMode().coreLibraries) { + if (lib.getLibraryPath().startsWith(sketchbookPath)) { + libraries.add(lib); + } + } + contributions.addAll(libraries); - //ArrayList tools = editor.contribTools; - List tools = editor.getToolContribs(); + Base base = editor.getBase(); + + List tools = base.getToolContribs(); contributions.addAll(tools); - List modes = editor.getBase().getModeContribs(); + List modes = base.getModeContribs(); contributions.addAll(modes); - List examples = editor.getBase().getExampleContribs(); + List examples = base.getExampleContribs(); contributions.addAll(examples); // ArrayList compilations = LibraryCompilation.list(libraries); @@ -402,6 +319,7 @@ protected void updateContributionListing() { } } + protected void setFilterText(String filter) { if (filter == null || filter.isEmpty()) { filterField.setText(""); @@ -412,65 +330,79 @@ protected void setFilterText(String filter) { } -// private JPanel getPlaceholder() { -// return contributionListPanel.statusPlaceholder; -// } - - //TODO: this is causing a lot of bugs as the hint is wrongly firing applyFilter() class FilterField extends JTextField { - Icon searchIcon; List filters; - JLabel filterLabel; public FilterField () { - super(""); - filterLabel = new JLabel("Filter"); - filterLabel.setFont(Toolkit.getSansFont(14, Font.PLAIN)); + JLabel filterLabel = new JLabel("Filter"); + filterLabel.setFont(ManagerFrame.NORMAL_PLAIN); filterLabel.setOpaque(false); - setFont(Toolkit.getSansFont(14, Font.PLAIN)); - searchIcon = Toolkit.getLibIcon("manager/search.png"); + setFont(ManagerFrame.NORMAL_PLAIN); + filterLabel.setIcon(Toolkit.getLibIconX("manager/search")); + JButton removeFilter = Toolkit.createIconButton("manager/remove"); + removeFilter.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2)); + removeFilter.setBorderPainted(false); + removeFilter.setContentAreaFilled(false); + removeFilter.setCursor(Cursor.getDefaultCursor()); + removeFilter.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + setText(""); + filterField.requestFocusInWindow(); + } + }); + //searchIcon = new ImageIcon(java.awt.Toolkit.getDefaultToolkit().getImage("NSImage://NSComputerTemplate")); setOpaque(false); - setBorder(BorderFactory.createMatteBorder(0, 33, 0, 0, searchIcon)); GroupLayout fl = new GroupLayout(this); setLayout(fl); - fl.setHorizontalGroup(fl.createSequentialGroup().addComponent(filterLabel)); + fl.setHorizontalGroup(fl + .createSequentialGroup() + .addComponent(filterLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, + GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) + .addComponent(removeFilter)); + fl.setVerticalGroup(fl.createSequentialGroup() .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) + .addGroup(fl.createParallelGroup() .addComponent(filterLabel) + .addComponent(removeFilter)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); + removeFilter.setVisible(false); filters = new ArrayList(); addFocusListener(new FocusListener() { public void focusLost(FocusEvent focusEvent) { if (getText().isEmpty()) { - setBorder(BorderFactory.createMatteBorder(0, 33, 0, 0, searchIcon)); filterLabel.setVisible(true); } } public void focusGained(FocusEvent focusEvent) { - setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0)); filterLabel.setVisible(false); } }); getDocument().addDocumentListener(new DocumentListener() { public void removeUpdate(DocumentEvent e) { + removeFilter.setVisible(!getText().isEmpty()); applyFilter(); } public void insertUpdate(DocumentEvent e) { + removeFilter.setVisible(!getText().isEmpty()); applyFilter(); } public void changedUpdate(DocumentEvent e) { + removeFilter.setVisible(!getText().isEmpty()); applyFilter(); } }); @@ -487,15 +419,34 @@ public void applyFilter() { contributionListPanel.updateColors(); } + } + +// public boolean hasAlreadyBeenOpened() { +// return panel != null; +// } + + + public void updateStatusPanel(DetailPanel contributionPanel) { + statusPanel.update(contributionPanel); } - public boolean hasAlreadyBeenOpened() { - return panel != null; + protected void updateAll() { + Collection collection = + contributionListPanel.panelByContribution.values(); + for (DetailPanel detailPanel : collection) { + detailPanel.update(); + } + contributionListPanel.model.fireTableDataChanged(); } - public void updateStatusPanel(ContributionPanel contributionPanel) { - statusPanel.update(contributionPanel); + + protected boolean hasUpdates() { + return contributionListPanel.getRowCount() > 0; + } + + public boolean filterHasFocus() { + return filterField != null && filterField.hasFocus(); } } diff --git a/app/src/processing/app/contrib/ContributionType.java b/app/src/processing/app/contrib/ContributionType.java index 9814f82ff8..2ea1dd2d78 100644 --- a/app/src/processing/app/contrib/ContributionType.java +++ b/app/src/processing/app/contrib/ContributionType.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013 The Processing Foundation + Copyright (c) 2013-20 The Processing Foundation Copyright (c) 2011-12 Ben Fry and Casey Reas This program is free software; you can redistribute it and/or modify @@ -33,17 +33,17 @@ import processing.app.ui.Editor; public enum ContributionType { - LIBRARY, TOOL, MODE, EXAMPLES; + LIBRARY, MODE, TOOL, EXAMPLES; public String toString() { switch (this) { case LIBRARY: return "library"; - case TOOL: - return "tool"; case MODE: return "mode"; + case TOOL: + return "tool"; case EXAMPLES: return "examples"; } @@ -61,6 +61,21 @@ public String getTitle() { } + public String getPluralTitle() { + switch (this) { + case LIBRARY: + return "Libraries"; + case MODE: + return "Modes"; + case TOOL: + return "Tools"; + case EXAMPLES: + return "Examples"; + } + return null; // should be unreachable + } + + // public String getFolderName() { // return toString(); // /* @@ -90,6 +105,19 @@ public File createTempFolder() throws IOException { } + public File[] listTempFolders() throws IOException { + File base = getSketchbookFolder(); + return base.listFiles(new FileFilter() { + @Override + public boolean accept(File file) { + String name = file.getName(); + return (file.isDirectory() && + name.startsWith(toString()) && name.endsWith("tmp")); + } + }); + } + + public boolean isTempFolderName(String name) { return name.startsWith(toString()) && name.endsWith("tmp"); } @@ -115,12 +143,12 @@ static public ContributionType fromName(String s) { if ("library".equalsIgnoreCase(s)) { return LIBRARY; } - if ("tool".equalsIgnoreCase(s)) { - return TOOL; - } if ("mode".equalsIgnoreCase(s)) { return MODE; } + if ("tool".equalsIgnoreCase(s)) { + return TOOL; + } if ("examples".equalsIgnoreCase(s)) { return EXAMPLES; } @@ -144,7 +172,7 @@ public File getSketchbookFolder() { } - boolean isCandidate(File potential) { + public boolean isCandidate(File potential) { return (potential.isDirectory() && new File(potential, toString()).exists() && !isTempFolderName(potential.getName())); @@ -209,13 +237,13 @@ LocalContribution load(Base base, File folder) { ArrayList listContributions(Editor editor) { - ArrayList contribs = new ArrayList(); + ArrayList contribs = new ArrayList<>(); switch (this) { case LIBRARY: contribs.addAll(editor.getMode().contribLibraries); break; case TOOL: - contribs.addAll(editor.getToolContribs()); + contribs.addAll(editor.getBase().getToolContribs()); break; case MODE: contribs.addAll(editor.getBase().getModeContribs()); @@ -249,27 +277,27 @@ File createBackupFolder(StatusPanel status) { } - /** - * Create a filter for a specific contribution type. - * @param type The type, or null for a generic update checker. - */ - ContributionFilter createFilter() { - return new ContributionFilter() { - public boolean matches(Contribution contrib) { - return contrib.getType() == ContributionType.this; - } - }; - } +// /** +// * Create a filter for a specific contribution type. +// * @param type The type, or null for a generic update checker. +// */ +// Contribution.Filter createFilter2() { +// return new Contribution.Filter() { +// public boolean matches(Contribution contrib) { +// return contrib.getType() == ContributionType.this; +// } +// }; +// } - static ContributionFilter createUpdateFilter() { - return new ContributionFilter() { - public boolean matches(Contribution contrib) { - if (contrib instanceof LocalContribution) { - return ContributionListing.getInstance().hasUpdates(contrib); - } - return false; - } - }; - } +// static Contribution.Filter createUpdateFilter() { +// return new Contribution.Filter() { +// public boolean matches(Contribution contrib) { +// if (contrib instanceof LocalContribution) { +// return ContributionListing.getInstance().hasUpdates(contrib); +// } +// return false; +// } +// }; +// } } \ No newline at end of file diff --git a/app/src/processing/app/contrib/ContributionPanel.java b/app/src/processing/app/contrib/DetailPanel.java similarity index 52% rename from app/src/processing/app/contrib/ContributionPanel.java rename to app/src/processing/app/contrib/DetailPanel.java index c6730b2c6f..e36978e114 100644 --- a/app/src/processing/app/contrib/ContributionPanel.java +++ b/app/src/processing/app/contrib/DetailPanel.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013-15 The Processing Foundation + Copyright (c) 2013-16 The Processing Foundation Copyright (c) 2011-12 Ben Fry and Casey Reas This program is free software; you can redistribute it and/or modify @@ -48,20 +48,10 @@ import processing.app.ui.Toolkit; -// TODO clean up accessors (too many cases of several de-references for basic tasks -// TODO hyperlink listener seems far too complicated for what it does, -// and why have a 'null' version rather than detecting whether selected or not -// TODO don't add/remove listeners for install/remove/undo based on function, -// just keep track of current behavior and call that. too many things can go wrong. -// TODO get rid of huge actionPerformed() blocks with anonymous classes, -// just make handleInstall(), etc methods and a single actionPerformed -// for the button that calls the necessary behavior (see prev note) -// TODO switch to the built-in fonts (available from Toolkit) rather than verdana et al - /** * Panel that expands and gives a brief overview of a library when clicked. */ -class ContributionPanel extends JPanel { +class DetailPanel extends JPanel { static public final String REMOVE_RESTART_MESSAGE = String.format("%s", Language.text("contrib.messages.remove_restart")); @@ -78,10 +68,11 @@ class ContributionPanel extends JPanel { static public final String INCOMPATIBILITY_BLUR = "This contribution is not compatible with " + "the current revision of Processing"; - private final ContributionListPanel listPanel; + private final ListPanel listPanel; private final ContributionListing contribListing = ContributionListing.getInstance(); - static private final int BUTTON_WIDTH = 100; + static final int BUTTON_WIDTH = Toolkit.zoom(100); + static Icon foundationIcon; /** * Should only be set through setContribution(), @@ -93,10 +84,13 @@ public Contribution getContrib() { return contrib; } + private LocalContribution getLocalContrib() { + return (LocalContribution) contrib; + } private boolean alreadySelected; private boolean enableHyperlinks; - private HyperlinkListener conditionalHyperlinkOpener; + //private HyperlinkListener conditionalHyperlinkOpener; private JTextPane descriptionPane; private JLabel notificationLabel; private JButton updateButton; @@ -104,71 +98,28 @@ public Contribution getContrib() { private JButton installRemoveButton; private JPopupMenu contextMenu; private JMenuItem openFolder; - private JPanel barButtonCardPane; - private ActionListener removeActionListener; - private ActionListener installActionListener; - private ActionListener undoActionListener; - - boolean isUpdateInProgress; - private boolean isInstallInProgress; - private boolean isRemoveInProgress; + private JPanel barButtonCardPane; + private CardLayout barButtonCardLayout; - StringBuilder description; + static private final String installText = Language.text("contrib.install"); + static private final String removeText = Language.text("contrib.remove"); + static private final String undoText = Language.text("contrib.undo"); - ContributionPanel(ContributionListPanel contributionListPanel) { - listPanel = contributionListPanel; - barButtonCardPane = new JPanel(); + boolean updateInProgress; + boolean installInProgress; + boolean removeInProgress; - enableHyperlinks = false; - alreadySelected = false; - conditionalHyperlinkOpener = new HyperlinkListener() { - public void hyperlinkUpdate(HyperlinkEvent e) { - if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { - if (enableHyperlinks) { - if (e.getURL() != null) { - Platform.openURL(e.getURL().toString()); - } - } - } - } - }; + String description; - installActionListener = new ActionListener() { - public void actionPerformed(ActionEvent e) { - install(); - } - }; - undoActionListener = new ActionListener() { - public void actionPerformed(ActionEvent e) { - listPanel.contributionTab.statusPanel.clear(); - if (contrib instanceof LocalContribution) { - LocalContribution installed = (LocalContribution) contrib; - installed.setDeletionFlag(false); - contribListing.replaceContribution(contrib, contrib); // ?? - Iterator contribsListIter = contribListing.allContributions.iterator(); - boolean toBeRestarted = false; - while (contribsListIter.hasNext()) { - Contribution contribElement = contribsListIter.next(); - if (contrib.getType().equals(contribElement.getType())) { - if (contribElement.isDeletionFlagged() || - contribElement.isUpdateFlagged()) { - toBeRestarted = !toBeRestarted; - break; - } - } - } - listPanel.contributionTab.restartButton.setVisible(toBeRestarted); - } - } - }; + DetailPanel(ListPanel contributionListPanel) { + if (foundationIcon == null) { + foundationIcon = Toolkit.getLibIconX("icons/foundation", 32); + } - removeActionListener = new ActionListener() { - public void actionPerformed(ActionEvent arg) { - remove(); - } - }; + listPanel = contributionListPanel; + barButtonCardPane = new JPanel(); contextMenu = new JPopupMenu(); openFolder = new JMenuItem("Open Folder"); @@ -192,11 +143,10 @@ public void actionPerformed(ActionEvent e) { setExpandListener(this, new MouseAdapter() { public void mousePressed(MouseEvent e) { if (contrib.isCompatible(Base.getRevision())) { - listPanel.setSelectedPanel(ContributionPanel.this); + listPanel.setSelectedPanel(DetailPanel.this); } else { - final String msg = contrib.getName() - + " is not compatible with this version of Processing"; - listPanel.contributionTab.statusPanel.setErrorMessage(msg); + setErrorMessage(contrib.getName() + + " cannot be used with this version of Processing"); } } }); @@ -217,98 +167,107 @@ private void addPaneComponents() { margin.bottom = 0; descriptionPane.setMargin(margin); descriptionPane.setContentType("text/html"); - setTextStyle(descriptionPane); + setTextStyle(descriptionPane, "0.95em"); descriptionPane.setOpaque(false); if (UIManager.getLookAndFeel().getID().equals("Nimbus")) { descriptionPane.setBackground(new Color(0, 0, 0, 0)); } -// stripTextSelectionListeners(descriptionBlock); descriptionPane.setBorder(new EmptyBorder(4, 7, 7, 7)); descriptionPane.setHighlighter(null); + descriptionPane.addHyperlinkListener(new HyperlinkListener() { + public void hyperlinkUpdate(HyperlinkEvent e) { + if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + // for 3.2.3, added the isSelected() prompt here, rather than + // adding/removing the listener repeatedly + if (isSelected()) { + if (enableHyperlinks && e.getURL() != null) { + Platform.openURL(e.getURL().toString()); + } + } + } + } + }); + add(descriptionPane, BorderLayout.CENTER); - JPanel updateBox = new JPanel(); //new BoxLayout(filterPanel, BoxLayout.X_AXIS) + JPanel updateBox = new JPanel(); updateBox.setLayout(new BorderLayout()); notificationLabel = new JLabel(); notificationLabel.setInheritsPopupMenu(true); notificationLabel.setVisible(false); notificationLabel.setOpaque(false); - // not needed after changing to JLabel -// notificationBlock.setContentType("text/html"); -// notificationBlock.setHighlighter(null); -// setTextStyle(notificationBlock); - notificationLabel.setFont(new Font("Verdana", Font.ITALIC, 10)); -// stripTextSelectionListeners(notificationBlock); - - updateButton = new JButton("Update"); - updateButton.setInheritsPopupMenu(true); - Dimension updateButtonDimensions = updateButton.getPreferredSize(); - updateButtonDimensions.width = BUTTON_WIDTH; - updateButton.setMinimumSize(updateButtonDimensions); - updateButton.setPreferredSize(updateButtonDimensions); - updateButton.setOpaque(false); - updateButton.setVisible(false); - - updateButton.addActionListener(new ActionListener() { + notificationLabel.setFont(ManagerFrame.SMALL_PLAIN); + + { + updateButton = new JButton("Update"); + updateButton.setInheritsPopupMenu(true); + Dimension dim = + new Dimension(BUTTON_WIDTH, updateButton.getPreferredSize().height); + updateButton.setMinimumSize(dim); + updateButton.setPreferredSize(dim); + updateButton.setOpaque(false); + updateButton.setVisible(false); + + updateButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + update(); + } + }); + } - public void actionPerformed(ActionEvent e) { - update(); - } - }); -// add(updateButton, c); -// } updateBox.add(updateButton, BorderLayout.EAST); updateBox.add(notificationLabel, BorderLayout.WEST); updateBox.setBorder(new EmptyBorder(4, 7, 7, 7)); updateBox.setOpaque(false); add(updateBox, BorderLayout.SOUTH); -// } -// -// -// private void addProgressBarAndButton() { - -// Box statusBox = Box.createVerticalBox(); -// GridBagConstraints c = new GridBagConstraints(); -// c.gridx = 4; -// c.gridy = 0; -// c.weighty = 1; -// c.gridheight = 3; -// c.fill = GridBagConstraints.VERTICAL; -// c.anchor = GridBagConstraints.NORTH; JPanel rightPane = new JPanel(); rightPane.setInheritsPopupMenu(true); rightPane.setOpaque(false); rightPane.setLayout(new BoxLayout(rightPane, BoxLayout.Y_AXIS)); - rightPane.setMinimumSize(new Dimension(ContributionPanel.BUTTON_WIDTH, 1)); -// add(rightPane, c); -// statusBox.add(rightPane); + rightPane.setMinimumSize(new Dimension(BUTTON_WIDTH, 1)); add(rightPane, BorderLayout.EAST); - barButtonCardPane.setLayout(new CardLayout()); + barButtonCardLayout = new CardLayout(); + barButtonCardPane.setLayout(barButtonCardLayout); barButtonCardPane.setInheritsPopupMenu(true); barButtonCardPane.setOpaque(false); - barButtonCardPane.setMinimumSize(new Dimension(ContributionPanel.BUTTON_WIDTH, 1)); - - installProgressBar = new JProgressBar(); - installProgressBar.setInheritsPopupMenu(true); - installProgressBar.setStringPainted(true); - resetInstallProgressBarState(); - Dimension d = installProgressBar.getPreferredSize(); - d.width = ContributionPanel.BUTTON_WIDTH; - installProgressBar.setPreferredSize(d); - installProgressBar.setMaximumSize(d); - installProgressBar.setMinimumSize(d); - installProgressBar.setOpaque(false); - installProgressBar.setAlignmentX(CENTER_ALIGNMENT); + barButtonCardPane.setMinimumSize(new Dimension(BUTTON_WIDTH, 1)); + + { + installProgressBar = new JProgressBar(); + installProgressBar.setInheritsPopupMenu(true); + installProgressBar.setStringPainted(true); + resetInstallProgressBarState(); + Dimension dim = + new Dimension(BUTTON_WIDTH, + installProgressBar.getPreferredSize().height); + installProgressBar.setPreferredSize(dim); + installProgressBar.setMaximumSize(dim); + installProgressBar.setMinimumSize(dim); + installProgressBar.setOpaque(false); + installProgressBar.setAlignmentX(CENTER_ALIGNMENT); + } installRemoveButton = new JButton(" "); installRemoveButton.setInheritsPopupMenu(true); + installRemoveButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + String mode = installRemoveButton.getText(); + if (mode.equals(installText)) { + install(); + } else if (mode.equals(removeText)) { + remove(); + } else if (mode.equals(undoText)) { + undo(); + } + } + }); Dimension installButtonDimensions = installRemoveButton.getPreferredSize(); - installButtonDimensions.width = ContributionPanel.BUTTON_WIDTH; + installButtonDimensions.width = BUTTON_WIDTH; installRemoveButton.setPreferredSize(installButtonDimensions); installRemoveButton.setMaximumSize(installButtonDimensions); installRemoveButton.setMinimumSize(installButtonDimensions); @@ -317,7 +276,6 @@ public void actionPerformed(ActionEvent e) { JPanel barPane = new JPanel(); barPane.setOpaque(false); -// barPane.add(installProgressBar); JPanel buttonPane = new JPanel(); buttonPane.setOpaque(false); @@ -325,19 +283,17 @@ public void actionPerformed(ActionEvent e) { barButtonCardPane.add(buttonPane, BUTTON_CONSTRAINT); barButtonCardPane.add(barPane, PROGRESS_BAR_CONSTRAINT); - - ((CardLayout) barButtonCardPane.getLayout()).show(barButtonCardPane, BUTTON_CONSTRAINT); + barButtonCardLayout.show(barButtonCardPane, BUTTON_CONSTRAINT); rightPane.add(barButtonCardPane); // Set the minimum size of this pane to be the sum of the height of the // progress bar and install button - d = installProgressBar.getPreferredSize(); - Dimension d2 = installRemoveButton.getPreferredSize(); - d.width = ContributionPanel.BUTTON_WIDTH; - d.height = d2.height;//d.height+d2.height; - rightPane.setMinimumSize(d); - rightPane.setPreferredSize(d); + Dimension dim = + new Dimension(BUTTON_WIDTH, + installRemoveButton.getPreferredSize().height); + rightPane.setMinimumSize(dim); + rightPane.setPreferredSize(dim); } @@ -358,11 +314,10 @@ private void reorganizePaneComponents() { rightPane.setInheritsPopupMenu(true); rightPane.setOpaque(false); rightPane.setLayout(new BoxLayout(rightPane, BoxLayout.Y_AXIS)); - rightPane.setMinimumSize(new Dimension(ContributionPanel.BUTTON_WIDTH, 1)); + rightPane.setMinimumSize(new Dimension(BUTTON_WIDTH, 1)); add(rightPane, BorderLayout.EAST); - - if (updateButton.isVisible() && !isRemoveInProgress && !contrib.isDeletionFlagged()) { + if (updateButton.isVisible() && !removeInProgress && !contrib.isDeletionFlagged()) { JPanel updateRemovePanel = new JPanel(); updateRemovePanel.setLayout(new FlowLayout()); updateRemovePanel.setOpaque(false); @@ -374,21 +329,18 @@ private void reorganizePaneComponents() { JPanel barPane = new JPanel(); barPane.setOpaque(false); barPane.setInheritsPopupMenu(true); -// barPane.add(installProgressBar); rightPane.add(barPane); - if (isUpdateInProgress) - ((CardLayout) barButtonCardPane.getLayout()).show(barButtonCardPane, PROGRESS_BAR_CONSTRAINT); - - } - else { + if (updateInProgress) { + barButtonCardLayout.show(barButtonCardPane, PROGRESS_BAR_CONSTRAINT); + } + } else { updateBox.add(updateButton, BorderLayout.EAST); barButtonCardPane.removeAll(); JPanel barPane = new JPanel(); barPane.setOpaque(false); barPane.setInheritsPopupMenu(true); -// barPane.add(installProgressBar); JPanel buttonPane = new JPanel(); buttonPane.setOpaque(false); @@ -397,34 +349,33 @@ private void reorganizePaneComponents() { barButtonCardPane.add(buttonPane, BUTTON_CONSTRAINT); barButtonCardPane.add(barPane, PROGRESS_BAR_CONSTRAINT); - if (isInstallInProgress || isRemoveInProgress || isUpdateInProgress) - ((CardLayout) barButtonCardPane.getLayout()).show(barButtonCardPane, PROGRESS_BAR_CONSTRAINT); - else - ((CardLayout) barButtonCardPane.getLayout()).show(barButtonCardPane, BUTTON_CONSTRAINT); - + if (installInProgress || removeInProgress || updateInProgress) { + barButtonCardLayout.show(barButtonCardPane, PROGRESS_BAR_CONSTRAINT); + } else { + barButtonCardLayout.show(barButtonCardPane, BUTTON_CONSTRAINT); + } rightPane.add(barButtonCardPane); } - Dimension d = installProgressBar.getPreferredSize(); - Dimension d2 = installRemoveButton.getPreferredSize(); - d.width = ContributionPanel.BUTTON_WIDTH; - d.height = Math.max(d.height,d2.height); - rightPane.setMinimumSize(d); - rightPane.setPreferredSize(d); + Dimension progressDim = installProgressBar.getPreferredSize(); + Dimension installDim = installRemoveButton.getPreferredSize(); + progressDim.width = BUTTON_WIDTH; + progressDim.height = Math.max(progressDim.height, installDim.height); + rightPane.setMinimumSize(progressDim); + rightPane.setPreferredSize(progressDim); } private void setExpandListener(Component component, MouseListener expandListener) { - if (component instanceof JButton) { - // This will confuse the button, causing it to stick on OS X - // https://github.com/processing/processing/issues/3172 - return; - } - component.addMouseListener(expandListener); - if (component instanceof Container) { - for (Component child : ((Container) component).getComponents()) { - setExpandListener(child, expandListener); + // If it's a JButton, adding the listener will make this stick on OS X + // https://github.com/processing/processing/issues/3172 + if (!(component instanceof JButton)) { + component.addMouseListener(expandListener); + if (component instanceof Container) { + for (Component child : ((Container) component).getComponents()) { + setExpandListener(child, expandListener); + } } } } @@ -433,8 +384,9 @@ private void setExpandListener(Component component, private void blurContributionPanel(Component component) { component.setFocusable(false); component.setEnabled(false); - if (component instanceof JComponent) + if (component instanceof JComponent) { ((JComponent) component).setToolTipText(INCOMPATIBILITY_BLUR); + } if (component instanceof Container) { for (Component child : ((Container) component).getComponents()) { blurContributionPanel(child); @@ -447,48 +399,43 @@ public void setContribution(Contribution contrib) { this.contrib = contrib; if (contrib.isSpecial()) { - ImageIcon processingIcon = Toolkit.getLibIcon("icons/pde-48.png"); - JLabel iconLabel = new JLabel(processingIcon); + JLabel iconLabel = new JLabel(foundationIcon); iconLabel.setBorder(new EmptyBorder(4, 7, 7, 7)); iconLabel.setVerticalAlignment(SwingConstants.TOP); add(iconLabel, BorderLayout.WEST); } - description = new StringBuilder(); - description.append(""); + // Avoid ugly synthesized bold + Font boldFont = ManagerFrame.SMALL_BOLD; + String fontFace = ""; + + StringBuilder desc = new StringBuilder(); + desc.append("" + fontFace); if (contrib.getUrl() == null) { - description.append(contrib.getName()); + desc.append(contrib.getName()); } else { - description.append("" + contrib.getName() + ""); - } - description.append(" "); - - String version = contrib.getPrettyVersion(); - - // TODO this has no place here, we shouldn't be cleaning up contrib - // information in the f*king GUI. - if (version != null && !version.isEmpty()) { - if (version.toLowerCase().startsWith("build")) // For Python mode - description.append(version.substring(5, version.indexOf(',')).trim()); - else if (version.toLowerCase().startsWith("v")) // For ketai library - description.append(version); - else - description.append(version); - } - description.append("
"); - + desc.append("" + contrib.getName() + ""); + } + desc.append("
"); + + String prettyVersion = contrib.getPrettyVersion(); + if (prettyVersion != null) { + desc.append(prettyVersion); + } + desc.append("
"); + String authorList = contrib.getAuthorList(); if (authorList != null && !authorList.isEmpty()) { - description.append(toHtmlLinks(contrib.getAuthorList())); + desc.append(toHtmlLinks(contrib.getAuthorList())); } - description.append("

"); + desc.append("

"); if (contrib.isDeletionFlagged()) { - description.append(REMOVE_RESTART_MESSAGE); + desc.append(REMOVE_RESTART_MESSAGE); } else if (contrib.isRestartFlagged()) { - description.append(INSTALL_RESTART_MESSAGE); + desc.append(INSTALL_RESTART_MESSAGE); } else if (contrib.isUpdateFlagged()) { - description.append(UPDATE_RESTART_MESSAGE); + desc.append(UPDATE_RESTART_MESSAGE); } else { String sentence = contrib.getSentence(); if (sentence == null || sentence.isEmpty()) { @@ -497,22 +444,24 @@ else if (version.toLowerCase().startsWith("v")) // For ketai library sentence = sanitizeHtmlTags(sentence); sentence = toHtmlLinks(sentence); } - description.append(sentence); + desc.append(sentence); } long lastUpdatedUTC = contrib.getLastUpdated(); if (lastUpdatedUTC != 0) { DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.MEDIUM); Date lastUpdatedDate = new Date(lastUpdatedUTC); - if (version != null && !version.isEmpty()) - description.append(", "); - description.append("Last Updated on " + dateFormatter.format(lastUpdatedDate)); + if (prettyVersion != null) { + desc.append(", "); + } + desc.append("Last Updated on " + dateFormatter.format(lastUpdatedDate)); } - description.append(""); - descriptionPane.setText(description.toString()); + desc.append(""); + description = desc.toString(); + descriptionPane.setText(description); - if (contribListing.hasUpdates(contrib)) { + if (contribListing.hasUpdates(contrib) && contrib.isCompatible(Base.getRevision())) { StringBuilder versionText = new StringBuilder(); versionText.append(""); if (contrib.isUpdateFlagged() || contrib.isDeletionFlagged()) { @@ -520,7 +469,7 @@ else if (version.toLowerCase().startsWith("v")) // For ketai library // versionText.append("To finish an update, reinstall this contribution after restarting."); ; } else { - String latestVersion = contribListing.getLatestVersion(contrib); + String latestVersion = contribListing.getLatestPrettyVersion(contrib); if (latestVersion != null) { versionText.append("New version (" + latestVersion + ") available."); } else { @@ -537,29 +486,22 @@ else if (version.toLowerCase().startsWith("v")) // For ketai library updateButton.setEnabled(true); if (contrib != null) { - updateButton.setVisible((contribListing.hasUpdates(contrib) && !contrib.isUpdateFlagged() && !contrib.isDeletionFlagged()) || isUpdateInProgress); + updateButton.setVisible((contribListing.hasUpdates(contrib) && !contrib.isUpdateFlagged() && !contrib.isDeletionFlagged()) || updateInProgress); } - installRemoveButton.removeActionListener(installActionListener); - installRemoveButton.removeActionListener(removeActionListener); - installRemoveButton.removeActionListener(undoActionListener); - if (contrib.isDeletionFlagged()) { - installRemoveButton.addActionListener(undoActionListener); - installRemoveButton.setText(Language.text("contrib.undo")); + installRemoveButton.setText(undoText); + } else if (contrib.isInstalled()) { - installRemoveButton.addActionListener(removeActionListener); - installRemoveButton.setText(Language.text("contrib.remove")); + installRemoveButton.setText(removeText); installRemoveButton.setVisible(true); installRemoveButton.setEnabled(!contrib.isUpdateFlagged()); reorganizePaneComponents(); } else { - installRemoveButton.addActionListener(installActionListener); - installRemoveButton.setText(Language.text("contrib.install")); + installRemoveButton.setText(installText); } contextMenu.removeAll(); - if (contrib.isInstalled()) { contextMenu.add(openFolder); setComponentPopupMenu(contextMenu); @@ -572,15 +514,33 @@ else if (version.toLowerCase().startsWith("v")) // For ketai library } } + private void installContribution(AvailableContribution info) { if (info.link == null) { - listPanel.contributionTab.statusPanel.setErrorMessage(Language.interpolate("contrib.unsupported_operating_system", info.getType())); + setErrorMessage(Language.interpolate("contrib.unsupported_operating_system", info.getType())); } else { installContribution(info, info.link); } } + private void finishInstall(boolean error) { + resetInstallProgressBarState(); + installRemoveButton.setEnabled(!contrib.isUpdateFlagged()); + + if (error) { + setErrorMessage(Language.text("contrib.download_error")); + } + barButtonCardLayout.show(barButtonCardPane, BUTTON_CONSTRAINT); + installInProgress = false; + if (updateInProgress) { + updateInProgress = false; + } + updateButton.setVisible(contribListing.hasUpdates(contrib) && !contrib.isUpdateFlagged()); + setSelected(true); + } + + private void installContribution(AvailableContribution ad, String url) { installRemoveButton.setEnabled(false); @@ -590,72 +550,35 @@ private void installContribution(AvailableContribution ad, String url) { ContribProgressBar downloadProgress = new ContribProgressBar(installProgressBar) { public void finishedAction() { - // Finished downloading library + // nothing? } - public void cancel() { - // Finished installing library - resetInstallProgressBarState(); - installRemoveButton.setEnabled(!contrib.isUpdateFlagged()); - - ((CardLayout) barButtonCardPane.getLayout()).show(barButtonCardPane, BUTTON_CONSTRAINT); - isInstallInProgress = false; - if(isUpdateInProgress) - isUpdateInProgress = !isUpdateInProgress; - updateButton.setVisible(contribListing.hasUpdates(contrib) && !contrib.isUpdateFlagged()); - setSelected(true); + public void cancelAction() { + finishInstall(false); } }; ContribProgressBar installProgress = new ContribProgressBar(installProgressBar) { public void finishedAction() { - // Finished installing library - resetInstallProgressBarState(); - installRemoveButton.setEnabled(!contrib.isUpdateFlagged()); - - if (isError()) { - listPanel.contributionTab.statusPanel.setErrorMessage(Language.text("contrib.download_error")); - } - ((CardLayout) barButtonCardPane.getLayout()).show(barButtonCardPane, BUTTON_CONSTRAINT); - isInstallInProgress = false; - if(isUpdateInProgress) - isUpdateInProgress = !isUpdateInProgress; - updateButton.setVisible(contribListing.hasUpdates(contrib) && !contrib.isUpdateFlagged()); - setSelected(true); + finishInstall(isError()); } - public void cancel() { + public void cancelAction() { finishedAction(); } }; - ContributionManager.downloadAndInstall(listPanel.contributionTab.editor, - downloadUrl, ad, + ContributionManager.downloadAndInstall(getBase(), downloadUrl, ad, downloadProgress, installProgress, - listPanel.contributionTab.statusPanel); + getStatusPanel()); } catch (MalformedURLException e) { Messages.showWarning(Language.text("contrib.errors.install_failed"), Language.text("contrib.errors.malformed_url"), e); // not sure why we'd re-enable the button if it had an error... -// installRemoveButton.setEnabled(true); - } - } - - - // This doesn't actually seem to work? - /* - static void stripTextSelectionListeners(JEditorPane editorPane) { - for (MouseListener listener : editorPane.getMouseListeners()) { - String className = listener.getClass().getName(); - if (className.endsWith("MutableCaretEvent") || - className.endsWith("DragListener") || - className.endsWith("BasicCaret")) { - editorPane.removeMouseListener(listener); - } + //installRemoveButton.setEnabled(true); } } - */ protected void resetInstallProgressBarState() { @@ -666,6 +589,13 @@ protected void resetInstallProgressBarState() { } + /* + static final HyperlinkListener NULL_HYPERLINK_LISTENER = new HyperlinkListener() { + public void hyperlinkUpdate(HyperlinkEvent e) { } + }; + */ + + /** * Should be called whenever this component is selected (clicked on) * or unselected, even if it is already selected. @@ -677,22 +607,24 @@ public void setSelected(boolean isSelected) { enableHyperlinks = alreadySelected; if (contrib != null) { - updateButton.setVisible((contribListing.hasUpdates(contrib) && !contrib.isUpdateFlagged() && !contrib.isDeletionFlagged()) || isUpdateInProgress); + updateButton.setVisible((contribListing.hasUpdates(contrib) && !contrib.isUpdateFlagged() && !contrib.isDeletionFlagged()) || updateInProgress); updateButton.setEnabled(!contribListing.hasListDownloadFailed()); } - installRemoveButton.setVisible(isSelected() || installRemoveButton.getText().equals(Language.text("contrib.remove")) || isUpdateInProgress); + installRemoveButton.setVisible(isSelected() || installRemoveButton.getText().equals(Language.text("contrib.remove")) || updateInProgress); installRemoveButton.setEnabled(installRemoveButton.getText().equals(Language.text("contrib.remove")) ||!contribListing.hasListDownloadFailed()); reorganizePaneComponents(); - descriptionPane.removeHyperlinkListener(ContributionListPanel.nullHyperlinkListener); + /* + descriptionPane.removeHyperlinkListener(NULL_HYPERLINK_LISTENER); descriptionPane.removeHyperlinkListener(conditionalHyperlinkOpener); if (isSelected()) { descriptionPane.addHyperlinkListener(conditionalHyperlinkOpener); // descriptionPane.setEditable(false); } else { - descriptionPane.addHyperlinkListener(ContributionListPanel.nullHyperlinkListener); + descriptionPane.addHyperlinkListener(NULL_HYPERLINK_LISTENER); // descriptionPane.setEditable(true); } + */ // Update style of hyperlinks setSelectionStyle(descriptionPane, isSelected()); @@ -767,29 +699,30 @@ static String toHtmlLinks(String stringIn) { * Sets coloring based on whether installed or not; * also makes ugly blue HTML links into the specified color (black). */ - static void setForegroundStyle(JTextPane textPane, boolean installed, boolean selected) { + static void setForegroundStyle(JTextPane textPane, + boolean installed, boolean selected) { Document doc = textPane.getDocument(); if (doc instanceof HTMLDocument) { HTMLDocument html = (HTMLDocument) doc; StyleSheet stylesheet = html.getStyleSheet(); - String c = (installed && !selected) ? "#555555" : "#000000"; // slightly grayed when installed -// String c = "#000000"; // just make them both black + // slightly grayed when installed + String c = (installed && !selected) ? "#555555" : "#000000"; stylesheet.addRule("body { color:" + c + "; }"); stylesheet.addRule("a { color:" + c + "; }"); } } - static void setTextStyle(JTextPane textPane) { + static void setTextStyle(JTextPane textPane, String fontSize) { Document doc = textPane.getDocument(); if (doc instanceof HTMLDocument) { HTMLDocument html = (HTMLDocument) doc; StyleSheet stylesheet = html.getStyleSheet(); stylesheet.addRule("body { " + " margin: 0; padding: 0;" + - " font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;" + - " font-size: 100%;" + "font-size: 0.95em; " + + " font-family: " + Toolkit.getSansFontName() + ", Arial, Helvetica, sans-serif;" + + " font-size: 100%;" + "font-size: " + fontSize + "; " + "}"); } } @@ -810,9 +743,9 @@ static void setSelectionStyle(JTextPane textPane, boolean selected) { public void install() { - listPanel.contributionTab.statusPanel.clear(); - isInstallInProgress = true; - ((CardLayout) barButtonCardPane.getLayout()).show(barButtonCardPane, PROGRESS_BAR_CONSTRAINT); + clearStatusMessage(); + installInProgress = true; + barButtonCardLayout.show(barButtonCardPane, PROGRESS_BAR_CONSTRAINT); if (contrib instanceof AvailableContribution) { installContribution((AvailableContribution) contrib); contribListing.replaceContribution(contrib, contrib); @@ -821,131 +754,169 @@ public void install() { public void update() { - - listPanel.contributionTab.statusPanel.clear(); - isUpdateInProgress = true; + clearStatusMessage(); + updateInProgress = true; if (contrib.getType().requiresRestart()) { installRemoveButton.setEnabled(false); installProgressBar.setVisible(true); installProgressBar.setIndeterminate(true); - ContribProgressBar progress = new ContribProgressBar(installProgressBar) { - public void finishedAction() { - // Finished uninstalling the library - resetInstallProgressBarState(); - updateButton.setEnabled(false); - AvailableContribution ad = - contribListing.getAvailableContribution(contrib); - String url = ad.link; - installContribution(ad, url); - } - - @Override - public void cancel() { - super.cancel(); - resetInstallProgressBarState(); - listPanel.contributionTab.statusPanel.setMessage(""); - isUpdateInProgress = false; - installRemoveButton.setEnabled(true); - if (contrib.isDeletionFlagged()) { - ((LocalContribution)contrib).setUpdateFlag(true); - ((LocalContribution)contrib).setDeletionFlag(false); - contribListing.replaceContribution(contrib,contrib); - } - - boolean isModeActive = false; - if (contrib.getType() == ContributionType.MODE) { - ModeContribution m = (ModeContribution) contrib; - //Iterator iter = listPanel.contribManager.editor.getBase().getEditors().iterator(); - //while (iter.hasNext()) { - // TODO there's gotta be a cleaner way to do this accessor - Base base = listPanel.contributionTab.editor.getBase(); - for (Editor e : base.getEditors()) { - //Editor e = iter.next(); - if (e.getMode().equals(m.getMode())) { - isModeActive = true; - break; - } - } - } - if (isModeActive) { - updateButton.setEnabled(true); - } else { - listPanel.contributionTab.restartButton.setVisible(true); - } - } - }; - ((LocalContribution) contrib) - .removeContribution(listPanel.contributionTab.editor, - progress, listPanel.contributionTab.statusPanel); + ContribProgressBar progress = new UpdateProgressBar(installProgressBar); + getLocalContrib().removeContribution(getBase(), progress, getStatusPanel()); } else { updateButton.setEnabled(false); installRemoveButton.setEnabled(false); - AvailableContribution ad = contribListing.getAvailableContribution(contrib); + AvailableContribution ad = + contribListing.getAvailableContribution(contrib); + installContribution(ad, ad.link); + } + } + + + class UpdateProgressBar extends ContribProgressBar { + public UpdateProgressBar(JProgressBar progressBar) { + super(progressBar); + } + + public void finishedAction() { + resetInstallProgressBarState(); + updateButton.setEnabled(false); + AvailableContribution ad = + contribListing.getAvailableContribution(contrib); String url = ad.link; installContribution(ad, url); } + @Override + public void cancelAction() { + resetInstallProgressBarState(); + //listPanel.contributionTab.statusPanel.setMessage(""); // same as clear? + clearStatusMessage(); + updateInProgress = false; + installRemoveButton.setEnabled(true); + if (contrib.isDeletionFlagged()) { + getLocalContrib().setUpdateFlag(true); + getLocalContrib().setDeletionFlag(false); + contribListing.replaceContribution(contrib, contrib); + } + + if (isModeActive(contrib)) { + updateButton.setEnabled(true); + } else { + // TODO: remove or uncomment if the button was added + //listPanel.contributionTab.restartButton.setVisible(true); + } + } } public void remove() { - - listPanel.contributionTab.statusPanel.clear(); + clearStatusMessage(); if (contrib.isInstalled() && contrib instanceof LocalContribution) { - isRemoveInProgress = true; - ((CardLayout) barButtonCardPane.getLayout()).show(barButtonCardPane, PROGRESS_BAR_CONSTRAINT); + removeInProgress = true; + barButtonCardLayout.show(barButtonCardPane, PROGRESS_BAR_CONSTRAINT); updateButton.setEnabled(false); installRemoveButton.setEnabled(false); installProgressBar.setVisible(true); installProgressBar.setIndeterminate(true); - ContribProgressBar monitor = new ContribProgressBar(installProgressBar) { - public void finishedAction() { - // Finished uninstalling the library - resetInstallProgressBarState(); - isRemoveInProgress = false; - installRemoveButton.setEnabled(true); + ContribProgressBar monitor = new RemoveProgressBar(installProgressBar); + getLocalContrib().removeContribution(getBase(), monitor, getStatusPanel()); + } + } - reorganizePaneComponents(); - setSelected(true); // Needed for smooth working. Dunno why, though... - } - public void cancel() { - super.cancel(); - resetInstallProgressBarState(); - isRemoveInProgress = false; - installRemoveButton.setEnabled(true); - - reorganizePaneComponents(); - setSelected(true); - - ContributionTab contributionTab = listPanel.contributionTab; - boolean isModeActive = false; - if (contrib.getType() == ContributionType.MODE) { - ModeContribution m = (ModeContribution) contrib; - // TODO there's gotta be a cleaner way to do this accessor - for (Editor e : contributionTab.editor.getBase().getEditors()) { - //Iterator iter = listPanel.contribManager.editor.getBase().getEditors().iterator(); - //while (iter.hasNext()) { - //Editor e = iter.next(); - if (e.getMode().equals(m.getMode())) { - isModeActive = true; - break; - } - } - } - if (isModeActive) { - updateButton.setEnabled(true); - } else { - contributionTab.restartButton.setVisible(true); + class RemoveProgressBar extends ContribProgressBar { + public RemoveProgressBar(JProgressBar progressBar) { + super(progressBar); + } + + private void preAction() { + resetInstallProgressBarState(); + removeInProgress = false; + installRemoveButton.setEnabled(true); + reorganizePaneComponents(); + setSelected(true); // Needed for smooth working. Dunno why, though... + } + + public void finishedAction() { + // Finished uninstalling the library + preAction(); + } + + public void cancelAction() { + preAction(); + + if (isModeActive(contrib)) { + updateButton.setEnabled(true); + } else { + // TODO: remove or uncomment if the button was added + //contributionTab.restartButton.setVisible(true); + } + } + } + + + private void undo() { + clearStatusMessage(); + if (contrib instanceof LocalContribution) { + LocalContribution installed = getLocalContrib(); + installed.setDeletionFlag(false); + contribListing.replaceContribution(contrib, contrib); // ?? + Iterator contribsListIter = contribListing.allContributions.iterator(); + boolean toBeRestarted = false; + while (contribsListIter.hasNext()) { + Contribution contribElement = contribsListIter.next(); + if (contrib.getType().equals(contribElement.getType())) { + if (contribElement.isDeletionFlagged() || + contribElement.isUpdateFlagged()) { + toBeRestarted = !toBeRestarted; + break; } } - }; - ContributionTab contributionTab = listPanel.contributionTab; - LocalContribution localContrib = (LocalContribution) contrib; - localContrib.removeContribution(contributionTab.editor, monitor, contributionTab.statusPanel); + } + // TODO: remove or uncomment if the button was added + //listPanel.contributionTab.restartButton.setVisible(toBeRestarted); } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + // Can't be called from the constructor because the path isn't set all the + // way down. However, it's not Base changes over time. More importantly, + // though, is that the functions being called in Base are somewhat suspect + // since they're contribution-related, and should perhaps live closer. + private Base getBase() { + return listPanel.contributionTab.editor.getBase(); + } + + + private boolean isModeActive(Contribution contrib) { + if (contrib.getType() == ContributionType.MODE) { + ModeContribution m = (ModeContribution) contrib; + for (Editor e : getBase().getEditors()) { + if (e.getMode().equals(m.getMode())) { + return true; + } + } + } + return false; + } + + + private StatusPanel getStatusPanel() { + return listPanel.contributionTab.statusPanel; // TODO this is gross [fry] + } + + + private void clearStatusMessage() { + getStatusPanel().clearMessage(); + } + + private void setErrorMessage(String message) { + getStatusPanel().setErrorMessage(message); } } diff --git a/app/src/processing/app/contrib/ExamplesContribution.java b/app/src/processing/app/contrib/ExamplesContribution.java index aa7a14fb73..2e091c7216 100644 --- a/app/src/processing/app/contrib/ExamplesContribution.java +++ b/app/src/processing/app/contrib/ExamplesContribution.java @@ -6,7 +6,7 @@ import java.util.Map; import processing.app.Base; -import processing.core.PApplet; +import processing.app.Mode; import processing.data.StringDict; import processing.data.StringList; import static processing.app.contrib.ContributionType.EXAMPLES; @@ -30,45 +30,28 @@ private ExamplesContribution(File folder) { } - static private StringList parseModeList(StringDict properties) { - String unparsedModes = properties.get(MODES_PROPERTY); - - // Workaround for 3.0 alpha/beta bug for 3.0b2 - if ("null".equals(unparsedModes)) { - properties.remove(MODES_PROPERTY); - unparsedModes = null; - } - - StringList outgoing = new StringList(); - if (unparsedModes != null) { - outgoing.append(PApplet.trim(PApplet.split(unparsedModes, ','))); - } - return outgoing; + static public boolean isCompatible(Base base, StringDict props) { + return isCompatible(base.getActiveEditor().getMode(), props); } /** * Function to determine whether or not the example present in the * exampleLocation directory is compatible with the current mode. - * - * @param base - * @param exampleFolder - * @return true if the example is compatible with the mode of the currently - * active editor + * @return true if compatible with the Mode of the currently active editor */ - static public boolean isCompatible(Base base, StringDict props) { - String currentIdentifier = - base.getActiveEditor().getMode().getIdentifier(); + static public boolean isCompatible(Mode mode, StringDict props) { + String currentIdentifier = mode.getIdentifier(); StringList compatibleList = parseModeList(props); if (compatibleList.size() == 0) { - return true; // if no mode specified, assume compatible everywhere - } - for (String c : compatibleList) { - if (c.equals(currentIdentifier)) { - return true; + if (mode.requireExampleCompatibility()) { + // for p5js (and maybe Python), examples must specify that they work + return false; } + // if no Mode specified, assume compatible everywhere + return true; } - return false; + return compatibleList.hasValue(currentIdentifier); } diff --git a/app/src/processing/app/contrib/IgnorableException.java b/app/src/processing/app/contrib/IgnorableException.java new file mode 100644 index 0000000000..b86ac2a93e --- /dev/null +++ b/app/src/processing/app/contrib/IgnorableException.java @@ -0,0 +1,8 @@ +package processing.app.contrib; + + +public class IgnorableException extends Exception { + public IgnorableException(String msg) { + super(msg); + } +} diff --git a/app/src/processing/app/contrib/ListPanel.java b/app/src/processing/app/contrib/ListPanel.java new file mode 100644 index 0000000000..845b7178d4 --- /dev/null +++ b/app/src/processing/app/contrib/ListPanel.java @@ -0,0 +1,762 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2013-15 The Processing Foundation + Copyright (c) 2011-12 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 version 2 + as published by the Free Software Foundation. + + 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.contrib; + +import java.awt.*; +import java.util.List; +import java.util.*; +import java.util.Map.Entry; + +import javax.swing.*; +import javax.swing.RowSorter.SortKey; +import javax.swing.border.Border; +import javax.swing.event.*; +import javax.swing.table.*; + +import processing.app.Base; +import processing.app.Platform; +import processing.app.ui.Toolkit; + + +// The "Scrollable" implementation and its methods here take care of preventing +// the scrolling area from running exceptionally slowly. Not sure why they're +// necessary in the first place, however; seems like odd behavior. +// It also allows the description text in the panels to wrap properly. + +public class ListPanel extends JPanel +implements Scrollable, ContributionListing.ChangeListener { + ContributionTab contributionTab; + TreeMap panelByContribution = new TreeMap<>(ContributionListing.COMPARATOR); + + private DetailPanel selectedPanel; + protected ContributionRowFilter filter; + protected JTable table; + protected TableRowSorter sorter; + ContributionTableModel model; + JScrollPane scrollPane; + + static Icon upToDateIcon; + static Icon updateAvailableIcon; + static Icon incompatibleIcon; + static Icon foundationIcon; + static Icon downloadingIcon; + + // Should this be in theme.txt? Of course! Is it? No. + static final Color HEADER_BGCOLOR = new Color(0xffEBEBEB); + static final Color SECTION_COLOR = new Color(0xFFf8f8f8); + static final Color SELECTION_COLOR = new Color(0xffe0fffd); + + static final SectionHeaderContribution[] sections = { + new SectionHeaderContribution(ContributionType.LIBRARY), + new SectionHeaderContribution(ContributionType.MODE), + new SectionHeaderContribution(ContributionType.TOOL), + new SectionHeaderContribution(ContributionType.EXAMPLES) + }; + + public ListPanel() { + if (upToDateIcon == null) { + upToDateIcon = Toolkit.getLibIconX("manager/up-to-date"); + updateAvailableIcon = Toolkit.getLibIconX("manager/update-available"); + incompatibleIcon = Toolkit.getLibIconX("manager/incompatible"); + foundationIcon = Toolkit.getLibIconX("icons/foundation", 16); + downloadingIcon = Toolkit.getLibIconX("manager/downloading"); + } + } + + + public ListPanel(final ContributionTab contributionTab, + final Contribution.Filter filter, + final boolean enableSections, + final ContributionColumn... columns) { + this(); + this.contributionTab = contributionTab; + this.filter = new ContributionRowFilter(filter); + + setLayout(new GridBagLayout()); + setOpaque(true); + setBackground(Color.WHITE); + model = new ContributionTableModel(columns); + model.enableSections(enableSections); + table = new JTable(model) { + @Override + public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { + Component c = super.prepareRenderer(renderer, row, column); + Object rowValue = getValueAt(row, column); + if (rowValue instanceof SectionHeaderContribution) { + c.setBackground(SECTION_COLOR); + } else if (isRowSelected(row)) { + c.setBackground(SELECTION_COLOR); + } else { + c.setBackground(Color.white); + } + return c; + } + + @Override + public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) { + if (!(getValueAt(rowIndex, columnIndex) instanceof SectionHeaderContribution)) { + super.changeSelection(rowIndex, columnIndex, toggle, extend); + } + } + }; + + // There is a space before Status + scrollPane = new JScrollPane(table); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + scrollPane.setBorder(BorderFactory.createEmptyBorder()); + table.setFillsViewportHeight(true); + table.setDefaultRenderer(Contribution.class, new ContribStatusRenderer()); + table.setFont(ManagerFrame.NORMAL_PLAIN); + table.setRowHeight(Toolkit.zoom(28)); + table.setRowMargin(Toolkit.zoom(6)); + table.getColumnModel().setColumnMargin(0); + table.getColumnModel().getColumn(0).setMaxWidth(ManagerFrame.STATUS_WIDTH); + table.getColumnModel().getColumn(2).setMinWidth(ManagerFrame.AUTHOR_WIDTH); + table.getColumnModel().getColumn(2).setMaxWidth(ManagerFrame.AUTHOR_WIDTH); + table.setShowGrid(false); + table.setColumnSelectionAllowed(false); + table.setCellSelectionEnabled(false); + table.setAutoCreateColumnsFromModel(true); + table.setAutoCreateRowSorter(false); + table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + + table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent event) { + //TODO this executes 2 times when clicked and 1 time when traversed using arrow keys + //Ideally this should always be true but while clearing the table something fishy is going on + if (table.getSelectedRow() != -1) { + setSelectedPanel(panelByContribution.get(table.getValueAt(table + .getSelectedRow(), 0))); + // Preventing the focus to move out of filterField after typing every character + if (!contributionTab.filterHasFocus()) { + table.requestFocusInWindow(); + } + } + } + }); + + sorter = new TableRowSorter<>(model); + table.setRowSorter(sorter); + sorter.setRowFilter(this.filter); + for (int i=0; i < model.getColumnCount(); i++) { + if (model.columns[i] == ContributionColumn.NAME) { + sorter.setSortKeys(Collections.singletonList(new SortKey(i, SortOrder.ASCENDING))); + } + sorter.setComparator(i, model.columns[i].getComparator()); + } + table.getTableHeader().setDefaultRenderer(new ContribHeaderRenderer()); + + GroupLayout layout = new GroupLayout(this); + layout.setHorizontalGroup(layout.createParallelGroup().addComponent(scrollPane)); + layout.setVerticalGroup(layout.createSequentialGroup().addComponent(scrollPane)); + + this.setLayout(layout); + table.setVisible(true); + } + + private static int getContributionStatusRank(Contribution c) { + int pos = 4; + if (c.isInstalled()) { + pos = 1; + if (ContributionListing.getInstance().hasUpdates(c)) { + pos = 2; + } + if (!c.isCompatible(Base.getRevision())) { + pos = 3; + } + } + return pos; + } + + class ContribHeaderRenderer extends DefaultTableCellRenderer { + + public ContribHeaderRenderer() { + setHorizontalTextPosition(LEFT); + setOpaque(true); + } + + /** + * Returns the default table header cell renderer. + *

+ * If the column is sorted, the appropriate icon is retrieved from the + * current Look and Feel, and a border appropriate to a table header cell + * is applied. + *

+ * Subclasses may override this method to provide custom content or + * formatting. + * + * @param table the JTable. + * @param value the value to assign to the header cell + * @param isSelected This parameter is ignored. + * @param hasFocus This parameter is ignored. + * @param row This parameter is ignored. + * @param column the column of the header cell to render + * @return the default table header cell renderer + */ + @Override + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { + super.getTableCellRendererComponent(table, value, + isSelected, hasFocus, row, column); + + JTableHeader tableHeader = table.getTableHeader(); + if (tableHeader != null) { + setForeground(tableHeader.getForeground()); + } + setFont(ManagerFrame.SMALL_PLAIN); + setIcon(getSortIcon(table, column)); + setBackground(HEADER_BGCOLOR); +// if (column % 2 == 0) { +// setBackground(new Color(0xdfdfdf)); +// } else { +// setBackground(new Color(0xebebeb)); +// } + setBorder(null); + return this; + } + + /** + * Overloaded to return an icon suitable to the primary sorted column, or null if + * the column is not the primary sort key. + * + * @param table the JTable. + * @param column the column index. + * @return the sort icon, or null if the column is unsorted. + */ + protected Icon getSortIcon(JTable table, int column) { + SortKey sortKey = getSortKey(table, column); + if (sortKey != null && table.convertColumnIndexToView(sortKey.getColumn()) == column) { + switch (sortKey.getSortOrder()) { + case ASCENDING: + return UIManager.getIcon("Table.ascendingSortIcon"); + case DESCENDING: + return UIManager.getIcon("Table.descendingSortIcon"); + } + } + return null; + } + + /** + * Returns the current sort key, or null if the column is unsorted. + * + * @param table the table + * @param column the column index + * @return the SortKey, or null if the column is unsorted + */ + protected SortKey getSortKey(JTable table, int column) { + return Optional.ofNullable(table.getRowSorter()) + .map(RowSorter::getSortKeys) + .map(columns -> columns.isEmpty() ? null : columns.get(0)) + .orElse(null); + + } + } + + + private class ContribStatusRenderer extends DefaultTableCellRenderer { + + @Override + public void setVerticalAlignment(int alignment) { + super.setVerticalAlignment(SwingConstants.CENTER); + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, + boolean hasFocus, int row, + int column) { + Contribution contribution = (Contribution) value; + JLabel label = new JLabel(); + ContributionColumn col = model.columns[column]; + if (value == null) { + // Working on https://github.com/processing/processing/issues/3667 + //System.err.println("null value seen in getTableCellRendererComponent()"); + // TODO this is now working, but the underlying issue is not fixed + return label; + } + + label.setOpaque(true); + + if (value instanceof SectionHeaderContribution && col != ContributionColumn.NAME) { + return label; + } + switch (col) { + case STATUS: + case STATUS_NO_HEADER: + configureStatusColumnLabel(label, contribution); + break; + case NAME: + configureNameColumnLabel(table, label, contribution); + break; + case AUTHOR: + configureAuthorsColumnLabel(label, contribution); + break; + case INSTALLED_VERSION: + label.setText(contribution.getBenignVersion()); + break; + case AVAILABLE_VERSION: + label.setText(ContributionListing.getInstance().getLatestPrettyVersion(contribution)); + break; + } + + if(!contribution.isCompatible(Base.getRevision())){ + label.setForeground(Color.LIGHT_GRAY); + } + return label; + } + + private void configureStatusColumnLabel(JLabel label, Contribution contribution) { + Icon icon = null; + label.setFont(ManagerFrame.NORMAL_PLAIN); + if ((panelByContribution.get(contribution)).updateInProgress || + (panelByContribution.get(contribution)).installInProgress) { + // Display "Loading icon" if download/install in progress + icon = downloadingIcon; + } else if (contribution.isInstalled()) { + if (!contribution.isCompatible(Base.getRevision())) { + icon = incompatibleIcon; + } else if (ContributionListing.getInstance().hasUpdates(contribution)) { + icon = updateAvailableIcon; + } else if (panelByContribution.get(contribution).installInProgress + || panelByContribution.get(contribution).updateInProgress) { + icon = downloadingIcon; + } else { + icon = upToDateIcon; + } + } + + label.setIcon(icon); + label.setHorizontalAlignment(SwingConstants.CENTER); + } + + private void configureNameColumnLabel(JTable table, JLabel label, Contribution contribution) { + // Generating ellipses based on fontMetrics + final Font boldFont = ManagerFrame.NORMAL_BOLD; + FontMetrics fontMetrics = table.getFontMetrics(boldFont); //table.getFont()); + int colSize = table.getColumnModel().getColumn(1).getWidth(); + int currentWidth = fontMetrics.stringWidth(contribution.getName() + " | ..."); + String sentence = contribution.getSentence(); + StringBuilder text = new StringBuilder("") + .append(contribution.getName()); + + if (sentence == null) { + text.append(""); + } else { + int i = 0; + for (i = 0; i < sentence.length(); i++) { + currentWidth += fontMetrics.charWidth(sentence.charAt(i)); + if (currentWidth >= colSize) { + break; + } + } + text.append(" | ").append(sentence, 0, i); + // Adding ellipses only if text doesn't fits into the column + if(i != sentence.length()) { + text.append("..."); + } + } + text.append(""); + label.setText(text.toString()); + label.setFont(ManagerFrame.NORMAL_PLAIN); + } + + private void configureAuthorsColumnLabel(JLabel label, Contribution contribution) { + if (contribution.isSpecial()) { + label.setIcon(foundationIcon); + } + String authorList = contribution.getAuthorList(); + String name = getAuthorNameWithoutMarkup(authorList); + label.setText(name); + label.setHorizontalAlignment(SwingConstants.LEFT); + label.setForeground(Color.BLACK); + label.setFont(ManagerFrame.NORMAL_BOLD); + } + } + + protected enum ContributionColumn { + STATUS(" Status"), + NAME("Name"), + AUTHOR("Author"), + INSTALLED_VERSION("Installed"), + AVAILABLE_VERSION("Available"), + STATUS_NO_HEADER(""); + + final String name; + + ContributionColumn(String name) { + this.name = name; + } + + Comparator getComparator() { + Comparator comparator = Comparator.comparing(Contribution::getType) + .thenComparingInt(contribution -> contribution instanceof SectionHeaderContribution ? 0 : 1); + switch (this) { + case STATUS: + case STATUS_NO_HEADER: + return comparator.thenComparingInt(ListPanel::getContributionStatusRank); + case AUTHOR: + return comparator.thenComparing(contribution -> getAuthorNameWithoutMarkup(contribution.getAuthorList())); + case NAME: + default: + return comparator.thenComparing(Contribution::getName, String.CASE_INSENSITIVE_ORDER); + } + } + } + + protected class ContributionTableModel extends AbstractTableModel { + + ContributionColumn[] columns = { ContributionColumn.STATUS, ContributionColumn.NAME, ContributionColumn.AUTHOR }; + boolean sectionsEnabled; + + ContributionTableModel(ContributionColumn... columns) { + if (columns.length > 0) { + this.columns = columns; + } + } + + @Override + public int getRowCount() { + return ContributionListing.getInstance().allContributions.size() + (sectionsEnabled ? 4 : 0); + } + + @Override + public int getColumnCount() { + return columns.length; + } + + @Override + public String getColumnName(int column) { + if (column < 0 || column > columns.length) { + return ""; + } + + return columns[column].name; + } + + @Override + public Class getColumnClass(int columnIndex) { + return Contribution.class; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + if (rowIndex >= ContributionListing.getInstance().allContributions.size()) { + return sections[rowIndex - ContributionListing.getInstance().allContributions.size()]; + } + + return ContributionListing.getInstance().allContributions.stream().skip(rowIndex).findFirst().orElse(null); + } + + public void setColumns(ContributionColumn[] columns) { + this.columns = columns; + } + + public void enableSections(boolean enable) { + this.sectionsEnabled = enable; + } + } + + protected class ContributionRowFilter extends RowFilter { + Contribution.Filter contributionFilter; + Optional categoryFilter = Optional.empty(); + List stringFilters = Collections.emptyList(); + + ContributionRowFilter(Contribution.Filter contributionFilter) { + this.contributionFilter = contributionFilter; + } + + public void setCategoryFilter(String categoryFilter) { + this.categoryFilter = Optional.ofNullable(categoryFilter); + } + + public void setStringFilters(List filters) { + this.stringFilters = filters; + } + + @Override + public boolean include(Entry entry) { + Contribution contribution = (Contribution) entry.getValue(0); + if (contribution instanceof SectionHeaderContribution) { + return includeSection((SectionHeaderContribution) contribution); + } + return includeContribution(contribution); + } + + private boolean includeContribution(Contribution contribution) { + return contributionFilter.matches(contribution) + && categoryFilter.map(contribution::hasCategory).orElse(true) + && stringFilters.stream().allMatch(pattern -> ContributionListing.getInstance().matches(contribution, pattern)); + } + + private boolean includeSection(SectionHeaderContribution section) { + return ContributionListing.getInstance().allContributions.stream() + .filter(contribution -> contribution.getType() == section.getType()) + .anyMatch(this::includeContribution); + } + } + + protected static class SectionHeaderContribution extends Contribution { + ContributionType type; + + SectionHeaderContribution(ContributionType type) { + this.type = type; + this.name = getTypeName(); + } + + @Override + public ContributionType getType() { + return type; + } + + @Override + public boolean isInstalled() { + return false; + } + } + + static String getAuthorNameWithoutMarkup(String authorList) { + StringBuilder name = new StringBuilder(); + if (authorList != null) { + int parentheses = 0; + for (int i = 0; i < authorList.length(); i++) { + + if (authorList.charAt(i) == '[' || authorList.charAt(i) == ']') { + continue; + } + if (authorList.charAt(i) == '(') { + parentheses++; + } else if (authorList.charAt(i) == ')') { + parentheses--; + } else if (parentheses == 0) { + name.append(authorList.charAt(i)); + } + } + } + return name.toString(); + } + + // Thread: EDT + public void contributionAdded(final Contribution contribution) { + if (!panelByContribution.containsKey(contribution)) { + DetailPanel newPanel = + new DetailPanel(this); + panelByContribution.put(contribution, newPanel); + newPanel.setContribution(contribution); + add(newPanel); + model.fireTableDataChanged(); + updateColors(); // XXX this is the place + } + } + + + // Thread: EDT + public void contributionRemoved(final Contribution contribution) { + DetailPanel panel = panelByContribution.get(contribution); + if (panel != null) { + remove(panel); + panelByContribution.remove(contribution); + } + model.fireTableDataChanged(); + updateColors(); + updateUI(); + } + + + // Thread: EDT + public void contributionChanged(final Contribution oldContrib, + final Contribution newContrib) { + DetailPanel panel = panelByContribution.get(oldContrib); + if (panel == null) { + contributionAdded(newContrib); + } else { + panelByContribution.remove(oldContrib); + panel.setContribution(newContrib); + panelByContribution.put(newContrib, panel); + model.fireTableDataChanged(); + } + } + + + // Thread: EDT + public void filterLibraries(String category, List filters) { + filter.setCategoryFilter(category); + filter.setStringFilters(filters); + model.fireTableDataChanged(); + } + + + // Thread: EDT + protected void setSelectedPanel(DetailPanel contributionPanel) { + contributionTab.updateStatusPanel(contributionPanel); + + if (selectedPanel == contributionPanel) { + selectedPanel.setSelected(true); + + } else { + DetailPanel lastSelected = selectedPanel; + selectedPanel = contributionPanel; + + if (lastSelected != null) { + lastSelected.setSelected(false); + } + contributionPanel.setSelected(true); + + updateColors(); + requestFocusInWindow(); + } + } + + + protected DetailPanel getSelectedPanel() { + return selectedPanel; + } + + + // Thread: EDT + /** + * Updates the colors of all library panels that are visible. + */ + protected void updateColors() { + int count = 0; + for (Entry entry : panelByContribution.entrySet()) { + DetailPanel panel = entry.getValue(); + Border border = BorderFactory.createEmptyBorder(1, 1, 1, 1); + + if (panel.isVisible()) { + boolean oddRow = count % 2 == 1; + Color bgColor = null; + Color fgColor = UIManager.getColor("List.foreground"); + + if (panel.isSelected()) { + bgColor = UIManager.getColor("List.selectionBackground"); + fgColor = UIManager.getColor("List.selectionForeground"); + border = UIManager.getBorder("List.focusCellHighlightBorder"); + } else if (Platform.isMacOS()) { + border = oddRow + ? UIManager.getBorder("List.oddRowBackgroundPainter") + : UIManager.getBorder("List.evenRowBackgroundPainter"); + } else { + bgColor = oddRow + ? new Color(219, 224, 229) + : new Color(241, 241, 241); + } + + panel.setForeground(fgColor); + if (bgColor != null) { + panel.setBackground(bgColor); + } + count++; + } + + panel.setBorder(border); + } + } + + + @Override + public Dimension getPreferredScrollableViewportSize() { + return getPreferredSize(); + } + + + /** + * Amount to scroll to reveal a new page of items + */ + @Override + public int getScrollableBlockIncrement(Rectangle visibleRect, + int orientation, int direction) { + if (orientation == SwingConstants.VERTICAL) { + int blockAmount = visibleRect.height; + if (direction > 0) { + visibleRect.y += blockAmount; + } else { + visibleRect.y -= blockAmount; + } + + blockAmount += + getScrollableUnitIncrement(visibleRect, orientation, direction); + return blockAmount; + } + return 0; + } + + + /** + * Amount to scroll to reveal the rest of something we are on or a new item + */ + @Override + public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { + if (orientation != SwingConstants.VERTICAL) { + return 0; + } + int lastHeight = 0; + int height = 0; + int bottomOfScrollArea = visibleRect.y + visibleRect.height; + + for (Component c : getComponents()) { + if (!(c.isVisible() && c instanceof DetailPanel)) { + continue; + } + Dimension d = c.getPreferredSize(); + + int nextHeight = height + d.height; + + if (direction > 0) { + // scrolling down + if (nextHeight > bottomOfScrollArea) { + return nextHeight - bottomOfScrollArea; + } + } else if (nextHeight > visibleRect.y) { + if (visibleRect.y != height) { + return visibleRect.y - height; + } else { + return visibleRect.y - lastHeight; + } + } + + lastHeight = height; + height = nextHeight; + } + + return 0; + } + + + @Override + public boolean getScrollableTracksViewportHeight() { + return false; + } + + + @Override + public boolean getScrollableTracksViewportWidth() { + return true; + } + + + public int getRowCount() { + // This will count section headers, but it is only used to check if any rows are shown + return sorter.getViewRowCount(); + } +} diff --git a/app/src/processing/app/contrib/LocalContribution.java b/app/src/processing/app/contrib/LocalContribution.java index c314c71028..cb128a73e9 100644 --- a/app/src/processing/app/contrib/LocalContribution.java +++ b/app/src/processing/app/contrib/LocalContribution.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013-15 The Processing Foundation + Copyright (c) 2013-20 The Processing Foundation Copyright (c) 2011-12 Ben Fry and Casey Reas This program is free software; you can redistribute it and/or modify @@ -21,7 +21,9 @@ */ package processing.app.contrib; +import java.awt.EventQueue; import java.io.*; +import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.net.URLClassLoader; import java.text.SimpleDateFormat; @@ -70,9 +72,9 @@ public LocalContribution(File folder) { } // changing to 'authors' in 3.0a11 authors = properties.get(AUTHORS_PROPERTY); - if (authors == null) { - authors = properties.get("authorList"); - } +// if (authors == null) { +// authors = properties.get("authorList"); +// } url = properties.get("url"); sentence = properties.get("sentence"); paragraph = properties.get("paragraph"); @@ -80,11 +82,11 @@ public LocalContribution(File folder) { try { version = Integer.parseInt(properties.get("version")); } catch (NumberFormatException e) { - System.err.println("The version number for the “" + name + "” library is not set properly."); + System.err.println("The version number for the “" + name + "” library is not a number."); System.err.println("Please contact the library author to fix it according to the guidelines."); } - prettyVersion = properties.get("prettyVersion"); + setPrettyVersion(properties.get("prettyVersion")); try { lastUpdated = Long.parseLong(properties.get("lastUpdated")); @@ -235,7 +237,8 @@ static void listClasses(ClassLoader loader) { LocalContribution copyAndLoad(Base base, boolean confirmReplace, StatusPanel status) { -// NOTE: null status => function is called on startup when Editor objects, et al. aren't ready + // NOTE: null status => function is called on startup + // when Editor objects, et al. aren't ready String contribFolderName = getFolder().getName(); @@ -260,10 +263,17 @@ LocalContribution copyAndLoad(Base base, (oldContrib.getId() != null && oldContrib.getId().equals(getId()))) { if (oldContrib.getType().requiresRestart()) { - // XXX: We can't replace stuff, soooooo.... do something different - if (!oldContrib.backup(editor, false, status)) { + if (!oldContrib.backup(false, status)) { return null; } + /* + try { + Platform.deleteFile(oldContrib.getFolder()); + } catch (IOException e) { + status.setErrorMessage(e.getMessage()); + return null; + } + */ } else { int result = 0; boolean doBackup = Preferences.getBoolean("contribution.backup.on_install"); @@ -275,7 +285,7 @@ LocalContribution copyAndLoad(Base base, "has been found in your sketchbook. Clicking “Yes”
"+ "will move the existing library to a backup folder
" + "in libraries/old before replacing it."); - if (result != JOptionPane.YES_OPTION || !oldContrib.backup(editor, true, status)) { + if (result != JOptionPane.YES_OPTION || !oldContrib.backup(true, status)) { return null; } } else { @@ -290,7 +300,7 @@ LocalContribution copyAndLoad(Base base, } } } else { - if ((doBackup && !oldContrib.backup(editor, true, status)) || + if ((doBackup && !oldContrib.backup(true, status)) || (!doBackup && !oldContrib.getFolder().delete())) { return null; } @@ -304,8 +314,7 @@ LocalContribution copyAndLoad(Base base, Util.removeDir(contribFolder); } - } - else { + } else { // This if should ideally never happen, since this function // is to be called only when restarting on update if (contribFolder.exists() && contribFolder.isDirectory()) { @@ -347,7 +356,7 @@ else if (contribFolder.exists()) { * true if the file should be moved to the directory, false if it * should instead be copied, leaving the original in place */ - boolean backup(Editor editor, boolean deleteOriginal, StatusPanel status) { + boolean backup(boolean deleteOriginal, StatusPanel status) { File backupFolder = getType().createBackupFolder(status); boolean success = false; @@ -377,12 +386,13 @@ boolean backup(Editor editor, boolean deleteOriginal, StatusPanel status) { /** * Non-blocking call to remove a contribution in a new thread. */ - void removeContribution(final Editor editor, + void removeContribution(final Base base, final ContribProgressMonitor pm, final StatusPanel status) { + // TODO: replace with SwingWorker [jv] new Thread(new Runnable() { public void run() { - remove(editor, + remove(base, pm, status, ContributionListing.getInstance()); @@ -391,7 +401,7 @@ public void run() { } - void remove(final Editor editor, + void remove(final Base base, final ContribProgressMonitor pm, final StatusPanel status, final ContributionListing contribListing) { @@ -409,7 +419,7 @@ void remove(final Editor editor, if (getType() == ContributionType.MODE) { boolean isModeActive = false; ModeContribution m = (ModeContribution) this; - Iterator iter = editor.getBase().getEditors().iterator(); + Iterator iter = base.getEditors().iterator(); while (iter.hasNext()) { Editor e = iter.next(); if (e.getMode().equals(m.getMode())) { @@ -418,7 +428,7 @@ void remove(final Editor editor, } } if (!isModeActive) { - m.clearClassLoader(editor.getBase()); + m.clearClassLoader(base); } else { pm.cancel(); Messages.showMessage("Mode Manager", @@ -429,6 +439,7 @@ void remove(final Editor editor, } if (getType() == ContributionType.TOOL) { + /* ToolContribution t = (ToolContribution) this; Iterator iter = editor.getBase().getEditors().iterator(); while (iter.hasNext()) { @@ -436,45 +447,88 @@ void remove(final Editor editor, ed.clearToolMenu(); } t.clearClassLoader(editor.getBase()); + */ + // menu will be rebuilt below with the refreshContribs() call + base.clearToolMenus(); + ((ToolContribution) this).clearClassLoader(); } if (doBackup) { - success = backup(editor, true, status); + success = backup(true, status); } else { - Util.removeDir(getFolder()); - success = !getFolder().exists(); + success = Util.removeDir(getFolder(), false); } if (success) { - if (getType() == ContributionType.TOOL) { - editor.removeTool(); - } - - Contribution advertisedVersion = contribListing - .getAvailableContribution(this); + // this was just rebuilding the tool menu in one editor, which happens + // yet again down below with the call to refreshInstalled() [fry 150828] +// if (getType() == ContributionType.TOOL) { +// editor.removeTool(); +// } - if (advertisedVersion == null) { - contribListing.removeContribution(this); - } else { - contribListing.replaceContribution(this, advertisedVersion); + try { + // TODO: run this in SwingWorker done() [jv] + EventQueue.invokeAndWait(new Runnable() { + @Override + public void run() { + Contribution advertisedVersion = + contribListing.getAvailableContribution(LocalContribution.this); + + if (advertisedVersion == null) { + contribListing.removeContribution(LocalContribution.this); + } else { + contribListing.replaceContribution(LocalContribution.this, advertisedVersion); + } + base.refreshContribs(LocalContribution.this.getType()); + base.setUpdatesAvailable(contribListing.countUpdates(base)); + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + Throwable cause = e.getCause(); + if (cause instanceof RuntimeException) { + throw (RuntimeException) cause; + } else { + cause.printStackTrace(); + } } - } - else { + + } else { // There was a failure backing up the folder - if (!doBackup || (doBackup && backup(editor, false, status))) { - if (setDeletionFlag(true)) { - contribListing.replaceContribution(this, this); + if (!doBackup || (doBackup && backup(false, status))) { + if (setDeletionFlag(true)) { + try { + // TODO: run this in SwingWorker done() [jv] + EventQueue.invokeAndWait(new Runnable() { + @Override + public void run() { + contribListing.replaceContribution(LocalContribution.this, + LocalContribution.this); + base.refreshContribs(LocalContribution.this.getType()); + base.setUpdatesAvailable(contribListing.countUpdates(base)); + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + Throwable cause = e.getCause(); + if (cause instanceof RuntimeException) { + throw (RuntimeException) cause; + } else { + cause.printStackTrace(); } } - else - status.setErrorMessage("Could not delete the contribution's files"); + } + } else { + status.setErrorMessage("Could not delete the contribution's files"); + } } -// } - ContributionManager.refreshInstalled(editor); - if (success) + if (success) { pm.finished(); - else + } else { pm.cancel(); + } } @@ -717,11 +771,4 @@ static protected String findClassInZipFile(String base, File file) { } return null; } - - - static protected class IgnorableException extends Exception { - public IgnorableException(String msg) { - super(msg); - } - } } diff --git a/app/src/processing/app/contrib/ManagerFrame.java b/app/src/processing/app/contrib/ManagerFrame.java new file mode 100644 index 0000000000..3e25531bf9 --- /dev/null +++ b/app/src/processing/app/contrib/ManagerFrame.java @@ -0,0 +1,232 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2013-15 The Processing Foundation + Copyright (c) 2011-12 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 version 2 + as published by the Free Software Foundation. + + 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.contrib; + +import java.awt.*; +import java.awt.event.*; + +import javax.swing.*; + +import processing.app.*; +import processing.app.ui.Editor; +import processing.app.ui.Toolkit; + + +/** + * This class is the main Contribution Manager Dialog. + * It contains all the contributions tab and the update tab. + */ +public class ManagerFrame { + static final String ANY_CATEGORY = Language.text("contrib.all"); + + static final int AUTHOR_WIDTH = Toolkit.zoom(240); + static final int STATUS_WIDTH = Toolkit.zoom(66); + + static final String title = "Contribution Manager"; + + Base base; + JFrame frame; + ManagerTabs tabs; + + ContributionTab librariesTab; + ContributionTab modesTab; + ContributionTab toolsTab; + ContributionTab examplesTab; + UpdateContributionTab updatesTab; + + static Font SMALL_PLAIN; + static Font SMALL_BOLD; + static Font NORMAL_PLAIN; + static Font NORMAL_BOLD; + + + public ManagerFrame(Base base) { + this.base = base; + + final int smallSize = Toolkit.zoom(12); + final int normalSize = Toolkit.zoom(14); + SMALL_PLAIN = Toolkit.getSansFont(smallSize, Font.PLAIN); + SMALL_BOLD = Toolkit.getSansFont(smallSize, Font.BOLD); + NORMAL_PLAIN = Toolkit.getSansFont(normalSize, Font.PLAIN); + NORMAL_BOLD = Toolkit.getSansFont(normalSize, Font.BOLD); + + librariesTab = new ContributionTab(this, ContributionType.LIBRARY); + modesTab = new ContributionTab(this, ContributionType.MODE); + toolsTab = new ContributionTab(this, ContributionType.TOOL); + examplesTab = new ContributionTab(this, ContributionType.EXAMPLES); + updatesTab = new UpdateContributionTab(this); + } + + + public void showFrame(ContributionType contributionType) { + ContributionTab showTab = getTab(contributionType); + if (frame == null) { + makeFrame(); + // done before as downloadAndUpdateContributionListing() + // requires the current selected tab + tabs.setPanel(showTab); + downloadAndUpdateContributionListing(base); + } else { + tabs.setPanel(showTab); + } + frame.setVisible(true); + // Avoid the search box taking focus and hiding the 'search' text + tabs.requestFocusInWindow(); + } + + + private void makeFrame() { + frame = new JFrame(title); + frame.setMinimumSize(Toolkit.zoom(750, 500)); + tabs = new ManagerTabs(base); + + makeAndShowTab(false, true); + + tabs.addPanel(librariesTab, "Libraries"); + tabs.addPanel(modesTab, "Modes"); + tabs.addPanel(toolsTab, "Tools"); + tabs.addPanel(examplesTab, "Examples"); + tabs.addPanel(updatesTab, "Updates"); + + frame.setResizable(true); + + Container c = frame.getContentPane(); + c.add(tabs); + c.setBackground(base.getDefaultMode().getColor("manager.tab.background")); + + frame.validate(); + frame.repaint(); + + Toolkit.setIcon(frame); + registerDisposeListeners(); + + frame.pack(); + frame.setLocationRelativeTo(null); + } + + + /** + * Close the window after an OK or Cancel. + */ + protected void disposeFrame() { + frame.dispose(); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + private void registerDisposeListeners() { + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + disposeFrame(); + } + }); + // handle window closing commands for ctrl/cmd-W or hitting ESC. + Toolkit.registerWindowCloseKeys(frame.getRootPane(), new ActionListener() { + public void actionPerformed(ActionEvent actionEvent) { + disposeFrame(); + } + }); + + frame.getContentPane().addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + //System.out.println(e); + KeyStroke wc = Toolkit.WINDOW_CLOSE_KEYSTROKE; + if ((e.getKeyCode() == KeyEvent.VK_ESCAPE) + || (KeyStroke.getKeyStrokeForEvent(e).equals(wc))) { + disposeFrame(); + } + } + }); + } + + + // TODO move this to ContributionTab (this is handled weirdly, period) [fry] + void downloadAndUpdateContributionListing(Base base) { + //activeTab is required now but should be removed + //as there is only one instance of contribListing and it should be present in this class + final ContributionTab activeTab = getActiveTab(); + + ContribProgressMonitor progress = + new ContribProgressBar(activeTab.progressBar) { + + @Override + public void startTask(String name, int maxValue) { + super.startTask(name, maxValue); + progressBar.setVisible(true); + progressBar.setString(null); + } + + @Override + public void setProgress(int value) { + super.setProgress(value); +// int percent = 100 * value / this.max; + progressBar.setValue(value); + } + + @Override + public void finishedAction() { + progressBar.setVisible(false); + activeTab.updateContributionListing(); + activeTab.updateCategoryChooser(); + + if (error) { + exception.printStackTrace(); + makeAndShowTab(true, false); + } else { + makeAndShowTab(false, false); + } + } + }; + activeTab.contribListing.downloadAvailableList(base, progress); + } + + + void makeAndShowTab(boolean error, boolean loading) { + Editor editor = base.getActiveEditor(); + librariesTab.showFrame(editor, error, loading); + modesTab.showFrame(editor, error, loading); + toolsTab.showFrame(editor, error, loading); + examplesTab.showFrame(editor, error, loading); + updatesTab.showFrame(editor, error, loading); + } + + + protected ContributionTab getTab(ContributionType contributionType) { + if (contributionType == ContributionType.LIBRARY) { + return librariesTab; + } else if (contributionType == ContributionType.MODE) { + return modesTab; + } else if (contributionType == ContributionType.TOOL) { + return toolsTab; + } else if (contributionType == ContributionType.EXAMPLES) { + return examplesTab; + } + return updatesTab; + } + + + ContributionTab getActiveTab() { + return (ContributionTab) tabs.getPanel(); + } +} diff --git a/app/src/processing/app/contrib/ManagerTabs.java b/app/src/processing/app/contrib/ManagerTabs.java new file mode 100644 index 0000000000..8cc1e5d331 --- /dev/null +++ b/app/src/processing/app/contrib/ManagerTabs.java @@ -0,0 +1,392 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2015 The Processing Foundation + + 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.contrib; + +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.*; +import javax.swing.border.EmptyBorder; + +import processing.app.Base; +import processing.app.Mode; +import processing.app.ui.Toolkit; + + +/** + * Console/error/whatever tabs at the bottom of the editor window. + */ +public class ManagerTabs extends Box { + // height of this tab bar + static final int HIGH = Toolkit.zoom(34); + + // amount of space around the entire window + static final int BORDER = Toolkit.zoom(8); + + static final int CURVE_RADIUS = Toolkit.zoom(6); + + static final int TAB_TOP = Toolkit.zoom(0); + static final int TAB_BOTTOM = HIGH - Toolkit.zoom(2); + // amount of extra space between individual tabs + static final int TAB_BETWEEN = Toolkit.zoom(2); + // amount of margin on the left/right for the text on the tab + static final int MARGIN = Toolkit.zoom(14); + + static final int ICON_WIDTH = Toolkit.zoom(16); + static final int ICON_HEIGHT = Toolkit.zoom(16); + static final int ICON_TOP = Toolkit.zoom(7); + static final int ICON_MARGIN = Toolkit.zoom(7); + + static final int UNSELECTED = 0; + static final int SELECTED = 1; + + Color[] textColor = new Color[2]; + Color[] tabColor = new Color[2]; + + List tabList = new ArrayList<>(); + + Mode mode; + + Font font; + int fontAscent; + + Image offscreen; + int sizeW, sizeH; + int imageW, imageH; + + Image gradient; + + JPanel cardPanel; + CardLayout cardLayout; + Controller controller; + + Component currentPanel; + + + public ManagerTabs(Base base) { + super(BoxLayout.Y_AXIS); + + // A mode shouldn't actually override these, they're coming from theme.txt. + // But use the default (Java) mode settings just in case. + mode = base.getDefaultMode(); + + textColor[SELECTED] = mode.getColor("manager.tab.text.selected.color"); + textColor[UNSELECTED] = mode.getColor("manager.tab.text.unselected.color"); + font = mode.getFont("manager.tab.text.font"); + + tabColor[SELECTED] = mode.getColor("manager.tab.selected.color"); + tabColor[UNSELECTED] = mode.getColor("manager.tab.unselected.color"); + + gradient = mode.makeGradient("manager.tab", Toolkit.zoom(400), HIGH); + + setBorder(new EmptyBorder(BORDER, BORDER, BORDER, BORDER)); + + controller = new Controller(); + add(controller); + + cardLayout = new CardLayout(); + cardPanel = new JPanel(cardLayout); + add(cardPanel); + } + + + /** Add a panel with no icon. */ + public void addPanel(Component comp, String name) { + addPanel(comp, name, null); + } + + + /** + * Add a panel with a name and icon. + * @param comp Component that will be shown when this tab is selected + * @param name Title to appear on the tab itself + * @param icon Prefix of the file name for the icon + */ + public void addPanel(Component comp, String name, String icon) { + if (tabList.isEmpty()) { + currentPanel = comp; + } + tabList.add(new Tab(comp, name, icon)); + cardPanel.add(name, comp); + } + + +// public void setPanel(int index) { +// cardLayout.show(cardPanel, tabs.get(index).name); +// } + + + public void setPanel(Component comp) { + for (Tab tab : tabList) { + if (tab.comp == comp) { + currentPanel = comp; + cardLayout.show(cardPanel, tab.name); + repaint(); + } + } + } + + + public Component getPanel() { + return currentPanel; + } + + + public void setNotification(Component comp, boolean note) { + for (Tab tab : tabList) { + if (tab.comp == comp) { + tab.notification = note; + repaint(); + } + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + class Controller extends JComponent { + + Controller() { + addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + int x = e.getX(); + for (Tab tab : tabList) { + if (tab.contains(x)) { + //cardLayout.show(cardPanel, tab.name); + setPanel(tab.comp); + repaint(); + } + } + } + }); + } + + public void paintComponent(Graphics screen) { + if (screen == 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 { + // if the image is larger than necessary, no need to change + sizeW = size.width; + sizeH = size.height; + } + } + + if (offscreen == null) { + sizeW = size.width; + sizeH = size.height; + imageW = sizeW; + imageH = sizeH; + offscreen = Toolkit.offscreenGraphics(this, imageW, imageH); + } + + Graphics g = offscreen.getGraphics(); + g.setFont(font); // need to set this each time through + if (fontAscent == 0) { + fontAscent = (int) Toolkit.getAscent(g); + } + + Graphics2D g2 = Toolkit.prepareGraphics(g); + + g.drawImage(gradient, 0, 0, imageW, imageH, this); + + g.setColor(tabColor[SELECTED]); + // draw the two pixel line that extends left/right below the tabs + // can't be done with lines, b/c retina leaves tiny hairlines + g.fillRect(0, TAB_BOTTOM, imageW, Toolkit.zoom(2)); + + // reset all tab positions + for (Tab tab : tabList) { + tab.textWidth = (int) + font.getStringBounds(tab.name, g2.getFontRenderContext()).getWidth(); + } + + placeTabs(0); + // now actually draw the tabs + drawTabs(g2); + + screen.drawImage(offscreen, 0, 0, imageW, imageH, null); + } + + + /** + * @param left starting position from the left + * @param g graphics context, or null if we're not drawing + */ + private void placeTabs(int left) { //, Graphics2D g) { + int x = left; + + for (Tab tab : tabList) { + tab.left = x; + x += MARGIN; + if (tab.hasIcon()) { + x += ICON_WIDTH + MARGIN; + } + x += tab.textWidth + MARGIN; + tab.right = x; + +// // if drawing and not just placing +// if (g != null) { +// tab.draw(g); +// } + x += TAB_BETWEEN; + } + // Align the final tab (the "updates") to the right-hand side + Tab lastTab = tabList.get(tabList.size() - 1); + int offset = getWidth() - lastTab.right; + lastTab.left += offset; + lastTab.right += offset; + } + + + private void drawTabs(Graphics2D g) { + for (Tab tab: tabList) { + tab.draw(g); + } + } + + + public Dimension getPreferredSize() { + return new Dimension(300, HIGH); + } + + + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + + public Dimension getMaximumSize() { + return new Dimension(super.getMaximumSize().width, HIGH); + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + class Tab { + String name; + Component comp; + boolean notification; + + Image enabledIcon; + Image selectedIcon; + + int left; + int right; + int textWidth; + + Tab(Component comp, String name, String icon) { + this.comp = comp; + this.name = name; + + if (icon != null) { + enabledIcon = mode.loadImageX(icon + "-enabled"); + selectedIcon = mode.loadImageX(icon + "-selected"); + if (selectedIcon == null) { + selectedIcon = enabledIcon; // use this as the default + } + } + } + + boolean contains(int x) { + return x >= left && x <= right; + } + + boolean isCurrent() { + return comp.isVisible(); + } + + boolean hasLeftNotch() { + return (tabList.get(0) == this || + tabList.get(tabList.size() - 1) == this); + } + + boolean hasRightNotch() { + return (tabList.get(tabList.size() - 1) == this || + tabList.get(tabList.size() - 2) == this); + + } + + int getTextLeft() { + int links = left; + if (enabledIcon != null) { + links += ICON_WIDTH + ICON_MARGIN; + } + return links + ((right - links) - textWidth) / 2; + } + + boolean hasIcon() { + return enabledIcon != null; + } + + void draw(Graphics g) { + int state = isCurrent() ? SELECTED : UNSELECTED; + g.setColor(tabColor[state]); + + Graphics2D g2 = (Graphics2D) g; +// g2.fill(Toolkit.createRoundRect(left, TAB_TOP, right, TAB_BOTTOM, 0, 0, +// isLast() ? CURVE_RADIUS : 0, +// hastLeftCurve() ? CURVE_RADIUS : 0)); + g2.fill(Toolkit.createRoundRect(left, TAB_TOP, + right, TAB_BOTTOM, + hasLeftNotch() ? CURVE_RADIUS : 0, + hasRightNotch() ? CURVE_RADIUS : 0, + 0, 0)); + + if (hasIcon()) { + Image icon = (isCurrent() || notification) ? selectedIcon : enabledIcon; + g.drawImage(icon, left + MARGIN, ICON_TOP, ICON_WIDTH, ICON_HEIGHT, null); + } + + int textLeft = getTextLeft(); + if (notification && state == UNSELECTED) { + g.setColor(textColor[SELECTED]); + } else { + g.setColor(textColor[state]); + } + int tabHeight = TAB_BOTTOM - TAB_TOP; + int baseline = TAB_TOP + (tabHeight + fontAscent) / 2; + g.drawString(name, textLeft, baseline); + } + } +} diff --git a/app/src/processing/app/contrib/ModeContribution.java b/app/src/processing/app/contrib/ModeContribution.java index 9d9196c8ed..0005de2478 100644 --- a/app/src/processing/app/contrib/ModeContribution.java +++ b/app/src/processing/app/contrib/ModeContribution.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013 The Processing Foundation + Copyright (c) 2013-15 The Processing Foundation Copyright (c) 2011-12 Ben Fry and Casey Reas This program is free software; you can redistribute it and/or modify @@ -24,13 +24,11 @@ import java.io.File; import java.io.IOException; import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Map; import processing.app.Base; import processing.app.Messages; @@ -82,7 +80,7 @@ static public ModeContribution load(Base base, File folder, * @param className name of class and full package, or null to use default * @throws Exception */ - private ModeContribution(Base base, File folder, + public ModeContribution(Base base, File folder, String className) throws Exception { super(folder); className = initLoader(base, className); @@ -106,14 +104,14 @@ private ModeContribution(Base base, File folder, public void clearClassLoader(Base base) { List contribModes = base.getModeContribs(); int botherToRemove = contribModes.indexOf(this); - if (botherToRemove != -1) { // The poor thing isn't even loaded, and we're trying to remove it... + // The poor thing isn't even loaded, and we're trying to remove it... + if (botherToRemove != -1) { contribModes.remove(botherToRemove); try { + // This cast should be safe, since the only case when loader is not a + // URLClassLoader is when no archives were found in the first place. ((URLClassLoader) loader).close(); - // The typecast should be safe, since the only case when loader is not of - // type URLClassLoader is when no archives were found in the first - // place... } catch (IOException e) { e.printStackTrace(); } @@ -121,53 +119,6 @@ public void clearClassLoader(Base base) { } - static public void loadMissing(Base base) { - File modesFolder = Base.getSketchbookModesFolder(); - List contribModes = base.getModeContribs(); - - Map existing = new HashMap(); - for (ModeContribution contrib : contribModes) { - existing.put(contrib.getFolder(), contrib); - } - File[] potential = ContributionType.MODE.listCandidates(modesFolder); - // If modesFolder does not exist or is inaccessible (folks might like to - // mess with folders then report it as a bug) 'potential' will be null. - if (potential != null) { - for (File folder : potential) { - if (!existing.containsKey(folder)) { - try { - contribModes.add(new ModeContribution(base, folder, null)); - } catch (NoSuchMethodError nsme) { - System.err.println(folder.getName() + " is not compatible with this version of Processing"); - } catch (NoClassDefFoundError ncdfe) { - System.err.println(folder.getName() + " is not compatible with this version of Processing"); - } catch (InvocationTargetException ite) { - System.err.println(folder.getName() + " could not be loaded and may not compatible with this version of Processing"); -// Throwable cause = ite.getCause(); -// if (cause != null) { -// } - } catch (IgnorableException ig) { - Messages.log(ig.getMessage()); - } catch (Throwable e) { - e.printStackTrace(); - } - } - } - } - - // This allows you to build and test your Mode code from Eclipse. - // -Dusemode=com.foo.FrobMode:/path/to/FrobMode - final String useMode = System.getProperty("usemode"); - if (useMode != null) { - final String[] modeInfo = useMode.split(":", 2); - final String modeClass = modeInfo[0]; - final String modeResourcePath = modeInfo[1]; - System.out.println("Attempting to load " + modeClass + " with resources at " + modeResourcePath); - contribModes.add(ModeContribution.load(base, new File(modeResourcePath), modeClass)); - } - } - - public Mode getMode() { return mode; } @@ -178,19 +129,10 @@ public ContributionType getType() { } - public boolean equals(Object o) { - if (o == null || !(o instanceof ModeContribution)) { - return false; - } - ModeContribution other = (ModeContribution) o; - return loader.equals(other.loader) && mode.equals(other.getMode()); - } - public String initLoader(Base base, String className) throws Exception { - File modeDirectory = new File(folder, getTypeName()); if (modeDirectory.exists()) { - Messages.log("checking mode folder regarding " + className); + Messages.log("checking mode folder regarding class name " + className); // If no class name specified, search the main .jar for the // full name package and mode name. if (className == null) { @@ -210,8 +152,8 @@ public String initLoader(Base base, String className) throws Exception { ArrayList extraUrls = new ArrayList<>(); if (imports != null && imports.size() > 0) { - // if the mode has any dependencies (defined as imports in mode.properties), - // add the dependencies to the classloader + // if the mode has any dependencies (defined as imports in + // mode.properties), add the dependencies to the classloader HashMap installedModes = new HashMap<>(); for(Mode m: base.getModeList()){ @@ -219,7 +161,7 @@ public String initLoader(Base base, String className) throws Exception { installedModes.put(m.getClass().getName(), m); } - for(String modeImport: imports){ + for (String modeImport: imports) { if (installedModes.containsKey(modeImport)) { Messages.log("Found mode dependency " + modeImport); File modeFolder = installedModes.get(modeImport).getFolder(); @@ -231,8 +173,9 @@ public String initLoader(Base base, String className) throws Exception { } } } else { - throw new IgnorableException("Dependency mode "+ modeImport + " could not be" - + " found. Can't load " + className); + throw new IgnorableException("Can't load " + className + + " because the import " + modeImport + + " could not be found. "); } } } @@ -267,14 +210,4 @@ public String initLoader(Base base, String className) throws Exception { } return className; } - - -// static protected List discover(File folder) { -// File[] folders = listCandidates(folder, "mode"); -// if (folders == null) { -// return new ArrayList(); -// } else { -// return Arrays.asList(folders); -// } -// } -} \ No newline at end of file +} diff --git a/app/src/processing/app/contrib/StatusPanel.java b/app/src/processing/app/contrib/StatusPanel.java index d20989196d..4c25c5ec1e 100644 --- a/app/src/processing/app/contrib/StatusPanel.java +++ b/app/src/processing/app/contrib/StatusPanel.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013-15 The Processing Foundation + Copyright (c) 2013-16 The Processing Foundation Copyright (c) 2011-12 Ben Fry and Casey Reas This program is free software; you can redistribute it and/or modify @@ -29,7 +29,6 @@ import javax.swing.GroupLayout; import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; @@ -44,12 +43,19 @@ import processing.app.Base; import processing.app.Platform; + class StatusPanel extends JPanel { - static final int BUTTON_WIDTH = 150; + static final int BUTTON_WIDTH = Toolkit.zoom(150); + + static Icon foundationIcon; + static Icon installIcon; + static Icon updateIcon; + static Icon removeIcon; + static Font buttonFont; JTextPane label; JButton installButton; - JPanel progressBarPanel; + JPanel progressPanel; JLabel updateLabel; JButton updateButton; JButton removeButton; @@ -60,20 +66,33 @@ class StatusPanel extends JPanel { private String bodyRule; - public StatusPanel(int width, final ContributionTab contributionTab) { - super(); - setBackground(new Color(0xebebeb)); -// setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, Color.BLACK)); + + /** Needed by ContributionListPanel */ + public StatusPanel() { } + + + public StatusPanel(final ContributionTab contributionTab, int width) { this.contributionTab = contributionTab; + if (foundationIcon == null) { + foundationIcon = Toolkit.getLibIconX("icons/foundation", 32); + installIcon = Toolkit.getLibIconX("manager/install"); + updateIcon = Toolkit.getLibIconX("manager/update"); + removeIcon = Toolkit.getLibIconX("manager/remove"); + buttonFont = ManagerFrame.NORMAL_PLAIN; + } + + setBackground(new Color(0xebebeb)); + iconLabel = new JLabel(); + iconLabel.setHorizontalAlignment(SwingConstants.CENTER); label = new JTextPane(); label.setEditable(false); label.setOpaque(false); label.setContentType("text/html"); - bodyRule = "body { font-family: " + ContributionManagerDialog.myFont.getFamily() + "; " + - "font-size: " + ContributionManagerDialog.myFont.getSize() + "pt; }"; + bodyRule = "a, body { font-family: " + buttonFont.getFamily() + "; " + + "font-size: " + buttonFont.getSize() + "pt; color: black; text-decoration: none;}"; label.addHyperlinkListener(new HyperlinkListener() { @Override @@ -85,63 +104,56 @@ public void hyperlinkUpdate(HyperlinkEvent e) { } } }); - installButton = new JButton("Install", - Toolkit.getLibIcon("manager/install.png")); - installButton.setFont(Toolkit.getSansFont(14, Font.PLAIN)); + installButton = Toolkit.createIconButton("Install", installIcon); + //installButton.setDisabledIcon(installIcon); + installButton.setFont(buttonFont); installButton.setHorizontalAlignment(SwingConstants.LEFT); -// installButton.setContentAreaFilled(false); -// installButton.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK, 1),BorderFactory.createEmptyBorder(3, 0, 3, 0))); installButton.addActionListener(new ActionListener() { - @Override public void actionPerformed(ActionEvent e) { - ContributionPanel currentPanel = contributionTab.contributionListPanel - .getSelectedPanel(); + installButton.setEnabled(false); + DetailPanel currentPanel = + contributionTab.contributionListPanel.getSelectedPanel(); currentPanel.install(); StatusPanel.this.update(currentPanel); } }); - progressBarPanel = new JPanel(); - progressBarPanel.setLayout(new BorderLayout()); - progressBarPanel.setOpaque(false); + progressPanel = new JPanel(); + progressPanel.setLayout(new BorderLayout()); + progressPanel.setOpaque(false); + updateLabel = new JLabel(" "); - updateLabel.setFont(Toolkit.getSansFont(14, Font.PLAIN)); - updateButton = new JButton("Update", - Toolkit.getLibIcon("manager/update.png")); - updateButton.setFont(Toolkit.getSansFont(14, Font.PLAIN)); + updateLabel.setFont(buttonFont); + updateLabel.setHorizontalAlignment(SwingConstants.CENTER); + + updateButton = Toolkit.createIconButton("Update", updateIcon); + updateButton.setFont(buttonFont); updateButton.setHorizontalAlignment(SwingConstants.LEFT); -// updateButton.setAlignmentX(SwingConstants.LEFT); -// updateButton.setContentAreaFilled(false); -// updateButton.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK, 1),BorderFactory.createEmptyBorder(3, 0, 3, 0))); updateButton.addActionListener(new ActionListener() { - - @Override public void actionPerformed(ActionEvent e) { - ContributionPanel currentPanel = contributionTab.contributionListPanel - .getSelectedPanel(); + updateButton.setEnabled(false); + DetailPanel currentPanel = + contributionTab.contributionListPanel.getSelectedPanel(); currentPanel.update(); StatusPanel.this.update(currentPanel); } }); - removeButton = new JButton("Remove", - Toolkit.getLibIcon("manager/remove.png")); - removeButton.setFont(Toolkit.getSansFont(14, Font.BOLD)); + removeButton = Toolkit.createIconButton("Remove", removeIcon); + removeButton.setFont(buttonFont); removeButton.setHorizontalAlignment(SwingConstants.LEFT); -// removeButton.setContentAreaFilled(false); -// removeButton.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK, 1),BorderFactory.createEmptyBorder(3, 0, 3, 0))); removeButton.addActionListener(new ActionListener() { - - @Override public void actionPerformed(ActionEvent e) { - ContributionPanel currentPanel = contributionTab.contributionListPanel - .getSelectedPanel(); + removeButton.setEnabled(false); + DetailPanel currentPanel = + contributionTab.contributionListPanel.getSelectedPanel(); currentPanel.remove(); StatusPanel.this.update(currentPanel); } }); - int labelWidth = width != 0 ? width * 3 / 4 : GroupLayout.PREFERRED_SIZE; + int labelWidth = (width != 0) ? + (3 * width / 4) : GroupLayout.PREFERRED_SIZE; layout = new GroupLayout(this); this.setLayout(layout); @@ -150,49 +162,53 @@ public void actionPerformed(ActionEvent e) { layout.setHorizontalGroup(layout .createSequentialGroup() - .addComponent(iconLabel, 50, 50, 50) + .addGap(0) + .addComponent(iconLabel, + ManagerFrame.STATUS_WIDTH, + ManagerFrame.STATUS_WIDTH, + ManagerFrame.STATUS_WIDTH) .addGap(0) .addComponent(label, labelWidth, labelWidth, labelWidth) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) - .addGroup(layout - .createParallelGroup(GroupLayout.Alignment.CENTER) - .addComponent(installButton, BUTTON_WIDTH, BUTTON_WIDTH, - BUTTON_WIDTH).addComponent(progressBarPanel) - .addComponent(updateLabel).addComponent(updateButton) - .addComponent(removeButton))); + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) + .addComponent(installButton, + BUTTON_WIDTH, BUTTON_WIDTH, BUTTON_WIDTH) + .addComponent(progressPanel) + .addComponent(updateLabel, + BUTTON_WIDTH, BUTTON_WIDTH, BUTTON_WIDTH) + .addComponent(updateButton) + .addComponent(removeButton)) + .addGap(12)); // make buttons line up relative to the scrollbar layout.setVerticalGroup(layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(iconLabel) .addComponent(label) - .addGroup(layout - .createSequentialGroup() + .addGroup(layout.createSequentialGroup() .addComponent(installButton) .addGroup(layout.createParallelGroup() - .addComponent(progressBarPanel) + .addComponent(progressPanel) .addComponent(updateLabel)) .addComponent(updateButton).addComponent(removeButton))); - layout.linkSize(SwingConstants.HORIZONTAL, installButton, progressBarPanel, - updateButton, removeButton); + layout.linkSize(SwingConstants.HORIZONTAL, + installButton, progressPanel, updateButton, removeButton); - progressBarPanel.setVisible(false); + progressPanel.setVisible(false); updateLabel.setVisible(false); installButton.setEnabled(false); updateButton.setEnabled(false); removeButton.setEnabled(false); + updateLabel.setVisible(true); - layout.setHonorsVisibility(updateLabel, false); // Makes the label take up space even though not visible + // Makes the label take up space even though not visible + layout.setHonorsVisibility(updateLabel, false); validate(); - } - public StatusPanel() { - // TODO Auto-generated constructor stub - } void setMessage(String message) { if (label != null) { @@ -201,6 +217,7 @@ void setMessage(String message) { } } + void setErrorMessage(String message) { if (label != null) { label.setText(message); @@ -208,44 +225,62 @@ void setErrorMessage(String message) { } } - void clear() { + + void clearMessage() { if (label != null) { label.setText(null); label.repaint(); } } - public void update(ContributionPanel panel) { - progressBarPanel.removeAll(); + public void update(DetailPanel panel) { + progressPanel.removeAll(); - if (panel.getContrib().isSpecial()) { - Icon contribIcon = new ImageIcon(Toolkit.getLibImage("/icons/pde-48.png")); - iconLabel.setIcon(contribIcon); - } else { - iconLabel.setIcon(null); - } - label.setText(panel.description.toString()); + iconLabel.setIcon(panel.getContrib().isSpecial() ? foundationIcon : null); + label.setText(panel.description); ((HTMLDocument)label.getDocument()).getStyleSheet().addRule(bodyRule); - updateButton.setEnabled(contributionListing.hasDownloadedLatestList() - && (contributionListing.hasUpdates(panel.getContrib()) && !panel - .getContrib().isUpdateFlagged())); + updateButton.setEnabled(contributionListing.hasDownloadedLatestList() && + (contributionListing.hasUpdates(panel.getContrib()) && + !panel.getContrib().isUpdateFlagged()) && + !panel.updateInProgress); - String latestVersion = contributionListing.getLatestVersion(panel - .getContrib()); + String latestVersion = + contributionListing.getLatestPrettyVersion(panel.getContrib()); String currentVersion = panel.getContrib().getPrettyVersion(); - if (latestVersion != null) { - latestVersion = "Update to " + latestVersion; + installButton.setEnabled(!panel.getContrib().isInstalled() && + contributionListing.hasDownloadedLatestList() && + panel.getContrib().isCompatible(Base.getRevision()) && + !panel.installInProgress); + + if (panel.getContrib().isCompatible(Base.getRevision())) { + if (installButton.isEnabled()) { + if (latestVersion != null) { + updateLabel.setText(latestVersion + " available"); + } else { + updateLabel.setText("Available"); + } + } else { + if (currentVersion != null) { + updateLabel.setText(currentVersion + " installed"); + } else { + updateLabel.setText("Installed"); + } + } } else { - latestVersion = "Update"; + if (currentVersion != null) { + updateLabel.setText(currentVersion + " not compatible"); + } else { + updateLabel.setText("Not compatible"); + } } - if (currentVersion != null) { - currentVersion = "Version " + currentVersion; + if (latestVersion != null) { + latestVersion = "Update to " + latestVersion; } else { - currentVersion = ""; + latestVersion = "Update"; } if (updateButton.isEnabled()) { @@ -254,79 +289,14 @@ public void update(ContributionPanel panel) { updateButton.setText("Update"); } - installButton.setEnabled(!panel.getContrib().isInstalled() - && contributionListing.hasDownloadedLatestList() - && panel.getContrib().isCompatible(Base.getRevision())); - - if (installButton.isEnabled()) { - updateLabel.setText(currentVersion + " available"); - } else { - updateLabel.setText(currentVersion + " installed"); - } - - removeButton.setEnabled(panel.getContrib().isInstalled()); - progressBarPanel.add(panel.installProgressBar); - if (panel.installProgressBar.isEnabled()) { - progressBarPanel.setVisible(true); + removeButton.setEnabled(panel.getContrib().isInstalled() && !panel.removeInProgress); + progressPanel.add(panel.installProgressBar); + progressPanel.setVisible(false); + updateLabel.setVisible(true); + if (panel.updateInProgress || panel.installInProgress || panel.removeInProgress) { + progressPanel.setVisible(true); updateLabel.setVisible(false); - progressBarPanel.repaint(); - } - } -} -/* -interface ErrorWidget { - void setErrorMessage(String msg); -} - -class StatusPanel extends JPanel implements ErrorWidget { - String errorMessage; - - StatusPanel() { - addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { - clearErrorMessage(); - } - }); - } - - @Override - protected void paintComponent(Graphics g) { - super.paintComponent(g); - - g.setFont(new Font("SansSerif", Font.PLAIN, 10)); - int baseline = (getSize().height + g.getFontMetrics().getAscent()) / 2; - - if (contribListing.isDownloadingListing()) { - g.setColor(Color.black); - g.drawString("Downloading software listing...", 2, baseline); - setVisible(true); - } else if (errorMessage != null) { - g.setColor(Color.red); - g.drawString(errorMessage, 2, baseline); - setVisible(true); - } else { - setVisible(false); + progressPanel.repaint(); } } - - public void setErrorMessage(String message) { - errorMessage = message; - setVisible(true); - - JPanel placeholder = getPlaceholder(); - Dimension d = getPreferredSize(); - if (Base.isWindows()) { - d.height += 5; - placeholder.setPreferredSize(d); - } - placeholder.setVisible(true); - } - - void clearErrorMessage() { - errorMessage = null; - repaint(); - - getPlaceholder().setVisible(false); - } } -*/ \ No newline at end of file diff --git a/app/src/processing/app/contrib/ToolContribution.java b/app/src/processing/app/contrib/ToolContribution.java index 5335c0a416..a9afc7f291 100644 --- a/app/src/processing/app/contrib/ToolContribution.java +++ b/app/src/processing/app/contrib/ToolContribution.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013 The Processing Foundation + Copyright (c) 2013-15 The Processing Foundation Copyright (c) 2011-12 Ben Fry and Casey Reas This program is free software; you can redistribute it and/or modify @@ -19,21 +19,19 @@ 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.contrib; import java.io.*; import java.net.URLClassLoader; -//import java.net.*; import java.util.*; import processing.app.Base; import processing.app.Messages; -//import processing.app.Base; import processing.app.tools.Tool; -import processing.app.ui.Editor; -public class ToolContribution extends LocalContribution implements Tool { +public class ToolContribution extends LocalContribution implements Tool, Comparable { private Tool tool; private File referenceFile; // shortname/reference/index.html @@ -65,7 +63,7 @@ private ToolContribution(File folder) throws Throwable { String className = initLoader(null); if (className != null) { Class toolClass = loader.loadClass(className); - tool = (Tool) toolClass.newInstance(); + tool = (Tool) toolClass.getDeclaredConstructor().newInstance(); } referenceFile = new File(folder, "reference/index.html"); @@ -73,31 +71,15 @@ private ToolContribution(File folder) throws Throwable { /** - * Method to close the ClassLoader so that the archives are no longer "locked" and - * a tool can be removed without restart. + * Method to close the ClassLoader so that the archives are no longer + * "locked" and a tool can be removed without restart. */ - public void clearClassLoader(Base base) { + public void clearClassLoader() { try { ((URLClassLoader) this.loader).close(); } catch (IOException e1) { e1.printStackTrace(); } - Iterator editorIter = base.getEditors().iterator(); - while (editorIter.hasNext()) { - Editor editor = editorIter.next(); - List contribTools = editor.getToolContribs(); - for (ToolContribution toolContrib : contribTools) - if (toolContrib.getName().equals(this.name)) { - try { - ((URLClassLoader) toolContrib.loader).close(); - editor.removeToolContrib(toolContrib); - break; - } catch (IOException e) { - e.printStackTrace(); - } -// base.getActiveEditor().rebuildToolMenu(); - } - } } @@ -113,7 +95,7 @@ public void clearClassLoader(Base base) { static public List loadAll(File toolsFolder) { File[] list = ContributionType.TOOL.listCandidates(toolsFolder); - ArrayList outgoing = new ArrayList(); + ArrayList outgoing = new ArrayList<>(); // If toolsFolder does not exist or is inaccessible (stranger things have // happened, and are reported as bugs) list will come back null. if (list != null) { @@ -128,30 +110,18 @@ static public List loadAll(File toolsFolder) { } } } + Collections.sort(outgoing); return outgoing; } -// Editor editor; // used to send error messages - - public void init(Editor editor) { -// try { -// this.editor = editor; - tool.init(editor); -// } catch (NoSuchMethodError nsme) { -// editor.statusError(tool.getMenuTitle() + " is not compatible with this version of Processing"); -// nsme.printStackTrace(); -// } + public void init(Base base) { + tool.init(base); } public void run() { -// try { tool.run(); -// } catch (NoSuchMethodError nsme) { -// editor.statusError(tool.getMenuTitle() + " is not compatible with this version of Processing"); -// nsme.printStackTrace(); -// } } @@ -185,4 +155,10 @@ public File getReferenceIndexFile() { public boolean hasReference() { return referenceFile.exists(); } + + + @Override + public int compareTo(ToolContribution o) { + return getMenuTitle().compareTo(o.getMenuTitle()); + } } diff --git a/app/src/processing/app/contrib/UpdateContributionTab.java b/app/src/processing/app/contrib/UpdateContributionTab.java index a1791a8602..a3de07f389 100644 --- a/app/src/processing/app/contrib/UpdateContributionTab.java +++ b/app/src/processing/app/contrib/UpdateContributionTab.java @@ -1,69 +1,58 @@ package processing.app.contrib; import java.awt.Color; -import java.awt.Component; -import java.awt.Font; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Comparator; -import java.util.Set; -import java.util.TreeMap; -import javax.swing.BorderFactory; import javax.swing.GroupLayout; -import javax.swing.Icon; -import javax.swing.JButton; -import javax.swing.JComponent; import javax.swing.JLabel; -import javax.swing.JPanel; import javax.swing.JProgressBar; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.LayoutStyle; -import javax.swing.ListSelectionModel; -import javax.swing.SwingConstants; -import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.JTableHeader; -import javax.swing.table.TableCellRenderer; -import processing.app.Base; -import processing.app.ui.Editor; import processing.app.ui.Toolkit; public class UpdateContributionTab extends ContributionTab { - public UpdateContributionTab(ContributionType type,ContributionManagerDialog contributionManagerDialog) { + public UpdateContributionTab(ManagerFrame dialog) { super(); - filter = ContributionType.createUpdateFilter(); - contributionListPanel = new UpdateContribListingPanel(this, filter); - statusPanel = new UpdateStatusPanel(650, this); - this.contributionType = type; - this.contributionManagerDialog = contributionManagerDialog; + this.contribDialog = dialog; + + filter = contrib -> { + if (contrib instanceof ListPanel.SectionHeaderContribution) { + return true; + } + if (contrib instanceof LocalContribution) { + return ContributionListing.getInstance().hasUpdates(contrib); + } + return false; + }; + contributionListPanel = new UpdateListPanel(this, filter); +// contributionListPanel.setBorder(new EmptyBorder(8, 8, 8, 8)); + + statusPanel = new UpdateStatusPanel(this, 650); contribListing = ContributionListing.getInstance(); - contribListing.addContributionListener(contributionListPanel); + contribListing.addListener(contributionListPanel); } + @Override - public void setLayout(Editor editor, boolean activateErrorPanel, - boolean isLoading) { - if (panel == null) { + protected void setLayout(boolean error, boolean loading) { + if (progressBar == null) { progressBar = new JProgressBar(); progressBar.setVisible(false); + buildErrorPanel(); - panel = new JPanel(false); - loaderLabel = new JLabel(Toolkit.getLibIcon("icons/loader.gif")); + + loaderLabel = new JLabel(Toolkit.getLibIcon("manager/loader.gif")); loaderLabel.setOpaque(false); - loaderLabel.setBackground(Color.WHITE); +// loaderLabel.setBackground(Color.WHITE); } - GroupLayout layout = new GroupLayout(panel); - panel.setLayout(layout); + GroupLayout layout = new GroupLayout(this); + setLayout(layout); layout.setHorizontalGroup(layout .createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(loaderLabel) - .addComponent(contributionListPanel).addComponent(errorPanel) + .addComponent(contributionListPanel) + .addComponent(errorPanel) .addComponent(statusPanel)); layout.setVerticalGroup(layout @@ -76,274 +65,11 @@ public void setLayout(Editor editor, boolean activateErrorPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); layout.setHonorsVisibility(contributionListPanel, false); - panel.setBackground(Color.WHITE); -// panel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2)); - - } - - public class UpdateContribListingPanel extends ContributionListPanel { - - public UpdateContribListingPanel(ContributionTab contributionTab, - ContributionFilter filter) { - super.contributionTab = contributionTab; - super.filter = filter; - setOpaque(true); - setBackground(Color.WHITE); - -// statusPlaceholder = new JPanel(); -// statusPlaceholder.setVisible(false); -// status = new StatusPanel(null); - - String[] colName = { "", "Name", "Author", "Installed", "Update To" }; - dtm = new MyTableModel(){ - @Override - public Class getColumnClass(int columnIndex) { - if (columnIndex == 0) { - return Icon.class; - } - return String.class; - } - }; - dtm.setColumnIdentifiers(colName); - table = new JTable(dtm){ - @Override - public Component prepareRenderer( - TableCellRenderer renderer, int row, int column) { - Component c = super.prepareRenderer(renderer, row, column); - String title = (String) getValueAt(row, 1); - if (title.equals("Library") || title.equals("Tools") - || title.equals("Modes") || title.equals("Examples")) { - ((JComponent) c).setBorder(BorderFactory - .createMatteBorder(row == 0 ? 0 : 2, 0, 2, 0, Color.BLACK)); - } - return c; - } - @Override - public void changeSelection(int rowIndex, int columnIndex, - boolean toggle, boolean extend) { - String title = (String) getValueAt(rowIndex, 1); - if(title.equals("Library") || title.equals("Tools") - || title.equals("Modes") || title.equals("Examples")){ - return; - } - super.changeSelection(rowIndex, columnIndex, toggle, extend); - } -// @Override -// public boolean isRowSelected(int row) { -// if (row == 0) { -// return false; -// } -// return super.isRowSelected(row); -// } - }; - JScrollPane scrollPane = new JScrollPane(table); - table.setFillsViewportHeight(true); - table.setSelectionBackground(new Color(0xe0fffd)); - table.setSelectionForeground(table.getForeground()); - table.setFont(Toolkit.getSansFont(14, Font.PLAIN)); - table.setRowHeight(30); - table.setRowMargin(6); - table.getColumnModel().setColumnMargin(-1); - table.getColumnModel().getColumn(0).setMaxWidth(60); - table.setShowGrid(false); - table.setCellSelectionEnabled(false); - table.setRowSelectionAllowed(true); - table.setAutoCreateColumnsFromModel(true); - table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - table.setDefaultRenderer(String.class, new StatusRendere()); - table.getTableHeader().setDefaultRenderer(new MyColumnHeaderRenderer() { - @Override - public Component getTableCellRendererComponent(JTable table, - Object value, - boolean isSelected, - boolean hasFocus, int row, - int column) { - super.getTableCellRendererComponent(table, value, isSelected, hasFocus, - row, column); - JTableHeader tableHeader = table.getTableHeader(); - if (tableHeader != null) { - setForeground(tableHeader.getForeground()); - } - setIcon(getIcon(table, column)); - setBackground(new Color(0xebebeb)); -// setBorder(BorderFactory.createMatteBorder(2, 0, 2, 0, Color.BLACK)); - return this; - } - }); - - - GroupLayout layout = new GroupLayout(this); - layout.setHorizontalGroup(layout.createParallelGroup().addComponent(scrollPane)); - layout.setVerticalGroup(layout.createSequentialGroup().addComponent(scrollPane)); - - this.setLayout(layout); - table.setVisible(true); - - panelByContribution = new TreeMap(new Comparator() { - - @Override - public int compare(Contribution o1, Contribution o2) { - int val1 = 0; - int val2 = 0; - switch(o1.getType()){ - case LIBRARY: val1 = 1; - break; - case TOOL: val1 = 2; - break; - case MODE: val1 = 3; - break; - case EXAMPLES: val1 = 4; - break; - } - switch(o2.getType()){ - case LIBRARY: val2 = 1; - break; - case TOOL: val2 = 2; - break; - case MODE: val2 = 3; - break; - case EXAMPLES: val2 = 4; - break; - } - if(val1 == val2){ - return o1.getName().toLowerCase().compareTo(o2.getName().toLowerCase()); - } - return val1 - val2; - } - }); - - } - - class StatusRendere extends DefaultTableCellRenderer { - @Override - public Component getTableCellRendererComponent(JTable table, - Object value, - boolean isSelected, - boolean hasFocus, int row, - int column) { - return super.getTableCellRendererComponent(table, value, isSelected, false, - row, column); - } - } - // -// @Override -// public void contributionAdded(Contribution contribution) { -// if(filter.matches(contribution)){ -// super.contributionAdded(contribution); -// } -// } - // - @Override - void updatePanelOrdering(Set contributionsSet) { - if(getNoOfRows() == 0){ - contributionTab.contributionManagerDialog.numberLabel.setVisible(false); - }else{ - contributionTab.contributionManagerDialog.numberLabel.setText(Integer - .toString(panelByContribution.size())); - contributionTab.contributionManagerDialog.numberLabel.setVisible(true); - } - dtm.getDataVector().removeAllElements(); - dtm.fireTableDataChanged(); - ContributionType temp = null; - for (Contribution entry : contributionsSet) { - if(entry.getType() != temp){ - temp = entry.getType(); - dtm.addRow(new Object[] { null, "" + temp.getTitle() + "", null, null, null }); - } - //TODO Make this into a function - StringBuilder name = new StringBuilder(""); - String authorList = entry.getAuthorList(); - if (authorList != null) { - for (int i = 0; i < authorList.length(); i++) { - - if (authorList.charAt(i) == '[' || authorList.charAt(i) == ']') { - continue; - } - if (authorList.charAt(i) == '(') { - i++; - while (authorList.charAt(i) != ')') { - i++; - } - } else { - name.append(authorList.charAt(i)); - } - } - } - Icon icon = null; - if (entry.isInstalled()) { - icon = Toolkit.getLibIcon("manager/up-to-date.png"); - if (contribListing.hasUpdates(entry)) { - icon = Toolkit.getLibIcon("manager/update-available.png"); - } - if (!entry.isCompatible(Base.getRevision())) { - icon = Toolkit.getLibIcon("manager/incompatible.png"); - } - } - dtm - .addRow(new Object[] { - icon, "" + entry.getName() + "", name, entry.getPrettyVersion(), - contributionTab.contribListing.getLatestVersion(entry) }); - } - } - private class MyTableModel extends DefaultTableModel{ - MyTableModel() { - super(0,0); - } - @Override - public boolean isCellEditable(int row, int column) { - return false; - } - @Override - public Class getColumnClass(int columnIndex) { - if(columnIndex == 0){ - return Icon.class; - } - return super.getColumnClass(columnIndex); - } - } + setBackground(Color.WHITE); } - public class UpdateStatusPanel extends StatusPanel { - public UpdateStatusPanel(int width, final ContributionTab contributionTab) { - super(); - updateButton = new JButton("Update All", Toolkit.getLibIcon("manager/update.png")); - updateButton.setFont(Toolkit.getSansFont(14, Font.PLAIN)); - updateButton.setHorizontalAlignment(SwingConstants.LEFT); -// updateButton.setContentAreaFilled(false); -// updateButton.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK, 1),BorderFactory.createEmptyBorder(3, 0, 3, 0))); - updateButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub - for(ContributionPanel contributionPanel : contributionTab.contributionListPanel.panelByContribution.values()){ - contributionPanel.update(); - } - } - }); - this.setBackground(new Color(0xe0fffd)); -// this.setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, Color.BLACK)); - layout = new GroupLayout(this); - this.setLayout(layout); - layout.setAutoCreateContainerGaps(true); - layout.setAutoCreateGaps(true); - - layout.setHorizontalGroup(layout - .createSequentialGroup() - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, - GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) - .addComponent(updateButton, BUTTON_WIDTH, BUTTON_WIDTH, BUTTON_WIDTH)); - layout.setVerticalGroup(layout.createParallelGroup() - .addComponent(updateButton)); - updateButton.setVisible(true); - } - - @Override - public void update(ContributionPanel panel) { - if (contributionListPanel.getNoOfRows() > 0) { - updateButton.setEnabled(true); - } else { - updateButton.setEnabled(false); - } - } + @Override + public void updateStatusPanel(DetailPanel contributionPanel) { + // Do nothing } } diff --git a/app/src/processing/app/contrib/UpdateListPanel.java b/app/src/processing/app/contrib/UpdateListPanel.java new file mode 100644 index 0000000000..6ade2e439a --- /dev/null +++ b/app/src/processing/app/contrib/UpdateListPanel.java @@ -0,0 +1,50 @@ +package processing.app.contrib; + +public class UpdateListPanel extends ListPanel { + + Contribution.Filter contribFilter; + + public UpdateListPanel(ContributionTab contributionTab, + Contribution.Filter contribFilter) { + super(contributionTab, contribFilter, true, + ContributionColumn.STATUS_NO_HEADER, + ContributionColumn.NAME, + ContributionColumn.AUTHOR, + ContributionColumn.INSTALLED_VERSION, + ContributionColumn.AVAILABLE_VERSION); + + this.contribFilter = contribFilter; + table.getTableHeader().setEnabled(false); + } + + // Thread: EDT + @Override + public void contributionAdded(final Contribution contribution) { + // Ensures contributionAdded in ListPanel is only run on LocalContributions + if (contribFilter.matches(contribution)) { + super.contributionAdded(contribution); + ((UpdateStatusPanel) contributionTab.statusPanel).update(); // Enables update button + } + } + + // Thread: EDT + @Override + public void contributionRemoved(final Contribution contribution) { + super.contributionRemoved(contribution); + ((UpdateStatusPanel) contributionTab.statusPanel).update(); // Disables update button on last contribution + } + + // Thread: EDT + @Override + public void contributionChanged(final Contribution oldContrib, + final Contribution newContrib) { + DetailPanel panel = panelByContribution.get(oldContrib); + if (panel == null) { + contributionAdded(newContrib); + } else if (newContrib.isInstalled()) { + panelByContribution.remove(oldContrib); + } + model.fireTableDataChanged(); + } + +} diff --git a/app/src/processing/app/contrib/UpdateStatusPanel.java b/app/src/processing/app/contrib/UpdateStatusPanel.java new file mode 100644 index 0000000000..f91db9fbd5 --- /dev/null +++ b/app/src/processing/app/contrib/UpdateStatusPanel.java @@ -0,0 +1,74 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2013-16 The Processing Foundation + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + as published by the Free Software Foundation. + + 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.contrib; + +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.GroupLayout; +import javax.swing.LayoutStyle; +import javax.swing.SwingConstants; + +import processing.app.ui.Toolkit; + + +public class UpdateStatusPanel extends StatusPanel { + + public UpdateStatusPanel(UpdateContributionTab tab, int width) { + super(); + this.contributionTab = tab; + + updateButton = Toolkit.createIconButton("Update All", "manager/update"); + updateButton.setFont(ManagerFrame.NORMAL_PLAIN); + updateButton.setHorizontalAlignment(SwingConstants.LEFT); + updateButton.setVisible(true); + updateButton.setEnabled(false); + + updateButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + contributionTab.updateAll(); + } + }); + setBackground(new Color(0xebebeb)); + layout = new GroupLayout(this); + setLayout(layout); + + layout.setAutoCreateContainerGaps(true); + layout.setAutoCreateGaps(true); + + layout.setHorizontalGroup(layout + .createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, + GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) + .addComponent(updateButton, BUTTON_WIDTH, BUTTON_WIDTH, BUTTON_WIDTH) + .addGap(12)); // make button line up relative to the scrollbar + + layout.setVerticalGroup(layout.createParallelGroup() + .addComponent(updateButton)); + } + + + public void update() { + updateButton.setEnabled(contributionTab.hasUpdates()); + } +} \ No newline at end of file diff --git a/app/src/processing/app/exec/StreamRedirectThread.java b/app/src/processing/app/exec/StreamRedirectThread.java index c3140d872c..ee6d7ed006 100644 --- a/app/src/processing/app/exec/StreamRedirectThread.java +++ b/app/src/processing/app/exec/StreamRedirectThread.java @@ -7,13 +7,13 @@ */ /* * 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 @@ -25,7 +25,7 @@ * 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 @@ -50,7 +50,7 @@ public class StreamRedirectThread extends Thread { private static final int BUFFER_SIZE = 2048; - + /** * Set up for copy. * @param name Name of the thread @@ -63,15 +63,15 @@ public StreamRedirectThread(String name, InputStream in, OutputStream out) { this.out = new OutputStreamWriter(out); setPriority(Thread.MAX_PRIORITY-1); } - - + + public StreamRedirectThread(String name, Reader in, Writer out) { super(name); this.in = in; this.out = out; setPriority(Thread.MAX_PRIORITY-1); } - + /** * Copy. @@ -80,16 +80,15 @@ 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); + + } catch (IOException exc) { + processing.app.Console.systemErr("Child I/O Transfer - " + exc); } } } diff --git a/app/src/processing/app/platform/DefaultPlatform.java b/app/src/processing/app/platform/DefaultPlatform.java index 7643cbb45d..58529b516f 100644 --- a/app/src/processing/app/platform/DefaultPlatform.java +++ b/app/src/processing/app/platform/DefaultPlatform.java @@ -29,6 +29,9 @@ import javax.swing.UIManager; +import com.sun.jna.Library; +import com.sun.jna.Native; + import processing.app.Base; import processing.app.Preferences; @@ -120,4 +123,42 @@ public boolean openFolderAvailable() { public void openFolder(File file) throws Exception { Desktop.getDesktop().open(file); } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + public interface CLibrary extends Library { + CLibrary INSTANCE = (CLibrary)Native.loadLibrary("c", CLibrary.class); + int setenv(String name, String value, int overwrite); + String getenv(String name); + int unsetenv(String name); + int putenv(String string); + } + + + public void setenv(String variable, String value) { + CLibrary clib = CLibrary.INSTANCE; + clib.setenv(variable, value, 1); + } + + + public String getenv(String variable) { + CLibrary clib = CLibrary.INSTANCE; + return clib.getenv(variable); + } + + + public int unsetenv(String variable) { + CLibrary clib = CLibrary.INSTANCE; + return clib.unsetenv(variable); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + public int getSystemDPI() { + return 96; + } } diff --git a/app/src/processing/app/platform/LinuxPlatform.java b/app/src/processing/app/platform/LinuxPlatform.java index d3be4e9912..7bc7297246 100644 --- a/app/src/processing/app/platform/LinuxPlatform.java +++ b/app/src/processing/app/platform/LinuxPlatform.java @@ -23,15 +23,18 @@ package processing.app.platform; import java.io.File; +import java.awt.Desktop; import java.awt.Toolkit; import processing.app.Base; import processing.app.Messages; import processing.app.Preferences; -import processing.app.platform.DefaultPlatform; +import processing.core.PApplet; public class LinuxPlatform extends DefaultPlatform { + String homeDir; + public void initBase(Base base) { super.initBase(base); @@ -42,12 +45,12 @@ public void initBase(Base base) { (!javaVendor.contains("Sun") && !javaVendor.contains("Oracle")) || javaVM == null || !javaVM.contains("Java")) { Messages.showWarning("Not fond of this Java VM", - "Processing requires Java 8 from Sun (i.e. the sun-java-jdk\n" + - "package on Ubuntu). Other versions such as OpenJDK, IcedTea,\n" + + "Processing requires Java 8 from Oracle.\n" + + "Other versions such as OpenJDK, IcedTea,\n" + "and GCJ are strongly discouraged. Among other things, you're\n" + "likely to run into problems with sketch window size and\n" + "placement. For more background, please read the wiki:\n" + - "https://github.com/processing/processing/wiki/Supported-Platforms#Linux", null); + "https://github.com/processing/processing/wiki/Supported-Platforms#linux", null); } // Set x11 WM_CLASS property which is used as the application @@ -67,16 +70,61 @@ public void initBase(Base base) { } - public void openURL(String url) throws Exception { - if (openFolderAvailable()) { - String launcher = Preferences.get("launcher"); - if (launcher != null) { - Runtime.getRuntime().exec(new String[] { launcher, url }); + // The default Look & Feel is set in preferences.txt + // As of 3.0a6, defaults.txt is set to Nimbus for Linux. + + + // Java sets user.home to be /root for execution with sudo. + // This method attempts to use the user's real home directory instead. + public String getHomeDir() { + if (homeDir == null) { + // get home directory of SUDO_USER if set, else use user.home + homeDir = System.getProperty("user.home"); + String sudoUser = System.getenv("SUDO_USER"); + if (sudoUser != null && sudoUser.length() != 0) { + try { + homeDir = getHomeDir(sudoUser); + } catch (Exception e) { } } } + return homeDir; + } + + + static public String getHomeDir(String user) throws Exception { + Process p = PApplet.exec("/bin/sh", "-c", "echo ~" + user); + return PApplet.createReader(p.getInputStream()).readLine(); + } + + + @Override + public File getSettingsFolder() throws Exception { + return new File(getHomeDir(), ".processing"); + } + + + @Override + public File getDefaultSketchbookFolder() throws Exception { + return new File(getHomeDir(), "sketchbook"); + } + + + @Override + public void openURL(String url) throws Exception { + if (Desktop.isDesktopSupported()) { + super.openURL(url); + + } else if (openFolderAvailable()) { + String launcher = Preferences.get("launcher"); // guaranteed non-null + Runtime.getRuntime().exec(new String[] { launcher, url }); + + } else { + System.err.println("No launcher set, cannot open " + url); + } } + @Override public boolean openFolderAvailable() { if (Preferences.get("launcher") != null) { return true; @@ -111,19 +159,18 @@ public boolean openFolderAvailable() { } + @Override 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(); - } + if (Desktop.isDesktopSupported()) { + super.openFolder(file); + + } else if (openFolderAvailable()) { + String launcher = Preferences.get("launcher"); + String[] params = new String[] { launcher, file.getAbsolutePath() }; + Runtime.getRuntime().exec(params); + } else { - System.out.println("No launcher set, cannot open " + + System.err.println("No launcher set, cannot open " + file.getAbsolutePath()); } } diff --git a/app/src/processing/app/platform/MacPlatform.java b/app/src/processing/app/platform/MacPlatform.java index 8fab34e6d7..02474a3942 100644 --- a/app/src/processing/app/platform/MacPlatform.java +++ b/app/src/processing/app/platform/MacPlatform.java @@ -22,15 +22,16 @@ package processing.app.platform; +import java.awt.Desktop; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.net.URI; import com.apple.eio.FileManager; import processing.app.Base; import processing.app.Messages; -import processing.app.platform.DefaultPlatform; /** @@ -62,6 +63,7 @@ public void saveLanguage(String language) { } } + public void initBase(Base base) { super.initBase(base); System.setProperty("apple.laf.useScreenMenuBar", "true"); @@ -127,6 +129,21 @@ public File getDefaultSketchbookFolder() throws Exception { // } + public void openURL(String url) throws Exception { + try { + Desktop.getDesktop().browse(new URI(url)); + } catch (IOException e) { + // Deal with a situation where the browser hangs on macOS + // https://github.com/fathominfo/processing-p5js-mode/issues/4 + if (e.getMessage().contains("Error code: -600")) { + throw new RuntimeException("Could not open the sketch, please restart your browser or computer"); + } else { + throw e; + } + } + } + + /* public void openURL(String url) throws Exception { if (PApplet.javaVersion < 1.6f) { diff --git a/app/src/processing/app/platform/WindowsPlatform.java b/app/src/processing/app/platform/WindowsPlatform.java index c3731bc924..3c4759a375 100644 --- a/app/src/processing/app/platform/WindowsPlatform.java +++ b/app/src/processing/app/platform/WindowsPlatform.java @@ -28,27 +28,37 @@ import com.sun.jna.Library; import com.sun.jna.Native; -import com.sun.jna.platform.win32.Kernel32Util; -import com.sun.jna.platform.win32.Shell32; +import com.sun.jna.Pointer; +import com.sun.jna.platform.win32.Shell32Util; import com.sun.jna.platform.win32.ShlObj; -import com.sun.jna.platform.win32.WinDef; -import com.sun.jna.platform.win32.WinError; -import com.sun.jna.platform.win32.WinNT.HRESULT; +import com.sun.jna.win32.StdCallLibrary; +import com.sun.jna.win32.W32APIOptions; import processing.app.Base; import processing.app.Messages; import processing.app.Preferences; -import processing.app.platform.DefaultPlatform; +import processing.app.Util; import processing.app.platform.WindowsRegistry.REGISTRY_ROOT_KEY; + import processing.core.PApplet; +// With the changes to include .pyde files for 3.4, this class is +// a bit of a mess. Registering a single extension has moved to +// registerExtension(), however that method, and the checkAssociations() +// method now have too much duplicated effort, which isn't great, +// but more importantly, makes it hard to follow what's going on. +// At some point, checkAssociations() and setAssociations() can probably +// be merged, or at least turned into cleaner methods that don't re-do +// one another's work, but I haven't time today. [fry 180326] + /** * Platform-specific glue for Windows. */ public class WindowsPlatform extends DefaultPlatform { static final String APP_NAME = "Processing"; + static final String[] APP_EXTENSIONS = { ".pde", ".pyde" }; static final String REG_OPEN_COMMAND = System.getProperty("user.dir").replace('/', '\\') + "\\" + APP_NAME.toLowerCase() + ".exe \"%1\""; @@ -139,10 +149,18 @@ protected void checkAssociations() { // Check the key that should be set by a previous run of Processing String knownCommand = WindowsRegistry.getStringValue(REGISTRY_ROOT_KEY.CURRENT_USER, - "Software\\Classes\\" + REG_DOC + "\\shell\\open\\command", ""); + "Software\\Classes\\" + REG_DOC + "\\shell\\open\\command", ""); // If the association hasn't been set, or it's not correct, set it. if (knownCommand == null || !knownCommand.equals(REG_OPEN_COMMAND)) { setAssociations(); + + } else { // check each extension + for (String extension : APP_EXTENSIONS) { + if (!WindowsRegistry.valueExists(REGISTRY_ROOT_KEY.CURRENT_USER, + "Software\\Classes", extension)) { + setAssociations(); + } + } } } } catch (Exception e) { @@ -192,33 +210,36 @@ protected void setAssociations() throws UnsupportedEncodingException { openCommand)) { */ + // First create the .pde association + for (String extension : APP_EXTENSIONS) { + if (!registerExtension(extension)) { + Messages.log("Could not associate " + extension + "files, " + + "turning off auto-associate pref."); + Preferences.setBoolean("platform.auto_file_type_associations", false); + } + } + } + + + private boolean registerExtension(String extension) throws UnsupportedEncodingException { // "To change the settings for the interactive user, store the changes // under HKEY_CURRENT_USER\Software\Classes rather than HKEY_CLASSES_ROOT." // msdn.microsoft.com/en-us/library/windows/desktop/ms724475(v=vs.85).aspx final REGISTRY_ROOT_KEY rootKey = REGISTRY_ROOT_KEY.CURRENT_USER; final String docPrefix = "Software\\Classes\\" + REG_DOC; - // First create the .pde association - if (WindowsRegistry.createKey(rootKey, "Software\\Classes", ".pde") && - WindowsRegistry.setStringValue(rootKey, "Software\\Classes\\.pde", "", REG_DOC) && - - // Now give files with a .pde extension a name for the explorer - WindowsRegistry.createKey(rootKey, "Software\\Classes", REG_DOC) && - WindowsRegistry.setStringValue(rootKey, docPrefix, "", APP_NAME + " Source Code") && + return (WindowsRegistry.createKey(rootKey, "Software\\Classes", extension) && + WindowsRegistry.setStringValue(rootKey, "Software\\Classes\\" + extension, "", REG_DOC) && - // Now associate the 'open' command with the current processing.exe - WindowsRegistry.createKey(rootKey, docPrefix, "shell") && - WindowsRegistry.createKey(rootKey, docPrefix + "\\shell", "open") && - WindowsRegistry.createKey(rootKey, docPrefix + "\\shell\\open", "command") && - WindowsRegistry.setStringValue(rootKey, docPrefix + "\\shell\\open\\command", "", REG_OPEN_COMMAND)) { + // Now give files with a .pde extension a name for the explorer + WindowsRegistry.createKey(rootKey, "Software\\Classes", REG_DOC) && + WindowsRegistry.setStringValue(rootKey, docPrefix, "", APP_NAME + " Source Code") && - // everything ok - // hooray! - - } else { - Messages.log("Could not associate files, turning off auto-associate pref."); - Preferences.setBoolean("platform.auto_file_type_associations", false); - } + // Now associate the 'open' command with the current processing.exe + WindowsRegistry.createKey(rootKey, docPrefix, "shell") && + WindowsRegistry.createKey(rootKey, docPrefix + "\\shell", "open") && + WindowsRegistry.createKey(rootKey, docPrefix + "\\shell\\open", "command") && + WindowsRegistry.setStringValue(rootKey, docPrefix + "\\shell\\open\\command", "", REG_OPEN_COMMAND)); } @@ -259,52 +280,72 @@ protected void checkPath() { // looking for Documents and Settings/blah/Application Data/Processing public File getSettingsFolder() throws Exception { - String appData = getAppDataPath(); - if (appData != null) { - return new File(appData, APP_NAME); + try { + String appDataRoaming = getAppDataPath(); + if (appDataRoaming != null) { + File settingsFolder = new File(appDataRoaming, APP_NAME); + if (settingsFolder.exists() || settingsFolder.mkdirs()) { + return settingsFolder; + } + } + + String appDataLocal = getLocalAppDataPath(); + if (appDataLocal != null) { + File settingsFolder = new File(appDataLocal, APP_NAME); + if (settingsFolder.exists() || settingsFolder.mkdirs()) { + return settingsFolder; + } + } + + if (appDataRoaming == null && appDataLocal == null) { + throw new IOException("Could not get the AppData folder"); + } + + // https://github.com/processing/processing/issues/3838 + throw new IOException("Permissions error: make sure that " + + appDataRoaming + " or " + appDataLocal + + " is writable."); + + } catch (UnsatisfiedLinkError ule) { + String path = new File("lib").getCanonicalPath(); + + String msg = Util.containsNonASCII(path) ? + "Please move Processing to a location with only\n" + + "ASCII characters in the path and try again.\n" + + "https://github.com/processing/processing/issues/3543" : + "Could not find JNA support files, please reinstall Processing."; + Messages.showError("Windows JNA Problem", msg, ule); + return null; // unreachable } - throw new IOException("Could not get the Application Data folder"); } - static private String getAppDataPath() throws Exception { - // HKEY_CURRENT_USER\Software\Microsoft - // \Windows\CurrentVersion\Explorer\Shell Folders - // Value Name: AppData - // Value Type: REG_SZ - // Value Data: path + /* + What's happening internally with JNA https://github.com/java-native-access/jna/blob/master/contrib/platform/src/com/sun/jna/platform/win32/Shell32.java - //String keyPath = - // "Software\\Microsoft\\Windows\\CurrentVersion" + - // "\\Explorer\\Shell Folders"; - //String appDataPath = - // Registry.getStringValue(REGISTRY_ROOT_KEY.CURRENT_USER, keyPath, "AppData"); + Some goodies here: https://github.com/java-native-access/jna/blob/master/contrib/platform/src/com/sun/jna/platform/win32/Shell32Util.java + http://twall.github.io/jna/4.1.0/com/sun/jna/platform/win32/Shell32Util.html#getSpecialFolderPath(int, boolean) - // Fix for Issue 410 - // Java 1.6 doesn't provide a good workaround (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6519127) - // Using JNA and SHGetFolderPath instead. + SHGetKnownFolderPath function https://msdn.microsoft.com/en-us/library/windows/desktop/bb762188(v=vs.85).aspx + SHGetSpecialFolderPath https://msdn.microsoft.com/en-us/library/windows/desktop/bb762204(v=vs.85).aspx - // this will be contain the path if SHGetFolderPath is successful - char[] pszPath = new char[WinDef.MAX_PATH]; - HRESULT hResult = - Shell32.INSTANCE.SHGetFolderPath(null, ShlObj.CSIDL_APPDATA, - null, ShlObj.SHGFP_TYPE_CURRENT, - pszPath); + http://blogs.msdn.com/b/patricka/archive/2010/03/18/where-should-i-store-my-data-and-configuration-files-if-i-target-multiple-os-versions.aspx + */ - if (!hResult.equals(WinError.S_OK)) { - System.err.println(Kernel32Util.formatMessageFromHR(hResult)); - throw new Exception("Problem city, population: your computer."); - } - String appDataPath = new String(pszPath); - int len = appDataPath.indexOf("\0"); -// appDataPath = appDataPath.substring(0, len); -// return new File(appDataPath, "Processing"); - return appDataPath.substring(0, len); + /** Get the Users\name\AppData\Roaming path to write settings files. */ + static private String getAppDataPath() throws Exception { + return Shell32Util.getSpecialFolderPath(ShlObj.CSIDL_APPDATA, true); } - // looking for Documents and Settings/blah/My Documents/Processing + /** Get the Users\name\AppData\Local path as a settings fallback. */ + static private String getLocalAppDataPath() throws Exception { + return Shell32Util.getSpecialFolderPath(ShlObj.CSIDL_LOCAL_APPDATA, true); + } + + + /** Get the Documents and Settings\name\My Documents\Processing folder. */ public File getDefaultSketchbookFolder() throws Exception { String documentsPath = getDocumentsPath(); if (documentsPath != null) { @@ -315,6 +356,15 @@ public File getDefaultSketchbookFolder() throws Exception { static private String getDocumentsPath() throws Exception { + return Shell32Util.getSpecialFolderPath(ShlObj.CSIDL_MYDOCUMENTS, true); + } + + + /* + static private String getDocumentsPath() throws Exception { + // heh, this is a little too cheeky + //new JFileChooser().getFileSystemView().getDefaultDirectory().toString(); + // http://support.microsoft.com/?kbid=221837&sd=RMVP // http://support.microsoft.com/kb/242557/en-us @@ -342,16 +392,14 @@ static private String getDocumentsPath() throws Exception { HRESULT hResult = Shell32.INSTANCE.SHGetFolderPath(null, ShlObj.CSIDL_PERSONAL, null, ShlObj.SHGFP_TYPE_CURRENT, pszPath); if (!hResult.equals(WinError.S_OK)) { - System.err.println(Kernel32Util.formatMessageFromHR(hResult)); - throw new Exception("Problem city, population: your computer."); + throw new Exception(Kernel32Util.formatMessageFromHR(hResult)); } String personalPath = new String(pszPath); int len = personalPath.indexOf("\0"); -// personalPath = personalPath.substring(0, len); -// return new File(personalPath, "Processing"); return personalPath.substring(0, len); } + */ // @Override @@ -498,10 +546,57 @@ public void openFolder(File file) throws Exception { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - // Code partially thanks to Richard Quirk from: + // getenv/setenv code partially thanks to Richard Quirk from: // http://quirkygba.blogspot.com/2009/11/setting-environment-variables-in-java.html - static WinLibC clib = (WinLibC) Native.loadLibrary("msvcrt", WinLibC.class); + static WinLibC clib; + + + // moved to a getter so that we could handle errors in a single location + // and at a time when it was useful/possible (rather than a static block) + static WinLibC getLibC() { + if (clib == null) { + try { + clib = (WinLibC) Native.loadLibrary("msvcrt", WinLibC.class); + } catch (UnsatisfiedLinkError ule) { + Messages.showTrace("JNA Error", + "JNA could not be loaded. Please report here:\n" + + "http://github.com/processing/processing/issues/new", ule, true); + + /* + // Might be a problem with file encoding, use a default directory + // https://github.com/processing/processing/issues/3624 + File ctmp = new File("C:\\TEMP"); // kick it old school + if (ctmp.exists() || ctmp.mkdirs()) { + try { + File jnaTmp = File.createTempFile("processing", "jna", ctmp); + if (jnaTmp.mkdirs()) { + jnaTmp.deleteOnExit(); // clean up when we're done + System.setProperty("jna.tmpdir", jnaTmp.getAbsolutePath()); + try { + clib = (WinLibC) Native.loadLibrary("msvcrt", WinLibC.class); + } catch (UnsatisfiedLinkError ulf) { + Messages.showTrace("No luck with JNA", + "After several attempts, JNA could not be loaded. Please report:\n" + + "http://github.com/processing/processing/issues/new", ulf, true); + } + } + } catch (IOException e) { + Messages.showTrace("Could not create temp directory", + "JNA could not be loaded properly. Please report:\n" + + "http://github.com/processing/processing/issues/new", e, true); + } + } else { + Messages.showError("Could not create temp directory", + "JNA could not be loaded into C:\\TEMP. Please report:\n" + + "http://github.com/processing/processing/issues/new", null); + } + */ + } + } + return clib; + } + public interface WinLibC extends Library { //WinLibC INSTANCE = (WinLibC) Native.loadLibrary("msvcrt", WinLibC.class); @@ -512,7 +607,7 @@ public interface WinLibC extends Library { public void setenv(String variable, String value) { //WinLibC clib = WinLibC.INSTANCE; - clib._putenv(variable + "=" + value); + getLibC()._putenv(variable + "=" + value); } @@ -525,62 +620,63 @@ public int unsetenv(String variable) { //WinLibC clib = WinLibC.INSTANCE; //clib._putenv(variable + "="); //return 0; - return clib._putenv(variable + "="); + return getLibC()._putenv(variable + "="); } // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - // JNA code for using SHGetFolderPath to fix Issue 410 - // https://code.google.com/p/processing/issues/detail?id=410 - // Based on answer provided by McDowell at - // http://stackoverflow.com/questions/585534/what-is-the-best-way-to-find-the-users-home-directory-in-java/586917#586917 -// private static Map OPTIONS = new HashMap(); -// -// static { -// OPTIONS.put(Library.OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE); -// OPTIONS.put(Library.OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE); -// } -// -// -// static class HANDLE extends PointerType implements NativeMapped { -// public HANDLE() { } -// } -// -// static class HWND extends HANDLE { } -// -// -// public interface Shell32 extends Library { -// -// public static final int MAX_PATH = 260; -// public static final int SHGFP_TYPE_CURRENT = 0; -// public static final int SHGFP_TYPE_DEFAULT = 1; -// public static final int S_OK = 0; -// -// // KNOWNFOLDERIDs are preferred to CSDIL values -// // but Windows XP only supports CSDIL so thats what we have to use -// public static final int CSIDL_APPDATA = 0x001a; // "Application Data" -// public static final int CSIDL_PERSONAL = 0x0005; // "My Documents" -// -// static Shell32 INSTANCE = (Shell32) Native.loadLibrary("shell32", Shell32.class, OPTIONS); -// -// /** -// * see http://msdn.microsoft.com/en-us/library/bb762181(VS.85).aspx -// * -// * HRESULT SHGetFolderPath( HWND hwndOwner, int nFolder, HANDLE hToken, -// * DWORD dwFlags, LPTSTR pszPath); -// */ -// public int SHGetFolderPath(HWND hwndOwner, int nFolder, HANDLE hToken, -// int dwFlags, char[] pszPath); -// -// /** -// * This function can be used to copy, move, rename, -// * or delete a file system object. -// * @param fileop Address of an SHFILEOPSTRUCT structure that contains -// * information this function needs to carry out the specified operation. -// * @return Returns zero if successful, or nonzero otherwise. -// */ -// public int SHFileOperation(SHFILEOPSTRUCT fileop); -// } + // Need to extend com.sun.jna.platform.win32.User32 to access + // Win32 function GetDpiForSystem() + interface ExtUser32 extends StdCallLibrary, com.sun.jna.platform.win32.User32 { + ExtUser32 INSTANCE = (ExtUser32) Native.loadLibrary("user32", ExtUser32.class, W32APIOptions.DEFAULT_OPTIONS); + + public int GetDpiForSystem(); + + public int SetProcessDpiAwareness(int value); + + public final int DPI_AWARENESS_INVALID = -1; + public final int DPI_AWARENESS_UNAWARE = 0; + public final int DPI_AWARENESS_SYSTEM_AWARE = 1; + public final int DPI_AWARENESS_PER_MONITOR_AWARE = 2; + + public Pointer SetThreadDpiAwarenessContext(Pointer dpiContext); + + public final Pointer DPI_AWARENESS_CONTEXT_UNAWARE = new Pointer(-1); + public final Pointer DPI_AWARENESS_CONTEXT_SYSTEM_AWARE = new Pointer(-2); + public final Pointer DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE = new Pointer(-3); + } + + + static private int detected = detectSystemDPI(); + + + public int getSystemDPI() { + if (detected == -1) { + return super.getSystemDPI(); + } + return detected; + } + + + public static int detectSystemDPI() { + try { + ExtUser32.INSTANCE.SetProcessDpiAwareness(ExtUser32.DPI_AWARENESS_SYSTEM_AWARE); + } catch (Throwable e) { + // Ignore error + } + try { + ExtUser32.INSTANCE.SetThreadDpiAwarenessContext(ExtUser32.DPI_AWARENESS_CONTEXT_SYSTEM_AWARE); + } catch (Throwable e) { + // Ignore error (call valid only on Windows 10) + } + try { + return ExtUser32.INSTANCE.GetDpiForSystem(); + } catch (Throwable e) { + // DPI detection failed, fall back with default + System.out.println("DPI detection failed, fallback to 96 dpi"); + return -1; + } + } } diff --git a/app/src/processing/app/syntax/Brackets.java b/app/src/processing/app/syntax/Brackets.java index 1fd46ec27d..226e30aabc 100644 --- a/app/src/processing/app/syntax/Brackets.java +++ b/app/src/processing/app/syntax/Brackets.java @@ -16,7 +16,7 @@ public void invalidate() { } public int findMatchingBracket(final String text, final int pos) { - if (pos < 0 || pos > text.length()) + if (pos < 0 || pos >= text.length()) return -1; final char alpha = text.charAt(pos); @@ -126,9 +126,9 @@ private void readMLComment(final String text) { for (pos++; pos < len; pos++) { final char c = text.charAt(pos); if (c == '*' && (pos < len - 1)) { - pos++; - final char d = text.charAt(pos); + final char d = text.charAt(pos + 1); if (d == '/') { + pos++; return; } } diff --git a/app/src/processing/app/syntax/DefaultInputHandler.java b/app/src/processing/app/syntax/DefaultInputHandler.java old mode 100755 new mode 100644 index 3001f9eebe..c8db2bf7da --- a/app/src/processing/app/syntax/DefaultInputHandler.java +++ b/app/src/processing/app/syntax/DefaultInputHandler.java @@ -46,7 +46,6 @@ public void addDefaultKeyBindings() addKeyBinding("TAB",INSERT_TAB); addKeyBinding("INSERT",OVERWRITE); - addKeyBinding("C+\\",TOGGLE_RECT); addKeyBinding("HOME",HOME); addKeyBinding("END",END); diff --git a/app/src/processing/app/syntax/InputHandler.java b/app/src/processing/app/syntax/InputHandler.java index 5cde91f2a9..a695be1a09 100644 --- a/app/src/processing/app/syntax/InputHandler.java +++ b/app/src/processing/app/syntax/InputHandler.java @@ -84,7 +84,6 @@ public abstract class InputHandler extends KeyAdapter 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(); public static final ActionListener CLIPBOARD_CUT = new clipboard_cut(); // [fry] public static final ActionListener CLIPBOARD_COPY = new clipboard_copy(); public static final ActionListener CLIPBOARD_PASTE = new clipboard_paste(); @@ -133,7 +132,6 @@ public abstract class InputHandler extends KeyAdapter 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); actions.put("clipboard-cut",CLIPBOARD_CUT); actions.put("clipboard-copy",CLIPBOARD_COPY); @@ -1060,14 +1058,6 @@ public void actionPerformed(ActionEvent evt) { } - public static class toggle_rect implements ActionListener { - public void actionPerformed(ActionEvent evt) { - JEditTextArea textArea = getTextArea(evt); - textArea.setSelectionRectangular(!textArea.isSelectionRectangular()); - } - } - - public static class clipboard_cut implements ActionListener { public void actionPerformed(ActionEvent evt) { getTextArea(evt).cut(); @@ -1183,4 +1173,11 @@ public static int findWordEnd(String line, int pos, String noWordSep) { } return wordEnd; } + + + /** + * Called when input method support committed a character. + */ + public void handleInputMethodCommit() { + } } diff --git a/app/src/processing/app/syntax/JEditTextArea.java b/app/src/processing/app/syntax/JEditTextArea.java index b44c7b5b9a..b63084c63a 100644 --- a/app/src/processing/app/syntax/JEditTextArea.java +++ b/app/src/processing/app/syntax/JEditTextArea.java @@ -26,7 +26,6 @@ import javax.swing.*; import java.awt.im.InputMethodRequests; -import java.awt.print.Printable; import processing.app.syntax.im.InputMethodSupport; import processing.core.PApplet; @@ -77,7 +76,9 @@ public class JEditTextArea extends JComponent /** The size of the offset between the leftmost padding and the code */ public static final int leftHandGutter = 6; - private InputMethodSupport inputMethodSupport = null; + private InputMethodSupport inputMethodSupport; + + private TextAreaDefaults defaults; private Brackets bracketHelper = new Brackets(); @@ -87,6 +88,8 @@ public class JEditTextArea extends JComponent * @param defaults The default settings */ public JEditTextArea(TextAreaDefaults defaults, InputHandler inputHandler) { + this.defaults = defaults; + // Enable the necessary events enableEvents(AWTEvent.KEY_EVENT_MASK); @@ -258,8 +261,8 @@ public final TextAreaPainter getPainter() { } - public final Printable getPrintable() { - return painter.getPrintable(); + public TextAreaDefaults getDefaults() { + return defaults; } @@ -382,7 +385,7 @@ public void updateScrollBars() { } int charWidth = painter.getFontMetrics().charWidth('w'); int width = maxLineLength * charWidth; - int painterWidth = painter.getWidth(); + int painterWidth = painter.getScrollWidth(); // Update to how horizontal scrolling is handled // http://code.google.com/p/processing/issues/detail?id=280 @@ -591,8 +594,7 @@ public int lineToY(int line) { public int yToLine(int y) { FontMetrics fm = painter.getFontMetrics(); int height = fm.getHeight(); - return Math.max(0,Math.min(getLineCount() - 1, - y / height + firstLine)); + return Math.max(0, Math.min(getLineCount() - 1, y / height + firstLine)); } @@ -617,7 +619,7 @@ public final int offsetToX(int line, int offset) { * @param offset The offset, from the start of the line */ public int _offsetToX(int line, int offset) { - TokenMarker tokenMarker = getTokenMarker(); + TokenMarkerState tokenMarker = getTokenMarker(); // Use painter's cached info for speed FontMetrics fm = painter.getFontMetrics(); @@ -679,7 +681,7 @@ public int _offsetToX(int line, int offset) { * @param x The x co-ordinate */ public int xToOffset(int line, int x) { - TokenMarker tokenMarker = getTokenMarker(); + TokenMarkerState tokenMarker = getTokenMarker(); /* Use painter's cached info for speed */ FontMetrics fm = painter.getFontMetrics(); @@ -755,6 +757,9 @@ public int xToOffset(int line, int x) { // ", i = " + i + // ", length = " + length + // ", array len = " + segmentArray.length); + if (segmentOffset + offset + i >= segmentArray.length) { + return segmentArray.length - segmentOffset - 1; + } char c = segmentArray[segmentOffset + offset + i]; int charWidth; if (c == '\t') { @@ -782,26 +787,27 @@ public int xToOffset(int line, int x) { } } + /** * 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) - { + 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() - { + public final SyntaxDocument getDocument() { return document; } + /** * Sets the document this text area is editing. * @param document The document @@ -815,6 +821,7 @@ public void setDocument(SyntaxDocument document) { document.addDocumentListener(documentHandler); + bracketHelper.invalidate(); select(0, 0); updateScrollBars(); painter.repaint(); @@ -835,6 +842,7 @@ public void setDocument(SyntaxDocument document, document.addDocumentListener(documentHandler); + bracketHelper.invalidate(); select(start, stop); updateScrollBars(); setVerticalScrollPosition(scroll); @@ -846,7 +854,7 @@ public void setDocument(SyntaxDocument document, * Returns the document's token marker. Equivalent to calling * getDocument().getTokenMarker(). */ - public final TokenMarker getTokenMarker() { + public final TokenMarkerState getTokenMarker() { return document.getTokenMarker(); } @@ -1024,8 +1032,10 @@ public final void getText(int start, int len, Segment segment) { try { document.getText(start,len,segment); - } catch(BadLocationException bl) { + } catch (BadLocationException bl) { bl.printStackTrace(); + System.err.format("Bad Location: %d for start %d and length %d", + bl.offsetRequested(), start, len); segment.offset = segment.count = 0; } } @@ -1067,19 +1077,8 @@ public final int getSelectionStart() { */ public int getSelectionStart(int line) { - if(line == selectionStartLine) + 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); } @@ -1117,19 +1116,8 @@ public final int getSelectionStop() */ public int getSelectionStop(int line) { - if(line == selectionEndLine) + 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; } @@ -1286,17 +1274,12 @@ public void select(int start, int end) fireCaretEvent(); } - // When the user is typing, etc, we don't want the caret - // to blink + // When the user is typing, etc, we don't want the caret to blink blink = true; if (!DISABLE_CARET) { 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; @@ -1344,7 +1327,8 @@ protected void setNewSelectionWord( int line, int offset ) int wordStart = 0; int wordEnd = lineText.length(); - char ch = lineText.charAt(Math.max(0,offset - 1)); + int charPos = PApplet.constrain(offset - 1, 0, lineText.length() - 1); + char ch = lineText.charAt(charPos); CharacterKinds thisWord = CharacterKind(ch,noWordSep); @@ -1375,54 +1359,10 @@ protected void setNewSelectionWord( int line, int offset ) */ public final String getSelectedText() { - if(selectionStart == selectionEnd) + 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; - } - - StringBuilder sb = new StringBuilder(); - 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); - sb.append(seg.array,seg.offset,seg.count); - - if(i != selectionEndLine) - sb.append('\n'); - } - - return sb.toString(); - } - else - { - return getText(selectionStart, - selectionEnd - selectionStart); + } else { + return getText(selectionStart, selectionEnd - selectionStart); } } @@ -1431,67 +1371,40 @@ public final String getSelectedText() * @param selectedText The replacement text for the selection */ public void setSelectedText(String selectedText) { + setSelectedText(selectedText, false); + } + + + /** + * Replaces the selection with the specified text. + * @param selectedText The replacement text for the selection + * @param recordCompoundEdit Whether the replacement should be + * recorded as a compound edit + */ + public void setSelectedText(String selectedText, boolean recordCompoundEdit) { 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) { - 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 (recordCompoundEdit) { + document.beginCompoundEdit(); + } - 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); - } + try { + document.remove(selectionStart, selectionEnd - selectionStart); + if (selectedText != null) { + document.insertString(selectionStart, selectedText,null); } - } catch(BadLocationException bl) { + } catch (BadLocationException bl) { bl.printStackTrace(); throw new InternalError("Cannot replace selection"); } finally { // No matter what happens... stops us from leaving document in a bad state - document.endCompoundEdit(); + // (provided this has to be recorded as a compound edit, of course...) + if (recordCompoundEdit) { + document.endCompoundEdit(); + } } setCaretPosition(selectionEnd); } @@ -1563,7 +1476,10 @@ public void overwriteSetSelectedText(String str) // Don't overstrike if there is a selection if(!overwrite || selectionStart != selectionEnd) { - setSelectedText(str); + // record the whole operation as a compound edit if + // selected text is being replaced + boolean isSelectAndReplaceOp = (selectionStart != selectionEnd); + setSelectedText(str, isSelectAndReplaceOp); return; } @@ -1573,12 +1489,10 @@ public void overwriteSetSelectedText(String str) int caretLineEnd = getLineStopOffset(getCaretLine()); if(caretLineEnd - caret <= str.length()) { - setSelectedText(str); + setSelectedText(str, false); return; } - document.beginCompoundEdit(); - try { document.remove(caret,str.length()); @@ -1588,10 +1502,6 @@ public void overwriteSetSelectedText(String str) { bl.printStackTrace(); } - finally - { - document.endCompoundEdit(); - } } /** @@ -1613,24 +1523,6 @@ public final void setOverwriteEnabled(boolean 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 @@ -1689,13 +1581,14 @@ public void copy() { Clipboard clipboard = getToolkit().getSystemClipboard(); String selection = getSelectedText(); + if (selection != null) { + int repeatCount = inputHandler.getRepeatCount(); + StringBuilder sb = new StringBuilder(); + for(int i = 0; i < repeatCount; i++) + sb.append(selection); - int repeatCount = inputHandler.getRepeatCount(); - StringBuilder sb = new StringBuilder(); - for(int i = 0; i < repeatCount; i++) - sb.append(selection); - - clipboard.setContents(new StringSelection(sb.toString()), null); + clipboard.setContents(new StringSelection(sb.toString()), null); + } } } @@ -1721,7 +1614,25 @@ public void copy() { * specific to any language or version of the PDE. */ public void copyAsHTML() { - StringBuilder cf = new StringBuilder("

\n");
+    HtmlSelection formatted = new HtmlSelection("
\n"
+        + getTextAsHtml(null) + "\n
"); + + Clipboard clipboard = processing.app.ui.Toolkit.getSystemClipboard(); + clipboard.setContents(formatted, new ClipboardOwner() { + public void lostOwnership(Clipboard clipboard, Transferable contents) { + // I don't care about ownership + } + }); + } + + + /** + * Guts of copyAsHTML, minus the pre, body, and html blocks surrounding. + * @param doc If null, read only the selection if any, and use the active + * document. Otherwise, the whole of doc is used. + */ + public String getTextAsHtml(SyntaxDocument doc) { + StringBuilder cf = new StringBuilder(); int selStart = getSelectionStart(); int selStop = getSelectionStop(); @@ -1729,8 +1640,12 @@ public void copyAsHTML() { int startLine = getSelectionStartLine(); int stopLine = getSelectionStopLine(); + if (doc != null) { + startLine = 0; + stopLine = doc.getDefaultRootElement().getElementCount() - 1; + } // If no selection, convert all the lines - if (selStart == selStop) { + else if (selStart == selStop) { startLine = 0; stopLine = getLineCount() - 1; } else { @@ -1739,55 +1654,45 @@ public void copyAsHTML() { stopLine--; } } + if (doc == null) { + doc = getDocument(); + } // Read the code line by line for (int i = startLine; i <= stopLine; i++) { - emitAsHTML(cf, i); + emitAsHTML(cf, i, doc); } - cf.append("\n
"); - - HtmlSelection formatted = new HtmlSelection(cf.toString()); - - Clipboard clipboard = processing.app.ui.Toolkit.getSystemClipboard(); - clipboard.setContents(formatted, new ClipboardOwner() { - public void lostOwnership(Clipboard clipboard, Transferable contents) { - // i don't care about ownership - } - }); + return cf.toString(); } - private void emitAsHTML(StringBuilder cf, int line) { + private void emitAsHTML(StringBuilder cf, int line, SyntaxDocument doc) { + // Almost static; only needs the painter for a color scheme. Segment segment = new Segment(); - getLineText(line, segment); + try { + Element element = doc.getDefaultRootElement().getElement(line); + int start = element.getStartOffset(); + int stop = element.getEndOffset(); + doc.getText(start, stop - start - 1, segment); + } catch (BadLocationException e) { return; } char[] segmentArray = segment.array; int limit = segment.getEndIndex(); int segmentOffset = segment.offset; int segmentCount = segment.count; - TokenMarker tokenMarker = getTokenMarker(); + TokenMarkerState tokenMarker = doc.getTokenMarker(); // 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); appendAsHTML(cf, c); } } 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(); - } + Token tokens = tokenMarker.markTokens(segment, line); int offset = 0; SyntaxStyle[] styles = painter.getStyles(); @@ -1795,10 +1700,8 @@ private void emitAsHTML(StringBuilder cf, int line) { for (;;) { byte id = tokens.id; if (id == Token.END) { - char c = segmentArray[segmentOffset + offset]; if (segmentOffset + offset < limit) { - //cf.append(c); - appendAsHTML(cf, c); + appendAsHTML(cf, segmentArray[segmentOffset + offset]); } else { cf.append('\n'); } @@ -1821,7 +1724,6 @@ private void emitAsHTML(StringBuilder cf, int line) { cf.append(" "); } else { appendAsHTML(cf, c); - //cf.append(c); } // Place close tags [/] if (j == (length - 1) && id != Token.NULL && styles[id].isBold()) @@ -2001,13 +1903,11 @@ public void processKeyEvent(KeyEvent event) { protected static String RIGHT = "right"; protected static String BOTTOM = "bottom"; -// protected static JEditTextArea focusedComponent; protected Timer caretTimer; - private boolean DISABLE_CARET = false; + static private final boolean DISABLE_CARET = false; protected TextAreaPainter painter; - //protected EditPopupMenu popup; protected JPopupMenu popup; protected EventListenerList eventListenerList; @@ -2054,7 +1954,6 @@ public void processKeyEvent(KeyEvent event) { protected int magicCaret; protected boolean overwrite; - protected boolean rectSelect; protected void fireCaretEvent() @@ -2374,8 +2273,6 @@ public void mouseDragged(MouseEvent evt) { if (popup != null && popup.isVisible()) return; if (!selectWord && !selectLine) { - //setSelectionRectangular((evt.getModifiers() & InputEvent.CTRL_MASK) != 0); - setSelectionRectangular(evt.isControlDown()); try { select(getMarkPosition(), xyToOffset(evt.getX(), evt.getY())); } catch (ArrayIndexOutOfBoundsException e) { @@ -2432,8 +2329,10 @@ public void mousePressed(MouseEvent event) { // if (focusedComponent != JEditTextArea.this) return; if (!hasFocus()) { // System.out.println("requesting focus in window"); - requestFocusInWindow(); - return; + // The following condition check fixes #3649 [manindra, 08/20/15] + if(!requestFocusInWindow()) { + return; + } } // isPopupTrigger() is handled differently across platforms, @@ -2449,6 +2348,16 @@ public void mousePressed(MouseEvent event) { // // Windows fires the popup trigger on release (see mouseReleased() below)( // if (!Base.isWindows()) { // if (event.isPopupTrigger() && (popup != null)) { + + // If user right-clicked inside the selection, preserve it; + // move caret to click offset otherwise + int offset = xyToOffset(event.getX(), event.getY()); + int selectionStart = getSelectionStart(); + int selectionStop = getSelectionStop(); + if (offset < selectionStart || offset >= selectionStop) { + select(offset, offset); + } + popup.show(painter, event.getX(), event.getY()); return; // } @@ -2502,7 +2411,6 @@ public void mouseReleased(MouseEvent event) { 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); diff --git a/app/src/processing/app/syntax/KeywordMap.java b/app/src/processing/app/syntax/KeywordMap.java index cfa4caa68c..d8ea622788 100644 --- a/app/src/processing/app/syntax/KeywordMap.java +++ b/app/src/processing/app/syntax/KeywordMap.java @@ -32,7 +32,7 @@ public class KeywordMap { // A value of 52 will give good performance for most maps. static private int MAP_LENGTH = 52; - + /** * Creates a new KeywordMap. * @param ignoreCase True if keys are case insensitive @@ -84,8 +84,8 @@ public byte lookup(Segment text, int offset, int length, boolean paren) { } return Token.NULL; } - - + + /** * Checks if a subregion of a Segment is equal to a * character array. @@ -98,20 +98,20 @@ static public 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) + 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; + } + 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; } @@ -127,7 +127,7 @@ public void add(String keyword, byte id, boolean paren) { map[key] = new Keyword(keyword.toCharArray(), id, map[key]); } - + /** * Returns true if the keyword map is set to be case insensitive, * false otherwise. @@ -136,7 +136,7 @@ public boolean getIgnoreCase() { return ignoreCase; } - + /** * Sets if the keyword map should be case insensitive. * @param ignoreCase True if the keyword map should be case @@ -146,21 +146,21 @@ public void setIgnoreCase(boolean ignoreCase) { this.ignoreCase = ignoreCase; } - + protected int getStringMapKey(String s) { return (Character.toUpperCase(s.charAt(0)) + Character.toUpperCase(s.charAt(s.length()-1))) % MAP_LENGTH; } - + protected int getSegmentMapKey(Segment s, int off, int len) { return (Character.toUpperCase(s.array[off]) + Character.toUpperCase(s.array[off + len - 1])) % MAP_LENGTH; } - + // private members private static class Keyword { public final char[] keyword; diff --git a/app/src/processing/app/syntax/PdeInputHandler.java b/app/src/processing/app/syntax/PdeInputHandler.java old mode 100755 new mode 100644 index be918de07b..eec0b858a7 --- a/app/src/processing/app/syntax/PdeInputHandler.java +++ b/app/src/processing/app/syntax/PdeInputHandler.java @@ -30,6 +30,7 @@ import processing.app.Platform; import processing.app.Preferences; +import processing.app.ui.Editor; /** @@ -39,6 +40,29 @@ */ public class PdeInputHandler extends DefaultInputHandler { + /** + * Need the Editor object for Input Method changes, plus most subclasses + * will want a local copy anyway. Changed after Processing 3.1.2, need to + * see if this breaks any other Modes before releasing. + */ + protected Editor editor; + + + /** + * Recommended constructor. + * @since 3.2 + */ + public PdeInputHandler(Editor editor) { + // Make sure the default constructor is called to set up the basics + this(); + + this.editor = editor; + } + + + /** + * Not recommended, but included for API compatibility. + */ public PdeInputHandler() { // Use option on mac for text edit controls that are ctrl on Windows/Linux. // (i.e. ctrl-left/right is option-left/right on OS X) @@ -253,4 +277,9 @@ public boolean handlePressed(KeyEvent event) { public boolean handleTyped(KeyEvent event) { return false; } + + + public void handleInputMethodCommit() { + editor.getSketch().setModified(true); + } } \ No newline at end of file diff --git a/app/src/processing/app/syntax/PdeTextArea.java b/app/src/processing/app/syntax/PdeTextArea.java new file mode 100644 index 0000000000..43b403107e --- /dev/null +++ b/app/src/processing/app/syntax/PdeTextArea.java @@ -0,0 +1,183 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* +Part of the Processing project - http://processing.org +Copyright (c) 2012-16 The Processing Foundation + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +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. +*/ + +package processing.app.syntax; + +import java.awt.Cursor; +import java.awt.Image; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; +import java.util.HashMap; +import java.util.Map; + +import processing.app.Mode; +import processing.app.ui.Editor; + + +/** + * Extensions to JEditTextArea to for the PDE. These were moved out of + * JavaTextArea because they were not Java-specific and would be helpful + * for other Mode implementations. + */ +public class PdeTextArea extends JEditTextArea { + protected final Editor editor; + + protected Image gutterGradient; + + /// the text marker for highlighting breakpoints in the gutter + static public final String BREAK_MARKER = "<>"; + /// the text marker for highlighting the current line in the gutter + static public final String STEP_MARKER = "->"; + + /// maps line index to gutter text + protected final Map gutterText = new HashMap<>(); + + + public PdeTextArea(TextAreaDefaults defaults, InputHandler inputHandler, + Editor editor) { + super(defaults, inputHandler); + this.editor = editor; + + // change cursor to pointer in the gutter area + painter.addMouseMotionListener(gutterCursorMouseAdapter); + + add(CENTER, painter); + + // load settings from theme.txt + Mode mode = editor.getMode(); + gutterGradient = mode.makeGradient("editor", Editor.LEFT_GUTTER, 500); + } + + + @Override + protected TextAreaPainter createPainter(final TextAreaDefaults defaults) { + return new PdeTextAreaPainter(this, defaults); + } + + + public Image getGutterGradient() { + return gutterGradient; + } + + + public void setMode(Mode mode) { + ((PdeTextAreaPainter) painter).setMode(mode); + } + + + /** + * Set the gutter text of a specific line. + * + * @param lineIdx + * the line index (0-based) + * @param text + * the text + */ + public void setGutterText(int lineIdx, String text) { + gutterText.put(lineIdx, text); + painter.invalidateLine(lineIdx); + } + + + /** + * Clear the gutter text of a specific line. + * + * @param lineIdx + * the line index (0-based) + */ + public void clearGutterText(int lineIdx) { + gutterText.remove(lineIdx); + painter.invalidateLine(lineIdx); + } + + + /** + * Clear all gutter text. + */ + public void clearGutterText() { + for (int lineIdx : gutterText.keySet()) { + painter.invalidateLine(lineIdx); + } + gutterText.clear(); + } + + + /** + * Retrieve the gutter text of a specific line. + * @param lineIdx the line index (0-based) + * @return the gutter text + */ + public String getGutterText(int lineIdx) { + return gutterText.get(lineIdx); + } + + + /** + * Convert a character offset to a horizontal pixel position inside + * the text area. Overridden to take gutter width into account. + * @param line the 0-based line number + * @param offset the character offset (0 is the first character on a line) + * @return the horizontal position + */ + @Override + public int _offsetToX(int line, int offset) { + return super._offsetToX(line, offset) + Editor.LEFT_GUTTER; + } + + + /** + * Convert a horizontal pixel position to a character offset. Overridden to + * take gutter width into account. + * @param line the 0-based line number + * @param x the horizontal pixel position + * @return he character offset (0 is the first character on a line) + */ + @Override + public int xToOffset(int line, int x) { + return super.xToOffset(line, x - Editor.LEFT_GUTTER); + } + + + /** + * Sets default cursor (instead of text cursor) in the gutter area. + */ + protected final MouseMotionAdapter gutterCursorMouseAdapter = new MouseMotionAdapter() { + private int lastX; // previous horizontal position of the mouse cursor + + @Override + public void mouseMoved(MouseEvent me) { + if (me.getX() < Editor.LEFT_GUTTER) { + if (lastX >= Editor.LEFT_GUTTER) { + painter.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + } + } else { + if (lastX < Editor.LEFT_GUTTER) { + painter.setCursor(new Cursor(Cursor.TEXT_CURSOR)); + } + } + lastX = me.getX(); + } + }; + + + public Editor getEditor() { + return editor; + } +} \ No newline at end of file diff --git a/app/src/processing/app/syntax/PdeTextAreaPainter.java b/app/src/processing/app/syntax/PdeTextAreaPainter.java new file mode 100644 index 0000000000..24232f23e1 --- /dev/null +++ b/app/src/processing/app/syntax/PdeTextAreaPainter.java @@ -0,0 +1,349 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* +Part of the Processing project - http://processing.org +Copyright (c) 2012-16 The Processing Foundation + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +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. +*/ + +package processing.app.syntax; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.geom.GeneralPath; +import java.util.List; + +import javax.swing.text.BadLocationException; +import javax.swing.text.Segment; +import javax.swing.text.Utilities; + +import processing.app.Mode; +import processing.app.Problem; +import processing.app.ui.Editor; + + +/** + * Adds support to TextAreaPainter for background colors, + * and the left hand gutter area with background color and text. + */ +public class PdeTextAreaPainter extends TextAreaPainter { + public Color errorUnderlineColor; + public Color warningUnderlineColor; + + protected Font gutterTextFont; + protected Color gutterTextColor; + protected Color gutterPastColor; + protected Color gutterLineHighlightColor; + + + public PdeTextAreaPainter(JEditTextArea textArea, TextAreaDefaults defaults) { + super(textArea, defaults); + + // Handle mouse clicks to toggle breakpoints + addMouseListener(new MouseAdapter() { + long lastTime; // OS X seems to be firing multiple mouse events + + public void mousePressed(MouseEvent event) { + // Don't toggle breakpoints when the debugger isn't enabled + // https://github.com/processing/processing/issues/3306 + if (getEditor().isDebuggerEnabled()) { + long thisTime = event.getWhen(); + if (thisTime - lastTime > 100) { + if (event.getX() < Editor.LEFT_GUTTER) { + int offset = textArea.xyToOffset(event.getX(), event.getY()); + if (offset >= 0) { + int lineIndex = textArea.getLineOfOffset(offset); + getEditor().toggleBreakpoint(lineIndex); + } + } + lastTime = thisTime; + } + } + } + }); + } + + + /** + * Loads theme for TextAreaPainter. This is handled here because in the olden + * days, Modes had different visual design. Now, these are just pulling the + * defaults from the standard theme, though there may be minor additions or + * overrides added in a Mode's own theme.txt file. + */ + public void setMode(Mode mode) { + errorUnderlineColor = mode.getColor("editor.error.underline.color"); + warningUnderlineColor = mode.getColor("editor.warning.underline.color"); + + gutterTextFont = mode.getFont("editor.gutter.text.font"); + gutterTextColor = mode.getColor("editor.gutter.text.color"); + gutterPastColor = new Color(gutterTextColor.getRed(), + gutterTextColor.getGreen(), + gutterTextColor.getBlue(), + 96); + gutterLineHighlightColor = mode.getColor("editor.gutter.linehighlight.color"); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + /** + * Paint a line. Paints the gutter (with background color and text) + * then the line (background color and text). + * + * @param gfx the graphics context + * @param tokenMarker + * @param line 0-based line number + * @param x horizontal position + */ + @Override + protected void paintLine(Graphics gfx, int line, int x, TokenMarkerState marker) { + try { + // TODO This line is causing NPEs randomly ever since I added the + // toggle for Java Mode/Debugger toolbar. [Manindra] + super.paintLine(gfx, line, x + Editor.LEFT_GUTTER, marker); + + } catch (Exception e) { + e.printStackTrace(); + } + + paintLeftGutter(gfx, line, x); + paintErrorLine(gfx, line, x); + } + + + /** + * Paints the underline for an error/warning line + */ + protected void paintErrorLine(Graphics gfx, int line, int x) { + List problems = getEditor().findProblems(line); + for (Problem problem : problems) { + int startOffset = problem.getStartOffset(); + int stopOffset = problem.getStopOffset(); + + int lineOffset = textArea.getLineStartOffset(line); + + int wiggleStart = Math.max(startOffset, lineOffset); + int wiggleStop = Math.min(stopOffset, textArea.getLineStopOffset(line)); + + int y = textArea.lineToY(line) + fm.getLeading() + fm.getMaxDescent(); + + try { + String badCode = null; + String goodCode = null; + try { + SyntaxDocument doc = textArea.getDocument(); + badCode = doc.getText(wiggleStart, wiggleStop - wiggleStart); + goodCode = doc.getText(lineOffset, wiggleStart - lineOffset); + //log("paintErrorLine() LineText GC: " + goodCode); + //log("paintErrorLine() LineText BC: " + badCode); + } catch (BadLocationException bl) { + // Error in the import statements or end of code. + // System.out.print("BL caught. " + ta.getLineCount() + " ," + // + line + " ,"); + // log((ta.getLineStopOffset(line) - start - 1)); + return; + } + + int trimmedLength = badCode.trim().length(); + int rightTrimmedLength = trimRight(badCode).length(); + int leftTrimLength = rightTrimmedLength - trimmedLength; + + // Fix offsets when bad code is just whitespace + if (trimmedLength == 0) { + leftTrimLength = 0; + rightTrimmedLength = badCode.length(); + } + + int x1 = textArea.offsetToX(line, goodCode.length() + leftTrimLength); + int x2 = textArea.offsetToX(line, goodCode.length() + rightTrimmedLength); + if (x1 == x2) x2 += fm.stringWidth(" "); + int y1 = y + fm.getHeight() - 2; + + if (line != problem.getLineNumber()) { + x1 = Editor.LEFT_GUTTER; // on the following lines, wiggle extends to the left border + } + + gfx.setColor(errorUnderlineColor); + if (problem.isWarning()) { + gfx.setColor(warningUnderlineColor); + } + paintSquiggle(gfx, y1, x1, x2); + + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + + /** + * Paint the gutter: draw the background, draw line numbers, break points. + * @param gfx the graphics context + * @param line 0-based line number + * @param x horizontal position + */ + protected void paintLeftGutter(Graphics gfx, int line, int x) { + int y = textArea.lineToY(line) + fm.getLeading() + fm.getMaxDescent(); + if (line == textArea.getSelectionStopLine()) { + gfx.setColor(gutterLineHighlightColor); + gfx.fillRect(0, y, Editor.LEFT_GUTTER, fm.getHeight()); + } else { + //gfx.setColor(getJavaTextArea().gutterBgColor); + gfx.setClip(0, y, Editor.LEFT_GUTTER, fm.getHeight()); + gfx.drawImage(((PdeTextArea) textArea).getGutterGradient(), 0, 0, getWidth(), getHeight(), this); + gfx.setClip(null); // reset + } + + String text = null; + if (getEditor().isDebuggerEnabled()) { + text = getPdeTextArea().getGutterText(line); + } + + gfx.setColor(line < textArea.getLineCount() ? gutterTextColor : gutterPastColor); +// if (line >= textArea.getLineCount()) { +// //gfx.setColor(new Color(gutterTextColor.getRGB(), ); +// } + int textRight = Editor.LEFT_GUTTER - Editor.GUTTER_MARGIN; + int textBaseline = textArea.lineToY(line) + fm.getHeight(); + + if (text != null) { + if (text.equals(PdeTextArea.BREAK_MARKER)) { + drawDiamond(gfx, textRight - 8, textBaseline - 8, 8, 8); + + } else if (text.equals(PdeTextArea.STEP_MARKER)) { + //drawRightArrow(gfx, textRight - 7, textBaseline - 7, 7, 6); + drawRightArrow(gfx, textRight - 7, textBaseline - 7.5f, 7, 7); + } + } else { + // if no special text for a breakpoint, just show the line number + text = String.valueOf(line + 1); + //text = makeOSF(String.valueOf(line + 1)); + + gfx.setFont(gutterTextFont); +// ((Graphics2D) gfx).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, +// RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + // Right-align the text + char[] txt = text.toCharArray(); + int tx = textRight - gfx.getFontMetrics().charsWidth(txt, 0, txt.length); + // Using 'fm' here because it's relative to the editor text size, + // not the numbers in the gutter + Utilities.drawTabbedText(new Segment(txt, 0, text.length()), + tx, textBaseline, gfx, this, 0); + } + } + + + static private void drawDiamond(Graphics g, + float x, float y, float w, float h) { + Graphics2D g2 = (Graphics2D) g; + GeneralPath path = new GeneralPath(); + path.moveTo(x + w/2, y); + path.lineTo(x + w, y + h/2); + path.lineTo(x + w/2, y + h); + path.lineTo(x, y + h/2); + path.closePath(); + g2.fill(path); + } + + + static private void drawRightArrow(Graphics g, + float x, float y, float w, float h) { + Graphics2D g2 = (Graphics2D) g; + GeneralPath path = new GeneralPath(); + path.moveTo(x, y); + path.lineTo(x + w, y + h/2); + path.lineTo(x, y + h); + path.closePath(); + g2.fill(path); + } + + + /** + * Remove all trailing whitespace from a line + */ + static private String trimRight(String str) { + int i = str.length() - 1; + while (i >= 0 && Character.isWhitespace(str.charAt(i))) { + i--; + } + return str.substring(0, i+1); + } + + + static private void paintSquiggle(Graphics g, int y, int x1, int x2) { + int xx = x1; + + while (xx < x2) { + g.drawLine(xx, y, xx + 2, y + 1); + xx += 2; + g.drawLine(xx, y + 1, xx + 2, y); + xx += 2; + } + } + + + @Override + public String getToolTipText(MouseEvent event) { + int line = event.getY() / getFontMetrics().getHeight() + textArea.getFirstLine(); + if (line >= 0 || line < textArea.getLineCount()) { + List problems = getEditor().findProblems(line); + for (Problem problem : problems) { + int lineStart = textArea.getLineStartOffset(line); + int lineEnd = textArea.getLineStopOffset(line); + + int errorStart = problem.getStartOffset(); + int errorEnd = problem.getStopOffset() + 1; + + int startOffset = Math.max(errorStart, lineStart) - lineStart; + int stopOffset = Math.min(errorEnd, lineEnd) - lineStart; + + int x = event.getX(); + + if (x >= textArea.offsetToX(line, startOffset) && + x <= textArea.offsetToX(line, stopOffset)) { + getEditor().statusToolTip(this, problem.getMessage(), problem.isError()); + return super.getToolTipText(event); + } + } + } + setToolTipText(null); + return super.getToolTipText(event); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + @Override + public int getScrollWidth() { + // TODO https://github.com/processing/processing/issues/3591 + return super.getWidth() - Editor.LEFT_GUTTER; + } + + + public Editor getEditor() { + return getPdeTextArea().editor; + } + + + public PdeTextArea getPdeTextArea() { + return (PdeTextArea) textArea; + } +} diff --git a/app/src/processing/app/syntax/PdeKeywords.java b/app/src/processing/app/syntax/PdeTokenMarker.java similarity index 71% rename from app/src/processing/app/syntax/PdeKeywords.java rename to app/src/processing/app/syntax/PdeTokenMarker.java index a8fddcb259..7e12182876 100644 --- a/app/src/processing/app/syntax/PdeKeywords.java +++ b/app/src/processing/app/syntax/PdeTokenMarker.java @@ -29,11 +29,11 @@ import processing.app.ui.Editor; -public class PdeKeywords extends TokenMarker { +public class PdeTokenMarker extends TokenMarker { protected KeywordMap keywordColoring; - protected int lastOffset; - protected int lastKeyword; +// protected int lastOffset; +// protected int lastKeyword; /** @@ -71,11 +71,23 @@ public void addColoring(String keyword, String coloring) { } + class MarkerState { + int lastOffset; + int lastKeyword; + + MarkerState(int offset) { + lastOffset = offset; + lastKeyword = offset; + } + } + + public byte markTokensImpl(byte token, Segment line, int lineIndex) { char[] array = line.array; int offset = line.offset; - lastOffset = offset; - lastKeyword = offset; +// lastOffset = offset; +// lastKeyword = offset; + MarkerState ms = new MarkerState(offset); int mlength = offset + line.count; boolean backslash = false; @@ -96,52 +108,52 @@ public byte markTokensImpl(byte token, Segment line, int lineIndex) { backslash = false; break; case '"': - doKeyword(line, i, c); + doKeyword(ms, line, i, c); if (backslash) backslash = false; else { - addToken(i - lastOffset, token); + addToken(i - ms.lastOffset, token); token = Token.LITERAL1; - lastOffset = lastKeyword = i; + ms.lastOffset = ms.lastKeyword = i; } break; case '\'': - doKeyword(line, i, c); + doKeyword(ms, line, i, c); if (backslash) backslash = false; else { - addToken(i - lastOffset, token); + addToken(i - ms.lastOffset, token); token = Token.LITERAL2; - lastOffset = lastKeyword = i; + ms.lastOffset = ms.lastKeyword = i; } break; case ':': - if (lastKeyword == offset) { - if (doKeyword(line, i, c)) + if (ms.lastKeyword == offset) { + if (doKeyword(ms, line, i, c)) break; backslash = false; - addToken(i1 - lastOffset, Token.LABEL); - lastOffset = lastKeyword = i1; - } else if (doKeyword(line, i, c)) + addToken(i1 - ms.lastOffset, Token.LABEL); + ms.lastOffset = ms.lastKeyword = i1; + } else if (doKeyword(ms, line, i, c)) break; break; case '/': backslash = false; - doKeyword(line, i, c); + doKeyword(ms, line, i, c); if (mlength - i > 1) { switch (array[i1]) { case '*': - addToken(i - lastOffset, token); - lastOffset = lastKeyword = i; + addToken(i - ms.lastOffset, token); + ms.lastOffset = ms.lastKeyword = i; if (mlength - i > 2 && array[i + 2] == '*') token = Token.COMMENT2; else token = Token.COMMENT1; break; case '/': - addToken(i - lastOffset, token); + addToken(i - ms.lastOffset, token); addToken(mlength - i, Token.COMMENT1); - lastOffset = lastKeyword = mlength; + ms.lastOffset = ms.lastKeyword = mlength; break loop; } // https://github.com/processing/processing/issues/1681 @@ -153,7 +165,7 @@ public byte markTokensImpl(byte token, Segment line, int lineIndex) { default: backslash = false; if (!Character.isLetterOrDigit(c) && c != '_') { - doKeyword(line, i, c); + doKeyword(ms, line, i, c); } break; } @@ -164,9 +176,9 @@ public byte markTokensImpl(byte token, Segment line, int lineIndex) { if (c == '*' && mlength - i > 1) { if (array[i1] == '/') { i++; - addToken((i + 1) - lastOffset, token); + addToken((i + 1) - ms.lastOffset, token); token = Token.NULL; - lastOffset = lastKeyword = i + 1; + ms.lastOffset = ms.lastKeyword = i + 1; } } break; @@ -174,18 +186,18 @@ public byte markTokensImpl(byte token, Segment line, int lineIndex) { if (backslash) backslash = false; else if (c == '"') { - addToken(i1 - lastOffset, token); + addToken(i1 - ms.lastOffset, token); token = Token.NULL; - lastOffset = lastKeyword = i1; + ms.lastOffset = ms.lastKeyword = i1; } break; case Token.LITERAL2: if (backslash) backslash = false; else if (c == '\'') { - addToken(i1 - lastOffset, Token.LITERAL1); + addToken(i1 - ms.lastOffset, Token.LITERAL1); token = Token.NULL; - lastOffset = lastKeyword = i1; + ms.lastOffset = ms.lastKeyword = i1; } break; default: @@ -194,44 +206,44 @@ else if (c == '\'') { } if (token == Token.NULL) { - doKeyword(line, mlength, '\0'); + doKeyword(ms, line, mlength, '\0'); } switch (token) { case Token.LITERAL1: case Token.LITERAL2: - addToken(mlength - lastOffset, Token.INVALID); + addToken(mlength - ms.lastOffset, Token.INVALID); token = Token.NULL; break; case Token.KEYWORD2: - addToken(mlength - lastOffset, token); + addToken(mlength - ms.lastOffset, token); if (!backslash) token = Token.NULL; - addToken(mlength - lastOffset, token); + addToken(mlength - ms.lastOffset, token); break; default: - addToken(mlength - lastOffset, token); + addToken(mlength - ms.lastOffset, token); break; } return token; } - protected boolean doKeyword(Segment line, int i, char c) { + protected boolean doKeyword(MarkerState ms, Segment line, int i, char c) { int i1 = i + 1; - int len = i - lastKeyword; + int len = i - ms.lastKeyword; boolean paren = Editor.checkParen(line.array, i, line.array.length); - byte id = keywordColoring.lookup(line, lastKeyword, len, paren); + byte id = keywordColoring.lookup(line, ms.lastKeyword, len, paren); if (id != Token.NULL) { - if (lastKeyword != lastOffset) { - addToken(lastKeyword - lastOffset, Token.NULL); + if (ms.lastKeyword != ms.lastOffset) { + addToken(ms.lastKeyword - ms.lastOffset, Token.NULL); } addToken(len, id); - lastOffset = i; + ms.lastOffset = i; } - lastKeyword = i1; + ms.lastKeyword = i1; return false; } } diff --git a/app/src/processing/app/syntax/SyntaxDocument.java b/app/src/processing/app/syntax/SyntaxDocument.java index 25b50d69a0..cead844394 100644 --- a/app/src/processing/app/syntax/SyntaxDocument.java +++ b/app/src/processing/app/syntax/SyntaxDocument.java @@ -27,7 +27,7 @@ public class SyntaxDocument extends PlainDocument * of this document up into tokens. May return null if this * document is not to be colorized. */ - public TokenMarker getTokenMarker() + public TokenMarkerState getTokenMarker() { return tokenMarker; } @@ -40,9 +40,11 @@ public TokenMarker getTokenMarker() */ public void setTokenMarker(TokenMarker tm) { - tokenMarker = tm; - if(tm == null) + if (tm == null) { + tokenMarker = null; return; + } + tokenMarker = tm.createStateInstance(); tokenMarker.insertLines(0,getDefaultRootElement() .getElementCount()); tokenizeLines(); @@ -67,7 +69,7 @@ public void tokenizeLines() */ public void tokenizeLines(int start, int len) { - if(tokenMarker == null || !tokenMarker.supportsMultilineTokens()) + if(tokenMarker == null || !tokenMarker.marker.supportsMultilineTokens()) return; Segment lineSegment = new Segment(); @@ -118,7 +120,7 @@ public void endCompoundEdit() {} public void addUndoableEdit(UndoableEdit edit) {} // protected members - protected TokenMarker tokenMarker; + protected TokenMarkerState tokenMarker; /** * We overwrite this method to update the token marker diff --git a/app/src/processing/app/syntax/SyntaxStyle.java b/app/src/processing/app/syntax/SyntaxStyle.java index 9415a4bf07..39c5407817 100644 --- a/app/src/processing/app/syntax/SyntaxStyle.java +++ b/app/src/processing/app/syntax/SyntaxStyle.java @@ -30,9 +30,9 @@ 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 */ +// * @param italic True if the text should be italics // public SyntaxStyle(Color color, boolean italic, boolean bold) { public SyntaxStyle(Color color, boolean bold) { this.color = color; diff --git a/app/src/processing/app/syntax/TextAreaDefaults.java b/app/src/processing/app/syntax/TextAreaDefaults.java index 4adab96733..493ad0e574 100644 --- a/app/src/processing/app/syntax/TextAreaDefaults.java +++ b/app/src/processing/app/syntax/TextAreaDefaults.java @@ -18,10 +18,6 @@ * creating the text area is that this method is faster. */ public class TextAreaDefaults { - // For 3.0a6, the InputHandler object was broken out because it has little - // to do with this code and created circuitous connections between classes. - //public InputHandler inputHandler; - public SyntaxDocument document; public boolean caretVisible; @@ -29,10 +25,10 @@ public class TextAreaDefaults { public boolean blockCaret; public int electricScroll; - // default/preferred number of rows/cols + // default/preferred number of rows/cols public int cols; public int rows; - + public SyntaxStyle[] styles; public Color caretColor; public Color selectionColor; diff --git a/app/src/processing/app/syntax/TextAreaPainter.java b/app/src/processing/app/syntax/TextAreaPainter.java index 134b9966da..86e1ce2dc1 100644 --- a/app/src/processing/app/syntax/TextAreaPainter.java +++ b/app/src/processing/app/syntax/TextAreaPainter.java @@ -10,9 +10,15 @@ */ package processing.app.syntax; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.RenderingHints; import java.awt.event.MouseEvent; -import java.awt.*; -import java.awt.print.*; import javax.swing.ToolTipManager; import javax.swing.text.*; @@ -20,6 +26,7 @@ import processing.app.Preferences; import processing.app.syntax.im.CompositionTextPainter; +import processing.app.ui.Toolkit; /** @@ -28,9 +35,6 @@ * @author Slava Pestov */ public class TextAreaPainter extends JComponent implements TabExpander { - /** True if inside printing, will handle disabling the highlight */ - boolean printing; - /** A specific painter composed by the InputMethod.*/ protected CompositionTextPainter compositionTextPainter; @@ -47,7 +51,7 @@ public class TextAreaPainter extends JComponent implements TabExpander { // protected boolean bracketHighlight; // protected Color eolMarkerColor; // protected boolean eolMarkers; - + // protected int cols; // protected int rows; @@ -62,7 +66,7 @@ public class TextAreaPainter extends JComponent implements TabExpander { protected FontMetrics fm; protected Highlight highlights; - + int currentLineIndex; Token currentLineTokens; Segment currentLine; @@ -104,21 +108,22 @@ public TextAreaPainter(JEditTextArea textArea, TextAreaDefaults defaults) { // eolMarkerColor = defaults.eolMarkerColor; // eolMarkers = defaults.eolMarkers; // antialias = defaults.antialias; - + // cols = defaults.cols; // rows = defaults.rows; } - - + + public void updateAppearance() { -// // unfortunately probably can't just do setDefaults() since things aren't quite set up -// setFont(defaults.plainFont); -//// System.out.println("defaults font is " + defaults.font); setForeground(defaults.fgcolor); setBackground(defaults.bgcolor); - + + // Ensure that our monospaced font is loaded + // https://github.com/processing/processing/pull/4639 + Toolkit.getMonoFontName(); + String fontFamily = Preferences.get("editor.font.family"); - int fontSize = Preferences.getInteger("editor.font.size"); + final int fontSize = Toolkit.zoom(Preferences.getInteger("editor.font.size")); plainFont = new Font(fontFamily, Font.PLAIN, fontSize); if (!fontFamily.equals(plainFont.getFamily())) { System.err.println(fontFamily + " not available, resetting to monospaced"); @@ -128,24 +133,20 @@ public void updateAppearance() { } boldFont = new Font(fontFamily, Font.BOLD, fontSize); antialias = Preferences.getBoolean("editor.smooth"); -// System.out.println(plainFont.getFamily()); -// System.out.println(plainFont); // moved from setFont() override (never quite comfortable w/ that override) fm = super.getFontMetrics(plainFont); + tabSize = fm.charWidth(' ') * Preferences.getInteger("editor.tabs.size"); textArea.recalculateVisibleLines(); - -// fgcolor = mode.getColor("editor.fgcolor"); -// bgcolor = mode.getColor("editor.bgcolor"); } - - + + /* public void setDefaults(TextAreaDefaults defaults) { setFont(defaults.font); setForeground(defaults.fgcolor); setBackground(defaults.bgcolor); - + setBlockCaretEnabled(defaults.blockCaret); setStyles(defaults.styles); setCaretColor(defaults.caretColor); @@ -157,7 +158,7 @@ public void setDefaults(TextAreaDefaults defaults) { setEOLMarkerColor(defaults.eolMarkerColor); setEOLMarkersPainted(defaults.eolMarkers); setAntialias(defaults.antialias); - + // only used for getPreferredSize() cols = defaults.cols; rows = defaults.rows; @@ -197,7 +198,7 @@ public final SyntaxStyle[] getStyles() { // repaint(); // } - + // /** // * Returns the caret color. // */ @@ -205,7 +206,7 @@ public final SyntaxStyle[] getStyles() { // return caretColor; // } - + // /** // * Sets the caret color. // * @param caretColor The caret color @@ -215,7 +216,7 @@ public final SyntaxStyle[] getStyles() { // invalidateSelectedLines(); // } - + // /** // * Returns the selection color. // */ @@ -223,7 +224,7 @@ public final SyntaxStyle[] getStyles() { // return selectionColor; // } - + // /** // * Sets the selection color. // * @param selectionColor The selection color @@ -241,7 +242,7 @@ public final SyntaxStyle[] getStyles() { // return lineHighlightColor; // } - + // /** // * Sets the line highlight color. // * @param lineHighlightColor The line highlight color @@ -259,7 +260,7 @@ public final SyntaxStyle[] getStyles() { // return lineHighlight; // } - + /** * Enables or disables current line highlighting. * @param lineHighlight True if current line highlight @@ -271,7 +272,7 @@ public final void setLineHighlightEnabled(boolean lineHighlight) { invalidateSelectedLines(); } - + // /** // * Returns the bracket highlight color. // */ @@ -279,7 +280,7 @@ public final void setLineHighlightEnabled(boolean lineHighlight) { // return bracketHighlightColor; // } - + // /** // * Sets the bracket highlight color. // * @param bracketHighlightColor The bracket highlight color @@ -288,7 +289,7 @@ public final void setLineHighlightEnabled(boolean lineHighlight) { // this.bracketHighlightColor = bracketHighlightColor; // invalidateLine(textArea.getBracketLine()); // } - + /** * Returns true if bracket highlighting is enabled, false otherwise. @@ -321,7 +322,7 @@ public final boolean isBlockCaretEnabled() { return defaults.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, @@ -358,7 +359,7 @@ public final boolean isBlockCaretEnabled() { // return eolMarkers; // } - + // /** // * Sets if EOL markers are to be drawn. // * @param eolMarkers True if EOL markers should be drawn, false otherwise @@ -367,8 +368,8 @@ public final boolean isBlockCaretEnabled() { // this.eolMarkers = eolMarkers; // repaint(); // } - - + + // public final void setAntialias(boolean antialias) { // this.antialias = antialias; // } @@ -423,20 +424,26 @@ public interface Highlight { // return (highlights == null) ? null : highlights.getToolTipText(evt); // } - + /** Returns the font metrics used by this component. */ public FontMetrics getFontMetrics() { return fm; } - + public FontMetrics getFontMetrics(SyntaxStyle style) { -// return getFontMetrics(style.isBold() ? +// return getFontMetrics(style.isBold() ? // defaults.boldFont : defaults.plainFont); return getFontMetrics(style.isBold() ? boldFont : plainFont); } + // fry [160806 for 3.2] + public int getLineHeight() { + return fm.getHeight() + fm.getDescent(); + } + + // /** // * Sets the font for this component. This is overridden to update the // * cached font metrics and to recalculate which lines are visible. @@ -465,8 +472,6 @@ public void paint(Graphics gfx) { // g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, // RenderingHints.VALUE_FRACTIONALMETRICS_ON); - tabSize = fm.charWidth(' ') * ((Integer)textArea.getDocument().getProperty(PlainDocument.tabSizeAttribute)).intValue(); - Rectangle clipRect = gfx.getClipBounds(); gfx.setColor(getBackground()); @@ -483,7 +488,7 @@ public void paint(Graphics gfx) { int lastInvalid = firstLine + (clipRect.y + clipRect.height - 1) / height; try { - TokenMarker tokenMarker = textArea.getDocument().getTokenMarker(); + TokenMarkerState tokenMarker = textArea.getDocument().getTokenMarker(); int x = textArea.getHorizontalOffset(); for (int line = firstInvalid; line <= lastInvalid; line++) { @@ -495,45 +500,13 @@ public void paint(Graphics gfx) { repaint(0, h, getWidth(), getHeight() - h); } } catch (Exception e) { - System.err.println("Error repainting line" + + System.err.println("Error repainting line" + " range {" + firstInvalid + "," + lastInvalid + "}:"); e.printStackTrace(); } } - public Printable getPrintable() { - return new Printable() { - - @Override - public int print(Graphics graphics, PageFormat pageFormat, - int pageIndex) throws PrinterException { - 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 g2 = (Graphics2D) graphics; - TokenMarker tokenMarker = textArea.getDocument().getTokenMarker(); - int firstLine = pageIndex*linesPerPage; - g2.translate(Math.max(54, pageFormat.getImageableX()), - pageFormat.getImageableY() - firstLine*lineHeight); - printing = true; - for (int line = firstLine; line < firstLine + linesPerPage; line++) { - paintLine(g2, line, 0, tokenMarker); - } - printing = false; - return PAGE_EXISTS; - } - } - }; - } - - /** * Marks a line as needing a repaint. * @param line The line to invalidate @@ -543,7 +516,7 @@ final public void invalidateLine(int line) { getWidth(), fm.getHeight()); } - + /** * Marks a range of lines as needing a repaint. * @param firstLine The first line to invalidate @@ -555,14 +528,14 @@ final void invalidateLineRange(int firstLine, int lastLine) { getWidth(),(lastLine - firstLine + 1) * fm.getHeight()); } - + /** Repaints the lines containing the selection. */ final void invalidateSelectedLines() { invalidateLineRange(textArea.getSelectionStartLine(), textArea.getSelectionStopLine()); } - + /** Returns next tab stop after a specified point. */ // TabExpander tabExpander = new TabExpander() { @Override @@ -597,7 +570,7 @@ public Dimension getMinimumSize() { public int getCurrentLineIndex() { return currentLineIndex; } - + /** * Accessor used by tools that want to hook in and grab the formatting. @@ -605,7 +578,7 @@ public int getCurrentLineIndex() { public void setCurrentLineIndex(int what) { currentLineIndex = what; } - + /** * Accessor used by tools that want to hook in and grab the formatting. @@ -614,14 +587,14 @@ 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. @@ -631,18 +604,12 @@ public Segment getCurrentLine() { } -// /** Old paintLine() method with kooky args order, kept around for X Mode. */ -// @Deprecated -// protected void paintLine(Graphics gfx, TokenMarker tokenMarker, -// int line, int x) { -// Font defaultFont = getFont(); -// Color defaultColor = getForeground(); - protected void paintLine(Graphics gfx, int line, int x, - TokenMarker tokenMarker) { + protected void paintLine(Graphics gfx, int line, int x, + TokenMarkerState tokenMarker) { currentLineIndex = line; int y = textArea.lineToY(line); - if (tokenMarker == null) { + if (tokenMarker == null) { //paintPlainLine(gfx, line, defaultFont, defaultColor, x, y); paintPlainLine(gfx, line, x, y); } else if (line >= 0 && line < textArea.getLineCount()) { @@ -650,53 +617,49 @@ protected void paintLine(Graphics gfx, int line, int x, paintSyntaxLine(gfx, line, x, y, tokenMarker); } } - - -// protected void paintLine(Graphics gfx, int line, int x, -// TokenMarker tokenMarker) { -// paintLine(gfx, tokenMarker, line, x); -// } - -// protected void paintPlainLine(Graphics gfx, int line, Font defaultFont, -// Color defaultColor, int x, int y) { + protected void paintPlainLine(Graphics gfx, int line, int x, int y) { - if (!printing) { - paintHighlight(gfx,line,y); - } - textArea.getLineText(line, currentLine); + paintHighlight(gfx, line, y); -// gfx.setFont(plainFont); -// gfx.setFont(defaultFont); -// gfx.setColor(defaultColor); + // don't try to draw lines past where they exist in the document + // https://github.com/processing/processing/issues/5628 + if (line < textArea.getLineCount()) { + textArea.getLineText(line, currentLine); - y += fm.getHeight(); - // doesn't respect fixed width like it should + int x0 = x - textArea.getHorizontalOffset(); + // prevent the blinking from drawing with last color used + // https://github.com/processing/processing/issues/5628 + gfx.setColor(defaults.fgcolor); + gfx.setFont(plainFont); + + y += fm.getHeight(); + // doesn't respect fixed width like it should // x = Utilities.drawTabbedText(currentLine, x, y, gfx, this, 0); // int w = fm.charWidth(' '); - for (int i = 0; i < currentLine.count; i++) { - gfx.drawChars(currentLine.array, currentLine.offset+i, 1, x, y); - x = currentLine.array[currentLine.offset + i] == '\t' ? (int)nextTabStop(x, i) : + for (int i = 0; i < currentLine.count; i++) { + gfx.drawChars(currentLine.array, currentLine.offset+i, 1, x, y); + x = currentLine.array[currentLine.offset + i] == '\t' ? + x0 + (int)nextTabStop(x - x0, i) : x + fm.charWidth(currentLine.array[currentLine.offset+i]); - } + //textArea.offsetToX(line, currentLine.offset + i); + } - // Draw characters via input method. - if (compositionTextPainter != null && + // Draw characters via input method. + if (compositionTextPainter != null && compositionTextPainter.hasComposedTextLayout()) { - compositionTextPainter.draw(gfx, defaults.lineHighlightColor); + compositionTextPainter.draw(gfx, defaults.lineHighlightColor); + } } if (defaults.eolMarkers) { gfx.setColor(defaults.eolMarkerColor); gfx.drawString(".", x, y); } } - -// protected void paintSyntaxLine(Graphics gfx, TokenMarker tokenMarker, -// int line, Font defaultFont, -// Color defaultColor, int x, int y) { - protected void paintSyntaxLine(Graphics gfx, int line, int x, int y, - TokenMarker tokenMarker) { + + protected void paintSyntaxLine(Graphics gfx, int line, int x, int y, + TokenMarkerState tokenMarker) { textArea.getLineText(currentLineIndex, currentLine); currentLineTokens = tokenMarker.markTokens(currentLine, currentLineIndex); @@ -712,8 +675,8 @@ protected void paintSyntaxLine(Graphics gfx, int line, int x, int y, x = paintSyntaxLine(gfx, currentLine, x, y, currentLineTokens, defaults.styles); - // Draw characters via input method. - if (compositionTextPainter != null && + // Draw characters via input method. + if (compositionTextPainter != null && compositionTextPainter.hasComposedTextLayout()) { compositionTextPainter.draw(gfx, defaults.lineHighlightColor); } @@ -722,8 +685,8 @@ protected void paintSyntaxLine(Graphics gfx, int line, int x, int y, gfx.drawString(".", x, y); } } - - + + /** * Paints the specified line onto the graphics context. Note that this * method munges the offset and count values of the segment. @@ -740,11 +703,13 @@ protected void paintSyntaxLine(Graphics gfx, int line, int x, int y, // public int paintSyntaxLine(Segment line, Token tokens, SyntaxStyle[] styles, // TabExpander expander, Graphics gfx, // int x, int y) { - protected int paintSyntaxLine(Graphics gfx, Segment line, int x, int y, + protected int paintSyntaxLine(Graphics gfx, Segment line, int x, int y, Token tokens, SyntaxStyle[] styles) { // Font defaultFont = gfx.getFont(); // Color defaultColor = gfx.getColor(); + int x0 = x - textArea.getHorizontalOffset(); + // for (byte id = tokens.id; id != Token.END; tokens = tokens.next) { for (;;) { byte id = tokens.id; @@ -772,8 +737,9 @@ protected int paintSyntaxLine(Graphics gfx, Segment line, int x, int y, // int w = fm.charWidth(' '); for (int i = 0; i < line.count; i++) { gfx.drawChars(line.array, line.offset+i, 1, x, y); - x = line.array[line.offset + i] == '\t' ? (int)nextTabStop(x, i) : - x + fm.charWidth(line.array[line.offset+i]); + x = line.array[line.offset + i] == '\t' ? + x0 + (int)nextTabStop(x - x0, i) : + x + fm.charWidth(line.array[line.offset+i]); } //x += fm.charsWidth(line.array, line.offset, line.count); //x += fm.charWidth(' ') * line.count; @@ -786,9 +752,8 @@ protected int paintSyntaxLine(Graphics gfx, Segment line, int x, int y, } - protected void paintHighlight(Graphics gfx, int line, int y) {//, boolean printing) { -// if (!printing) { - if (line >= textArea.getSelectionStartLine() && + protected void paintHighlight(Graphics gfx, int line, int y) { + if (line >= textArea.getSelectionStartLine() && line <= textArea.getSelectionStopLine()) { paintLineHighlight(gfx, line, y); } @@ -806,7 +771,7 @@ protected void paintHighlight(Graphics gfx, int line, int y) {//, boolean printi } } - + protected void paintLineHighlight(Graphics gfx, int line, int y) { int height = fm.getHeight(); y += fm.getLeading() + fm.getMaxDescent(); @@ -827,13 +792,7 @@ protected void paintLineHighlight(Graphics gfx, int line, int y) { 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) { + if (selectionStartLine == selectionEndLine) { x1 = textArea._offsetToX(line, selectionStart - lineStart); x2 = textArea._offsetToX(line, selectionEnd - lineStart); } else if(line == selectionStartLine) { @@ -861,7 +820,7 @@ protected void paintLineHighlight(Graphics gfx, int line, int y) { } } - + protected void paintBracketHighlight(Graphics gfx, int line, int y) { int position = textArea.getBracketPosition(); if (position != -1) { @@ -875,7 +834,7 @@ protected void paintBracketHighlight(Graphics gfx, int line, int y) { } } - + protected void paintCaret(Graphics gfx, int line, int y) { //System.out.println("painting caret " + line + " " + y); if (textArea.isCaretVisible()) { @@ -911,4 +870,10 @@ protected void paintCaret(Graphics gfx, int line, int y) { } } } + + + public int getScrollWidth() { + // https://github.com/processing/processing/issues/3591 + return super.getWidth(); + } } diff --git a/app/src/processing/app/syntax/TokenMarker.java b/app/src/processing/app/syntax/TokenMarker.java index 0e414e901e..57d76e6b7b 100644 --- a/app/src/processing/app/syntax/TokenMarker.java +++ b/app/src/processing/app/syntax/TokenMarker.java @@ -15,7 +15,7 @@ * 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 @@ -23,321 +23,68 @@ * * @author Slava Pestov */ -public abstract class TokenMarker -{ - abstract public void addColoring(String keyword, String coloring); - - /** - * 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. - */ - private static 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; - } +public abstract class TokenMarker { + + public interface TokenListener { + void addToken(int length, byte id); + } + + // Only needed during markTokensImpl() call so addToken() can be forwarded + private TokenListener tokenListener = null; + + public final void setTokenListener(TokenListener listener) { + this.tokenListener = listener; + } + + public final TokenMarkerState createStateInstance() { + return new TokenMarkerState(this); + } + + /** + * Creates a new TokenMarker. This DOES NOT create + * a lineInfo array; an initial call to insertLines() + * does that. + */ + protected TokenMarker() { } + + abstract public void addColoring(String keyword, String coloring); + + /** + * 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); + + protected final void addToken(int length, byte id) { + if (tokenListener != null) { + tokenListener.addToken(length, id); + } + } + + /** + * 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; + } } diff --git a/app/src/processing/app/syntax/TokenMarkerState.java b/app/src/processing/app/syntax/TokenMarkerState.java new file mode 100644 index 0000000000..8b20b2603c --- /dev/null +++ b/app/src/processing/app/syntax/TokenMarkerState.java @@ -0,0 +1,266 @@ +package processing.app.syntax; + +import javax.swing.text.Segment; + +/** + * This class serves only as a workaround to preserve API and should be removed + * in the next major version. Base TokenMarker which serves as superclass for + * token markes for various modes is stateful, but single instance was shared + * between all tabs and Editors. This caused inherent bugs by leaking state + * between contexts. + * + * TokenMarker subclasses now serve two purposes: they keep keyword list and + * they override markTokensImpl to provide the marking logic. + * + * Since each tab and Editor should have it's own token marker state, I extracted + * most of the fields and associated metods working with them from TokenMarker + * into this class, and allowed TokenMarker to create instances of this class + * when requested. + * + * The way marking logic is handled is unfortunate, since markTokensImpl is + * expected to call addToken() of TokenMarker superclass instead of – for + * example - returning a List of tokens. I worked around this by plugging in + * TokenMarkerState instance as listener before markTokensImpl is called. + * This behavior is safe since TokenMarker is always operated from Event + * Dispatch Thread and no multithreading is involved. + * + * This allows having only single instance of TokenMarker in a way it was + * intended before while keeping state separate for each tab. + * + * In the next major version TokenMarker shound be redesigned with following + * requirements in mind: + * - Single instance of keyword list and other common data, initialized by Mode + * - Each tab should have its own instance of TokenMarker containing its state + * - Support multiple flavors for different doc types + * - Other modes should provide logic in a way which is compatible with + * multiple states (pure function? Function object?). + * Currently state, logic and keywords list are tied together into one + * TokenMarker instance, which leads to need for this workaround. + */ +public class TokenMarkerState { + + protected TokenMarker marker; + + protected TokenMarkerState(TokenMarker marker) { + this.marker = marker; + } + + /** + * 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 byte[] 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 = -1; + + /** + * True if the next line should be painted. + */ + protected boolean nextLineRequested; + + /** + * 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); + } + + marker.setTokenListener(this::addToken); + + lastToken = null; + + byte prev = (lineIndex == 0) ? Token.NULL : lineInfo[lineIndex - 1]; + + byte oldToken = lineInfo[lineIndex]; + byte token = marker.markTokensImpl(prev, line, lineIndex); + + marker.setTokenListener(null); + + lineInfo[lineIndex] = 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; + } + + /** + * 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] = Token.NULL; + } + } + + /** + * 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; + } + + /** + * 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 byte[index + 1]; + } else if (lineInfo.length <= index) { + byte[] lineInfoN = new byte[(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; + } + } +} diff --git a/app/src/processing/app/syntax/im/CompositionTextManager.java b/app/src/processing/app/syntax/im/CompositionTextManager.java index 12a9ad341c..a7cc100208 100644 --- a/app/src/processing/app/syntax/im/CompositionTextManager.java +++ b/app/src/processing/app/syntax/im/CompositionTextManager.java @@ -5,6 +5,7 @@ import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; +import java.awt.RenderingHints; import java.awt.font.FontRenderContext; import java.awt.font.TextAttribute; import java.awt.font.TextLayout; @@ -14,9 +15,12 @@ import javax.swing.text.BadLocationException; +import processing.app.Messages; +import processing.app.Preferences; import processing.app.syntax.JEditTextArea; import processing.app.syntax.TextAreaPainter; + /** * This class Manage texts from input method * by begin-process-end steps. @@ -73,7 +77,7 @@ public void insertFullWidthSpace() { * This method initializes text manager. * * @param text Text from InputMethodEvent. - * @param commited_count Numbers of committed characters in text. + * @param committed_count Numbers of committed characters in text. */ public void beginCompositionText(AttributedCharacterIterator text, int committed_count) { isInputProcess = true; @@ -87,7 +91,7 @@ public void beginCompositionText(AttributedCharacterIterator text, int committed * select candidates from input method. * * @param text Text from InputMethodEvent. - * @param commited_count Numbers of committed characters in text. + * @param committed_count Numbers of committed characters in text. */ public void processCompositionText(AttributedCharacterIterator text, int committed_count) { int layoutCaretPosition = initialCaretPosition + committed_count; @@ -125,7 +129,7 @@ private boolean canRemovePreviousInput(int committed_count){ * composition text. This method resets CompositionTextPainter. * * @param text Text from InputMethodEvent. - * @param commited_count Numbers of committed characters in text. + * @param committed_count Numbers of committed characters in text. */ public void endCompositionText(AttributedCharacterIterator text, int committed_count) { /* @@ -153,13 +157,25 @@ private void removeNotCommittedText(AttributedCharacterIterator text){ } } - private TextLayout getTextLayout(AttributedCharacterIterator text, int committed_count) { - AttributedString composed = new AttributedString(text, committed_count, text.getEndIndex()); - Font font = textArea.getPainter().getFont(); - FontRenderContext context = ((Graphics2D) (textArea.getPainter().getGraphics())).getFontRenderContext(); + private TextLayout getTextLayout(AttributedCharacterIterator text, int committedCount) { + boolean antialias = Preferences.getBoolean("editor.smooth"); + TextAreaPainter painter = textArea.getPainter(); + + // create attributed string with font info. + AttributedString composed = new AttributedString(text, committedCount, text.getEndIndex()); + Font font = painter.getFontMetrics().getFont(); composed.addAttribute(TextAttribute.FONT, font); - TextLayout layout = new TextLayout(composed.getIterator(), context); - return layout; + + // set hint of antialiasing to render target. + Graphics2D g2d = (Graphics2D)painter.getGraphics(); + g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + antialias ? + RenderingHints.VALUE_TEXT_ANTIALIAS_ON : + RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + FontRenderContext frc = g2d.getFontRenderContext(); + Messages.log("debug: FontRenderContext is Antialiased = " + frc.getAntiAliasingHint()); + + return new TextLayout(composed.getIterator(), frc); } private Point getCaretLocation() { diff --git a/app/src/processing/app/syntax/im/CompositionTextPainter.java b/app/src/processing/app/syntax/im/CompositionTextPainter.java index c12d7ed300..b31ad9271e 100644 --- a/app/src/processing/app/syntax/im/CompositionTextPainter.java +++ b/app/src/processing/app/syntax/im/CompositionTextPainter.java @@ -1,31 +1,34 @@ package processing.app.syntax.im; import java.awt.Color; -import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; +import java.awt.Rectangle; +import java.awt.font.TextHitInfo; import java.awt.font.TextLayout; import processing.app.syntax.JEditTextArea; + /** - * Paint texts from input method. Text via input method are transmitted by - * AttributedCaharacterIterator. This class helps the PDE's TextAreaPainter + * Paint texts from input method. Text via input method are transmitted by + * AttributedCaharacterIterator. This class helps the PDE's TextAreaPainter * to handle AttributedCaharacterIterator. - * + * * For practical purposes, paint to textarea is done by TextLayout class. - * Because TextLayout class is easy to draw composing texts. (For example, + * Because TextLayout class is easy to draw composing texts. (For example, * draw underline composing texts, focus when select from candidates text.) - * + * * @author Takashi Maekawa (takachin@generative.info) */ public class CompositionTextPainter { private TextLayout composedTextLayout; private int composedBeginCaretPosition = 0; private JEditTextArea textArea; + private boolean caretColorFlag; + private TextHitInfo caret; - /** * Constructor for painter. * @param textArea textarea used by PDE. @@ -35,29 +38,27 @@ public CompositionTextPainter(JEditTextArea textArea) { composedTextLayout = null; } - + /** * Check the painter has TextLayout. * If a user input via InputMethod, this result will return true. - * @param textarea textarea used by PDE. */ public boolean hasComposedTextLayout() { return (composedTextLayout != null); } - - + + /** * Set TextLayout to the painter. * TextLayout will be created and set by CompositionTextManager. - * + * * @see CompositionTextManager - * @param textarea textarea used by PDE. */ public void setComposedTextLayout(TextLayout composedTextLayout, int composedStartCaretPosition) { this.composedTextLayout = composedTextLayout; this.composedBeginCaretPosition = composedStartCaretPosition; } - + /** * Invalidate this TextLayout to set null. @@ -68,60 +69,87 @@ public void invalidateComposedTextLayout(int composedEndCaretPosition) { this.composedBeginCaretPosition = composedEndCaretPosition; //this.composedBeginCaretPosition = textArea.getCaretPosition(); } - - + + /** * Draw text via input method with composed text information. - * This method can draw texts with some underlines to illustrate converting characters. - * + * This method can draw texts with some underlines to illustrate converting characters. + * * This method is workaround for TextAreaPainter. * Because, TextAreaPainter can't treat AttributedCharacterIterator directly. * AttributedCharacterIterator has very important information when composing text. * It has a map where are converted characters and committed characters. * Ideally, changing TextAreaPainter method can treat AttributedCharacterIterator is better. But it's very tough!! * So I choose to write some code as a workaround. - * + * * This draw method is proceeded with the following steps. - * 1. Original TextAreaPainter draws characters. - * 2. This refillComposedArea method erase previous paint characters by textarea's background color. - * The refill area is only square that width and height defined by characters with input method. - * 3. CompositionTextPainter.draw method paints composed text. It was actually drawn by TextLayout. - * + * 1. Original TextAreaPainter draws characters. + * 2. CompositionTextPainter.draw method paints composed text. It was actually drawn by TextLayout. + * * @param gfx set TextAreaPainter's Graphics object. * @param fillBackGroundColor set textarea's background. */ +// public void draw(Graphics gfx, Color fillBackGroundColor) { +// assert(composedTextLayout != null); +// Point composedLoc = getCaretLocation(); +// //refillComposedArea(fillBackGroundColor, composedLoc.x, composedLoc.y); +// composedTextLayout.draw((Graphics2D) gfx, composedLoc.x, composedLoc.y); +// } public void draw(Graphics gfx, Color fillBackGroundColor) { - assert(composedTextLayout != null); - Point composedLoc = getCaretLocation(); - refillComposedArea(fillBackGroundColor, composedLoc.x, composedLoc.y); - composedTextLayout.draw((Graphics2D) gfx, composedLoc.x, composedLoc.y); - } - + //assert(composedTextLayout != null); + if (composedTextLayout != null) { + Point composedLoc = getCaretLocation(); + //refillComposedArea(fillBackGroundColor, composedLoc.x, composedLoc.y); + composedTextLayout.draw((Graphics2D) gfx, composedLoc.x, composedLoc.y); - /** - * Fill color to erase characters drawn by original TextAreaPainter. - * - * @param fillColor fill color to erase characters drawn by original TextAreaPainter method. - * @param x x-coordinate where to fill. - * @param y y-coordinate where to fill. - */ - private void refillComposedArea(Color fillColor, int x, int y) { - Graphics gfx = textArea.getPainter().getGraphics(); - gfx.setColor(fillColor); - FontMetrics fm = textArea.getPainter().getFontMetrics(); - int newY = y - (fm.getHeight() - CompositionTextManager.COMPOSING_UNDERBAR_HEIGHT); - int paintHeight = fm.getHeight(); - int paintWidth = (int) composedTextLayout.getBounds().getWidth(); - gfx.fillRect(x, newY, paintWidth, paintHeight); + // draw caret. + if (this.caret != null) { + int caretLocation = Math.round(composedTextLayout.getCaretInfo(caret)[0]); + Rectangle rect = new Rectangle(composedLoc.x + caretLocation, + composedLoc.y - (int)composedTextLayout.getAscent(), + 1, + (int)composedTextLayout.getAscent() + (int)composedTextLayout.getDescent()); + Color c = gfx.getColor(); // save + if (caretColorFlag) { + caretColorFlag = false; + gfx.setColor(Color.WHITE); + } else { + caretColorFlag = true; + gfx.setColor(Color.BLACK); + } + gfx.fillRect(rect.x, rect.y, rect.width, rect.height); + gfx.setColor(c); // restore + } + } } - + +// /** +// * Fill color to erase characters drawn by original TextAreaPainter. +// * +// * @param fillColor fill color to erase characters drawn by original TextAreaPainter method. +// * @param x x-coordinate where to fill. +// * @param y y-coordinate where to fill. +// */ +// private void refillComposedArea(Color fillColor, int x, int y) { +// Graphics gfx = textArea.getPainter().getGraphics(); +// gfx.setColor(fillColor); +// FontMetrics fm = textArea.getPainter().getFontMetrics(); +// int newY = y - (fm.getHeight() - CompositionTextManager.COMPOSING_UNDERBAR_HEIGHT); +// int paintHeight = fm.getHeight(); +// int paintWidth = (int) composedTextLayout.getBounds().getWidth(); +// gfx.fillRect(x, newY, paintWidth, paintHeight); +// } + private Point getCaretLocation() { - FontMetrics fm = textArea.getPainter().getFontMetrics(); - int offsetY = fm.getHeight() - CompositionTextManager.COMPOSING_UNDERBAR_HEIGHT; - int lineIndex = textArea.getCaretLine(); - int offsetX = composedBeginCaretPosition - textArea.getLineStartOffset(lineIndex); - return new Point(textArea.offsetToX(lineIndex, offsetX), - (lineIndex - textArea.getFirstLine()) * fm.getHeight() + offsetY); + int line = textArea.getCaretLine(); + int offsetX = composedBeginCaretPosition - textArea.getLineStartOffset(line); + // '+1' mean textArea.lineToY(line) + textArea.getPainter().getFontMetrics().getHeight(). + // TextLayout#draw method need at least one height of font. + return new Point(textArea.offsetToX(line, offsetX), textArea.lineToY(line + 1)); + } + + public void setCaret(TextHitInfo caret) { + this.caret = caret; } } diff --git a/app/src/processing/app/syntax/im/InputMethodSupport.java b/app/src/processing/app/syntax/im/InputMethodSupport.java index 461be3d167..347480552d 100644 --- a/app/src/processing/app/syntax/im/InputMethodSupport.java +++ b/app/src/processing/app/syntax/im/InputMethodSupport.java @@ -1,120 +1,270 @@ package processing.app.syntax.im; +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.Point; import java.awt.Rectangle; +import java.awt.RenderingHints; import java.awt.event.InputMethodEvent; import java.awt.event.InputMethodListener; +import java.awt.font.FontRenderContext; +import java.awt.font.TextAttribute; import java.awt.font.TextHitInfo; +import java.awt.font.TextLayout; import java.awt.im.InputMethodRequests; import java.text.AttributedCharacterIterator; +import java.text.AttributedCharacterIterator.Attribute; +import java.text.AttributedString; + +import processing.app.Base; +import processing.app.Messages; +import processing.app.Preferences; import processing.app.syntax.JEditTextArea; +import processing.app.syntax.TextAreaDefaults; +import processing.app.syntax.TextAreaPainter; + /** - * Support in-line Japanese input for PDE. (Maybe Chinese, Korean and more) - * This class is implemented by Java Input Method Framework and handles - * If you would like to know more about Java Input Method Framework, - * Please see http://java.sun.com/j2se/1.5.0/docs/guide/imf/ - * - * This class is implemented to fix Bug #854. - * http://dev.processing.org/bugs/show_bug.cgi?id=854 - * + * On-the-spot style input support for CJK (Chinese, Japanese, Korean). + * + * @see Bugzilla 854: implement input method support for Japanese (and other languages) + * @see Bugzilla 1531: Can't input full-width space when Japanese IME is on. + * @see Java Input Method Framework (IMF) Technology + * @see The Java Tutorials + * * @author Takashi Maekawa (takachin@generative.info) + * @author Satoshi Okita */ -public class InputMethodSupport implements InputMethodRequests, - InputMethodListener { +public class InputMethodSupport implements InputMethodRequests, InputMethodListener { + + /* + public interface Callback { + public void onCommitted(char c); + } + + private Callback callback; + */ + + static private final Attribute[] CUSTOM_IM_ATTRIBUTES = { + TextAttribute.INPUT_METHOD_HIGHLIGHT, + }; + + private JEditTextArea textArea; - private int committed_count = 0; - private CompositionTextManager textManager; + private int committedCount = 0; + private AttributedString composedTextString; public InputMethodSupport(JEditTextArea textArea) { - textManager = new CompositionTextManager(textArea); + this.textArea = textArea; + textArea.enableInputMethods(true); textArea.addInputMethodListener(this); } + + /* + public void setCallback(Callback callback) { + this.callback = callback; + } + */ + + + ///////////////////////////////////////////////////////////////////////////// + + // InputMethodRequest + + ///////////////////////////////////////////////////////////////////////////// + + @Override public Rectangle getTextLocation(TextHitInfo offset) { - return textManager.getTextLocation(); + if (Base.DEBUG) { + Messages.log("#Called getTextLocation:" + offset); + } + int line = textArea.getCaretLine(); + int offsetX = textArea.getCaretPosition() - textArea.getLineStartOffset(line); + // '+1' mean textArea.lineToY(line) + textArea.getPainter().getFontMetrics().getHeight(). + // TextLayout#draw method need at least one height of font. + Rectangle rectangle = new Rectangle(textArea.offsetToX(line, offsetX), textArea.lineToY(line + 1), 0, 0); + + Point location = textArea.getPainter().getLocationOnScreen(); + rectangle.translate(location.x, location.y); + + return rectangle; } + + @Override public TextHitInfo getLocationOffset(int x, int y) { return null; } + + @Override public int getInsertPositionOffset() { - return textManager.getInsertPositionOffset(); + return -textArea.getCaretPosition(); } + + @Override public AttributedCharacterIterator getCommittedText(int beginIndex, int endIndex, AttributedCharacterIterator.Attribute[] attributes) { - return textManager.getCommittedText(beginIndex, endIndex); + int length = endIndex - beginIndex; + String textAreaString = textArea.getText(beginIndex, length); + return new AttributedString(textAreaString).getIterator(); } + + @Override public int getCommittedTextLength() { - return committed_count; + return committedCount; } + + @Override public AttributedCharacterIterator cancelLatestCommittedText( AttributedCharacterIterator.Attribute[] attributes) { return null; } + + @Override public AttributedCharacterIterator getSelectedText( AttributedCharacterIterator.Attribute[] attributes) { return null; } + + ///////////////////////////////////////////////////////////////////////////// + + // InputMethodListener + + ///////////////////////////////////////////////////////////////////////////// + /** * Handles events from InputMethod. - * This method judges whether beginning of input or - * progress of input or end and call related method. - * + * * @param event event from Input Method. */ + @Override public void inputMethodTextChanged(InputMethodEvent event) { - AttributedCharacterIterator text = event.getText(); - committed_count = event.getCommittedCharacterCount(); - if(isFullWidthSpaceInput(text)){ - textManager.insertFullWidthSpace(); - caretPositionChanged(event); - return; + if (Base.DEBUG) { + StringBuilder sb = new StringBuilder(); + sb.append("#Called inputMethodTextChanged"); + sb.append("\t ID: " + event.getID()); + sb.append("\t timestamp: " + new java.util.Date(event.getWhen())); + sb.append("\t parmString: " + event.paramString()); + Messages.log(sb.toString()); } - if(isBeginInputProcess(text, textManager)){ - textManager.beginCompositionText(text, committed_count); - caretPositionChanged(event); - return; + + AttributedCharacterIterator text = event.getText(); // text = composedText + commitedText + committedCount = event.getCommittedCharacterCount(); + + // The caret for Input Method. If you type a character by a input method, + // original caret position will be incorrect. JEditTextArea is not + // implemented using AttributedString and TextLayout. + textArea.setCaretVisible(false); + + // Japanese : if the enter key pressed, event.getText is null. + // Japanese : if first space key pressed, event.getText is null. + // Chinese (pinin) : if a space key pressed, event.getText is null. + // Taiwan (bopomofo): ? + // Korean : ? + + // Korean Input Method + if (text != null && text.getEndIndex() - (text.getBeginIndex() + committedCount) <= 0) { + textArea.setCaretVisible(true); } - if (isInputProcess(text)){ - textManager.processCompositionText(text, committed_count); - caretPositionChanged(event); - return; + // Japanese Input Method + if (text == null) { + textArea.setCaretVisible(true); } - textManager.endCompositionText(text, committed_count); - caretPositionChanged(event); - } - - private boolean isFullWidthSpaceInput(AttributedCharacterIterator text){ - if(text == null) - return false; - if(textManager.getIsInputProcess()) - return false; - return (String.valueOf(text.first()).equals("\u3000")); - } - - private boolean isBeginInputProcess(AttributedCharacterIterator text, CompositionTextManager textManager){ - if(text == null) - return false; - if(textManager.getIsInputProcess()) - return false; - return (isInputProcess(text)); + + if (text != null) { + if (committedCount > 0) { + char[] insertion = new char[committedCount]; + char c = text.first(); + for (int i = 0; i < committedCount; i++) { + insertion[i] = c; + c = text.next(); + } + // Insert this as a compound edit + textArea.setSelectedText(new String(insertion), true); + textArea.getInputHandler().handleInputMethodCommit(); + } + + CompositionTextPainter compositionPainter = textArea.getPainter().getCompositionTextpainter(); + Messages.log("textArea.getCaretPosition() + committed_count: " + (textArea.getCaretPosition() + committedCount)); + compositionPainter.setComposedTextLayout(getTextLayout(text, committedCount), textArea.getCaretPosition() + committedCount); + compositionPainter.setCaret(event.getCaret()); + + } else { // otherwise hide the input method + CompositionTextPainter compositionPainter = textArea.getPainter().getCompositionTextpainter(); + compositionPainter.setComposedTextLayout(null, 0); + compositionPainter.setCaret(null); + } + event.consume(); + textArea.repaint(); } - private boolean isInputProcess(AttributedCharacterIterator text){ - if(text == null) - return false; - return (text.getEndIndex() - (text.getBeginIndex() + committed_count) > 0); + + private TextLayout getTextLayout(AttributedCharacterIterator text, int committedCount) { + boolean antialias = Preferences.getBoolean("editor.smooth"); + TextAreaPainter painter = textArea.getPainter(); + + // create attributed string with font info. + if (text.getEndIndex() - (text.getBeginIndex() + committedCount) > 0) { + composedTextString = new AttributedString(text, committedCount, text.getEndIndex(), CUSTOM_IM_ATTRIBUTES); + Font font = painter.getFontMetrics().getFont(); + + TextAreaDefaults defaults = textArea.getDefaults(); + Color bgColor = defaults.lineHighlight ? + defaults.lineHighlightColor : defaults.bgcolor; + + composedTextString.addAttribute(TextAttribute.FONT, font); + composedTextString.addAttribute(TextAttribute.FOREGROUND, defaults.fgcolor); + composedTextString.addAttribute(TextAttribute.BACKGROUND, bgColor); + + } else { + composedTextString = new AttributedString(""); + return null; + } + + // set hint of antialiasing to render target. + Graphics2D g2d = (Graphics2D)painter.getGraphics(); + g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + antialias ? + RenderingHints.VALUE_TEXT_ANTIALIAS_ON : + RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + FontRenderContext frc = g2d.getFontRenderContext(); + if (Base.DEBUG) { + Messages.log("debug: FontRenderContext is Antialiased = " + frc.getAntiAliasingHint()); + } + + return new TextLayout(composedTextString.getIterator(), frc); } + + @Override public void caretPositionChanged(InputMethodEvent event) { event.consume(); } + + + /* + private void insertCharacter(char c) { + if (Base.DEBUG) { + Messages.log("debug: insertCharacter(char c) textArea.getCaretPosition()=" + textArea.getCaretPosition()); + } + try { + textArea.getDocument().insertString(textArea.getCaretPosition(), Character.toString(c), null); + if (Base.DEBUG) { + Messages.log("debug: \t after:insertCharacter(char c) textArea.getCaretPosition()=" + textArea.getCaretPosition()); + } + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + */ } diff --git a/app/src/processing/app/tools/Archiver.java b/app/src/processing/app/tools/Archiver.java index b6aa785a16..a3f63ab0d0 100644 --- a/app/src/processing/app/tools/Archiver.java +++ b/app/src/processing/app/tools/Archiver.java @@ -35,6 +35,7 @@ public class Archiver implements Tool { + Base base; Editor editor; // someday these will be settable @@ -50,8 +51,8 @@ public String getMenuTitle() { } - public void init(Editor editor) { - this.editor = editor; + public void init(Base base) { + this.base = base; numberFormat = NumberFormat.getInstance(); numberFormat.setGroupingUsed(false); // no commas @@ -62,6 +63,7 @@ public void init(Editor editor) { public void run() { + editor = base.getActiveEditor(); Sketch sketch = editor.getSketch(); if (sketch.isModified()) { @@ -134,7 +136,7 @@ public void fileSelected(File newbie) { } - public void buildZip(File dir, String sofar, + private void buildZip(File dir, String sofar, ZipOutputStream zos) throws IOException { String files[] = dir.list(); for (int i = 0; i < files.length; i++) { diff --git a/app/src/processing/app/tools/ColorSelector.java b/app/src/processing/app/tools/ColorSelector.java index 8424703ff8..0a59744c78 100644 --- a/app/src/processing/app/tools/ColorSelector.java +++ b/app/src/processing/app/tools/ColorSelector.java @@ -23,7 +23,6 @@ import processing.app.*; import processing.app.ui.ColorChooser; -import processing.app.ui.Editor; import processing.app.ui.Toolkit; import java.awt.Color; @@ -48,31 +47,32 @@ public class ColorSelector implements Tool { */ private static volatile ColorChooser selector; - private Editor editor; + private Base base; + - public String getMenuTitle() { return Language.text("menu.tools.color_selector"); } - public void init(Editor editor) { - this.editor = editor; + public void init(Base base) { + this.base = base; } public void run() { if (selector == null) { - synchronized(ColorSelector.class) { + synchronized (ColorSelector.class) { if (selector == null) { - selector = new ColorChooser(editor, false, Color.WHITE, + selector = new ColorChooser(base.getActiveEditor(), + false, Color.WHITE, Language.text("menu.edit.copy"), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - Clipboard clipboard = Toolkit.getSystemClipboard(); - clipboard.setContents(new StringSelection(selector.getHexColor()), null); + Clipboard c = Toolkit.getSystemClipboard(); + c.setContents(new StringSelection(selector.getHexColor()), null); } }); } diff --git a/app/src/processing/app/tools/CreateFont.java b/app/src/processing/app/tools/CreateFont.java index ba9cf3a0a3..aff82e191a 100644 --- a/app/src/processing/app/tools/CreateFont.java +++ b/app/src/processing/app/tools/CreateFont.java @@ -51,10 +51,7 @@ * GUI tool for font creation heaven/hell. */ public class CreateFont extends JFrame implements Tool { - Editor editor; - //Sketch sketch; - -// Dimension windowSize; + Base base; JList fontSelector; JTextField sizeSelector; @@ -64,7 +61,7 @@ public class CreateFont extends JFrame implements Tool { JButton okButton; JTextField filenameField; - HashMap table; + Map table; boolean smooth = true; Font font; @@ -85,8 +82,8 @@ public String getMenuTitle() { } - public void init(Editor editor) { - this.editor = editor; + public void init(Base base) { + this.base = base; Container paine = getContentPane(); paine.setLayout(new BorderLayout()); //10, 10)); @@ -111,12 +108,13 @@ public void init(Editor editor) { // also ignore dialog, dialoginput, monospaced, serif, sansserif // getFontList is deprecated in 1.4, so this has to be used - //long t = System.currentTimeMillis(); + //long t = System.currentTimeMillis(); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); Font[] fonts = ge.getAllFonts(); //System.out.println("font startup took " + (System.currentTimeMillis() - t) + " ms"); - + + /* if (false) { ArrayList fontList = new ArrayList(); File folderList = new File("/Users/fry/coconut/sys/fonts/web"); @@ -136,7 +134,7 @@ public boolean accept(File dir, String name) { Font font = Font.createFont(Font.TRUETYPE_FONT, input); input.close(); fontList.add(font); - + } catch (Exception e) { System.out.println("Ignoring " + fontFile.getName()); } @@ -147,8 +145,9 @@ public boolean accept(File dir, String name) { // fontList.toArray(fonts); fonts = fontList.toArray(new Font[fontList.size()]); } + */ - String flist[] = new String[fonts.length]; + String[] fontList = new String[fonts.length]; table = new HashMap(); int index = 0; @@ -157,7 +156,7 @@ public boolean accept(File dir, String name) { //if (psname == null) System.err.println("ps name is null"); try { - flist[index++] = fonts[i].getPSName(); + fontList[index++] = fonts[i].getPSName(); table.put(fonts[i].getPSName(), fonts[i]); // Checking into http://processing.org/bugs/bugzilla/407.html // and https://github.com/processing/processing/issues/1727 @@ -172,7 +171,7 @@ public boolean accept(File dir, String name) { } list = new String[index]; - System.arraycopy(flist, 0, list, 0, index); + System.arraycopy(fontList, 0, list, 0, index); fontSelector = new JList(list); fontSelector.addListSelectionListener(new ListSelectionListener() { @@ -348,30 +347,14 @@ public void build() { filename += ".vlw"; } - // Please implement me properly. The schematic is below, but not debugged. - // http://dev.processing.org/bugs/show_bug.cgi?id=1464 - -// final String filename2 = filename; -// final int fontsize2 = fontsize; -// SwingUtilities.invokeLater(new Runnable() { -// public void run() { try { Font instance = table.get(list[selection]); font = instance.deriveFont(Font.PLAIN, fontsize); //PFont f = new PFont(font, smooth, all ? null : PFont.CHARSET); PFont f = new PFont(font, smooth, charSelector.getCharacters()); -// PFont f = new PFont(font, smooth, null); -// char[] charset = charSelector.getCharacters(); -// ProgressMonitor progressMonitor = new ProgressMonitor(CreateFont.this, -// "Creating font", "", 0, charset.length); -// progressMonitor.setProgress(0); -// for (int i = 0; i < charset.length; i++) { -// System.out.println(charset[i]); -// f.index(charset[i]); // load this char -// progressMonitor.setProgress(i+1); -// } - + // the editor may have changed while the window was open + Editor editor = base.getActiveEditor(); // make sure the 'data' folder exists File folder = editor.getSketch().prepareDataFolder(); f.save(new FileOutputStream(new File(folder, filename))); @@ -383,8 +366,6 @@ public void build() { JOptionPane.WARNING_MESSAGE); e.printStackTrace(); } -// } -// }); setVisible(false); } diff --git a/app/src/processing/app/tools/InstallCommander.java b/app/src/processing/app/tools/InstallCommander.java index 035d63d4ee..518789d4ce 100644 --- a/app/src/processing/app/tools/InstallCommander.java +++ b/app/src/processing/app/tools/InstallCommander.java @@ -28,6 +28,7 @@ import javax.swing.JOptionPane; +import processing.app.Base; import processing.app.Language; import processing.app.Messages; import processing.app.Platform; @@ -37,7 +38,7 @@ public class InstallCommander implements Tool { - Editor editor; + Base base; public String getMenuTitle() { @@ -45,13 +46,15 @@ public String getMenuTitle() { } - public void init(Editor editor) { - this.editor = editor; + public void init(Base base) { + this.base = base; } public void run() { try { + Editor editor = base.getActiveEditor(); + final String primary = "Install processing-java for all users?"; final String secondary = @@ -81,7 +84,17 @@ public void run() { File file = File.createTempFile("processing", "commander"); PrintWriter writer = PApplet.createWriter(file); - writer.println("#!/bin/sh"); + writer.print("#!/bin/sh\n\n"); + + writer.print("# Prevents processing-java from stealing focus, see:\n" + + "# https://github.com/processing/processing/issues/3996.\n" + + "OPTION_FOR_HEADLESS_RUN=\"\"\n" + + "for ARG in \"$@\"\n" + + "do\n" + + " if [ \"$ARG\" = \"--build\" ]; then\n" + + " OPTION_FOR_HEADLESS_RUN=\"-Djava.awt.headless=true\"\n" + + " fi\n" + + "done\n\n"); String javaRoot = Platform.getContentFile(".").getCanonicalPath(); @@ -92,8 +105,9 @@ public void run() { String classPath = jarList.join(":").replaceAll(javaRoot + "\\/?", ""); writer.println("cd \"" + javaRoot + "\" && " + - Platform.getJavaPath() + + Platform.getJavaPath().replaceAll(" ", "\\\\ ") + " -Djna.nosys=true" + + " $OPTION_FOR_HEADLESS_RUN" + " -cp \"" + classPath + "\"" + " processing.mode.java.Commander \"$@\""); writer.flush(); @@ -106,7 +120,12 @@ public void run() { // with OS X 10.11 and its "System Integrity Protection" // https://github.com/processing/processing/issues/3497 String targetPath = "/usr/local/bin/processing-java"; - String shellScript = "/bin/mkdir -p /usr/local/bin && /bin/mv " + sourcePath + " " + targetPath; + // Remove the old version in case it exists + // https://github.com/processing/processing/issues/3786 + String oldPath = "/usr/bin/processing-java"; + String shellScript = "/bin/rm -f " + oldPath + + " && /bin/mkdir -p /usr/local/bin" + + " && /bin/mv " + sourcePath + " " + targetPath; String appleScript = "do shell script \"" + shellScript + "\" with administrator privileges"; PApplet.exec(new String[] { "osascript", "-e", appleScript }); @@ -127,7 +146,7 @@ public void run() { } catch (IOException e) { Messages.showWarning("Error while installing", - "An error occurred and the tools were not installed.", e); + "An error occurred and the tool was not installed.", e); } } diff --git a/app/src/processing/app/tools/Tool.java b/app/src/processing/app/tools/Tool.java index 0423472f6b..958fb27247 100644 --- a/app/src/processing/app/tools/Tool.java +++ b/app/src/processing/app/tools/Tool.java @@ -23,7 +23,7 @@ package processing.app.tools; -import processing.app.ui.Editor; +import processing.app.Base; /** @@ -31,8 +31,8 @@ */ public interface Tool extends Runnable { - public void init(Editor editor); - + public void init(Base base); + public void run(); // Not doing shortcuts for now, no way to resolve between tools. diff --git a/app/src/processing/app/ui/About.java b/app/src/processing/app/ui/About.java index 553d09ce22..526bc31de6 100644 --- a/app/src/processing/app/ui/About.java +++ b/app/src/processing/app/ui/About.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2012-19 The Processing Foundation Copyright (c) 2004-12 Ben Fry and Casey Reas This program is free software; you can redistribute it and/or @@ -23,28 +23,36 @@ package processing.app.ui; import java.awt.Color; -import java.awt.Dimension; import java.awt.Font; import java.awt.Frame; import java.awt.Graphics; import java.awt.Graphics2D; -import java.awt.Image; import java.awt.RenderingHints; import java.awt.Window; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import javax.swing.ImageIcon; + import processing.app.Base; +import processing.app.Platform; public class About extends Window { - Image image; + ImageIcon icon; int width, height; public About(Frame frame) { super(frame); + icon = Toolkit.getLibIconX("about"); + width = icon.getIconWidth(); + height = icon.getIconHeight(); + + /* if (Toolkit.highResDisplay()) { image = Toolkit.getLibImage("about-2x.jpg"); //$NON-NLS-1$ width = image.getWidth(null) / 2; @@ -54,6 +62,7 @@ public About(Frame frame) { width = image.getWidth(null); height = image.getHeight(null); } + */ addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { @@ -61,21 +70,42 @@ public void mousePressed(MouseEvent e) { } }); - Dimension screen = Toolkit.getScreenSize(); - setBounds((screen.width-width)/2, (screen.height-height)/2, width, height); + addKeyListener(new KeyAdapter() { + public void keyTyped(KeyEvent e) { + System.out.println(e); + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + dispose(); + } + } + }); + +// Dimension screen = Toolkit.getScreenSize(); +// setBounds((screen.width-width)/2, (screen.height-height)/2, width, height); + setSize(width, height); +// setLocationRelativeTo(null); + setLocationRelativeTo(frame); setVisible(true); + requestFocus(); } public void paint(Graphics g) { - g.drawImage(image, 0, 0, width, height, null); +// Graphics2D g2 = Toolkit.prepareGraphics(g); +// g2.scale(0.5, 0.5); Graphics2D g2 = (Graphics2D) g; + // OS X looks better doing its own thing, Windows and Linux need AA g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, - RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + Platform.isMacOS() ? + RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT : + RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + + g.drawImage(icon.getImage(), 0, 0, width, height, null); +// g.setColor(Color.ORANGE); +// g.fillRect(0, 0, width, height); - g.setFont(new Font("SansSerif", Font.PLAIN, 10)); //$NON-NLS-1$ - g.setColor(Color.white); - g.drawString(Base.getVersionName(), 90, 29); + g.setFont(Toolkit.getSansFont(12, Font.PLAIN)); + g.setColor(Color.WHITE); + g.drawString(Base.getVersionName(), 26, 29); } } \ No newline at end of file diff --git a/app/src/processing/app/ui/ChangeDetector.java b/app/src/processing/app/ui/ChangeDetector.java index 878fea66ea..6d95275d0a 100644 --- a/app/src/processing/app/ui/ChangeDetector.java +++ b/app/src/processing/app/ui/ChangeDetector.java @@ -1,15 +1,40 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2012-19 The Processing Foundation + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + as published by the Free Software Foundation. + + 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. +*/ + package processing.app.ui; -import java.awt.EventQueue; -import java.awt.Frame; import java.awt.event.WindowEvent; import java.awt.event.WindowFocusListener; import java.io.File; -import java.io.FilenameFilter; -import java.lang.reflect.InvocationTargetException; - -import javax.swing.JOptionPane; - +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import processing.app.Language; import processing.app.Messages; import processing.app.Preferences; import processing.app.Sketch; @@ -17,18 +42,22 @@ public class ChangeDetector implements WindowFocusListener { - private Sketch sketch; - private Editor editor; + private final Sketch sketch; + private final Editor editor; + + private List ignoredRemovals = new ArrayList<>(); + private List ignoredModifications = new ArrayList<>(); // Windows and others seem to have a few hundred ms difference in reported // times, so we're arbitrarily setting a gap in time here. // Mac OS X has an (exactly) one second difference. Not sure if it's a Java // bug or something else about how OS X is writing files. - private final int MODIFIED_TIME_BUFFER = 1000; + static private final int MODIFICATION_WINDOW_MILLIS = + Preferences.getInteger("editor.watcher.window"); - // Set true if the user selected 'no'. TODO this can't just skip once, - // because subsequent returns to the window w/o saving will keep firing. - private boolean skip = false; + // Debugging this feature is particularly difficult, adding an option for it + static private final boolean DEBUG = + Preferences.getBoolean("editor.watcher.debug"); public ChangeDetector(Editor editor) { @@ -39,20 +68,13 @@ public ChangeDetector(Editor editor) { @Override public void windowGainedFocus(WindowEvent e) { - // Keep the listener instantiated and check this to avoid a maze of - // adding and removing and re-adding with Preferences changes. if (Preferences.getBoolean("editor.watcher")) { - // if they selected no, skip the next focus event - if (skip) { - skip = false; + if (sketch != null) { + // make sure the sketch folder exists at all. + // if it does not, it will be re-saved, and no changes will be detected + sketch.ensureExistence(); - } else { - new Thread(new Runnable() { - @Override - public void run() { - checkFileChange(); - } - }).start(); + checkFiles(); } } } @@ -65,170 +87,199 @@ public void windowLostFocus(WindowEvent e) { } - private void checkFileChange() { - //check that the content of each of the files in sketch matches what is in memory - if (sketch == null) { - return; - } + private void checkFiles() { + List filenames = new ArrayList<>(); + List extensions = new ArrayList<>(); + sketch.getSketchCodeFiles(filenames, extensions); - // make sure the sketch folder exists at all. - // if it does not, it will be re-saved, and no changes will be detected - sketch.ensureExistence(); - - // check file count first - File sketchFolder = sketch.getFolder(); - File[] sketchFiles = sketchFolder.listFiles(new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - for (String s : editor.getMode().getExtensions()) { - if (name.toLowerCase().endsWith(s.toLowerCase())) { - return true; - } - } - return false; - } - }); - int fileCount = sketchFiles.length; - - if (fileCount != sketch.getCodeCount()) { - // if they chose to reload and there aren't any files left - if (reloadSketch(null) && fileCount < 1) { - try { - //make a blank file - sketch.getMainFile().createNewFile(); - } catch (Exception e1) { - //if that didn't work, tell them it's un-recoverable - showErrorEDT("Reload failed", "The sketch contains no code files.", e1); - //don't try to reload again after the double fail - //this editor is probably trashed by this point, but a save-as might be possible - skip = true; - return; - } - //it's okay to do this without confirmation, because they already confirmed to deleting the unsaved changes above - sketch.reload(); - showWarningEDT("Modified Reload", - "You cannot delete the last code file in a sketch.\n" + - "A new blank sketch file has been generated for you."); + SketchCode[] codes = sketch.getCode(); - } - return; - } + // Separate codes with and without files + Map> existsMap = Arrays.stream(codes) + .collect(Collectors.groupingBy(code -> filenames.contains(code.getFileName()))); - SketchCode[] codes = sketch.getCode(); - for (SketchCode sc : codes) { - File sketchFile = sc.getFile(); - if (sketchFile.exists()) { - long diff = sketchFile.lastModified() - sc.lastModified(); - if (diff > MODIFIED_TIME_BUFFER) { - //System.out.println(sketchFile.getName() + " " + diff); - reloadSketch(sc); - //return; - } - } else { - // If a file in the sketch was not found, then it must have been - // deleted externally, so reload the sketch. - reloadSketch(sc); - //return; + // ADDED FILES + + List codeFilenames = Arrays.stream(codes) + .map(SketchCode::getFileName) + .collect(Collectors.toList()); + + // Get filenames which are in filesystem but don't have code + List addedFilenames = filenames.stream() + .filter(f -> !codeFilenames.contains(f)) + .collect(Collectors.toList()); + + // Take action if there are any added files which were not previously ignored + boolean added = !addedFilenames.isEmpty(); + + + // REMOVED FILES + + // Get codes which don't have file + List removedCodes = Optional.ofNullable(existsMap.get(Boolean.FALSE)) + .orElse(Collections.emptyList()); + List removedCodesFinal = removedCodes.stream() + .filter(code -> !ignoredRemovals.contains(code)) + .collect(Collectors.toList()); + + // Show prompt if there are any removed codes which were not previously ignored + boolean removed = !removedCodesFinal.isEmpty(); + + + /// MODIFIED FILES + + // Get codes which have file with different modification time + List modifiedCodes = existsMap.containsKey(Boolean.TRUE) ? + existsMap.get(Boolean.TRUE) : Collections.emptyList(); + List modifiedCodesFinal = new ArrayList<>(); + for (SketchCode code : modifiedCodes) { + if (ignoredModifications.contains(code)) continue; + long fileLastModified = code.getFile().lastModified(); + long codeLastModified = code.getLastModified(); + long diff = fileLastModified - codeLastModified; + if (fileLastModified == 0L || diff > MODIFICATION_WINDOW_MILLIS) { + modifiedCodesFinal.add(code); } } - } + // Show prompt if any open codes were modified + boolean modified = !modifiedCodesFinal.isEmpty(); - private void setSketchCodeModified(SketchCode sc) { - sc.setModified(true); - sketch.setModified(true); - } + // Clean ignore lists + ignoredModifications.retainAll(modifiedCodes); + ignoredRemovals.retainAll(removedCodes); - /** - * @param changed The file that was known to be modified - * @return true if the files in the sketch have been reloaded - */ - private boolean reloadSketch(SketchCode changed) { - int response = blockingYesNoPrompt(editor, - "File Modified", - "Your sketch has been modified externally.
" + - "Would you like to reload the sketch?", - "If you reload the sketch, any unsaved changes will be lost."); - if (response == JOptionPane.YES_OPTION) { - sketch.reload(); - rebuildHeaderEDT(); - return true; + boolean changes = added || removed || modified; + // Do both PDE and disk change for any one file? + List mergeConflicts = modifiedCodesFinal.stream() + .filter(SketchCode::isModified) + .collect(Collectors.toList()); + boolean ask = !mergeConflicts.isEmpty() || removed; + + if (DEBUG) { + System.out.println("ask: " + ask + "\n" + + "merge conflicts: " + mergeConflicts + ",\n" + + "added filenames: " + addedFilenames + ",\n" + + "removed codes: " + removedCodes + ",\n" + + "ignored removed: " + ignoredRemovals + ",\n" + + "modified codes: " + modifiedCodesFinal + "\n"); } - // they said no (or canceled), make it possible to stop the msgs by saving - if (changed != null) { - //set it to be modified so that it will actually save to disk when the user saves from inside processing - setSketchCodeModified(changed); - - } else { - // Because the number of files changed, they may be working with a file - // that doesn't exist any more. So find the files that are missing, - // and mark them as modified so that the next "Save" will write them. - for (SketchCode sc : sketch.getCode()) { - if (!sc.getFile().exists()) { - setSketchCodeModified(sc); + + // No prompt yet. + if (changes) { + for (int i = 0; i < filenames.size(); i++) { + for (String addedTab : addedFilenames) { + if (filenames.get(i).equals(addedTab)) { + sketch.loadNewTab(filenames.get(i), extensions.get(i), true); + } + } + } + for (SketchCode modifiedCode : modifiedCodesFinal) { + if (!mergeConflicts.contains(modifiedCode)) { + sketch.loadNewTab(modifiedCode.getFileName(), + modifiedCode.getExtension(), false); } } - // If files were simply added, then nothing needs done - } - rebuildHeaderEDT(); - skip = true; - return false; - } - - private void showErrorEDT(final String title, final String message, - final Exception e) { - EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - Messages.showError(title, message, e); + // Destructive actions, so prompt. + if (ask) { + sketch.updateSketchCodes(); + + showReloadPrompt(mergeConflicts, removedCodesFinal, + scReload -> { + try { + File file = scReload.getFile(); + File autosave = File.createTempFile(scReload.getPrettyName(), + ".autosave", file.getParentFile()); + scReload.copyTo(autosave); + } catch (IOException e) { + Messages.showWarning("Could not autosave modified tab", + "Your changes to " + scReload.getPrettyName() + + " have not been saved, so we won't load the new version.", e); + scReload.setModified(true); // So we'll have another go at saving + // it later, + ignoredModifications.add(scReload); // but not create a loop. + return; + } + sketch.loadNewTab(scReload.getFileName(), scReload.getExtension(), false); + }, + scKeep -> { + scKeep.setLastModified(); + scKeep.setModified(true); + }, + scDelete -> sketch.removeCode(scDelete), + scResave -> { + try { + scResave.save(); + } catch (IOException e) { + if (sketch.getCode(0).equals(scResave)) { + // Not a fatal error; the sketch has to stay open if + // they're going to save the code that's in it. + Messages.showWarning( + scResave.getFileName() + " deleted and not re-saved", + "Your main tab was deleted, and Processing couldn't " + + "resave it.\nYour sketch won't work without the " + + "main tab.", e); + } else { + Messages.showWarning("Could not re-save deleted tab", + "Your copy of " + scResave.getPrettyName() + + " will stay in the editor.", e); + } + ignoredRemovals.add(scResave); + scResave.setModified(true); // So we'll have another go at + // saving it later. + } + } + ); } - }); - } + editor.rebuildHeader(); + sketch.setCurrentCode(sketch.getCurrentCodeIndex()); + editor.repaintHeader(); + editor.sketchChanged(); + } - private void showWarningEDT(final String title, final String message) { - EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - Messages.showWarning(title, message); - } - }); } - private int blockingYesNoPrompt(final Frame editor, final String title, - final String message1, - final String message2) { - final int[] result = { -1 }; // yuck - try { - //have to wait for a response on this one - EventQueue.invokeAndWait(new Runnable() { - @Override - public void run() { - result[0] = Messages.showYesNoQuestion(editor, title, message1, message2); - } - }); - } catch (InvocationTargetException e) { - //occurs if Base.showYesNoQuestion throws an error, so, shouldn't happen - e.getTargetException().printStackTrace(); - } catch (InterruptedException e) { - //occurs if the EDT is interrupted, so, shouldn't happen - e.printStackTrace(); + /** + * Prompt the user what to do about each tab. Passes the tab to the user's + * choice of Consumer. Won't let you delete the main tab. + */ + private void showReloadPrompt( + List mergeConflict, List removed, + Consumer modifiedReload, Consumer modifiedKeep, + Consumer delete, Consumer deletedResave) { + for (SketchCode sc : mergeConflict) { + if (1 == Messages.showCustomQuestion(editor, + Language.text("change_detect.reload.title"), + Language.interpolate("change_detect.reload.question", sc.getFileName()), + Language.text("change_detect.reload.comment"), + 0, + Language.text("change_detect.button.keep"), + Language.text("change_detect.button.load_new"))) { + modifiedReload.accept(sc); + } else { + modifiedKeep.accept(sc); + } } - return result[0]; - } - - private void rebuildHeaderEDT() { - EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - editor.header.rebuild(); + for (SketchCode sc : removed) { + if (!sketch.getCode(0).equals(sc) && + 1 == Messages.showCustomQuestion(editor, + Language.text("change_detect.delete.title"), + Language.interpolate("change_detect.delete.question", sc.getFileName()), + Language.text("change_detect.delete.comment"), + 0, + Language.text("change_detect.button.resave"), + Language.text("change_detect.button.discard"))) { + delete.accept(sc); + } else { + deletedResave.accept(sc); } - }); + } } } diff --git a/app/src/processing/app/ui/ColorChooser.java b/app/src/processing/app/ui/ColorChooser.java index 1281206e2c..5693db6c66 100644 --- a/app/src/processing/app/ui/ColorChooser.java +++ b/app/src/processing/app/ui/ColorChooser.java @@ -3,7 +3,8 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2006-14 Ben Fry and Casey Reas + Copyright (c) 2012-19 The Processing Foundation + Copyright (c) 2006-12 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 version 2 diff --git a/app/src/processing/app/ui/Editor.java b/app/src/processing/app/ui/Editor.java index 8631e847d9..6780a53100 100644 --- a/app/src/processing/app/ui/Editor.java +++ b/app/src/processing/app/ui/Editor.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2012-19 The Processing Foundation Copyright (c) 2004-12 Ben Fry and Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology @@ -30,41 +30,44 @@ import processing.app.Mode; import processing.app.Platform; import processing.app.Preferences; +import processing.app.Problem; import processing.app.RunnerListener; import processing.app.Sketch; import processing.app.SketchCode; import processing.app.SketchException; import processing.app.Util; import processing.app.contrib.ContributionManager; -import processing.app.contrib.ToolContribution; import processing.app.syntax.*; -import processing.app.tools.*; import processing.core.*; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.EventQueue; +import java.awt.Font; import java.awt.Frame; import java.awt.Image; import java.awt.Point; +import java.awt.Window; import java.awt.datatransfer.*; import java.awt.event.*; import java.awt.print.*; import java.io.*; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Stack; import java.util.Timer; import java.util.TimerTask; +import java.util.stream.Collectors; import javax.swing.*; import javax.swing.event.*; import javax.swing.plaf.basic.*; import javax.swing.text.*; +import javax.swing.text.html.*; import javax.swing.undo.*; @@ -76,10 +79,11 @@ public abstract class Editor extends JFrame implements RunnerListener { protected EditorState state; protected Mode mode; - static public final int LEFT_GUTTER = 44; - static public final int RIGHT_GUTTER = 20; - static public final int GUTTER_MARGIN = 3; + static public final int LEFT_GUTTER = Toolkit.zoom(44); + static public final int RIGHT_GUTTER = Toolkit.zoom(12); + static public final int GUTTER_MARGIN = Toolkit.zoom(3); + protected MarkerColumn errorColumn; // Otherwise, if the window is resized with the message label // set to blank, its preferredSize() will be fuckered @@ -110,7 +114,7 @@ public abstract class Editor extends JFrame implements RunnerListener { protected JSplitPane splitPane; protected EditorFooter footer; protected EditorConsole console; -// protected EditorLineStatus lineStatus; + protected ErrorTable errorTable; // currently opened program protected Sketch sketch; @@ -127,7 +131,7 @@ public abstract class Editor extends JFrame implements RunnerListener { protected CopyAsHtmlAction copyAsHtmlAction; protected PasteAction pasteAction; /** Menu Actions updated on the opening of the edit menu. */ - protected List editMenuUpdatable = new ArrayList(); + protected List editMenuUpdatable = new ArrayList<>(); /** The currently selected tab's undo manager */ private UndoManager undo; @@ -140,20 +144,18 @@ public abstract class Editor extends JFrame implements RunnerListener { // true if inserting text, false if removing text private boolean isInserting; // maintain caret position during undo operations - private final Stack caretUndoStack = new Stack(); - private final Stack caretRedoStack = new Stack(); + private final Stack caretUndoStack = new Stack<>(); + private final Stack caretRedoStack = new Stack<>(); private FindReplace find; JMenu toolsMenu; - JMenu modeMenu; - - List coreTools; - List contribTools; + JMenu modePopup; Image backgroundGradient; + protected List problems = Collections.emptyList(); + -// protected Editor(final Base base, String path, int[] location, final Mode mode) { protected Editor(final Base base, String path, final EditorState state, final Mode mode) throws EditorException { super("Processing", state.checkConfig()); @@ -161,10 +163,11 @@ protected Editor(final Base base, String path, final EditorState state, this.state = state; this.mode = mode; - Toolkit.setIcon(this); // TODO should this be per-mode? + // Make sure Base.getActiveEditor() never returns null + base.checkFirstEditor(this); - // Install default actions for Run, Present, etc. -// resetHandlers(); + // This is a Processing window. Get rid of that ugly ass coffee cup. + Toolkit.setIcon(this); // add listener to handle window close box hit event addWindowListener(new WindowAdapter() { @@ -179,25 +182,21 @@ public void windowClosing(WindowEvent e) { // When bringing a window to front, let the Base know addWindowListener(new WindowAdapter() { -// int importIndex; public void windowActivated(WindowEvent e) { base.handleActivated(Editor.this); fileMenu.insert(Recent.getMenu(), 2); Toolkit.setMenuMnemsInside(fileMenu); - //sketchMenu.insert(mode.getImportMenu(), 5); mode.insertImportMenu(sketchMenu); - //sketchMenu.insert(mode.getImportMenu(), importIndex); Toolkit.setMenuMnemsInside(sketchMenu); mode.insertToolbarRecentMenu(); } public void windowDeactivated(WindowEvent e) { + // TODO call handleActivated(null)? or do we run the risk of the + // deactivate call for old window being called after the activate? fileMenu.remove(Recent.getMenu()); -// JMenu importMenu = mode.getImportMenu(); -// importIndex = sketchMenu.getComponentZOrder(mode.getImportMenu()); -// sketchMenu.remove(mode.getImportMenu()); mode.removeImportMenu(sketchMenu); mode.removeToolbarRecentMenu(); } @@ -253,7 +252,7 @@ public void paintComponent(Graphics g) { // upper.setOpaque(false); // box.setOpaque(false); - initModeMenu(); + rebuildModePopup(); toolbar = createToolbar(); upper.add(toolbar); @@ -264,17 +263,44 @@ public void paintComponent(Graphics g) { textarea.setRightClickPopup(new TextAreaPopup()); textarea.setHorizontalOffset(JEditTextArea.leftHandGutter); + { // Hack: add Numpad Slash as alternative shortcut for Comment/Uncomment + int modifiers = Toolkit.awtToolkit.getMenuShortcutKeyMask(); + KeyStroke keyStroke = + KeyStroke.getKeyStroke(KeyEvent.VK_DIVIDE, modifiers); + final String ACTION_KEY = "COMMENT_UNCOMMENT_ALT"; + textarea.getInputMap().put(keyStroke, ACTION_KEY); + textarea.getActionMap().put(ACTION_KEY, new AbstractAction() { + @Override + public void actionPerformed(ActionEvent e) { + handleCommentUncomment(); + } + }); + } + textarea.addCaretListener(new CaretListener() { + public void caretUpdate(CaretEvent e) { + updateEditorStatus(); + } + }); + footer = createFooter(); - upper.add(textarea); + // build the central panel with the text area & error marker column + JPanel editorPanel = new JPanel(new BorderLayout()); + errorColumn = new MarkerColumn(this, textarea.getMinimumSize().height); + editorPanel.add(errorColumn, BorderLayout.EAST); + textarea.setBounds(0, 0, errorColumn.getX() - 1, textarea.getHeight()); + editorPanel.add(textarea); + upper.add(editorPanel); - // alternate spot for status, but ugly -// status = new EditorStatus(this); -// upper.add(status); + // set colors and fonts for the painter object + PdeTextArea pta = getPdeTextArea(); + if (pta != null) { + pta.setMode(mode); + } splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, upper, footer); - // disable this because it hides the message area, which is essential (issue #745) + // disable this because it hides the message area (Google Code issue #745) splitPane.setOneTouchExpandable(false); // repaint child panes while resizing splitPane.setContinuousLayout(true); @@ -286,7 +312,6 @@ public void paintComponent(Graphics g) { // remove an ugly border around anything in a SplitPane !$*&!% UIManager.getDefaults().put("SplitPane.border", BorderFactory.createEmptyBorder()); // set the height per our gui design - //splitPane.setDividerSize(mode.getInteger("divider.height")); splitPane.setDividerSize(EditorStatus.HIGH); // override the look of the SplitPane so that it's identical across OSes @@ -294,30 +319,17 @@ public void paintComponent(Graphics g) { public BasicSplitPaneDivider createDefaultDivider() { status = new EditorStatus(this, Editor.this); return status; - /* - return new BasicSplitPaneDivider(this) { - final Color dividerColor = mode.getColor("divider.color"); //new Color(204, 204, 204); - final Color dotColor = mode.getColor("divider.dot.color"); //new Color(80, 80, 80); - int dotSize = mode.getInteger("divider.dot.diameter"); //3; - - @Override - public void paint(Graphics g) { - Graphics2D g2 = (Graphics2D) g; - g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - - final int w = getSize().width; - final int h = getSize().height; - g.setColor(dividerColor); - g.fillRect(0, 0, w, h); - - g.setColor(dotColor); - int x = w/2 - dotSize/2; - int y = h/2 - dotSize/2; - g.fillOval(x, y, dotSize, dotSize); - } - }; - */ + } + + + @Override + public void finishDraggingTo(int location) { + super.finishDraggingTo(location); + // JSplitPane issue: if you only make the lower component visible at + // the last minute, its minmum size is ignored. + if (location > splitPane.getMaximumDividerLocation()) { + splitPane.setDividerLocation(splitPane.getMaximumDividerLocation()); + } } }); @@ -325,32 +337,34 @@ public void paint(Graphics g) { contentPain.add(box); - // get shift down/up events so we can show the alt version of toolbar buttons - //textarea.addKeyListener(toolbar); - // end an undo-chunk any time the caret moves unless it's when text is edited textarea.addCaretListener(new CaretListener() { String lastText = textarea.getText(); public void caretUpdate(CaretEvent e) { String newText = textarea.getText(); - if (lastText.equals(newText) && isDirectEdit()) { + if (lastText.equals(newText) && isDirectEdit() && !textarea.isOverwriteEnabled()) { endTextEditHistory(); } lastText = newText; } }); + textarea.addKeyListener(toolbar); + contentPain.setTransferHandler(new FileDropHandler()); - // Finish preparing Editor (formerly found in Base) + // Finish preparing Editor pack(); // Set the window bounds and the divider location before setting it visible state.apply(this); // Set the minimum size for the editor window - setMinimumSize(new Dimension(Preferences.getInteger("editor.window.width.min"), - Preferences.getInteger("editor.window.height.min"))); + int minWidth = + Toolkit.zoom(Preferences.getInteger("editor.window.width.min")); + int minHeight = + Toolkit.zoom(Preferences.getInteger("editor.window.height.min")); + setMinimumSize(new Dimension(minWidth, minHeight)); // Bring back the general options for the editor applyPreferences(); @@ -363,20 +377,34 @@ public void caretUpdate(CaretEvent e) { public void windowGainedFocus(WindowEvent e) { textarea.requestFocusInWindow(); } - -// public void windowLostFocus(WindowEvent e) { -// System.out.println("lost focus, should we tell the text area?"); -// } }); + // TODO: Subclasses can't initialize anything before Doc Open happens since + // super() has to be the first line in subclass constructor; we might + // want to keep constructor light and call methods later [jv 160318] + // Open the document that was passed in handleOpenInternal(path); // Add a window listener to watch for changes to the files in the sketch addWindowFocusListener(new ChangeDetector(this)); + + // Try to enable fancy fullscreen on OSX + if (Platform.isMacOS()) { + try { + Class util = Class.forName("com.apple.eawt.FullScreenUtilities"); + Class params[] = new Class[]{Window.class, Boolean.TYPE}; + Method method = util.getMethod("setWindowCanFullScreen", params); + method.invoke(util, this, true); + } catch (Exception e) { + Messages.loge("Could not enable OSX fullscreen", e); + } + } + } + /* protected List getCoreTools() { return coreTools; } @@ -390,45 +418,12 @@ public List getToolContribs() { public void removeToolContrib(ToolContribution tc) { contribTools.remove(tc); } + */ - /** - * Broken out to get modes working for GSOC, but this needs a longer-term - * solution where the listeners are handled properly. - */ protected JEditTextArea createTextArea() { return new JEditTextArea(new PdeTextAreaDefaults(mode), - new PdeInputHandler()); - /* - return new JEditTextArea(new PdeTextAreaDefaults(mode), new PdeInputHandler()) { - // this is a kludge that needs to be removed [fry 150120] - 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); - - if (inputHandler != null) { - // Prevent sketch being marked modified cia ctrl-, on Windows/Linux - if ((evt.getModifiers() & InputEvent.CTRL_MASK) != 0 && - evt.getKeyChar() == ',') { - System.out.println("skipping " + evt); - return; - } - switch (evt.getID()) { - case KeyEvent.KEY_TYPED: - inputHandler.keyTyped(evt); - break; - case KeyEvent.KEY_PRESSED: - inputHandler.keyPressed(evt); - break; - case KeyEvent.KEY_RELEASED: - inputHandler.keyReleased(evt); - break; - } - } - } - }; - */ + new PdeInputHandler(this)); } @@ -437,24 +432,15 @@ public EditorFooter createFooter() { console = new EditorConsole(this); ef.addPanel(console, Language.text("editor.footer.console"), "/lib/footer/console"); return ef; + } - /* - // assemble console panel, consisting of status area and the console itself - JPanel panel = new JPanel(); - panel.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); - panel.add(console, BorderLayout.CENTER); -// lineStatus = new EditorLineStatus(this); -// consolePanel.add(lineStatus, BorderLayout.SOUTH); - return panel; - */ + public void addErrorTable(EditorFooter ef) { + JScrollPane scrollPane = new JScrollPane(); + errorTable = new ErrorTable(this); + scrollPane.setBorder(BorderFactory.createEmptyBorder()); + scrollPane.setViewportView(errorTable); + ef.addPanel(scrollPane, Language.text("editor.footer.errors"), "/lib/footer/error"); } @@ -463,16 +449,6 @@ public EditorState getEditorState() { } -// public void removeRecent() { -// Recent.remove(this); -// } -// -// -// public void addRecent() { -// Recent.handle(this); -// } - - /** * Handles files dragged & dropped from the desktop and into the editor * window. Dragging files into the editor window is the same as using @@ -555,61 +531,67 @@ public void rebuildHeader() { } - protected void initModeMenu() { - modeMenu = new JMenu(); + public void rebuildModePopup() { + modePopup = new JMenu(); ButtonGroup modeGroup = new ButtonGroup(); for (final Mode m : base.getModeList()) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(m.getTitle()); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (!sketch.isModified()) { - base.changeMode(m); + if (!base.changeMode(m)) { + reselectMode(); + Messages.showWarning(Language.text("warn.cannot_change_mode.title"), + Language.interpolate("warn.cannot_change_mode.body", m)); + } } else { + reselectMode(); Messages.showWarning("Save", "Please save the sketch before changing the mode."); - - // Re-select the old checkbox, because it was automatically - // updated by Java, even though the Mode could not be changed. - // https://github.com/processing/processing/issues/2615 - for (Component c : modeMenu.getPopupMenu().getComponents()) { - if (c instanceof JRadioButtonMenuItem) { - if (((JRadioButtonMenuItem)c).getText() == mode.getTitle()) { - ((JRadioButtonMenuItem)c).setSelected(true); - break; - } - } - } } } }); - modeMenu.add(item); + modePopup.add(item); modeGroup.add(item); if (mode == m) { item.setSelected(true); } } - modeMenu.addSeparator(); + modePopup.addSeparator(); JMenuItem addLib = new JMenuItem(Language.text("toolbar.add_mode")); addLib.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - ContributionManager.openModeManager(Editor.this); + ContributionManager.openModes(); } }); - modeMenu.add(addLib); + modePopup.add(addLib); - Toolkit.setMenuMnemsInside(modeMenu); + Toolkit.setMenuMnemsInside(modePopup); } + // Re-select the old checkbox, because it was automatically + // updated by Java, even though the Mode could not be changed. + // https://github.com/processing/processing/issues/2615 + private void reselectMode() { + for (Component c : getModePopup().getComponents()) { + if (c instanceof JRadioButtonMenuItem) { + if (((JRadioButtonMenuItem)c).getText() == mode.getTitle()) { + ((JRadioButtonMenuItem)c).setSelected(true); + break; + } + } + } + } - public void rebuildModeMenu() { - initModeMenu(); + public JPopupMenu getModePopup() { + return modePopup.getPopupMenu(); } - public JMenu getModeMenu() { - return modeMenu; - } +// public JMenu getModeMenu() { +// return modePopup; +// } public EditorConsole getConsole() { @@ -745,8 +727,9 @@ protected void buildMenuBar() { menubar.add(modeMenu); } - rebuildToolMenu(); - menubar.add(getToolMenu()); + toolsMenu = new JMenu(Language.text("menu.tools")); + base.populateToolsMenu(toolsMenu); + menubar.add(toolsMenu); menubar.add(buildHelpMenu()); Toolkit.setMenuMnemonics(menubar); @@ -898,13 +881,8 @@ protected JMenu buildEditMenu() { undoItem = Toolkit.newJMenuItem(undoAction = new UndoAction(), 'Z'); menu.add(undoItem); - // Gotta follow them interface guidelines - // http://code.google.com/p/processing/issues/detail?id=363 - if (Platform.isWindows()) { - redoItem = Toolkit.newJMenuItem(redoAction = new RedoAction(), 'Y'); - } else { // Linux and OS X - redoItem = Toolkit.newJMenuItemShift(redoAction = new RedoAction(), 'Z'); - } + redoItem = new JMenuItem(redoAction = new RedoAction()); + redoItem.setAccelerator(Toolkit.getKeyStrokeExt("menu.edit.redo")); menu.add(redoItem); menu.addSeparator(); @@ -973,7 +951,7 @@ public void actionPerformed(ActionEvent e) { }); menu.add(item); - item = Toolkit.newJMenuItem(Language.text("menu.edit.comment_uncomment"), '/'); + item = Toolkit.newJMenuItemExt("menu.edit.comment_uncomment"); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleCommentUncomment(); @@ -981,7 +959,7 @@ public void actionPerformed(ActionEvent e) { }); menu.add(item); - item = Toolkit.newJMenuItem("\u2192 "+Language.text("menu.edit.increase_indent"), ']'); + item = Toolkit.newJMenuItemExt("menu.edit.increase_indent"); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleIndentOutdent(true); @@ -989,7 +967,7 @@ public void actionPerformed(ActionEvent e) { }); menu.add(item); - item = Toolkit.newJMenuItem("\u2190 "+Language.text("menu.edit.decrease_indent"), '['); + item = Toolkit.newJMenuItemExt("menu.edit.decrease_indent"); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleIndentOutdent(false); @@ -1097,7 +1075,7 @@ public void actionPerformed(ActionEvent e) { sketchMenu.addMenuListener(new MenuListener() { // Menu Listener that populates the menu only when the menu is opened - List menuList = new ArrayList(); + List menuList = new ArrayList<>(); @Override public void menuSelected(MenuEvent event) { @@ -1149,172 +1127,51 @@ public void menuCanceled(MenuEvent event) { abstract public void handleImportLibrary(String name); - public JMenu getToolMenu() { - if (toolsMenu == null) { - rebuildToolMenu(); - } - return toolsMenu; - } + public void librariesChanged() { } + public void codeFolderChanged() { } -// protected void rebuildToolList() { -// coreTools = ToolContribution.list(Base.getToolsFolder(), true); -// contribTools = ToolContribution.list(Base.getSketchbookToolsFolder(), true); -// } + public void sketchChanged() { } - public void rebuildToolMenu() { - if (toolsMenu == null) { - toolsMenu = new JMenu(Language.text("menu.tools")); - } else { - toolsMenu.removeAll(); - } - -// rebuildToolList(); - coreTools = ToolContribution.loadAll(Base.getToolsFolder()); - contribTools = ToolContribution.loadAll(Base.getSketchbookToolsFolder()); + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - addInternalTools(toolsMenu); - addTools(toolsMenu, coreTools); - addTools(toolsMenu, contribTools); - toolsMenu.addSeparator(); - JMenuItem item = new JMenuItem(Language.text("menu.tools.add_tool")); - item.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - ContributionManager.openToolManager(Editor.this); - } - }); - toolsMenu.add(item); + public JMenu getToolMenu() { + return toolsMenu; } - public void clearToolMenu() { - toolsMenu.removeAll(); - System.gc(); + /* + public JMenu getToolMenu() { + if (toolsMenu == null) { + rebuildToolMenu(); + } + return toolsMenu; } - public void removeTool() { rebuildToolMenu(); } + */ -// /** -// * Attempt to init or run a Tool from the safety of a try/catch block that -// * will report errors to the user. -// * @param tool The Tool object to be inited or run -// * @param item null to call init(), or the existing JMenuItem for run() -// * @return -// */ -// protected boolean safeTool(Tool tool, JMenuItem item) { -// try { -// if (item == null) { -// tool.init(Editor.this); -// } else { -// tool.run(); -// } -// return true; -// -// } catch (NoSuchMethodError nsme) { -// System.out.println("tool is " + tool + " "); -// statusError("\"" + tool.getMenuTitle() + "\" " + -// "is not compatible with this version of Processing"); -// nsme.printStackTrace(); -// -// } catch (Exception ex) { -// statusError("An error occurred inside \"" + tool.getMenuTitle() + "\""); -// ex.printStackTrace(); -// } -// if (item != null) { -// item.setEnabled(false); // don't you try that again -// } -// return false; -// } - - - void addToolItem(final Tool tool, Map toolItems) { - String title = tool.getMenuTitle(); - final JMenuItem item = new JMenuItem(title); - item.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - try { - tool.run(); - - } catch (NoSuchMethodError nsme) { - statusError("\"" + tool.getMenuTitle() + "\" is not" + - "compatible with this version of Processing"); - //nsme.printStackTrace(); - Messages.loge("Incompatible tool found during tool.run()", nsme); - item.setEnabled(false); - - } catch (Exception ex) { - statusError("An error occurred inside \"" + tool.getMenuTitle() + "\""); - ex.printStackTrace(); - item.setEnabled(false); - } - } - }); - //menu.add(item); - toolItems.put(title, item); + /** + * Clears the Tool menu and runs the gc so that contributions can be updated + * without classes still being in use. + */ + public void clearToolMenu() { + toolsMenu.removeAll(); + System.gc(); } - protected void addTools(JMenu menu, List tools) { - Map toolItems = new HashMap(); - - for (final ToolContribution tool : tools) { - try { - tool.init(Editor.this); - // If init() fails, the item won't be added to the menu - addToolItem(tool, toolItems); - - // With the exceptions, we can't call statusError because the window - // isn't completely set up yet. Also not gonna pop up a warning because - // people may still be running different versions of Processing. - // TODO Once the dust settles on 2.x, change this to Base.showError() - // and open the Tools folder instead of showing System.err.println(). - - } catch (VerifyError ve) { - System.err.println("\"" + tool.getMenuTitle() + "\" is not " + - "compatible with this version of Processing"); - - } catch (NoSuchMethodError nsme) { - System.err.println("\"" + tool.getMenuTitle() + "\" is not " + - "compatible with this version of Processing"); - System.err.println("The " + nsme.getMessage() + " method no longer exists."); - Messages.loge("Incompatible Tool found during tool.init()", nsme); - - } catch (NoClassDefFoundError ncdfe) { - System.err.println("\"" + tool.getMenuTitle() + "\" is not " + - "compatible with this version of Processing"); - System.err.println("The " + ncdfe.getMessage() + " class is no longer available."); - Messages.loge("Incompatible Tool found during tool.init()", ncdfe); - - } catch (AbstractMethodError ame) { - System.err.println("\"" + tool.getMenuTitle() + "\" is not " + - "compatible with this version of Processing"); -// ame.printStackTrace(); - - } catch (Error err) { - System.err.println("An error occurred inside \"" + tool.getMenuTitle() + "\""); - err.printStackTrace(); - - } catch (Exception ex) { - System.err.println("An exception occurred inside \"" + tool.getMenuTitle() + "\""); - ex.printStackTrace(); - } - } - - ArrayList toolList = new ArrayList(toolItems.keySet()); - if (toolList.size() > 0) { - menu.addSeparator(); - Collections.sort(toolList); - for (String title : toolList) { - menu.add(toolItems.get(title)); - } - } + /** + * Updates update count in the UI. Called on EDT. + * @param count number of available updates + */ + public void setUpdatesAvailable(int count) { + footer.setUpdateCount(count); } @@ -1326,6 +1183,7 @@ public JMenu buildModeMenu() { } + /* protected void addToolMenuItem(JMenu menu, String className) { try { Class toolClass = Class.forName(className); @@ -1341,22 +1199,14 @@ public void actionPerformed(ActionEvent e) { } }); menu.add(item); -// return item; } catch (Exception e) { e.printStackTrace(); -// return null; } } protected JMenu addInternalTools(JMenu menu) { -// JMenuItem item; -// item = createToolMenuItem("processing.app.tools.AutoFormatTool"); -// int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); -// item.setAccelerator(KeyStroke.getKeyStroke('T', modifiers)); -// menu.add(item); - addToolMenuItem(menu, "processing.app.tools.CreateFont"); addToolMenuItem(menu, "processing.app.tools.ColorSelector"); addToolMenuItem(menu, "processing.app.tools.Archiver"); @@ -1365,27 +1215,9 @@ protected JMenu addInternalTools(JMenu menu) { addToolMenuItem(menu, "processing.app.tools.InstallCommander"); } - // I think this is no longer needed... It was Mac OS X specific, - // and they gave up on MacRoman a long time ago. -// addToolMenuItem(menu, "processing.app.tools.FixEncoding"); - - // currently commented out -// if (Base.DEBUG) { -// addToolMenuItem(menu, "processing.app.tools.ExportExamples"); -// } - -// // These are temporary entries while Android mode is being worked out. -// // The mode will not be in the tools menu, and won't involve a cmd-key -// if (!Base.RELEASE) { -// item = createToolMenuItem("processing.app.tools.android.AndroidTool"); -// item.setAccelerator(KeyStroke.getKeyStroke('D', modifiers)); -// menu.add(item); -// menu.add(createToolMenuItem("processing.app.tools.android.Permissions")); -// menu.add(createToolMenuItem("processing.app.tools.android.Reset")); -// } - return menu; } + */ /* @@ -1570,6 +1402,15 @@ public void actionPerformed(ActionEvent e) { redoAction.updateRedoState(); if (sketch != null) { sketch.setModified(!getText().equals(sketch.getCurrentCode().getSavedProgram())); + // Go through all tabs; Replace All, Rename or Undo could have changed them + for (SketchCode sc : sketch.getCode()) { + if (sc.getDocument() != null) { + try { + sc.setModified(!sc.getDocumentText().equals(sc.getSavedProgram())); + } catch (BadLocationException ignore) { } + } + } + repaintHeader(); } } @@ -1626,6 +1467,16 @@ public void actionPerformed(ActionEvent e) { undoAction.updateUndoState(); if (sketch != null) { sketch.setModified(!getText().equals(sketch.getCurrentCode().getSavedProgram())); + // Go through all tabs; Replace All, Rename or Undo could have changed them + for (SketchCode sc : sketch.getCode()) { + if (sc.getDocument() != null) { + try { + sc.setModified(!sc.getDocumentText().equals(sc.getSavedProgram())); + } catch (BadLocationException ignore) { + } + } + } + repaintHeader(); } } @@ -1752,6 +1603,11 @@ public JEditTextArea getTextArea() { } + public PdeTextArea getPdeTextArea() { + return (textarea instanceof PdeTextArea) ? (PdeTextArea) textarea : null; + } + + /** * Get the contents of the current buffer. Used by the Sketch class. */ @@ -1769,7 +1625,9 @@ public String getText(int start, int stop) { /** - * Replace the entire contents of the front-most tab. + * Replace the entire contents of the front-most tab. Note that this does + * a compound edit, so internal callers may want to use textarea.setText() + * if this is part of a larger compound edit. */ public void setText(String what) { startCompoundEdit(); @@ -1787,24 +1645,6 @@ public void insertText(String what) { } - /** - * 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(); } @@ -1815,6 +1655,11 @@ public void setSelectedText(String what) { } + public void setSelectedText(String what, boolean ever) { + textarea.setSelectedText(what, ever); + } + + 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()); @@ -1903,12 +1748,24 @@ public int getLineCount() { /** - * Use before a manipulating text to group editing operations together as a - * single undo. Use stopCompoundEdit() once finished. + * Use before a manipulating text to group editing operations together + * as a single undo. Use stopCompoundEdit() once finished. */ public void startCompoundEdit() { - stopCompoundEdit(); + // Call endTextEditHistory() before starting a new CompoundEdit, + // because there's a timer that's possibly set off for 3 seconds after + // which endTextEditHistory() is called, which means that things get + // messed up. Hence, manually call this method so that auto-format gets + // undone in one fell swoop if the user calls auto-formats within 3 + // seconds of typing in the last character. Then start a new compound + // edit so that the auto-format can be undone in one go. + // https://github.com/processing/processing/issues/3003 + endTextEditHistory(); // also calls stopCompoundEdit() + + //stopCompoundEdit(); compoundEdit = new CompoundEdit(); + caretUndoStack.push(textarea.getCaretPosition()); + caretRedoStack.clear(); } @@ -1919,8 +1776,6 @@ public void stopCompoundEdit() { if (compoundEdit != null) { compoundEdit.end(); undo.addEdit(compoundEdit); - caretUndoStack.push(textarea.getCaretPosition()); - caretRedoStack.clear(); undoAction.updateUndoState(); redoAction.updateRedoState(); compoundEdit = null; @@ -1944,11 +1799,24 @@ public void setCode(SketchCode code) { SyntaxDocument document = (SyntaxDocument) code.getDocument(); if (document == null) { // this document not yet inited - document = new SyntaxDocument(); + document = new SyntaxDocument() { + @Override + public void beginCompoundEdit() { + if (compoundEdit == null) + startCompoundEdit(); + super.beginCompoundEdit(); + } + + @Override + public void endCompoundEdit() { + stopCompoundEdit(); + super.endCompoundEdit(); + } + }; code.setDocument(document); // turn on syntax highlighting - document.setTokenMarker(mode.getTokenMarker()); + document.setTokenMarker(mode.getTokenMarker(code)); // insert the program text into the document object try { @@ -1963,17 +1831,20 @@ public void setCode(SketchCode code) { document.addDocumentListener(new DocumentListener() { public void removeUpdate(DocumentEvent e) { - if (isInserting && isDirectEdit()) { + if (isInserting && isDirectEdit() && !textarea.isOverwriteEnabled()) { endTextEditHistory(); } isInserting = false; } public void insertUpdate(DocumentEvent e) { - if (!isInserting && isDirectEdit()) { + if (!isInserting && !textarea.isOverwriteEnabled() && isDirectEdit()) { endTextEditHistory(); } - isInserting = true; + + if (!textarea.isOverwriteEnabled()) { + isInserting = true; + } } public void changedUpdate(DocumentEvent e) { @@ -2026,10 +1897,11 @@ boolean isDirectEdit() { return endUndoEvent != null; } + void startTimerEvent() { endUndoEvent = new TimerTask() { public void run() { - endTextEditHistory(); + EventQueue.invokeLater(Editor.this::endTextEditHistory); } }; timer.schedule(endUndoEvent, 3000); @@ -2037,6 +1909,7 @@ public void run() { timer.purge(); } + void endTextEditHistory() { if (endUndoEvent != null) { endUndoEvent.cancel(); @@ -2045,6 +1918,13 @@ void endTextEditHistory() { stopCompoundEdit(); } + + public void removeNotify() { + timer.cancel(); + super.removeNotify(); + } + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @@ -2198,11 +2078,12 @@ public void handleAutoFormat() { if (formattedText.equals(source)) { statusNotice(Language.text("editor.status.autoformat.no_changes")); - } else { - // replace with new bootiful text + + } else { // replace with new bootiful text + startCompoundEdit(); // selectionEnd hopefully at least in the neighborhood int scrollPos = textarea.getVerticalScrollPosition(); - setText(formattedText); + textarea.setText(formattedText); setSelection(selectionEnd, selectionEnd); // Put the scrollbar position back, otherwise it jumps on each format. @@ -2210,17 +2091,10 @@ public void handleAutoFormat() { // a more complicated workaround here is fairly pointless. // http://code.google.com/p/processing/issues/detail?id=1533 if (scrollPos != textarea.getVerticalScrollPosition()) { -// boolean wouldBeVisible = -// scrollPos >= textarea.getFirstLine() && -// scrollPos < textarea.getLastLine(); -// -// // if it was visible, and now it's not, then allow the scroll -// if (!(wasVisible && !wouldBeVisible)) { textarea.setVerticalScrollPosition(scrollPos); -// } } - getSketch().setModified(true); - // mark as finished + stopCompoundEdit(); + sketch.setModified(true); statusNotice(Language.text("editor.status.autoformat.finished")); } @@ -2268,13 +2142,26 @@ protected void handleCommentUncomment() { // log("Commented: " + commented); - // This is the line start offset of the first line, which is added to - // all other lines while adding a comment. Required when commenting + // This is the min line start offset of the selection, which is added to + // all lines while adding a comment. Required when commenting // lines which have uneven whitespaces in the beginning. Makes the // commented lines look more uniform. int lso = Math.abs(textarea.getLineStartNonWhiteSpaceOffset(startLine) - textarea.getLineStartOffset(startLine)); + if (!commented) { + // get min line start offset of all selected lines + for (int line = startLine+1; line <= stopLine; line++) { + String lineText = textarea.getLineText(line); + if (lineText.trim().length() == 0) { + continue; //ignore blank lines + } + int so = Math.abs(textarea.getLineStartNonWhiteSpaceOffset(line) + - textarea.getLineStartOffset(line)); + lso = Math.min(lso, so); + } + } + for (int line = startLine; line <= stopLine; line++) { int location = textarea.getLineStartNonWhiteSpaceOffset(line); String lineText = textarea.getLineText(line); @@ -2282,11 +2169,7 @@ protected void handleCommentUncomment() { continue; //ignore blank lines if (commented) { // remove a comment - if (lineText.trim().startsWith(prefix + " ")) { - textarea.select(location, location + prefixLen + 1); - } else { - textarea.select(location, location + prefixLen); - } + textarea.select(location, location + prefixLen); textarea.setSelectedText(""); } else { // add a comment @@ -2345,7 +2228,7 @@ public void handleIndentOutdent(boolean indent) { int last = Math.min(location + tabSize, textarea.getDocumentLength()); textarea.select(location, last); // Don't eat code if it's not indented - if (textarea.getSelectedText().equals(tabString)) { + if (tabString.equals(textarea.getSelectedText())) { textarea.setSelectedText(""); } } @@ -2444,11 +2327,11 @@ protected void handleFindReference() { if (ref != null) { showReference(ref + ".html"); } else { - String text = textarea.getSelectedText().trim(); - if (text.length() == 0) { + String text = textarea.getSelectedText(); + if (text == null) { statusNotice(Language.text("editor.status.find_reference.select_word_first")); } else { - statusNotice(Language.interpolate("editor.status.find_reference.not_available", text)); + statusNotice(Language.interpolate("editor.status.find_reference.not_available", text.trim())); } } } @@ -2524,6 +2407,14 @@ public Point getSketchLocation() { // } + public boolean isDebuggerEnabled() { + return false; + } + + + public void toggleBreakpoint(int lineIndex) { } + + /** * Check if the sketch is modified and ask user to save changes. * @return false if canceling the close/quit operation @@ -2582,7 +2473,9 @@ public boolean checkModified() { JOptionPane.QUESTION_MESSAGE); String[] options = new String[] { - Language.text("save.btn.save"), Language.text("prompt.cancel"), Language.text("save.btn.dont_save") + Language.text("save.btn.save"), + Language.text("prompt.cancel"), + Language.text("save.btn.dont_save") }; pane.setOptions(options); @@ -2592,7 +2485,7 @@ public boolean checkModified() { // 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)); + Integer.valueOf(2)); JDialog dialog = pane.createDialog(this, null); dialog.setVisible(true); @@ -2706,6 +2599,7 @@ protected void handleOpenInternal(String path) throws EditorException { Preferences.save(); } + /** * Set the title of the PDE window based on the current sketch, i.e. * something like "sketch_070752a - Processing 0126" @@ -2781,7 +2675,7 @@ public boolean handleSaveAs() { statusNotice(Language.text("editor.status.saving")); try { if (sketch.saveAs()) { - // statusNotice("Done Saving."); + //statusNotice(Language.text("editor.status.saving.done")); // status is now printed from Sketch so that "Done Saving." // is only printed after Save As when progress bar is shown. } else { @@ -2796,6 +2690,29 @@ public boolean handleSaveAs() { } + /* + public void handleSaveAs() { + statusNotice(Language.text("editor.status.saving")); + sketch.saveAs(); + } + + + public void handleSaveAsSuccess() { + statusNotice(Language.text("editor.status.saving.done")); + } + + + public void handleSaveAsCanceled() { + statusNotice(Language.text("editor.status.saving.canceled")); + } + + + public void handleSaveAsError(Exception e) { + statusError(e); + } + */ + + /** * Handler for File → Page Setup. */ @@ -2817,15 +2734,51 @@ public void handlePageSetup() { */ public void handlePrint() { statusNotice(Language.text("editor.status.printing")); + + StringBuilder html = new StringBuilder(""); + for (SketchCode tab : sketch.getCode()) { + html.append("" + tab.getPrettyName() + "
"); + html.append(textarea.getTextAsHtml((SyntaxDocument)tab.getDocument())); + html.append("
"); + } + html.setLength(html.length() - 4); // Don't want last
. + html.append(""); + JTextPane jtp = new JTextPane(); + // Needed for good line wrapping; otherwise one very long word breaks + // wrapping for the whole document. + jtp.setEditorKit(new HTMLEditorKit() { + public ViewFactory getViewFactory() { + return new HTMLFactory() { + public View create(Element e) { + View v = super.create(e); + if (!(v instanceof javax.swing.text.html.ParagraphView)) + return v; + else + return new javax.swing.text.html.ParagraphView(e) { + protected SizeRequirements calculateMinorAxisRequirements( + int axis, SizeRequirements r) { + r = super.calculateMinorAxisRequirements(axis, r); + r.minimum = 1; + return r; + } + }; + } + }; + } + }); + jtp.setFont(new Font(Preferences.get("editor.font.family"), Font.PLAIN, 10)); + jtp.setText(html.toString().replace("\n", "
") // Not in a

.
+        .replaceAll("(? statusMessage(message, type));
+    }
+  }
+
+
   public void startIndeterminate() {
     status.startIndeterminate();
   }
@@ -3032,6 +3054,158 @@ public boolean isHalted() {
   // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
 
+  public void setProblemList(List problems) {
+    this.problems = problems;
+    boolean hasErrors = problems.stream().anyMatch(Problem::isError);
+    updateErrorTable(problems);
+    errorColumn.updateErrorPoints(problems);
+    textarea.repaint();
+    updateErrorToggle(hasErrors);
+    updateEditorStatus();
+  }
+
+
+  /**
+   * Updates the error table in the Error Window.
+   */
+  public void updateErrorTable(List problems) {
+    if (errorTable != null) {
+      errorTable.clearRows();
+
+      for (Problem p : problems) {
+        String message = p.getMessage();
+        errorTable.addRow(p, message,
+                          sketch.getCode(p.getTabIndex()).getPrettyName(),
+                          Integer.toString(p.getLineNumber() + 1));
+        // Added +1 because lineNumbers internally are 0-indexed
+      }
+    }
+  }
+
+
+  public void highlight(Problem p) {
+    if (p != null) {
+      highlight(p.getTabIndex(), p.getStartOffset(), p.getStopOffset());
+    }
+  }
+
+
+  public void highlight(int tabIndex, int startOffset, int stopOffset) {
+    // Switch to tab
+    toFront();
+    sketch.setCurrentCode(tabIndex);
+
+    // Make sure offsets are in bounds
+    int length = textarea.getDocumentLength();
+    startOffset = PApplet.constrain(startOffset, 0, length);
+    stopOffset = PApplet.constrain(stopOffset, 0, length);
+
+    // Highlight the code
+    textarea.select(startOffset, stopOffset);
+
+    // Scroll to error line
+    textarea.scrollToCaret();
+    repaint();
+  }
+
+
+  public List getProblems() {
+    return problems;
+  }
+
+
+  /**
+   * Updates editor status bar, depending on whether the caret is on an error
+   * line or not
+   */
+  public void updateEditorStatus() {
+    Problem problem = findProblem(textarea.getCaretLine());
+    if (problem != null) {
+      int type = problem.isError() ?
+        EditorStatus.CURSOR_LINE_ERROR : EditorStatus.CURSOR_LINE_WARNING;
+      statusMessage(problem.getMessage(), type);
+    } else {
+      switch (getStatusMode()) {
+        case EditorStatus.CURSOR_LINE_ERROR:
+        case EditorStatus.CURSOR_LINE_WARNING:
+          statusEmpty();
+          break;
+      }
+    }
+  }
+
+
+  /**
+   * @return the Problem for the most relevant error or warning on 'line',
+   *         defaults to the first error, if there are no errors first warning.
+   */
+  protected Problem findProblem(int line) {
+    List problems = findProblems(line);
+    for (Problem p : problems) {
+      if (p.isError()) return p;
+    }
+    return problems.isEmpty() ? null : problems.get(0);
+  }
+
+
+  public List findProblems(int line) {
+    int currentTab = getSketch().getCurrentCodeIndex();
+    return problems.stream()
+        .filter(p -> p.getTabIndex() == currentTab)
+        .filter(p -> {
+          int pStartLine = p.getLineNumber();
+          int pEndOffset = p.getStopOffset();
+          int pEndLine = textarea.getLineOfOffset(pEndOffset);
+          return line >= pStartLine && line <= pEndLine;
+        })
+        .collect(Collectors.toList());
+  }
+
+
+  public void repaintErrorBar() {
+    errorColumn.repaint();
+  }
+
+
+  public void showConsole() {
+    footer.setPanel(console);
+  }
+
+
+  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+
+  static Font font;
+  static Color textColor;
+  static Color bgColorWarning;
+  static Color bgColorError;
+
+
+  public void statusToolTip(JComponent comp, String message, boolean error) {
+    if (font == null) {
+      font = Toolkit.getSansFont(Toolkit.zoom(9), Font.PLAIN);
+      textColor = mode.getColor("errors.selection.fgcolor");
+      bgColorWarning = mode.getColor("errors.selection.warning.bgcolor");
+      bgColorError = mode.getColor("errors.selection.error.bgcolor");
+    }
+
+    Color bgColor = error ? bgColorError : bgColorWarning;
+    int m = Toolkit.zoom(3);
+    String css =
+      String.format("margin: %d %d %d %d; ", -m, -m, -m, -m) +
+      String.format("padding: %d %d %d %d; ", m, m, m, m) +
+      "background: #" + PApplet.hex(bgColor.getRGB(), 8).substring(2) + ";" +
+      "font-family: " + font.getFontName() + ", sans-serif;" +
+      "font-size: " + font.getSize() + "px;";
+    String content =
+      " 
" + message + "
"; + comp.setToolTipText(content); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + /** * Returns the edit popup menu. */ diff --git a/app/src/processing/app/ui/EditorButton.java b/app/src/processing/app/ui/EditorButton.java index c424dd2f13..f65f081398 100644 --- a/app/src/processing/app/ui/EditorButton.java +++ b/app/src/processing/app/ui/EditorButton.java @@ -2,7 +2,8 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2015 The Processing Foundation + + Copyright (c) 2015-19 The Processing Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 @@ -30,7 +31,7 @@ abstract public class EditorButton extends JComponent implements MouseListener, MouseMotionListener, ActionListener { - static public final int DIM = 30; + static public final int DIM = Toolkit.zoom(30); /** Button's description. */ protected String title; @@ -42,7 +43,7 @@ abstract public class EditorButton extends JComponent protected boolean pressed; protected boolean selected; protected boolean rollover; - protected JLabel rolloverLabel; +// protected JLabel rolloverLabel; protected boolean shift; protected Image enabledImage; @@ -53,33 +54,35 @@ abstract public class EditorButton extends JComponent protected Image gradient; - protected Mode mode; + protected EditorToolbar toolbar; +// protected Mode mode; - public EditorButton(Mode mode, String name, String title) { - this(mode, name, title, title, title); + public EditorButton(EditorToolbar parent, String name, String title) { + this(parent, name, title, title, title); } - public EditorButton(Mode mode, String name, + public EditorButton(EditorToolbar parent, String name, String title, String titleShift) { - this(mode, name, title, titleShift, title); + this(parent, name, title, titleShift, title); } - public EditorButton(Mode mode, String name, + public EditorButton(EditorToolbar parent, String name, String title, String titleShift, String titleAlt) { - this.mode = mode; + this.toolbar = parent; this.title = title; this.titleShift = titleShift; this.titleAlt = titleAlt; - final int res = Toolkit.highResDisplay() ? 2 : 1; - disabledImage = mode.loadImage(name + "-disabled-" + res + "x.png"); - enabledImage = mode.loadImage(name + "-enabled-" + res + "x.png"); - selectedImage = mode.loadImage(name + "-selected-" + res + "x.png"); - pressedImage = mode.loadImage(name + "-pressed-" + res + "x.png"); - rolloverImage = mode.loadImage(name + "-rollover-" + res + "x.png"); + Mode mode = toolbar.mode; + + disabledImage = mode.loadImageX(name + "-disabled"); + enabledImage = mode.loadImageX(name + "-enabled"); + selectedImage = mode.loadImageX(name + "-selected"); + pressedImage = mode.loadImageX(name + "-pressed"); + rolloverImage = mode.loadImageX(name + "-rollover"); if (disabledImage == null) { disabledImage = enabledImage; @@ -110,10 +113,18 @@ public void paintComponent(Graphics g) { } else if (rollover) { image = rolloverImage; } + + Graphics2D g2 = (Graphics2D) g; + g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BICUBIC); + + int dim = getSize().width; // width == height if (gradient != null) { - g.drawImage(gradient, 0, 0, DIM, DIM, this); + //g.drawImage(gradient, 0, 0, DIM, DIM, this); + g.drawImage(gradient, 0, 0, dim, dim, this); } - g.drawImage(image, 0, 0, DIM, DIM, this); + //g.drawImage(image, 0, 0, DIM, DIM, this); + g.drawImage(image, 0, 0, dim, dim, this); } @@ -138,9 +149,9 @@ public void paintComponent(Graphics g) { // } - public void setReverse() { - gradient = mode.makeGradient("reversed", DIM, DIM); - } +// public void setReverse() { +// gradient = mode.makeGradient("reversed", DIM, DIM); +// } // public void setGradient(Image gradient) { @@ -148,9 +159,9 @@ public void setReverse() { // } - public void setRolloverLabel(JLabel label) { - rolloverLabel = label; - } +// public void setRolloverLabel(JLabel label) { +// rolloverLabel = label; +// } @Override @@ -200,9 +211,37 @@ public void setSelected(boolean selected) { } + /* @Override - public void mouseEntered(MouseEvent e) { - rollover = true; + public void keyTyped(KeyEvent e) { } + + + @Override + public void keyReleased(KeyEvent e) { + updateRollover(e); + } + + + @Override + public void keyPressed(KeyEvent e) { + System.out.println(e); + updateRollover(e); + } + */ + + + public String getRolloverText(InputEvent e) { + if (e.isShiftDown()) { + return titleShift; + } else if (e.isAltDown()) { + return titleAlt; + } + return title; + } + + + /* + public void updateRollover(InputEvent e) { if (rolloverLabel != null) { if (e.isShiftDown()) { rolloverLabel.setText(titleShift); @@ -212,17 +251,31 @@ public void mouseEntered(MouseEvent e) { rolloverLabel.setText(title); } } + } + */ + + + @Override + public void mouseEntered(MouseEvent e) { + toolbar.setRollover(this, e); + /* + rollover = true; + updateRollover(e); repaint(); + */ } @Override public void mouseExited(MouseEvent e) { + toolbar.setRollover(null, e); + /* rollover = false; if (rolloverLabel != null) { rolloverLabel.setText(""); } repaint(); + */ } diff --git a/app/src/processing/app/ui/EditorConsole.java b/app/src/processing/app/ui/EditorConsole.java index 02060662c2..186e692b90 100644 --- a/app/src/processing/app/ui/EditorConsole.java +++ b/app/src/processing/app/ui/EditorConsole.java @@ -3,7 +3,8 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2004-10 Ben Fry and Casey Reas + Copyright (c) 2012-19 The Processing Foundation + Copyright (c) 2004-12 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 @@ -23,39 +24,33 @@ package processing.app.ui; -import java.awt.*; -import java.awt.event.*; -import java.io.*; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.OutputStream; +import java.io.PrintStream; +import java.util.concurrent.LinkedBlockingQueue; import javax.swing.*; +import javax.swing.border.MatteBorder; import javax.swing.text.*; -import processing.app.Base; +import processing.app.Console; import processing.app.Mode; -import processing.app.Platform; import processing.app.Preferences; -import processing.core.PApplet; - -import java.text.SimpleDateFormat; -import java.util.*; /** * Message console that sits below the editing area. - *

- * Be careful when debugging this class, because if it's throwing exceptions, - * don't take over System.err, and debug while watching just System.out - * or just call println() or whatever directly to systemOut or systemErr. - *

- * Also note that encodings will not work properly when run from Eclipse. This - * means that if you use non-ASCII characters in a println() or some such, - * the characters won't print properly in the Processing and/or Eclipse console. - * It seems that Eclipse's console-grabbing and that of Processing don't - * get along with one another. Use 'ant run' to work on encoding-related issues. */ public class EditorConsole extends JScrollPane { Editor editor; + Timer flushTimer; + JTextPane consoleTextPane; BufferedStyledDocument consoleDoc; @@ -63,118 +58,71 @@ public class EditorConsole extends JScrollPane { MutableAttributeSet errStyle; int maxLineCount; + int maxCharCount; PrintStream sketchOut; PrintStream sketchErr; - // 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 PrintStream systemOut; - static PrintStream systemErr; - - static PrintStream consoleOut; - static PrintStream consoleErr; - - static OutputStream stdoutFile; - static OutputStream stderrFile; - - static EditorConsole currentConsole; - - // For 0185, moved the first init to this static { } block, so that we never - // have a situation that causes systemOut/Err to not be set properly. - static { - systemOut = System.out; - systemErr = System.err; - - // placing everything inside a try block because this can be a dangerous - // time for the lights to blink out and crash for and obscure reason. - try { - // Create output files that 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. - SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd"); - String randy = PApplet.nf((int) (1000 * Math.random()), 4); - String stamp = formatter.format(new Date()) + "_" + randy; - - File consoleDir = Base.getSettingsFile("console"); - consoleDir.mkdirs(); - File outFile = new File(consoleDir, stamp + ".out"); - stdoutFile = new FileOutputStream(outFile); - File errFile = new File(consoleDir, stamp + ".err"); - stderrFile = new FileOutputStream(errFile); - - consoleOut = new PrintStream(new EditorConsoleStream(false, null)); - consoleErr = new PrintStream(new EditorConsoleStream(true, null)); - - System.setOut(consoleOut); - System.setErr(consoleErr); - -// } catch (Exception e) { -// stdoutFile = null; -// stderrFile = null; -// -// e.printStackTrace(); -// Base.showWarning("Console Error", -// "A problem occurred while trying to open the\n" + -// "files used to store the console output.", e); - } catch (Exception e) { - stdoutFile = null; - stderrFile = null; - - consoleOut = null; - consoleErr = null; - - System.setOut(systemOut); - System.setErr(systemErr); - - e.printStackTrace(systemErr); - } - } + static EditorConsole current; public EditorConsole(Editor editor) { this.editor = editor; - maxLineCount = Preferences.getInteger("console.length"); + maxLineCount = Preferences.getInteger("console.scrollback.lines"); + maxCharCount = Preferences.getInteger("console.scrollback.chars"); - consoleDoc = new BufferedStyledDocument(10000, maxLineCount); + consoleDoc = new BufferedStyledDocument(10000, maxLineCount, maxCharCount); consoleTextPane = new JTextPane(consoleDoc); consoleTextPane.setEditable(false); updateMode(); - // add the jtextpane to this scrollpane - this.setViewportView(consoleTextPane); + setViewportView(consoleTextPane); + + sketchOut = new PrintStream(new EditorConsoleStream(false)); + sketchErr = new PrintStream(new EditorConsoleStream(true)); - // to fix ugliness.. normally macosx java 1.3 puts an - // ugly white border around this object, so turn it off. - if (Platform.isMacOS()) { - setBorder(null); + startTimer(); + } + + + protected void flush() { + // 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()); } + } - sketchOut = new PrintStream(new EditorConsoleStream(false, this)); - sketchErr = new PrintStream(new EditorConsoleStream(true, this)); - - // 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 the timer that handles flushing the console text. Has to be started + * and stopped/cleared because the Timer thread will keep a reference to its + * Editor around even after the Editor has been closed, leaking memory. + */ + protected void startTimer() { + if (flushTimer == null) { + // periodically post buffered messages to the console + // should the interval come from the preferences file? + flushTimer = new Timer(250, new ActionListener() { + public void actionPerformed(ActionEvent evt) { + flush(); } - } - }).start(); + }); + flushTimer.start(); + } + } - // windows puts an ugly border on this guy - setBorder(null); + + protected void stopTimer() { + if (flushTimer != null) { + flush(); // clear anything that's there + flushTimer.stop(); + flushTimer = null; + } } @@ -193,7 +141,7 @@ public PrintStream getErr() { */ protected void updateAppearance() { String fontFamily = Preferences.get("editor.font.family"); - int fontSize = Preferences.getInteger("console.font.size"); + int fontSize = Toolkit.zoom(Preferences.getInteger("console.font.size")); StyleConstants.setFontFamily(stdStyle, fontFamily); StyleConstants.setFontSize(stdStyle, fontSize); StyleConstants.setFontFamily(errStyle, fontFamily); @@ -220,6 +168,10 @@ protected void updateMode() { Color fgColorOut = mode.getColor("console.output.color"); Color fgColorErr = mode.getColor("console.error.color"); + // Make things line up with the Editor above. If this is ever removed, + // setBorder(null) should be called instead. The defaults are nasty. + setBorder(new MatteBorder(0, Editor.LEFT_GUTTER, 0, 0, bgColor)); + stdStyle = new SimpleAttributeSet(); StyleConstants.setForeground(stdStyle, fgColorOut); StyleConstants.setBackground(stdStyle, bgColor); @@ -256,51 +208,33 @@ protected void updateMode() { static public void setEditor(Editor editor) { - currentConsole = editor.console; + if (current != null) { + current.stopTimer(); // allow to be garbage collected + } + editor.console.setCurrent(); } - /** - * 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 static void handleQuit() { - // replace original streams to remove references to console's streams - System.setOut(systemOut); - System.setErr(systemErr); - - try { - // close the PrintStream - if (consoleOut != null) consoleOut.close(); - if (consoleErr != null) consoleErr.close(); - - // also have to close the original FileOutputStream - // otherwise it won't be shut down completely - if (stdoutFile != null) stdoutFile.close(); - if (stderrFile != null) stderrFile.close(); - - } catch (IOException e) { - e.printStackTrace(systemErr); - } + void setCurrent() { + current = this; //editor.console; + startTimer(); + Console.setEditor(sketchOut, sketchErr); } - synchronized public void message(String what, boolean err) { - if (err) { - systemErr.print(what); - } else { - systemOut.print(what); - } - + public void message(String what, boolean err) { if (err && (what.contains("invalid context 0x0") || (what.contains("invalid drawable")))) { // Respectfully declining... This is a quirk of more recent releases of // Java on Mac OS X, but is widely reported as the source of any other // bug or problem that a user runs into. It may well be a Processing // bug, but until we know, we're suppressing the messages. + } else if (err && what.contains("is calling TIS/TSM in non-main thread environment")) { + // Error message caused by JOGL since macOS 10.13.4, cannot fix at the moment so silencing it: + // https://github.com/processing/processing/issues/5462 + // Some discussion on the Apple's developer forums seems to suggest that is not serious: + // https://forums.developer.apple.com/thread/105244 + } else if (err && what.contains("NSWindow drag regions should only be invalidated on the Main Thread")) { + // Keep hiding warnings triggered by JOGL on recent macOS versions (this is from 10.14 onwards I think). } else if (err && what.contains("Make pbuffer:")) { // Remove initalization warning from LWJGL. } else if (err && what.contains("XInitThreads() called for concurrent")) { @@ -335,53 +269,20 @@ public void clear() { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - private static class EditorConsoleStream extends OutputStream { - final boolean err; // whether stderr or stdout - final byte single[] = new byte[1]; - EditorConsole console; + class EditorConsoleStream extends OutputStream { + boolean err; - public EditorConsoleStream(boolean err, EditorConsole console) { + public EditorConsoleStream(boolean err) { this.err = err; - this.console = console; - } - - public void close() { } - - public void flush() { } - - public void write(byte b[]) { // appears never to be used - write(b, 0, b.length); } public void write(byte b[], int offset, int length) { - if (console != null) { - console.message(new String(b, offset, length), err); - } else if (currentConsole != null) { - currentConsole.message(new String(b, offset, length), err); - } else { - // If no console is present, still need to write this to the actual - // System.out or System.err. Otherwise we can't !#$!% debug anything. - if (err) { - systemErr.write(b, offset, length); - } else { - systemOut.write(b, offset, length); - } - } - - final OutputStream echo = err ? stderrFile : stdoutFile; - if (echo != null) { - try { - echo.write(b, offset, length); - echo.flush(); - } catch (IOException e) { - e.printStackTrace(); - } - } + message(new String(b, offset, length), err); } + // doesn't appear to be called (but must be implemented) public void write(int b) { - single[0] = (byte) b; - write(single, 0, 1); + write(new byte[] { (byte) b }, 0, 1); } } } @@ -398,22 +299,32 @@ public void write(int b) { * swing event thread, so they need to be synchronized */ class BufferedStyledDocument extends DefaultStyledDocument { - ArrayList elements = new ArrayList(); - int maxLineLength, maxLineCount; + //List elements = new ArrayList<>(); + LinkedBlockingQueue elements; +// AtomicInteger queuedLineCount = new AtomicInteger(); + int maxLineLength, maxLineCount, maxCharCount; int currentLineLength = 0; boolean needLineBreak = false; - boolean hasAppendage = false; +// boolean hasAppendage = false; + final Object insertLock = new Object(); - public BufferedStyledDocument(int maxLineLength, int maxLineCount) { + public BufferedStyledDocument(int maxLineLength, int maxLineCount, + int maxCharCount) { this.maxLineLength = maxLineLength; this.maxLineCount = maxLineCount; + this.maxCharCount = maxCharCount; + elements = new LinkedBlockingQueue<>(); + } + + // monitor 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) + public boolean hasAppendage() { + return elements.size() > 0; } /** 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; + public void appendString(String str, AttributeSet a) { +// hasAppendage = true; // process each line of the string while (str.length() > 0) { @@ -422,6 +333,7 @@ public synchronized void appendString(String str, AttributeSet a) { if (needLineBreak || currentLineLength > maxLineLength) { elements.add(new ElementSpec(a, ElementSpec.EndTagType)); elements.add(new ElementSpec(a, ElementSpec.StartTagType)); +// queuedLineCount.incrementAndGet(); currentLineLength = 0; } @@ -437,15 +349,42 @@ public synchronized void appendString(String str, AttributeSet a) { needLineBreak = true; str = str.substring(str.indexOf('\n') + 1); // eat the line } + /* + while (queuedLineCount.get() > maxLineCount) { + Console.systemOut("too many: " + queuedLineCount); + ElementSpec elem = elements.remove(); + if (elem.getType() == ElementSpec.EndTagType) { + queuedLineCount.decrementAndGet(); + } + } + */ + } + if (elements.size() > 1000) { + insertAll(); } } /** insert the buffered strings */ - public synchronized void insertAll() { - ElementSpec[] elementArray = new ElementSpec[elements.size()]; - elements.toArray(elementArray); + public void insertAll() { + /* + // each line is ~3 elements + int tooMany = elements.size() - maxLineCount*3; + if (tooMany > 0) { + try { + remove(0, getLength()); // clear the document first + } catch (BadLocationException ble) { + ble.printStackTrace(); + } + Console.systemOut("skipping " + elements.size()); + for (int i = 0; i < tooMany; i++) { + elements.remove(); + } + } + */ + ElementSpec[] elementArray = elements.toArray(new ElementSpec[0]); 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(); @@ -462,13 +401,42 @@ public synchronized void insertAll() { // remove to the end of the 200th line super.remove(0, endOffset); } - super.insert(super.getLength(), elementArray); + */ + synchronized (insertLock) { + checkLength(); + insert(getLength(), elementArray); + checkLength(); + } } 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; +// hasAppendage = false; + } + + private void checkLength() throws BadLocationException { + // set a limit on the number of characters in the console + int docLength = getLength(); + if (docLength > maxCharCount) { + remove(0, docLength - maxCharCount); + } + // 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) { + int endOffset = lineElement.getEndOffset(); + // remove to the end of the 200th line + super.remove(0, endOffset); + } + } } } diff --git a/app/src/processing/app/ui/EditorException.java b/app/src/processing/app/ui/EditorException.java index 67c170a88f..9dc210edcb 100644 --- a/app/src/processing/app/ui/EditorException.java +++ b/app/src/processing/app/ui/EditorException.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2015 The Processing Foundation + Copyright (c) 2015-19 The Processing Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 diff --git a/app/src/processing/app/ui/EditorFooter.java b/app/src/processing/app/ui/EditorFooter.java index 84f972ee07..81b16fc685 100644 --- a/app/src/processing/app/ui/EditorFooter.java +++ b/app/src/processing/app/ui/EditorFooter.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2015 The Processing Foundation + Copyright (c) 2015-19 The Processing Foundation 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 @@ -32,6 +32,8 @@ import java.awt.Image; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.awt.font.FontRenderContext; +import java.awt.geom.Ellipse2D; import java.util.ArrayList; import java.util.List; @@ -39,31 +41,39 @@ import processing.app.Mode; import processing.app.Sketch; +import processing.app.contrib.ContributionManager; /** * Console/error/whatever tabs at the bottom of the editor window. + * This shares a lot of code with EditorHeader and the Manager tabs as well. */ public class EditorFooter extends Box { // height of this tab bar - static final int HIGH = 29; + static final int HIGH = Toolkit.zoom(32); - static final int CURVE_RADIUS = 6; + static final int CURVE_RADIUS = Toolkit.zoom(6); - static final int TAB_TOP = 0; - static final int TAB_BOTTOM = 23; + static final int TAB_TOP = Toolkit.zoom(2); + static final int TAB_BOTTOM = Toolkit.zoom(29); // amount of extra space between individual tabs - static final int TAB_BETWEEN = 3; + static final int TAB_BETWEEN = Toolkit.zoom(2); // amount of margin on the left/right for the text on the tab - static final int MARGIN = 16; + static final int MARGIN = Toolkit.zoom(14); - static final int ICON_WIDTH = 14; - static final int ICON_HEIGHT = 13; - static final int ICON_TOP = 5; + static final int ICON_WIDTH = Toolkit.zoom(16); + static final int ICON_HEIGHT = Toolkit.zoom(16); + static final int ICON_TOP = Toolkit.zoom(7); + static final int ICON_MARGIN = Toolkit.zoom(7); + + static final int UNSELECTED = 0; + static final int SELECTED = 1; Color[] textColor = new Color[2]; Color[] tabColor = new Color[2]; - Color errorColor; + + Color updateColor; + int updateLeft; Editor editor; @@ -72,22 +82,19 @@ public class EditorFooter extends Box { Font font; int fontAscent; - JMenu menu; - JPopupMenu popup; - - static final int UNSELECTED = 0; - static final int SELECTED = 1; - Image offscreen; int sizeW, sizeH; int imageW, imageH; Image gradient; + Color bgColor; JPanel cardPanel; CardLayout cardLayout; Controller controller; + int updateCount; + public EditorFooter(Editor eddie) { super(BoxLayout.Y_AXIS); @@ -147,6 +154,12 @@ public void setNotification(Component comp, boolean note) { } + public void setUpdateCount(int count) { + this.updateCount = count; + repaint(); + } + + public void updateMode() { Mode mode = editor.getMode(); @@ -157,9 +170,14 @@ public void updateMode() { tabColor[SELECTED] = mode.getColor("footer.tab.selected.color"); tabColor[UNSELECTED] = mode.getColor("footer.tab.unselected.color"); - errorColor = mode.getColor("status.error.bgcolor"); + updateColor = mode.getColor("footer.updates.color"); gradient = mode.makeGradient("footer", 400, HIGH); + // Set the default background color in case the window size reported + // incorrectly by the OS, or we miss an update event of some kind + // https://github.com/processing/processing/issues/3919 + bgColor = mode.getColor("footer.gradient.bottom"); + setBackground(bgColor); } @@ -179,6 +197,9 @@ public void mousePressed(MouseEvent e) { repaint(); } } + if (updateCount > 0 && x > updateLeft) { + ContributionManager.openUpdates(); + } } }); } @@ -208,11 +229,7 @@ public void paintComponent(Graphics screen) { sizeH = size.height; imageW = sizeW; imageH = sizeH; - if (Toolkit.highResDisplay()) { - offscreen = createImage(imageW*2, imageH*2); - } else { - offscreen = createImage(imageW, imageH); - } + offscreen = Toolkit.offscreenGraphics(this, imageW, imageH); } Graphics g = offscreen.getGraphics(); @@ -222,7 +239,12 @@ public void paintComponent(Graphics screen) { } Graphics2D g2 = Toolkit.prepareGraphics(g); - g.drawImage(gradient, 0, 0, imageW, imageH, this); + + g.setColor(tabColor[SELECTED]); + // can't be done with lines, b/c retina leaves tiny hairlines + g.fillRect(0, 0, imageW, Toolkit.zoom(2)); + + g.drawImage(gradient, 0, Toolkit.zoom(2), imageW, imageH, this); // reset all tab positions for (Tab tab : tabs) { @@ -231,13 +253,10 @@ public void paintComponent(Graphics screen) { } // now actually draw the tabs - placeTabs(Editor.LEFT_GUTTER, g2); + drawTabs(Editor.LEFT_GUTTER, g2); -// // draw the two pixel line that extends left/right below the tabs -// g.setColor(tabColor[SELECTED]); -// // can't be done with lines, b/c retina leaves tiny hairlines -// g.fillRect(Editor.LEFT_GUTTER, TAB_BOTTOM, -// editor.getTextArea().getWidth() - Editor.LEFT_GUTTER, 2); + // the number of updates available in the Manager + drawUpdates(g2); screen.drawImage(offscreen, 0, 0, imageW, imageH, null); } @@ -247,7 +266,7 @@ public void paintComponent(Graphics screen) { * @param left starting position from the left * @param g graphics context, or null if we're not drawing */ - private void placeTabs(int left, Graphics2D g) { + private void drawTabs(int left, Graphics2D g) { int x = left; for (Tab tab : tabs) { @@ -259,47 +278,40 @@ private void placeTabs(int left, Graphics2D g) { x += tab.textWidth + MARGIN; tab.right = x; - // if drawing and not just placing - if (g != null) { - tab.draw(g); - /* - int state = tab.isCurrent() ? SELECTED : UNSELECTED; - g.setColor(tabColor[state]); - if (tab.notification) { - g.setColor(errorColor); - } - //drawTab(g, tab.left, tab.right, tab.isFirst(), tab.isLast()); - tab.draw(g); - - int textLeft = tab.getTextLeft(); - if (tab.notification && state == UNSELECTED) { - g.setColor(Color.LIGHT_GRAY); - } else { - g.setColor(textColor[state]); - } - int tabHeight = TAB_BOTTOM - TAB_TOP; - int baseline = TAB_TOP + (tabHeight + fontAscent) / 2; - g.drawString(tab.name, textLeft, baseline); - */ - } + tab.draw(g); x += TAB_BETWEEN; } } - /* - private void drawTab(Graphics g, int left, int right, - boolean leftNotch, boolean rightNotch) { - Graphics2D g2 = (Graphics2D) g; - g2.fill(Toolkit.createRoundRect(left, TAB_TOP, right, TAB_BOTTOM, 0, 0, - rightNotch ? CURVE_RADIUS : 0, - leftNotch ? CURVE_RADIUS : 0)); + private void drawUpdates(Graphics2D g2) { + if (updateCount != 0) { + FontRenderContext frc = g2.getFontRenderContext(); + final int GAP = Toolkit.zoom(5); + final String updateLabel = "Updates"; + String updatesStr = "" + updateCount; + double countWidth = font.getStringBounds(updatesStr, frc).getWidth(); + if (fontAscent > countWidth) { + countWidth = fontAscent; + } + float diameter = (float) (countWidth * 1.65f); + float ex = getWidth() - Editor.RIGHT_GUTTER - diameter; + float ey = (getHeight() - diameter) / 2; + g2.setColor(updateColor); + g2.fill(new Ellipse2D.Float(ex, ey, diameter, diameter)); + g2.setColor(textColor[SELECTED]); + int baseline = (getHeight() + fontAscent) / 2; + g2.drawString(updatesStr, (int) (ex + (diameter - countWidth)/2), baseline); + double updatesWidth = font.getStringBounds(updateLabel, frc).getWidth(); + g2.setColor(textColor[UNSELECTED]); + updateLeft = (int) (ex - updatesWidth - GAP); + g2.drawString(updateLabel, updateLeft, baseline); + } } - */ public Dimension getPreferredSize() { - return new Dimension(300, HIGH); + return new Dimension(Toolkit.zoom(300), HIGH); } @@ -335,9 +347,8 @@ class Tab { if (icon != null) { Mode mode = editor.getMode(); - final int res = Toolkit.highResDisplay() ? 2 : 1; - enabledIcon = mode.loadImage(icon + "-enabled-" + res + "x.png"); - selectedIcon = mode.loadImage(icon + "-selected-" + res + "x.png"); + enabledIcon = mode.loadImageX(icon + "-enabled"); + selectedIcon = mode.loadImageX(icon + "-selected"); if (selectedIcon == null) { selectedIcon = enabledIcon; // use this as the default } @@ -363,7 +374,7 @@ boolean isLast() { int getTextLeft() { int links = left; if (enabledIcon != null) { - links += ICON_WIDTH; + links += ICON_WIDTH + ICON_MARGIN; } return links + ((right - links) - textWidth) / 2; } @@ -375,9 +386,9 @@ boolean hasIcon() { void draw(Graphics g) { int state = isCurrent() ? SELECTED : UNSELECTED; g.setColor(tabColor[state]); - if (notification) { - g.setColor(errorColor); - } +// if (notification) { +// g.setColor(errorColor); +// } Graphics2D g2 = (Graphics2D) g; g2.fill(Toolkit.createRoundRect(left, TAB_TOP, right, TAB_BOTTOM, 0, 0, @@ -385,13 +396,13 @@ void draw(Graphics g) { isFirst() ? CURVE_RADIUS : 0)); if (hasIcon()) { - Image icon = isCurrent() ? selectedIcon : enabledIcon; + Image icon = (isCurrent() || notification) ? selectedIcon : enabledIcon; g.drawImage(icon, left + MARGIN, ICON_TOP, ICON_WIDTH, ICON_HEIGHT, null); } int textLeft = getTextLeft(); if (notification && state == UNSELECTED) { - g.setColor(Color.LIGHT_GRAY); + g.setColor(textColor[SELECTED]); } else { g.setColor(textColor[state]); } diff --git a/app/src/processing/app/ui/EditorHeader.java b/app/src/processing/app/ui/EditorHeader.java index 73453e7737..50fa1b8bf8 100644 --- a/app/src/processing/app/ui/EditorHeader.java +++ b/app/src/processing/app/ui/EditorHeader.java @@ -3,8 +3,8 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013-15 The Processing Foundation - Copyright (c) 2004-13 Ben Fry and Casey Reas + Copyright (c) 2012-19 The Processing Foundation + Copyright (c) 2004-12 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 @@ -44,26 +44,25 @@ */ public class EditorHeader extends JComponent { // height of this tab bar - static final int HIGH = 29; + static final int HIGH = Toolkit.zoom(29); - static final int ARROW_TAB_WIDTH = 18; - static final int ARROW_TOP = 11; - static final int ARROW_BOTTOM = 18; - static final int ARROW_WIDTH = 6; + static final int ARROW_TAB_WIDTH = Toolkit.zoom(18); + static final int ARROW_TOP = Toolkit.zoom(11); + static final int ARROW_BOTTOM = Toolkit.zoom(18); + static final int ARROW_WIDTH = Toolkit.zoom(6); - static final int CURVE_RADIUS = 6; + static final int CURVE_RADIUS = Toolkit.zoom(6); static final int TAB_TOP = 0; - static final int TAB_BOTTOM = 27; + static final int TAB_BOTTOM = Toolkit.zoom(27); // amount of extra space between individual tabs - static final int TAB_BETWEEN = 3; + static final int TAB_BETWEEN = Toolkit.zoom(3); // amount of margin on the left/right for the text on the tab - static final int TEXT_MARGIN = 16; + static final int TEXT_MARGIN = Toolkit.zoom(16); // width of the tab when no text visible // (total tab width will be this plus TEXT_MARGIN*2) - static final int NO_TEXT_WIDTH = 16; + static final int NO_TEXT_WIDTH = Toolkit.zoom(16); -// Color bgColor; Color textColor[] = new Color[2]; Color tabColor[] = new Color[2]; Color modifiedColor; @@ -153,7 +152,8 @@ public void updateMode() { tabColor[UNSELECTED] = mode.getColor("header.tab.unselected.color"); arrowColor = mode.getColor("header.tab.arrow.color"); - modifiedColor = mode.getColor("editor.selection.color"); + //modifiedColor = mode.getColor("editor.selection.color"); + modifiedColor = mode.getColor("header.tab.modified.color"); gradient = mode.makeGradient("header", 400, HIGH); } @@ -184,11 +184,7 @@ public void paintComponent(Graphics screen) { sizeH = size.height; imageW = sizeW; imageH = sizeH; - if (Toolkit.highResDisplay()) { - offscreen = createImage(imageW*2, imageH*2); - } else { - offscreen = createImage(imageW, imageH); - } + offscreen = Toolkit.offscreenGraphics(this, imageW, imageH); } Graphics g = offscreen.getGraphics(); @@ -198,6 +194,7 @@ public void paintComponent(Graphics screen) { } Graphics2D g2 = Toolkit.prepareGraphics(g); +// Toolkit.dpiStroke(g2); g.drawImage(gradient, 0, 0, imageW, imageH, this); @@ -264,7 +261,8 @@ public void paintComponent(Graphics screen) { g.setColor(tabColor[SELECTED]); // can't be done with lines, b/c retina leaves tiny hairlines g.fillRect(Editor.LEFT_GUTTER, TAB_BOTTOM, - editor.getTextArea().getWidth() - Editor.LEFT_GUTTER, 2); + editor.getTextArea().getWidth() - Editor.LEFT_GUTTER, + Toolkit.zoom(2)); // draw the tab for the menu g.setColor(tabColor[UNSELECTED]); @@ -358,7 +356,8 @@ private boolean placeTabs(int left, int right, Graphics2D g) { if (code.isModified()) { g.setColor(modifiedColor); //g.drawLine(tab.left + NOTCH, top, tab.right - NOTCH, top); - g.drawLine(tab.left + (i == 0 ? CURVE_RADIUS : 0), TAB_TOP, tab.right-1, TAB_TOP); + //g.drawLine(tab.left + (i == 0 ? CURVE_RADIUS : 0), TAB_TOP, tab.right-1, TAB_TOP); + g.drawLine(tab.right, TAB_TOP, tab.right, TAB_BOTTOM); } } @@ -495,47 +494,29 @@ public void actionPerformed(ActionEvent e) { // KeyEvent.VK_LEFT and VK_RIGHT will make Windows beep - final String prevTab = Language.text("editor.header.previous_tab"); - if (Platform.isLinux()) { - item = Toolkit.newJMenuItem(prevTab, KeyEvent.VK_PAGE_UP); - } else { - item = Toolkit.newJMenuItemAlt(prevTab, KeyEvent.VK_LEFT); - } + mapKey = "editor.header.previous_tab"; + item = Toolkit.newJMenuItemExt(mapKey); action = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { editor.getSketch().handlePrevCode(); } }; - mapKey = "editor.header.previous_tab"; - if (Platform.isLinux()) { - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, Toolkit.SHORTCUT_KEY_MASK); - } else { - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Toolkit.SHORTCUT_ALT_KEY_MASK); - } + keyStroke = item.getAccelerator(); inputMap.put(keyStroke, mapKey); actionMap.put(mapKey, action); item.addActionListener(action); menu.add(item); - final String nextTab = Language.text("editor.header.next_tab"); - if (Platform.isLinux()) { - item = Toolkit.newJMenuItem(nextTab, KeyEvent.VK_PAGE_DOWN); - } else { - item = Toolkit.newJMenuItemAlt(nextTab, KeyEvent.VK_RIGHT); - } + mapKey = "editor.header.next_tab"; + item = Toolkit.newJMenuItemExt(mapKey); action = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { editor.getSketch().handleNextCode(); } }; - mapKey = "editor.header.next_tab"; - if (Platform.isLinux()) { - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, Toolkit.SHORTCUT_KEY_MASK); - } else { - keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Toolkit.SHORTCUT_ALT_KEY_MASK); - } + keyStroke = item.getAccelerator(); inputMap.put(keyStroke, mapKey); actionMap.put(mapKey, action); item.addActionListener(action); diff --git a/app/src/processing/app/ui/EditorState.java b/app/src/processing/app/ui/EditorState.java index 1eeafba2da..b560bf8ed8 100644 --- a/app/src/processing/app/ui/EditorState.java +++ b/app/src/processing/app/ui/EditorState.java @@ -3,6 +3,7 @@ /* Part of the Processing project - http://processing.org + Copyright (c) 2012-19 The Processing Foundation Copyright (c) 2011-12 Ben Fry and Casey Reas This program is free software; you can redistribute it and/or modify @@ -158,8 +159,14 @@ GraphicsConfiguration defaultConfig() { * @param editors List of editors currently opened */ void defaultLocation(List editors) { - int defaultWidth = Preferences.getInteger("editor.window.width.default"); - int defaultHeight = Preferences.getInteger("editor.window.height.default"); + int defaultWidth = + Toolkit.zoom(Preferences.getInteger("editor.window.width.default")); + int defaultHeight = + Toolkit.zoom(Preferences.getInteger("editor.window.height.default")); + + defaultWidth = Math.min(defaultWidth, deviceBounds.width); + defaultHeight = Math.min(defaultHeight, deviceBounds.height); + //System.out.println("default w/h = " + defaultWidth + "/" + defaultHeight); if (editors.size() == 0) { // If no current active editor, use default placement. @@ -213,9 +220,12 @@ void update(Editor editor) { void apply(Editor editor) { editor.setBounds(editorBounds); - if (dividerLocation != 0) { - editor.setDividerLocation(dividerLocation); + + if (dividerLocation == 0) { + dividerLocation = 2 * editor.getSize().height / 3; } + editor.setDividerLocation(dividerLocation); + if (isMaximized) { editor.setExtendedState(Frame.MAXIMIZED_BOTH); } @@ -242,4 +252,4 @@ void apply(Editor editor) { // writer.print('\t'); // writer.print(rect.height); // } -} \ No newline at end of file +} diff --git a/app/src/processing/app/ui/EditorStatus.java b/app/src/processing/app/ui/EditorStatus.java index b406cfdd92..8affa8c6a3 100644 --- a/app/src/processing/app/ui/EditorStatus.java +++ b/app/src/processing/app/ui/EditorStatus.java @@ -3,7 +3,8 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2004-10 Ben Fry and Casey Reas + Copyright (c) 2012-19 The Processing Foundation + Copyright (c) 2004-12 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 @@ -23,57 +24,96 @@ package processing.app.ui; -import java.awt.*; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.StringSelection; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; import javax.swing.plaf.basic.BasicSplitPaneDivider; import javax.swing.plaf.basic.BasicSplitPaneUI; import processing.app.Mode; import processing.app.Platform; +import processing.app.Preferences; import processing.core.PApplet; /** * Panel just below the editing area that contains status messages. */ -public class EditorStatus extends BasicSplitPaneDivider { //JPanel { - static final int HIGH = 28; +public class EditorStatus extends BasicSplitPaneDivider { + static final int HIGH = Toolkit.zoom(28); static final int LEFT_MARGIN = Editor.LEFT_GUTTER; - static final int RIGHT_MARGIN = 20; - - - Color[] bgcolor; - Color[] fgcolor; - + static final int RIGHT_MARGIN = Toolkit.zoom(20); + + Color urlColor; + Color[] fgColor; + Color[] bgColor; + Image[] bgImage; + + @SuppressWarnings("hiding") + static public final int ERROR = 1; + static public final int CURSOR_LINE_ERROR = 2; + static public final int WARNING = 3; + static public final int CURSOR_LINE_WARNING = 4; static public final int NOTICE = 0; - static public final int ERR = 1; - static public final int EDIT = 2; - static final int YES = 1; - static final int NO = 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 = ""; + static final int OK = 4; Editor editor; int mode; - String message; + String message = ""; + String url; + int rightEdge; + int mouseX; + + static final int ROLLOVER_NONE = 0; + static final int ROLLOVER_URL = 1; + static final int ROLLOVER_COLLAPSE = 2; + static final int ROLLOVER_CLIPBOARD = 3; + int rolloverState; + Font font; FontMetrics metrics; int ascent; + // actual Clipboard character not available [fry 180326] + //static final String CLIPBOARD_GLYPH = "\uD83D\uDCCB"; + // other apps seem to use this one as a hack + static final String CLIPBOARD_GLYPH = "\u2398"; + + // https://en.wikipedia.org/wiki/Geometric_Shapes +// static final String COLLAPSE_GLYPH = "\u25B3"; // large up +// static final String EXPAND_GLYPH = "\u25BD"; // large down +// static final String COLLAPSE_GLYPH = "\u25B5"; // small up (unavailable) +// static final String EXPAND_GLYPH = "\u25BF"; // small down (unavailable) + static final String COLLAPSE_GLYPH = "\u25C1"; // left + static final String EXPAND_GLYPH = "\u25B7"; // right +// static final String COLLAPSE_GLYPH = "\u25F8"; // upper-left (unavailable) +// static final String EXPAND_GLYPH = "\u25FF"; // lower-right (unavailable) + + // a font that supports the Unicode glyphs we need + Font glyphFont; + Image offscreen; int sizeW, sizeH; - -// JButton cancelButton; -// JButton okButton; -// JTextField editField; + // size of the glyph buttons (width and height are identical) + int buttonSize; + boolean collapsed = false; int response; @@ -81,7 +121,6 @@ public class EditorStatus extends BasicSplitPaneDivider { //JPanel { Thread thread; - //public EditorStatus(Editor editor) { public EditorStatus(BasicSplitPaneUI ui, Editor editor) { super(ui); this.editor = editor; @@ -89,21 +128,88 @@ public EditorStatus(BasicSplitPaneUI ui, Editor editor) { updateMode(); addMouseListener(new MouseAdapter() { + + @Override public void mouseEntered(MouseEvent e) { - if (url != null) { - setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - } + updateMouse(); } + @Override public void mousePressed(MouseEvent e) { - if (url != null) { + if (rolloverState == ROLLOVER_URL) { Platform.openURL(url); + + } else if (rolloverState == ROLLOVER_CLIPBOARD) { + if (e.isShiftDown()) { + // open the text in a browser window as a search + final String fmt = Preferences.get("search.format"); + Platform.openURL(String.format(fmt, PApplet.urlEncode(message))); + + } else { + // copy the text to the clipboard + Clipboard clipboard = getToolkit().getSystemClipboard(); + clipboard.setContents(new StringSelection(message), null); + System.out.println("Copied to the clipboard. " + + "Use shift-click to search the web instead."); + } + + } else if (rolloverState == ROLLOVER_COLLAPSE) { + setCollapsed(!collapsed); } } + + @Override + public void mouseExited(MouseEvent e) { + mouseX = -100; + updateMouse(); + } + + }); + + addMouseMotionListener(new MouseMotionAdapter() { + @Override + public void mouseDragged(MouseEvent e) { + // BasicSplitPaneUI.startDragging gets called even when you click but + // don't drag, so we can't expand the console whenever that gets called + // or the button wouldn't work. + setCollapsed(false); + } + + @Override + public void mouseMoved(MouseEvent e) { + mouseX = e.getX(); + updateMouse(); + } }); } + void setCollapsed(boolean newState) { + if (collapsed != newState) { + collapsed = newState; + editor.footer.setVisible(!newState); + splitPane.resetToPreferredSizes(); + } + } + + + void updateMouse() { + switch (rolloverState) { + case ROLLOVER_CLIPBOARD: + case ROLLOVER_URL: + setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + break; + case ROLLOVER_COLLAPSE: + setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + break; + case ROLLOVER_NONE: + setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); + break; + } + repaint(); + } + + static String findURL(String message) { String[] m = PApplet.match(message, "http\\S+"); if (m != null) { @@ -115,75 +221,86 @@ static String findURL(String message) { public void updateMode() { Mode mode = editor.getMode(); - bgcolor = new Color[] { + + urlColor = mode.getColor("status.url.fgcolor"); + + fgColor = new Color[] { + mode.getColor("status.notice.fgcolor"), + mode.getColor("status.error.fgcolor"), + mode.getColor("status.error.fgcolor"), + mode.getColor("status.warning.fgcolor"), + mode.getColor("status.warning.fgcolor") + }; + + bgColor = new Color[] { mode.getColor("status.notice.bgcolor"), mode.getColor("status.error.bgcolor"), - mode.getColor("status.edit.bgcolor") + mode.getColor("status.error.bgcolor"), + mode.getColor("status.warning.bgcolor"), + mode.getColor("status.warning.bgcolor") }; - fgcolor = new Color[] { - mode.getColor("status.notice.fgcolor"), - mode.getColor("status.error.fgcolor"), - mode.getColor("status.edit.fgcolor") + bgImage = new Image[] { + mode.loadImage("/lib/status/notice.png"), + mode.loadImage("/lib/status/error.png"), + mode.loadImage("/lib/status/error.png"), + mode.loadImage("/lib/status/warning.png"), + mode.loadImage("/lib/status/warning.png") }; font = mode.getFont("status.font"); + glyphFont = mode.getFont("status.emoji.font"); metrics = null; } public void empty() { mode = NOTICE; - message = NO_MESSAGE; + message = ""; url = null; repaint(); } - public void notice(String message) { - mode = NOTICE; + public void message(String message, int mode) { this.message = message; + this.mode = mode; + url = findURL(message); repaint(); } - public void unnotice(String unmessage) { - if (message.equals(unmessage)) empty(); + public void notice(String message) { + message(message, NOTICE); +// mode = NOTICE; +// this.message = message; +// url = findURL(message); +// repaint(); } - public void error(String message) { - mode = ERR; - this.message = message; - url = findURL(message); - repaint(); - } +// public void unnotice(String unmessage) { +// if (message.equals(unmessage)) empty(); +// } -// public void edit(String message, String dflt) { -// mode = EDIT; + public void warning(String message) { + message(message, WARNING); // this.message = message; -// -// response = 0; -// okButton.setVisible(true); -// cancelButton.setVisible(true); -// editField.setVisible(true); -// editField.setText(dflt); -// editField.selectAll(); -// editField.requestFocusInWindow(); -// +// mode = WARNING; +// url = findURL(message); // repaint(); -// } + } -// public void unedit() { -// okButton.setVisible(false); -// cancelButton.setVisible(false); -// editField.setVisible(false); -// editor.textarea.requestFocusInWindow(); -// empty(); -// } + public void error(String message) { + message(message, ERROR); +// this.message = message; +// mode = ERROR; +// url = findURL(message); +// repaint(); + } public void startIndeterminate() { @@ -212,8 +329,6 @@ public void stopIndeterminate() { //public void paintComponent(Graphics screen) { public void paint(Graphics screen) { -// if (okButton == null) setup(); - Dimension size = getSize(); if ((size.width != sizeW) || (size.height != sizeH)) { // component has been resized @@ -223,12 +338,8 @@ public void paint(Graphics screen) { if (offscreen == null) { sizeW = size.width; sizeH = size.height; -// setButtonBounds(); - if (Toolkit.highResDisplay()) { - offscreen = createImage(sizeW*2, sizeH*2); - } else { - offscreen = createImage(sizeW, sizeH); - } + buttonSize = sizeH; + offscreen = Toolkit.offscreenGraphics(this, sizeW, sizeH); } Graphics g = offscreen.getGraphics(); @@ -240,222 +351,97 @@ public void paint(Graphics screen) { ascent = metrics.getAscent(); } - g.setColor(bgcolor[mode]); - g.fillRect(0, 0, sizeW, sizeH); + g.drawImage(bgImage[mode], 0, 0, sizeW, sizeH, this); + + rolloverState = ROLLOVER_NONE; + if (mouseX > sizeW - buttonSize && mouseX < sizeW) { + rolloverState = ROLLOVER_COLLAPSE; + + } else if (message != null && !message.isEmpty()) { + if (sizeW - 2*buttonSize < mouseX) { + rolloverState = ROLLOVER_CLIPBOARD; + + } else if (url != null && mouseX > LEFT_MARGIN && + // calculate right edge of the text for rollovers (otherwise the pane + // cannot be resized up or down whenever a URL is being displayed) + mouseX < (LEFT_MARGIN + g.getFontMetrics().stringWidth(message))) { + rolloverState = ROLLOVER_URL; + } + } - g.setColor(fgcolor[mode]); // https://github.com/processing/processing/issues/3265 if (message != null) { - g.setFont(font); // needs to be set each time on osx + // font needs to be set each time on osx + g.setFont(font); + // set the highlight color on rollover so that the user's not surprised + // to see the web browser open when they click + g.setColor((rolloverState == ROLLOVER_URL) ? urlColor : fgColor[mode]); g.drawString(message, LEFT_MARGIN, (sizeH + ascent) / 2); } if (indeterminate) { //int x = cancelButton.getX(); //int w = cancelButton.getWidth(); - int w = Toolkit.BUTTON_WIDTH; - int x = getWidth() - RIGHT_MARGIN - w; - int y = getHeight() / 3; - int h = getHeight() / 3; + int w = Toolkit.getButtonWidth(); + int x = getWidth() - Math.max(RIGHT_MARGIN, (int)(buttonSize*1.2)) - w; + int y = sizeH / 3; + int h = sizeH / 3; g.setColor(new Color(0x80000000, true)); g.drawRect(x, y, w, h); for (int i = 0; i < 10; i++) { int r = (int) (x + Math.random() * w); g.drawLine(r, y, r, y+h); } + + } else if (!message.isEmpty()) { + g.setFont(glyphFont); + drawButton(g, CLIPBOARD_GLYPH, 1, rolloverState == ROLLOVER_CLIPBOARD); + g.setFont(font); } + // draw collapse/expand button + String collapseGlyph = collapsed ? EXPAND_GLYPH : COLLAPSE_GLYPH; + drawButton(g, collapseGlyph, 0, rolloverState == ROLLOVER_COLLAPSE); + screen.drawImage(offscreen, 0, 0, sizeW, sizeH, 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); - - add(cancelButton); - add(okButton); + //private final Color whitishTint = new Color(0x20eeeeee, true); - cancelButton.setVisible(false); - okButton.setVisible(false); + /** + * @param pos A zero-based button index with 0 as the rightmost button + */ + private void drawButton(Graphics g, String symbol, int pos, boolean highlight) { + int left = sizeW - (pos + 1) * buttonSize; + // Overlap very long errors + g.drawImage(bgImage[mode], left, 0, buttonSize, sizeH, this); - 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); + if (highlight) { + // disabling since this doesn't match any of our other UI +// g.setColor(whitishTint); +// g.fillRect(left, 0, sizeH, sizeH); + g.setColor(urlColor); + } else { + g.setColor(fgColor[mode]); } + g.drawString(symbol, + left + (buttonSize - g.getFontMetrics().stringWidth(symbol))/2, + (sizeH + ascent) / 2); } - private void setButtonBounds() { - int top = (sizeH - 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, BUTTON_HEIGHT); - okButton.setSize(Preferences.BUTTON_WIDTH, 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, HIGH); + return new Dimension(Toolkit.zoom(300), HIGH); } public Dimension getMaximumSize() { return new Dimension(super.getMaximumSize().width, HIGH); } - - - /* - 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/ui/EditorToolbar.java b/app/src/processing/app/ui/EditorToolbar.java index eb4be746df..63fa851acf 100644 --- a/app/src/processing/app/ui/EditorToolbar.java +++ b/app/src/processing/app/ui/EditorToolbar.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyirght (c) 2012-15 The Processing Foundation + Copyirght (c) 2012-19 The Processing Foundation Copyright (c) 2004-12 Ben Fry and Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology @@ -49,14 +49,14 @@ /** * Run/Stop button plus Mode selection */ -abstract public class EditorToolbar extends JPanel { +abstract public class EditorToolbar extends JPanel implements KeyListener { // haven't decided how to handle this/how to make public/consistency // for components/does it live in theme.txt - static final int HIGH = 53; + static final int HIGH = Toolkit.zoom(53); // horizontal gap between buttons - static final int GAP = 9; + static final int GAP = Toolkit.zoom(9); // corner radius on the mode selector - static final int RADIUS = 3; + static final int RADIUS = Toolkit.zoom(3); protected Editor editor; protected Base base; @@ -64,10 +64,11 @@ abstract public class EditorToolbar extends JPanel { protected EditorButton runButton; protected EditorButton stopButton; -// protected EditorButton currentButton; + + protected EditorButton rolloverButton; + protected JLabel rolloverLabel; protected Box box; - protected JLabel label; protected Image gradient; @@ -77,8 +78,7 @@ public EditorToolbar(Editor editor) { base = editor.getBase(); mode = editor.getMode(); - gradient = mode.makeGradient("toolbar", 400, HIGH); -// reverseGradient = mode.getGradient("reversed", 100, EditorButton.DIM); + gradient = mode.makeGradient("toolbar", Toolkit.zoom(400), HIGH); rebuild(); } @@ -91,28 +91,27 @@ public void rebuild() { box = Box.createHorizontalBox(); box.add(Box.createHorizontalStrut(Editor.LEFT_GUTTER)); - label = new JLabel(); - label.setFont(mode.getFont("toolbar.rollover.font")); - label.setForeground(mode.getColor("toolbar.rollover.color")); + rolloverLabel = new JLabel(); + rolloverLabel.setFont(mode.getFont("toolbar.rollover.font")); + rolloverLabel.setForeground(mode.getColor("toolbar.rollover.color")); for (EditorButton button : buttons) { box.add(button); box.add(Box.createHorizontalStrut(GAP)); - button.setRolloverLabel(label); +// registerButton(button); } // // remove the last gap // box.remove(box.getComponentCount() - 1); // box.add(Box.createHorizontalStrut(LABEL_GAP)); - box.add(label); + box.add(rolloverLabel); // currentButton = runButton; - // runButton.setRolloverLabel(label); // stopButton.setRolloverLabel(label); box.add(Box.createHorizontalGlue()); - addModeButtons(box); + addModeButtons(box, rolloverLabel); // Component items = createModeButtons(); // if (items != null) { // box.add(items); @@ -126,6 +125,12 @@ public void rebuild() { } +// public void registerButton(EditorButton button) { + //button.setRolloverLabel(rolloverLabel); + //editor.getTextArea().addKeyListener(button); +// } + + // public void setReverse(EditorButton button) { // button.setGradient(reverseGradient); // } @@ -143,7 +148,7 @@ public void paintComponent(Graphics g) { public List createButtons() { - runButton = new EditorButton(mode, + runButton = new EditorButton(this, "/lib/toolbar/run", Language.text("toolbar.run"), Language.text("toolbar.present")) { @@ -153,7 +158,7 @@ public void actionPerformed(ActionEvent e) { } }; - stopButton = new EditorButton(mode, + stopButton = new EditorButton(this, "/lib/toolbar/stop", Language.text("toolbar.stop")) { @Override @@ -165,7 +170,7 @@ public void actionPerformed(ActionEvent e) { } - public void addModeButtons(Box box) { + public void addModeButtons(Box box, JLabel label) { } @@ -220,6 +225,41 @@ public void deactivateStop() { abstract public void handleStop(); + void setRollover(EditorButton button, InputEvent e) { + rolloverButton = button; +// if (rolloverButton != null) { + updateRollover(e); +// } else { +// rolloverLabel.setText(""); +// } + } + + + void updateRollover(InputEvent e) { + if (rolloverButton != null) { + rolloverLabel.setText(rolloverButton.getRolloverText(e)); + } else { + rolloverLabel.setText(""); + } + } + + + @Override + public void keyTyped(KeyEvent e) { } + + + @Override + public void keyReleased(KeyEvent e) { + updateRollover(e); + } + + + @Override + public void keyPressed(KeyEvent e) { + updateRollover(e); + } + + public Dimension getPreferredSize() { return new Dimension(super.getPreferredSize().width, HIGH); } @@ -245,11 +285,11 @@ class ModeSelector extends JPanel { int titleAscent; int titleWidth; - final int MODE_GAP_WIDTH = 13; - final int ARROW_GAP_WIDTH = 6; - final int ARROW_WIDTH = 6; - final int ARROW_TOP = 12; - final int ARROW_BOTTOM = 18; + final int MODE_GAP_WIDTH = Toolkit.zoom(13); + final int ARROW_GAP_WIDTH = Toolkit.zoom(6); + final int ARROW_WIDTH = Toolkit.zoom(6); + final int ARROW_TOP = Toolkit.zoom(12); + final int ARROW_BOTTOM = Toolkit.zoom(18); int[] triangleX = new int[3]; int[] triangleY = new int[] { ARROW_TOP, ARROW_TOP, ARROW_BOTTOM }; @@ -270,7 +310,7 @@ public ModeSelector() { addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { - JPopupMenu popup = editor.getModeMenu().getPopupMenu(); + JPopupMenu popup = editor.getModePopup(); popup.show(ModeSelector.this, event.getX(), event.getY()); } }); @@ -287,11 +327,7 @@ public void paintComponent(Graphics screen) { Dimension size = getSize(); width = 0; if (width != size.width || height != size.height) { - if (Toolkit.highResDisplay()) { - offscreen = createImage(size.width*2, size.height*2); - } else { - offscreen = createImage(size.width, size.height); - } + offscreen = Toolkit.offscreenGraphics(this, size.width, size.height); width = size.width; height = size.height; } @@ -316,6 +352,7 @@ public void paintComponent(Graphics screen) { // draw the outline for this feller g.setColor(outlineColor); + //Toolkit.dpiStroke(g2); g2.draw(Toolkit.createRoundRect(1, 1, width-1, height-1, RADIUS, RADIUS, RADIUS, RADIUS)); diff --git a/app/src/processing/app/ui/ErrorTable.java b/app/src/processing/app/ui/ErrorTable.java new file mode 100644 index 0000000000..8abfdf77a0 --- /dev/null +++ b/app/src/processing/app/ui/ErrorTable.java @@ -0,0 +1,261 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2012-19 The Processing Foundation + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + as published by the Free Software Foundation. + + 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. +*/ + +package processing.app.ui; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +import javax.swing.JLabel; +import javax.swing.JTable; +import javax.swing.ListSelectionModel; +import javax.swing.SwingConstants; +import javax.swing.ToolTipManager; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.JTableHeader; +import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumn; + +import processing.app.Language; +import processing.app.Mode; +import processing.app.Problem; + + +public class ErrorTable extends JTable { + Editor editor; + + static final String[] columnNames = { + "", // the blank column used for spacing + Language.text("editor.footer.errors.problem"), + Language.text("editor.footer.errors.tab"), + Language.text("editor.footer.errors.line") + }; + + static final int DATA_COLUMN = 0; + static final int PROBLEM_COLUMN = 1; + static final int TAB_COLUMN = 2; + static final int LINE_COLUMN = 3; + + Font headerFont; + Color headerColor; + Color headerBgColor; + +// Font rowFont; +// Color rowColor; +// Color rowBgColor; + + + public ErrorTable(final Editor editor) { + super(new DefaultTableModel(columnNames, 0)); + + setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + + this.editor = editor; + JTableHeader header = getTableHeader(); + + Mode mode = editor.getMode(); + header.setDefaultRenderer(new GradyHeaderRenderer(mode)); + setDefaultRenderer(Object.class, new GradyRowRenderer(mode)); + //setShowGrid(false); + setIntercellSpacing(new Dimension(0, 0)); + + // be specific about the width of the first column + TableColumn emptyColumn = columnModel.getColumn(0); + emptyColumn.setMaxWidth(Editor.LEFT_GUTTER); + emptyColumn.setMinWidth(Editor.LEFT_GUTTER); + + columnModel.getColumn(PROBLEM_COLUMN).setPreferredWidth(400); + columnModel.getColumn(TAB_COLUMN).setPreferredWidth(100); + columnModel.getColumn(LINE_COLUMN).setPreferredWidth(50); +// // the other columns are just a preference +// for (int i = 1; i < columnModel.getColumnCount(); i++) { +// columnModel.getColumn(i).setPreferredWidth(columnWidths[i]); +// } + + addMouseListener(new MouseAdapter() { + @Override + synchronized public void mouseClicked(MouseEvent e) { + try { + int row = ((ErrorTable) e.getSource()).getSelectedRow(); + if (row >= 0 && row < getRowCount()) { + Object data = getModel().getValueAt(row, DATA_COLUMN); + int clickCount = e.getClickCount(); + if (clickCount == 1) { + editor.errorTableClick(data); + } else if (clickCount > 1) { + editor.errorTableDoubleClick(data); + } + editor.getTextArea().requestFocusInWindow(); +// editor.getErrorChecker().scrollToErrorLine(row); + } + } catch (Exception ex) { + ex.printStackTrace(); + } + } + }); + + header.setReorderingAllowed(false); + setFillsViewportHeight(true); + ToolTipManager.sharedInstance().registerComponent(this); + } + + + public void clearRows() { + DefaultTableModel dtm = (DefaultTableModel) getModel(); + dtm.setRowCount(0); + } + + + public void addRow(Problem data, String msg, String filename, String line) { + DefaultTableModel dtm = (DefaultTableModel) getModel(); + dtm.addRow(new Object[] { data, msg, filename, line }); + } + + + @Override + public boolean isCellEditable(int rowIndex, int colIndex) { + return false; // Disallow the editing of any cell + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + static class GradyHeaderRenderer extends JLabel implements TableCellRenderer { + + public GradyHeaderRenderer(Mode mode) { + setFont(mode.getFont("errors.header.font")); + setAlignmentX(LEFT_ALIGNMENT); + + setForeground(mode.getColor("errors.header.fgcolor")); + setBackground(mode.getColor("errors.header.bgcolor")); + setOpaque(true); + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, + boolean selected, + boolean focused, + int row, int column) { + + // Adjust height for magnified displays. The font is scaled properly, + // but the rows don't automatically use the scaled preferred size. + // https://github.com/processing/processing/issues/4936 + int high = getPreferredSize().height; + if (high != 0) { + JTableHeader header = table.getTableHeader(); + int current = header.getSize().height; + if (current != high) { + table.setPreferredSize(new Dimension(table.getWidth(), high)); + } + } + setText(value == null ? "" : value.toString()); + return this; + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + static class GradyRowRenderer extends JLabel implements TableCellRenderer { + Color textColor; + Color bgColor; + Color textColorSelected; + Color bgColorSelected; + Color bgColorError; + Color bgColorWarning; + + Color errorIndicatorColor; + Color warningIndicatorColor; + + public GradyRowRenderer(Mode mode) { + setFont(mode.getFont("errors.row.font")); + setAlignmentX(LEFT_ALIGNMENT); + + textColor = mode.getColor("errors.row.fgcolor"); + bgColor = mode.getColor("errors.row.bgcolor"); + textColorSelected = mode.getColor("errors.selection.fgcolor"); + bgColorSelected = mode.getColor("errors.selection.bgcolor"); + bgColorError = mode.getColor("errors.selection.error.bgcolor"); + bgColorWarning = mode.getColor("errors.selection.warning.bgcolor"); + + errorIndicatorColor = mode.getColor("errors.indicator.error.color"); + warningIndicatorColor = mode.getColor("errors.indicator.warning.color"); + + setOpaque(true); + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, + boolean selected, + boolean focused, + int row, int column) { + Problem entry = (Problem) table.getValueAt(row, DATA_COLUMN); + + // Adjust row height for magnified displays. The font is scaled properly, + // but the rows don't automatically use the scaled preferred size. + // https://github.com/processing/processing/issues/4936 + int high = getPreferredSize().height; + if (high != 0) { + int current = table.getRowHeight(); + if (current != high) { + table.setRowHeight(high); + } + } + + if (selected) { + setForeground(textColorSelected); + if (entry.isError()) { + setBackground(bgColorError); + } else if (entry.isWarning()) { + setBackground(bgColorWarning); + } else { + setBackground(bgColorSelected); + } + } else { + setForeground(textColor); + setBackground(bgColor); + } + if (column == DATA_COLUMN) { + setText("\u2022"); + setHorizontalAlignment(SwingConstants.CENTER); + if (entry.isError()) { + setForeground(errorIndicatorColor); + } else if (entry.isWarning()) { + setForeground(warningIndicatorColor); + } else { + setText(""); // no dot + } + } else if (value == null) { + setText(""); + } else { + setHorizontalAlignment(SwingConstants.LEFT); + setText(value.toString()); + } + return this; + } + } +} diff --git a/app/src/processing/app/ui/ExamplesFrame.java b/app/src/processing/app/ui/ExamplesFrame.java index ecd531476a..70258650d5 100644 --- a/app/src/processing/app/ui/ExamplesFrame.java +++ b/app/src/processing/app/ui/ExamplesFrame.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013-15 The Processing Foundation + Copyright (c) 2013-19 The Processing Foundation 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 @@ -26,7 +26,6 @@ import java.awt.Color; import java.awt.Component; import java.awt.Cursor; -import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Point; import java.awt.event.ActionEvent; @@ -108,7 +107,7 @@ public void actionPerformed(ActionEvent e) { addExamplesButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - ContributionManager.openExampleManager(base.getActiveEditor()); + ContributionManager.openExamples(); } }); @@ -183,9 +182,12 @@ public void treeCollapsed(TreeExpansionEvent event) { tree.setToggleClickCount(1); } + // Special cell renderer that takes the UI zoom into account + tree.setCellRenderer(new ZoomTreeCellRenderer(mode)); + JScrollPane treePane = new JScrollPane(tree); - treePane.setPreferredSize(new Dimension(250, 300)); - treePane.setBorder(new EmptyBorder(2, 0, 0, 0)); + treePane.setPreferredSize(Toolkit.zoom(250, 300)); + treePane.setBorder(new EmptyBorder(Toolkit.zoom(2), 0, 0, 0)); treePane.setOpaque(true); treePane.setBackground(Color.WHITE); treePane.setAlignmentX(Component.LEFT_ALIGNMENT); @@ -342,8 +344,7 @@ protected DefaultMutableTreeNode buildTree() { e.printStackTrace(); } - DefaultMutableTreeNode contributedExamplesNode = - buildContribTree(); + DefaultMutableTreeNode contributedExamplesNode = buildContribTree(); if (contributedExamplesNode.getChildCount() > 0) { root.add(contributedExamplesNode); } diff --git a/app/src/processing/app/ui/FindReplace.java b/app/src/processing/app/ui/FindReplace.java index 2f7301b211..757ab96251 100644 --- a/app/src/processing/app/ui/FindReplace.java +++ b/app/src/processing/app/ui/FindReplace.java @@ -3,6 +3,7 @@ /* Part of the Processing project - http://processing.org + Copyright (c) 2012-19 The Processing Foundation Copyright (c) 2004-12 Ben Fry and Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology @@ -417,15 +418,27 @@ protected void setFound(boolean found) { replaceAndFindButton.setEnabled(found); } +/** + * Replace the current selection with whatever's in the + * replacement text field. + * @param isCompoundEdit True if the action is to be marked as a copmound edit + */ + public void replace(boolean isCompoundEdit) { + editor.setSelectedText(replaceField.getText(), isCompoundEdit); + + editor.getSketch().setModified(true); // This necessary- calling replace() + // doesn't seem to mark a sketch as modified + + setFound(false); + } + /** * Replace the current selection with whatever's in the - * replacement text field. + * replacement text field, marking the action as a compound edit. */ public void replace() { - editor.setSelectedText(replaceField.getText()); - editor.getSketch().setModified(true); // TODO is this necessary? - setFound(false); + replace(true); } @@ -448,27 +461,33 @@ public void replaceAll() { editor.setSelection(0, 0); boolean foundAtLeastOne = false; - int startTab = -1, startIndex = -1, c = 50000; - // you couldn't seriously be replacing 50K times o_O - while (--c > 0) { + int startTab = -1; + int startIndex = -1; + int counter = 10000; // prevent infinite loop + + editor.startCompoundEdit(); + while (--counter > 0) { if (find(false, false)) { - if(editor.getSketch().getCurrentCodeIndex() == startTab - && editor.getSelectionStart() == startIndex){ + int caret = editor.getSelectionStart(); + int stopIndex = startIndex + replaceField.getText().length(); + if (editor.getSketch().getCurrentCodeIndex() == startTab && + (caret >= startIndex && (caret <= stopIndex))) { // we've reached where we started, so stop the replace Toolkit.beep(); editor.statusNotice("Reached beginning of search!"); break; } - if(!foundAtLeastOne){ + if (!foundAtLeastOne) { foundAtLeastOne = true; startTab = editor.getSketch().getCurrentCodeIndex(); startIndex = editor.getSelectionStart(); } - replace(); + replace(false); } else { break; } } + editor.stopCompoundEdit(); if (!foundAtLeastOne) { Toolkit.beep(); } diff --git a/app/src/processing/app/ui/MarkerColumn.java b/app/src/processing/app/ui/MarkerColumn.java new file mode 100644 index 0000000000..8d6371fbd5 --- /dev/null +++ b/app/src/processing/app/ui/MarkerColumn.java @@ -0,0 +1,219 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* +Part of the Processing project - http://processing.org + +Copyright (c) 2012-19 The Processing Foundation + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +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. +*/ + +package processing.app.ui; + +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import javax.swing.JPanel; + +import processing.app.Mode; +import processing.app.Problem; +import processing.app.Sketch; +import processing.app.SketchCode; +import processing.app.syntax.PdeTextArea; +import processing.core.PApplet; + + +/** + * Implements the column to the right of the editor window that displays ticks + * for errors and warnings. + *
+ * All errors and warnings of a sketch are drawn on the bar, clicking on one, + * scrolls to the tab and location. Error messages displayed on hover. Markers + * are not in sync with the error line. Similar to Eclipse's right error bar + * which displays the overall errors in a document + */ +public class MarkerColumn extends JPanel { + protected Editor editor; + +// static final int WIDE = 12; + + private Color errorColor; + private Color warningColor; + + // Stores error markers displayed PER TAB along the error bar. + private List errorPoints = new ArrayList<>(); + + + public MarkerColumn(Editor editor, int height) { + this.editor = editor; + + Mode mode = editor.getMode(); + errorColor = mode.getColor("editor.column.error.color"); + warningColor = mode.getColor("editor.column.warning.color"); + + addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + scrollToMarkerAt(e.getY()); + } + }); + + addMouseMotionListener(new MouseMotionAdapter() { + public void mouseMoved(final MouseEvent e) { + showMarkerHover(e.getY()); + } + }); + } + + + @Override + public void repaint() { + recalculateMarkerPositions(); + super.repaint(); + } + + + @Override + public void paintComponent(Graphics g) { + PdeTextArea pta = editor.getPdeTextArea(); + if (pta != null) { + g.drawImage(pta.getGutterGradient(), + 0, 0, getWidth(), getHeight(), this); + } + + int currentTabIndex = editor.getSketch().getCurrentCodeIndex(); + + for (LineMarker m : errorPoints) { + Problem problem = m.problem; + if (problem.getTabIndex() != currentTabIndex) continue; + if (problem.isError()) { + g.setColor(errorColor); + } else { + g.setColor(warningColor); + } + g.drawLine(2, m.y, getWidth() - 2, m.y); + } + } + + + public void updateErrorPoints(final List problems) { + errorPoints = problems.stream() + .map(LineMarker::new) + .collect(Collectors.toList()); + repaint(); + } + + + /** Find out which error/warning the user has clicked and scroll to it */ + private void scrollToMarkerAt(final int y) { + try { + LineMarker m = findClosestMarker(y); + if (m != null) { + editor.highlight(m.problem); + } + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + + /** Show tooltip on hover. */ + private void showMarkerHover(final int y) { + try { + LineMarker m = findClosestMarker(y); + if (m != null) { + Problem p = m.problem; + editor.statusToolTip(MarkerColumn.this, p.getMessage(), p.isError()); + setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + + private void recalculateMarkerPositions() { + if (errorPoints != null && errorPoints.size() > 0) { + Sketch sketch = editor.getSketch(); + SketchCode code = sketch.getCurrentCode(); + int currentTab = sketch.getCurrentCodeIndex(); + int totalLines = PApplet.max(1, code.getLineCount()); // do not divide by zero + int visibleLines = editor.getTextArea().getVisibleLines(); + totalLines = PApplet.max(totalLines, visibleLines); + + int topMargin = 20; // top scroll button + int bottomMargin = 40; // bottom scroll button and horizontal scrollbar + int height = getHeight() - topMargin - bottomMargin; + + for (LineMarker m : errorPoints) { + Problem problem = m.problem; + if (problem.getTabIndex() != currentTab) continue; + // Ratio of error line to total lines + float ratio = (problem.getLineNumber() + 1) / ((float) totalLines); + // Ratio multiplied by height of the error bar + float y = topMargin + ratio * height; + + m.y = (int) y; + } + } + } + + + private LineMarker findClosestMarker(final int y) { + LineMarker closest = null; + int closestDist = Integer.MAX_VALUE; + for (LineMarker m : errorPoints) { + int dist = Math.abs(y - m.y); + if (dist < 3 && dist < closestDist) { + closest = m; + closestDist = dist; + } + } + return closest; + } + + + public Dimension getPreferredSize() { + return new Dimension(Editor.RIGHT_GUTTER, super.getPreferredSize().height); + } + + + public Dimension getMinimumSize() { + return new Dimension(Editor.RIGHT_GUTTER, super.getMinimumSize().height); + } + + + /** + * Line markers displayed on the Error Column. + */ + private static class LineMarker { + /** y co-ordinate of the marker */ + int y; + + /** Problem that the error marker represents */ + final Problem problem; + + + LineMarker(Problem problem) { + this.problem = problem; + } + } +} diff --git a/app/src/processing/app/ui/PreferencesFrame.java b/app/src/processing/app/ui/PreferencesFrame.java index 32203ec5b4..d4684b2e24 100644 --- a/app/src/processing/app/ui/PreferencesFrame.java +++ b/app/src/processing/app/ui/PreferencesFrame.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2012-19 The Processing Foundation Copyright (c) 2004-12 Ben Fry and Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology @@ -37,7 +37,6 @@ import processing.app.Messages; import processing.app.Platform; import processing.app.Preferences; -import processing.app.ui.ColorChooser; import processing.core.*; @@ -69,7 +68,9 @@ public class PreferencesFrame { JCheckBox warningsCheckerBox; JCheckBox codeCompletionBox; JCheckBox importSuggestionsBox; - //JCheckBox codeCompletionTriggerBox; + + JComboBox zoomSelectionBox; + JCheckBox zoomAutoBox; JComboBox displaySelectionBox; JComboBox languageSelectionBox; @@ -96,9 +97,9 @@ public PreferencesFrame(Base base) { pain.setLayout(layout); - final int BORDER = Platform.isMacOS() ? 20 : 13; - - JLabel sketchbookLocationLabel, restartProcessingLabel; + JLabel sketchbookLocationLabel; + JLabel languageRestartLabel; + JLabel zoomRestartLabel; JButton browseButton; //, button2; @@ -109,7 +110,7 @@ public PreferencesFrame(Base base) { sketchbookLocationField = new JTextField(40); - browseButton = new JButton(Toolkit.PROMPT_BROWSE); + browseButton = new JButton(Language.getPrompt("browse")); browseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { File dflt = new File(sketchbookLocationField.getText()); @@ -123,7 +124,7 @@ public void actionPerformed(ActionEvent e) { // Language: [ English ] (requires restart of Processing) JLabel languageLabel = new JLabel(Language.text("preferences.language")+": "); - languageSelectionBox = new JComboBox(); + languageSelectionBox = new JComboBox<>(); Map languages = Language.getLanguages(); String[] languageSelection = new String[languages.size()]; @@ -134,8 +135,8 @@ public void actionPerformed(ActionEvent e) { languageSelection[i++] = lang.getValue(); } } - languageSelectionBox.setModel(new DefaultComboBoxModel(languageSelection)); - restartProcessingLabel = new JLabel(" (" + Language.text("preferences.requires_restart") + ")"); + languageSelectionBox.setModel(new DefaultComboBoxModel<>(languageSelection)); + languageRestartLabel = new JLabel(" (" + Language.text("preferences.requires_restart") + ")"); // Editor and console font [ Source Code Pro ] @@ -144,7 +145,7 @@ public void actionPerformed(ActionEvent e) { final String fontTip = "" + Language.text("preferences.editor_and_console_font.tip"); fontLabel.setToolTipText(fontTip); // get a wide name in there before getPreferredSize() is called - fontSelectionBox = new JComboBox(new String[] { Toolkit.getMonoFontName() }); + fontSelectionBox = new JComboBox<>(new String[] { Toolkit.getMonoFontName() }); fontSelectionBox.setToolTipText(fontTip); fontSelectionBox.setEnabled(false); // don't enable until fonts are loaded @@ -152,12 +153,31 @@ public void actionPerformed(ActionEvent e) { // Editor font size [ 12 ] Console font size [ 10 ] JLabel fontSizelabel = new JLabel(Language.text("preferences.editor_font_size")+": "); - fontSizeField = new JComboBox(FONT_SIZES); + fontSizeField = new JComboBox<>(FONT_SIZES); JLabel consoleFontSizeLabel = new JLabel(Language.text("preferences.console_font_size")+": "); - consoleFontSizeField = new JComboBox(FONT_SIZES); + consoleFontSizeField = new JComboBox<>(FONT_SIZES); fontSizeField.setSelectedItem(Preferences.getFont("editor.font.size")); + + // Interface scale: [ 100% ] (requires restart of Processing) + + JLabel zoomLabel = new JLabel(Language.text("preferences.zoom") + ": "); + + zoomAutoBox = new JCheckBox(Language.text("preferences.zoom.auto")); + zoomAutoBox.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + zoomSelectionBox.setEnabled(!zoomAutoBox.isSelected()); + } + }); + + zoomSelectionBox = new JComboBox<>(); + zoomSelectionBox.setModel(new DefaultComboBoxModel<>(Toolkit.zoomOptions.array())); + zoomRestartLabel = new JLabel(" (" + Language.text("preferences.requires_restart") + ")"); + + // + JLabel backgroundColorLabel = new JLabel(Language.text("preferences.background_color")+": "); final String colorTip = "" + Language.text("preferences.background_color.tip"); @@ -165,7 +185,8 @@ public void actionPerformed(ActionEvent e) { presentColor = new JTextField(" "); presentColor.setOpaque(true); - presentColor.setEnabled(false); + presentColor.setEnabled(true); + presentColor.setEditable(false); Border cb = new CompoundBorder(BorderFactory.createMatteBorder(1, 1, 0, 0, new Color(195, 195, 195)), BorderFactory.createMatteBorder(0, 0, 1, 1, new Color(54, 54, 54))); presentColor.setBorder(cb); @@ -271,6 +292,9 @@ public void mouseClicked(MouseEvent e) { errorCheckerBox = new JCheckBox(Language.text("preferences.continuously_check")); + errorCheckerBox.addItemListener(e -> { + warningsCheckerBox.setEnabled(errorCheckerBox.isSelected()); + }); // [ ] Show Warnings - PDE X @@ -322,7 +346,7 @@ public void stateChanged(ChangeEvent e) { JLabel displayLabel = new JLabel(Language.text("preferences.run_sketches_on_display") + ": "); final String tip = "" + Language.text("preferences.run_sketches_on_display.tip"); displayLabel.setToolTipText(tip); - displaySelectionBox = new JComboBox(); + displaySelectionBox = new JComboBox<>(); updateDisplayList(); // needs to happen here for getPreferredSize() @@ -362,7 +386,7 @@ public void mouseExited(MouseEvent e) { // [ OK ] [ Cancel ] - okButton = new JButton(Toolkit.PROMPT_OK); + okButton = new JButton(Language.getPrompt("ok")); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { applyFrame(); @@ -370,15 +394,16 @@ public void actionPerformed(ActionEvent e) { } }); - JButton cancelButton = new JButton(Toolkit.PROMPT_CANCEL); + JButton cancelButton = new JButton(Language.getPrompt("cancel")); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { disposeFrame(); } }); + final int buttonWidth = Toolkit.getButtonWidth(); layout.setHorizontalGroup(layout.createSequentialGroup() // sequential group for border + mainContent + border - .addGap(BORDER) + .addGap(Toolkit.BORDER) .addGroup(layout.createParallelGroup() // parallel group for rest of the components .addComponent(sketchbookLocationLabel) .addGroup(layout.createSequentialGroup() @@ -387,7 +412,7 @@ public void actionPerformed(ActionEvent e) { .addGroup(layout.createSequentialGroup() .addComponent(languageLabel) .addComponent(languageSelectionBox,GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) // This makes the component non-resizable in the X direction - .addComponent(restartProcessingLabel)) + .addComponent(languageRestartLabel)) .addGroup(layout.createSequentialGroup() .addComponent(fontLabel) .addComponent(fontSelectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) @@ -397,6 +422,11 @@ public void actionPerformed(ActionEvent e) { .addComponent(fontSizeField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(consoleFontSizeLabel) .addComponent(consoleFontSizeField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(zoomLabel) + .addComponent(zoomAutoBox) + .addComponent(zoomSelectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(zoomRestartLabel)) .addGroup(layout.createSequentialGroup() .addComponent(backgroundColorLabel) .addComponent(hashLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) @@ -408,6 +438,7 @@ public void actionPerformed(ActionEvent e) { .addGroup(layout.createSequentialGroup() .addComponent(errorCheckerBox) .addComponent(warningsCheckerBox)) + .addComponent(warningsCheckerBox) .addComponent(codeCompletionBox) .addComponent(importSuggestionsBox) .addGroup(layout.createSequentialGroup() @@ -431,14 +462,14 @@ public void actionPerformed(ActionEvent e) { .addComponent(preferencePathLabel) .addComponent(preferenceHintLabel) .addGroup(GroupLayout.Alignment.TRAILING,layout.createSequentialGroup() // Trailing so that the buttons are to the right - .addComponent(okButton, Toolkit.BUTTON_WIDTH, GroupLayout.DEFAULT_SIZE, Toolkit.BUTTON_WIDTH) // Ok and Cancel buttton are now of size BUTTON_WIDTH - .addComponent(cancelButton, Toolkit.BUTTON_WIDTH, GroupLayout.DEFAULT_SIZE, Toolkit.BUTTON_WIDTH) + .addComponent(okButton, buttonWidth, GroupLayout.DEFAULT_SIZE, buttonWidth) // Ok and Cancel buttton are now of size BUTTON_WIDTH + .addComponent(cancelButton, buttonWidth, GroupLayout.DEFAULT_SIZE, buttonWidth) )) - .addGap(BORDER) + .addGap(Toolkit.BORDER) ); layout.setVerticalGroup(layout.createSequentialGroup() // sequential group for border + mainContent + border - .addGap(BORDER) + .addGap(Toolkit.BORDER) .addComponent(sketchbookLocationLabel) .addGroup(layout.createParallelGroup() .addComponent(sketchbookLocationField) @@ -446,7 +477,7 @@ public void actionPerformed(ActionEvent e) { .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(languageLabel) .addComponent(languageSelectionBox) - .addComponent(restartProcessingLabel)) + .addComponent(languageRestartLabel)) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER). addComponent(fontLabel) .addComponent(fontSelectionBox)) @@ -455,6 +486,11 @@ public void actionPerformed(ActionEvent e) { .addComponent(fontSizeField) .addComponent(consoleFontSizeLabel) .addComponent(consoleFontSizeField)) + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) + .addComponent(zoomLabel) + .addComponent(zoomAutoBox) + .addComponent(zoomSelectionBox) + .addComponent(zoomRestartLabel)) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(backgroundColorLabel) .addComponent(hashLabel) @@ -485,7 +521,7 @@ public void actionPerformed(ActionEvent e) { .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(okButton) .addComponent(cancelButton)) - .addGap(BORDER) + .addGap(Toolkit.BORDER) ); if (Platform.isWindows()){ @@ -629,6 +665,10 @@ protected void applyFrame() { fontSizeField.setSelectedItem(Preferences.getInteger("editor.font.size")); } + Preferences.setBoolean("editor.zoom.auto", zoomAutoBox.isSelected()); + Preferences.set("editor.zoom", + String.valueOf(zoomSelectionBox.getSelectedItem())); + try { Object selection = consoleFontSizeField.getSelectedItem(); if (selection instanceof String) { @@ -654,8 +694,8 @@ protected void applyFrame() { Preferences.setBoolean("pdex.errorCheckEnabled", errorCheckerBox.isSelected()); Preferences.setBoolean("pdex.warningsEnabled", warningsCheckerBox.isSelected()); Preferences.setBoolean("pdex.completion", codeCompletionBox.isSelected()); - //Preferences.setBoolean("pdex.completion.trigger", codeCompletionTriggerBox.isSelected()); - Preferences.setBoolean("pdex.importSuggestEnabled", importSuggestionsBox.isSelected()); +// Preferences.setBoolean("pdex.completion.trigger", codeCompletionTriggerBox.isSelected()); + Preferences.setBoolean("pdex.suggest.imports", importSuggestionsBox.isSelected()); for (Editor editor : base.getEditors()) { editor.applyPreferences(); @@ -668,10 +708,11 @@ public void showFrame() { inputMethodBox.setSelected(Preferences.getBoolean("editor.input_method_support")); //$NON-NLS-1$ errorCheckerBox.setSelected(Preferences.getBoolean("pdex.errorCheckEnabled")); warningsCheckerBox.setSelected(Preferences.getBoolean("pdex.warningsEnabled")); + warningsCheckerBox.setEnabled(errorCheckerBox.isSelected()); codeCompletionBox.setSelected(Preferences.getBoolean("pdex.completion")); //codeCompletionTriggerBox.setSelected(Preferences.getBoolean("pdex.completion.trigger")); //codeCompletionTriggerBox.setEnabled(codeCompletionBox.isSelected()); - importSuggestionsBox.setSelected(Preferences.getBoolean("pdex.importSuggestEnabled")); + importSuggestionsBox.setSelected(Preferences.getBoolean("pdex.suggest.imports")); deletePreviousBox.setSelected(Preferences.getBoolean("export.delete_target_folder")); //$NON-NLS-1$ sketchbookLocationField.setText(Preferences.getSketchbookPath()); @@ -697,6 +738,19 @@ public void run() { fontSizeField.setSelectedItem(Preferences.getInteger("editor.font.size")); consoleFontSizeField.setSelectedItem(Preferences.getInteger("console.font.size")); + boolean zoomAuto = Preferences.getBoolean("editor.zoom.auto"); + if (zoomAuto) { + zoomAutoBox.setSelected(zoomAuto); + zoomSelectionBox.setEnabled(!zoomAuto); + } + String zoomSel = Preferences.get("editor.zoom"); + int zoomIndex = Toolkit.zoomOptions.index(zoomSel); + if (zoomIndex != -1) { + zoomSelectionBox.setSelectedIndex(zoomIndex); + } else { + zoomSelectionBox.setSelectedIndex(0); + } + presentColor.setBackground(Preferences.getColor("run.present.bgcolor")); presentColorHex.setText(Preferences.get("run.present.bgcolor").substring(1)); @@ -745,7 +799,7 @@ void initFontList() { EventQueue.invokeLater(new Runnable() { @Override public void run() { - fontSelectionBox.setModel(new DefaultComboBoxModel(monoFontFamilies)); + fontSelectionBox.setModel(new DefaultComboBoxModel<>(monoFontFamilies)); String family = Preferences.get("editor.font.family"); // Set a reasonable default, in case selecting the family fails @@ -780,7 +834,7 @@ int updateDisplayList() { } items[i] = title; } - displaySelectionBox.setModel(new DefaultComboBoxModel(items)); + displaySelectionBox.setModel(new DefaultComboBoxModel<>(items)); // Disable it if you can't actually change the default display displaySelectionBox.setEnabled(displayCount != 1); diff --git a/app/src/processing/app/ui/ProgressFrame.java b/app/src/processing/app/ui/ProgressFrame.java deleted file mode 100644 index 0dcab2e874..0000000000 --- a/app/src/processing/app/ui/ProgressFrame.java +++ /dev/null @@ -1,340 +0,0 @@ -package processing.app.ui; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JProgressBar; -import javax.swing.SwingWorker; - -import processing.app.Language; -import processing.app.Util; - - -// TODO This code was contributed and needs a lot of work. [fry] -// + It probably shouldn't a "Frame" object at all. -// + It should be more general to the tasks at hand (why Save As and Add File -// in here?) We'd have to copy the code again for a new "Task" -// + Instead of multiple implementations of file and directory copy, it should -// just use a single version from Base that takes a ProgressMonitor as an arg - -/** - * Class used to handle progress bar, and run Save As or Add File in - * background so that progress bar can update without freezing. - */ -public class ProgressFrame extends JFrame implements PropertyChangeListener { - private JProgressBar progressBar; - private JLabel label; - private File[] copyItems; - private File newFolder; - private File addFile, sourceFile; - private Editor editor; - - - /** Create a new background thread to Save As */ - public class TaskSaveAs extends SwingWorker { - - @Override - protected Void doInBackground() throws Exception { - // a large part of the file copying happens in this background - // thread - - long totalSize = 0; - for (File copyable : copyItems) { - totalSize += calcSize(copyable); - } - - long progress = 0; - setProgress(0); - for (File copyable : ProgressFrame.this.copyItems) { - // loop to copy over the items that make sense, and to set the - // current progress - - if (copyable.isDirectory()) { - copyDir(copyable, - new File(ProgressFrame.this.newFolder, copyable.getName()), - progress, totalSize); - progress += calcSize(copyable); - } else { - copyFile(copyable, - new File(ProgressFrame.this.newFolder, copyable.getName()), - progress, totalSize); - if (calcSize(copyable) < 524288) { - // If the file length > 0.5MB, the copyFile() function has - // been redesigned to change progress every 0.5MB so that - // the progress bar doesn't stagnate during that time - progress += calcSize(copyable); - setProgress((int) (progress * 100L / totalSize)); - } - } - } - return null; - } - - - /** - * Overloaded copyFile that is called whenever a Save As is being done, - * so that the ProgressBar is updated for very large files as well. - */ - private void copyFile(File sourceFile, File targetFile, - double progress, long totalSize) throws IOException { - BufferedInputStream from = new BufferedInputStream(new FileInputStream(sourceFile)); - BufferedOutputStream to = new BufferedOutputStream(new FileOutputStream(targetFile)); - byte[] buffer = new byte[16 * 1024]; - int bytesRead; - int totalRead = 0; - while ((bytesRead = from.read(buffer)) != -1) { - to.write(buffer, 0, bytesRead); - totalRead += bytesRead; - if (totalRead >= 512 * 1024) { // to update progress bar every 0.5MB - progress += totalRead; - setProgressBarStatus((int) Math.min(Math.ceil(progress * 100.0 / totalSize), 100)); - totalRead = 0; - } - } - if (sourceFile.length() > 512 * 1024) { - // Update the progress bar one final time if file size is more than 0.5MB, - // otherwise, the update is handled either by the copyDir function, - // or directly by ProgressFrame.TaskSaveAs.doInBackground() - progress += totalRead; - setProgressBarStatus((int) Math.min(Math.ceil(progress * 100.0 / totalSize), 100)); - } - from.close(); - from = null; - to.flush(); - to.close(); - to = null; - - targetFile.setLastModified(sourceFile.lastModified()); - targetFile.setExecutable(sourceFile.canExecute()); - } - - - private double copyDir(File sourceDir, File targetDir, - double progress, long totalSize) throws IOException { - // Overloaded copyDir so that the Save As progress bar gets updated when the - // files are in folders as well (like in the data folder) - if (sourceDir.equals(targetDir)) { - final String urDum = "source and target directories are identical"; - throw new IllegalArgumentException(urDum); - } - 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(); - progress = copyDir(source, target, progress, totalSize); - setProgressBarStatus((int) Math.min(Math.ceil(progress * 100.0 / totalSize), 100)); - target.setLastModified(source.lastModified()); - } else { - copyFile(source, target, progress, totalSize); - // Update SaveAs progress bar - progress += source.length(); - setProgressBarStatus((int) Math.min(Math.ceil(progress * 100.0 / totalSize), 100)); - } - } - return progress; - } - - - public void setProgressBarStatus(int status) { - setProgress(status); - } - - - @Override - public void done() { - // to close the progress bar automatically when done, and to - // print that Saving is done in Message Area - editor.statusNotice(Language.text("editor.status.saving.done")); - dispose(); - } - } - - - /** Create a new background thread to add a file. */ - public class TaskAddFile extends SwingWorker { - - @Override - protected Void doInBackground() throws Exception { - // a large part of the file copying happens in this background - // thread - - setProgress(0); - - copyFile(sourceFile, addFile); - - if (addFile.length() < 1024) { - // If the file length > 1kB, the copyFile() function has - // been redesigned to change progress every 1kB so that - // the progress bar doesn't stagnate during that time - - // If file <1 kB, just fill up Progress Bar to 100% - // directly, since time to copy is now negligable (when - // perceived by a human, anyway) - setProgress(100); - } - - return null; - } - - - /** - * Overloaded copyFile that is called whenever a addFile is being done, - * so that the ProgressBar is updated. - */ - private void copyFile(File sourceFile, File targetFile) throws IOException { - long totalSize = sourceFile.length(); - int progress = 0; - BufferedInputStream from = new BufferedInputStream(new FileInputStream(sourceFile)); - BufferedOutputStream to = new BufferedOutputStream(new FileOutputStream(targetFile)); - byte[] buffer = new byte[16 * 1024]; - int bytesRead; - int totalRead = 0; - while ((bytesRead = from.read(buffer)) != -1) { - to.write(buffer, 0, bytesRead); - totalRead += bytesRead; - if (totalRead >= 1024) { // to update progress bar every 1kB - progress += totalRead; - setProgressBarStatus((int) Math.min(Math.ceil(progress * 100.0 / totalSize), 100)); - totalRead = 0; - } - } - if (sourceFile.length() > 1024) { - // Update the progress bar one final time if file size is more than - // 1kB, otherwise, the update is handled directly by - // ProgressFrame.TaskAddFile.doInBackground() - progress += totalRead; - setProgressBarStatus((int) Math.min(Math.ceil(progress * 100.0 / totalSize), 100)); - } - from.close(); - from = null; - - to.flush(); - to.close(); - to = null; - - targetFile.setLastModified(sourceFile.lastModified()); - targetFile.setExecutable(sourceFile.canExecute()); - } - - - public void setProgressBarStatus(int status) { - setProgress(status); - } - - - @Override - public void done() { - dispose(); - } - } - - - /** Use for Save As */ - public ProgressFrame(File[] c, File nf, String oldName, String newName, - Editor editor) { - // initialize a copyItems and newFolder, which are used for file - // copying in the background thread - copyItems = c; - newFolder = nf; - this.editor = editor; - - // the UI of the progress bar follows - setDefaultCloseOperation(HIDE_ON_CLOSE); - setBounds(200, 200, 400, 140); - setResizable(false); - setTitle("Saving As..."); - JPanel panel = new JPanel(null); - add(panel); - setContentPane(panel); - label = new JLabel("Saving " + oldName + " as " + newName + "..."); - label.setBounds(40, 20, 300, 20); - - progressBar = new JProgressBar(0, 100); - progressBar.setValue(0); - progressBar.setBounds(40, 50, 300, 30); - progressBar.setStringPainted(true); - - panel.add(progressBar); - panel.add(label); - Toolkit.setIcon(this); - this.setVisible(true); - - // create an instance of TaskSaveAs and run execute() on this - // instance to start background thread - TaskSaveAs t = new TaskSaveAs(); - t.addPropertyChangeListener(this); - t.execute(); - } - - - /** Used for Add File */ - public ProgressFrame(File sf, File add, Editor editor) { - addFile = add; - sourceFile = sf; - this.editor = editor; - - // the UI of the progress bar follows - setDefaultCloseOperation(HIDE_ON_CLOSE); - setBounds(200, 200, 400, 140); - setResizable(false); - setTitle("Adding File..."); - JPanel panel = new JPanel(null); - add(panel); - setContentPane(panel); - label = new JLabel("Adding " + addFile.getName()); - label.setBounds(40, 20, 300, 20); - - progressBar = new JProgressBar(0, 100); - progressBar.setValue(0); - progressBar.setBounds(40, 50, 300, 30); - progressBar.setStringPainted(true); - - panel.add(progressBar); - panel.add(label); - Toolkit.setIcon(this); - this.setVisible(true); - - // create an instance of TaskAddFile and run execute() on this - // instance to - // start background thread - TaskAddFile task = new TaskAddFile(); - task.addPropertyChangeListener(this); - task.execute(); - } - - - /** - * Function to return the length of the file, or entire directory, including - * the component files and sub-folders if passed. - */ - long calcSize(File file) { - return file.isFile() ? file.length() : Util.calcFolderSize(file); - } - - - /** - * Detects a change in the property of the background task, - * i.e., is called when the size of files already copied changes. - */ - public void propertyChange(PropertyChangeEvent evt) { - if ("progress".equals(evt.getPropertyName())) { - progressBar.setValue((Integer) evt.getNewValue()); - } - } -} diff --git a/app/src/processing/app/ui/Recent.java b/app/src/processing/app/ui/Recent.java index 4cf644e1a8..bc26761736 100644 --- a/app/src/processing/app/ui/Recent.java +++ b/app/src/processing/app/ui/Recent.java @@ -3,6 +3,7 @@ /* Part of the Processing project - http://processing.org + Copyright (c) 2012-19 The Processing Foundation Copyright (c) 2011-12 Ben Fry and Casey Reas This program is free software; you can redistribute it and/or modify @@ -77,7 +78,7 @@ static public void init(Base b) { static protected void load() throws IOException { - records = new ArrayList(); + records = new ArrayList<>(); if (file.exists()) { BufferedReader reader = PApplet.createReader(file); String version = reader.readLine(); @@ -103,6 +104,7 @@ static protected void load() throws IOException { static protected void save() { + file.setWritable(true, false); PrintWriter writer = PApplet.createWriter(file); writer.println(VERSION); for (Record record : records) { @@ -240,6 +242,8 @@ public void actionPerformed(ActionEvent e) { synchronized static public void remove(Editor editor) { int index = findRecord(editor.getSketch().getMainFilePath()); if (index != -1) { + System.out.println("removing " + editor.getSketch().getMainFilePath()); + new Exception().printStackTrace(System.out); records.remove(index); } } @@ -289,6 +293,7 @@ synchronized static public void append(Editor editor) { // If this sketch is already in the menu, remove it remove(editor); + // If the list is full, remove the first entry if (records.size() == Preferences.getInteger("recent.count")) { records.remove(0); // remove the first entry } @@ -351,12 +356,6 @@ static class Record { String path; // if not loaded, this is non-null // EditorState state; // if not loaded, this is non-null - /** - * If currently loaded, this is non-null, and takes precedence over the - * path and state information, which will instead be stored actively by - * the actual sketch object. - */ - Editor editor; // Sketch sketch; // Record(String path, EditorState state) { @@ -374,14 +373,10 @@ static class Record { // } Record(Editor editor) { - this.editor = editor; - this.path = editor.getSketch().getMainFilePath(); + this(editor.getSketch().getMainFilePath()); } String getName() { - if (editor != null) { - return editor.getSketch().getName(); - } // Get the filename of the .pde (or .js or .py...) String name = path.substring(path.lastIndexOf(File.separatorChar) + 1); // Return the name with the extension removed diff --git a/app/src/processing/app/ui/SketchbookFrame.java b/app/src/processing/app/ui/SketchbookFrame.java index 7749236ae5..ae36203a29 100644 --- a/app/src/processing/app/ui/SketchbookFrame.java +++ b/app/src/processing/app/ui/SketchbookFrame.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013-15 The Processing Foundation + Copyright (c) 2013-19 The Processing Foundation 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 @@ -22,7 +22,7 @@ package processing.app.ui; -import java.awt.Dimension; +import java.awt.Color; import java.awt.EventQueue; import java.awt.Point; import java.awt.event.ActionEvent; @@ -33,10 +33,13 @@ import java.awt.event.MouseEvent; import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.border.EmptyBorder; import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreeModel; import javax.swing.tree.TreeSelectionModel; import processing.app.Base; @@ -107,17 +110,37 @@ public void keyTyped(KeyEvent e) { } }); - tree.setBorder(new EmptyBorder(5, 5, 5, 5)); + final int border = Toolkit.zoom(5); + tree.setBorder(new EmptyBorder(border, border, border, border)); if (Platform.isMacOS()) { tree.setToggleClickCount(2); } else { tree.setToggleClickCount(1); } - JScrollPane treePane = new JScrollPane(tree); - treePane.setPreferredSize(new Dimension(250, 450)); - treePane.setBorder(new EmptyBorder(0, 0, 0, 0)); - getContentPane().add(treePane); + // Special cell renderer that takes the UI zoom into account + tree.setCellRenderer(new ZoomTreeCellRenderer(mode)); + + // Check whether sketch book is empty or not + TreeModel treeModel = tree.getModel(); + if (treeModel.getChildCount(treeModel.getRoot()) != 0) { + JScrollPane treePane = new JScrollPane(tree); + treePane.setPreferredSize(Toolkit.zoom(250, 450)); + treePane.setBorder(new EmptyBorder(0, 0, 0, 0)); + getContentPane().add(treePane); + + } else { + JPanel emptyPanel = new JPanel(); + emptyPanel.setBackground(Color.WHITE); + emptyPanel.setPreferredSize(Toolkit.zoom(250,450)); + + JLabel emptyLabel = new JLabel("Empty Sketchbook"); + emptyLabel.setForeground(Color.GRAY); + emptyPanel.add(emptyLabel); + + setContentPane(emptyPanel); + } + pack(); } @@ -145,4 +168,4 @@ public void run() { } }); } -} \ No newline at end of file +} diff --git a/app/src/processing/app/ui/SplashWindow.java b/app/src/processing/app/ui/SplashWindow.java new file mode 100644 index 0000000000..83f8f4e53b --- /dev/null +++ b/app/src/processing/app/ui/SplashWindow.java @@ -0,0 +1,226 @@ +package processing.app.ui; + +/* + * @(#)SplashWindow.java 2.2.1 2006-05-27 + * + * Copyright (c) 2003-2010 Werner Randelshofer + * Hausmatt 10, Immensee, CH-6405, Switzerland. + * + * This software is in the public domain. + * You are free to use, adapt, copy and license this work + * without having to attribute to Werner Randelshofer. + */ + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.MediaTracker; +import java.awt.Toolkit; +import java.awt.Window; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.net.URL; + +/** + * A Splash window. + *

+ * Usage: MyApplication is your application class. Create a Splasher class which + * opens the splash window, invokes the main method of your Application class, + * and disposes the splash window afterwards. + * Please note that we want to keep the Splasher class and the SplashWindow class + * as small as possible. The less code and the less classes must be loaded into + * the JVM to open the splash screen, the faster it will appear. + *

+ * class Splasher {
+ *    public static void main(String[] args) {
+ *         SplashWindow.splash(Startup.class.getResource("splash.gif"));
+ *         MyApplication.main(args);
+ *         SplashWindow.disposeSplash();
+ *    }
+ * }
+ * 
+ * + * @author Werner Randelshofer + * @version 2.2.1 2006-05-27 Abort when splash image can not be loaded. + */ +public class SplashWindow extends Window { + /** + * The current instance of the splash window. + * (Singleton design pattern). + */ + private static SplashWindow instance; + + /** + * The splash image which is displayed on the splash window. + */ + private Image image; + + /** + * This attribute indicates whether the method + * paint(Graphics) has been called at least once since the + * construction of this window.
+ * This attribute is used to notify method splash(Image) + * that the window has been drawn at least once + * by the AWT event dispatcher thread.
+ * This attribute acts like a latch. Once set to true, + * it will never be changed back to false again. + * + * @see #paint + * @see #splash + */ + private boolean paintCalled = false; + + /** + * Creates a new instance. + * @param parent the parent of the window. + * @param image the splash image. + */ + private SplashWindow(Frame parent, Image image, boolean hidpi) { + super(parent); + this.image = image; + + // Load the image + MediaTracker mt = new MediaTracker(this); + mt.addImage(image,0); + try { + mt.waitForID(0); + } catch(InterruptedException ie){} + + // Abort on failure + if (mt.isErrorID(0)) { + setSize(0,0); + System.err.println("Warning: SplashWindow couldn't load splash image."); + synchronized(this) { + paintCalled = true; + notifyAll(); + } + return; + } + + // Center the window on the screen + int imgWidth = image.getWidth(this); + int imgHeight = image.getHeight(this); + + if (hidpi) { + imgWidth /= 2; + imgHeight /= 2; + } + setSize(imgWidth, imgHeight); +// Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); +// setLocation((screenDim.width - imgWidth) / 2, +// (screenDim.height - imgHeight) / 2); + setLocationRelativeTo(null); + + // Users shall be able to close the splash window by + // clicking on its display area. This mouse listener + // listens for mouse clicks and disposes the splash window. + MouseAdapter disposeOnClick = new MouseAdapter() { + public void mouseClicked(MouseEvent evt) { + // Note: To avoid that method splash hangs, we + // must set paintCalled to true and call notifyAll. + // This is necessary because the mouse click may + // occur before the contents of the window + // has been painted. + synchronized(SplashWindow.this) { + SplashWindow.this.paintCalled = true; + SplashWindow.this.notifyAll(); + } + dispose(); + } + }; + addMouseListener(disposeOnClick); + } + + /** + * Updates the display area of the window. + */ + public void update(Graphics g) { + // Note: Since the paint method is going to draw an + // image that covers the complete area of the component we + // do not fill the component with its background color + // here. This avoids flickering. + paint(g); + } + /** + * Paints the image on the window. + */ + public void paint(Graphics g) { + g.drawImage(image, 0, 0, getWidth(), getHeight(), this); + + // Notify method splash that the window + // has been painted. + // Note: To improve performance we do not enter + // the synchronized block unless we have to. + if (! paintCalled) { + paintCalled = true; + synchronized (this) { notifyAll(); } + } + } + + /** + * Open's a splash window using the specified image. + * @param image The splash image. + */ + public static void splash(Image image, boolean hidpi) { + if (instance == null && image != null) { + Frame f = new Frame(); + + // Create the splash image + instance = new SplashWindow(f, image, hidpi); + + // Show the window. + instance.setVisible(true); + + // Note: To make sure the user gets a chance to see the + // splash window we wait until its paint method has been + // called at least once by the AWT event dispatcher thread. + // If more than one processor is available, we don't wait, + // and maximize CPU throughput instead. + if (! EventQueue.isDispatchThread() + && Runtime.getRuntime().availableProcessors() == 1) { + synchronized (instance) { + while (! instance.paintCalled) { + try { instance.wait(); } catch (InterruptedException e) {} + } + } + } + } + } + + /** + * Open's a splash window using the specified image. + * @param imageURL The url of the splash image. + */ + public static void splash(URL imageURL, boolean hidpi) { + if (imageURL != null) { + splash(Toolkit.getDefaultToolkit().createImage(imageURL), hidpi); + } + } + + /** + * Closes the splash window. + */ + public static void disposeSplash() { + if (instance != null) { + instance.getOwner().dispose(); + instance = null; + } + } + + /** + * Invokes the main method of the provided class name. + * @param args the command line arguments + */ + public static void invokeMain(String className, String[] args) { + try { + Class.forName(className) + .getMethod("main", new Class[] {String[].class}) + .invoke(null, new Object[] {args}); + } catch (Exception e) { + InternalError error = new InternalError("Failed to invoke main method"); + error.initCause(e); + throw error; + } + } +} diff --git a/app/src/processing/app/ui/Toolkit.java b/app/src/processing/app/ui/Toolkit.java index 4b72e64cd6..866190c6ed 100644 --- a/app/src/processing/app/ui/Toolkit.java +++ b/app/src/processing/app/ui/Toolkit.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2012-19 The Processing Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 @@ -21,6 +21,7 @@ package processing.app.ui; +import java.awt.BasicStroke; import java.awt.Component; import java.awt.Dimension; import java.awt.Font; @@ -43,6 +44,7 @@ import java.awt.font.TextLayout; import java.awt.geom.AffineTransform; import java.awt.geom.GeneralPath; +import java.awt.image.ImageObserver; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; @@ -51,12 +53,14 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; -import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.regex.Pattern; import javax.swing.Action; +import javax.swing.Icon; import javax.swing.ImageIcon; +import javax.swing.JButton; import javax.swing.JCheckBoxMenuItem; import javax.swing.JComponent; import javax.swing.JMenu; @@ -65,45 +69,29 @@ import javax.swing.JPopupMenu; import javax.swing.JRootPane; import javax.swing.KeyStroke; +import javax.swing.border.EmptyBorder; import processing.app.Language; import processing.app.Messages; import processing.app.Platform; import processing.app.Preferences; +import processing.app.Util; +import processing.core.PApplet; +import processing.data.StringList; /** * Utility functions for base that require a java.awt.Toolkit object. These * are broken out from Base as we start moving toward the possibility of the * code running in headless mode. - * @author fry */ public class Toolkit { - static public final String PROMPT_YES = Language.text("prompt.yes"); - static public final String PROMPT_NO = Language.text("prompt.no"); - static public final String PROMPT_CANCEL = Language.text("prompt.cancel"); - static public final String PROMPT_OK = Language.text("prompt.ok"); - static public final String PROMPT_BROWSE = Language.text("prompt.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. - * This is now stored in the languages file since this may need to be larger - * for languages that are consistently wider than English. - */ - static public int BUTTON_WIDTH = - Integer.parseInt(Language.text("preferences.button.width")); - static final java.awt.Toolkit awtToolkit = java.awt.Toolkit.getDefaultToolkit(); /** Command on Mac OS X, Ctrl on Windows and Linux */ static final int SHORTCUT_KEY_MASK = awtToolkit.getMenuShortcutKeyMask(); - - /** Command-W on Mac OS X, Ctrl-W on Windows and Linux */ - public 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 | SHORTCUT_KEY_MASK; @@ -111,6 +99,76 @@ public class Toolkit { static final int SHORTCUT_SHIFT_KEY_MASK = ActionEvent.SHIFT_MASK | SHORTCUT_KEY_MASK; + /** Command-W on Mac OS X, Ctrl-W on Windows and Linux */ + static public final KeyStroke WINDOW_CLOSE_KEYSTROKE = + KeyStroke.getKeyStroke('W', SHORTCUT_KEY_MASK); + + static final String BAD_KEYSTROKE = + "'%s' is not understood, please re-read the Java reference for KeyStroke"; + + /** + * 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. + * This is now stored in the languages file since this may need to be larger + * for languages that are consistently wider than English. + */ + static public int getButtonWidth() { + // Made into a method so that calling Toolkit methods doesn't require + // the languages to be loaded, and with that, Base initialized completely + return zoom(Integer.parseInt(Language.text("preferences.button.width"))); + } + + + /** + * Return the correct KeyStroke per locale and platform. + * Also checks for any additional overrides in preferences.txt. + * @param base the localization key for the menu item + * (.keystroke and .platform will be added to the end) + * @return KeyStroke for base + .keystroke + .platform + * (or the value from preferences) or null if none found + */ + static public KeyStroke getKeyStrokeExt(String base) { + String key = base + ".keystroke"; + + // see if there's an override in preferences.txt + String sequence = Preferences.get(key); + if (sequence != null) { + KeyStroke ks = KeyStroke.getKeyStroke(sequence); + if (ks != null) { + return ks; // user did good, we're all set + + } else { + System.err.format(BAD_KEYSTROKE, sequence); + } + } + + sequence = Language.text(key + "." + Platform.getName()); + KeyStroke ks = KeyStroke.getKeyStroke(sequence); + if (ks == null) { + // this can only happen if user has screwed up their language files + System.err.format(BAD_KEYSTROKE, sequence); + //return KeyStroke.getKeyStroke(0, 0); // badness + } + return ks; + } + + + /** + * Create a menu item and set its KeyStroke by name (so it can be stored + * in the language settings or the preferences. Syntax is here: + * https://docs.oracle.com/javase/8/docs/api/javax/swing/KeyStroke.html#getKeyStroke-java.lang.String- + * @param sequence the name, as outlined by the KeyStroke API + * @param fallback what to use if getKeyStroke() comes back null + */ + static public JMenuItem newJMenuItemExt(String base) { + JMenuItem menuItem = new JMenuItem(Language.text(base)); + KeyStroke ks = getKeyStrokeExt(base); // will print error if necessary + if (ks != null) { + menuItem.setAccelerator(ks); + } + return menuItem; + } + /** * A software engineer, somewhere, needs to have their abstraction @@ -284,7 +342,7 @@ public int compare(Character ch1, Character ch2) { // Holds only [0-9a-z], not uppercase. // Prevents X != x, so "Save" and "Save As" aren't both given 'a'. - final List taken = new ArrayList(menu.length); + final List taken = new ArrayList<>(menu.length); char firstChar; char[] cleanChars; Character[] cleanCharas; @@ -323,7 +381,7 @@ public int compare(Character ch1, Character ch2) { if (cleanString.length() == 0) continue; // First, ban letters by underscores. - final List banned = new ArrayList(); + final List banned = new ArrayList<>(); for (int i = 0; i < cleanString.length(); i++) { if (cleanString.charAt(i) == '_') { if (i > 0) @@ -381,7 +439,7 @@ public int compare(Character ch1, Character ch2) { cleanChars = cleanString.toCharArray(); cleanCharas = new Character[cleanChars.length]; for (int i = 0; i < cleanChars.length; i++) { - cleanCharas[i] = new Character(cleanChars[i]); + cleanCharas[i] = cleanChars[i]; } Arrays.sort(cleanCharas, charComparator); // sorts in increasing order for (char mnem : cleanCharas) { @@ -429,7 +487,7 @@ static public void setMenuMnemonics(JMenuBar menubar) { * As setMenuMnemonics(JMenuItem...). */ static public void setMenuMnemonics(JPopupMenu menu) { - ArrayList items = new ArrayList(); + ArrayList items = new ArrayList<>(); for (Component c : menu.getComponents()) { if (c instanceof JMenuItem) items.add((JMenuItem)c); @@ -482,6 +540,91 @@ static public ImageIcon getLibIcon(String filename) { } + static public ImageIcon getIconX(File dir, String base) { + return getIconX(dir, base, 0); + } + + + /** + * Get an icon of the format base-NN.png where NN is the size, but if it's + * a hidpi display, get the NN*2 version automatically, sized at NN + */ + static public ImageIcon getIconX(File dir, String base, int size) { + final int scale = Toolkit.highResImages() ? 2 : 1; + String filename = (size == 0) ? + (base + "-" + scale + "x.png") : + (base + "-" + (size*scale) + ".png"); + File file = new File(dir, filename); + if (!file.exists()) { + return null; + } + + ImageIcon outgoing = new ImageIcon(file.getAbsolutePath()) { + + @Override + public int getIconWidth() { + return Toolkit.zoom(super.getIconWidth()) / scale; + } + + @Override + public int getIconHeight() { + return Toolkit.zoom(super.getIconHeight()) / scale; + } + + @Override + public synchronized void paintIcon(Component c, Graphics g, int x, int y) { + ImageObserver imageObserver = getImageObserver(); + if (imageObserver == null) { + imageObserver = c; + } + g.drawImage(getImage(), x, y, getIconWidth(), getIconHeight(), imageObserver); + } + }; + return outgoing; + } + + + /** + * Get an image icon with hi-dpi support. Pulls 1x or 2x versions of the + * file depending on the display type, but sizes them based on 1x. + */ + static public ImageIcon getLibIconX(String base) { + return getLibIconX(base, 0); + } + + + static public ImageIcon getLibIconX(String base, int size) { + return getIconX(Platform.getContentFile("lib"), base, size); + } + + + /** + * Create a JButton with an icon, and set its disabled and pressed images + * to be the same image, so that 2x versions of the icon work properly. + */ + static public JButton createIconButton(String title, String base) { + ImageIcon icon = Toolkit.getLibIconX(base); + return createIconButton(title, icon); + } + + + /** Same as above, but with no text title (follows JButton constructor) */ + static public JButton createIconButton(String base) { + return createIconButton(null, base); + } + + + static public JButton createIconButton(String title, Icon icon) { + JButton button = new JButton(title, icon); + button.setDisabledIcon(icon); + button.setPressedIcon(icon); + return button; + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + static List iconImages; @@ -501,7 +644,7 @@ static public void setIcon(Frame frame) { static public void setIcon(Window window) { if (!Platform.isMacOS()) { if (iconImages == null) { - iconImages = new ArrayList(); + iconImages = new ArrayList<>(); final int[] sizes = { 16, 32, 48, 64, 128, 256, 512 }; for (int sz : sizes) { iconImages.add(Toolkit.getLibImage("icons/pde-" + sz + ".png")); @@ -546,25 +689,6 @@ static public Shape createRoundRect(float x1, float y1, float x2, float y2, } - // 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. @@ -598,6 +722,17 @@ static public Clipboard getSystemClipboard() { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + /** + * Create an Image to be used as an offscreen drawing context, + * automatically doubling the size if running on a retina display. + */ + static public Image offscreenGraphics(Component comp, int width, int height) { + int m = Toolkit.isRetina() ? 2 : 1; + //return comp.createImage(m * dpi(width), m * dpi(height)); + return comp.createImage(m * width, m * height); + } + + /** * Handles scaling for high-res displays, also sets text anti-aliasing * options to be far less ugly than the defaults. @@ -607,19 +742,24 @@ static public Clipboard getSystemClipboard() { static public Graphics2D prepareGraphics(Graphics g) { Graphics2D g2 = (Graphics2D) g; - if (Toolkit.highResDisplay()) { + //float z = zoom * (Toolkit.isRetina() ? 2 : 1); + if (Toolkit.isRetina()) { // scale everything 2x, will be scaled down when drawn to the screen g2.scale(2, 2); } + //g2.scale(z, z); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); - if (Toolkit.highResDisplay()) { + g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BICUBIC); + if (Toolkit.isRetina()) { // Looks great on retina, not so great (with our font) on 1x g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP); } + zoomStroke(g2); return g2; } @@ -658,14 +798,116 @@ static public Graphics2D prepareGraphics(Graphics g) { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - static Boolean highResProp; + static float zoom = 0; + + + /* + // http://stackoverflow.com/a/35029265 + static public void zoomSwingFonts() { + Set keySet = UIManager.getLookAndFeelDefaults().keySet(); + Object[] keys = keySet.toArray(new Object[keySet.size()]); + + for (Object key : keys) { + if (key != null && key.toString().toLowerCase().contains("font")) { + System.out.println(key); + Font font = UIManager.getDefaults().getFont(key); + if (font != null) { + font = font.deriveFont(font.getSize() * zoom); + UIManager.put(key, font); + } + } + } + } + */ + + + static final StringList zoomOptions = + new StringList("100%", "150%", "200%", "300%"); + + + static public int zoom(int pixels) { + if (zoom == 0) { + zoom = parseZoom(); + } + // Deal with 125% scaling badness + // https://github.com/processing/processing/issues/4902 + return (int) Math.ceil(zoom * pixels); + } + + + static public Dimension zoom(int w, int h) { + return new Dimension(zoom(w), zoom(h)); + } + + + static public final int BORDER = + Toolkit.zoom(Platform.isMacOS() ? 20 : 13); + + + static public void setBorder(JComponent comp) { + setBorder(comp, BORDER, BORDER, BORDER, BORDER); + } + + + static public void setBorder(JComponent comp, + int top, int left, int bottom, int right) { + comp.setBorder(new EmptyBorder(Toolkit.zoom(top), Toolkit.zoom(left), + Toolkit.zoom(bottom), Toolkit.zoom(right))); + } + + + static private float parseZoom() { + if (Preferences.getBoolean("editor.zoom.auto")) { + float newZoom = Platform.getSystemDPI() / 96f; + String percentSel = ((int) (newZoom*100)) + "%"; + Preferences.set("editor.zoom", percentSel); + return newZoom; + + } else { + String zoomSel = Preferences.get("editor.zoom"); + if (zoomOptions.hasValue(zoomSel)) { + // shave off the % symbol at the end + zoomSel = zoomSel.substring(0, zoomSel.length() - 1); + return PApplet.parseInt(zoomSel, 100) / 100f; + + } else { + Preferences.set("editor.zoom", "100%"); + return 1; + } + } + } + + + static BasicStroke zoomStroke; + + static private void zoomStroke(Graphics2D g2) { + if (zoom != 1) { + if (zoomStroke == null || zoomStroke.getLineWidth() != zoom) { + zoomStroke = new BasicStroke(zoom); + } + g2.setStroke(zoomStroke); + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + // Changed to retinaProp instead of highResProp because only Mac + // "retina" displays use this mechanism for high-resolution scaling. + static Boolean retinaProp; + + + static public boolean highResImages() { + return isRetina() || (zoom > 1); + } - static public boolean highResDisplay() { - if (highResProp == null) { - highResProp = checkRetina(); + static public boolean isRetina() { + if (retinaProp == null) { + retinaProp = checkRetina(); } - return highResProp; + return retinaProp; } @@ -696,57 +938,12 @@ static private boolean checkRetina() { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -// static Font monoFont; -// static Font plainFont; -// static Font boldFont; -// -// -// static public Font getMonoFont(int size) { -// if (monoFont == null) { -// try { -// monoFont = createFont("DroidSansMono.ttf", size); -// } catch (Exception e) { -// monoFont = new Font("Monospaced", Font.PLAIN, size); -// } -// } -// return monoFont; -// } -// -// -// static public Font getPlainFont(int size) { -// if (plainFont == null) { -// try { -// plainFont = createFont("DroidSans.ttf", size); -// } catch (Exception e) { -// plainFont = new Font("SansSerif", Font.PLAIN, size); -// } -// } -// return plainFont; -// } -// -// -// static public Font getBoldFont(int size) { -// if (boldFont == null) { -// try { -// boldFont = createFont("DroidSans-Bold.ttf", size); -// } catch (Exception e) { -// boldFont = new Font("SansSerif", Font.BOLD, size); -// } -// } -// return boldFont; -// } - - - static final char GREEK_SMALL_LETTER_ALPHA = '\u03B1'; // α - static final char GREEK_CAPITAL_LETTER_OMEGA = '\u03A9'; // ω - - // Gets the plain (not bold, not italic) version of each static private List getMonoFontList() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); Font[] fonts = ge.getAllFonts(); - ArrayList outgoing = new ArrayList(); + List outgoing = new ArrayList<>(); // Using AffineTransform.getScaleInstance(100, 100) doesn't change sizes FontRenderContext frc = new FontRenderContext(new AffineTransform(), @@ -788,13 +985,12 @@ static private List getMonoFontList() { static public String[] getMonoFontFamilies() { - HashSet families = new HashSet(); + StringList families = new StringList(); for (Font font : getMonoFontList()) { - families.add(font.getFamily()); + families.appendUnique(font.getFamily()); } - String[] names = families.toArray(new String[0]); - Arrays.sort(names); - return names; + families.sort(); + return families.array(); } @@ -806,7 +1002,8 @@ static public String[] getMonoFontFamilies() { static public String getMonoFontName() { if (monoFont == null) { - getMonoFont(12, Font.PLAIN); // load a dummy version + // create a dummy version if the font has never been loaded (rare) + getMonoFont(12, Font.PLAIN); } return monoFont.getName(); } @@ -816,16 +1013,18 @@ static public Font getMonoFont(int size, int style) { if (monoFont == null) { try { monoFont = createFont("SourceCodePro-Regular.ttf", size); - //monoBoldFont = createFont("SourceCodePro-Semibold.ttf", size); monoBoldFont = createFont("SourceCodePro-Bold.ttf", size); - // additional language constraints - if ("el".equals(Language.getLanguage())) { - if (!monoFont.canDisplay(GREEK_SMALL_LETTER_ALPHA) || - !monoFont.canDisplay(GREEK_CAPITAL_LETTER_OMEGA)) { - monoFont = createFont("AnonymousPro-Regular.ttf", size); - monoBoldFont = createFont("AnonymousPro-Bold.ttf", size); - } + // https://github.com/processing/processing/issues/2886 + // https://github.com/processing/processing/issues/4944 + String lang = Language.getLanguage(); + if ("el".equals(lang) || + "ar".equals(lang) || + Locale.CHINESE.getLanguage().equals(lang) || + Locale.JAPANESE.getLanguage().equals(lang) || + Locale.KOREAN.getLanguage().equals(lang)) { + sansFont = new Font("Monospaced", Font.PLAIN, size); + sansBoldFont = new Font("Monospaced", Font.BOLD, size); } } catch (Exception e) { Messages.loge("Could not load mono font", e); @@ -849,19 +1048,31 @@ static public Font getMonoFont(int size, int style) { } + static public String getSansFontName() { + if (sansFont == null) { + // create a dummy version if the font has never been loaded (rare) + getSansFont(12, Font.PLAIN); + } + return sansFont.getName(); + } + + static public Font getSansFont(int size, int style) { if (sansFont == null) { try { - sansFont = createFont("SourceSansPro-Regular.ttf", size); - sansBoldFont = createFont("SourceSansPro-Semibold.ttf", size); - - // additional language constraints - if ("el".equals(Language.getLanguage())) { - if (!sansFont.canDisplay(GREEK_SMALL_LETTER_ALPHA) || - !sansFont.canDisplay(GREEK_CAPITAL_LETTER_OMEGA)) { - sansFont = createFont("Carlito-Regular.ttf", size); - sansBoldFont = createFont("Carlito-Bold.ttf", size); - } + sansFont = createFont("ProcessingSansPro-Regular.ttf", size); + sansBoldFont = createFont("ProcessingSansPro-Semibold.ttf", size); + + // https://github.com/processing/processing/issues/2886 + // https://github.com/processing/processing/issues/4944 + String lang = Language.getLanguage(); + if ("el".equals(lang) || + "ar".equals(lang) || + Locale.CHINESE.getLanguage().equals(lang) || + Locale.JAPANESE.getLanguage().equals(lang) || + Locale.KOREAN.getLanguage().equals(lang)) { + sansFont = new Font("SansSerif", Font.PLAIN, size); + sansBoldFont = new Font("SansSerif", Font.BOLD, size); } } catch (Exception e) { Messages.loge("Could not load sans font", e); @@ -886,29 +1097,29 @@ static public Font getSansFont(int size, int style) { /** - * Get a font from the JRE lib/fonts folder. Our default fonts are also + * Get a font from the lib/fonts folder. Our default fonts are also * installed there so that the monospace (and others) can be used by other * font listing calls (i.e. it appears in the list of monospace fonts in * the Preferences window, and can be used by HTMLEditorKit for WebFrame). */ static private Font createFont(String filename, int size) throws IOException, FontFormatException { - // Can't use Base.getJavaHome(), because if we're not using our local JRE, - // we likely have bigger problems with how things are running. + boolean registerFont = false; + + // try the JRE font directory first File fontFile = new File(System.getProperty("java.home"), "lib/fonts/" + filename); + + // else fall back to our own content dir if (!fontFile.exists()) { - // if we're debugging from Eclipse, grab it from the work folder (user.dir is /app) - fontFile = new File(System.getProperty("user.dir"), "../build/shared/lib/fonts/" + filename); - } - if (!fontFile.exists()) { - // if we're debugging the new Java Mode from Eclipse, paths are different - fontFile = new File(System.getProperty("user.dir"), "../../shared/lib/fonts/" + filename); + fontFile = Platform.getContentFile("lib/fonts/" + filename); + registerFont = true; } + if (!fontFile.exists()) { String msg = "Could not find required fonts. "; // This gets the JAVA_HOME for the *local* copy of the JRE installed with // Processing. If it's not using the local JRE, it may be because of this // launch4j bug: https://github.com/processing/processing/issues/3543 - if (hasNonAsciiChars(Platform.getJavaHome().getAbsolutePath())) { + if (Util.containsNonASCII(Platform.getJavaHome().getAbsolutePath())) { msg += "Trying moving Processing\n" + "to a location with only ASCII characters in the path."; } else { @@ -917,18 +1128,17 @@ static private Font createFont(String filename, int size) throws IOException, Fo Messages.showError("Font Sadness", msg, null); } + BufferedInputStream input = new BufferedInputStream(new FileInputStream(fontFile)); Font font = Font.createFont(Font.TRUETYPE_FONT, input); input.close(); - return font.deriveFont((float) size); - } - - static private final boolean hasNonAsciiChars(String what) { - for (char c : what.toCharArray()) { - if (c < 32 || c > 127) return true; + if (registerFont) { + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + ge.registerFont(font); } - return false; + + return font.deriveFont((float) size); } @@ -936,7 +1146,7 @@ static private final boolean hasNonAsciiChars(String what) { * Synthesized replacement for FontMetrics.getAscent(), which is dreadfully * inaccurate and inconsistent across platforms. */ - static double getAscent(Graphics g) { //, Font font) { + static public double getAscent(Graphics g) { Graphics2D g2 = (Graphics2D) g; FontRenderContext frc = g2.getFontRenderContext(); //return new TextLayout("H", font, frc).getBounds().getHeight(); @@ -944,20 +1154,6 @@ static double getAscent(Graphics g) { //, Font font) { } - /** Do not use or rely upon presence of this method: not approved as final API. */ - static public void debugOpacity(Component comp) { - //Component parent = comp.getParent(); - while (comp != null) { - //EditorConsole.systemOut.println("parent is " + parent + " " + parent.isOpaque()); - //EditorConsole.systemOut.println(parent.getClass().getName() + " " + (parent.isOpaque() ? "OPAQUE" : "")); - System.out.println(comp.getClass().getName() + " " + (comp.isOpaque() ? "OPAQUE" : "")); - comp = comp.getParent(); - } - //EditorConsole.systemOut.println(); - System.out.println(); - } - - static public int getMenuItemIndex(JMenu menu, JMenuItem item) { int index = 0; for (Component comp : menu.getMenuComponents()) { diff --git a/app/src/processing/app/ui/WebFrame.java b/app/src/processing/app/ui/WebFrame.java index d795958153..f1f791d3f2 100644 --- a/app/src/processing/app/ui/WebFrame.java +++ b/app/src/processing/app/ui/WebFrame.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2015 The Processing Foundation + Copyright (c) 2015-19 The Processing Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -21,6 +21,7 @@ package processing.app.ui; +import java.awt.Container; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -46,10 +47,10 @@ public class WebFrame extends JFrame { boolean ready; - public WebFrame(File file, int width) throws IOException { + public WebFrame(File file, int width, Container panel) throws IOException { // Need to use the URL version so that relative paths work for images // https://github.com/processing/processing/issues/3494 - URL fileUrl = file.toURI().toURL(); //.toExternalForm(); + URL fileUrl = file.toURI().toURL(); requestContentHeight(width, fileUrl); editorPane = new JEditorPane(); @@ -68,7 +69,14 @@ public void propertyChange(PropertyChangeEvent evt) { editorPane.setEditable(false); // set height to something generic editorPane.setPreferredSize(new Dimension(width, width)); - getContentPane().add(editorPane); + + //getContentPane().add(editorPane); + Container pain = getContentPane(); + pain.setLayout(new BoxLayout(pain, BoxLayout.Y_AXIS)); + pain.add(editorPane); + if (panel != null) { + pain.add(panel); + } Toolkit.registerWindowCloseKeys(getRootPane(), new ActionListener() { @Override @@ -76,6 +84,7 @@ public void actionPerformed(ActionEvent e) { handleClose(); } }); + Toolkit.setIcon(this); editorKit = (HTMLEditorKit) editorPane.getEditorKit(); editorKit.setAutoFormSubmission(false); diff --git a/app/src/processing/app/ui/Welcome.java b/app/src/processing/app/ui/Welcome.java index c0b38d198f..9de89a1db8 100644 --- a/app/src/processing/app/ui/Welcome.java +++ b/app/src/processing/app/ui/Welcome.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2015 The Processing Foundation + Copyright (c) 2015-19 The Processing Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -21,54 +21,114 @@ package processing.app.ui; +import java.awt.Color; import java.awt.EventQueue; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; import java.io.File; import java.io.IOException; +import javax.swing.Box; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComponent; + import processing.app.Base; import processing.app.Language; import processing.app.Platform; import processing.app.Preferences; import processing.core.PApplet; -import processing.data.StringDict; -public class Welcome extends WebFrame { +public class Welcome { Base base; + WebFrame view; public Welcome(Base base, boolean sketchbook) throws IOException { - super(getIndexFile(sketchbook), 400); this.base = base; - //addStyle("#new_sketchbook { background-color: rgb(0, 255, 0); }"); - setVisible(true); - } + // TODO this should live inside theme or somewhere modifiable + Font dialogFont = Toolkit.getSansFont(14, Font.PLAIN); + + JComponent panel = Box.createHorizontalBox(); + panel.setBackground(new Color(245, 245, 245)); + Toolkit.setBorder(panel, 15, 20, 15, 20); + + //panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); + //panel.add(Box.createHorizontalStrut(20)); + JCheckBox checkbox = new JCheckBox("Show this message on startup"); + checkbox.setFont(dialogFont); + // handles the Help menu invocation, and also the pref not existing + checkbox.setSelected("true".equals(Preferences.get("welcome.show"))); + checkbox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + Preferences.setBoolean("welcome.show", true); + } else if (e.getStateChange() == ItemEvent.DESELECTED) { + Preferences.setBoolean("welcome.show", false); + } + } + }); + panel.add(checkbox); - public void handleSubmit(StringDict dict) { - // sketchbook = "create_new" or "use_existing" - // show_each_time = "on" or - //dict.print(); - - String sketchbookAction = dict.get("sketchbook", null); - if ("create_new".equals(sketchbookAction)) { - // open file dialog - // on affirmative selection, update sketchbook folder -// String path = Preferences.getSketchbookPath() + "3"; -// File folder = new File(path); -// folder.mkdirs(); - File folder = new File(Preferences.getSketchbookPath()).getParentFile(); - PApplet.selectFolder(Language.text("preferences.sketchbook_location.popup"), - "sketchbookCallback", folder, - this, this); - } + panel.add(Box.createHorizontalGlue()); - // If un-checked, the key won't be in the dict, so null will be passed - boolean keepShowing = "on".equals(dict.get("show_each_time", null)); - Preferences.setBoolean("welcome.show", keepShowing); - Preferences.save(); + JButton button = new JButton("Get Started"); + button.setFont(Toolkit.getSansFont(14, Font.PLAIN)); + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + view.handleClose(); + } + }); + panel.add(button); + //panel.add(Box.createHorizontalGlue()); + + view = new WebFrame(getIndexFile(sketchbook), 425, panel) { + /* + @Override + public void handleSubmit(StringDict dict) { + String sketchbookAction = dict.get("sketchbook", null); + if ("create_new".equals(sketchbookAction)) { + File folder = new File(Preferences.getSketchbookPath()).getParentFile(); + PApplet.selectFolder(Language.text("preferences.sketchbook_location.popup"), + "sketchbookCallback", folder, + this, this); + } - handleClose(); +// // If un-checked, the key won't be in the dict, so null will be passed +// boolean keepShowing = "on".equals(dict.get("show_each_time", null)); +// Preferences.setBoolean("welcome.show", keepShowing); +// Preferences.save(); + handleClose(); + } + */ + + @Override + public void handleLink(String link) { + // The link will already have the full URL prefix + if (link.endsWith("#sketchbook")) { + File folder = new File(Preferences.getSketchbookPath()).getParentFile(); + PApplet.selectFolder(Language.text("preferences.sketchbook_location.popup"), + "sketchbookCallback", folder, + this, this); + } else { + super.handleLink(link); + } + } + + @Override + public void handleClose() { + Preferences.setBoolean("welcome.seen", true); + Preferences.save(); + super.handleClose(); + } + }; + view.setVisible(true); } @@ -77,16 +137,17 @@ public void sketchbookCallback(File folder) { if (folder != null) { if (base != null) { base.setSketchbookFolder(folder); - } else { - System.out.println("user selected " + folder); +// } else { +// System.out.println("user selected " + folder); } } } - public void handleClose() { - dispose(); - } +// @Override +// public void handleClose() { +// dispose(); +// } static private File getIndexFile(boolean sketchbook) { @@ -120,11 +181,7 @@ static public void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { - new Welcome(null, true) { - public void handleClose() { - System.exit(0); - } - }; + new Welcome(null, true); } catch (IOException e) { e.printStackTrace(); } diff --git a/app/src/processing/app/ui/Welcome2.java b/app/src/processing/app/ui/Welcome2.java new file mode 100644 index 0000000000..7c635dc115 --- /dev/null +++ b/app/src/processing/app/ui/Welcome2.java @@ -0,0 +1,362 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2017-19 The Processing Foundation + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + version 2, as published by the Free Software Foundation. + + 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.ui; + +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Font; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.io.File; +import java.io.IOException; + +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JTextArea; + +import processing.app.Base; +import processing.app.Language; +import processing.app.Platform; +import processing.app.Preferences; +import processing.core.PApplet; + + +/** + * The Welcome class creates a welcome window upon startup + * + * It provides links to changes Processing 3 + * + * If the user is migrating from Processing 2, it provides a + * prompt asking whether to use the same sketchbook folder + * as before, or use a new one. + */ +public class Welcome2 extends JFrame { + Base base; + boolean newSketchbook; + + /** + * @param Base the current Processing Base + * @param oldSketchbook true if the user has a Processing 2 sketchbook + * @throws IOException if resources cannot be found + */ + public Welcome2(Base base, boolean oldSketchbook) throws IOException { + this.base = base; + + // strings used in the GUI + // should be moved to external files to make tranlsation easier + final String welcomeText = "Welcome to Processing 3"; + final String whatsNewText = "Read about what's new in 3.0 \u2192"; + final String compatibleText = "Note that some sketches from Processing 2 " + + "may not be compatible."; + final String whatHasChangedText = "What has changed?"; + final String newSketchbookText = "Since older sketches may " + + "not be compatible, we recommend creating a new sketchbook folder, " + + "so Processing 2 and 3 can happily coexist. This is a one-time " + + "process."; + final String readMoreText = "Read more about it"; + final String createNewSketchbookText = "Create a new sketchbook " + + "folder for use with Processing 3 sketches (recommended!)"; + final String useOldSketchbookText = "Use the existing sketchbook " + + "for both old and new sketches (may cause conflicts with installed " + + "libraries)"; + final String showEachTimeText = "Show this welcome message each time"; + + // color used for boxes with special information + final Color insetColor = new Color(224, 253, 251); + // color used in hyperlinks + final Color linkColor = new Color(44, 123, 181); + + final String whatsNewUrl = "https://github.com/processing/processing/wiki/Changes-in-3.0"; + +// Font processingSemibold; +// Font processingSansPro; + + // load fonts +// try { +// processingSemibold = Font.createFont(Font.TRUETYPE_FONT, +// Base.getLibFile("/fonts/ProcessingSansPro-Semibold.ttf")); +// processingSansPro = Font.createFont(Font.TRUETYPE_FONT, +// Base.getLibFile("/fonts/ProcessingSansPro-Regular.ttf")); +// } catch (FontFormatException e) { +// processingSemibold = UIManager.getDefaults().getFont("Label.font"); +// processingSansPro = UIManager.getDefaults().getFont("Label.font"); +// } +// +// headerFont = processingSemibold.deriveFont(20f); +// bodyFont = processingSansPro.deriveFont(12f); + + Font headerFont = Toolkit.getSansFont(20, Font.BOLD); + Font bodyFont = Toolkit.getSansFont(12, Font.PLAIN); + + //Set welcome window title + setTitle(welcomeText); + + // release frame resources on close + setDefaultCloseOperation(DISPOSE_ON_CLOSE); + + //Main content panel + JPanel panel = new JPanel(new GridBagLayout()); + Toolkit.setBorder(panel, 20, 20, 20, 20); + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.LINE_START; + c.fill = GridBagConstraints.HORIZONTAL; + + //int width = sketchbook ? 500 : 400; +// int width = Toolkit.zoom(400); +// int height = Toolkit.zoom(oldSketchbook ? 400 : 250); + int width = 400; + int height = oldSketchbook ? 400 : 250; + + panel.setPreferredSize(Toolkit.zoom(width, height)); + panel.setBackground(Color.white); + + // Processing logo + JLabel logo = new JLabel(Toolkit.getLibIcon("/icons/pde-64.png")); + c.gridx = 0; + c.gridy = 0; + panel.add(logo, c); + + // welcome header + JLabel header = new JLabel(welcomeText); + header.setFont(headerFont); + c.gridx = 1; + c.gridy = 0; + panel.add(header, c); + + // read what's new link + JLabel readNew = new JLabel(whatsNewText); + readNew.setForeground(linkColor); + readNew.setFont(bodyFont); + readNew.setCursor(new Cursor(Cursor.HAND_CURSOR)); + readNew.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + Platform.openURL(whatsNewUrl); + } + }); + c.gridwidth = 2; + c.gridx = 0; + c.gridy = 1; + panel.add(readNew, c); + + // compatible notice inset + JPanel compatible = new JPanel(new GridBagLayout()); + GridBagConstraints compc = new GridBagConstraints(); + compatible.setBackground(insetColor); + Toolkit.setBorder(compatible, 10, 0, 10, 0); + compc.anchor = GridBagConstraints.FIRST_LINE_START; + compc.fill = GridBagConstraints.HORIZONTAL; + + // compatible notice text + JLabel compatibleNotice = new JLabel(compatibleText); + compatibleNotice.setFont(bodyFont); + compc.gridx = 0; + compc.gridy = 0; + compatible.add(compatibleNotice, compc); + + // link to what has changed + JLabel changed = new JLabel(whatHasChangedText); + changed.setFont(bodyFont); + changed.setForeground(linkColor); + changed.setCursor(new Cursor(Cursor.HAND_CURSOR)); + changed.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + Platform.openURL(whatsNewUrl); + } + }); + compc.gridx = 0; + compc.gridy = 1; + compatible.add(changed, compc); + + // add compatible notice inset into main panel + c.gridx = 0; + c.gridy = 2; + panel.add(compatible, c); + + // if the user needs to choose a new sketchbook + if (oldSketchbook) { + // create new sketchbook prompt + JTextArea newSketchbookPrompt = new JTextArea(newSketchbookText); + newSketchbookPrompt.setFont(bodyFont); + newSketchbookPrompt.setEditable(false); + newSketchbookPrompt.setLineWrap(true); + newSketchbookPrompt.setWrapStyleWord(true); + c.gridx = 0; + c.gridy = 3; + panel.add(newSketchbookPrompt, c); + + // read more link + JLabel readMore = new JLabel(readMoreText); + readMore.setFont(bodyFont); + c.gridx = 0; + c.gridy = 4; + panel.add(readMore, c); + + // inset for choose sketchbook + JPanel chooseSketchbook = new JPanel(new GridBagLayout()); + Toolkit.setBorder(chooseSketchbook, 10, 0, 10, 0); + GridBagConstraints choosec = new GridBagConstraints(); + choosec.fill = GridBagConstraints.HORIZONTAL; + choosec.anchor = GridBagConstraints.LINE_START; + chooseSketchbook.setBackground(insetColor); + + // sketchbookGroup contains radio buttons for selection + ButtonGroup sketchbookGroup = new ButtonGroup(); + + // create a new sketchbook for Processing 3 option + JRadioButton createNew = new JRadioButton(createNewSketchbookText); + sketchbookGroup.add(createNew); + createNew.setSelected(true); + createNew.setFont(bodyFont); + createNew.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + //dict.set("sketchbook", "create_new"); + newSketchbook = true; + } + } + }); + // set default + //dict.set("sketchbook", "create_new"); + newSketchbook = true; + choosec.gridx = 0; + choosec.gridy = 0; + chooseSketchbook.add(createNew, choosec); + + // share sketchbook with Processing 2 option + JRadioButton useOld = new JRadioButton("" + useOldSketchbookText); + sketchbookGroup.add(useOld); + useOld.setFont(bodyFont); + useOld.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + //dict.set("sketchbook", "use_existing"); + newSketchbook = false; + } + } + }); + choosec.gridx = 0; + choosec.gridy = 1; + chooseSketchbook.add(useOld, choosec); + + // add choose sketchbook inset into main panel + c.gridx = 0; + c.gridy = 5; + panel.add(chooseSketchbook, c); + } + + // show welcome each time checkbox + // fixes https://github.com/processing/processing/issues/3912 + JCheckBox showEachTime = new JCheckBox("" + showEachTimeText); + // handles the Help menu invocation, and also the pref not existing + showEachTime.setSelected("true".equals(Preferences.get("welcome.show"))); + showEachTime.setFont(bodyFont); + showEachTime.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + Preferences.setBoolean("welcome.show", true); + } else if (e.getStateChange() == ItemEvent.DESELECTED) { + Preferences.setBoolean("welcome.show", false); + } + } + }); + // set default +// dict.set("show_each_time", "on"); + c.gridx = 0; + c.gridy = 6; + panel.add(showEachTime, c); + + // get started (submit) button + JButton getStarted = new JButton("Get Started"); + getStarted.setFont(bodyFont); + getStarted.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handleClose(); + } + }); + c.fill = GridBagConstraints.NONE; + c.gridx = 0; + c.gridy = 7; + c.anchor = GridBagConstraints.LAST_LINE_END; + panel.add(getStarted, c); + + add(panel); + pack(); + + Toolkit.registerWindowCloseKeys(getRootPane(), new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleClose(); + } + }); + + // center window on the screen + setLocationRelativeTo(null); + + setVisible(true); + } + + + /** + * Callback for the folder selector, used when user chooses + * a new sketchbook for Processing 3 + * @param folder the path to the new sketcbook + */ + public void sketchbookCallback(File folder) { + if (folder != null) { + if (base != null) { + base.setSketchbookFolder(folder); + } else { + System.out.println("user selected " + folder); + } + } + } + + + /** + * Closes the window + */ + public void handleClose() { + Preferences.save(); // save the "show this" setting + + if (newSketchbook) { + File folder = new File(Preferences.getSketchbookPath()).getParentFile(); + PApplet.selectFolder(Language.text("preferences.sketchbook_location.popup"), + "sketchbookCallback", folder, this, this); + } + dispose(); + } +} diff --git a/app/src/processing/app/ui/ZoomTreeCellRenderer.java b/app/src/processing/app/ui/ZoomTreeCellRenderer.java new file mode 100644 index 0000000000..616b63dbe9 --- /dev/null +++ b/app/src/processing/app/ui/ZoomTreeCellRenderer.java @@ -0,0 +1,63 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2017-19 The Processing Foundation + + 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.ui; + +import java.awt.*; +import java.util.Optional; + +import javax.swing.JTree; +import javax.swing.tree.DefaultTreeCellRenderer; + +import processing.app.Mode; + + +public class ZoomTreeCellRenderer extends DefaultTreeCellRenderer { + + public ZoomTreeCellRenderer(Mode mode) { + setFont(mode.getFont("tree.font")); + } + + @Override + public Dimension getPreferredSize() { + return Optional.ofNullable(super.getPreferredSize()) + .map(d -> new Dimension(d.width, (int) (d.height * 1.15f))) + .orElse(null); + } + + @Override + public Component getTreeCellRendererComponent(JTree tree, Object value, + boolean selected, + boolean expanded, + boolean leaf, int row, + boolean hasFocus) { + + // Adjust height for magnified displays. The font is scaled properly, + // but the rows don't automatically use the scaled preferred size. + // https://github.com/processing/processing/issues/4936 + // Using setRowHeight(0) to force using this cell renderer's preferred height + // https://github.com/processing/processing/issues/5246#issuecomment-379503233 + tree.setRowHeight(0); + return super.getTreeCellRendererComponent(tree, value, selected, + expanded, leaf, row, hasFocus); + } +} \ No newline at end of file diff --git a/build/.gitignore b/build/.gitignore index a340c103d7..290988977d 100644 --- a/build/.gitignore +++ b/build/.gitignore @@ -1 +1,2 @@ -work \ No newline at end of file +work +javadoc diff --git a/build/build.xml b/build/build.xml index 0c58c1ea62..5b944c08b8 100644 --- a/build/build.xml +++ b/build/build.xml @@ -1,13 +1,13 @@ - + - + - + @@ -32,51 +32,68 @@ + + + + + + + + - - + + + + + + + - - - - - - - - - + + + + + + + + + - + - - - - + + + + + + + @@ -134,7 +151,7 @@ - - @@ -201,7 +218,7 @@ - + @@ -210,9 +227,9 @@ - + - + path="${jre.tgz.path}" /> - - + - - + - - + @@ -273,7 +292,7 @@ - + @@ -282,21 +301,12 @@ + - - - - - - - - @@ -304,9 +314,16 @@ + + + + + - @@ -327,15 +344,16 @@ - + - + + @@ -346,7 +364,7 @@ - + @@ -358,22 +376,29 @@ - + + + + + + + + - + - - + - + - + @@ -384,17 +409,24 @@ - + - + + + + + + - @@ -413,13 +445,13 @@ - + - + + - @@ -436,9 +468,9 @@ - + - @@ -449,46 +481,54 @@ - + - + - - - + + - + + + - + ======================================================= Processing for Mac OS X can only be built on Mac OS X. - - Bye. + + Bye. ======================================================= - + + + + + - + + minimumSystem="10.8.5" + mainClassName="processing.app.BaseSplash"> - + - - - - - @@ -532,15 +569,20 @@ - + + + + - - + - - + - + - + - - - - + + + + + + - + - + - - + + + + + + + - - + + + + + + + Code signing will only work if you have a $99/yr Apple developer ID. @@ -677,7 +744,7 @@ - - - - - - - - @@ -714,43 +770,43 @@ ======================================================= Processing for Mac OS X was built. Grab it from - + macosx/processing-${version}-macosx.zip ======================================================= - + - + + - - + ======================================================= Processing for Linux can only be built on *nix systems. - - Bye. + + Bye. ======================================================= - + - - + + - - + + - + @@ -759,13 +815,15 @@ - + + - - @@ -777,8 +835,8 @@ - - + + @@ -789,17 +847,31 @@ - + + + + + + - @@ -809,7 +881,7 @@ @@ -817,17 +889,12 @@ - - - + - + @@ -836,8 +903,8 @@ - - + + @@ -851,20 +918,15 @@ --> - - - - - - - - - + + @@ -910,25 +972,43 @@ - + + - + - + - - - + + + + + + + + + - + + + + + + + + - + @@ -969,56 +1049,73 @@ - + ======================================================== - Processing for Debian Linux was built. Grab the deb from - + Processing for Debian Linux was built. Grab the deb from + ${linux.deb} ======================================================== - + - + + - - + ======================================================= Processing for Windows can only be built on windows. - - Bye. + + Bye. ======================================================= - + - + - + - + - - + + + + + + + + + + + + + + + + + + - + @@ -1042,12 +1139,12 @@ - - - @@ -1059,21 +1156,21 @@ - - @@ -1084,61 +1181,57 @@ --> - - - - - - - - - - + ======================================================= - Processing for Windows was built. Grab the archive from + Processing for Windows was built. Grab the archive from ${windows.dist} ======================================================= - + - + - + - + @@ -1230,15 +1323,20 @@ remove the spaces for depth since it should be double dash, but screws up commen + + + + + - + - + @@ -1246,6 +1344,16 @@ remove the spaces for depth since it should be double dash, but screws up commen + + + + + + + + + + @@ -1253,9 +1361,9 @@ remove the spaces for depth since it should be double dash, but screws up commen @@ -1264,35 +1372,98 @@ remove the spaces for depth since it should be double dash, but screws up commen - + - + - + + + + + + + + + + + - + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1327,12 +1498,12 @@ remove the spaces for depth since it should be double dash, but screws up commen --> - + - - diff --git a/build/javadoc/core/allclasses-frame.html b/build/javadoc/core/allclasses-frame.html deleted file mode 100644 index dfb7c0144e..0000000000 --- a/build/javadoc/core/allclasses-frame.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - -All Classes - - - - -

All Classes

- - - diff --git a/build/javadoc/core/allclasses-noframe.html b/build/javadoc/core/allclasses-noframe.html deleted file mode 100644 index 3ef73965cd..0000000000 --- a/build/javadoc/core/allclasses-noframe.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - -All Classes - - - - -

All Classes

- - - diff --git a/build/javadoc/core/constant-values.html b/build/javadoc/core/constant-values.html deleted file mode 100644 index 65e0a0ca57..0000000000 --- a/build/javadoc/core/constant-values.html +++ /dev/null @@ -1,2320 +0,0 @@ - - - - - -Constant Field Values - - - - - - - - - - - -
- - -

processing.core.*

- - - - -

processing.data.*

-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.data.Table 
    Modifier and TypeConstant FieldValue
    - -public static final intCATEGORY5
    - -public static final intDOUBLE4
    - -public static final intFLOAT3
    - -public static final intINT1
    - -public static final intLONG2
    - -public static final intSTRING0
    -
  • -
- - - -

processing.event.*

-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.event.Event 
    Modifier and TypeConstant FieldValue
    - -public static final intALT8
    - -public static final intCTRL2
    - -public static final intKEY1
    - -public static final intMETA4
    - -public static final intMOUSE2
    - -public static final intSHIFT1
    - -public static final intTOUCH3
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.event.KeyEvent 
    Modifier and TypeConstant FieldValue
    - -public static final intPRESS1
    - -public static final intRELEASE2
    - -public static final intTYPE3
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.event.MouseEvent 
    Modifier and TypeConstant FieldValue
    - -public static final intCLICK3
    - -public static final intDRAG4
    - -public static final intENTER6
    - -public static final intEXIT7
    - -public static final intMOVE5
    - -public static final intPRESS1
    - -public static final intRELEASE2
    - -public static final intWHEEL8
    -
  • -
- - - -

processing.opengl.*

-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.opengl.LinePath 
    Modifier and TypeConstant FieldValue
    - -public static final intCAP_BUTT0
    - -public static final intCAP_ROUND1
    - -public static final intCAP_SQUARE2
    - -public static final intJOIN_BEVEL2
    - -public static final intJOIN_MITER0
    - -public static final intJOIN_ROUND1
    - -public static final byteSEG_CLOSE2
    - -public static final byteSEG_LINETO1
    - -public static final byteSEG_MOVETO0
    - -public static final intWIND_EVEN_ODD0
    - -public static final intWIND_NON_ZERO1
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.opengl.PGL 
    Modifier and TypeConstant FieldValue
    - -public static final StringFRAMEBUFFER_ERROR"Framebuffer error (%1$s), rendering will probably not work as expected Read http://wiki.processing.org/w/OpenGL_Issues for help."
    - -public static final StringMISSING_FBO_ERROR"Framebuffer objects are not supported by this hardware (or driver) Read http://wiki.processing.org/w/OpenGL_Issues for help."
    - -public static final StringMISSING_GLFUNC_ERROR"GL function %1$s is not available on this hardware (or driver) Read http://wiki.processing.org/w/OpenGL_Issues for help."
    - -public static final StringMISSING_GLSL_ERROR"GLSL shaders are not supported by this hardware (or driver) Read http://wiki.processing.org/w/OpenGL_Issues for help."
    - -public static final StringNONPRIMARY_ERROR"The renderer is trying to call a PGL function that can only be called on a primary PGL. This is most likely due to a bug in the renderer\'s code, please report it with an issue on Processing\'s github page https://github.com/processing/processing/issues?state=open if using any of the built-in OpenGL renderers. If you are using a contributed library, contact the library\'s developers."
    - -public static final StringTEXUNIT_ERROR"Number of texture units not supported by this hardware (or driver) Read http://wiki.processing.org/w/OpenGL_Issues for help."
    - -public static final StringUNSUPPORTED_GLPROF_ERROR"Unsupported OpenGL profile."
    - -public static final StringWIKI" Read http://wiki.processing.org/w/OpenGL_Issues for help."
    -
  • -
  • - - - - - - - - - - - - - - - - - - - -
    processing.opengl.PJOGL 
    Modifier and TypeConstant FieldValue
    - -public static final intAWT0
    - -public static final intNEWT1
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.opengl.PShapeOpenGL 
    Modifier and TypeConstant FieldValue
    - -public static final intDIRECTION3
    - -public static final intNORMAL1
    - -public static final intOFFSET4
    - -public static final intPOSITION0
    - -public static final intTEXCOORD2
    -
  • -
  • - - - - - - - - - - - - - - -
    processing.opengl.Texture 
    Modifier and TypeConstant FieldValue
    - -public static final intMAX_BUFFER_CACHE_SIZE3
    -
  • -
-
- - - - - - diff --git a/build/javadoc/core/deprecated-list.html b/build/javadoc/core/deprecated-list.html deleted file mode 100644 index 42f30c963e..0000000000 --- a/build/javadoc/core/deprecated-list.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - -Deprecated List - - - - - - - -
- - - - - - - -
- - -
-

Deprecated API

-

Contents

- -
-
- - - - - - - -
- -
- - - - - - - -
- - - - diff --git a/build/javadoc/core/help-doc.html b/build/javadoc/core/help-doc.html deleted file mode 100644 index d4b59da43b..0000000000 --- a/build/javadoc/core/help-doc.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - -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 six 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.

    -
  • -
  • -

    All Classes

    -

    The All Classes link shows all classes and interfaces except non-static nested types.

    -
  • -
  • -

    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 deleted file mode 100644 index c7df764e9e..0000000000 --- a/build/javadoc/core/index-all.html +++ /dev/null @@ -1,11573 +0,0 @@ - - - - - -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 class processing.core.PGraphics
-
 
-
AB - Static variable in class processing.core.PGraphics
-
 
-
abs(float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from abs.xml ) - - Calculates the absolute value (magnitude) of a number.
-
-
abs(int) - Static method in class processing.core.PApplet
-
 
-
acos(float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from acos.xml ) - - The inverse of cos(), returns the arc cosine of a value.
-
-
activeTexture(int) - Method in class processing.opengl.PGL
-
 
-
ADD - Static variable in interface processing.core.PConstants
-
 
-
add(PVector) - Method in class processing.core.PVector
-
-
( begin auto-generated from PVector_add.xml ) - - Adds x, y, and z components to a vector, adds one vector to another, or - adds two independent vectors together.
-
-
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
-
-
add(String, float) - Method in class processing.data.FloatDict
-
 
-
add(int, float) - Method in class processing.data.FloatList
-
 
-
add(String, int) - Method in class processing.data.IntDict
-
 
-
add(int, int) - Method in class processing.data.IntList
-
 
-
addChild(PShape) - Method in class processing.core.PShape
-
 
-
addChild(PShape, int) - Method in class processing.core.PShape
-
 
-
addChild(String) - Method in class processing.data.XML
-
 
-
addChild(XML) - Method in class processing.data.XML
-
 
-
addChild(PShape) - Method in class processing.opengl.PShapeOpenGL
-
 
-
addChild(PShape, int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
addColumn() - Method in class processing.data.Table
-
 
-
addColumn(String) - Method in class processing.data.Table
-
 
-
addColumn(String, int) - Method in class processing.data.Table
-
 
-
addName(String, PShape) - Method in class processing.core.PShape
-
-
Add a shape to the name lookup table.
-
-
addRow() - Method in class processing.data.Table
-
 
-
addRow(TableRow) - Method in class processing.data.Table
-
 
-
addRow(Object[]) - Method in class processing.data.Table
-
 
-
addRows(Table) - Method in class processing.data.Table
-
 
-
AG - Static variable in class processing.core.PGraphics
-
 
-
ALIASED_LINE_WIDTH_RANGE - Static variable in class processing.opengl.PGL
-
 
-
ALIASED_POINT_SIZE_RANGE - Static variable in class processing.opengl.PGL
-
 
-
alpha(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from alpha.xml ) - - Extracts the alpha value from a color.
-
-
ALPHA - Static variable in interface processing.core.PConstants
-
 
-
alpha(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from alpha.xml ) - - Extracts the alpha value from a color.
-
-
ALPHA - Static variable in class processing.opengl.PGL
-
 
-
ALPHA8 - Static variable in class processing.opengl.PGL
-
 
-
ALPHA_MASK - Static variable in class processing.core.PImage
-
 
-
ALPHA_TEST - Static variable in class processing.opengl.PGL
-
 
-
alphaFunc(int, float) - Method in class processing.opengl.PGL
-
 
-
alphaFunc(int, float) - Method in class processing.opengl.PJOGL
-
 
-
ALT - Static variable in interface processing.core.PConstants
-
 
-
ALT - Static variable in class processing.event.Event
-
 
-
ALWAYS - Static variable in class processing.opengl.PGL
-
 
-
ambient(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from ambient.xml ) - - Sets the ambient reflectance for shapes drawn to the screen.
-
-
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
-
-
( begin auto-generated from ambient.xml ) - - Sets the ambient reflectance for shapes drawn to the screen.
-
-
ambient(float) - Method in class processing.core.PGraphics
-
 
-
ambient(float, float, float) - Method in class processing.core.PGraphics
-
 
-
ambient(int) - Method in class processing.core.PShape
-
 
-
ambient(float) - Method in class processing.core.PShape
-
 
-
ambient(float, float, float) - Method in class processing.core.PShape
-
 
-
ambientB - Variable in class processing.core.PGraphics
-
 
-
ambientB - Variable in class processing.core.PStyle
-
 
-
ambientColor - Variable in class processing.core.PGraphics
-
 
-
ambientG - Variable in class processing.core.PGraphics
-
 
-
ambientG - Variable in class processing.core.PStyle
-
 
-
ambientLight(float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from ambientLight.xml ) - - Adds an ambient light.
-
-
ambientLight(float, float, float, float, float, float) - Method in class processing.core.PApplet
-
 
-
ambientLight(float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from ambientLight.xml ) - - Adds an ambient light.
-
-
ambientLight(float, float, float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
ambientLight(float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
ambientLight(float, float, float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
ambientLight(float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Add an ambient light based on the current color mode.
-
-
ambientLight(float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
-
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
-
-
( begin auto-generated from PVector_angleBetween.xml ) - - Calculates and returns the angle (in radians) between two vectors.
-
-
anisoSamplingSupported - Static variable in class processing.opengl.PGraphicsOpenGL
-
 
-
append(byte[], byte) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from append.xml ) - - Expands an array by one element and adds data to the new position.
-
-
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
-
 
-
append(float) - Method in class processing.data.FloatList
-
-
Add a new entry to the list.
-
-
append(float[]) - Method in class processing.data.FloatList
-
 
-
append(FloatList) - Method in class processing.data.FloatList
-
 
-
append(int) - Method in class processing.data.IntList
-
-
Add a new entry to the list.
-
-
append(int[]) - Method in class processing.data.IntList
-
 
-
append(IntList) - Method in class processing.data.IntList
-
 
-
append(String) - Method in class processing.data.JSONArray
-
-
Append an String value.
-
-
append(int) - Method in class processing.data.JSONArray
-
-
Append an int value.
-
-
append(long) - Method in class processing.data.JSONArray
-
-
Append an long value.
-
-
append(float) - Method in class processing.data.JSONArray
-
-
Append a float value.
-
-
append(double) - Method in class processing.data.JSONArray
-
-
Append a double value.
-
-
append(boolean) - Method in class processing.data.JSONArray
-
-
Append a boolean value.
-
-
append(JSONArray) - Method in class processing.data.JSONArray
-
 
-
append(JSONObject) - Method in class processing.data.JSONArray
-
 
-
append(String) - Method in class processing.data.StringList
-
-
Add a new entry to the list.
-
-
append(String[]) - Method in class processing.data.StringList
-
 
-
append(StringList) - Method in class processing.data.StringList
-
 
-
appendUnique(float) - Method in class processing.data.FloatList
-
-
Add this value, but only if it's not already in the list.
-
-
appendUnique(int) - Method in class processing.data.IntList
-
-
Add this value, but only if it's not already in the list.
-
-
appendUnique(String) - Method in class processing.data.StringList
-
-
Add this value, but only if it's not already in the list.
-
-
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
-
 
-
applyMatrix(PMatrix) - Method in class processing.core.PApplet
-
-
( begin auto-generated from applyMatrix.xml ) - - Multiplies the current matrix by the one specified through the - parameters.
-
-
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
-
-
( begin auto-generated from applyMatrix.xml ) - - Multiplies the current matrix by the one specified through the - parameters.
-
-
applyMatrix(PMatrix2D) - Method in class processing.core.PGraphics
-
 
-
applyMatrix(float, float, float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
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
-
 
-
applyMatrix(float, float, float, float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
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(PMatrix3D) - 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
-
 
-
applyMatrix(PMatrix3D) - Method in class processing.opengl.PGraphics2D
-
 
-
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
applyMatrix(PMatrix2D) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
applyMatrix(float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
applyMatrix(PMatrix3D) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Apply a 4x4 transformation matrix to the modelview stack.
-
-
applyMatrix(PMatrix2D) - Method in class processing.opengl.PShapeOpenGL
-
 
-
applyMatrix(float, float, float, float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
applyProjection(PMatrix3D) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
applyProjection(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
AR - Static variable in class processing.core.PGraphics
-
 
-
arc(float, float, float, float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from arc.xml ) - - Draws an arc in the display window.
-
-
arc(float, float, float, float, float, float, int) - 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
-
-
( begin auto-generated from arc.xml ) - - Draws an arc in the display window.
-
-
arc(float, float, float, float, float, float, int) - Method in class processing.core.PGraphics
-
 
-
ARGB - Static variable in interface processing.core.PConstants
-
 
-
args - Variable in class processing.core.PApplet
-
-
Command line options passed in from main().
-
-
ARGS_DISPLAY - Static variable in class processing.core.PApplet
-
-
Used by the PDE to suggest a display (set in prefs, passed on Run)
-
-
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_EXTERNAL - Static variable in class processing.core.PApplet
-
 
-
ARGS_HIDE_STOP - Static variable in class processing.core.PApplet
-
 
-
ARGS_LOCATION - Static variable in class processing.core.PApplet
-
-
Location for where to position the applet window on screen.
-
-
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
-
 
-
ARGS_WINDOW_COLOR - Static variable in class processing.core.PApplet
-
 
-
array() - Method in class processing.core.PVector
-
-
( begin auto-generated from PVector_array.xml ) - - Return a representation of this vector as a float array.
-
-
array() - Method in class processing.data.FloatList
-
-
Create a new array with a copy of all the values.
-
-
array(float[]) - Method in class processing.data.FloatList
-
-
Copy values into the specified array.
-
-
array() - Method in class processing.data.IntList
-
-
Create a new array with a copy of all the values.
-
-
array(int[]) - Method in class processing.data.IntList
-
-
Copy values into the specified array.
-
-
array() - Method in class processing.data.StringList
-
-
Create a new array with a copy of all the values.
-
-
array(String[]) - Method in class processing.data.StringList
-
-
Copy values into the specified array.
-
-
ARRAY_BUFFER - Static variable in class processing.opengl.PGL
-
 
-
arrayCopy(Object, int, Object, int, int) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from arrayCopy.xml ) - - Copies an array (or part of an array) to another 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() - Method in class processing.core.PFont
-
-
Returns the ascent of this font from the baseline.
-
-
asin(float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from asin.xml ) - - The inverse of sin(), returns the arc sine of a value.
-
-
atan(float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from atan.xml ) - - The inverse of tan(), returns the arc tangent of a value.
-
-
atan2(float, float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from atan2.xml ) - - Calculates the angle (in radians) from a specified point to the - coordinate origin as measured from the positive x-axis.
-
-
attachShader(int, int) - Method in class processing.opengl.PGL
-
 
-
attachShader(int, int) - Method in class processing.opengl.PJOGL
-
 
-
attrib(String, float...) - Method in class processing.core.PApplet
-
 
-
attrib(String, int...) - Method in class processing.core.PApplet
-
 
-
attrib(String, boolean...) - Method in class processing.core.PApplet
-
 
-
attrib(String, float...) - Method in class processing.core.PGraphics
-
 
-
attrib(String, int...) - Method in class processing.core.PGraphics
-
 
-
attrib(String, boolean...) - Method in class processing.core.PGraphics
-
 
-
attrib(String, float...) - Method in class processing.core.PShape
-
 
-
attrib(String, int...) - Method in class processing.core.PShape
-
 
-
attrib(String, boolean...) - Method in class processing.core.PShape
-
 
-
attrib(String, float...) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
attrib(String, int...) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
attrib(String, boolean...) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
attrib(String, float...) - Method in class processing.opengl.PShapeOpenGL
-
 
-
attrib(String, int...) - Method in class processing.opengl.PShapeOpenGL
-
 
-
attrib(String, boolean...) - Method in class processing.opengl.PShapeOpenGL
-
 
-
autoMipmapGenSupported - Static variable in class processing.opengl.PGraphicsOpenGL
-
 
-
available() - Method in class processing.opengl.Texture
-
-
Returns true if the texture has been initialized.
-
-
AWT - Static variable in class processing.opengl.PJOGL
-
 
-
- - - -

B

-
-
B - Static variable in class processing.core.PGraphics
-
 
-
BACK - Static variable in class processing.opengl.PGL
-
 
-
background(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from background.xml ) - - The background() function sets the color used for the background - of the Processing window.
-
-
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
-
-
Takes an RGB or ARGB image and sets it as the background.
-
-
background(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from background.xml ) - - The background() function sets the color used for the background - of the Processing window.
-
-
background(int, float) - Method in class processing.core.PGraphics
-
 
-
background(float) - Method in class processing.core.PGraphics
-
 
-
background(float, float) - Method in class processing.core.PGraphics
-
 
-
background(float, float, float) - Method in class processing.core.PGraphics
-
 
-
background(float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
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.PGraphicsFX2D
-
 
-
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 class processing.core.PGraphics
-
 
-
beginCamera() - Method in class processing.core.PApplet
-
-
( begin auto-generated from beginCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
-
-
beginCamera() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from beginCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
-
-
beginCamera() - Method in class processing.opengl.PGraphics2D
-
 
-
beginCamera() - Method in class processing.opengl.PGraphicsOpenGL
-
-
Set matrix mode to the camera matrix (instead of the current transformation - matrix).
-
-
beginContour() - Method in class processing.core.PApplet
-
 
-
beginContour() - Method in class processing.core.PGraphics
-
 
-
beginContour() - Method in class processing.core.PGraphicsFX2D
-
 
-
beginContour() - Method in class processing.core.PGraphicsJava2D
-
 
-
beginContour() - Method in class processing.core.PShape
-
 
-
beginContour() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
beginDraw() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from PGraphics_beginDraw.xml ) - - Sets the default properties for a PGraphics object.
-
-
beginDraw() - Method in class processing.core.PGraphicsDanger2D
-
 
-
beginDraw() - Method in class processing.core.PGraphicsFX2D
-
 
-
beginDraw() - Method in class processing.core.PGraphicsJava2D
-
 
-
beginDraw() - 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).
-
-
beginPGL() - Method in class processing.core.PApplet
-
 
-
beginPGL() - Method in class processing.core.PGraphics
-
 
-
beginPGL() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
beginRaw(String, String) - Method in class processing.core.PApplet
-
-
( begin auto-generated from beginRaw.xml ) - - To create vectors from 3D data, use the beginRaw() and - endRaw() commands.
-
-
beginRaw(PGraphics) - Method in class processing.core.PApplet
-
 
-
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 auto-generated from beginRecord.xml ) - - Opens a new file and all subsequent drawing functions are echoed to this - file as well as the display window.
-
-
beginRecord(PGraphics) - Method in class processing.core.PApplet
-
 
-
beginShape() - Method in class processing.core.PApplet
-
-
Start a new shape of type POLYGON
-
-
beginShape(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms.
-
-
beginShape() - Method in class processing.core.PGraphics
-
-
Start a new shape of type POLYGON
-
-
beginShape(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms.
-
-
beginShape(int) - Method in class processing.core.PGraphicsFX2D
-
 
-
beginShape(int) - Method in class processing.core.PGraphicsJava2D
-
 
-
beginShape() - Method in class processing.core.PShape
-
 
-
beginShape(int) - Method in class processing.core.PShape
-
 
-
beginShape(int) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
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
-
-
( begin auto-generated from bezier.xml ) - - Draws a Bezier curve on the screen.
-
-
bezier(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.PGraphics
-
-
( begin auto-generated from bezier.xml ) - - Draws a Bezier curve on the screen.
-
-
BEZIER_VERTEX - Static variable in interface processing.core.PConstants
-
 
-
bezierDetail(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from bezierDetail.xml ) - - Sets the resolution at which Beziers display.
-
-
bezierDetail - Variable in class processing.core.PGraphics
-
 
-
bezierDetail(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from bezierDetail.xml ) - - Sets the resolution at which Beziers display.
-
-
bezierDetail(int) - Method in class processing.core.PGraphicsFX2D
-
-
Ignored (not needed) by this renderer.
-
-
bezierDetail(int) - Method in class processing.core.PGraphicsJava2D
-
-
Ignored (not needed) in Java 2D.
-
-
bezierDetail(int) - Method in class processing.core.PShape
-
 
-
bezierDetail(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
bezierPoint(float, float, float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from bezierPoint.xml ) - - Evaluates the Bezier at point t for points a, b, c, d.
-
-
bezierPoint(float, float, float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from bezierPoint.xml ) - - Evaluates the Bezier at point t for points a, b, c, d.
-
-
bezierTangent(float, float, float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from bezierTangent.xml ) - - Calculates the tangent of a point on a Bezier curve.
-
-
bezierTangent(float, float, float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from bezierTangent.xml ) - - Calculates the tangent of a point on a 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
-
-
( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves.
-
-
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
-
-
( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves.
-
-
bezierVertex(float, float, float, float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
bezierVertex(float, float, float, float, float, float, float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
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
-
 
-
bezierVertex(float, float, float, float, float, float) - Method in class processing.core.PShape
-
 
-
bezierVertex(float, float, float, float, float, float, float, float, float) - Method in class processing.core.PShape
-
 
-
bezierVertex(float, float, float, float, float, float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
bezierVertex(float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
bezierVertex(float, float, float, float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
bezierVertex(float, float, float, float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
bezierVertex(float, float, float, float, float, float, float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
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
-
-
( begin auto-generated from binary.xml ) - - Converts a byte, char, int, or color to a String containing the - equivalent binary notation.
-
-
bind() - Method in class processing.opengl.FrameBuffer
-
 
-
bind() - Method in class processing.opengl.PShader
-
-
Initializes (if needed) and binds the shader program.
-
-
bind() - Method in class processing.opengl.Texture
-
 
-
bindAttribLocation(int, int, String) - Method in class processing.opengl.PGL
-
 
-
bindAttribLocation(int, int, String) - Method in class processing.opengl.PJOGL
-
 
-
bindBuffer(int, int) - Method in class processing.opengl.PGL
-
 
-
bindBuffer(int, int) - Method in class processing.opengl.PJOGL
-
 
-
bindFramebuffer(int, int) - Method in class processing.opengl.PGL
-
 
-
bindRenderbuffer(int, int) - Method in class processing.opengl.PGL
-
 
-
bindRenderbuffer(int, int) - Method in class processing.opengl.PJOGL
-
 
-
bindTexture(int, int) - Method in class processing.opengl.PGL
-
 
-
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
-
-
( begin auto-generated from PImage_blend.xml ) - - Blends a region of pixels into the image specified by the img - parameter.
-
-
BLEND - Static variable in interface processing.core.PConstants
-
 
-
blend(int, int, int, int, int) - Method in class processing.core.PGraphicsDanger2D
-
 
-
blend(PImage, int, int, int, int, int) - Method in class processing.core.PGraphicsDanger2D
-
 
-
blend(int, int, int, int, int, int, int, int, int) - Method in class processing.core.PGraphicsDanger2D
-
 
-
blend(PImage, int, int, int, int, int, int, int, int, int) - Method in class processing.core.PGraphicsDanger2D
-
 
-
blend(int, int, int, int, int, int, int, int, int) - Method in class processing.core.PImage
-
 
-
blend(PImage, int, int, int, int, int, int, int, int, int) - Method in class processing.core.PImage
-
-
( begin auto-generated from PImage_blend.xml ) - - Blends a region of pixels into the image specified by the img - parameter.
-
-
BLEND - Static variable in class processing.opengl.PGL
-
 
-
blendColor(int, int, int) - Static method in class processing.core.PApplet
-
 
-
blendColor(int, int, int) - Static method in class processing.core.PImage
-
-
( begin auto-generated from blendColor.xml ) - - Blends two color values together based on the blending mode given as the - MODE parameter.
-
-
blendColor(float, float, float, float) - Method in class processing.opengl.PGL
-
 
-
blendColor(float, float, float, float) - Method in class processing.opengl.PJOGL
-
 
-
blendEqSupported - Static variable in class processing.opengl.PGraphicsOpenGL
-
 
-
blendEquation(int) - Method in class processing.opengl.PGL
-
 
-
blendEquation(int) - Method in class processing.opengl.PJOGL
-
 
-
blendEquationSeparate(int, int) - Method in class processing.opengl.PGL
-
 
-
blendEquationSeparate(int, int) - Method in class processing.opengl.PJOGL
-
 
-
blendFunc(int, int) - Method in class processing.opengl.PGL
-
 
-
blendFunc(int, int) - Method in class processing.opengl.PJOGL
-
 
-
blendFuncSeparate(int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
blendFuncSeparate(int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
blendMode(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from blendMode.xml ) - - This is a new reference entry for Processing 2.0.
-
-
blendMode(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from blendMode.xml ) - - This is a new reference entry for Processing 2.0.
-
-
blendMode - Variable in class processing.core.PStyle
-
 
-
blitFramebuffer(int, int, int, int, int, int, int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
blitFramebuffer(int, int, int, int, int, int, int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
blue(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from blue.xml ) - - Extracts the blue value from a color, scaled to match current - colorMode().
-
-
blue(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from blue.xml ) - - Extracts the blue value from a color, scaled to match current - colorMode().
-
-
BLUE_MASK - Static variable in class processing.core.PImage
-
 
-
BLUR - Static variable in interface processing.core.PConstants
-
 
-
BOOL - Static variable in class processing.opengl.PGL
-
 
-
BOOL_VEC2 - Static variable in class processing.opengl.PGL
-
 
-
BOOL_VEC3 - Static variable in class processing.opengl.PGL
-
 
-
BOOL_VEC4 - Static variable in class processing.opengl.PGL
-
 
-
BOTTOM - Static variable in interface processing.core.PConstants
-
-
Align text from the bottom, using the baseline.
-
-
bound() - Method in class processing.opengl.PShader
-
-
Returns true if the shader is bound, false otherwise.
-
-
bound() - Method in class processing.opengl.Texture
-
 
-
box(float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from box.xml ) - - A box is an extruded rectangle.
-
-
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
-
-
( begin auto-generated from box.xml ) - - A box is an extruded rectangle.
-
-
box(float, float, float) - Method in class processing.core.PGraphics
-
 
-
box(float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
box(float, float, float) - Method in class processing.core.PGraphicsJava2D
-
 
-
box(float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
box(float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
BREAK - Static variable in interface processing.core.PConstants
-
 
-
brightness(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from brightness.xml ) - - Extracts the brightness value from a color.
-
-
brightness(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from brightness.xml ) - - Extracts the brightness value from a color.
-
-
BUFFER_SIZE - Static variable in class processing.opengl.PGL
-
 
-
BUFFER_USAGE - Static variable in class processing.opengl.PGL
-
 
-
bufferData(int, int, Buffer, int) - Method in class processing.opengl.PGL
-
 
-
bufferData(int, int, Buffer, int) - Method in class processing.opengl.PJOGL
-
 
-
bufferSubData(int, int, int, Buffer) - Method in class processing.opengl.PGL
-
 
-
bufferSubData(int, int, int, Buffer) - Method in class processing.opengl.PJOGL
-
 
-
BURN - Static variable in interface processing.core.PConstants
-
 
-
BYTE - Static variable in class processing.opengl.PGL
-
 
-
- - - -

C

-
-
camera() - Method in class processing.core.PApplet
-
-
( begin auto-generated from camera.xml ) - - Sets the position of the camera through setting the eye position, the - center of the scene, and which axis is facing upward.
-
-
camera(float, float, float, float, float, float, float, float, float) - Method in class processing.core.PApplet
-
 
-
camera() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from camera.xml ) - - Sets the position of the camera through setting the eye position, the - center of the scene, and which axis is facing upward.
-
-
camera(float, float, float, float, float, float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
camera() - Method in class processing.opengl.PGraphics2D
-
 
-
camera(float, float, float, float, float, float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
camera - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
camera() - Method in class processing.opengl.PGraphicsOpenGL
-
-
Set camera to the default settings.
-
-
camera(float, float, float, float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
-
More flexible method for dealing with camera().
-
-
cameraAspect - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Aspect ratio of camera's view.
-
-
cameraFar - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Distance of the near and far planes.
-
-
cameraFOV - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Camera field of view.
-
-
cameraInv - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
cameraNear - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Distance of the near and far planes.
-
-
cameraX - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Default position of the camera.
-
-
cameraY - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Default position of the camera.
-
-
cameraZ - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Default position of the camera.
-
-
canDraw() - Method in class processing.core.PApplet
-
-
Not official API, not guaranteed to work in the future.
-
-
canDraw() - Method in class processing.core.PGraphics
-
-
Some renderers have requirements re: when they are ready to draw.
-
-
canDraw() - Method in class processing.core.PGraphicsFX2D
-
 
-
canDraw() - Method in class processing.core.PGraphicsJava2D
-
 
-
canvas - Variable in class processing.opengl.PJOGL
-
-
The canvas where OpenGL rendering takes place
-
-
CAP_BUTT - Static variable in class processing.opengl.LinePath
-
-
Ends unclosed subpaths and dash segments with no added decoration.
-
-
CAP_ROUND - Static variable in class processing.opengl.LinePath
-
-
Ends unclosed subpaths and dash segments with a round decoration that has a - radius equal to half of the width of the pen.
-
-
CAP_SQUARE - Static variable in class processing.opengl.LinePath
-
-
Ends unclosed subpaths and dash segments with a square projection that - extends beyond the end of the segment to a distance equal to half of the - line width.
-
-
CATEGORY - Static variable in class processing.data.Table
-
 
-
CCW - Static variable in class processing.opengl.PGL
-
 
-
ceil(float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from ceil.xml ) - - Calculates the closest int value that is greater than or equal to the - value of the parameter.
-
-
CENTER - Static variable in interface processing.core.PConstants
-
-
Draw from the center, using second pair of values as the diameter.
-
-
CHARSET - Static variable in class processing.core.PFont
-
-
The default Processing character set.
-
-
CHATTER - Static variable in interface processing.core.PConstants
-
 
-
checkColumnIndex(String) - Method in class processing.data.Table
-
-
Same as getColumnIndex(), but creates the column if it doesn't exist.
-
-
checkExtension(String) - Static method in class processing.core.PApplet
-
-
Get the compression-free extension for this filename.
-
-
checkFramebufferStatus(int) - Method in class processing.opengl.PGL
-
 
-
checkFramebufferStatus(int) - Method in class processing.opengl.PJOGL
-
 
-
checkImage() - Method in class processing.core.PGraphicsJava2D
-
 
-
CHORD - Static variable in interface processing.core.PConstants
-
 
-
CLAMP - Static variable in interface processing.core.PConstants
-
-
textures are clamped to their edges
-
-
CLAMP_TO_EDGE - Static variable in class processing.opengl.PGL
-
 
-
clear() - Method in class processing.core.PApplet
-
 
-
clear() - Method in class processing.core.PGraphics
-
 
-
clear() - Method in class processing.data.FloatDict
-
-
Remove all entries.
-
-
clear() - Method in class processing.data.FloatList
-
-
Remove all entries from the list.
-
-
clear() - Method in class processing.data.IntDict
-
-
Remove all entries.
-
-
clear() - Method in class processing.data.IntList
-
-
Remove all entries from the list.
-
-
clear() - Method in class processing.data.StringDict
-
-
Remove all entries.
-
-
clear() - Method in class processing.data.StringList
-
-
Remove all entries from the list.
-
-
clear() - Method in class processing.opengl.FrameBuffer
-
 
-
clear(int) - Method in class processing.opengl.PGL
-
 
-
clear(int) - Method in class processing.opengl.PJOGL
-
 
-
clearColor(float, float, float, float) - Method in class processing.opengl.PGL
-
 
-
clearColor(float, float, float, float) - Method in class processing.opengl.PJOGL
-
 
-
clearDepth(float) - Method in class processing.opengl.PGL
-
 
-
clearDepth(float) - Method in class processing.opengl.PJOGL
-
 
-
clearRows() - Method in class processing.data.Table
-
 
-
clearStencil(int) - Method in class processing.opengl.PGL
-
 
-
clearStencil(int) - Method in class processing.opengl.PJOGL
-
 
-
CLICK - Static variable in class processing.event.MouseEvent
-
 
-
clip(float, float, float, float) - Method in class processing.core.PApplet
-
 
-
clip(float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
clone() - Method in class processing.core.PImage
-
-
Duplicate an image, returns new PImage object.
-
-
CLOSE - Static variable in interface processing.core.PConstants
-
 
-
close() - Method in class processing.opengl.LineStroker
-
 
-
closePath() - Method in class processing.opengl.LinePath
-
-
Closes the current subpath by drawing a straight line back to the - coordinates of the last moveTo.
-
-
CODED - Static variable in interface processing.core.PConstants
-
 
-
color(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from color.xml ) - - Creates colors for storing in variables of the color datatype.
-
-
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(int, int, int, int) - Method in class processing.core.PApplet
-
 
-
color(float, float, float) - 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
-
 
-
COLOR_ATTACHMENT0 - Static variable in class processing.opengl.PGL
-
 
-
COLOR_ATTACHMENT1 - Static variable in class processing.opengl.PGL
-
 
-
COLOR_ATTACHMENT2 - Static variable in class processing.opengl.PGL
-
 
-
COLOR_ATTACHMENT3 - Static variable in class processing.opengl.PGL
-
 
-
COLOR_BUFFER_BIT - Static variable in class processing.opengl.PGL
-
 
-
colorBuffer(boolean) - Method in class processing.opengl.Texture
-
 
-
colorBuffer() - Method in class processing.opengl.Texture
-
 
-
colorMask(boolean, boolean, boolean, boolean) - Method in class processing.opengl.PGL
-
 
-
colorMask(boolean, boolean, boolean, boolean) - Method in class processing.opengl.PJOGL
-
 
-
colorMode(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from colorMode.xml ) - - Changes the way Processing interprets color data.
-
-
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
-
-
( begin auto-generated from colorMode.xml ) - - Changes the way Processing interprets color data.
-
-
colorMode(int, float) - Method in class processing.core.PGraphics
-
 
-
colorMode(int, float, float, float) - Method in class processing.core.PGraphics
-
 
-
colorMode(int, float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
colorMode - Variable in class processing.core.PShape
-
-
The current colorMode
-
-
colorMode(int) - Method in class processing.core.PShape
-
-
Set the pivot point for all transformations.
-
-
colorMode(int, float) - Method in class processing.core.PShape
-
 
-
colorMode(int, float, float, float) - Method in class processing.core.PShape
-
 
-
colorMode(int, float, float, float, float) - Method in class processing.core.PShape
-
 
-
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.PShape
-
-
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.PShape
-
-
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.PShape
-
-
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.PShape
-
-
Max value for blue (or value) set by colorMode
-
-
colorModeZ - Variable in class processing.core.PStyle
-
 
-
compare(int, int) - Method in class processing.data.Sort
-
 
-
COMPILE_STATUS - Static variable in class processing.opengl.PGL
-
 
-
compileShader(int) - Method in class processing.opengl.PGL
-
 
-
compileShader(int) - Method in class processing.opengl.PJOGL
-
 
-
COMPLAINT - Static variable in interface processing.core.PConstants
-
 
-
COMPRESSED_TEXTURE_FORMATS - Static variable in class processing.opengl.PGL
-
 
-
compressedTexImage2D(int, int, int, int, int, int, int, Buffer) - Method in class processing.opengl.PGL
-
 
-
compressedTexImage2D(int, int, int, int, int, int, int, Buffer) - Method in class processing.opengl.PJOGL
-
 
-
compressedTexSubImage2D(int, int, int, int, int, int, int, int, Buffer) - Method in class processing.opengl.PGL
-
 
-
compressedTexSubImage2D(int, int, int, int, int, int, int, int, Buffer) - Method in class processing.opengl.PJOGL
-
 
-
concat(boolean[], boolean[]) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from concat.xml ) - - Concatenates two arrays.
-
-
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
-
 
-
CONSTANT_ALPHA - Static variable in class processing.opengl.PGL
-
 
-
CONSTANT_COLOR - Static variable in class processing.opengl.PGL
-
 
-
constrain(int, int, int) - Static method in class processing.core.PApplet
-
 
-
constrain(float, float, float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from constrain.xml ) - - Constrains a value to not exceed a maximum and minimum value.
-
-
contains(float, float) - Method in class processing.core.PShape
-
 
-
contains(float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
context - Variable in class processing.opengl.PJOGL
-
-
The rendering context (holds rendering state info)
-
-
CONTROL - Static variable in interface processing.core.PConstants
-
 
-
copy() - Method in class processing.core.PApplet
-
 
-
copy(int, int, int, int, int, int, int, int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another.
-
-
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.PGraphicsDanger2D
-
 
-
copy(PImage, int, int, int, int, int, int, int, int) - Method in class processing.core.PGraphicsDanger2D
-
 
-
copy(int, int, int, int, int, int, int, int) - Method in class processing.core.PGraphicsJava2D
-
 
-
copy(PImage, int, int, int, int, int, int, int, int) - Method in class processing.core.PGraphicsJava2D
-
 
-
copy() - Method in class processing.core.PImage
-
 
-
copy(int, int, int, int, int, int, int, int) - Method in class processing.core.PImage
-
-
( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another.
-
-
copy(PImage, int, int, int, int, int, int, int, int) - Method in class processing.core.PImage
-
 
-
copy() - Method in class processing.core.PVector
-
 
-
copy() - Method in class processing.data.FloatDict
-
-
Returns a duplicate copy of this object.
-
-
copy() - Method in class processing.data.FloatList
-
 
-
copy() - Method in class processing.data.IntDict
-
-
Returns a duplicate copy of this object.
-
-
copy() - Method in class processing.data.IntList
-
 
-
copy() - Method in class processing.data.StringDict
-
-
Returns a duplicate copy of this object.
-
-
copy() - Method in class processing.data.StringList
-
 
-
copy() - Method in class processing.data.Table
-
-
Make a copy of the current table
-
-
copy(FrameBuffer, int) - Method in class processing.opengl.FrameBuffer
-
 
-
copy(int, int, int, int, int, int, int, int) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
copy(PImage, int, int, int, int, int, int, int, int) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
copyBufferFromSource(Object, ByteBuffer, int, int) - Method in class processing.opengl.Texture
-
 
-
copyColor(FrameBuffer) - Method in class processing.opengl.FrameBuffer
-
 
-
copyDepth(FrameBuffer) - Method in class processing.opengl.FrameBuffer
-
 
-
copyGroup2D(PGraphicsOpenGL, PShape, PShape) - Static method in class processing.opengl.PShapeOpenGL
-
 
-
copyGroup3D(PGraphicsOpenGL, PShape, PShape) - Static method in class processing.opengl.PShapeOpenGL
-
 
-
copyOf(float[], int) - Static method in class processing.opengl.LinePath
-
 
-
copyOf(byte[], int) - Static method in class processing.opengl.LinePath
-
 
-
copyOf(int[], int) - Static method in class processing.opengl.LinePath
-
 
-
copyStencil(FrameBuffer) - Method in class processing.opengl.FrameBuffer
-
 
-
copyTexImage2D(int, int, int, int, int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
copyTexImage2D(int, int, int, int, int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
copyTexSubImage2D(int, int, int, int, int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
copyTexSubImage2D(int, int, int, int, int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
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
-
-
( begin auto-generated from cos.xml ) - - Calculates the cosine of an angle.
-
-
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
-
-
( begin auto-generated from createFont.xml ) - - Dynamically converts a font to the format used by Processing from either - a font name that's installed on the computer, or from a .ttf or .otf - file inside the sketches "data" folder.
-
-
createGraphics(int, int) - Method in class processing.core.PApplet
-
 
-
createGraphics(int, int, String) - Method in class processing.core.PApplet
-
-
( begin auto-generated from createGraphics.xml ) - - Creates and returns a new PGraphics object of the types P2D or - P3D.
-
-
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
-
-
( begin auto-generated from createImage.xml ) - - Creates a new PImage (the datatype for storing images).
-
-
createInput(String) - Method in class processing.core.PApplet
-
-
( begin auto-generated from createInput.xml ) - - This is a function for advanced programmers 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
-
-
( begin auto-generated from createOutput.xml ) - - Similar to createInput(), 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
-
 
-
createProgram() - Method in class processing.opengl.PGL
-
 
-
createProgram() - Method in class processing.opengl.PJOGL
-
 
-
createReader(String) - Method in class processing.core.PApplet
-
-
( begin auto-generated from createReader.xml ) - - Creates a BufferedReader object that can be used to read files - line-by-line as individual String objects.
-
-
createReader(File) - Static method in class processing.core.PApplet
-
 
-
createReader(InputStream) - Static method in class processing.core.PApplet
-
 
-
createShader(int) - Method in class processing.opengl.PGL
-
 
-
createShader(int) - Method in class processing.opengl.PJOGL
-
 
-
createShape() - Method in class processing.core.PApplet
-
 
-
createShape(int) - Method in class processing.core.PApplet
-
 
-
createShape(int, float...) - Method in class processing.core.PApplet
-
 
-
createShape() - Method in class processing.core.PGraphics
-
 
-
createShape(int) - Method in class processing.core.PGraphics
-
 
-
createShape(int, float...) - Method in class processing.core.PGraphics
-
 
-
createShape2D(PGraphicsOpenGL, PShape) - Static method in class processing.opengl.PShapeOpenGL
-
 
-
createShape3D(PGraphicsOpenGL, PShape) - Static method in class processing.opengl.PShapeOpenGL
-
 
-
createStrokedPath(LinePath, float, int, int) - Static method in class processing.opengl.LinePath
-
 
-
createStrokedPath(LinePath, float, int, int, float) - Static method in class processing.opengl.LinePath
-
 
-
createStrokedPath(LinePath, float, int, int, float, PMatrix2D) - Static method in class processing.opengl.LinePath
-
-
Constructs a solid LinePath with the specified attributes.
-
-
createSurface() - Method in class processing.core.PGraphics
-
 
-
createSurface() - Method in class processing.core.PGraphicsDanger2D
-
 
-
createSurface() - Method in class processing.core.PGraphicsFX2D
-
 
-
createSurface() - Method in class processing.core.PGraphicsJava2D
-
 
-
createSurface() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
createThread() - Method in class processing.core.PSurfaceAWT
-
 
-
createThread() - Method in class processing.core.PSurfaceDanger
-
 
-
createThread() - Method in class processing.core.PSurfaceNone
-
 
-
createWriter(String) - Method in class processing.core.PApplet
-
-
( begin auto-generated from createWriter.xml ) - - Creates a new file in the sketch folder, and a PrintWriter object - to write to it.
-
-
createWriter(File) - Static method in class processing.core.PApplet
-
 
-
createWriter(OutputStream) - Static method in class processing.core.PApplet
-
 
-
CROSS - Static variable in interface processing.core.PConstants
-
 
-
cross(PVector) - Method in class processing.core.PVector
-
-
( begin auto-generated from PVector_cross.xml ) - - Calculates and returns a vector composed of the cross product between - two vectors.
-
-
cross(PVector, PVector) - Method in class processing.core.PVector
-
 
-
cross(PVector, PVector, PVector) - Static method in class processing.core.PVector
-
 
-
CTRL - Static variable in class processing.event.Event
-
 
-
CULL_FACE - Static variable in class processing.opengl.PGL
-
 
-
cullFace(int) - Method in class processing.opengl.PGL
-
 
-
cullFace(int) - Method in class processing.opengl.PJOGL
-
 
-
CURRENT_VERTEX_ATTRIB - Static variable in class processing.opengl.PGL
-
 
-
currentLightFalloffConstant - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Current light falloff
-
-
currentLightFalloffLinear - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
currentLightFalloffQuadratic - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
currentLightSpecular - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Current specular color for lighting
-
-
currentSampling() - Method in class processing.opengl.Texture
-
 
-
currentSegment(float[]) - Method in class processing.opengl.LinePath.PathIterator
-
 
-
currentSegment(double[]) - Method in class processing.opengl.LinePath.PathIterator
-
 
-
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
-
-
( begin auto-generated from cursor.xml ) - - Sets the cursor to a predefined symbol, an image, or makes it visible if - already hidden.
-
-
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
-
-
( begin auto-generated from curve.xml ) - - Draws a curved line on the screen.
-
-
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
-
-
( begin auto-generated from curve.xml ) - - Draws a curved line on the screen.
-
-
curve(float, float, float, float, float, float, float, float, float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
CURVE_VERTEX - Static variable in interface processing.core.PConstants
-
 
-
curveDetail(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from curveDetail.xml ) - - Sets the resolution at which curves display.
-
-
curveDetail - Variable in class processing.core.PGraphics
-
 
-
curveDetail(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from curveDetail.xml ) - - Sets the resolution at which curves display.
-
-
curveDetail(int) - Method in class processing.core.PGraphicsFX2D
-
-
Ignored (not needed) by this renderer.
-
-
curveDetail(int) - Method in class processing.core.PGraphicsJava2D
-
-
Ignored (not needed) in Java 2D.
-
-
curveDetail(int) - Method in class processing.core.PShape
-
 
-
curveDetail(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
curvePoint(float, float, float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from curvePoint.xml ) - - Evalutes the curve at point t for points a, b, c, d.
-
-
curvePoint(float, float, float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from curvePoint.xml ) - - Evalutes the curve at point t for points a, b, c, d.
-
-
curveTangent(float, float, float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from curveTangent.xml ) - - Calculates the tangent of a point on a curve.
-
-
curveTangent(float, float, float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from curveTangent.xml ) - - Calculates the tangent of a point on a curve.
-
-
curveTightness(float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from curveTightness.xml ) - - Modifies the quality of forms created with curve() and - curveVertex().
-
-
curveTightness - Variable in class processing.core.PGraphics
-
 
-
curveTightness(float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from curveTightness.xml ) - - Modifies the quality of forms created with curve() and - curveVertex().
-
-
curveTightness(float) - Method in class processing.core.PShape
-
 
-
curveTightness(float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
curveVertex(float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from curveVertex.xml ) - - Specifies vertex coordinates for curves.
-
-
curveVertex(float, float, float) - Method in class processing.core.PApplet
-
 
-
curveVertex(float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from curveVertex.xml ) - - Specifies vertex coordinates for curves.
-
-
curveVertex(float, float, float) - Method in class processing.core.PGraphics
-
 
-
curveVertex(float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
curveVertex(float, float, float) - Method in class processing.core.PGraphicsJava2D
-
 
-
curveVertex(float, float) - Method in class processing.core.PShape
-
 
-
curveVertex(float, float, float) - Method in class processing.core.PShape
-
 
-
curveVertex(float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
curveVertex(float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
curveVertex(float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
curveVertex(float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
curveVertex(float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
CUSTOM - Static variable in interface processing.core.PConstants
-
 
-
CW - Static variable in class processing.opengl.PGL
-
 
-
- - - -

D

-
-
DA - Static variable in class processing.core.PGraphics
-
 
-
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
-
-
( begin auto-generated from day.xml ) - - Processing communicates with the clock on your computer.
-
-
DB - Static variable in class processing.core.PGraphics
-
 
-
debug(String) - Static method in class processing.core.PApplet
-
 
-
DECR - Static variable in class processing.opengl.PGL
-
 
-
DECR_WRAP - Static variable in class processing.opengl.PGL
-
 
-
DEFAULT_HEIGHT - Static variable in class processing.core.PApplet
-
 
-
DEFAULT_VERTICES - Static variable in class processing.core.PGraphics
-
 
-
DEFAULT_WIDTH - Static variable in class processing.core.PApplet
-
-
Default width and height for sketch 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
-
-
( begin auto-generated from degrees.xml ) - - Converts a radian measurement to its corresponding value in degrees.
-
-
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
-
 
-
DELETE_STATUS - Static variable in class processing.opengl.PGL
-
 
-
deleteBuffers(int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
deleteBuffers(int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
deleteFramebuffers(int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
deleteFramebuffers(int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
deleteProgram(int) - Method in class processing.opengl.PGL
-
 
-
deleteProgram(int) - Method in class processing.opengl.PJOGL
-
 
-
deleteRenderbuffers(int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
deleteRenderbuffers(int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
deleteShader(int) - Method in class processing.opengl.PGL
-
 
-
deleteShader(int) - Method in class processing.opengl.PJOGL
-
 
-
deleteTextures(int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
deleteTextures(int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
depth - Variable in class processing.core.PShape
-
 
-
DEPTH24_STENCIL8 - Static variable in class processing.opengl.PGL
-
 
-
DEPTH_ATTACHMENT - Static variable in class processing.opengl.PGL
-
 
-
DEPTH_BITS - Static variable in class processing.opengl.PGL
-
 
-
DEPTH_BUFFER_BIT - Static variable in class processing.opengl.PGL
-
 
-
DEPTH_COMPONENT - Static variable in class processing.opengl.PGL
-
 
-
DEPTH_COMPONENT16 - Static variable in class processing.opengl.PGL
-
 
-
DEPTH_COMPONENT24 - Static variable in class processing.opengl.PGL
-
 
-
DEPTH_COMPONENT32 - Static variable in class processing.opengl.PGL
-
 
-
DEPTH_STENCIL - Static variable in class processing.opengl.PGL
-
 
-
DEPTH_TEST - Static variable in class processing.opengl.PGL
-
 
-
DEPTH_WRITEMASK - Static variable in class processing.opengl.PGL
-
 
-
depthBits - Static variable in class processing.opengl.PGraphicsOpenGL
-
 
-
depthFunc(int) - Method in class processing.opengl.PGL
-
 
-
depthFunc(int) - Method in class processing.opengl.PJOGL
-
 
-
depthMask(boolean) - Method in class processing.opengl.PGL
-
 
-
depthMask(boolean) - Method in class processing.opengl.PJOGL
-
 
-
depthRangef(float, float) - Method in class processing.opengl.PGL
-
 
-
depthRangef(float, float) - Method in class processing.opengl.PJOGL
-
 
-
descent() - Method in class processing.core.PFont
-
-
Returns how far this font descends from the baseline.
-
-
desktopFile(String) - Static method in class processing.core.PApplet
-
-
Not a supported function.
-
-
desktopPath(String) - Static method in class processing.core.PApplet
-
-
Not a supported function.
-
-
detachShader(int, int) - Method in class processing.opengl.PGL
-
 
-
detachShader(int, int) - Method in class processing.opengl.PJOGL
-
 
-
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 class processing.core.PGraphics
-
 
-
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
-
 
-
DIRECTION - Static variable in class processing.opengl.PShapeOpenGL
-
 
-
DIRECTIONAL - Static variable in interface processing.core.PConstants
-
 
-
directionalLight(float, float, float, float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from directionalLight.xml ) - - Adds a directional light.
-
-
directionalLight(float, float, float, float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from directionalLight.xml ) - - Adds a directional light.
-
-
directionalLight(float, float, float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
directionalLight(float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
disable(int) - Method in class processing.opengl.PGL
-
 
-
disable(int) - Method in class processing.opengl.PJOGL
-
 
-
DISABLE_DEPTH_MASK - 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_NATIVE_FONTS - Static variable in interface processing.core.PConstants
-
-
Deprecated.
-
-
DISABLE_OPENGL_ERRORS - Static variable in interface processing.core.PConstants
-
 
-
DISABLE_OPTIMIZED_STROKE - Static variable in interface processing.core.PConstants
-
 
-
DISABLE_STROKE_PERSPECTIVE - Static variable in interface processing.core.PConstants
-
 
-
DISABLE_STROKE_PURE - Static variable in interface processing.core.PConstants
-
 
-
DISABLE_TEXTURE_MIPMAPS - Static variable in interface processing.core.PConstants
-
 
-
disableDepthTest() - Method in class processing.opengl.FrameBuffer
-
 
-
disableStyle() - Method in class processing.core.PShape
-
-
( begin auto-generated from PShape_disableStyle.xml ) - - Disables the shape's style data and uses Processing's current styles.
-
-
disableStyle() - Method in class processing.opengl.PShapeOpenGL
-
 
-
disableVertexAttribArray(int) - Method in class processing.opengl.PGL
-
 
-
disableVertexAttribArray(int) - Method in class processing.opengl.PJOGL
-
 
-
displayable() - Method in class processing.core.PGraphics
-
-
Return true if this renderer should be drawn to the screen.
-
-
displayDensity() - Method in class processing.core.PApplet
-
 
-
displayDensity(int) - Static method in class processing.core.PApplet
-
 
-
displayHeight - Variable in class processing.core.PApplet
-
-
( begin auto-generated from displayHeight.xml ) - - System variable that stores the height of the computer screen.
-
-
displayWidth - Variable in class processing.core.PApplet
-
-
( begin auto-generated from displayWidth.xml ) - - System variable which stores the width of the computer screen.
-
-
dispose() - Method in class processing.core.PApplet
-
-
Called to dispose of resources and shut down the sketch.
-
-
dispose() - Method in class processing.core.PGraphics
-
-
Handle any takedown for this graphics context.
-
-
dispose() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
disposeSourceBuffer() - Method in class processing.opengl.Texture
-
 
-
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
-
-
( begin auto-generated from dist.xml ) - - Calculates the distance between two points.
-
-
dist(PVector) - Method in class processing.core.PVector
-
-
( begin auto-generated from PVector_dist.xml ) - - Calculates the Euclidean distance between two points (considering a - point as a vector object).
-
-
dist(PVector, PVector) - Static method in class processing.core.PVector
-
 
-
DITHER - Static variable in class processing.opengl.PGL
-
 
-
div(float) - Method in class processing.core.PVector
-
-
( begin auto-generated from PVector_div.xml ) - - Divides a vector by a scalar or divides one vector by another.
-
-
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
-
-
Divide a vector by a scalar and store the result in another vector.
-
-
div(String, float) - Method in class processing.data.FloatDict
-
 
-
div(int, float) - Method in class processing.data.FloatList
-
 
-
div(String, int) - Method in class processing.data.IntDict
-
 
-
div(int, int) - Method in class processing.data.IntList
-
 
-
DODGE - Static variable in interface processing.core.PConstants
-
 
-
DONT_CARE - Static variable in class processing.opengl.PGL
-
 
-
dot(PVector) - Method in class processing.core.PVector
-
-
( begin auto-generated from PVector_dot.xml ) - - Calculates the dot product of two vectors.
-
-
dot(float, float, float) - Method in class processing.core.PVector
-
 
-
dot(PVector, PVector) - Static method in class processing.core.PVector
-
 
-
DOUBLE - Static variable in class processing.data.Table
-
 
-
DOWN - Static variable in interface processing.core.PConstants
-
 
-
DR - Static variable in class processing.core.PGraphics
-
 
-
DRAG - Static variable in class processing.event.MouseEvent
-
 
-
draw() - Method in class processing.core.PApplet
-
-
( begin auto-generated from draw.xml ) - - Called directly after setup() and continuously executes the lines - of code contained inside its block until the program is stopped or - noLoop() is called.
-
-
draw(PGraphics) - Method in class processing.core.PShape
-
-
Called by the following (the shape() command adds the g) - PShape s = loadShape("blah.svg"); - shape(s);
-
-
draw() - Method in class processing.opengl.PShapeOpenGL
-
 
-
draw(PGraphics) - Method in class processing.opengl.PShapeOpenGL
-
 
-
DRAW_FRAMEBUFFER - Static variable in class processing.opengl.PGL
-
 
-
drawArrays(int, int, int) - Method in class processing.opengl.PGL
-
 
-
drawArrays(int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
drawBuffer(int) - Method in class processing.opengl.PGL
-
 
-
drawBuffer(int) - Method in class processing.opengl.PJOGL
-
 
-
drawChar(PGraphics, char, float, float, float) - Method in class processing.core.PShapeSVG.Font
-
 
-
drawElements(int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
drawElements(int, int, int, Buffer) - Method in class processing.opengl.PGL
-
 
-
drawElements(int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
drawElements(int, int, int, Buffer) - Method in class processing.opengl.PJOGL
-
 
-
drawString(PGraphics, String, float, float, float) - Method in class processing.core.PShapeSVG.Font
-
 
-
drawTexture(int, int, int, int, int, int, int, int) - Method in class processing.opengl.PGL
-
-
Not an approved function, this will change or be removed in the future.
-
-
drawTexture(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) - Method in class processing.opengl.PGL
-
-
Not an approved function, this will change or be removed in the future.
-
-
DST_ALPHA - Static variable in class processing.opengl.PGL
-
 
-
DST_COLOR - Static variable in class processing.opengl.PGL
-
 
-
DXF - Static variable in interface processing.core.PConstants
-
 
-
DYNAMIC_DRAW - Static variable in class processing.opengl.PGL
-
 
-
- - - -

E

-
-
E2D - Static variable in interface processing.core.PConstants
-
 
-
EB - Static variable in class processing.core.PGraphics
-
 
-
edge(boolean) - Method in class processing.core.PApplet
-
-
Sets whether the upcoming vertex is part of an edge.
-
-
EDGE - Static variable in class processing.core.PGraphics
-
 
-
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 class processing.core.PGraphics
-
 
-
ELEMENT_ARRAY_BUFFER - Static variable in class processing.opengl.PGL
-
 
-
ellipse(float, float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from ellipse.xml ) - - Draws an ellipse (oval) in the display window.
-
-
ELLIPSE - Static variable in interface processing.core.PConstants
-
 
-
ellipse(float, float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from ellipse.xml ) - - Draws an ellipse (oval) in the display window.
-
-
ellipseImpl(float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
ellipseMode(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from ellipseMode.xml ) - - The origin of the ellipse is modified by the ellipseMode() - function.
-
-
ellipseMode - Variable in class processing.core.PGraphics
-
-
The current ellipse mode (read-only)
-
-
ellipseMode(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from ellipseMode.xml ) - - The origin of the ellipse is modified by the ellipseMode() - function.
-
-
ellipseMode - Variable in class processing.core.PStyle
-
 
-
emissive(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from emissive.xml ) - - Sets the emissive color of the material used for drawing shapes drawn to - the screen.
-
-
emissive(float) - Method in class processing.core.PApplet
-
-
gray number specifying value between white and black
-
-
emissive(float, float, float) - Method in class processing.core.PApplet
-
 
-
emissive(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from emissive.xml ) - - Sets the emissive color of the material used for drawing shapes drawn to - the screen.
-
-
emissive(float) - Method in class processing.core.PGraphics
-
-
gray number specifying value between white and black
-
-
emissive(float, float, float) - Method in class processing.core.PGraphics
-
 
-
emissive(int) - Method in class processing.core.PShape
-
 
-
emissive(float) - Method in class processing.core.PShape
-
 
-
emissive(float, float, float) - Method in class processing.core.PShape
-
 
-
emissiveB - Variable in class processing.core.PGraphics
-
 
-
emissiveB - Variable in class processing.core.PStyle
-
 
-
emissiveColor - Variable in class processing.core.PGraphics
-
 
-
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(int) - Method in class processing.opengl.PGL
-
 
-
enable(int) - Method in class processing.opengl.PJOGL
-
 
-
ENABLE_DEPTH_MASK - 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
-
-
Deprecated.
-
-
ENABLE_OPENGL_ERRORS - Static variable in interface processing.core.PConstants
-
 
-
ENABLE_OPTIMIZED_STROKE - Static variable in interface processing.core.PConstants
-
 
-
ENABLE_STROKE_PERSPECTIVE - Static variable in interface processing.core.PConstants
-
 
-
ENABLE_STROKE_PURE - Static variable in interface processing.core.PConstants
-
 
-
ENABLE_TEXTURE_MIPMAPS - Static variable in interface processing.core.PConstants
-
 
-
enableStyle() - Method in class processing.core.PShape
-
-
( begin auto-generated from PShape_enableStyle.xml ) - - Enables the shape's style data and ignores Processing's current styles.
-
-
enableStyle() - Method in class processing.opengl.PShapeOpenGL
-
 
-
enableVertexAttribArray(int) - Method in class processing.opengl.PGL
-
 
-
enableVertexAttribArray(int) - Method in class processing.opengl.PJOGL
-
 
-
end() - Method in class processing.opengl.LineStroker
-
 
-
endCamera() - Method in class processing.core.PApplet
-
-
( begin auto-generated from endCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
-
-
endCamera() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from endCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
-
-
endCamera() - Method in class processing.opengl.PGraphics2D
-
 
-
endCamera() - Method in class processing.opengl.PGraphicsOpenGL
-
-
Record the current settings into the camera matrix, and set the matrix mode - back to the current transformation matrix.
-
-
endContour() - Method in class processing.core.PApplet
-
 
-
endContour() - Method in class processing.core.PGraphics
-
 
-
endContour() - Method in class processing.core.PGraphicsFX2D
-
 
-
endContour() - Method in class processing.core.PGraphicsJava2D
-
 
-
endContour() - Method in class processing.core.PShape
-
 
-
endContour() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
endDraw() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from PGraphics_endDraw.xml ) - - Finalizes the rendering of a PGraphics object so that it can be shown on screen.
-
-
endDraw() - Method in class processing.core.PGraphicsFX2D
-
 
-
endDraw() - Method in class processing.core.PGraphicsJava2D
-
 
-
endDraw() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
endPGL() - Method in class processing.core.PApplet
-
 
-
endPGL() - Method in class processing.core.PGraphics
-
 
-
endPGL() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
endRaw() - Method in class processing.core.PApplet
-
-
( begin auto-generated from endRaw.xml ) - - Complement to beginRaw(); they must always be used together.
-
-
endRaw() - Method in class processing.core.PGraphics
-
 
-
endRaw() - Method in class processing.core.PGraphicsJava2D
-
 
-
endRecord() - Method in class processing.core.PApplet
-
-
( begin auto-generated from endRecord.xml ) - - Stops the recording process started by beginRecord() and closes - the file.
-
-
endShape() - Method in class processing.core.PApplet
-
 
-
endShape(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape().
-
-
endShape() - Method in class processing.core.PGraphics
-
 
-
endShape(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape().
-
-
endShape(int) - Method in class processing.core.PGraphicsFX2D
-
 
-
endShape(int) - Method in class processing.core.PGraphicsJava2D
-
 
-
endShape() - Method in class processing.core.PShape
-
 
-
endShape(int) - Method in class processing.core.PShape
-
 
-
endShape(int) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
endShape(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
ENTER - Static variable in interface processing.core.PConstants
-
 
-
ENTER - Static variable in class processing.event.MouseEvent
-
 
-
EPSILON - Static variable in interface processing.core.PConstants
-
 
-
EQUAL - Static variable in class processing.opengl.PGL
-
 
-
equals(Object) - Method in class processing.core.PVector
-
 
-
ER - Static variable in class processing.core.PGraphics
-
 
-
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
-
 
-
errorString(int) - Method in class processing.opengl.PGL
-
 
-
errorString(int) - Method in class processing.opengl.PJOGL
-
 
-
ESC - Static variable in interface processing.core.PConstants
-
 
-
Event - Class in processing.event
-
 
-
Event(Object, long, int, int) - Constructor for class processing.event.Event
-
 
-
EXCLUSION - Static variable in interface processing.core.PConstants
-
 
-
exec(String...) - Static method in class processing.core.PApplet
-
 
-
exit() - Method in class processing.core.PApplet
-
-
( begin auto-generated from exit.xml ) - - Quits/stops/exits the program.
-
-
EXIT - Static variable in class processing.event.MouseEvent
-
 
-
exitActual() - Method in class processing.core.PApplet
-
-
Some subclasses (I'm looking at you, processing.py) might wish to do something - other than actually terminate the JVM.
-
-
exitCalled() - Method in class processing.core.PApplet
-
 
-
exp(float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from exp.xml ) - - Returns Euler's number e (2.71828...) raised to the power of the - value parameter.
-
-
expand(boolean[]) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from expand.xml ) - - Increases the size of an array.
-
-
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(long[]) - Static method in class processing.core.PApplet
-
 
-
expand(long[], 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(double[]) - Static method in class processing.core.PApplet
-
 
-
expand(double[], 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
-
 
-
extensionOptions(boolean, String, String) - Static method in class processing.data.Table
-
 
-
EXTENSIONS - Static variable in class processing.opengl.PGL
-
 
-
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 sketch when it quits.
-
-
- - - -

F

-
-
face - Variable in class processing.core.PShapeSVG.Font
-
 
-
FALSE - Static variable in class processing.opengl.PGL
-
 
-
FASTEST - Static variable in class processing.opengl.PGL
-
 
-
fboMultisampleSupported - Static variable in class processing.opengl.PGraphicsOpenGL
-
 
-
fill(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from fill.xml ) - - Sets the color used to fill shapes.
-
-
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
-
-
( begin auto-generated from fill.xml ) - - Sets the color used to fill shapes.
-
-
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(int) - Method in class processing.core.PShape
-
 
-
fill(int, float) - Method in class processing.core.PShape
-
 
-
fill(float) - Method in class processing.core.PShape
-
 
-
fill(float, float) - Method in class processing.core.PShape
-
 
-
fill(float, float, float) - Method in class processing.core.PShape
-
 
-
fill(float, float, float, float) - Method in class processing.core.PShape
-
 
-
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(PShader) - Method in class processing.core.PApplet
-
 
-
filter(int) - Method in class processing.core.PApplet
-
 
-
filter(int, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from PImage_filter.xml ) - - Filters an image as defined by one of the following modes:

THRESHOLD - converts the image to black and white pixels depending if - they are above or below the threshold defined by the level parameter.
-
-
filter(PShader) - Method in class processing.core.PGraphics
-
 
-
filter(int) - Method in class processing.core.PGraphicsDanger2D
-
 
-
filter(int, float) - Method in class processing.core.PGraphicsDanger2D
-
 
-
filter(int) - Method in class processing.core.PImage
-
 
-
filter(int, float) - Method in class processing.core.PImage
-
-
( begin auto-generated from PImage_filter.xml ) - - Filters an image as defined by one of the following modes:

THRESHOLD - converts the image to black and white pixels depending if - they are above or below the threshold defined by the level parameter.
-
-
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(PShader) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
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 eldest grandparent, so that children can be found anywhere.
-
-
findFont(String) - Static method in class processing.core.PFont
-
-
Starting with Java 1.5, Apple broke the ability to specify most fonts.
-
-
findNative() - Method in class processing.core.PFont
-
-
Attempt to find the native version of this font.
-
-
findRow(String, int) - Method in class processing.data.Table
-
 
-
findRow(String, String) - Method in class processing.data.Table
-
 
-
findRowIndex(String, int) - Method in class processing.data.Table
-
-
Return the row that contains the first String that matches.
-
-
findRowIndex(String, String) - Method in class processing.data.Table
-
-
Return the row that contains the first String that matches.
-
-
findRowIndices(String, int) - Method in class processing.data.Table
-
-
Return a list of rows that contain the String passed in.
-
-
findRowIndices(String, String) - Method in class processing.data.Table
-
-
Return a list of rows that contain the String passed in.
-
-
findRowIterator(String, int) - Method in class processing.data.Table
-
 
-
findRowIterator(String, String) - Method in class processing.data.Table
-
 
-
findRows(String, int) - Method in class processing.data.Table
-
 
-
findRows(String, String) - Method in class processing.data.Table
-
 
-
finish() - Method in class processing.opengl.FrameBuffer
-
 
-
finish() - Method in class processing.opengl.PGL
-
 
-
finish() - Method in class processing.opengl.PJOGL
-
 
-
finished - Variable in class processing.core.PApplet
-
-
true if the sketch has stopped permanently.
-
-
firstMouse - Variable in class processing.core.PApplet
-
-
Deprecated. -
Please refrain from using this variable, it will be removed - from future releases of Processing because it cannot be used consistently - across platforms and input methods.
-
-
-
FLOAT - Static variable in class processing.data.Table
-
 
-
FLOAT - Static variable in class processing.opengl.PGL
-
 
-
FLOAT_MAT2 - Static variable in class processing.opengl.PGL
-
 
-
FLOAT_MAT3 - Static variable in class processing.opengl.PGL
-
 
-
FLOAT_MAT4 - Static variable in class processing.opengl.PGL
-
 
-
FLOAT_VEC2 - Static variable in class processing.opengl.PGL
-
 
-
FLOAT_VEC3 - Static variable in class processing.opengl.PGL
-
 
-
FLOAT_VEC4 - Static variable in class processing.opengl.PGL
-
 
-
FloatDict - Class in processing.data
-
-
A simple table class to use a String as a lookup for an float value.
-
-
FloatDict() - Constructor for class processing.data.FloatDict
-
 
-
FloatDict(int) - Constructor for class processing.data.FloatDict
-
-
Create a new lookup with a specific size.
-
-
FloatDict(BufferedReader) - Constructor for class processing.data.FloatDict
-
-
Read a set of entries from a Reader that has each key/value pair on - a single line, separated by a tab.
-
-
FloatDict(Object[][]) - Constructor for class processing.data.FloatDict
-
-
Constructor to allow (more intuitive) inline initialization, e.g.:
-
-
FloatDict(String[], float[]) - Constructor for class processing.data.FloatDict
-
 
-
FloatList - Class in processing.data
-
-
Helper class for a list of floats.
-
-
FloatList() - Constructor for class processing.data.FloatList
-
 
-
FloatList(int) - Constructor for class processing.data.FloatList
-
 
-
FloatList(float[]) - Constructor for class processing.data.FloatList
-
 
-
FloatList(Iterable<Object>) - Constructor for class processing.data.FloatList
-
-
Construct an FloatList from an iterable pile of objects.
-
-
FloatList(Object...) - Constructor for class processing.data.FloatList
-
-
Construct an FloatList from a random pile of objects.
-
-
floor(float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from floor.xml ) - - Calculates the closest int value that is less than or equal to the value - of the parameter.
-
-
flush() - Method in class processing.core.PApplet
-
 
-
flush() - Method in class processing.core.PGraphics
-
 
-
flush() - Method in class processing.opengl.PGL
-
 
-
flush() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
flush() - Method in class processing.opengl.PJOGL
-
 
-
focused - Variable in class processing.core.PApplet
-
-
( begin auto-generated from focused.xml ) - - Confirms if a Processing program is "focused", meaning that it is active - and will accept input from mouse or keyboard.
-
-
focusGained() - Method in class processing.core.PApplet
-
 
-
focusLost() - Method in class processing.core.PApplet
-
 
-
Font(PShapeSVG, XML) - Constructor for class processing.core.PShapeSVG.Font
-
 
-
FontGlyph(PShapeSVG, XML, PShapeSVG.Font) - Constructor for class processing.core.PShapeSVG.FontGlyph
-
 
-
format - Variable in class processing.core.PImage
-
-
Format for this image, one of RGB, ARGB or ALPHA.
-
-
format(int) - Method in class processing.data.JSONArray
-
-
Make a pretty-printed JSON text of this JSONArray.
-
-
format(int) - Method in class processing.data.JSONObject
-
-
Make a prettyprinted JSON text of this JSONObject.
-
-
format(int) - Method in class processing.data.XML
-
-
Format this XML data as a String.
-
-
format - Variable in class processing.opengl.Texture.Parameters
-
-
Texture internal format.
-
-
FRAGMENT_SHADER - Static variable in class processing.opengl.PGL
-
 
-
frame - Variable in class processing.core.PApplet
-
-
The frame containing this sketch (if any)
-
-
FrameBuffer - Class in processing.opengl
-
-
Encapsulates a Frame Buffer Object for offscreen rendering.
-
-
FRAMEBUFFER - Static variable in class processing.opengl.PGL
-
 
-
FRAMEBUFFER_ATTACHMENT_OBJECT_NAME - Static variable in class processing.opengl.PGL
-
 
-
FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE - Static variable in class processing.opengl.PGL
-
 
-
FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE - Static variable in class processing.opengl.PGL
-
 
-
FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL - Static variable in class processing.opengl.PGL
-
 
-
FRAMEBUFFER_COMPLETE - Static variable in class processing.opengl.PGL
-
 
-
FRAMEBUFFER_ERROR - Static variable in class processing.opengl.PGL
-
 
-
FRAMEBUFFER_INCOMPLETE_ATTACHMENT - Static variable in class processing.opengl.PGL
-
 
-
FRAMEBUFFER_INCOMPLETE_DIMENSIONS - Static variable in class processing.opengl.PGL
-
 
-
FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER - Static variable in class processing.opengl.PGL
-
 
-
FRAMEBUFFER_INCOMPLETE_FORMATS - Static variable in class processing.opengl.PGL
-
 
-
FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT - Static variable in class processing.opengl.PGL
-
 
-
FRAMEBUFFER_INCOMPLETE_READ_BUFFER - Static variable in class processing.opengl.PGL
-
 
-
FRAMEBUFFER_UNSUPPORTED - Static variable in class processing.opengl.PGL
-
 
-
framebufferRenderbuffer(int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
framebufferRenderbuffer(int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
framebufferTexture2D(int, int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
framebufferTexture2D(int, int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
frameCount - Variable in class processing.core.PApplet
-
-
( begin auto-generated from frameCount.xml ) - - The system variable frameCount contains the number of frames - displayed since the program started.
-
-
frameRate - Variable in class processing.core.PApplet
-
-
( begin auto-generated from frameRate_var.xml ) - - The system variable frameRate contains the approximate frame rate - of the software as it executes.
-
-
frameRate(float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from frameRate.xml ) - - Specifies the number of frames to be displayed every second.
-
-
fromAngle(float) - Static method in class processing.core.PVector
-
-
( begin auto-generated from PVector_sub.xml ) - - Make a new 2D unit vector from an angle.
-
-
fromAngle(float, PVector) - Static method in class processing.core.PVector
-
-
Make a new 2D unit vector from an angle
-
-
fromRange(int) - Static method in class processing.data.IntList
-
 
-
fromRange(int, int) - Static method in class processing.data.IntList
-
 
-
FRONT - Static variable in class processing.opengl.PGL
-
 
-
FRONT_AND_BACK - Static variable in class processing.opengl.PGL
-
 
-
frontFace(int) - Method in class processing.opengl.PGL
-
 
-
frontFace(int) - Method in class processing.opengl.PJOGL
-
 
-
frustum(float, float, float, float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from frustum.xml ) - - Sets a perspective matrix defined through the parameters.
-
-
frustum(float, float, float, float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from frustum.xml ) - - Sets a perspective matrix defined through the parameters.
-
-
frustum(float, float, float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
frustum(float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Same as glFrustum(), except that it wipes out (rather than multiplies - against) the current perspective matrix.
-
-
fullScreen() - Method in class processing.core.PApplet
-
-
Create a full-screen sketch using the default renderer.
-
-
fullScreen(int) - Method in class processing.core.PApplet
-
 
-
fullScreen(String) - Method in class processing.core.PApplet
-
-
( begin auto-generated from fullScreen.xml ) - - Description to come...
-
-
fullScreen(String, int) - Method in class processing.core.PApplet
-
 
-
FUNC_ADD - Static variable in class processing.opengl.PGL
-
 
-
FUNC_MAX - Static variable in class processing.opengl.PGL
-
 
-
FUNC_MIN - Static variable in class processing.opengl.PGL
-
 
-
FUNC_REVERSE_SUBTRACT - Static variable in class processing.opengl.PGL
-
 
-
FUNC_SUBTRACT - Static variable in class processing.opengl.PGL
-
 
-
FX2D - Static variable in interface processing.core.PConstants
-
 
-
- - - -

G

-
-
g - Variable in class processing.core.PApplet
-
-
The PGraphics renderer associated with this PApplet
-
-
G - Static variable in class processing.core.PGraphics
-
 
-
g2 - Variable in class processing.core.PGraphicsJava2D
-
 
-
genBuffers(int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
genBuffers(int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
GENERATE_MIPMAP_HINT - Static variable in class processing.opengl.PGL
-
 
-
generateMipmap(int) - Method in class processing.opengl.PGL
-
 
-
generateMipmap(int) - Method in class processing.opengl.PJOGL
-
 
-
genFramebuffers(int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
genFramebuffers(int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
genRenderbuffers(int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
genRenderbuffers(int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
genTextures(int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
genTextures(int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
GEOMETRY - Static variable in class processing.core.PShape
-
-
Collections of vertices created with beginShape().
-
-
GEQUAL - Static variable in class processing.opengl.PGL
-
 
-
get(int, int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image.
-
-
get(int, int, int, int) - Method in class processing.core.PApplet
-
 
-
get() - Method in class processing.core.PApplet
-
-
Returns a copy of this PImage.
-
-
get(int, int) - Method in class processing.core.PGraphicsDanger2D
-
 
-
get(int, int, int, int) - Method in class processing.core.PGraphicsDanger2D
-
 
-
get() - Method in class processing.core.PGraphicsDanger2D
-
 
-
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
-
-
( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image.
-
-
get(int, int, int, int) - Method in class processing.core.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
-
-
Deprecated.
-
-
get(float[]) - Method in class processing.core.PVector
-
 
-
get(String) - Method in class processing.data.FloatDict
-
-
Return a value for the specified key.
-
-
get(String, float) - Method in class processing.data.FloatDict
-
 
-
get(int) - Method in class processing.data.FloatList
-
-
Get an entry at a particular index.
-
-
get(String) - Method in class processing.data.IntDict
-
-
Return a value for the specified key.
-
-
get(String, int) - Method in class processing.data.IntDict
-
 
-
get(int) - Method in class processing.data.IntList
-
-
Get an entry at a particular index.
-
-
get(String) - Method in class processing.data.StringDict
-
-
Return a value for the specified key.
-
-
get(String, String) - Method in class processing.data.StringDict
-
 
-
get(int) - Method in class processing.data.StringList
-
-
Get an entry at a particular index.
-
-
get(int, int) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
get(int[]) - Method in class processing.opengl.Texture
-
-
Copy texture to pixels.
-
-
getAction() - Method in class processing.event.Event
-
 
-
getActiveAttrib(int, int, IntBuffer, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
getActiveAttrib(int, int, IntBuffer, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getActiveUniform(int, int, IntBuffer, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
getActiveUniform(int, int, IntBuffer, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getAmbient(int) - Method in class processing.core.PShape
-
 
-
getAmbient(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getAmount() - Method in class processing.event.MouseEvent
-
-
Deprecated.
-
-
getAttachedShaders(int, int, IntBuffer, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
getAttachedShaders(int, int, IntBuffer, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getAttribLocation(int, String) - Method in class processing.opengl.PGL
-
 
-
getAttribLocation(int, String) - Method in class processing.opengl.PJOGL
-
 
-
getAttributeCount() - Method in class processing.data.XML
-
-
Returns the number of attributes.
-
-
getBoolean(int) - Method in class processing.data.JSONArray
-
-
Get the boolean value associated with an index.
-
-
getBoolean(int, boolean) - Method in class processing.data.JSONArray
-
-
Get the optional boolean value associated with an index.
-
-
getBoolean(String) - Method in class processing.data.JSONObject
-
-
Get the boolean value associated with a key.
-
-
getBoolean(String, boolean) - Method in class processing.data.JSONObject
-
-
Get an optional boolean associated with a key.
-
-
getBooleanArray() - Method in class processing.data.JSONArray
-
-
Get this entire array as a boolean array.
-
-
getBooleanv(int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
getBooleanv(int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getBufferParameteriv(int, int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
getBufferParameteriv(int, int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getBufferPixels(int[]) - Method in class processing.opengl.Texture
-
 
-
getButton() - Method in class processing.event.MouseEvent
-
-
Which button was pressed, either LEFT, CENTER, or RIGHT.
-
-
getCache(PImage) - Method in class processing.core.PGraphics
-
-
Get cache storage data for the specified renderer.
-
-
getCache(PImage) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
getChild(int) - Method in class processing.core.PShape
-
-
( begin auto-generated from PShape_getChild.xml ) - - Extracts a child shape from a parent shape.
-
-
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.data.XML
-
-
Quick accessor for an element at a particular index.
-
-
getChild(String) - Method in class processing.data.XML
-
-
Get a child by its name or path.
-
-
getChildCount() - Method in class processing.core.PShape
-
 
-
getChildCount() - Method in class processing.data.XML
-
-
Returns the number of children.
-
-
getChildIndex(PShape) - Method in class processing.core.PShape
-
-
Returns the index of child who.
-
-
getChildren() - Method in class processing.core.PShape
-
 
-
getChildren() - Method in class processing.data.XML
-
-
Returns an array containing all the child elements.
-
-
getChildren(String) - Method in class processing.data.XML
-
-
Get any children that match this name or path.
-
-
getClickCount() - Method in class processing.event.MouseEvent
-
-
Deprecated.
-
-
getColumnCount() - Method in class processing.data.Table
-
 
-
getColumnCount() - Method in interface processing.data.TableRow
-
 
-
getColumnIndex(String) - Method in class processing.data.Table
-
 
-
getColumnTitle(int) - Method in class processing.data.Table
-
 
-
getColumnTitle(int) - Method in interface processing.data.TableRow
-
 
-
getColumnTitles() - Method in class processing.data.Table
-
 
-
getColumnTitles() - Method in interface processing.data.TableRow
-
 
-
getColumnType(String) - Method in class processing.data.Table
-
 
-
getColumnType(int) - Method in class processing.data.Table
-
-
Returns one of Table.STRING, Table.INT, etc...
-
-
getColumnType(String) - Method in interface processing.data.TableRow
-
 
-
getColumnType(int) - Method in interface processing.data.TableRow
-
 
-
getColumnTypes() - Method in class processing.data.Table
-
 
-
getColumnTypes() - Method in interface processing.data.TableRow
-
 
-
getComponent() - Method in class processing.opengl.PSurfaceJOGL
-
 
-
getContent() - Method in class processing.data.XML
-
-
Return the #PCDATA content of the element.
-
-
getContent(String) - Method in class processing.data.XML
-
 
-
getCount() - Method in class processing.event.MouseEvent
-
-
Number of clicks for mouse button events, or the number of steps (positive - or negative depending on direction) for a mouse wheel event.
-
-
getDefaultDrawBuffer() - Method in class processing.opengl.FrameBuffer
-
 
-
getDefaultReadBuffer() - Method in class processing.opengl.FrameBuffer
-
 
-
getDepth() - Method in class processing.core.PShape
-
-
Get the depth of the shape area (not necessarily the shape boundary).
-
-
getDepth() - Method in class processing.opengl.PShapeOpenGL
-
 
-
getDouble(int) - Method in class processing.data.JSONArray
-
-
Get the double value associated with an index.
-
-
getDouble(int, double) - Method in class processing.data.JSONArray
-
-
Get the optional double value associated with an index.
-
-
getDouble(String) - Method in class processing.data.JSONObject
-
-
Get the double value associated with a key.
-
-
getDouble(String, double) - Method in class processing.data.JSONObject
-
-
Get an optional double associated with a key, or the - defaultValue if there is no such key or if its value is not a number.
-
-
getDouble(int, int) - Method in class processing.data.Table
-
 
-
getDouble(int, String) - Method in class processing.data.Table
-
 
-
getDouble(int) - Method in interface processing.data.TableRow
-
 
-
getDouble(String) - Method in interface processing.data.TableRow
-
 
-
getDouble(String) - Method in class processing.data.XML
-
 
-
getDouble(String, double) - Method in class processing.data.XML
-
-
Returns the value of an attribute.
-
-
getDoubleArray() - Method in class processing.data.JSONArray
-
-
Get this entire array as a double array.
-
-
getDoubleColumn(String) - Method in class processing.data.Table
-
 
-
getDoubleColumn(int) - Method in class processing.data.Table
-
 
-
getDoubleContent() - Method in class processing.data.XML
-
 
-
getDoubleContent(double) - Method in class processing.data.XML
-
 
-
getDoubleRow(int) - Method in class processing.data.Table
-
 
-
getEmissive(int) - Method in class processing.core.PShape
-
 
-
getEmissive(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getError() - Method in class processing.opengl.PGL
-
 
-
getError() - Method in class processing.opengl.PJOGL
-
 
-
getExtension(String) - Static method in class processing.core.PApplet
-
 
-
getFamily() - Method in class processing.core.PShape
-
-
The shape type, one of GROUP, PRIMITIVE, PATH, or GEOMETRY.
-
-
getFill(int) - Method in class processing.core.PShape
-
 
-
getFill(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getFlavor() - Method in class processing.event.Event
-
 
-
getFloat(int) - Method in class processing.data.JSONArray
-
-
Get a value from an index as a float.
-
-
getFloat(int, float) - Method in class processing.data.JSONArray
-
 
-
getFloat(String) - Method in class processing.data.JSONObject
-
 
-
getFloat(String, float) - Method in class processing.data.JSONObject
-
 
-
getFloat(int, int) - Method in class processing.data.Table
-
-
Get a float value from the specified row and column.
-
-
getFloat(int, String) - Method in class processing.data.Table
-
 
-
getFloat(int) - Method in interface processing.data.TableRow
-
 
-
getFloat(String) - Method in interface processing.data.TableRow
-
 
-
getFloat(String) - Method in class processing.data.XML
-
-
Returns the value of an attribute, or zero if not present.
-
-
getFloat(String, float) - Method in class processing.data.XML
-
-
Returns the value of an attribute.
-
-
getFloatArray() - Method in class processing.data.JSONArray
-
-
Get this entire array as a float array.
-
-
getFloatColumn(String) - Method in class processing.data.Table
-
 
-
getFloatColumn(int) - Method in class processing.data.Table
-
 
-
getFloatContent() - Method in class processing.data.XML
-
 
-
getFloatContent(float) - Method in class processing.data.XML
-
 
-
getFloatDict(String, String) - Method in class processing.data.Table
-
 
-
getFloatDict(int, int) - Method in class processing.data.Table
-
 
-
getFloatList(String) - Method in class processing.data.Table
-
 
-
getFloatList(int) - Method in class processing.data.Table
-
 
-
getFloatRow(int) - Method in class processing.data.Table
-
 
-
getFloatv(int, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
getFloatv(int, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getFont() - Method in class processing.core.PFont
-
-
Deprecated.
-
-
getFontMetrics(Font) - Method in class processing.core.PGraphics
-
-
Convenience method to get a legit FontMetrics object.
-
-
getFontMetrics(Font) - Method in class processing.core.PGraphicsJava2D
-
 
-
getFontRenderContext(Font) - Method in class processing.core.PGraphics
-
-
Convenience method to jump through some Java2D hoops and get an FRC.
-
-
getFrame() - Method in class processing.core.PApplet
-
 
-
getFrameBuffer() - Method in class processing.opengl.PGraphicsOpenGL
-
-
Not an approved function, test its use in libraries to grab the FB objects - for offscreen PGraphics.
-
-
getFrameBuffer(boolean) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
getFramebufferAttachmentParameteriv(int, int, int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
getFramebufferAttachmentParameteriv(int, int, int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getGlyph(char) - Method in class processing.core.PFont
-
 
-
getGlyph(int) - Method in class processing.core.PFont
-
 
-
getGlyphCount() - Method in class processing.core.PFont
-
 
-
getGraphics() - Method in class processing.core.PApplet
-
 
-
getHeight() - Method in class processing.core.PShape
-
-
Get the height of the drawing area (not necessarily the shape boundary).
-
-
getHeight() - Method in class processing.opengl.PShapeOpenGL
-
 
-
getImage() - Method in class processing.core.PImage
-
-
Deprecated.
-
-
getInt(int) - Method in class processing.data.JSONArray
-
-
Get the int value associated with an index.
-
-
getInt(int, int) - Method in class processing.data.JSONArray
-
-
Get the optional int value associated with an index.
-
-
getInt(String) - Method in class processing.data.JSONObject
-
-
Gets the int value associated with a key
-
-
getInt(String, int) - Method in class processing.data.JSONObject
-
-
Get an optional int value associated with a key, - or the default if there is no such key or if the value is not a number.
-
-
getInt(int, int) - Method in class processing.data.Table
-
 
-
getInt(int, String) - Method in class processing.data.Table
-
 
-
getInt(int) - Method in interface processing.data.TableRow
-
 
-
getInt(String) - Method in interface processing.data.TableRow
-
 
-
getInt(String) - Method in class processing.data.XML
-
 
-
getInt(String, int) - Method in class processing.data.XML
-
-
Returns the value of an attribute.
-
-
getIntArray() - Method in class processing.data.JSONArray
-
-
Get this entire array as an int array.
-
-
getIntColumn(String) - Method in class processing.data.Table
-
 
-
getIntColumn(int) - Method in class processing.data.Table
-
 
-
getIntContent() - Method in class processing.data.XML
-
 
-
getIntContent(int) - Method in class processing.data.XML
-
 
-
getIntDict(String, String) - Method in class processing.data.Table
-
 
-
getIntDict(int, int) - Method in class processing.data.Table
-
 
-
getIntegerv(int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
getIntegerv(int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getIntList(String) - Method in class processing.data.Table
-
 
-
getIntList(int) - Method in class processing.data.Table
-
 
-
getIntRow(int) - Method in class processing.data.Table
-
 
-
getJSONArray(int) - Method in class processing.data.JSONArray
-
-
Get the JSONArray associated with an index.
-
-
getJSONArray(int, JSONArray) - Method in class processing.data.JSONArray
-
 
-
getJSONArray(String) - Method in class processing.data.JSONObject
-
-
Get the JSONArray value associated with a key.
-
-
getJSONObject(int) - Method in class processing.data.JSONArray
-
-
Get the JSONObject associated with an index.
-
-
getJSONObject(int, JSONObject) - Method in class processing.data.JSONArray
-
 
-
getJSONObject(String) - Method in class processing.data.JSONObject
-
-
Get the JSONObject value associated with a key.
-
-
getKey() - Method in class processing.event.KeyEvent
-
 
-
getKeyCode() - Method in class processing.event.KeyEvent
-
 
-
getKind() - Method in class processing.core.PShape
-
 
-
getLocalName() - Method in class processing.data.XML
-
-
Returns the name of the element (without namespace prefix).
-
-
getLong(int) - Method in class processing.data.JSONArray
-
-
Get the long value associated with an index.
-
-
getLong(int, long) - Method in class processing.data.JSONArray
-
-
Get the optional long value associated with an index.
-
-
getLong(String) - Method in class processing.data.JSONObject
-
-
Get the long value associated with a key.
-
-
getLong(String, long) - Method in class processing.data.JSONObject
-
-
Get an optional long value associated with a key, - or the default if there is no such key or if the value is not a number.
-
-
getLong(int, int) - Method in class processing.data.Table
-
 
-
getLong(int, String) - Method in class processing.data.Table
-
 
-
getLong(int) - Method in interface processing.data.TableRow
-
 
-
getLong(String) - Method in interface processing.data.TableRow
-
 
-
getLong(String, long) - Method in class processing.data.XML
-
-
Returns the value of an attribute.
-
-
getLongArray() - Method in class processing.data.JSONArray
-
-
Get this entire array as a long array.
-
-
getLongColumn(String) - Method in class processing.data.Table
-
 
-
getLongColumn(int) - Method in class processing.data.Table
-
 
-
getLongContent() - Method in class processing.data.XML
-
 
-
getLongContent(long) - Method in class processing.data.XML
-
 
-
getLongRow(int) - Method in class processing.data.Table
-
 
-
getMatrix() - Method in class processing.core.PApplet
-
 
-
getMatrix(PMatrix2D) - Method in class processing.core.PApplet
-
-
Copy the current transformation matrix into the specified target.
-
-
getMatrix(PMatrix3D) - Method in class processing.core.PApplet
-
-
Copy the current transformation matrix into the specified target.
-
-
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.PGraphicsFX2D
-
 
-
getMatrix(PMatrix2D) - Method in class processing.core.PGraphicsFX2D
-
 
-
getMatrix(PMatrix3D) - Method in class processing.core.PGraphicsFX2D
-
 
-
getMatrix() - Method in class processing.core.PGraphicsJava2D
-
 
-
getMatrix(PMatrix2D) - Method in class processing.core.PGraphicsJava2D
-
 
-
getMatrix(PMatrix3D) - Method in class processing.core.PGraphicsJava2D
-
 
-
getMatrix(PMatrix3D) - Method in class processing.opengl.PGraphics2D
-
 
-
getMatrix() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
getMatrix(PMatrix3D) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
getMillis() - Method in class processing.event.Event
-
 
-
getModifiedX1() - Method in class processing.core.PImage
-
 
-
getModifiedX1() - Method in class processing.opengl.Texture
-
 
-
getModifiedX2() - Method in class processing.core.PImage
-
 
-
getModifiedX2() - Method in class processing.opengl.Texture
-
 
-
getModifiedY1() - Method in class processing.core.PImage
-
 
-
getModifiedY1() - Method in class processing.opengl.Texture
-
 
-
getModifiedY2() - Method in class processing.core.PImage
-
 
-
getModifiedY2() - Method in class processing.opengl.Texture
-
 
-
getModifiers() - Method in class processing.event.Event
-
 
-
getName() - Method in class processing.core.PFont
-
 
-
getName() - Method in class processing.core.PShape
-
 
-
getName() - Method in class processing.data.XML
-
-
Returns the full name (i.e.
-
-
getNative() - Method in class processing.core.PFont
-
-
Return the native java.awt.Font associated with this PFont (if any).
-
-
getNative() - Method in class processing.core.PImage
-
-
Returns a native BufferedImage from this PImage.
-
-
getNative() - Method in class processing.event.Event
-
-
Get the platform-native event object.
-
-
getNormal(int) - Method in class processing.core.PShape
-
 
-
getNormal(int, PVector) - Method in class processing.core.PShape
-
 
-
getNormal(int, PVector) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getNormalX(int) - Method in class processing.core.PShape
-
 
-
getNormalX(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getNormalY(int) - Method in class processing.core.PShape
-
 
-
getNormalY(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getNormalZ(int) - Method in class processing.core.PShape
-
 
-
getNormalZ(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getOrder() - Method in class processing.data.StringList
-
-
Create a dictionary associating each entry in this list to its index.
-
-
getOrder(String) - Method in class processing.data.Table
-
 
-
getOrder(int) - Method in class processing.data.Table
-
 
-
getParam(int) - Method in class processing.core.PShape
-
 
-
getParameters() - Method in class processing.opengl.Texture
-
 
-
getParams() - Method in class processing.core.PShape
-
 
-
getParams(float[]) - Method in class processing.core.PShape
-
 
-
getParent() - Method in class processing.core.PShape
-
 
-
getParent() - Method in class processing.data.XML
-
-
Returns the parent element.
-
-
getPathIterator() - Method in class processing.opengl.LinePath
-
-
The iterator for this class is not multi-threaded safe, which means that - the LinePath class does not guarantee that modifications to the - geometry of this LinePath object do not affect any iterations of that - geometry that are already in process.
-
-
getPercent() - Method in class processing.data.FloatDict
-
-
Sum all of the values in this dictionary, then return a new FloatDict of - each key, divided by the total sum.
-
-
getPercent() - Method in class processing.data.FloatList
-
-
Returns a normalized version of this array.
-
-
getPercent() - Method in class processing.data.IntDict
-
-
Sum all of the values in this dictionary, then return a new FloatDict of - each key, divided by the total sum.
-
-
getPercent() - Method in class processing.data.IntList
-
-
Returns a normalized version of this array.
-
-
getPixelBuffer() - Method in class processing.opengl.FrameBuffer
-
 
-
getPixels(int[]) - Method in class processing.opengl.FrameBuffer
-
 
-
getPixelScale() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
getPixelScale() - Method in class processing.opengl.PSurfaceJOGL
-
 
-
getPostScriptName() - Method in class processing.core.PFont
-
 
-
getProgramInfoLog(int) - Method in class processing.opengl.PGL
-
 
-
getProgramInfoLog(int) - Method in class processing.opengl.PJOGL
-
 
-
getProgramiv(int, int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
getProgramiv(int, int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getRaw() - Method in class processing.core.PGraphics
-
 
-
getRenderbufferParameteriv(int, int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
getRenderbufferParameteriv(int, int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getRow(int) - Method in class processing.data.Table
-
 
-
getRowCount() - Method in class processing.data.Table
-
 
-
getShaderInfoLog(int) - Method in class processing.opengl.PGL
-
 
-
getShaderInfoLog(int) - Method in class processing.opengl.PJOGL
-
 
-
getShaderiv(int, int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
getShaderiv(int, int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getShaderPrecisionFormat(int, int, IntBuffer, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
getShaderPrecisionFormat(int, int, IntBuffer, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getShaderSource(int) - Method in class processing.opengl.PGL
-
 
-
getShaderSource(int) - Method in class processing.opengl.PJOGL
-
 
-
getShape(char) - Method in class processing.core.PFont
-
 
-
getShape(char, float) - Method in class processing.core.PFont
-
 
-
getShininess(int) - Method in class processing.core.PShape
-
 
-
getShininess(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getSize() - Method in class processing.core.PFont
-
-
Return size of this font.
-
-
getSpecular(int) - Method in class processing.core.PShape
-
 
-
getSpecular(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getString(int) - Method in class processing.data.JSONArray
-
-
Get the string associated with an index.
-
-
getString(int, String) - Method in class processing.data.JSONArray
-
-
Get the optional string associated with an index.
-
-
getString(String) - Method in class processing.data.JSONObject
-
-
Gets the String associated with a key
-
-
getString(String, String) - Method in class processing.data.JSONObject
-
-
Get an optional string associated with a key.
-
-
getString(int, int) - Method in class processing.data.Table
-
-
Get a String value from the table.
-
-
getString(int, String) - Method in class processing.data.Table
-
 
-
getString(int) - Method in interface processing.data.TableRow
-
 
-
getString(String) - Method in interface processing.data.TableRow
-
 
-
getString(String) - Method in class processing.data.XML
-
 
-
getString(String, String) - Method in class processing.data.XML
-
 
-
getString(int) - Method in class processing.opengl.PGL
-
 
-
getString(int) - Method in class processing.opengl.PJOGL
-
 
-
getStringArray() - Method in class processing.data.JSONArray
-
-
Get this entire array as a String array.
-
-
getStringColumn(String) - Method in class processing.data.Table
-
 
-
getStringColumn(int) - Method in class processing.data.Table
-
 
-
getStringDict(String, String) - Method in class processing.data.Table
-
 
-
getStringDict(int, int) - Method in class processing.data.Table
-
 
-
getStringList(String) - Method in class processing.data.Table
-
 
-
getStringList(int) - Method in class processing.data.Table
-
 
-
getStringRow(int) - Method in class processing.data.Table
-
 
-
getStroke(int) - Method in class processing.core.PShape
-
 
-
getStroke(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getStrokeWeight(int) - Method in class processing.core.PShape
-
 
-
getStrokeWeight(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getStyle() - Method in class processing.core.PGraphics
-
 
-
getStyle(PStyle) - Method in class processing.core.PGraphics
-
 
-
getSubset(int) - Method in class processing.data.FloatList
-
 
-
getSubset(int, int) - Method in class processing.data.FloatList
-
 
-
getSubset(int) - Method in class processing.data.IntList
-
 
-
getSubset(int, int) - Method in class processing.data.IntList
-
 
-
getSubset(int) - Method in class processing.data.StringList
-
 
-
getSubset(int, int) - Method in class processing.data.StringList
-
 
-
getTally() - Method in class processing.data.StringList
-
-
Count the number of times each String entry is found in this list.
-
-
getTally(String) - Method in class processing.data.Table
-
 
-
getTally(int) - Method in class processing.data.Table
-
 
-
getTessellation() - Method in class processing.core.PShape
-
 
-
getTessellation() - Method in class processing.opengl.PShapeOpenGL
-
 
-
getTessellation(int, int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getTexParameterfv(int, int, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
getTexParameterfv(int, int, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getTexParameteriv(int, int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
getTexParameteriv(int, int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getTexture() - Method in class processing.opengl.PGraphicsOpenGL
-
-
Not an approved function, this will change or be removed in the future.
-
-
getTexture(boolean) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Not an approved function either, don't use it.
-
-
getTexture(PImage) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Not an approved function, this will change or be removed in the future.
-
-
getTextureU(int) - Method in class processing.core.PShape
-
 
-
getTextureU(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getTextureV(int) - Method in class processing.core.PShape
-
 
-
getTextureV(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getTint(int) - Method in class processing.core.PShape
-
 
-
getTint(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getUniformfv(int, int, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
getUniformfv(int, int, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getUniformiv(int, int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
getUniformiv(int, int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getUniformLocation(int, String) - Method in class processing.opengl.PGL
-
 
-
getUniformLocation(int, String) - Method in class processing.opengl.PJOGL
-
 
-
getUnique() - Method in class processing.data.StringList
-
-
Get a list of all unique entries.
-
-
getUnique(String) - Method in class processing.data.Table
-
 
-
getUnique(int) - Method in class processing.data.Table
-
 
-
getVertex(int) - Method in class processing.core.PShape
-
 
-
getVertex(int, PVector) - Method in class processing.core.PShape
-
 
-
getVertex(int, PVector) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getVertexAttribfv(int, int, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
getVertexAttribfv(int, int, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getVertexAttribiv(int, int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
getVertexAttribiv(int, int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getVertexAttribPointerv(int, int, ByteBuffer) - Method in class processing.opengl.PGL
-
 
-
getVertexAttribPointerv(int, int, ByteBuffer) - Method in class processing.opengl.PJOGL
-
 
-
getVertexCode(int) - Method in class processing.core.PShape
-
-
One of VERTEX, BEZIER_VERTEX, CURVE_VERTEX, or BREAK.
-
-
getVertexCode(int) - Method in class processing.opengl.PShapeOpenGL
-
-
One of VERTEX, BEZIER_VERTEX, CURVE_VERTEX, or BREAK.
-
-
getVertexCodeCount() - Method in class processing.core.PShape
-
 
-
getVertexCodeCount() - Method in class processing.opengl.PShapeOpenGL
-
 
-
getVertexCodes() - Method in class processing.core.PShape
-
 
-
getVertexCodes() - Method in class processing.opengl.PShapeOpenGL
-
 
-
getVertexCount() - Method in class processing.core.PShape
-
 
-
getVertexCount() - Method in class processing.opengl.PShapeOpenGL
-
 
-
getVertexX(int) - Method in class processing.core.PShape
-
 
-
getVertexX(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getVertexY(int) - Method in class processing.core.PShape
-
 
-
getVertexY(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getVertexZ(int) - Method in class processing.core.PShape
-
 
-
getVertexZ(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
getWidth() - Method in class processing.core.PShape
-
-
Get the width of the drawing area (not necessarily the shape boundary).
-
-
getWidth() - Method in class processing.opengl.PShapeOpenGL
-
 
-
getWindingRule() - Method in class processing.opengl.LinePath
-
-
Returns the fill style winding rule.
-
-
getWindingRule() - Method in class processing.opengl.LinePath.PathIterator
-
 
-
getX() - Method in class processing.event.MouseEvent
-
 
-
getY() - Method in class processing.event.MouseEvent
-
 
-
GIF - Static variable in interface processing.core.PConstants
-
 
-
gl - Variable in class processing.opengl.PJOGL
-
-
Basic GL functionality, common to all profiles
-
-
glDepth - Variable in class processing.opengl.FrameBuffer
-
 
-
glDepthStencil - Variable in class processing.opengl.FrameBuffer
-
 
-
glFbo - Variable in class processing.opengl.FrameBuffer
-
 
-
glFormat - Variable in class processing.opengl.Texture
-
 
-
glFragment - Variable in class processing.opengl.PShader
-
 
-
glHeight - Variable in class processing.opengl.Texture
-
 
-
glLineAttrib - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glLineAttrib - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glLineColor - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glLineColor - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glLineIndex - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glLineIndex - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glLineVertex - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glLineVertex - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glMagFilter - Variable in class processing.opengl.Texture
-
 
-
glMinFilter - Variable in class processing.opengl.Texture
-
 
-
glMultisample - Variable in class processing.opengl.FrameBuffer
-
 
-
glName - Variable in class processing.opengl.Texture
-
 
-
glPointAttrib - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glPointAttrib - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glPointColor - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glPointColor - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glPointIndex - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glPointIndex - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glPointVertex - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glPointVertex - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glPolyAmbient - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glPolyAmbient - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glPolyColor - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glPolyColor - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glPolyEmissive - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glPolyEmissive - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glPolyIndex - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glPolyIndex - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glPolyNormal - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glPolyNormal - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glPolyShininess - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glPolyShininess - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glPolySpecular - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glPolySpecular - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glPolyTexcoord - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glPolyTexcoord - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glPolyVertex - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glPolyVertex - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glProgram - Variable in class processing.opengl.PShader
-
 
-
GLSL_VERSION - Static variable in class processing.opengl.PGraphicsOpenGL
-
 
-
glStencil - Variable in class processing.opengl.FrameBuffer
-
 
-
glTarget - Variable in class processing.opengl.Texture
-
 
-
glu - Variable in class processing.opengl.PJOGL
-
-
GLU interface
-
-
glUsage - Variable in class processing.opengl.PShapeOpenGL
-
 
-
glVertex - Variable in class processing.opengl.PShader
-
 
-
glWidth - Variable in class processing.opengl.Texture
-
 
-
glWrapS - Variable in class processing.opengl.Texture
-
 
-
glWrapT - Variable in class processing.opengl.Texture
-
 
-
Glyph() - Constructor for class processing.core.PFont.Glyph
-
 
-
Glyph(DataInputStream) - Constructor for class processing.core.PFont.Glyph
-
 
-
glyphCount - Variable in class processing.core.PShapeSVG.Font
-
 
-
glyphs - Variable in class processing.core.PShapeSVG.Font
-
 
-
GRAY - Static variable in interface processing.core.PConstants
-
 
-
GREATER - Static variable in class processing.opengl.PGL
-
 
-
green(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from green.xml ) - - Extracts the green value from a color, scaled to match current - colorMode().
-
-
green(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from green.xml ) - - Extracts the green value from a color, scaled to match current - colorMode().
-
-
GREEN_MASK - Static variable in class processing.core.PImage
-
 
-
GROUP - Static variable in interface processing.core.PConstants
-
 
-
- - - -

H

-
-
HALF_PI - Static variable in interface processing.core.PConstants
-
-
( begin auto-generated from HALF_PI.xml ) - - HALF_PI is a mathematical constant with the value - 1.57079632679489661923.
-
-
HAND - Static variable in interface processing.core.PConstants
-
 
-
handleDraw() - Method in class processing.core.PApplet
-
 
-
HARD_LIGHT - Static variable in interface processing.core.PConstants
-
 
-
HAS_NORMAL - Static variable in class processing.core.PGraphics
-
 
-
hasAttribute(String) - Method in class processing.data.XML
-
-
Returns whether an attribute exists.
-
-
hasBuffers() - Method in class processing.opengl.Texture
-
 
-
hasBufferSource() - Method in class processing.opengl.Texture
-
 
-
hasChildren() - Method in class processing.data.XML
-
-
Returns a boolean of whether or not there are children.
-
-
hasColumnTitles() - Method in class processing.data.Table
-
 
-
hasDepthBuffer() - Method in class processing.opengl.FrameBuffer
-
 
-
hashCode() - Method in class processing.core.PVector
-
 
-
hasKey(String) - Method in class processing.data.FloatDict
-
 
-
hasKey(String) - Method in class processing.data.IntDict
-
 
-
hasKey(String) - Method in class processing.data.JSONObject
-
-
Determine if the JSONObject contains a specific key.
-
-
hasKey(String) - Method in class processing.data.StringDict
-
 
-
hasStencilBuffer() - Method in class processing.opengl.FrameBuffer
-
 
-
hasValue(float) - Method in class processing.data.FloatList
-
 
-
hasValue(int) - Method in class processing.data.IntList
-
 
-
hasValue(String) - Method in class processing.data.StringList
-
 
-
haveRaw() - Method in class processing.core.PGraphics
-
 
-
heading() - Method in class processing.core.PVector
-
-
( begin auto-generated from PVector_setMag.xml ) - - Calculate the angle of rotation for this vector (only 2D vectors) - - ( end auto-generated )
-
-
heading2D() - Method in class processing.core.PVector
-
-
Deprecated.
-
-
height - Variable in class processing.core.PApplet
-
-
( begin auto-generated from height.xml ) - - System variable which stores the height of the display window.
-
-
height - Variable in class processing.core.PFont.Glyph
-
 
-
height - Variable in class processing.core.PImage
-
-
( begin auto-generated from PImage_height.xml ) - - The height of the image in units of pixels.
-
-
height - Variable in class processing.core.PShape
-
-
( begin auto-generated from PShape_height.xml ) - - The height of the PShape document.
-
-
height - Variable in class processing.opengl.FrameBuffer
-
 
-
height - Variable in class processing.opengl.Texture
-
 
-
hex(byte) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from hex.xml ) - - Converts a byte, char, int, or color to a String containing the - equivalent hexadecimal notation.
-
-
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
-
 
-
hideCursor() - Method in interface processing.core.PSurface
-
 
-
hideCursor() - Method in class processing.core.PSurfaceAWT
-
 
-
hideCursor() - Method in class processing.core.PSurfaceFX
-
 
-
hideCursor() - Method in class processing.core.PSurfaceNone
-
 
-
hideCursor() - Method in class processing.opengl.PSurfaceJOGL
-
 
-
hideMenuBar() - Static method in class processing.core.PApplet
-
-
Convenience method, should only be called by PSurface subclasses.
-
-
HIGH_FLOAT - Static variable in class processing.opengl.PGL
-
 
-
HIGH_INT - Static variable in class processing.opengl.PGL
-
 
-
hint(int) - Method in class processing.core.PApplet
-
 
-
hint(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from hint.xml ) - - Set various hints and hacks for the renderer.
-
-
hint(int) - Method in class processing.core.PGraphicsJava2D
-
 
-
hint(int, int) - Method in class processing.opengl.PGL
-
 
-
hint(int) - Method in class processing.opengl.PGraphics2D
-
 
-
hint(int) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
hint(int, int) - Method in class processing.opengl.PJOGL
-
 
-
HINT_COUNT - Static variable in interface processing.core.PConstants
-
 
-
hour() - Static method in class processing.core.PApplet
-
-
( begin auto-generated from hour.xml ) - - Processing communicates with the clock on your computer.
-
-
HSB - Static variable in interface processing.core.PConstants
-
 
-
hue(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from hue.xml ) - - Extracts the hue value from a color.
-
-
hue(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from hue.xml ) - - Extracts the hue value from a color.
-
-
hypot(double, double) - Static method in class processing.opengl.LinePath
-
 
-
hypot(int, int) - Static method in class processing.opengl.LinePath
-
 
-
hypot(long, long) - Static method in class processing.opengl.LinePath
-
 
-
- - - -

I

-
-
image(PImage, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from image.xml ) - - Displays images to the screen.
-
-
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
-
-
Draw an image(), also specifying u/v coordinates.
-
-
IMAGE - Static variable in interface processing.core.PConstants
-
-
texture coordinates based on image width/height
-
-
image - Variable in class processing.core.PFont.Glyph
-
 
-
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
-
-
( begin auto-generated from image.xml ) - - Displays images to the screen.
-
-
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
-
-
( begin auto-generated from imageMode.xml ) - - Modifies the location from which images draw.
-
-
imageMode - Variable in class processing.core.PGraphics
-
-
The current image alignment (read-only)
-
-
imageMode(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from imageMode.xml ) - - Modifies the location from which images draw.
-
-
imageMode - Variable in class processing.core.PStyle
-
 
-
INCR - Static variable in class processing.opengl.PGL
-
 
-
INCR_WRAP - Static variable in class processing.opengl.PGL
-
 
-
increment(String) - Method in class processing.data.IntDict
-
-
Increase the value associated with a specific key by 1.
-
-
increment(int) - Method in class processing.data.IntList
-
 
-
index - Variable in class processing.core.PFont.Glyph
-
 
-
index(String) - Method in class processing.data.FloatDict
-
 
-
index(float) - Method in class processing.data.FloatList
-
-
Return the first index of a particular value.
-
-
index(String) - Method in class processing.data.IntDict
-
 
-
index(int) - Method in class processing.data.IntList
-
-
Return the first index of a particular value.
-
-
index(String) - Method in class processing.data.StringDict
-
 
-
index(String) - Method in class processing.data.StringList
-
-
Return the first index of a particular value.
-
-
INFO_LOG_LENGTH - Static variable in class processing.opengl.PGL
-
 
-
init() - Method in class processing.core.PApplet
-
-
Applet initialization.
-
-
init(int, int, int) - Method in class processing.core.PImage
-
-
Do not remove, see notes in the other variant.
-
-
init(int, 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) - Static method in class processing.core.ThinkDifferent
-
 
-
init() - Method in class processing.opengl.PShader
-
 
-
init(int, int) - Method in class processing.opengl.Texture
-
-
Sets the size of the image and texture to width x height.
-
-
init(int, int, Texture.Parameters) - Method in class processing.opengl.Texture
-
-
Sets the size of the image and texture to width x height, and the - parameters of the texture to params.
-
-
init(int, int, int, int, int, int, int, int, int, int, int) - Method in class processing.opengl.Texture
-
-
Initializes the texture using GL parameters
-
-
initFrame(PApplet) - Method in interface processing.core.PSurface
-
 
-
initFrame(PApplet) - Method in class processing.core.PSurfaceAWT
-
 
-
initFrame(PApplet) - Method in class processing.core.PSurfaceFX
-
 
-
initFrame(PApplet) - Method in class processing.core.PSurfaceNone
-
 
-
initFrame(PApplet) - Method in class processing.opengl.PSurfaceJOGL
-
 
-
initialized - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Whether the PGraphics object is ready to render or not.
-
-
initOffscreen(PApplet) - Method in interface processing.core.PSurface
-
 
-
initOffscreen(PApplet) - Method in class processing.core.PSurfaceAWT
-
 
-
initOffscreen(PApplet) - Method in class processing.core.PSurfaceFX
-
 
-
initOffscreen(PApplet) - Method in class processing.core.PSurfaceNone
-
 
-
initOffscreen(PApplet) - Method in class processing.opengl.PSurfaceJOGL
-
 
-
insert(int, float) - Method in class processing.data.FloatList
-
 
-
insert(int, float[]) - Method in class processing.data.FloatList
-
 
-
insert(int, FloatList) - Method in class processing.data.FloatList
-
 
-
insert(int, int) - Method in class processing.data.IntList
-
 
-
insert(int, int[]) - Method in class processing.data.IntList
-
 
-
insert(int, IntList) - Method in class processing.data.IntList
-
 
-
insert(int, String) - Method in class processing.data.StringList
-
 
-
insert(int, String[]) - Method in class processing.data.StringList
-
 
-
insert(int, StringList) - Method in class processing.data.StringList
-
 
-
insertColumn(int) - Method in class processing.data.Table
-
 
-
insertColumn(int, String) - Method in class processing.data.Table
-
 
-
insertColumn(int, String, int) - Method in class processing.data.Table
-
 
-
insertFrame(String) - Method in class processing.core.PApplet
-
-
Check a string for #### signs to see if the frame number should be - inserted.
-
-
insertRow(int, Object[]) - Method in class processing.data.Table
-
 
-
INSIDE_BEGIN_END_ERROR - Static variable in class processing.core.PShape
-
 
-
INT - Static variable in class processing.data.Table
-
 
-
INT - Static variable in class processing.opengl.PGL
-
 
-
INT_VEC2 - Static variable in class processing.opengl.PGL
-
 
-
INT_VEC3 - Static variable in class processing.opengl.PGL
-
 
-
INT_VEC4 - Static variable in class processing.opengl.PGL
-
 
-
IntDict - Class in processing.data
-
-
A simple class to use a String as a lookup for an int value.
-
-
IntDict() - Constructor for class processing.data.IntDict
-
 
-
IntDict(int) - Constructor for class processing.data.IntDict
-
-
Create a new lookup with a specific size.
-
-
IntDict(BufferedReader) - Constructor for class processing.data.IntDict
-
-
Read a set of entries from a Reader that has each key/value pair on - a single line, separated by a tab.
-
-
IntDict(String[], int[]) - Constructor for class processing.data.IntDict
-
 
-
IntDict(Object[][]) - Constructor for class processing.data.IntDict
-
-
Constructor to allow (more intuitive) inline initialization, e.g.:
-
-
IntList - Class in processing.data
-
-
Helper class for a list of ints.
-
-
IntList() - Constructor for class processing.data.IntList
-
 
-
IntList(int) - Constructor for class processing.data.IntList
-
 
-
IntList(int[]) - Constructor for class processing.data.IntList
-
 
-
IntList(Iterable<Object>) - Constructor for class processing.data.IntList
-
-
Construct an IntList from an iterable pile of objects.
-
-
IntList(Object...) - Constructor for class processing.data.IntList
-
-
Construct an IntList from a random pile of objects.
-
-
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.
-
-
INVERT - Static variable in class processing.opengl.PGL
-
 
-
invertedX() - Method in class processing.opengl.Texture
-
-
Returns true if the texture is inverted along the horizontal direction.
-
-
invertedX(boolean) - Method in class processing.opengl.Texture
-
-
Sets the texture as inverted or not along the horizontal direction.
-
-
invertedY() - Method in class processing.opengl.Texture
-
-
Returns true if the texture is inverted along the vertical direction.
-
-
invertedY(boolean) - Method in class processing.opengl.Texture
-
-
Sets the texture as inverted or not along the vertical direction.
-
-
is2D() - Method in class processing.core.PGraphics
-
-
Return true if this renderer supports 2D drawing.
-
-
is2D() - Method in class processing.core.PShape
-
-
Return true if this shape is 2D.
-
-
is2D() - Method in class processing.opengl.PGraphics2D
-
 
-
is2D() - Method in class processing.opengl.PGraphics3D
-
 
-
is2X() - Method in class processing.core.PGraphics
-
 
-
is3D() - Method in class processing.core.PGraphics
-
-
Return true if this renderer supports 3D drawing.
-
-
is3D() - Method in class processing.core.PShape
-
-
Return true if this shape is 3D.
-
-
is3D() - Method in class processing.opengl.PGraphics2D
-
 
-
is3D() - Method in class processing.opengl.PGraphics3D
-
 
-
isAltDown() - Method in class processing.event.Event
-
 
-
isBuffer(int) - Method in class processing.opengl.PGL
-
 
-
isBuffer(int) - Method in class processing.opengl.PJOGL
-
 
-
isClosed() - Method in class processing.core.PShape
-
 
-
isControlDown() - Method in class processing.event.Event
-
 
-
isDone() - Method in class processing.opengl.LinePath.PathIterator
-
 
-
isEnabled(int) - Method in class processing.opengl.PGL
-
 
-
isEnabled(int) - Method in class processing.opengl.PJOGL
-
 
-
isFramebuffer(int) - Method in class processing.opengl.PGL
-
 
-
isFramebuffer(int) - Method in class processing.opengl.PJOGL
-
 
-
isGL() - Method in class processing.core.PGraphics
-
-
Return true if this renderer does rendering through OpenGL.
-
-
isGL() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
isLoaded() - Method in class processing.core.PImage
-
 
-
isMetaDown() - Method in class processing.event.Event
-
 
-
isModified() - Method in class processing.core.PImage
-
 
-
isModified() - Method in class processing.opengl.Texture
-
 
-
isNull(int) - Method in class processing.data.JSONArray
-
-
Determine if the value is null.
-
-
isNull(String) - Method in class processing.data.JSONObject
-
-
Determine if the value associated with the key is null or if there is - no value.
-
-
isProgram(int) - Method in class processing.opengl.PGL
-
 
-
isProgram(int) - Method in class processing.opengl.PJOGL
-
 
-
isqrt(int) - Static method in class processing.opengl.LinePath
-
 
-
isRenderbuffer(int) - Method in class processing.opengl.PGL
-
 
-
isRenderbuffer(int) - Method in class processing.opengl.PJOGL
-
 
-
isShader(int) - Method in class processing.opengl.PGL
-
 
-
isShader(int) - Method in class processing.opengl.PJOGL
-
 
-
isShiftDown() - Method in class processing.event.Event
-
 
-
isStopped() - Method in interface processing.core.PSurface
-
 
-
isStopped() - Method in class processing.core.PSurfaceFX
-
 
-
isStopped() - Method in class processing.core.PSurfaceNone
-
 
-
isStopped() - Method in class processing.opengl.PSurfaceJOGL
-
 
-
isStream() - Method in class processing.core.PFont
-
 
-
isTexture(int) - Method in class processing.opengl.PGL
-
 
-
isTexture(int) - Method in class processing.opengl.PJOGL
-
 
-
isVisible() - Method in class processing.core.PShape
-
-
( begin auto-generated from PShape_isVisible.xml ) - - Returns a boolean value "true" if the image is set to be visible, - "false" if not.
-
-
iterator() - Method in class processing.data.FloatList
-
-
Implemented this way so that we can use a FloatList in a for loop.
-
-
iterator() - Method in class processing.data.IntList
-
 
-
iterator() - Method in class processing.data.StringList
-
 
-
- - - -

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
-
-
( begin auto-generated from join.xml ) - - Combines an array of Strings into one String, each separated by the - character(s) used for the separator parameter.
-
-
join(String[], String) - Static method in class processing.core.PApplet
-
 
-
join(String) - Method in class processing.data.FloatList
-
 
-
join(String) - Method in class processing.data.IntList
-
 
-
join(String) - Method in class processing.data.JSONArray
-
-
Make a string from the contents of this JSONArray.
-
-
join(String) - Method in class processing.data.StringList
-
 
-
JOIN_BEVEL - Static variable in class processing.opengl.LinePath
-
-
Joins path segments by connecting the outer corners of their wide outlines - with a straight segment.
-
-
JOIN_MITER - Static variable in class processing.opengl.LinePath
-
-
Joins path segments by extending their outside edges until they meet.
-
-
JOIN_ROUND - Static variable in class processing.opengl.LinePath
-
-
Joins path segments by rounding off the corner at a radius of half the line - width.
-
-
JPEG - Static variable in interface processing.core.PConstants
-
 
-
JSONArray - Class in processing.data
-
-
A JSONArray is an ordered sequence of values.
-
-
JSONArray() - Constructor for class processing.data.JSONArray
-
-
Construct an empty JSONArray.
-
-
JSONArray(Reader) - Constructor for class processing.data.JSONArray
-
 
-
JSONArray(IntList) - Constructor for class processing.data.JSONArray
-
 
-
JSONArray(FloatList) - Constructor for class processing.data.JSONArray
-
 
-
JSONArray(StringList) - Constructor for class processing.data.JSONArray
-
 
-
JSONObject - Class in processing.data
-
-
A JSONObject is an unordered collection of name/value pairs.
-
-
JSONObject() - Constructor for class processing.data.JSONObject
-
-
Construct an empty JSONObject.
-
-
JSONObject(Reader) - Constructor for class processing.data.JSONObject
-
 
-
JSONObject(IntDict) - Constructor for class processing.data.JSONObject
-
 
-
JSONObject(FloatDict) - Constructor for class processing.data.JSONObject
-
 
-
JSONObject(StringDict) - Constructor for class processing.data.JSONObject
-
 
-
- - - -

K

-
-
KEEP - Static variable in class processing.opengl.PGL
-
 
-
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
-
-
( begin auto-generated from key.xml ) - - The system variable key always contains the value of the most - recent key on the keyboard that was used (either pressed or released).
-
-
key(int) - Method in class processing.data.FloatDict
-
 
-
key(int) - Method in class processing.data.IntDict
-
 
-
key(int) - Method in class processing.data.StringDict
-
 
-
KEY - Static variable in class processing.event.Event
-
 
-
keyArray() - Method in class processing.data.FloatDict
-
-
Return a copy of the internal keys array.
-
-
keyArray(String[]) - Method in class processing.data.FloatDict
-
 
-
keyArray() - Method in class processing.data.IntDict
-
-
Return a copy of the internal keys array.
-
-
keyArray(String[]) - Method in class processing.data.IntDict
-
 
-
keyArray() - Method in class processing.data.StringDict
-
-
Return a copy of the internal keys array.
-
-
keyArray(String[]) - Method in class processing.data.StringDict
-
 
-
keyCode - Variable in class processing.core.PApplet
-
-
( begin auto-generated from keyCode.xml ) - - The variable keyCode is used to detect special keys such as the - UP, DOWN, LEFT, RIGHT arrow keys and ALT, CONTROL, SHIFT.
-
-
keyEvent - Variable in class processing.core.PApplet
-
-
Deprecated. -
Use a key event handler that passes an event instead.
-
-
-
KeyEvent - Class in processing.event
-
 
-
KeyEvent(Object, long, int, int, char, int) - Constructor for class processing.event.KeyEvent
-
 
-
keyIterator() - Method in class processing.data.IntDict
-
 
-
keyIterator() - Method in class processing.data.JSONObject
-
-
Get an enumeration of the keys of the JSONObject.
-
-
keyPressed - Variable in class processing.core.PApplet
-
-
( begin auto-generated from keyPressed_var.xml ) - - The boolean system variable keyPressed is true if any key - is pressed and false if no keys are pressed.
-
-
keyPressed() - Method in class processing.core.PApplet
-
-
( begin auto-generated from keyPressed.xml ) - - The keyPressed() function is called once every time a key is - pressed.
-
-
keyPressed(KeyEvent) - Method in class processing.core.PApplet
-
 
-
keyReleased() - Method in class processing.core.PApplet
-
-
( begin auto-generated from keyReleased.xml ) - - The keyReleased() function is called once every time a key is - released.
-
-
keyReleased(KeyEvent) - Method in class processing.core.PApplet
-
 
-
keys() - Method in class processing.data.FloatDict
-
 
-
keys() - Method in class processing.data.IntDict
-
-
Return the internal array being used to store the keys.
-
-
keys() - Method in class processing.data.JSONObject
-
-
Get a set of keys of the JSONObject.
-
-
keys() - Method in class processing.data.StringDict
-
 
-
keyTyped() - Method in class processing.core.PApplet
-
-
( begin auto-generated from keyTyped.xml ) - - The keyTyped() function is called once every time a key is - pressed, but action keys such as Ctrl, Shift, and Alt are ignored.
-
-
keyTyped(KeyEvent) - Method in class processing.core.PApplet
-
 
-
- - - -

L

-
-
LANDSCAPE - Static variable in interface processing.core.PConstants
-
-
Screen orientation constant for landscape (the hot dog way).
-
-
lastRowIndex() - Method in class processing.data.Table
-
 
-
launch(String) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from launch.xml ) - - Attempts to open an application or file using your platform's launcher.
-
-
launch(String...) - Static method in class processing.core.PApplet
-
-
Launch a process using the platform's shell.
-
-
LEFT - Static variable in interface processing.core.PConstants
-
 
-
leftExtent - Variable in class processing.core.PFont.Glyph
-
 
-
LEQUAL - Static variable in class processing.opengl.PGL
-
 
-
lerp(float, float, float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from lerp.xml ) - - Calculates a number between two numbers at a specific increment.
-
-
lerp(PVector, float) - Method in class processing.core.PVector
-
-
( begin auto-generated from PVector_rotate.xml ) - - Linear interpolate the vector to another vector - - ( end auto-generated )
-
-
lerp(PVector, PVector, float) - Static method in class processing.core.PVector
-
-
Linear interpolate between two vectors (returns a new PVector object)
-
-
lerp(float, float, float, float) - Method in class processing.core.PVector
-
-
Linear interpolate the vector to x,y,z values
-
-
lerpColor(int, int, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from lerpColor.xml ) - - Calculates a color or colors between two color at a specific increment.
-
-
lerpColor(int, int, float, int) - Static method in class processing.core.PApplet
-
 
-
lerpColor(int, int, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from lerpColor.xml ) - - Calculates a color or colors between two color at a specific increment.
-
-
lerpColor(int, int, float, int) - Static method in class processing.core.PGraphics
-
 
-
LESS - Static variable in class processing.opengl.PGL
-
 
-
lightAmbient - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Ambient colors for lights.
-
-
lightCount - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
lightDiffuse - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Diffuse colors for lights.
-
-
LIGHTEST - Static variable in interface processing.core.PConstants
-
 
-
lightFalloff(float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from lightFalloff.xml ) - - Sets the falloff rates for point lights, spot lights, and ambient - lights.
-
-
lightFalloff(float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from lightFalloff.xml ) - - Sets the falloff rates for point lights, spot lights, and ambient - lights.
-
-
lightFalloff(float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
lightFalloff(float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Set the light falloff rates for the last light that was created.
-
-
lightFalloffCoefficients - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Light falloff
-
-
lightNormal - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Light direction (normalized vector)
-
-
lightPosition - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Light positions
-
-
lights() - Method in class processing.core.PApplet
-
-
( begin auto-generated from lights.xml ) - - Sets the default ambient light, directional light, falloff, and specular - values.
-
-
lights() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from lights.xml ) - - Sets the default ambient light, directional light, falloff, and specular - values.
-
-
lights() - Method in class processing.opengl.PGraphics2D
-
 
-
lights - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
lights() - Method in class processing.opengl.PGraphicsOpenGL
-
-
Sets up an ambient and directional light using OpenGL.
-
-
lightSpecular(float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from lightSpecular.xml ) - - Sets the specular color for lights.
-
-
lightSpecular(float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from lightSpecular.xml ) - - Sets the specular color for lights.
-
-
lightSpecular(float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
lightSpecular - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Specular colors for lights.
-
-
lightSpecular(float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Set the specular color of the last light created.
-
-
lightSpotParameters - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Light spot parameters: Cosine of light spot angle - and concentration
-
-
lightType - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Light types
-
-
limit(float) - Method in class processing.core.PVector
-
-
( begin auto-generated from PVector_limit.xml ) - - Limit the magnitude of this vector to the value used for the max parameter.
-
-
line(float, float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen.
-
-
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
-
-
( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen.
-
-
line(float, float, float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
line(float, float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
line(float, float, float, float) - Method in class processing.core.PGraphicsJava2D
-
 
-
line(float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
line(float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
LINE_LOOP - Static variable in interface processing.core.PConstants
-
 
-
LINE_LOOP - Static variable in class processing.opengl.PGL
-
 
-
LINE_SMOOTH - Static variable in class processing.opengl.PGL
-
 
-
LINE_STRIP - Static variable in interface processing.core.PConstants
-
 
-
LINE_STRIP - Static variable in class processing.opengl.PGL
-
 
-
LINEAR - Static variable in class processing.opengl.PGL
-
 
-
LINEAR_MIPMAP_LINEAR - Static variable in class processing.opengl.PGL
-
 
-
LINEAR_MIPMAP_NEAREST - Static variable in class processing.opengl.PGL
-
 
-
lineJoin() - Method in class processing.opengl.LineStroker
-
 
-
LinePath - Class in processing.opengl
-
-
The LinePath class allows to represent polygonal paths, - potentially composed by several disjoint polygonal segments.
-
-
LinePath() - Constructor for class processing.opengl.LinePath
-
-
Constructs a new empty single precision LinePath object with a - default winding rule of LinePath.WIND_NON_ZERO.
-
-
LinePath(int) - Constructor for class processing.opengl.LinePath
-
-
Constructs a new empty single precision LinePath object with the - specified winding rule to control operations that require the interior of - the path to be defined.
-
-
LinePath(int, int) - Constructor for class processing.opengl.LinePath
-
-
Constructs a new LinePath object from the given specified initial - values.
-
-
LinePath.PathIterator - Class in processing.opengl
-
 
-
LINES - Static variable in interface processing.core.PConstants
-
 
-
LINES - Static variable in class processing.opengl.PGL
-
 
-
LineStroker - Class in processing.opengl
-
 
-
LineStroker() - Constructor for class processing.opengl.LineStroker
-
-
Empty constructor.
-
-
LineStroker(LineStroker, int, int, int, int, PMatrix2D) - Constructor for class processing.opengl.LineStroker
-
-
Constructs a LineStroker.
-
-
lineTo(float, float, int) - Method in class processing.opengl.LinePath
-
-
Adds a point to the path by drawing a straight line from the current - coordinates to the new specified coordinates specified in float precision.
-
-
lineTo(int, int, int) - Method in class processing.opengl.LineStroker
-
 
-
lineWidth(float) - Method in class processing.opengl.PGL
-
 
-
lineWidth(float) - Method in class processing.opengl.PJOGL
-
 
-
link(String) - Method in class processing.core.PApplet
-
-
Links to a webpage either in the same window or in a new window.
-
-
LINK_STATUS - Static variable in class processing.opengl.PGL
-
 
-
linkProgram(int) - Method in class processing.opengl.PGL
-
 
-
linkProgram(int) - Method in class processing.opengl.PJOGL
-
 
-
LINUX - Static variable in interface processing.core.PConstants
-
 
-
list() - Static method in class processing.core.PFont
-
-
( begin auto-generated from PFont_list.xml ) - - Gets a list of the fonts installed on the system.
-
-
listAttributes() - Method in class processing.data.XML
-
-
Get a list of the names for all of the attributes for this node.
-
-
listChildren() - Method in class processing.data.XML
-
-
Put the names of all children into an array.
-
-
loadBytes(String) - Method in class processing.core.PApplet
-
-
( begin auto-generated from loadBytes.xml ) - - Reads the contents of a file or url and places it in a byte array.
-
-
loadBytes(InputStream) - Static method in class processing.core.PApplet
-
 
-
loadBytes(File) - Static method in class processing.core.PApplet
-
 
-
loaded - Variable in class processing.core.PImage
-
-
Loaded pixels flag
-
-
loadFont(String) - Method in class processing.core.PApplet
-
-
( begin auto-generated from loadFont.xml ) - - Loads a font into a variable of type PFont.
-
-
loadFonts() - Static method in class processing.core.PFont
-
 
-
loadImage(String) - Method in class processing.core.PApplet
-
-
( begin auto-generated from loadImage.xml ) - - Loads an image into a variable of type PImage.
-
-
loadImage(String, String) - Method in class processing.core.PApplet
-
 
-
loadJSONArray(String) - Method in class processing.core.PApplet
-
 
-
loadJSONArray(File) - Static method in class processing.core.PApplet
-
 
-
loadJSONObject(String) - Method in class processing.core.PApplet
-
 
-
loadJSONObject(File) - Static method in class processing.core.PApplet
-
 
-
loadPixels() - Method in class processing.core.PApplet
-
-
( begin auto-generated from loadPixels.xml ) - - Loads the pixel data for the display window into the pixels[] - array.
-
-
loadPixels() - Method in class processing.core.PGraphicsDanger2D
-
 
-
loadPixels() - Method in class processing.core.PGraphicsFX2D
-
 
-
loadPixels() - Method in class processing.core.PGraphicsJava2D
-
 
-
loadPixels() - Method in class processing.core.PImage
-
-
( begin auto-generated from PImage_loadPixels.xml ) - - Loads the pixel data for the image into its pixels[] array.
-
-
loadPixels() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
loadShader(String) - Method in class processing.core.PApplet
-
-
( begin auto-generated from loadShader.xml ) - - This is a new reference entry for Processing 2.0.
-
-
loadShader(String, String) - Method in class processing.core.PApplet
-
 
-
loadShader(String) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from loadShader.xml ) - - This is a new reference entry for Processing 2.0.
-
-
loadShader(String, String) - Method in class processing.core.PGraphics
-
 
-
loadShader(String) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
loadShader(String, String) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
loadShape(String) - Method in class processing.core.PApplet
-
 
-
loadShape(String, String) - Method in class processing.core.PApplet
-
 
-
loadShape(String) - Method in class processing.core.PGraphics
-
 
-
loadShape(String, String) - Method in class processing.core.PGraphics
-
 
-
loadShape(String) - Method in class processing.core.PGraphicsFX2D
-
 
-
loadShape(String, String) - Method in class processing.core.PGraphicsFX2D
-
 
-
loadShape(String, String) - Method in class processing.core.PGraphicsJava2D
-
 
-
loadShape(String) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
loadStrings(File) - Static method in class processing.core.PApplet
-
 
-
loadStrings(String) - Method in class processing.core.PApplet
-
-
( begin auto-generated from loadStrings.xml ) - - Reads the contents of a file or url and creates a String array of its - individual lines.
-
-
loadStrings(InputStream) - Static method in class processing.core.PApplet
-
 
-
loadStrings(BufferedReader) - Static method in class processing.core.PApplet
-
 
-
loadTable(String) - Method in class processing.core.PApplet
-
 
-
loadTable(String, String) - Method in class processing.core.PApplet
-
-
Options may contain "header", "tsv", "csv", or "bin" separated by commas.
-
-
loadTexture() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
loadXML(String) - Method in class processing.core.PApplet
-
 
-
loadXML(String, String) - Method in class processing.core.PApplet
-
 
-
log(float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from log.xml ) - - Calculates the natural logarithm (the base-e logarithm) of a - number.
-
-
LONG - Static variable in class processing.data.Table
-
 
-
loop() - Method in class processing.core.PApplet
-
-
( begin auto-generated from loop.xml ) - - Causes Processing to continuously execute the code within draw().
-
-
LOW_FLOAT - Static variable in class processing.opengl.PGL
-
 
-
LOW_INT - Static variable in class processing.opengl.PGL
-
 
-
lower() - Method in class processing.data.StringList
-
-
Make the entire list lower case.
-
-
lsqrt(long) - Static method in class processing.opengl.LinePath
-
 
-
LUMINANCE - Static variable in class processing.opengl.PGL
-
 
-
LUMINANCE_ALPHA - Static variable in class processing.opengl.PGL
-
 
-
- - - -

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
-
 
-
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
-
-
( begin auto-generated from mag.xml ) - - Calculates the magnitude (or length) of a vector.
-
-
mag() - Method in class processing.core.PVector
-
-
( begin auto-generated from PVector_mag.xml ) - - Calculates the magnitude (length) of the vector and returns the result - as a float (this is simply the equation sqrt(x*x + y*y + z*z).) - - ( end auto-generated )
-
-
magSq() - Method in class processing.core.PVector
-
-
( begin auto-generated from PVector_mag.xml ) - - Calculates the squared magnitude of the vector and returns the result - as a float (this is simply the equation (x*x + y*y + z*z).) - Faster if the real length is not required in the - case of comparing vectors, etc.
-
-
main(String[]) - Static method in class processing.core.PApplet
-
-
main() method for running this class from the command line.
-
-
main(String) - Static method in class processing.core.PApplet
-
-
Convenience method so that PApplet.main("YourSketch") launches a sketch, - rather than having to wrap it into a single element String array.
-
-
main(String, String[]) - Static method in class processing.core.PApplet
-
-
Convenience method so that PApplet.main("YourSketch", args) launches a - sketch, rather than having to wrap it into a String array, and appending - the 'args' array when not null.
-
-
map(float, float, float, float, float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from map.xml ) - - Re-maps a number from one range to another.
-
-
mapBuffer(int, int) - Method in class processing.opengl.PGL
-
 
-
mapBuffer(int, int) - Method in class processing.opengl.PJOGL
-
 
-
mapBufferRange(int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
mapBufferRange(int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
mask(PImage) - Method in class processing.core.PApplet
-
-
( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel.
-
-
mask(int[]) - Method in class processing.core.PGraphicsDanger2D
-
 
-
mask(PImage) - Method in class processing.core.PGraphicsDanger2D
-
 
-
mask(PImage) - Method in class processing.core.PGraphicsFX2D
-
 
-
mask(int[]) - Method in class processing.core.PGraphicsJava2D
-
 
-
mask(PImage) - Method in class processing.core.PGraphicsJava2D
-
 
-
mask(int[]) - Method in class processing.core.PImage
-
-
Deprecated.
-
-
mask(PImage) - Method in class processing.core.PImage
-
-
( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel.
-
-
mask(PImage) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
match(String, String) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from match.xml ) - - The match() function is used to apply a regular expression to a piece of - text, and return matching groups (elements found inside parentheses) as - a String array.
-
-
matchAll(String, String) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from matchAll.xml ) - - This function is used to apply a regular expression to a piece of text, - and return a list of matching groups (elements found inside parentheses) - as a two-dimensional String array.
-
-
matchRow(String, int) - Method in class processing.data.Table
-
 
-
matchRow(String, String) - Method in class processing.data.Table
-
 
-
matchRowIndex(String, int) - Method in class processing.data.Table
-
-
Return the row that contains the first String that matches.
-
-
matchRowIndex(String, String) - Method in class processing.data.Table
-
-
Return the row that contains the first String that matches.
-
-
matchRowIndices(String, int) - Method in class processing.data.Table
-
-
Return a list of rows that contain the String passed in.
-
-
matchRowIndices(String, String) - Method in class processing.data.Table
-
-
Return a list of rows that match the regex passed in.
-
-
matchRowIterator(String, int) - Method in class processing.data.Table
-
 
-
matchRowIterator(String, String) - Method in class processing.data.Table
-
 
-
matchRows(String, int) - Method in class processing.data.Table
-
 
-
matchRows(String, String) - Method in class processing.data.Table
-
 
-
max(int, int) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from max.xml ) - - Determines the largest value in a sequence of numbers.
-
-
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
-
 
-
max(float[]) - Static method in class processing.core.PApplet
-
 
-
max() - Method in class processing.data.FloatList
-
 
-
max() - Method in class processing.data.IntList
-
 
-
MAX_BUFFER_CACHE_SIZE - Static variable in class processing.opengl.Texture
-
 
-
MAX_COMBINED_TEXTURE_IMAGE_UNITS - Static variable in class processing.opengl.PGL
-
 
-
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_SAMPLES - Static variable in class processing.opengl.PGL
-
 
-
MAX_TEXTURE_IMAGE_UNITS - Static variable in class processing.opengl.PGL
-
 
-
MAX_TEXTURE_MAX_ANISOTROPY - Static variable in class processing.opengl.PGL
-
 
-
MAX_TEXTURE_SIZE - Static variable in class processing.opengl.PGL
-
 
-
MAX_VERTEX_ATTRIBS - Static variable in class processing.opengl.PGL
-
 
-
MAX_VERTEX_TEXTURE_IMAGE_UNITS - Static variable in class processing.opengl.PGL
-
 
-
maxAnisoAmount - Static variable in class processing.opengl.PGraphicsOpenGL
-
 
-
maxIndex() - Method in class processing.data.FloatDict
-
 
-
maxIndex() - Method in class processing.data.FloatList
-
 
-
maxIndex() - Method in class processing.data.IntDict
-
 
-
maxIndex() - Method in class processing.data.IntList
-
 
-
maxKey() - Method in class processing.data.FloatDict
-
-
The key for a max value, or null if everything is NaN (no max).
-
-
maxKey() - Method in class processing.data.IntDict
-
 
-
maxSamples - Static variable in class processing.opengl.PGraphicsOpenGL
-
 
-
maxTexcoordU() - Method in class processing.opengl.Texture
-
-
Returns the maximum possible value for the texture coordinate U - (horizontal).
-
-
maxTexcoordV() - Method in class processing.opengl.Texture
-
-
Returns the maximum possible value for the texture coordinate V (vertical).
-
-
maxTextureSize - Static variable in class processing.opengl.PGraphicsOpenGL
-
-
Some hardware limits
-
-
maxValue() - Method in class processing.data.FloatDict
-
-
The max value.
-
-
maxValue() - Method in class processing.data.IntDict
-
 
-
MEDIUM_FLOAT - Static variable in class processing.opengl.PGL
-
 
-
MEDIUM_INT - Static variable in class processing.opengl.PGL
-
 
-
META - Static variable in class processing.event.Event
-
 
-
method(String) - Method in class processing.core.PApplet
-
-
Call a method in the current class based on its name.
-
-
millis() - Method in class processing.core.PApplet
-
-
( begin auto-generated from millis.xml ) - - Returns the number of milliseconds (thousandths of a second) since - starting an applet.
-
-
min(int, int) - Static method in class processing.core.PApplet
-
-
Find the maximum value in an array.
-
-
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
-
-
( begin auto-generated from min.xml ) - - Determines the smallest value in a sequence of numbers.
-
-
min(int[]) - Static method in class processing.core.PApplet
-
 
-
min(float[]) - Static method in class processing.core.PApplet
-
 
-
min() - Method in class processing.data.FloatList
-
 
-
min() - Method in class processing.data.IntList
-
 
-
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 interface processing.core.PSurface
-
 
-
MIN_WINDOW_WIDTH - Static variable in interface processing.core.PSurface
-
-
Minimum dimensions for the window holding an applet.
-
-
minIndex() - Method in class processing.data.FloatDict
-
 
-
minIndex() - Method in class processing.data.FloatList
-
 
-
minIndex() - Method in class processing.data.IntDict
-
 
-
minIndex() - Method in class processing.data.IntList
-
 
-
minKey() - Method in class processing.data.FloatDict
-
 
-
minKey() - Method in class processing.data.IntDict
-
 
-
minute() - Static method in class processing.core.PApplet
-
-
( begin auto-generated from minute.xml ) - - Processing communicates with the clock on your computer.
-
-
minValue() - Method in class processing.data.FloatDict
-
 
-
minValue() - Method in class processing.data.IntDict
-
 
-
mipmaps - Variable in class processing.opengl.Texture.Parameters
-
-
Use mipmaps or not.
-
-
MISSING_FBO_ERROR - Static variable in class processing.opengl.PGL
-
 
-
MISSING_GLFUNC_ERROR - Static variable in class processing.opengl.PGL
-
 
-
MISSING_GLSL_ERROR - Static variable in class processing.opengl.PGL
-
 
-
missingGlyph - Variable in class processing.core.PShapeSVG.Font
-
 
-
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 - Static variable in interface processing.core.PConstants
-
 
-
modelview - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
modelviewInv - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
modelX(float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from modelX.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
-
-
modelX(float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from modelX.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
-
-
modelX(float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
modelY(float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from modelY.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
-
-
modelY(float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from modelY.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
-
-
modelY(float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
modelZ(float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from modelZ.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
-
-
modelZ(float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from modelZ.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
-
-
modelZ(float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
month() - Static method in class processing.core.PApplet
-
-
( begin auto-generated from month.xml ) - - Processing communicates with the clock on your computer.
-
-
MOUSE - Static variable in class processing.event.Event
-
 
-
mouseButton - Variable in class processing.core.PApplet
-
-
( begin auto-generated from mouseButton.xml ) - - Processing automatically tracks if the mouse button is pressed and which - button is pressed.
-
-
mouseClicked() - Method in class processing.core.PApplet
-
-
( begin auto-generated from mouseClicked.xml ) - - The mouseClicked() function is called once after a mouse button - has been pressed and then released.
-
-
mouseClicked(MouseEvent) - Method in class processing.core.PApplet
-
 
-
mouseDragged() - Method in class processing.core.PApplet
-
-
( begin auto-generated from mouseDragged.xml ) - - The mouseDragged() function is called once every time the mouse - moves and a mouse button is pressed.
-
-
mouseDragged(MouseEvent) - Method in class processing.core.PApplet
-
 
-
mouseEntered() - Method in class processing.core.PApplet
-
 
-
mouseEntered(MouseEvent) - Method in class processing.core.PApplet
-
 
-
mouseEvent - Variable in class processing.core.PApplet
-
-
Deprecated. -
Use a mouse event handler that passes an event instead.
-
-
-
MouseEvent - Class in processing.event
-
 
-
MouseEvent(Object, long, int, int, int, int, int, int) - Constructor for class processing.event.MouseEvent
-
 
-
mouseExited() - Method in class processing.core.PApplet
-
 
-
mouseExited(MouseEvent) - Method in class processing.core.PApplet
-
 
-
mouseMoved() - Method in class processing.core.PApplet
-
-
( begin auto-generated from mouseMoved.xml ) - - The mouseMoved() function is called every time the mouse moves - and a mouse button is not pressed.
-
-
mouseMoved(MouseEvent) - Method in class processing.core.PApplet
-
 
-
mousePressed - Variable in class processing.core.PApplet
-
-
( begin auto-generated from mousePressed_var.xml ) - - Variable storing if a mouse button is pressed.
-
-
mousePressed() - Method in class processing.core.PApplet
-
-
( begin auto-generated from mousePressed.xml ) - - The mousePressed() function is called once after every time a - mouse button is pressed.
-
-
mousePressed(MouseEvent) - Method in class processing.core.PApplet
-
 
-
mouseReleased() - Method in class processing.core.PApplet
-
-
( begin auto-generated from mouseReleased.xml ) - - The mouseReleased() function is called every time a mouse button - is released.
-
-
mouseReleased(MouseEvent) - Method in class processing.core.PApplet
-
 
-
mouseWheel() - Method in class processing.core.PApplet
-
 
-
mouseWheel(MouseEvent) - Method in class processing.core.PApplet
-
-
The event.getAmount() method returns negative values if the mouse wheel - if rotated up or away from the user and positive in the other direction.
-
-
mouseX - Variable in class processing.core.PApplet
-
-
( begin auto-generated from mouseX.xml ) - - The system variable mouseX always contains the current horizontal - coordinate of the mouse.
-
-
mouseY - Variable in class processing.core.PApplet
-
-
( begin auto-generated from mouseY.xml ) - - The system variable mouseY always contains the current vertical - coordinate of the mouse.
-
-
MOVE - Static variable in interface processing.core.PConstants
-
 
-
MOVE - Static variable in class processing.event.MouseEvent
-
 
-
moveTo(float, float, int) - Method in class processing.opengl.LinePath
-
-
Adds a point to the path by moving to the specified coordinates specified - in float precision.
-
-
moveTo(int, int, int) - Method in class processing.opengl.LineStroker
-
 
-
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
-
-
( begin auto-generated from PVector_mult.xml ) - - Multiplies a vector by a scalar or multiplies one vector by another.
-
-
mult(PVector, float) - Static method in class processing.core.PVector
-
 
-
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(String, float) - Method in class processing.data.FloatDict
-
 
-
mult(int, float) - Method in class processing.data.FloatList
-
 
-
mult(String, int) - Method in class processing.data.IntDict
-
 
-
mult(int, int) - Method in class processing.data.IntList
-
 
-
MULTIPLY - Static variable in interface processing.core.PConstants
-
 
-
MULTISAMPLE - Static variable in class processing.opengl.PGL
-
 
-
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.PShapeSVG.FontGlyph
-
 
-
namedGlyphs - Variable in class processing.core.PShapeSVG.Font
-
 
-
NEAREST - Static variable in class processing.opengl.PGL
-
 
-
NEVER - Static variable in class processing.opengl.PGL
-
 
-
NEWT - Static variable in class processing.opengl.PJOGL
-
 
-
next() - Method in class processing.opengl.LinePath.PathIterator
-
 
-
nf(int[], int) - Static method in class processing.core.PApplet
-
 
-
nf(int, int) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from nf.xml ) - - Utility function for formatting numbers into strings.
-
-
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
-
-
( begin auto-generated from nfc.xml ) - - Utility function for formatting numbers into strings and placing - appropriate commas to mark units of 1000.
-
-
nfc(int) - Static method in class processing.core.PApplet
-
-
nfc() or "number format with commas".
-
-
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
-
-
( begin auto-generated from nfp.xml ) - - Utility function for formatting numbers into strings.
-
-
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
-
-
( begin auto-generated from nfs.xml ) - - Utility function for formatting numbers into strings.
-
-
nfs(int[], int) - Static method in class processing.core.PApplet
-
 
-
nfs(float[], int, int) - Static method in class processing.core.PApplet
-
 
-
nfs(float, int, int) - Static method in class processing.core.PApplet
-
 
-
NICEST - Static variable in class processing.opengl.PGL
-
 
-
NO_SUCH_VERTEX_ERROR - Static variable in class processing.core.PShape
-
 
-
NO_VERTICES_ERROR - Static variable in class processing.core.PShape
-
 
-
noClip() - Method in class processing.core.PApplet
-
 
-
noClip() - Method in class processing.core.PGraphics
-
 
-
noClip() - Method in class processing.core.PGraphicsFX2D
-
 
-
noClip() - Method in class processing.core.PGraphicsJava2D
-
 
-
noClip() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
noCursor() - Method in class processing.core.PApplet
-
-
( begin auto-generated from noCursor.xml ) - - Hides the cursor from view.
-
-
noFill() - Method in class processing.core.PApplet
-
-
( begin auto-generated from noFill.xml ) - - Disables filling geometry.
-
-
noFill() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from noFill.xml ) - - Disables filling geometry.
-
-
noFill() - Method in class processing.core.PShape
-
 
-
noise(float) - Method in class processing.core.PApplet
-
 
-
noise(float, float) - Method in class processing.core.PApplet
-
 
-
noise(float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from noise.xml ) - - Returns the Perlin noise value at specified coordinates.
-
-
noiseDetail(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from noiseDetail.xml ) - - Adjusts the character and level of detail produced by the Perlin noise - function.
-
-
noiseDetail(int, float) - Method in class processing.core.PApplet
-
 
-
noiseSeed(long) - Method in class processing.core.PApplet
-
-
( begin auto-generated from noiseSeed.xml ) - - Sets the seed value for noise().
-
-
noLights() - Method in class processing.core.PApplet
-
-
( begin auto-generated from noLights.xml ) - - Disable all lighting.
-
-
noLights() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from noLights.xml ) - - Disable all lighting.
-
-
noLights() - Method in class processing.opengl.PGraphics2D
-
 
-
noLights() - Method in class processing.opengl.PGraphicsOpenGL
-
-
Disables lighting.
-
-
noLoop() - Method in class processing.core.PApplet
-
-
( begin auto-generated from noLoop.xml ) - - Stops Processing from continuously executing the code within - draw().
-
-
NONPRIMARY_ERROR - Static variable in class processing.opengl.PGL
-
 
-
norm(float, float, float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from norm.xml ) - - Normalizes a number from another range into a value between 0 and 1.
-
-
normal(float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from normal.xml ) - - Sets the current normal vector.
-
-
NORMAL - Static variable in interface processing.core.PConstants
-
-
texture coordinates in 0..1 range
-
-
normal(float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from normal.xml ) - - Sets the current normal vector.
-
-
normal(float, float, float) - Method in class processing.core.PShape
-
 
-
NORMAL - Static variable in class processing.opengl.PShapeOpenGL
-
 
-
normal(float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
normalize() - Method in class processing.core.PVector
-
-
( begin auto-generated from PVector_normalize.xml ) - - Normalize the vector to length 1 (make it a unit vector).
-
-
normalize(PVector) - Method in class processing.core.PVector
-
 
-
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
-
 
-
noStroke() - Method in class processing.core.PApplet
-
-
( begin auto-generated from noStroke.xml ) - - Disables drawing the stroke (outline).
-
-
noStroke() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from noStroke.xml ) - - Disables drawing the stroke (outline).
-
-
noStroke() - Method in class processing.core.PShape
-
 
-
NOTEQUAL - Static variable in class processing.opengl.PGL
-
 
-
noTexture() - Method in class processing.core.PApplet
-
-
Removes texture image for current shape.
-
-
noTexture() - Method in class processing.core.PGraphics
-
-
Removes texture image for current shape.
-
-
noTexture() - Method in class processing.core.PShape
-
 
-
noTint() - Method in class processing.core.PApplet
-
-
( begin auto-generated from noTint.xml ) - - Removes the current fill value for displaying images and reverts to - displaying images with their original hues.
-
-
noTint() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from noTint.xml ) - - Removes the current fill value for displaying images and reverts to - displaying images with their original hues.
-
-
noTint() - Method in class processing.core.PShape
-
 
-
npotTexSupported - Static variable in class processing.opengl.PGraphicsOpenGL
-
-
Extensions used by Processing
-
-
NULL - Static variable in class processing.data.JSONObject
-
-
It is sometimes more convenient and less ambiguous to have a - NULL object than to use Java's null value.
-
-
NUM_COMPRESSED_TEXTURE_FORMATS - Static variable in class processing.opengl.PGL
-
 
-
NX - Static variable in class processing.core.PGraphics
-
 
-
NY - Static variable in class processing.core.PGraphics
-
 
-
NZ - Static variable in class processing.core.PGraphics
-
 
-
- - - -

O

-
-
OFFSET - Static variable in class processing.opengl.PShapeOpenGL
-
 
-
offsetX - Variable in class processing.opengl.PGL
-
 
-
offsetY - Variable in class processing.opengl.PGL
-
 
-
ONE - Static variable in class processing.opengl.PGL
-
 
-
ONE_MINUS_CONSTANT_ALPHA - Static variable in class processing.opengl.PGL
-
 
-
ONE_MINUS_CONSTANT_COLOR - Static variable in class processing.opengl.PGL
-
 
-
ONE_MINUS_DST_COLOR - Static variable in class processing.opengl.PGL
-
 
-
ONE_MINUS_SRC_ALPHA - Static variable in class processing.opengl.PGL
-
 
-
ONE_MINUS_SRC_COLOR - Static variable in class processing.opengl.PGL
-
 
-
OPAQUE - Static variable in interface processing.core.PConstants
-
 
-
OPEN - Static variable in interface processing.core.PConstants
-
 
-
OPENGL - Static variable in interface processing.core.PConstants
-
-
Deprecated.
-
-
OPENGL_EXTENSIONS - Static variable in class processing.opengl.PGraphicsOpenGL
-
 
-
OPENGL_RENDERER - Static variable in class processing.opengl.PGraphicsOpenGL
-
 
-
OPENGL_VENDOR - Static variable in class processing.opengl.PGraphicsOpenGL
-
-
OpenGL information strings
-
-
OPENGL_VERSION - Static variable in class processing.opengl.PGraphicsOpenGL
-
 
-
orientation(int) - Method in class processing.core.PApplet
-
 
-
ortho() - Method in class processing.core.PApplet
-
-
( begin auto-generated from ortho.xml ) - - Sets an orthographic projection and defines a parallel clipping volume.
-
-
ortho(float, float, float, float) - 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
-
-
( begin auto-generated from ortho.xml ) - - Sets an orthographic projection and defines a parallel clipping volume.
-
-
ortho(float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
ortho(float, float, float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
ortho() - Method in class processing.opengl.PGraphics2D
-
 
-
ortho(float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
ortho(float, float, float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
ortho() - Method in class processing.opengl.PGraphicsOpenGL
-
-
Calls ortho() with the proper parameters for Processing's standard - orthographic projection.
-
-
ortho(float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Calls ortho() with the specified size of the viewing volume along - the X and Z directions.
-
-
ortho(float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Sets an orthographic projection.
-
-
ORTHOGRAPHIC - Static variable in interface processing.core.PConstants
-
 
-
OTHER - Static variable in interface processing.core.PConstants
-
 
-
OUTSIDE_BEGIN_END_ERROR - Static variable in class processing.core.PShape
-
 
-
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
-
 
-
PACK_ALIGNMENT - Static variable in class processing.opengl.PGL
-
 
-
packedDepthStencilSupported - Static variable in class processing.opengl.PGraphicsOpenGL
-
 
-
PApplet - Class in processing.core
-
-
Base class for all sketches that use processing.core.
-
-
PApplet() - Constructor for class processing.core.PApplet
-
 
-
PApplicationFX() - Constructor for class processing.core.PSurfaceFX.PApplicationFX
-
 
-
Parameters() - Constructor for class processing.opengl.Texture.Parameters
-
-
Sets all the parameters to default values.
-
-
Parameters(int) - Constructor for class processing.opengl.Texture.Parameters
-
 
-
Parameters(int, int) - Constructor for class processing.opengl.Texture.Parameters
-
 
-
Parameters(int, int, boolean) - Constructor for class processing.opengl.Texture.Parameters
-
 
-
Parameters(int, int, boolean, int) - Constructor for class processing.opengl.Texture.Parameters
-
 
-
Parameters(Texture.Parameters) - Constructor for class processing.opengl.Texture.Parameters
-
 
-
parent - Variable in class processing.core.PImage
-
-
Path to parent object that will be used with save().
-
-
parse(String) - Static method in class processing.data.JSONArray
-
-
Construct a JSONArray from a source JSON text.
-
-
parse(String) - Static method in class processing.data.JSONObject
-
-
Construct a JSONObject from a source JSON text string.
-
-
parse(String) - Static method in class processing.data.XML
-
 
-
parse(String, String) - Static method in class processing.data.XML
-
 
-
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(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
-
 
-
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
-
 
-
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(byte[]) - 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.
-
-
parseInto(Object, String) - Method in class processing.data.Table
-
-
incomplete, do not use
-
-
parseJSONArray(String) - Method in class processing.core.PApplet
-
 
-
parseJSONObject(String) - Method in class processing.core.PApplet
-
 
-
parseXML(String) - Method in class processing.core.PApplet
-
 
-
parseXML(String, String) - Method in class processing.core.PApplet
-
 
-
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.core.PApplet
-
-
Sketch has been paused.
-
-
pauseThread() - Method in interface processing.core.PSurface
-
-
On the next trip through the animation thread, things should go sleepy-bye.
-
-
pauseThread() - Method in class processing.core.PSurfaceFX
-
 
-
pauseThread() - Method in class processing.core.PSurfaceNone
-
 
-
pauseThread() - Method in class processing.opengl.PSurfaceJOGL
-
 
-
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
-
-
( begin auto-generated from perspective.xml ) - - Sets a perspective projection applying foreshortening, making distant - objects appear smaller than closer ones.
-
-
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
-
-
( begin auto-generated from perspective.xml ) - - Sets a perspective projection applying foreshortening, making distant - objects appear smaller than closer ones.
-
-
perspective(float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
perspective() - Method in class processing.opengl.PGraphics2D
-
 
-
perspective(float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
perspective() - Method in class processing.opengl.PGraphicsOpenGL
-
-
Calls perspective() with Processing's standard coordinate projection.
-
-
perspective(float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Similar to gluPerspective().
-
-
PFont - Class in processing.core
-
-
Grayscale bitmap font class used by Processing.
-
-
PFont() - Constructor for class processing.core.PFont
-
 
-
PFont(Font, boolean) - Constructor for class processing.core.PFont
-
-
( begin auto-generated from PFont.xml ) - - PFont is the font class for Processing.
-
-
PFont(Font, boolean, char[]) - Constructor for class processing.core.PFont
-
-
Create a new image-based font on the fly.
-
-
PFont(Font, boolean, char[], boolean) - Constructor for class processing.core.PFont
-
-
Adds an additional parameter that indicates the font came from a file, - not a built-in OS font.
-
-
PFont(InputStream) - Constructor for class processing.core.PFont
-
 
-
PFont.Glyph - Class in processing.core
-
-
A single character, and its visage.
-
-
PGL - Class in processing.opengl
-
-
Processing-OpenGL abstraction layer.
-
-
PGL() - Constructor for class processing.opengl.PGL
-
 
-
PGL(PGraphicsOpenGL) - Constructor for class processing.opengl.PGL
-
 
-
pgl - Variable in class processing.opengl.PGraphicsOpenGL
-
-
Interface between Processing and OpenGL
-
-
PGraphics - Class in processing.core
-
-
( begin auto-generated from PGraphics.xml ) - - Main graphics and rendering context, as well as the base API - implementation for processing "core".
-
-
PGraphics() - Constructor for class processing.core.PGraphics
-
 
-
PGraphics2D - Class in processing.opengl
-
 
-
PGraphics2D() - Constructor for class processing.opengl.PGraphics2D
-
 
-
PGraphics3D - Class in processing.opengl
-
 
-
PGraphics3D() - Constructor for class processing.opengl.PGraphics3D
-
 
-
PGraphicsDanger2D - Class in processing.core
-
-
Experimental/enhanced renderer that draws directly to the Graphics context - without an intermediate image.
-
-
PGraphicsDanger2D() - Constructor for class processing.core.PGraphicsDanger2D
-
 
-
PGraphicsFX2D - Class in processing.core
-
 
-
PGraphicsFX2D() - Constructor for class processing.core.PGraphicsFX2D
-
 
-
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
-
-
OpenGL renderer.
-
-
PGraphicsOpenGL() - Constructor for class processing.opengl.PGraphicsOpenGL
-
 
-
PI - Static variable in interface processing.core.PConstants
-
-
( begin auto-generated from PI.xml ) - - PI is a mathematical constant with the value 3.14159265358979323846.
-
-
PIE - Static variable in interface processing.core.PConstants
-
 
-
PImage - Class in processing.core
-
-
( begin auto-generated from PImage.xml ) - - Datatype for storing images.
-
-
PImage() - Constructor for class processing.core.PImage
-
-
( begin auto-generated from PImage.xml ) - - Datatype for storing images.
-
-
PImage(int, int) - Constructor for class processing.core.PImage
-
 
-
PImage(int, int, int) - Constructor for class processing.core.PImage
-
 
-
PImage(int, 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
-
 
-
pixelDensity(int) - Method in class processing.core.PApplet
-
 
-
pixelDensity - Variable in class processing.core.PImage
-
-
1 for most images, 2 for hi-dpi/retina
-
-
pixelHeight - Variable in class processing.core.PImage
-
 
-
pixels - Variable in class processing.core.PApplet
-
-
( begin auto-generated from pixels.xml ) - - Array containing the values for all the pixels in the display window.
-
-
pixels - Variable in class processing.core.PImage
-
-
( begin auto-generated from pixels.xml ) - - Array containing the values for all the pixels in the display window.
-
-
pixelStorei(int, int) - Method in class processing.opengl.PGL
-
 
-
pixelStorei(int, int) - Method in class processing.opengl.PJOGL
-
 
-
pixelWidth - Variable in class processing.core.PImage
-
-
Actual dimensions of pixels array, taking into account the 2x setting.
-
-
PJOGL - Class in processing.opengl
-
 
-
PJOGL(PGraphicsOpenGL) - Constructor for class processing.opengl.PJOGL
-
 
-
placePresent(int) - Method in interface processing.core.PSurface
-
 
-
placePresent(int) - Method in class processing.core.PSurfaceAWT
-
 
-
placePresent(int) - Method in class processing.core.PSurfaceFX
-
 
-
placePresent(int) - Method in class processing.core.PSurfaceNone
-
 
-
placePresent(int) - Method in class processing.opengl.PSurfaceJOGL
-
 
-
placeWindow(int[], int[]) - Method in interface processing.core.PSurface
-
 
-
placeWindow(int[], int[]) - Method in class processing.core.PSurfaceAWT
-
 
-
placeWindow(int[], int[]) - Method in class processing.core.PSurfaceFX
-
 
-
placeWindow(int[], int[]) - Method in class processing.core.PSurfaceNone
-
 
-
placeWindow(int[], int[]) - Method in class processing.opengl.PSurfaceJOGL
-
 
-
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
-
 
-
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
-
-
( begin auto-generated from pmouseX.xml ) - - The system variable pmouseX always contains the horizontal - position of the mouse in the frame previous to the current frame.
-
- You may find that pmouseX and pmouseY have different - values inside draw() and inside events like mousePressed() - and mouseMoved().
-
-
pmouseY - Variable in class processing.core.PApplet
-
-
( begin auto-generated from pmouseY.xml ) - - The system variable pmouseY always contains the vertical position - of the mouse in the frame previous to the current frame.
-
-
point(float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel.
-
-
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
-
-
( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel.
-
-
point(float, float, float) - Method in class processing.core.PGraphics
-
 
-
point(float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
point(float, float) - Method in class processing.core.PGraphicsJava2D
-
 
-
point(float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
point(float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
POINT_SMOOTH - Static variable in class processing.opengl.PGL
-
 
-
pointLight(float, float, float, float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from pointLight.xml ) - - Adds a point light.
-
-
pointLight(float, float, float, float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from pointLight.xml ) - - Adds a point light.
-
-
pointLight(float, float, float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
pointLight(float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
POINTS - Static variable in interface processing.core.PConstants
-
 
-
POINTS - Static variable in class processing.opengl.PGL
-
 
-
POLYGON - Static variable in interface processing.core.PConstants
-
 
-
POLYGON_OFFSET_FILL - Static variable in class processing.opengl.PGL
-
 
-
POLYGON_SMOOTH - Static variable in class processing.opengl.PGL
-
 
-
polygonOffset(float, float) - Method in class processing.opengl.PGL
-
 
-
polygonOffset(float, float) - Method in class processing.opengl.PJOGL
-
 
-
pop() - Method in class processing.data.FloatList
-
 
-
pop() - Method in class processing.data.IntList
-
 
-
pop() - Method in class processing.data.StringList
-
 
-
popMatrix() - Method in class processing.core.PApplet
-
-
( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack.
-
-
popMatrix() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack.
-
-
popMatrix() - Method in class processing.core.PGraphicsFX2D
-
 
-
popMatrix() - Method in class processing.core.PGraphicsJava2D
-
 
-
popMatrix() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
popProjection() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
popStyle() - Method in class processing.core.PApplet
-
-
( begin auto-generated from popStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings; these functions are - always used together.
-
-
popStyle() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from popStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings; these functions are - always used together.
-
-
popStyle() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
PORTRAIT - Static variable in interface processing.core.PConstants
-
-
Screen orientation constant for portrait (the hamburger way).
-
-
POSITION - Static variable in class processing.opengl.PShapeOpenGL
-
 
-
POSTERIZE - Static variable in interface processing.core.PConstants
-
 
-
postEvent(Event) - Method in class processing.core.PApplet
-
-
Add an event to the internal event queue, or process it immediately if - the sketch is not currently looping.
-
-
pow(float, float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from pow.xml ) - - Facilitates exponential expressions.
-
-
preApply(PMatrix) - Method in interface processing.core.PMatrix
-
-
Apply another matrix to the left of this one.
-
-
preApply(PMatrix2D) - Method in interface processing.core.PMatrix
-
 
-
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(PMatrix) - Method in class processing.core.PMatrix2D
-
-
Apply another matrix to the left of this one.
-
-
preApply(PMatrix2D) - Method in class processing.core.PMatrix2D
-
 
-
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(PMatrix) - Method in class processing.core.PMatrix3D
-
-
Apply another matrix to the left of this one.
-
-
preApply(PMatrix3D) - Method in class processing.core.PMatrix3D
-
 
-
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
-
 
-
presentMode - Variable in class processing.opengl.PGL
-
 
-
PRESS - Static variable in class processing.event.KeyEvent
-
 
-
PRESS - Static variable in class processing.event.MouseEvent
-
 
-
primaryPGL - Variable in class processing.opengl.PGL
-
-
true if this is the GL interface for a primary surface PGraphics
-
-
PRIMITIVE - Static variable in class processing.core.PShape
-
-
A line, ellipse, arc, image, etc.
-
-
print(byte) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from print.xml ) - - Writes to the console area of the Processing environment.
-
-
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(long) - Static method in class processing.core.PApplet
-
 
-
print(float) - Static method in class processing.core.PApplet
-
 
-
print(double) - 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.
-
-
print() - Method in class processing.data.FloatDict
-
 
-
print() - Method in class processing.data.FloatList
-
 
-
print() - Method in class processing.data.IntDict
-
 
-
print() - Method in class processing.data.IntList
-
 
-
print() - Method in class processing.data.StringDict
-
 
-
print() - Method in class processing.data.StringList
-
 
-
printArray(Object) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from printArray.xml ) - - To come...
-
-
printCamera() - Method in class processing.core.PApplet
-
-
( begin auto-generated from printCamera.xml ) - - Prints the current camera matrix to the Console (the text window at the - bottom of Processing).
-
-
printCamera() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from printCamera.xml ) - - Prints the current camera matrix to the Console (the text window at the - bottom of Processing).
-
-
printCamera() - Method in class processing.opengl.PGraphicsOpenGL
-
-
Print the current camera matrix.
-
-
println() - Static method in class processing.core.PApplet
-
-
( begin auto-generated from println.xml ) - - Writes to the text area of the Processing environment's console.
-
-
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(long) - Static method in class processing.core.PApplet
-
 
-
println(float) - Static method in class processing.core.PApplet
-
 
-
println(double) - 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(Object) - Static method in class processing.core.PApplet
-
-
For arrays, use printArray() instead.
-
-
printMatrix() - Method in class processing.core.PApplet
-
-
( begin auto-generated from printMatrix.xml ) - - Prints the current matrix to the Console (the text window at the bottom - of Processing).
-
-
printMatrix() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from printMatrix.xml ) - - Prints the current matrix to the Console (the text window at the bottom - of Processing).
-
-
printMatrix() - Method in class processing.core.PGraphicsFX2D
-
 
-
printMatrix() - Method in class processing.core.PGraphicsJava2D
-
 
-
printMatrix() - Method in class processing.opengl.PGraphicsOpenGL
-
-
Print the current model (or "transformation") matrix.
-
-
printProjection() - Method in class processing.core.PApplet
-
-
( begin auto-generated from printProjection.xml ) - - Prints the current projection matrix to the Console (the text window at - the bottom of Processing).
-
-
printProjection() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from printProjection.xml ) - - Prints the current projection matrix to the Console (the text window at - the bottom of Processing).
-
-
printProjection() - Method in class processing.opengl.PGraphicsOpenGL
-
-
Print the current projection matrix.
-
-
PROBLEM - Static variable in interface processing.core.PConstants
-
 
-
processing.core - package processing.core
-
 
-
processing.data - package processing.data
-
 
-
processing.event - package processing.event
-
 
-
processing.opengl - package processing.opengl
-
 
-
PROFILE - Static variable in class processing.opengl.PJOGL
-
 
-
profile - Static variable in class processing.opengl.PJOGL
-
-
Selected GL profile
-
-
profile - Static variable in class processing.opengl.PSurfaceJOGL
-
-
Selected GL profile
-
-
PROJECT - Static variable in interface processing.core.PConstants
-
 
-
PROJECTION - Static variable in interface processing.core.PConstants
-
 
-
projection - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
projmodelview - Variable in class processing.opengl.PGraphicsOpenGL
-
 
-
PShader - Class in processing.opengl
-
-
This class encapsulates a GLSL shader program, including a vertex - and a fragment shader.
-
-
PShader() - Constructor for class processing.opengl.PShader
-
 
-
PShader(PApplet) - Constructor for class processing.opengl.PShader
-
 
-
PShader(PApplet, String, String) - Constructor for class processing.opengl.PShader
-
-
Creates a shader program using the specified vertex and fragment - shaders.
-
-
PShader(PApplet, URL, URL) - Constructor for class processing.opengl.PShader
-
 
-
PShader(PApplet, String[], String[]) - Constructor for class processing.opengl.PShader
-
 
-
PShape - Class in processing.core
-
-
( begin auto-generated from PShape.xml ) - - Datatype for storing shapes.
-
-
PShape() - Constructor for class processing.core.PShape
-
 
-
PShape(int) - Constructor for class processing.core.PShape
-
 
-
PShape(PGraphics, int) - Constructor for class processing.core.PShape
-
 
-
PShape(PGraphics, int, float...) - Constructor for class processing.core.PShape
-
 
-
PShapeOBJ - Class in processing.core
-
-
This class is not part of the Processing API and should not be used - directly.
-
-
PShapeOBJ(PApplet, String) - Constructor for class processing.core.PShapeOBJ
-
-
Initializes a new OBJ Object with the given filename.
-
-
PShapeOBJ(PApplet, BufferedReader) - Constructor for class processing.core.PShapeOBJ
-
 
-
PShapeOBJ(PApplet, BufferedReader, String) - Constructor for class processing.core.PShapeOBJ
-
 
-
PShapeOpenGL - Class in processing.opengl
-
-
This class holds a 3D model composed of vertices, normals, colors - (per vertex) and texture coordinates (also per vertex).
-
-
PShapeOpenGL(PGraphicsOpenGL, int) - Constructor for class processing.opengl.PShapeOpenGL
-
 
-
PShapeOpenGL(PGraphicsOpenGL, int, float...) - Constructor for class processing.opengl.PShapeOpenGL
-
-
Create a shape from the PRIMITIVE family, using this kind and these params
-
-
PShapeSVG - Class in processing.core
-
-
This class is not part of the Processing API and should not be used - directly.
-
-
PShapeSVG(XML) - Constructor for class processing.core.PShapeSVG
-
-
Initializes a new SVG Object from the given XML.
-
-
PShapeSVG.Font - Class in processing.core
-
 
-
PShapeSVG.FontGlyph - Class in processing.core
-
 
-
PStyle - Class in processing.core
-
 
-
PStyle() - Constructor for class processing.core.PStyle
-
 
-
PSurface - Interface in processing.core
-
 
-
PSurfaceAWT - Class in processing.core
-
 
-
PSurfaceAWT(PGraphics) - Constructor for class processing.core.PSurfaceAWT
-
 
-
PSurfaceDanger - Class in processing.core
-
 
-
PSurfaceDanger(PGraphics) - Constructor for class processing.core.PSurfaceDanger
-
 
-
PSurfaceFX - Class in processing.core
-
 
-
PSurfaceFX(PGraphicsFX2D) - Constructor for class processing.core.PSurfaceFX
-
 
-
PSurfaceFX.PApplicationFX - Class in processing.core
-
 
-
PSurfaceJOGL - Class in processing.opengl
-
 
-
PSurfaceJOGL(PGraphics) - Constructor for class processing.opengl.PSurfaceJOGL
-
 
-
PSurfaceNone - Class in processing.core
-
-
Surface that's not really visible.
-
-
PSurfaceNone(PGraphics) - Constructor for class processing.core.PSurfaceNone
-
 
-
push(float) - Method in class processing.data.FloatList
-
-
Just an alias for append(), but matches pop()
-
-
push(int) - Method in class processing.data.IntList
-
-
Just an alias for append(), but matches pop()
-
-
push(String) - Method in class processing.data.StringList
-
-
Just an alias for append(), but matches pop()
-
-
pushMatrix() - Method in class processing.core.PApplet
-
-
( begin auto-generated from pushMatrix.xml ) - - Pushes the current transformation matrix onto the matrix stack.
-
-
pushMatrix() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from pushMatrix.xml ) - - Pushes the current transformation matrix onto the matrix stack.
-
-
pushMatrix() - Method in class processing.core.PGraphicsFX2D
-
 
-
pushMatrix() - Method in class processing.core.PGraphicsJava2D
-
 
-
pushMatrix() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
pushProjection() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
pushStyle() - Method in class processing.core.PApplet
-
-
( begin auto-generated from pushStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings.
-
-
pushStyle() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from pushStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings.
-
-
put(Texture) - Method in class processing.opengl.Texture
-
 
-
put(Texture, int, int, int, int) - Method in class processing.opengl.Texture
-
 
-
put(int, int, int, int, int, int) - Method in class processing.opengl.Texture
-
 
-
put(int, int, int, int, int, int, int, int, int, int) - Method in class processing.opengl.Texture
-
 
-
PVector - Class in processing.core
-
-
( begin auto-generated from PVector.xml ) - - 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
-
-
( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon.
-
-
QUAD - Static variable in interface processing.core.PConstants
-
 
-
quad(float, float, float, float, float, float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon.
-
-
quad(float, float, float, float, float, float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
quad(float, float, float, float, float, float, float, float) - Method in class processing.core.PGraphicsJava2D
-
 
-
quad(float, float, float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
QUAD_BEZIER_VERTEX - Static variable in interface processing.core.PConstants
-
-
Deprecated.
-
-
QUAD_STRIP - Static variable in interface processing.core.PConstants
-
 
-
QUADRATIC_VERTEX - Static variable in interface processing.core.PConstants
-
 
-
quadraticVertex(float, float, float, float) - Method in class processing.core.PApplet
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class processing.core.PApplet
-
 
-
quadraticVertex(float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
quadraticVertex(float, float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
quadraticVertex(float, float, float, float) - Method in class processing.core.PGraphicsJava2D
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class processing.core.PGraphicsJava2D
-
 
-
quadraticVertex(float, float, float, float) - Method in class processing.core.PShape
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class processing.core.PShape
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
quadraticVertex(float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
quadraticVertex(float, float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
QUADS - Static variable in interface processing.core.PConstants
-
 
-
QUARTER_PI - Static variable in interface processing.core.PConstants
-
-
( begin auto-generated from QUARTER_PI.xml ) - - QUARTER_PI is a mathematical constant with the value 0.7853982.
-
-
- - - -

R

-
-
R - Static variable in class processing.core.PGraphics
-
 
-
RAD_TO_DEG - Static variable in interface processing.core.PConstants
-
 
-
radians(float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from radians.xml ) - - Converts a degree measurement to its corresponding value in radians.
-
-
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
-
 
-
random(float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from random.xml ) - - Generates random numbers.
-
-
random2D() - Static method in class processing.core.PVector
-
-
( begin auto-generated from PVector_random2D.xml ) - - Make a new 2D unit vector with a random direction.
-
-
random2D(PApplet) - Static method in class processing.core.PVector
-
-
Make a new 2D unit vector with a random direction - using Processing's current random number generator
-
-
random2D(PVector) - Static method in class processing.core.PVector
-
-
Set a 2D vector to a random unit vector with a random direction
-
-
random2D(PVector, PApplet) - Static method in class processing.core.PVector
-
-
Make a new 2D unit vector with a random direction.
-
-
random3D() - Static method in class processing.core.PVector
-
-
( begin auto-generated from PVector_random3D.xml ) - - Make a new 3D unit vector with a random direction.
-
-
random3D(PApplet) - Static method in class processing.core.PVector
-
-
Make a new 3D unit vector with a random direction - using Processing's current random number generator
-
-
random3D(PVector) - Static method in class processing.core.PVector
-
-
Set a 3D vector to a random unit vector with a random direction
-
-
random3D(PVector, PApplet) - Static method in class processing.core.PVector
-
-
Make a new 3D unit vector with a random direction
-
-
randomGaussian() - Method in class processing.core.PApplet
-
-
( begin auto-generated from randomGaussian.xml ) - - Returns a float from a random series of numbers having a mean of 0 - and standard deviation of 1.
-
-
randomSeed(long) - Method in class processing.core.PApplet
-
-
( begin auto-generated from randomSeed.xml ) - - Sets the seed value for random().
-
-
READ_FRAMEBUFFER - Static variable in class processing.opengl.PGL
-
 
-
READ_ONLY - Static variable in class processing.opengl.PGL
-
 
-
READ_WRITE - Static variable in class processing.opengl.PGL
-
 
-
readBuffer(int) - Method in class processing.opengl.PGL
-
 
-
readBuffer(int) - Method in class processing.opengl.PJOGL
-
 
-
readPixels() - Method in class processing.opengl.FrameBuffer
-
 
-
readPixels(int, int, int, int, int, int, Buffer) - Method in class processing.opengl.PGL
-
 
-
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
-
-
( begin auto-generated from rect.xml ) - - Draws a rectangle to the screen.
-
-
rect(float, float, float, float, float) - Method in class processing.core.PApplet
-
 
-
rect(float, float, float, float, 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
-
-
( begin auto-generated from rect.xml ) - - Draws a rectangle to the screen.
-
-
rect(float, float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
rect(float, float, float, float, float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
rectMode(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from rectMode.xml ) - - Modifies the location from which rectangles draw.
-
-
rectMode - Variable in class processing.core.PGraphics
-
-
The current rect mode (read-only)
-
-
rectMode(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from rectMode.xml ) - - Modifies the location from which rectangles draw.
-
-
rectMode - Variable in class processing.core.PStyle
-
 
-
red(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from red.xml ) - - Extracts the red value from a color, scaled to match current - colorMode().
-
-
red(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from red.xml ) - - Extracts the red value from a color, scaled to match current - colorMode().
-
-
RED_MASK - Static variable in class processing.core.PImage
-
 
-
redraw() - Method in class processing.core.PApplet
-
-
( begin auto-generated from redraw.xml ) - - Executes the code within draw() one time.
-
-
registerMethod(String, Object) - Method in class processing.core.PApplet
-
-
Register a built-in event so that it can be fired for libraries, etc.
-
-
RELEASE - Static variable in class processing.event.KeyEvent
-
 
-
RELEASE - Static variable in class processing.event.MouseEvent
-
 
-
releaseShaderCompiler() - Method in class processing.opengl.PGL
-
 
-
releaseShaderCompiler() - Method in class processing.opengl.PJOGL
-
 
-
remove(String) - Method in class processing.data.FloatDict
-
 
-
remove(int) - Method in class processing.data.FloatList
-
-
Remove an element from the specified index.
-
-
remove(String) - Method in class processing.data.IntDict
-
 
-
remove(int) - Method in class processing.data.IntList
-
-
Remove an element from the specified index
-
-
remove(int) - Method in class processing.data.JSONArray
-
-
Remove an index and close the hole.
-
-
remove(String) - Method in class processing.data.JSONObject
-
-
Remove a name and its value, if present.
-
-
remove(String) - Method in class processing.data.StringDict
-
 
-
remove(int) - Method in class processing.data.StringList
-
-
Remove an element from the specified index.
-
-
removeCache(PImage) - Method in class processing.core.PGraphics
-
-
Remove information associated with this renderer from the cache, if any.
-
-
removeCache(PImage) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
removeChild(int) - Method in class processing.core.PShape
-
-
Remove the child shape with index idx.
-
-
removeChild(XML) - Method in class processing.data.XML
-
 
-
removeChild(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
removeColumn(String) - Method in class processing.data.Table
-
 
-
removeColumn(int) - Method in class processing.data.Table
-
 
-
removeIndex(int) - Method in class processing.data.FloatDict
-
 
-
removeIndex(int) - Method in class processing.data.IntDict
-
 
-
removeIndex(int) - Method in class processing.data.StringDict
-
 
-
removeRow(int) - Method in class processing.data.Table
-
 
-
removeTitleRow() - Method in class processing.data.Table
-
-
Deprecated.
-
-
removeTokens(String) - Method in class processing.data.Table
-
-
Remove any of the specified characters from the entire table.
-
-
removeTokens(String, int) - Method in class processing.data.Table
-
-
Removed any of the specified characters from a column.
-
-
removeTokens(String, String) - Method in class processing.data.Table
-
 
-
removeValue(int) - Method in class processing.data.FloatList
-
 
-
removeValue(int) - Method in class processing.data.IntList
-
 
-
removeValue(String) - Method in class processing.data.StringList
-
 
-
removeValues(int) - Method in class processing.data.FloatList
-
 
-
removeValues(int) - Method in class processing.data.IntList
-
 
-
removeValues(String) - Method in class processing.data.StringList
-
 
-
RENDERBUFFER - Static variable in class processing.opengl.PGL
-
 
-
RENDERBUFFER_ALPHA_SIZE - Static variable in class processing.opengl.PGL
-
 
-
RENDERBUFFER_BLUE_SIZE - Static variable in class processing.opengl.PGL
-
 
-
RENDERBUFFER_DEPTH_SIZE - Static variable in class processing.opengl.PGL
-
 
-
RENDERBUFFER_GREEN_SIZE - Static variable in class processing.opengl.PGL
-
 
-
RENDERBUFFER_HEIGHT - Static variable in class processing.opengl.PGL
-
 
-
RENDERBUFFER_INTERNAL_FORMAT - Static variable in class processing.opengl.PGL
-
 
-
RENDERBUFFER_RED_SIZE - Static variable in class processing.opengl.PGL
-
 
-
RENDERBUFFER_STENCIL_SIZE - Static variable in class processing.opengl.PGL
-
 
-
RENDERBUFFER_WIDTH - Static variable in class processing.opengl.PGL
-
 
-
renderbufferStorage(int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
renderbufferStorage(int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
renderbufferStorageMultisample(int, int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
renderbufferStorageMultisample(int, int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
RENDERER - Static variable in class processing.opengl.PGL
-
 
-
REPEAT - Static variable in interface processing.core.PConstants
-
-
textures wrap around when uv values go outside 0..1 range
-
-
REPEAT - Static variable in class processing.opengl.PGL
-
 
-
REPLACE - Static variable in interface processing.core.PConstants
-
 
-
replace(String, String) - Method in class processing.data.Table
-
-
Replace a String with another.
-
-
replace(String, String, int) - Method in class processing.data.Table
-
 
-
replace(String, String, String) - Method in class processing.data.Table
-
 
-
REPLACE - Static variable in class processing.opengl.PGL
-
 
-
replaceAll(String, String) - Method in class processing.data.Table
-
 
-
replaceAll(String, String, int) - Method in class processing.data.Table
-
 
-
replaceAll(String, String, String) - Method in class processing.data.Table
-
-
Run String.replaceAll() on all entries in a column.
-
-
replaceValue(float, float) - Method in class processing.data.FloatList
-
-
Replace the first instance of a particular value
-
-
replaceValue(String, String) - Method in class processing.data.StringList
-
 
-
replaceValues(float, float) - Method in class processing.data.FloatList
-
-
Replace all instances of a particular value
-
-
replaceValues(String, String) - Method in class processing.data.StringList
-
 
-
reqNumSamples - Variable in class processing.opengl.PGL
-
 
-
REQUESTED_ALPHA_BITS - Static variable in class processing.opengl.PGL
-
 
-
REQUESTED_DEPTH_BITS - Static variable in class processing.opengl.PGL
-
 
-
REQUESTED_STENCIL_BITS - Static variable in class processing.opengl.PGL
-
 
-
requestFBOLayer() - Method in class processing.opengl.PGL
-
 
-
requestFocus() - Method in class processing.opengl.PSurfaceJOGL
-
 
-
requestImage(String) - Method in class processing.core.PApplet
-
 
-
requestImage(String, String) - Method in class processing.core.PApplet
-
-
( begin auto-generated from requestImage.xml ) - - This function load images on a separate thread so that your sketch does - not freeze while images load during setup().
-
-
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 interface processing.core.PMatrix
-
 
-
reset() - Method in class processing.core.PMatrix2D
-
 
-
reset() - Method in class processing.core.PMatrix3D
-
 
-
reset() - Method in class processing.opengl.LinePath
-
-
Resets the path to empty.
-
-
resetMatrix() - Method in class processing.core.PApplet
-
-
( begin auto-generated from resetMatrix.xml ) - - Replaces the current matrix with the identity matrix.
-
-
resetMatrix() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from resetMatrix.xml ) - - Replaces the current matrix with the identity matrix.
-
-
resetMatrix() - Method in class processing.core.PGraphicsFX2D
-
 
-
resetMatrix() - Method in class processing.core.PGraphicsJava2D
-
 
-
resetMatrix() - Method in class processing.core.PShape
-
-
( begin auto-generated from PShape_resetMatrix.xml ) - - Replaces the current matrix of a shape with the identity matrix.
-
-
resetMatrix() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
resetMatrix() - Method in class processing.opengl.PShapeOpenGL
-
 
-
resetProjection() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
resetShader() - Method in class processing.core.PApplet
-
-
( begin auto-generated from resetShader.xml ) - - This is a new reference entry for Processing 2.0.
-
-
resetShader(int) - Method in class processing.core.PApplet
-
 
-
resetShader() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from resetShader.xml ) - - This is a new reference entry for Processing 2.0.
-
-
resetShader(int) - Method in class processing.core.PGraphics
-
 
-
resetShader() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
resetShader(int) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
resize(int, int) - Method in class processing.core.PImage
-
-
( begin auto-generated from PImage_resize.xml ) - - Resize the image to a new width and height.
-
-
resize(int) - Method in class processing.data.FloatList
-
 
-
resize(int) - Method in class processing.data.IntList
-
 
-
resize(int) - Method in class processing.data.StringList
-
 
-
resize(int, int) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
resize(int, int) - Method in class processing.opengl.Texture
-
 
-
resume() - Method in class processing.core.PApplet
-
-
Sketch has resumed.
-
-
resumeThread() - Method in interface processing.core.PSurface
-
 
-
resumeThread() - Method in class processing.core.PSurfaceFX
-
 
-
resumeThread() - Method in class processing.core.PSurfaceNone
-
 
-
resumeThread() - Method in class processing.opengl.PSurfaceJOGL
-
 
-
RETINA - Static variable in class processing.opengl.PJOGL
-
 
-
RETURN - Static variable in interface processing.core.PConstants
-
 
-
reverse(boolean[]) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from reverse.xml ) - - Reverses the order of an array.
-
-
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
-
 
-
reverse() - Method in class processing.data.FloatList
-
 
-
reverse() - Method in class processing.data.IntList
-
 
-
reverse() - Method in class processing.data.StringList
-
 
-
RGB - Static variable in interface processing.core.PConstants
-
 
-
RGB - Static variable in class processing.opengl.PGL
-
 
-
RGB565 - Static variable in class processing.opengl.PGL
-
 
-
RGB5_A1 - Static variable in class processing.opengl.PGL
-
 
-
RGB8 - Static variable in class processing.opengl.PGL
-
 
-
RGBA - Static variable in class processing.opengl.PGL
-
 
-
RGBA4 - Static variable in class processing.opengl.PGL
-
 
-
RGBA8 - Static variable in class processing.opengl.PGL
-
 
-
RIGHT - Static variable in interface processing.core.PConstants
-
 
-
rotate(float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter.
-
-
rotate(float, float, float, float) - Method in class processing.core.PApplet
-
-
Advanced
-
-
rotate(float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter.
-
-
rotate(float, float, float, float) - Method in class processing.core.PGraphics
-
-
Advanced
-
-
rotate(float) - Method in class processing.core.PGraphicsFX2D
-
 
-
rotate(float, float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
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
-
-
( begin auto-generated from PShape_rotate.xml ) - - Rotates a shape the amount specified by the angle parameter.
-
-
rotate(float, float, float, float) - Method in class processing.core.PShape
-
 
-
rotate(float) - Method in class processing.core.PVector
-
-
( begin auto-generated from PVector_rotate.xml ) - - Rotate the vector by an angle (only 2D vectors), magnitude remains the same - - ( end auto-generated )
-
-
rotate(float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
rotate(float) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Two dimensional rotation.
-
-
rotate(float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Rotate around an arbitrary vector, similar to glRotate(), except that it - takes radians (instead of degrees).
-
-
rotate(float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
rotate(float, float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
rotateX(float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter.
-
-
rotateX(float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter.
-
-
rotateX(float) - Method in class processing.core.PGraphicsFX2D
-
 
-
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
-
-
( begin auto-generated from PShape_rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter.
-
-
rotateX(float) - Method in class processing.opengl.PGraphics2D
-
 
-
rotateX(float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
rotateX(float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
rotateY(float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter.
-
-
rotateY(float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter.
-
-
rotateY(float) - Method in class processing.core.PGraphicsFX2D
-
 
-
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
-
-
( begin auto-generated from PShape_rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter.
-
-
rotateY(float) - Method in class processing.opengl.PGraphics2D
-
 
-
rotateY(float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
rotateY(float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
rotateZ(float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter.
-
-
rotateZ(float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter.
-
-
rotateZ(float) - Method in class processing.core.PGraphicsFX2D
-
 
-
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
-
-
( begin auto-generated from PShape_rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter.
-
-
rotateZ(float) - Method in class processing.opengl.PGraphics2D
-
 
-
rotateZ(float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
rotateZ(float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
round(float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from round.xml ) - - Calculates the integer closest to the value parameter.
-
-
ROUND - Static variable in interface processing.core.PConstants
-
 
-
rows() - Method in class processing.data.Table
-
-
Note that this one iterator instance is shared by any calls to iterate - the rows of this table.
-
-
rows(int[]) - Method in class processing.data.Table
-
 
-
run() - Method in class processing.data.Sort
-
 
-
runSketch(String[], PApplet) - Static method in class processing.core.PApplet
-
 
-
- - - -

S

-
-
SA - Static variable in class processing.core.PGraphics
-
 
-
SAMPLE_ALPHA_TO_COVERAGE - Static variable in class processing.opengl.PGL
-
 
-
SAMPLE_COVERAGE - Static variable in class processing.opengl.PGL
-
 
-
sampleCoverage(float, boolean) - Method in class processing.opengl.PGL
-
 
-
sampleCoverage(float, boolean) - Method in class processing.opengl.PJOGL
-
 
-
SAMPLER_2D - Static variable in class processing.opengl.PGL
-
 
-
SAMPLER_CUBE - Static variable in class processing.opengl.PGL
-
 
-
SAMPLES - Static variable in class processing.opengl.PGL
-
 
-
sampling - Variable in class processing.opengl.Texture.Parameters
-
-
Texture filtering (POINT, LINEAR, BILINEAR or TRILINEAR).
-
-
saturation(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from saturation.xml ) - - Extracts the saturation value from a color.
-
-
saturation(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from saturation.xml ) - - Extracts the saturation value from a color.
-
-
save(String) - Method in class processing.core.PApplet
-
-
( begin auto-generated from save.xml ) - - Saves an image from the display window.
-
-
save(OutputStream) - Method in class processing.core.PFont
-
-
Write this PFont to an OutputStream.
-
-
save(String) - Method in class processing.core.PGraphicsDanger2D
-
 
-
save(String) - Method in class processing.core.PImage
-
-
( begin auto-generated from PImage_save.xml ) - - Saves the image into a file.
-
-
save(File, String) - Method in class processing.data.JSONArray
-
 
-
save(File, String) - Method in class processing.data.JSONObject
-
 
-
save(File, String) - Method in class processing.data.Table
-
 
-
save(OutputStream, String) - Method in class processing.data.Table
-
 
-
save(File) - Method in class processing.data.XML
-
 
-
save(File, String) - Method in class processing.data.XML
-
 
-
save(String) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
saveBytes(String, byte[]) - Method in class processing.core.PApplet
-
-
( begin auto-generated from saveBytes.xml ) - - Opposite of loadBytes(), will write an entire array of bytes to a - file.
-
-
saveBytes(File, byte[]) - Static method in class processing.core.PApplet
-
 
-
saveBytes(OutputStream, byte[]) - Static method in class processing.core.PApplet
-
 
-
saveFile(String) - Method in class processing.core.PApplet
-
-
Identical to savePath(), but returns a File object.
-
-
saveFrame() - Method in class processing.core.PApplet
-
 
-
saveFrame(String) - Method in class processing.core.PApplet
-
-
( begin auto-generated from saveFrame.xml ) - - Saves a numbered sequence of images, one image each time the function is - run.
-
-
saveJSONArray(JSONArray, String) - Method in class processing.core.PApplet
-
 
-
saveJSONArray(JSONArray, String, String) - Method in class processing.core.PApplet
-
 
-
saveJSONObject(JSONObject, String) - Method in class processing.core.PApplet
-
 
-
saveJSONObject(JSONObject, String, String) - Method in class processing.core.PApplet
-
 
-
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
-
-
( begin auto-generated from saveStream.xml ) - - 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(String, InputStream) - Method in class processing.core.PApplet
-
 
-
saveStream(File, InputStream) - Static method in class processing.core.PApplet
-
 
-
saveStream(OutputStream, InputStream) - Static method in class processing.core.PApplet
-
 
-
saveStrings(String, String[]) - Method in class processing.core.PApplet
-
-
( begin auto-generated from saveStrings.xml ) - - Writes an array of strings to a file, one line per string.
-
-
saveStrings(File, String[]) - Static method in class processing.core.PApplet
-
 
-
saveStrings(OutputStream, String[]) - Static method in class processing.core.PApplet
-
 
-
saveTable(Table, String) - Method in class processing.core.PApplet
-
 
-
saveTable(Table, String, String) - Method in class processing.core.PApplet
-
 
-
saveXML(XML, String) - Method in class processing.core.PApplet
-
 
-
saveXML(XML, String, String) - Method in class processing.core.PApplet
-
 
-
SB - Static variable in class processing.core.PGraphics
-
 
-
scale(float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices.
-
-
scale(float, float) - Method in class processing.core.PApplet
-
-
Advanced
-
-
scale(float, float, float) - Method in class processing.core.PApplet
-
 
-
scale(float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices.
-
-
scale(float, float) - Method in class processing.core.PGraphics
-
-
Advanced
-
-
scale(float, float, float) - Method in class processing.core.PGraphics
-
 
-
scale(float) - Method in class processing.core.PGraphicsFX2D
-
 
-
scale(float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
scale(float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
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
-
-
( begin auto-generated from PShape_scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices.
-
-
scale(float, float) - Method in class processing.core.PShape
-
 
-
scale(float, float, float) - Method in class processing.core.PShape
-
 
-
scale(float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
scale(float) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Same as scale(s, s, s).
-
-
scale(float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Same as scale(sx, sy, 1).
-
-
scale(float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Scale in three dimensions.
-
-
scale(float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
scale(float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
scale(float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
scissor(int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
scissor(int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
SCISSOR_TEST - Static variable in class processing.opengl.PGL
-
 
-
SCREEN - Static variable in interface processing.core.PConstants
-
 
-
screenX(float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen.
-
-
screenX(float, float, float) - Method in class processing.core.PApplet
-
 
-
screenX(float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen.
-
-
screenX(float, float, float) - Method in class processing.core.PGraphics
-
 
-
screenX(float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
screenX(float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
screenX(float, float) - Method in class processing.core.PGraphicsJava2D
-
 
-
screenX(float, float, float) - Method in class processing.core.PGraphicsJava2D
-
 
-
screenX(float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
screenX(float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
screenX(float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
screenY(float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen.
-
-
screenY(float, float, float) - Method in class processing.core.PApplet
-
 
-
screenY(float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen.
-
-
screenY(float, float, float) - Method in class processing.core.PGraphics
-
 
-
screenY(float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
screenY(float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
screenY(float, float) - Method in class processing.core.PGraphicsJava2D
-
 
-
screenY(float, float, float) - Method in class processing.core.PGraphicsJava2D
-
 
-
screenY(float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
screenY(float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
screenY(float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
screenZ(float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen.
-
-
screenZ(float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen.
-
-
screenZ(float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
screenZ(float, float, float) - Method in class processing.core.PGraphicsJava2D
-
 
-
screenZ(float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
screenZ(float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
second() - Static method in class processing.core.PApplet
-
-
( begin auto-generated from second.xml ) - - Processing communicates with the clock on your computer.
-
-
SEG_CLOSE - Static variable in class processing.opengl.LinePath
-
-
Closes segment at current position.
-
-
SEG_LINETO - Static variable in class processing.opengl.LinePath
-
-
Extends segment by adding a line to a given position.
-
-
SEG_MOVETO - Static variable in class processing.opengl.LinePath
-
-
Starts segment at a given position.
-
-
selectFolder(String, String) - Method in class processing.core.PApplet
-
-
See selectInput() for details.
-
-
selectFolder(String, String, File) - Method in class processing.core.PApplet
-
 
-
selectFolder(String, String, File, Object) - Method in class processing.core.PApplet
-
 
-
selectFolder(String, String, File, Object, Frame) - Static method in class processing.core.PApplet
-
 
-
selectInput(String, String) - Method in class processing.core.PApplet
-
-
Open a platform-specific file chooser dialog to select a file for input.
-
-
selectInput(String, String, File) - Method in class processing.core.PApplet
-
 
-
selectInput(String, String, File, Object) - Method in class processing.core.PApplet
-
 
-
selectInput(String, String, File, Object, Frame) - Static method in class processing.core.PApplet
-
 
-
selectOutput(String, String) - Method in class processing.core.PApplet
-
-
See selectInput() for details.
-
-
selectOutput(String, String, File) - Method in class processing.core.PApplet
-
 
-
selectOutput(String, String, File, Object) - Method in class processing.core.PApplet
-
 
-
selectOutput(String, String, File, Object, Frame) - Static method in class processing.core.PApplet
-
 
-
set(int, int, int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
-
- The x and y parameters specify the pixel to change and the - color parameter specifies the color value.
-
-
set(int, int, PImage) - Method in class processing.core.PApplet
-
-
Advanced
-
-
set(int, int, int) - Method in class processing.core.PGraphicsDanger2D
-
 
-
set(int, int, PImage) - Method in class processing.core.PGraphicsDanger2D
-
 
-
set(int, int, int) - Method in class processing.core.PGraphicsJava2D
-
 
-
set(int, int, int) - Method in class processing.core.PImage
-
-
( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
-
- The x and y parameters specify the pixel to change and the - color parameter specifies the color value.
-
-
set(int, int, PImage) - Method in class processing.core.PImage
-
-
Advanced
-
-
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
-
-
( begin auto-generated from PVector_set.xml ) - - Sets the x, y, and z component of the vector using two or three separate - variables, the data from a PVector, or the values from a float array.
-
-
set(float, float) - Method in class processing.core.PVector
-
 
-
set(PVector) - Method in class processing.core.PVector
-
 
-
set(float[]) - Method in class processing.core.PVector
-
-
Set the x, y (and maybe z) coordinates using a float[] array as the source.
-
-
set(String, float) - Method in class processing.data.FloatDict
-
 
-
set(int, float) - Method in class processing.data.FloatList
-
-
Set the entry at a particular index.
-
-
set(String, int) - Method in class processing.data.IntDict
-
-
Create a new key/value pair or change the value of one.
-
-
set(int, int) - Method in class processing.data.IntList
-
-
Set the entry at a particular index.
-
-
set(String, String) - Method in class processing.data.StringDict
-
 
-
set(int, String) - Method in class processing.data.StringList
-
-
Set the entry at a particular index.
-
-
set(int, int, int) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
set(String, int) - Method in class processing.opengl.PShader
-
 
-
set(String, int, int) - Method in class processing.opengl.PShader
-
 
-
set(String, int, int, int) - Method in class processing.opengl.PShader
-
 
-
set(String, int, int, int, int) - Method in class processing.opengl.PShader
-
 
-
set(String, float) - Method in class processing.opengl.PShader
-
 
-
set(String, float, float) - Method in class processing.opengl.PShader
-
 
-
set(String, float, float, float) - Method in class processing.opengl.PShader
-
 
-
set(String, float, float, float, float) - Method in class processing.opengl.PShader
-
 
-
set(String, PVector) - Method in class processing.opengl.PShader
-
 
-
set(String, boolean) - Method in class processing.opengl.PShader
-
 
-
set(String, boolean, boolean) - Method in class processing.opengl.PShader
-
 
-
set(String, boolean, boolean, boolean) - Method in class processing.opengl.PShader
-
 
-
set(String, boolean, boolean, boolean, boolean) - Method in class processing.opengl.PShader
-
 
-
set(String, int[]) - Method in class processing.opengl.PShader
-
 
-
set(String, int[], int) - Method in class processing.opengl.PShader
-
 
-
set(String, float[]) - Method in class processing.opengl.PShader
-
 
-
set(String, float[], int) - Method in class processing.opengl.PShader
-
 
-
set(String, boolean[]) - Method in class processing.opengl.PShader
-
 
-
set(String, boolean[], int) - Method in class processing.opengl.PShader
-
 
-
set(String, PMatrix2D) - Method in class processing.opengl.PShader
-
 
-
set(String, PMatrix3D) - Method in class processing.opengl.PShader
-
 
-
set(String, PMatrix3D, boolean) - Method in class processing.opengl.PShader
-
 
-
set(String, PImage) - Method in class processing.opengl.PShader
-
 
-
set(int) - Method in class processing.opengl.Texture.Parameters
-
 
-
set(int, int) - Method in class processing.opengl.Texture.Parameters
-
 
-
set(int, int, boolean) - Method in class processing.opengl.Texture.Parameters
-
 
-
set(Texture.Parameters) - Method in class processing.opengl.Texture.Parameters
-
 
-
set(Texture) - Method in class processing.opengl.Texture
-
 
-
set(Texture, int, int, int, int) - Method in class processing.opengl.Texture
-
 
-
set(int, int, int, int, int, int) - Method in class processing.opengl.Texture
-
 
-
set(int, int, int, int, int, int, int, int, int, int) - Method in class processing.opengl.Texture
-
 
-
set(int[]) - Method in class processing.opengl.Texture
-
 
-
set(int[], int) - Method in class processing.opengl.Texture
-
 
-
set(int[], int, int, int, int) - Method in class processing.opengl.Texture
-
 
-
set(int[], int, int, int, int, int) - Method in class processing.opengl.Texture
-
 
-
set3D(boolean) - Method in class processing.core.PShape
-
 
-
setAmbient - Variable in class processing.core.PGraphics
-
 
-
setAmbient(int) - Method in class processing.core.PShape
-
 
-
setAmbient(int, int) - Method in class processing.core.PShape
-
 
-
setAmbient(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setAmbient(int, int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setAttrib(String, int, float...) - Method in class processing.core.PShape
-
 
-
setAttrib(String, int, int...) - Method in class processing.core.PShape
-
 
-
setAttrib(String, int, boolean...) - Method in class processing.core.PShape
-
 
-
setAttrib(String, int, float...) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setAttrib(String, int, int...) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setAttrib(String, int, boolean...) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setBoolean(int, boolean) - Method in class processing.data.JSONArray
-
-
Put or replace a boolean value in the JSONArray.
-
-
setBoolean(String, boolean) - Method in class processing.data.JSONObject
-
-
Put a key/boolean pair in the JSONObject.
-
-
setBufferSource(Object) - Method in class processing.opengl.Texture
-
 
-
setCache(PImage, Object) - Method in class processing.core.PGraphics
-
-
Store data of some kind for the renderer that requires extra metadata of - some kind.
-
-
setCache(PImage, Object) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
setColorBuffer(Texture) - Method in class processing.opengl.FrameBuffer
-
 
-
setColorBuffers(Texture[]) - Method in class processing.opengl.FrameBuffer
-
 
-
setColorBuffers(Texture[], int) - Method in class processing.opengl.FrameBuffer
-
 
-
setColumnCount(int) - Method in class processing.data.Table
-
-
Change the number of columns in this table.
-
-
setColumnTitle(int, String) - Method in class processing.data.Table
-
 
-
setColumnTitles(String[]) - Method in class processing.data.Table
-
 
-
setColumnType(String, String) - Method in class processing.data.Table
-
 
-
setColumnType(int, String) - Method in class processing.data.Table
-
-
Set the data type for a column so that using it is more efficient.
-
-
setColumnType(String, int) - Method in class processing.data.Table
-
 
-
setColumnType(int, int) - Method in class processing.data.Table
-
-
Sets the column type.
-
-
setColumnTypes(int[]) - Method in class processing.data.Table
-
 
-
setColumnTypes(Table) - Method in class processing.data.Table
-
-
Set the titles (and if a second column is present) the data types for - this table based on a file loaded separately.
-
-
setContent(String) - Method in class processing.data.XML
-
 
-
setCursor(int) - Method in interface processing.core.PSurface
-
 
-
setCursor(PImage, int, int) - Method in interface processing.core.PSurface
-
 
-
setCursor(int) - Method in class processing.core.PSurfaceAWT
-
 
-
setCursor(PImage, int, int) - Method in class processing.core.PSurfaceAWT
-
 
-
setCursor(int) - Method in class processing.core.PSurfaceFX
-
 
-
setCursor(PImage, int, int) - Method in class processing.core.PSurfaceFX
-
 
-
setCursor(int) - Method in class processing.core.PSurfaceNone
-
 
-
setCursor(PImage, int, int) - Method in class processing.core.PSurfaceNone
-
 
-
setCursor(int) - Method in class processing.opengl.PSurfaceJOGL
-
 
-
setCursor(PImage, int, int) - Method in class processing.opengl.PSurfaceJOGL
-
 
-
setDouble(int, double) - Method in class processing.data.JSONArray
-
-
Put or replace a double value.
-
-
setDouble(String, double) - Method in class processing.data.JSONObject
-
-
Put a key/double pair in the JSONObject.
-
-
setDouble(int, int, double) - Method in class processing.data.Table
-
 
-
setDouble(int, String, double) - Method in class processing.data.Table
-
 
-
setDouble(int, double) - Method in interface processing.data.TableRow
-
 
-
setDouble(String, double) - Method in interface processing.data.TableRow
-
 
-
setDouble(String, double) - Method in class processing.data.XML
-
 
-
setDoubleContent(double) - Method in class processing.data.XML
-
 
-
setEmissive(int) - Method in class processing.core.PShape
-
 
-
setEmissive(int, int) - Method in class processing.core.PShape
-
 
-
setEmissive(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setEmissive(int, int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setFamily(int) - Method in class processing.core.PShape
-
 
-
setFBO(int) - Method in class processing.opengl.FrameBuffer
-
 
-
setFill(boolean) - Method in class processing.core.PShape
-
 
-
setFill(int) - Method in class processing.core.PShape
-
 
-
setFill(int, int) - Method in class processing.core.PShape
-
 
-
setFill(boolean) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setFill(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setFill(int, int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setFloat(int, float) - Method in class processing.data.JSONArray
-
-
Put or replace a float value.
-
-
setFloat(String, float) - Method in class processing.data.JSONObject
-
 
-
setFloat(int, int, float) - Method in class processing.data.Table
-
 
-
setFloat(int, String, float) - Method in class processing.data.Table
-
 
-
setFloat(int, float) - Method in interface processing.data.TableRow
-
 
-
setFloat(String, float) - Method in interface processing.data.TableRow
-
 
-
setFloat(String, float) - Method in class processing.data.XML
-
 
-
setFloatContent(float) - Method in class processing.data.XML
-
 
-
setFragmentShader(String) - Method in class processing.opengl.PShader
-
 
-
setFragmentShader(URL) - Method in class processing.opengl.PShader
-
 
-
setFragmentShader(String[]) - Method in class processing.opengl.PShader
-
 
-
setFrame(Frame) - Method in class processing.core.PApplet
-
 
-
setFrameRate(float) - Method in interface processing.core.PSurface
-
 
-
setFrameRate(float) - Method in class processing.core.PSurfaceFX
-
 
-
setFrameRate(float) - Method in class processing.core.PSurfaceNone
-
 
-
setFrameRate(float) - Method in class processing.opengl.PSurfaceJOGL
-
 
-
setInt(int, int) - Method in class processing.data.JSONArray
-
-
Put or replace an int value.
-
-
setInt(String, int) - Method in class processing.data.JSONObject
-
-
Put a key/int pair in the JSONObject.
-
-
setInt(int, int, int) - Method in class processing.data.Table
-
 
-
setInt(int, String, int) - Method in class processing.data.Table
-
 
-
setInt(int, int) - Method in interface processing.data.TableRow
-
 
-
setInt(String, int) - Method in interface processing.data.TableRow
-
 
-
setInt(String, int) - Method in class processing.data.XML
-
 
-
setIntContent(int) - Method in class processing.data.XML
-
 
-
setJSONArray(int, JSONArray) - Method in class processing.data.JSONArray
-
 
-
setJSONArray(String, JSONArray) - Method in class processing.data.JSONObject
-
 
-
setJSONObject(int, JSONObject) - Method in class processing.data.JSONArray
-
 
-
setJSONObject(String, JSONObject) - Method in class processing.data.JSONObject
-
 
-
setKind(int) - Method in class processing.core.PShape
-
 
-
setLoaded() - Method in class processing.core.PImage
-
 
-
setLoaded(boolean) - Method in class processing.core.PImage
-
 
-
setLong(int, long) - Method in class processing.data.JSONArray
-
-
Put or replace a long value.
-
-
setLong(String, long) - Method in class processing.data.JSONObject
-
-
Put a key/long pair in the JSONObject.
-
-
setLong(int, int, long) - Method in class processing.data.Table
-
 
-
setLong(int, String, long) - Method in class processing.data.Table
-
 
-
setLong(int, long) - Method in interface processing.data.TableRow
-
 
-
setLong(String, long) - Method in interface processing.data.TableRow
-
 
-
setLong(String, long) - Method in class processing.data.XML
-
 
-
setLongContent(long) - Method in class processing.data.XML
-
 
-
setMag(float) - Method in class processing.core.PVector
-
-
( begin auto-generated from PVector_setMag.xml ) - - Set the magnitude of this vector to the value used for the len parameter.
-
-
setMag(PVector, float) - Method in class processing.core.PVector
-
-
Sets the magnitude of this vector, storing the result in another vector.
-
-
setMatrix(PMatrix) - Method in class processing.core.PApplet
-
-
Set the current transformation matrix to the contents of another.
-
-
setMatrix(PMatrix2D) - Method in class processing.core.PApplet
-
-
Set the current transformation to the contents of the specified source.
-
-
setMatrix(PMatrix3D) - Method in class processing.core.PApplet
-
-
Set the current transformation to the contents of the specified source.
-
-
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.PGraphicsFX2D
-
 
-
setMatrix(PMatrix3D) - Method in class processing.core.PGraphicsFX2D
-
 
-
setMatrix(PMatrix2D) - Method in class processing.core.PGraphicsJava2D
-
 
-
setMatrix(PMatrix3D) - Method in class processing.core.PGraphicsJava2D
-
 
-
setMatrix(PMatrix3D) - Method in class processing.opengl.PGraphics2D
-
 
-
setMatrix(PMatrix2D) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
setMatrix(PMatrix3D) - Method in class processing.opengl.PGraphicsOpenGL
-
-
Set the current transformation to the contents of the specified source.
-
-
setMissingDouble(double) - Method in class processing.data.Table
-
 
-
setMissingFloat(float) - Method in class processing.data.Table
-
 
-
setMissingInt(int) - Method in class processing.data.Table
-
 
-
setMissingLong(long) - Method in class processing.data.Table
-
 
-
setMissingString(String) - Method in class processing.data.Table
-
-
Treat entries with this string as "missing".
-
-
setModified() - Method in class processing.core.PImage
-
 
-
setModified(boolean) - Method in class processing.core.PImage
-
 
-
setModified() - Method in class processing.opengl.Texture
-
 
-
setModified(boolean) - Method in class processing.opengl.Texture
-
 
-
setName(String) - Method in class processing.core.PShape
-
 
-
setName(String) - Method in class processing.data.XML
-
 
-
setNative(Object) - Method in class processing.core.PFont
-
-
Set the native complement of this font.
-
-
setNative(int[]) - Method in class processing.opengl.Texture
-
 
-
setNative(int[], int, int, int, int) - Method in class processing.opengl.Texture
-
 
-
setNative(IntBuffer, int, int, int, int) - Method in class processing.opengl.Texture
-
 
-
setNormal(int, float, float, float) - Method in class processing.core.PShape
-
 
-
setNormal(int, float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setOutput(LineStroker) - Method in class processing.opengl.LineStroker
-
-
Sets the output LineStroker of this LineStroker.
-
-
setParameters(int, int, int, int, PMatrix2D) - Method in class processing.opengl.LineStroker
-
-
Sets the parameters of this LineStroker.
-
-
setParams(float[]) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setParent(PApplet) - Method in class processing.core.PGraphics
-
 
-
setPath(String) - Method in class processing.core.PGraphics
-
 
-
setPath(int, float[][]) - Method in class processing.core.PShape
-
 
-
setPath(int, float[][], int, int[]) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setPrimary(boolean) - Method in class processing.core.PGraphics
-
-
Set (or unset) this as the main drawing surface.
-
-
setPrimary(boolean) - Method in class processing.opengl.PGL
-
 
-
setPrimary(boolean) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
setProjection(PMatrix3D) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
setResizable(boolean) - Method in interface processing.core.PSurface
-
-
Set true if we want to resize things (default is not resizable)
-
-
setResizable(boolean) - Method in class processing.core.PSurfaceAWT
-
-
Set true if we want to resize things (default is not resizable)
-
-
setResizable(boolean) - Method in class processing.core.PSurfaceFX
-
-
Set true if we want to resize things (default is not resizable)
-
-
setResizable(boolean) - Method in class processing.core.PSurfaceNone
-
-
Set true if we want to resize things (default is not resizable)
-
-
setResizable(boolean) - Method in class processing.opengl.PSurfaceJOGL
-
 
-
setRow(int, TableRow) - Method in class processing.data.Table
-
 
-
setRow(int, Object[]) - Method in class processing.data.Table
-
 
-
setRowCount(int) - Method in class processing.data.Table
-
 
-
setShininess(float) - Method in class processing.core.PShape
-
 
-
setShininess(int, float) - Method in class processing.core.PShape
-
 
-
setShininess(float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setShininess(int, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
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 interface processing.core.PSurface
-
 
-
setSize(int, int) - Method in class processing.core.PSurfaceAWT
-
 
-
setSize(int, int) - Method in class processing.core.PSurfaceFX
-
 
-
setSize(int, int) - Method in class processing.core.PSurfaceNone
-
 
-
setSize(int, int) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
setSize(int, int) - Method in class processing.opengl.PSurfaceJOGL
-
 
-
setSmooth(int) - Method in interface processing.core.PSurface
-
-
Sometimes smoothing must be set at the drawing surface level - not just inside the renderer itself.
-
-
setSmooth(int) - Method in class processing.core.PSurfaceAWT
-
 
-
setSmooth(int) - Method in class processing.core.PSurfaceFX
-
 
-
setSmooth(int) - Method in class processing.core.PSurfaceNone
-
 
-
setSmooth(int) - Method in class processing.opengl.PSurfaceJOGL
-
 
-
setSpecular(int) - Method in class processing.core.PShape
-
 
-
setSpecular(int, int) - Method in class processing.core.PShape
-
 
-
setSpecular(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setSpecular(int, int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setString(int, String) - Method in class processing.data.JSONArray
-
-
Put or replace a String value.
-
-
setString(String, String) - Method in class processing.data.JSONObject
-
 
-
setString(int, int, String) - Method in class processing.data.Table
-
 
-
setString(int, String, String) - Method in class processing.data.Table
-
 
-
setString(int, String) - Method in interface processing.data.TableRow
-
 
-
setString(String, String) - Method in interface processing.data.TableRow
-
 
-
setString(String, String) - Method in class processing.data.XML
-
 
-
setStroke(boolean) - Method in class processing.core.PShape
-
 
-
setStroke(int) - Method in class processing.core.PShape
-
 
-
setStroke(int, int) - Method in class processing.core.PShape
-
 
-
setStroke(boolean) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setStroke(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setStroke(int, int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setStrokeCap(int) - Method in class processing.core.PShape
-
 
-
setStrokeCap(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setStrokeJoin(int) - Method in class processing.core.PShape
-
 
-
setStrokeJoin(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setStrokeWeight(float) - Method in class processing.core.PShape
-
 
-
setStrokeWeight(int, float) - Method in class processing.core.PShape
-
 
-
setStrokeWeight(float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setStrokeWeight(int, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setSubsetting() - Method in class processing.core.PFont
-
 
-
setTableType(String) - Method in class processing.data.Table
-
-
Set the entire table to a specific data type.
-
-
setTexture(PImage) - Method in class processing.core.PShape
-
 
-
setTexture(PImage) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setTextureMode(int) - Method in class processing.core.PShape
-
 
-
setTextureMode(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setTextureUV(int, float, float) - Method in class processing.core.PShape
-
 
-
setTextureUV(int, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setThread(Thread) - Method in class processing.opengl.PGL
-
 
-
settings() - Method in class processing.core.PApplet
-
-
( begin auto-generated from settings.xml ) - - Description to come...
-
-
setTint(boolean) - Method in class processing.core.PShape
-
 
-
setTint(int) - Method in class processing.core.PShape
-
 
-
setTint(int, int) - Method in class processing.core.PShape
-
 
-
setTint(boolean) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setTint(int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setTint(int, int) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setTitle(String) - Method in interface processing.core.PSurface
-
-
Set the window (and dock, or whatever necessary) title.
-
-
setTitle(String) - Method in class processing.core.PSurfaceAWT
-
-
Set the window (and dock, or whatever necessary) title.
-
-
setTitle(String) - Method in class processing.core.PSurfaceFX
-
-
Set the window (and dock, or whatever necessary) title.
-
-
setTitle(String) - Method in class processing.core.PSurfaceNone
-
-
Set the window (and dock, or whatever necessary) title.
-
-
setTitle(String) - Method in class processing.opengl.PSurfaceJOGL
-
 
-
setup() - Method in class processing.core.PApplet
-
-
( begin auto-generated from setup.xml ) - - The setup() function is called once when the program starts.
-
-
setupExternalMessages() - Method in interface processing.core.PSurface
-
 
-
setupExternalMessages() - Method in class processing.core.PSurfaceAWT
-
-
Set this sketch to communicate its state back to the PDE.
-
-
setupExternalMessages() - Method in class processing.core.PSurfaceFX
-
 
-
setupExternalMessages() - Method in class processing.core.PSurfaceNone
-
 
-
setupExternalMessages() - Method in class processing.opengl.PSurfaceJOGL
-
 
-
setupFrameResizeListener() - Method in class processing.core.PSurfaceAWT
-
-
Set up a listener that will fire proper component resize events - in cases where frame.setResizable(true) is called.
-
-
setVertex(int, float, float) - Method in class processing.core.PShape
-
 
-
setVertex(int, float, float, float) - Method in class processing.core.PShape
-
 
-
setVertex(int, PVector) - Method in class processing.core.PShape
-
 
-
setVertex(int, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setVertex(int, float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setVertex(int, PVector) - Method in class processing.opengl.PShapeOpenGL
-
 
-
setVertexShader(String) - Method in class processing.opengl.PShader
-
 
-
setVertexShader(URL) - Method in class processing.opengl.PShader
-
 
-
setVertexShader(String[]) - Method in class processing.opengl.PShader
-
 
-
setVisible(boolean) - Method in class processing.core.PShape
-
-
( begin auto-generated from PShape_setVisible.xml ) - - Sets the shape to be visible or invisible.
-
-
setVisible(boolean) - Method in interface processing.core.PSurface
-
-
Show or hide the window.
-
-
setVisible(boolean) - Method in class processing.core.PSurfaceAWT
-
 
-
setVisible(boolean) - Method in class processing.core.PSurfaceFX
-
-
Show or hide the window.
-
-
setVisible(boolean) - Method in class processing.core.PSurfaceNone
-
-
Show or hide the window.
-
-
setVisible(boolean) - Method in class processing.opengl.PSurfaceJOGL
-
 
-
setWidth - Variable in class processing.core.PFont.Glyph
-
 
-
setWindingRule(int) - Method in class processing.opengl.LinePath
-
-
Sets the winding rule for this path to the specified value.
-
-
SG - Static variable in class processing.core.PGraphics
-
 
-
shader(PShader) - Method in class processing.core.PApplet
-
-
( begin auto-generated from shader.xml ) - - This is a new reference entry for Processing 2.0.
-
-
shader(PShader, int) - Method in class processing.core.PApplet
-
 
-
shader(PShader) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from shader.xml ) - - This is a new reference entry for Processing 2.0.
-
-
shader(PShader, int) - Method in class processing.core.PGraphics
-
 
-
shader(PShader) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
shader(PShader, int) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
SHADER_SOURCE_LENGTH - Static variable in class processing.opengl.PGL
-
 
-
SHADER_TYPE - Static variable in class processing.opengl.PGL
-
 
-
shaderBinary(int, IntBuffer, int, Buffer, int) - Method in class processing.opengl.PGL
-
 
-
shaderBinary(int, IntBuffer, int, Buffer, int) - Method in class processing.opengl.PJOGL
-
 
-
shaderSource(int, String) - Method in class processing.opengl.PGL
-
 
-
shaderSource(int, String) - Method in class processing.opengl.PJOGL
-
 
-
SHADING_LANGUAGE_VERSION - Static variable in class processing.opengl.PGL
-
 
-
shape(PShape) - Method in class processing.core.PApplet
-
 
-
shape(PShape, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from shape.xml ) - - Displays shapes to the screen.
-
-
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
-
-
( begin auto-generated from shape.xml ) - - Displays shapes to the screen.
-
-
shape(PShape, float, float, float, float) - Method in class processing.core.PGraphics
-
 
-
shape(PShape) - Method in class processing.opengl.PGraphics2D
-
 
-
shape(PShape, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
shape(PShape, float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
shape(PShape, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
shape(PShape, float, float, float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
shapeMode(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from shapeMode.xml ) - - Modifies the location from which shapes draw.
-
-
shapeMode - Variable in class processing.core.PGraphics
-
-
The current shape alignment mode (read-only)
-
-
shapeMode(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from shapeMode.xml ) - - Modifies the location from which shapes draw.
-
-
shapeMode - Variable in class processing.core.PStyle
-
 
-
shearX(float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter.
-
-
shearX(float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter.
-
-
shearX(float) - Method in class processing.core.PGraphicsFX2D
-
 
-
shearX(float) - Method in class processing.core.PGraphicsJava2D
-
 
-
shearX(float) - Method in interface processing.core.PMatrix
-
 
-
shearX(float) - Method in class processing.core.PMatrix2D
-
 
-
shearX(float) - Method in class processing.core.PMatrix3D
-
 
-
shearX(float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
shearY(float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter.
-
-
shearY(float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter.
-
-
shearY(float) - Method in class processing.core.PGraphicsFX2D
-
 
-
shearY(float) - Method in class processing.core.PGraphicsJava2D
-
 
-
shearY(float) - Method in interface processing.core.PMatrix
-
 
-
shearY(float) - Method in class processing.core.PMatrix2D
-
 
-
shearY(float) - Method in class processing.core.PMatrix3D
-
 
-
shearY(float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
SHIFT - Static variable in interface processing.core.PConstants
-
 
-
SHIFT - Static variable in class processing.event.Event
-
 
-
SHINE - Static variable in class processing.core.PGraphics
-
 
-
shininess(float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from shininess.xml ) - - Sets the amount of gloss in the surface of shapes.
-
-
shininess - Variable in class processing.core.PGraphics
-
 
-
shininess(float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from shininess.xml ) - - Sets the amount of gloss in the surface of shapes.
-
-
shininess(float) - Method in class processing.core.PShape
-
 
-
shininess - Variable in class processing.core.PStyle
-
 
-
SHORT - Static variable in class processing.opengl.PGL
-
 
-
shorten(boolean[]) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from shorten.xml ) - - Decreases an array by one element and returns the shortened array.
-
-
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
-
 
-
showCursor() - Method in interface processing.core.PSurface
-
 
-
showCursor() - Method in class processing.core.PSurfaceAWT
-
 
-
showCursor() - Method in class processing.core.PSurfaceFX
-
 
-
showCursor() - Method in class processing.core.PSurfaceNone
-
 
-
showCursor() - Method in class processing.opengl.PSurfaceJOGL
-
 
-
showDepthWarning(String) - Static method in class processing.core.PApplet
-
-
Display a warning that the specified method is only available with 3D.
-
-
showDepthWarning(String) - Static method in class processing.core.PGraphics
-
-
Display a warning that the specified method is only available with 3D.
-
-
showDepthWarningXYZ(String) - Static method in class processing.core.PApplet
-
-
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.
-
-
showDepthWarningXYZ(String) - Static method in class processing.core.PGraphics
-
-
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.
-
-
showException(String) - Static method in class processing.core.PGraphics
-
-
Show an renderer-related exception that halts the program.
-
-
showMethodWarning(String) - Static method in class processing.core.PApplet
-
-
Display a warning that the specified method is simply unavailable.
-
-
showMethodWarning(String) - Static method in class processing.core.PGraphics
-
-
Display a warning that the specified method is simply unavailable.
-
-
showMissingWarning(String) - Static method in class processing.core.PApplet
-
-
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.
-
-
showMissingWarning(String) - Static method in class processing.core.PGraphics
-
-
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.
-
-
showTodoWarning(String, int) - Static method in class processing.core.PGraphicsFX2D
-
-
Display a warning that the specified method is simply unavailable.
-
-
showVariationWarning(String) - Static method in class processing.core.PApplet
-
-
Error that a particular variation of a method is unavailable (even though - other variations are).
-
-
showVariationWarning(String) - Static method in class processing.core.PGraphics
-
-
Error that a particular variation of a method is unavailable (even though - other variations are).
-
-
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.
-
-
showWarning(String, Object...) - Static method in class processing.core.PGraphics
-
-
Version of showWarning() that takes a parsed String.
-
-
shuffle() - Method in class processing.data.FloatList
-
-
Randomize the order of the list elements.
-
-
shuffle(PApplet) - Method in class processing.data.FloatList
-
-
Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
-
-
shuffle() - Method in class processing.data.IntList
-
-
Randomize the order of the list elements.
-
-
shuffle(PApplet) - Method in class processing.data.IntList
-
-
Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
-
-
shuffle() - Method in class processing.data.StringList
-
-
Randomize the order of the list elements.
-
-
shuffle(PApplet) - Method in class processing.data.StringList
-
-
Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
-
-
sin(float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from sin.xml ) - - Calculates the sine of an angle.
-
-
size(int, int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from size.xml ) - - Defines the dimension of the display window in units of pixels.
-
-
size(int, int, String) - Method in class processing.core.PApplet
-
 
-
size(int, int, String, String) - Method in class processing.core.PApplet
-
 
-
size() - Method in class processing.data.FloatDict
-
 
-
size() - Method in class processing.data.FloatList
-
-
Get the length of the list.
-
-
size() - Method in class processing.data.IntDict
-
-
Returns the number of key/value pairs
-
-
size() - Method in class processing.data.IntList
-
-
Get the length of the list.
-
-
size() - Method in class processing.data.JSONArray
-
-
Get the number of elements in the JSONArray, included nulls.
-
-
size() - Method in class processing.data.JSONObject
-
-
Get the number of keys stored in the JSONObject.
-
-
size() - Method in class processing.data.Sort
-
 
-
size() - Method in class processing.data.StringDict
-
 
-
size() - Method in class processing.data.StringList
-
-
Get the length of the list.
-
-
sketchDisplay() - Method in class processing.core.PApplet
-
 
-
sketchFile(String) - Method in class processing.core.PApplet
-
 
-
sketchFullScreen() - Method in class processing.core.PApplet
-
 
-
sketchHeight() - Method in class processing.core.PApplet
-
 
-
sketchOutputPath() - Method in class processing.core.PApplet
-
 
-
sketchOutputStream() - Method in class processing.core.PApplet
-
 
-
sketchPath() - Method in class processing.core.PApplet
-
 
-
sketchPath(String) - Method in class processing.core.PApplet
-
-
Prepend the sketch folder path to the filename (or path) that is - passed in.
-
-
sketchPixelDensity() - Method in class processing.core.PApplet
-
 
-
sketchRenderer() - Method in class processing.core.PApplet
-
 
-
sketchSmooth() - Method in class processing.core.PApplet
-
 
-
sketchWidth() - Method in class processing.core.PApplet
-
 
-
sketchWindowColor() - Method in class processing.core.PApplet
-
 
-
smooth() - Method in class processing.core.PApplet
-
 
-
smooth(int) - Method in class processing.core.PApplet
-
 
-
smooth - Variable in class processing.core.PGraphics
-
 
-
smooth() - Method in class processing.core.PGraphics
-
 
-
smooth(int) - Method in class processing.core.PGraphics
-
 
-
SOFT_LIGHT - Static variable in interface processing.core.PConstants
-
 
-
solid(boolean) - Method in class processing.opengl.PShapeOpenGL
-
 
-
sort(byte[]) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from sort.xml ) - - Sorts an array of numbers from smallest to largest and puts an array of - words in alphabetical order.
-
-
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
-
 
-
sort() - Method in class processing.data.FloatList
-
-
Sorts the array in place.
-
-
sort() - Method in class processing.data.IntList
-
-
Sorts the array in place.
-
-
Sort - Class in processing.data
-
-
Internal sorter used by several data classes.
-
-
Sort() - Constructor for class processing.data.Sort
-
 
-
sort() - Method in class processing.data.StringList
-
-
Sorts the array in place.
-
-
sort(String) - Method in class processing.data.Table
-
 
-
sort(int) - Method in class processing.data.Table
-
 
-
sortKeys() - Method in class processing.data.FloatDict
-
-
Sort the keys alphabetically (ignoring case).
-
-
sortKeys() - Method in class processing.data.IntDict
-
-
Sort the keys alphabetically (ignoring case).
-
-
sortKeys() - Method in class processing.data.StringDict
-
-
Sort the keys alphabetically (ignoring case).
-
-
sortKeysReverse() - Method in class processing.data.FloatDict
-
 
-
sortKeysReverse() - Method in class processing.data.IntDict
-
-
Sort the keys alphabetically in reverse (ignoring case).
-
-
sortKeysReverse() - Method in class processing.data.StringDict
-
 
-
sortReverse() - Method in class processing.data.FloatList
-
-
Reverse sort, orders values from highest to lowest
-
-
sortReverse() - Method in class processing.data.IntList
-
-
Reverse sort, orders values from highest to lowest.
-
-
sortReverse() - Method in class processing.data.StringList
-
-
Reverse sort, orders values from highest to lowest.
-
-
sortReverse(String) - Method in class processing.data.Table
-
 
-
sortReverse(int) - Method in class processing.data.Table
-
 
-
sortValues() - Method in class processing.data.FloatDict
-
-
Sort by values in descending order (largest value will be at [0]).
-
-
sortValues() - Method in class processing.data.IntDict
-
-
Sort by values in ascending order.
-
-
sortValues() - Method in class processing.data.StringDict
-
-
Sort by values in descending order (largest value will be at [0]).
-
-
sortValuesReverse() - Method in class processing.data.FloatDict
-
 
-
sortValuesReverse() - Method in class processing.data.IntDict
-
-
Sort by values in descending order.
-
-
sortValuesReverse() - Method in class processing.data.StringDict
-
 
-
SPAN - Static variable in interface processing.core.PConstants
-
-
Use with fullScreen() to indicate all available displays.
-
-
SPB - Static variable in class processing.core.PGraphics
-
 
-
specular(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from specular.xml ) - - Sets the specular color of the materials used for shapes drawn to the - screen, which sets the color of hightlights.
-
-
specular(float) - Method in class processing.core.PApplet
-
-
gray number specifying value between white and black
-
-
specular(float, float, float) - Method in class processing.core.PApplet
-
 
-
specular(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from specular.xml ) - - Sets the specular color of the materials used for shapes drawn to the - screen, which sets the color of hightlights.
-
-
specular(float) - Method in class processing.core.PGraphics
-
-
gray number specifying value between white and black
-
-
specular(float, float, float) - Method in class processing.core.PGraphics
-
 
-
specular(int) - Method in class processing.core.PShape
-
 
-
specular(float) - Method in class processing.core.PShape
-
 
-
specular(float, float, float) - Method in class processing.core.PShape
-
 
-
specularB - Variable in class processing.core.PGraphics
-
 
-
specularB - Variable in class processing.core.PStyle
-
 
-
specularColor - Variable in class processing.core.PGraphics
-
 
-
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 class processing.core.PGraphics
-
 
-
sphere(float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles.
-
-
SPHERE - Static variable in interface processing.core.PConstants
-
 
-
sphere(float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles.
-
-
sphere(float) - Method in class processing.core.PGraphicsFX2D
-
 
-
sphere(float) - Method in class processing.core.PGraphicsJava2D
-
 
-
sphere(float) - Method in class processing.opengl.PGraphics2D
-
 
-
sphere(float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
sphereDetail(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from sphereDetail.xml ) - - Controls the detail used to render a sphere by adjusting the number of - vertices of the sphere mesh.
-
-
sphereDetail(int, int) - Method in class processing.core.PApplet
-
 
-
sphereDetail(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from sphereDetail.xml ) - - Controls the detail used to render a sphere by adjusting the number of - vertices of the sphere mesh.
-
-
sphereDetail(int, int) - Method in class processing.core.PGraphics
-
 
-
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
-
-
( begin auto-generated from splice.xml ) - - Inserts a value or array of values into an existing array.
-
-
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
-
-
( begin auto-generated from split.xml ) - - The split() function breaks a string into pieces using a character or - string as the divider.
-
-
split(String, String) - Static method in class processing.core.PApplet
-
 
-
splitTokens(String) - Static method in class processing.core.PApplet
-
 
-
splitTokens(String, String) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from splitTokens.xml ) - - The splitTokens() function splits a String at one or many character - "tokens." The tokens parameter specifies the character or - characters to be used as a boundary.
-
-
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
-
-
( begin auto-generated from spotLight.xml ) - - Adds a spot light.
-
-
spotLight(float, float, float, float, float, float, float, float, float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from spotLight.xml ) - - Adds a spot light.
-
-
spotLight(float, float, float, float, float, float, float, float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
spotLight(float, float, float, float, float, float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
SPR - Static variable in class processing.core.PGraphics
-
 
-
sq(float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from sq.xml ) - - Squares a number (multiplies a number by itself).
-
-
sqrt(float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from sqrt.xml ) - - Calculates the square root of a number.
-
-
SQUARE - Static variable in interface processing.core.PConstants
-
 
-
SR - Static variable in class processing.core.PGraphics
-
-
stroke argb values
-
-
SRC_ALPHA - Static variable in class processing.opengl.PGL
-
 
-
SRC_ALPHA_SATURATE - Static variable in class processing.opengl.PGL
-
 
-
SRC_COLOR - Static variable in class processing.opengl.PGL
-
 
-
start() - Method in class processing.core.PApplet
-
-
Called by the browser or applet viewer to inform this applet that it - should start its execution.
-
-
start(Stage) - Method in class processing.core.PSurfaceFX.PApplicationFX
-
 
-
startThread() - Method in interface processing.core.PSurface
-
-
Start the animation thread
-
-
startThread() - Method in class processing.core.PSurfaceFX
-
 
-
startThread() - Method in class processing.core.PSurfaceNone
-
 
-
startThread() - Method in class processing.opengl.PSurfaceJOGL
-
 
-
STATIC_DRAW - Static variable in class processing.opengl.PGL
-
 
-
STENCIL_ATTACHMENT - Static variable in class processing.opengl.PGL
-
 
-
STENCIL_BITS - Static variable in class processing.opengl.PGL
-
 
-
STENCIL_BUFFER_BIT - Static variable in class processing.opengl.PGL
-
 
-
STENCIL_INDEX - Static variable in class processing.opengl.PGL
-
 
-
STENCIL_INDEX1 - Static variable in class processing.opengl.PGL
-
 
-
STENCIL_INDEX4 - Static variable in class processing.opengl.PGL
-
 
-
STENCIL_INDEX8 - Static variable in class processing.opengl.PGL
-
 
-
STENCIL_TEST - Static variable in class processing.opengl.PGL
-
 
-
stencilBits - Static variable in class processing.opengl.PGraphicsOpenGL
-
 
-
stencilFunc(int, int, int) - Method in class processing.opengl.PGL
-
 
-
stencilFunc(int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
stencilFuncSeparate(int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
stencilFuncSeparate(int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
stencilMask(int) - Method in class processing.opengl.PGL
-
 
-
stencilMask(int) - Method in class processing.opengl.PJOGL
-
 
-
stencilMaskSeparate(int, int) - Method in class processing.opengl.PGL
-
 
-
stencilMaskSeparate(int, int) - Method in class processing.opengl.PJOGL
-
 
-
stencilOp(int, int, int) - Method in class processing.opengl.PGL
-
 
-
stencilOp(int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
stencilOpSeparate(int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
stencilOpSeparate(int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
stop() - Method in class processing.core.PApplet
-
-
Called by the browser or applet viewer to inform - this applet that it should stop its execution.
-
-
stopThread() - Method in interface processing.core.PSurface
-
-
Stop the animation thread (set it null)
-
-
stopThread() - Method in class processing.core.PSurfaceFX
-
 
-
stopThread() - Method in class processing.core.PSurfaceNone
-
 
-
stopThread() - Method in class processing.opengl.PSurfaceJOGL
-
 
-
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
-
 
-
STREAM_DRAW - Static variable in class processing.opengl.PGL
-
 
-
STRING - Static variable in class processing.data.Table
-
 
-
StringDict - Class in processing.data
-
-
A simple table class to use a String as a lookup for another String value.
-
-
StringDict() - Constructor for class processing.data.StringDict
-
 
-
StringDict(int) - Constructor for class processing.data.StringDict
-
-
Create a new lookup pre-allocated to a specific length.
-
-
StringDict(BufferedReader) - Constructor for class processing.data.StringDict
-
-
Read a set of entries from a Reader that has each key/value pair on - a single line, separated by a tab.
-
-
StringDict(String[], String[]) - Constructor for class processing.data.StringDict
-
 
-
StringDict(String[][]) - Constructor for class processing.data.StringDict
-
-
Constructor to allow (more intuitive) inline initialization, e.g.:
-
-
StringList - Class in processing.data
-
-
Helper class for a list of Strings.
-
-
StringList() - Constructor for class processing.data.StringList
-
 
-
StringList(int) - Constructor for class processing.data.StringList
-
 
-
StringList(String[]) - Constructor for class processing.data.StringList
-
 
-
StringList(Object...) - Constructor for class processing.data.StringList
-
-
Construct a StringList from a random pile of objects.
-
-
StringList(Iterable<String>) - Constructor for class processing.data.StringList
-
-
Create from something iterable, for instance: - StringList list = new StringList(hashMap.keySet());
-
-
stroke(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from stroke.xml ) - - Sets the color used to draw lines and borders around shapes.
-
-
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
-
-
( begin auto-generated from stroke.xml ) - - Sets the color used to draw lines and borders around shapes.
-
-
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(int) - Method in class processing.core.PShape
-
 
-
stroke(int, float) - Method in class processing.core.PShape
-
 
-
stroke(float) - Method in class processing.core.PShape
-
 
-
stroke(float, float) - Method in class processing.core.PShape
-
 
-
stroke(float, float, float) - Method in class processing.core.PShape
-
 
-
stroke(float, float, float, float) - Method in class processing.core.PShape
-
 
-
stroke - Variable in class processing.core.PStyle
-
 
-
strokeCap(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from strokeCap.xml ) - - Sets the style for rendering line endings.
-
-
strokeCap - Variable in class processing.core.PGraphics
-
-
Set by strokeCap() (read-only).
-
-
strokeCap(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from strokeCap.xml ) - - Sets the style for rendering line endings.
-
-
strokeCap(int) - Method in class processing.core.PGraphicsFX2D
-
 
-
strokeCap(int) - Method in class processing.core.PGraphicsJava2D
-
 
-
strokeCap(int) - Method in class processing.core.PShape
-
 
-
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
-
-
( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments.
-
-
strokeJoin - Variable in class processing.core.PGraphics
-
-
Set by strokeJoin() (read-only).
-
-
strokeJoin(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments.
-
-
strokeJoin(int) - Method in class processing.core.PGraphicsFX2D
-
 
-
strokeJoin(int) - Method in class processing.core.PGraphicsJava2D
-
 
-
strokeJoin(int) - Method in class processing.core.PShape
-
 
-
strokeJoin - Variable in class processing.core.PStyle
-
 
-
strokeJoin(int) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
strokeWeight(float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes.
-
-
strokeWeight - Variable in class processing.core.PGraphics
-
-
Last value set by strokeWeight() (read-only).
-
-
strokeWeight(float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes.
-
-
strokeWeight(float) - Method in class processing.core.PGraphicsFX2D
-
 
-
strokeWeight(float) - Method in class processing.core.PGraphicsJava2D
-
 
-
strokeWeight(float) - Method in class processing.core.PShape
-
 
-
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
-
 
-
sub(PVector) - Method in class processing.core.PVector
-
-
( begin auto-generated from PVector_sub.xml ) - - Subtracts x, y, and z components from a vector, subtracts one vector - from another, or subtracts two independent vectors.
-
-
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
-
-
Subtract one vector from another and store in another vector
-
-
sub(String, float) - Method in class processing.data.FloatDict
-
 
-
sub(int, float) - Method in class processing.data.FloatList
-
 
-
sub(String, int) - Method in class processing.data.IntDict
-
 
-
sub(int, int) - Method in class processing.data.IntList
-
 
-
subset(boolean[], int) - Static method in class processing.core.PApplet
-
 
-
subset(boolean[], int, int) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from subset.xml ) - - Extracts an array of elements from an existing array.
-
-
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
-
 
-
sum() - Method in class processing.data.FloatList
-
 
-
sum() - Method in class processing.data.IntList
-
 
-
surface - Static variable in class processing.core.PSurfaceFX.PApplicationFX
-
 
-
SVG - Static variable in interface processing.core.PConstants
-
 
-
SW - Static variable in class processing.core.PGraphics
-
-
stroke weight
-
-
swap(int, int) - Method in class processing.data.FloatDict
-
 
-
swap(int, int) - Method in class processing.data.IntDict
-
 
-
swap(int, int) - Method in class processing.data.Sort
-
 
-
swap(int, int) - Method in class processing.data.StringDict
-
 
-
swapColorBuffers() - Method in class processing.opengl.FrameBuffer
-
 
-
- - - -

T

-
-
TAB - Static variable in interface processing.core.PConstants
-
 
-
Table - Class in processing.data
-
-
Generic class for handling tabular data, typically from a CSV, TSV, or - other sort of spreadsheet file.
-
-
Table() - Constructor for class processing.data.Table
-
-
Creates a new, empty table.
-
-
Table(File) - Constructor for class processing.data.Table
-
 
-
Table(File, String) - Constructor for class processing.data.Table
-
-
version that uses a File object; future releases (or data types) - may include additional optimizations here
-
-
Table(InputStream) - Constructor for class processing.data.Table
-
 
-
Table(InputStream, String) - Constructor for class processing.data.Table
-
-
Read the table from a stream.
-
-
Table(Iterable<TableRow>) - Constructor for class processing.data.Table
-
 
-
Table(ResultSet) - Constructor for class processing.data.Table
-
 
-
TableRow - Interface in processing.data
-
 
-
tan(float) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from tan.xml ) - - Calculates the ratio of the sine and cosine of an angle.
-
-
TARGA - Static variable in interface processing.core.PConstants
-
 
-
target - Variable in class processing.opengl.Texture.Parameters
-
-
Texture target.
-
-
TAU - Static variable in interface processing.core.PConstants
-
-
( begin auto-generated from TAU.xml ) - - TAU is an alias for TWO_PI, a mathematical constant with the value - 6.28318530717958647693.
-
-
TESS_WINDING_NONZERO - Static variable in class processing.opengl.PGL
-
 
-
TESS_WINDING_ODD - Static variable in class processing.opengl.PGL
-
 
-
TEXCOORD - Static variable in class processing.opengl.PShapeOpenGL
-
 
-
texImage2D(int, int, int, int, int, int, int, int, Buffer) - Method in class processing.opengl.PGL
-
 
-
texImage2D(int, int, int, int, int, int, int, int, Buffer) - Method in class processing.opengl.PJOGL
-
 
-
texParameterf(int, int, float) - Method in class processing.opengl.PGL
-
 
-
texParameterf(int, int, float) - Method in class processing.opengl.PJOGL
-
 
-
texParameterfv(int, int, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
texParameterfv(int, int, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
texParameteri(int, int, int) - Method in class processing.opengl.PGL
-
 
-
texParameteri(int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
texParameteriv(int, int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
texParameteriv(int, int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
texSubImage2D(int, int, int, int, int, int, int, int, Buffer) - Method in class processing.opengl.PGL
-
 
-
texSubImage2D(int, int, int, int, int, int, int, int, Buffer) - Method in class processing.opengl.PJOGL
-
 
-
text(char, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from text.xml ) - - Draws text to the screen.
-
-
text(char, float, float, float) - Method in class processing.core.PApplet
-
 
-
text(String, float, float) - Method in class processing.core.PApplet
-
-
Advanced
-
-
text(char[], int, int, float, float) - Method in class processing.core.PApplet
-
-
Advanced
-
-
text(String, float, float, float) - Method in class processing.core.PApplet
-
-
Same as above but with a z coordinate.
-
-
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
-
-
Advanced
-
-
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
-
-
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.PApplet
-
 
-
TEXT - Static variable in interface processing.core.PConstants
-
 
-
text(char, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from text.xml ) - - Draws text to the screen.
-
-
text(char, float, float, float) - Method in class processing.core.PGraphics
-
 
-
text(String, float, float) - Method in class processing.core.PGraphics
-
-
Advanced
-
-
text(char[], int, int, float, float) - Method in class processing.core.PGraphics
-
-
Advanced
-
-
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
-
-
Advanced
-
-
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
-
-
( begin auto-generated from textAlign.xml ) - - Sets the current alignment for drawing text.
-
-
textAlign - Variable in class processing.core.PGraphics
-
-
The current text align (read-only)
-
-
textAlign(int) - Method in class processing.core.PGraphics
-
 
-
textAlign(int, int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from textAlign.xml ) - - Sets the current alignment for drawing 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
-
-
( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size.
-
-
textAscent() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size.
-
-
textAscent() - Method in class processing.core.PGraphicsJava2D
-
 
-
textAscent() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
textDescent() - Method in class processing.core.PApplet
-
-
( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size.
-
-
textDescent() - Method in class processing.core.PGraphics
-
-
( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size.
-
-
textDescent() - Method in class processing.core.PGraphicsJava2D
-
 
-
textDescent() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
textFont(PFont) - Method in class processing.core.PApplet
-
-
( begin auto-generated from textFont.xml ) - - Sets the current font that will be drawn with the text() - function.
-
-
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
-
-
( begin auto-generated from textFont.xml ) - - Sets the current font that will be drawn with the text() - function.
-
-
textFont(PFont, float) - Method in class processing.core.PGraphics
-
 
-
textFont - Variable in class processing.core.PStyle
-
 
-
textLeading(float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from textLeading.xml ) - - Sets the spacing between lines of text in units of pixels.
-
-
textLeading - Variable in class processing.core.PGraphics
-
-
The current text leading (read-only)
-
-
textLeading(float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from textLeading.xml ) - - Sets the spacing between lines of text in units of pixels.
-
-
textLeading - Variable in class processing.core.PStyle
-
 
-
textMode(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from textMode.xml ) - - Sets the way text draws to the screen.
-
-
textMode - Variable in class processing.core.PGraphics
-
-
The current text mode (read-only)
-
-
textMode(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from textMode.xml ) - - Sets the way text draws to the screen.
-
-
textMode - Variable in class processing.core.PStyle
-
 
-
textSize(float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from textSize.xml ) - - Sets the current font size.
-
-
textSize - Variable in class processing.core.PGraphics
-
-
The current text size (read-only)
-
-
textSize(float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from textSize.xml ) - - Sets the current font size.
-
-
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
-
 
-
textSize(float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
texture(PImage) - Method in class processing.core.PApplet
-
-
( begin auto-generated from texture.xml ) - - Sets a texture to be applied to vertex points.
-
-
texture(PImage) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from texture.xml ) - - Sets a texture to be applied to vertex points.
-
-
texture(PImage) - Method in class processing.core.PGraphicsFX2D
-
 
-
texture(PImage) - Method in class processing.core.PGraphicsJava2D
-
 
-
texture(PImage) - Method in class processing.core.PShape
-
 
-
Texture - Class in processing.opengl
-
-
This class wraps an OpenGL texture.
-
-
Texture(PGraphicsOpenGL) - Constructor for class processing.opengl.Texture
-
 
-
Texture(PGraphicsOpenGL, int, int) - Constructor for class processing.opengl.Texture
-
-
Creates an instance of PTexture with size width x height.
-
-
Texture(PGraphicsOpenGL, int, int, Object) - Constructor for class processing.opengl.Texture
-
-
Creates an instance of PTexture with size width x height and with the - specified parameters.
-
-
Texture.Parameters - Class in processing.opengl
-
-
This class stores the parameters for a texture: target, internal format, - minimization filter and magnification filter.
-
-
TEXTURE0 - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE1 - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE2 - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE3 - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_2D - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_BINDING_2D - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_BINDING_RECTANGLE - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_CUBE_MAP - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_CUBE_MAP_NEGATIVE_X - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_CUBE_MAP_NEGATIVE_Y - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_CUBE_MAP_NEGATIVE_Z - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_CUBE_MAP_POSITIVE_X - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_CUBE_MAP_POSITIVE_Y - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_CUBE_MAP_POSITIVE_Z - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_MAG_FILTER - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_MAX_ANISOTROPY - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_MIN_FILTER - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_RECTANGLE - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_WRAP_R - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_WRAP_S - Static variable in class processing.opengl.PGL
-
 
-
TEXTURE_WRAP_T - Static variable in class processing.opengl.PGL
-
 
-
textureImage - Variable in class processing.core.PGraphics
-
-
Current image being used as a texture
-
-
textureMode(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from textureMode.xml ) - - Sets the coordinate space for texture mapping.
-
-
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
-
-
( begin auto-generated from textureMode.xml ) - - Sets the coordinate space for texture mapping.
-
-
textureMode(int) - Method in class processing.core.PShape
-
 
-
textureSampling(int) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
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.
-
-
textureWrap(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from textureWrap.xml ) - - Description to come...
-
-
textureWrap(int) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from textureWrap.xml ) - - Description to come...
-
-
textureWrap(int) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
textWidth(char) - Method in class processing.core.PApplet
-
 
-
textWidth(String) - Method in class processing.core.PApplet
-
-
( begin auto-generated from textWidth.xml ) - - Calculates and returns the width of any character or text string.
-
-
textWidth(char[], int, int) - Method in class processing.core.PApplet
-
 
-
textWidth(char) - Method in class processing.core.PGraphics
-
 
-
textWidth(String) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from textWidth.xml ) - - Calculates and returns the width of any character or text string.
-
-
textWidth(char[], int, int) - Method in class processing.core.PGraphics
-
 
-
textWidth(String, float) - Method in class processing.core.PShapeSVG.Font
-
 
-
TEXUNIT_ERROR - Static variable in class processing.opengl.PGL
-
 
-
ThinkDifferent - Class in processing.core
-
-
Deal with issues related to thinking differently.
-
-
ThinkDifferent() - Constructor for class processing.core.ThinkDifferent
-
 
-
THIRD_PI - Static variable in interface processing.core.PConstants
-
 
-
thread(String) - Method in class processing.core.PApplet
-
-
Launch a new thread and call the specified function from that new thread.
-
-
threadIsCurrent() - Method in class processing.opengl.PGL
-
 
-
THRESHOLD - Static variable in interface processing.core.PConstants
-
 
-
TIFF - Static variable in interface processing.core.PConstants
-
 
-
tint(int) - Method in class processing.core.PApplet
-
-
( begin auto-generated from tint.xml ) - - Sets the fill value for displaying images.
-
-
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
-
-
( begin auto-generated from tint.xml ) - - Sets the fill value for displaying images.
-
-
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(int) - Method in class processing.core.PShape
-
 
-
tint(int, float) - Method in class processing.core.PShape
-
 
-
tint(float) - Method in class processing.core.PShape
-
 
-
tint(float, float) - Method in class processing.core.PShape
-
 
-
tint(float, float, float) - Method in class processing.core.PShape
-
 
-
tint(float, float, float, float) - Method in class processing.core.PShape
-
 
-
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.Glyph
-
 
-
toString() - Method in class processing.core.PVector
-
 
-
toString() - Method in class processing.data.FloatDict
-
 
-
toString() - Method in class processing.data.FloatList
-
 
-
toString() - Method in class processing.data.IntDict
-
 
-
toString() - Method in class processing.data.IntList
-
 
-
toString() - Method in class processing.data.JSONArray
-
-
Return the JSON data formatted with two spaces for indents.
-
-
toString() - Method in class processing.data.JSONObject
-
-
Return the JSON data formatted with two spaces for indents.
-
-
toString() - Method in class processing.data.StringDict
-
 
-
toString() - Method in class processing.data.StringList
-
 
-
toString() - Method in class processing.data.XML
-
-
Return the XML document formatted with two spaces for indents.
-
-
toString() - Method in class processing.event.MouseEvent
-
 
-
TOUCH - Static variable in class processing.event.Event
-
 
-
TouchEvent - Class in processing.event
-
 
-
TouchEvent(Object, long, int, int) - Constructor for class processing.event.TouchEvent
-
 
-
translate(float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window.
-
-
translate(float, float, float) - Method in class processing.core.PApplet
-
 
-
translate(float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window.
-
-
translate(float, float, float) - Method in class processing.core.PGraphics
-
 
-
translate(float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
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
-
-
( begin auto-generated from PShape_translate.xml ) - - Specifies an amount to displace the shape.
-
-
translate(float, float, float) - Method in class processing.core.PShape
-
 
-
translate(float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
translate(float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
translate(float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
translate(float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
translate(float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
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.
-
-
triangle(float, float, float, float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points.
-
-
TRIANGLE - Static variable in interface processing.core.PConstants
-
 
-
triangle(float, float, float, float, float, float) - Method in class processing.core.PGraphics
-
-
( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points.
-
-
triangle(float, float, float, float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
triangle(float, float, float, float, float, float) - Method in class processing.core.PGraphicsJava2D
-
 
-
triangle(float, float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
TRIANGLE_FAN - Static variable in interface processing.core.PConstants
-
 
-
TRIANGLE_FAN - Static variable in class processing.opengl.PGL
-
 
-
TRIANGLE_STRIP - Static variable in interface processing.core.PConstants
-
 
-
TRIANGLE_STRIP - Static variable in class processing.opengl.PGL
-
 
-
TRIANGLES - Static variable in interface processing.core.PConstants
-
 
-
TRIANGLES - Static variable in class processing.opengl.PGL
-
 
-
trim(String) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from trim.xml ) - - Removes whitespace characters from the beginning and end of a String.
-
-
trim(String[]) - Static method in class processing.core.PApplet
-
 
-
trim() - Method in class processing.data.Table
-
 
-
trim(int) - Method in class processing.data.Table
-
 
-
trim(String) - Method in class processing.data.Table
-
 
-
trim() - Method in class processing.data.XML
-
 
-
TRUE - Static variable in class processing.opengl.PGL
-
 
-
TWO_PI - Static variable in interface processing.core.PConstants
-
-
( begin auto-generated from TWO_PI.xml ) - - TWO_PI is a mathematical constant with the value 6.28318530717958647693.
-
-
TX - Static variable in class processing.core.PGraphics
-
 
-
TY - Static variable in class processing.core.PGraphics
-
 
-
TYPE - Static variable in class processing.event.KeyEvent
-
 
-
typedParse(InputStream, String) - Method in class processing.data.Table
-
 
-
TZ - Static variable in class processing.core.PGraphics
-
 
-
- - - -

U

-
-
U - Static variable in class processing.core.PGraphics
-
 
-
unbinary(String) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from unbinary.xml ) - - Converts a String representation of a binary number to its equivalent - integer value.
-
-
unbind() - Method in class processing.opengl.PShader
-
-
Unbinds the shader program.
-
-
unbind() - Method in class processing.opengl.Texture
-
 
-
unhex(String) - Static method in class processing.core.PApplet
-
-
( begin auto-generated from unhex.xml ) - - Converts a String representation of a hexadecimal number to its - equivalent integer value.
-
-
unicodeGlyphs - Variable in class processing.core.PShapeSVG.Font
-
 
-
uniform1f(int, float) - Method in class processing.opengl.PGL
-
 
-
uniform1f(int, float) - Method in class processing.opengl.PJOGL
-
 
-
uniform1fv(int, int, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
uniform1fv(int, int, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
uniform1i(int, int) - Method in class processing.opengl.PGL
-
 
-
uniform1i(int, int) - Method in class processing.opengl.PJOGL
-
 
-
uniform1iv(int, int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
uniform1iv(int, int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
uniform2f(int, float, float) - Method in class processing.opengl.PGL
-
 
-
uniform2f(int, float, float) - Method in class processing.opengl.PJOGL
-
 
-
uniform2fv(int, int, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
uniform2fv(int, int, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
uniform2i(int, int, int) - Method in class processing.opengl.PGL
-
 
-
uniform2i(int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
uniform2iv(int, int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
uniform2iv(int, int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
uniform3f(int, float, float, float) - Method in class processing.opengl.PGL
-
 
-
uniform3f(int, float, float, float) - Method in class processing.opengl.PJOGL
-
 
-
uniform3fv(int, int, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
uniform3fv(int, int, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
uniform3i(int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
uniform3i(int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
uniform3iv(int, int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
uniform3iv(int, int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
uniform4f(int, float, float, float, float) - Method in class processing.opengl.PGL
-
 
-
uniform4f(int, float, float, float, float) - Method in class processing.opengl.PJOGL
-
 
-
uniform4fv(int, int, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
uniform4fv(int, int, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
uniform4i(int, int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
uniform4i(int, int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
uniform4iv(int, int, IntBuffer) - Method in class processing.opengl.PGL
-
 
-
uniform4iv(int, int, IntBuffer) - Method in class processing.opengl.PJOGL
-
 
-
uniformMatrix2fv(int, int, boolean, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
uniformMatrix2fv(int, int, boolean, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
uniformMatrix3fv(int, int, boolean, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
uniformMatrix3fv(int, int, boolean, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
uniformMatrix4fv(int, int, boolean, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
uniformMatrix4fv(int, int, boolean, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
unmapBuffer(int) - Method in class processing.opengl.PGL
-
 
-
unmapBuffer(int) - Method in class processing.opengl.PJOGL
-
 
-
UNPACK_ALIGNMENT - Static variable in class processing.opengl.PGL
-
 
-
unregisterMethod(String, Object) - Method in class processing.core.PApplet
-
 
-
UNSIGNED_BYTE - Static variable in class processing.opengl.PGL
-
 
-
UNSIGNED_INT - Static variable in class processing.opengl.PGL
-
 
-
UNSIGNED_SHORT - Static variable in class processing.opengl.PGL
-
 
-
UNSIGNED_SHORT_4_4_4_4 - Static variable in class processing.opengl.PGL
-
 
-
UNSIGNED_SHORT_5_5_5_1 - Static variable in class processing.opengl.PGL
-
 
-
UNSIGNED_SHORT_5_6_5 - Static variable in class processing.opengl.PGL
-
 
-
UNSUPPORTED_GLPROF_ERROR - Static variable in class processing.opengl.PGL
-
 
-
UP - Static variable in interface processing.core.PConstants
-
 
-
updateDisplay() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
updatePixels() - Method in class processing.core.PApplet
-
-
( begin auto-generated from updatePixels.xml ) - - Updates the display window with the data in the pixels[] array.
-
-
updatePixels(int, int, int, int) - Method in class processing.core.PApplet
-
 
-
updatePixels() - Method in class processing.core.PGraphicsDanger2D
-
 
-
updatePixels(int, int, int, int) - Method in class processing.core.PGraphicsDanger2D
-
 
-
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
-
 
-
updatePixels(int, int, int, int) - Method in class processing.core.PImage
-
-
( begin auto-generated from PImage_updatePixels.xml ) - - Updates the image with the data in its pixels[] array.
-
-
updateProjmodelview() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
updateTexels() - Method in class processing.opengl.Texture
-
 
-
updateTexels(int, int, int, int) - Method in class processing.opengl.Texture
-
 
-
updateTexture() - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
updateTexture(int, int, int, int) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
upper() - Method in class processing.data.StringList
-
-
Make the entire list upper case.
-
-
urlDecode(String) - Static method in class processing.core.PApplet
-
 
-
urlEncode(String) - Static method in class processing.core.PApplet
-
 
-
useNativeSelect - Static variable in class processing.core.PApplet
-
-
Whether to use native (AWT) dialogs for selectInput and selectOutput.
-
-
useProgram(int) - Method in class processing.opengl.PGL
-
 
-
useProgram(int) - Method in class processing.opengl.PJOGL
-
 
-
usingMipmaps() - Method in class processing.opengl.Texture
-
-
Returns true or false whether or not the texture is using mipmaps.
-
-
usingMipmaps(boolean, int) - Method in class processing.opengl.Texture
-
 
-
usingRepeat() - Method in class processing.opengl.Texture
-
-
Returns true or false whether or not the texture is using repeat wrap mode - along either U or V directions.
-
-
usingRepeat(boolean) - Method in class processing.opengl.Texture
-
 
-
- - - -

V

-
-
V - Static variable in class processing.core.PGraphics
-
 
-
VALIDATE_STATUS - Static variable in class processing.opengl.PGL
-
 
-
validateProgram(int) - Method in class processing.opengl.PGL
-
 
-
validateProgram(int) - Method in class processing.opengl.PJOGL
-
 
-
value - Variable in class processing.core.PFont.Glyph
-
 
-
value(int) - Method in class processing.data.FloatDict
-
 
-
value(int) - Method in class processing.data.IntDict
-
 
-
value(int) - Method in class processing.data.StringDict
-
 
-
valueArray() - Method in class processing.data.FloatDict
-
-
Create a new array and copy each of the values into it.
-
-
valueArray(float[]) - Method in class processing.data.FloatDict
-
-
Fill an already-allocated array with the values (more efficient than - creating a new array each time).
-
-
valueArray() - Method in class processing.data.IntDict
-
-
Create a new array and copy each of the values into it.
-
-
valueArray(int[]) - Method in class processing.data.IntDict
-
-
Fill an already-allocated array with the values (more efficient than - creating a new array each time).
-
-
valueArray() - Method in class processing.data.StringDict
-
-
Create a new array and copy each of the values into it.
-
-
valueArray(String[]) - Method in class processing.data.StringDict
-
-
Fill an already-allocated array with the values (more efficient than - creating a new array each time).
-
-
valueIterator() - Method in class processing.data.IntDict
-
 
-
values() - Method in class processing.data.FloatDict
-
 
-
values() - Method in class processing.data.FloatList
-
-
Returns the actual array being used to store the data.
-
-
values() - Method in class processing.data.IntDict
-
 
-
values() - Method in class processing.data.IntList
-
-
Returns the actual array being used to store the data.
-
-
values() - Method in class processing.data.StringDict
-
 
-
values() - Method in class processing.data.StringList
-
-
Returns the actual array being used to store the data.
-
-
VENDOR - Static variable in class processing.opengl.PGL
-
 
-
VERSION - Static variable in class processing.opengl.PGL
-
 
-
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
-
-
Used by renderer subclasses or PShape to efficiently pass in already - formatted vertex information.
-
-
vertex(float, float, float, float) - Method in class processing.core.PApplet
-
 
-
vertex(float, float, float, float, float) - Method in class processing.core.PApplet
-
-
( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices.
-
-
VERTEX - Static variable in interface processing.core.PConstants
-
 
-
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
-
-
( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices.
-
-
vertex(float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
vertex(float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
vertex(float[]) - Method in class processing.core.PGraphicsFX2D
-
 
-
vertex(float, float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
vertex(float, float, float, float, float) - Method in class processing.core.PGraphicsFX2D
-
 
-
vertex(float, float) - Method in class processing.core.PGraphicsJava2D
-
 
-
vertex(float, float, float) - Method in class processing.core.PGraphicsJava2D
-
 
-
vertex(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(float, float) - Method in class processing.core.PShape
-
 
-
vertex(float, float, float, float) - Method in class processing.core.PShape
-
 
-
vertex(float, float, float) - Method in class processing.core.PShape
-
 
-
vertex(float, float, float, float, float) - Method in class processing.core.PShape
-
 
-
vertex(float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
vertex(float, float, float, float, float) - Method in class processing.opengl.PGraphics2D
-
 
-
vertex(float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
vertex(float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
vertex(float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
vertex(float, float, float, float, float) - Method in class processing.opengl.PGraphicsOpenGL
-
 
-
vertex(float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
vertex(float, float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
vertex(float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
vertex(float, float, float, float, float) - Method in class processing.opengl.PShapeOpenGL
-
 
-
VERTEX_ATTRIB_ARRAY_BUFFER_BINDING - Static variable in class processing.opengl.PGL
-
 
-
VERTEX_ATTRIB_ARRAY_ENABLED - Static variable in class processing.opengl.PGL
-
 
-
VERTEX_ATTRIB_ARRAY_NORMALIZED - Static variable in class processing.opengl.PGL
-
 
-
VERTEX_ATTRIB_ARRAY_POINTER - Static variable in class processing.opengl.PGL
-
 
-
VERTEX_ATTRIB_ARRAY_SIZE - Static variable in class processing.opengl.PGL
-
 
-
VERTEX_ATTRIB_ARRAY_STRIDE - Static variable in class processing.opengl.PGL
-
 
-
VERTEX_ATTRIB_ARRAY_TYPE - Static variable in class processing.opengl.PGL
-
 
-
VERTEX_FIELD_COUNT - Static variable in class processing.core.PGraphics
-
 
-
VERTEX_SHADER - Static variable in class processing.opengl.PGL
-
 
-
vertexAttri4fv(int, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
vertexAttri4fv(int, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
vertexAttrib1f(int, float) - Method in class processing.opengl.PGL
-
 
-
vertexAttrib1f(int, float) - Method in class processing.opengl.PJOGL
-
 
-
vertexAttrib1fv(int, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
vertexAttrib1fv(int, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
vertexAttrib2f(int, float, float) - Method in class processing.opengl.PGL
-
 
-
vertexAttrib2f(int, float, float) - Method in class processing.opengl.PJOGL
-
 
-
vertexAttrib2fv(int, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
vertexAttrib2fv(int, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
vertexAttrib3f(int, float, float, float) - Method in class processing.opengl.PGL
-
 
-
vertexAttrib3f(int, float, float, float) - Method in class processing.opengl.PJOGL
-
 
-
vertexAttrib3fv(int, FloatBuffer) - Method in class processing.opengl.PGL
-
 
-
vertexAttrib3fv(int, FloatBuffer) - Method in class processing.opengl.PJOGL
-
 
-
vertexAttrib4f(int, float, float, float, float) - Method in class processing.opengl.PGL
-
 
-
vertexAttrib4f(int, float, float, float, float) - Method in class processing.opengl.PJOGL
-
 
-
vertexAttribPointer(int, int, int, boolean, int, int) - Method in class processing.opengl.PGL
-
 
-
vertexAttribPointer(int, int, int, boolean, int, Buffer) - Method in class processing.opengl.PGL
-
 
-
vertexAttribPointer(int, int, int, boolean, int, int) - Method in class processing.opengl.PJOGL
-
 
-
vertexAttribPointer(int, int, int, boolean, int, Buffer) - Method in class processing.opengl.PJOGL
-
 
-
VIEWPORT - Static variable in class processing.opengl.PGL
-
 
-
viewport(int, int, int, int) - Method in class processing.opengl.PGL
-
 
-
viewport(int, int, int, int) - Method in class processing.opengl.PJOGL
-
 
-
VW - Static variable in class processing.core.PGraphics
-
 
-
VX - Static variable in class processing.core.PGraphics
-
 
-
VY - Static variable in class processing.core.PGraphics
-
 
-
VZ - Static variable in class processing.core.PGraphics
-
 
-
- - - -

W

-
-
WAIT - Static variable in interface processing.core.PConstants
-
 
-
WHEEL - Static variable in class processing.event.MouseEvent
-
 
-
WHITESPACE - Static variable in interface processing.core.PConstants
-
 
-
width - Variable in class processing.core.PApplet
-
-
( begin auto-generated from width.xml ) - - System variable which stores the width of the display window.
-
-
width - Variable in class processing.core.PFont.Glyph
-
 
-
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
-
-
( begin auto-generated from PImage_width.xml ) - - The width of the image in units of pixels.
-
-
width - Variable in class processing.core.PShape
-
-
( begin auto-generated from PShape_width.xml ) - - The width of the PShape document.
-
-
width - Variable in class processing.opengl.FrameBuffer
-
 
-
width - Variable in class processing.opengl.Texture
-
 
-
WIKI - Static variable in class processing.opengl.PGL
-
 
-
WIND_EVEN_ODD - Static variable in class processing.opengl.LinePath
-
-
The winding rule constant for specifying an even-odd rule - for determining the interior of a path.
-
-
WIND_NON_ZERO - Static variable in class processing.opengl.LinePath
-
-
The winding rule constant for specifying a non-zero rule - for determining the interior of a path.
-
-
WINDOWS - Static variable in interface processing.core.PConstants
-
 
-
wrapU - Variable in class processing.opengl.Texture.Parameters
-
-
Wrapping mode along U.
-
-
wrapV - Variable in class processing.opengl.Texture.Parameters
-
-
Wrapping mode along V.
-
-
write(PrintWriter) - Method in class processing.data.FloatDict
-
-
Write tab-delimited entries out to
-
-
write(PrintWriter) - Method in class processing.data.IntDict
-
-
Write tab-delimited entries out to
-
-
write(PrintWriter) - Method in class processing.data.JSONArray
-
 
-
write(PrintWriter, String) - Method in class processing.data.JSONArray
-
 
-
write(PrintWriter) - Method in class processing.data.JSONObject
-
 
-
write(PrintWriter, String) - Method in class processing.data.JSONObject
-
 
-
write(PrintWriter) - Method in class processing.data.StringDict
-
-
Write tab-delimited entries out to
-
-
write(PrintWriter) - Method in class processing.data.XML
-
 
-
WRITE_ONLY - Static variable in class processing.opengl.PGL
-
 
-
- - - -

X

-
-
X - Static variable in interface processing.core.PConstants
-
 
-
x - Variable in class processing.core.PVector
-
-
( begin auto-generated from PVector_x.xml ) - - The x component of the vector.
-
-
XML - Class in processing.data
-
-
This is the base class used for the Processing XML library, - representing a single node of an XML tree.
-
-
XML(File) - Constructor for class processing.data.XML
-
-
Advanced users only; use loadXML() in PApplet.
-
-
XML(File, String) - Constructor for class processing.data.XML
-
-
Advanced users only; use loadXML() in PApplet.
-
-
XML(InputStream) - Constructor for class processing.data.XML
-
 
-
XML(InputStream, String) - Constructor for class processing.data.XML
-
-
Unlike the loadXML() method in PApplet, this version works with files - that are not in UTF-8 format.
-
-
XML(Reader) - Constructor for class processing.data.XML
-
-
Advanced users only; use loadXML() in PApplet.
-
-
XML(Reader, String) - Constructor for class processing.data.XML
-
-
Advanced users only; use loadXML() in PApplet.
-
-
XML(String) - Constructor for class processing.data.XML
-
 
-
- - - -

Y

-
-
Y - Static variable in interface processing.core.PConstants
-
 
-
y - Variable in class processing.core.PVector
-
-
( begin auto-generated from PVector_y.xml ) - - The y component of the vector.
-
-
year() - Static method in class processing.core.PApplet
-
-
( begin auto-generated from year.xml ) - - Processing communicates with the clock on your computer.
-
-
- - - -

Z

-
-
Z - Static variable in interface processing.core.PConstants
-
 
-
z - Variable in class processing.core.PVector
-
-
( begin auto-generated from PVector_z.xml ) - - The z component of the vector.
-
-
ZERO - Static variable in class processing.opengl.PGL
-
 
-
-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 deleted file mode 100644 index fe32431936..0000000000 --- a/build/javadoc/core/index.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - -Generated Documentation (Untitled) - - - - - - - - - -<noscript> -<div>JavaScript is disabled on your browser.</div> -</noscript> -<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. Link to <a href="overview-summary.html">Non-frame version</a>.</p> - - - diff --git a/build/javadoc/core/overview-frame.html b/build/javadoc/core/overview-frame.html deleted file mode 100644 index d3bcbd56e4..0000000000 --- a/build/javadoc/core/overview-frame.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - -Overview List - - - - - - -

 

- - diff --git a/build/javadoc/core/overview-summary.html b/build/javadoc/core/overview-summary.html deleted file mode 100644 index 9aad054766..0000000000 --- a/build/javadoc/core/overview-summary.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - -Overview - - - - - - - -
- - - - - - - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - -
Packages 
PackageDescription
processing.core 
processing.data 
processing.event 
processing.opengl 
-
- -
- - - - - - - -
- - - - diff --git a/build/javadoc/core/overview-tree.html b/build/javadoc/core/overview-tree.html deleted file mode 100644 index 8df8913708..0000000000 --- a/build/javadoc/core/overview-tree.html +++ /dev/null @@ -1,229 +0,0 @@ - - - - - -Class Hierarchy - - - - - - - -
- - - - - - - -
- - -
-

Hierarchy For All Packages

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Interface Hierarchy

- -
- -
- - - - - - - -
- - - - diff --git a/build/javadoc/core/package-list b/build/javadoc/core/package-list deleted file mode 100644 index 5d28a9d36f..0000000000 --- a/build/javadoc/core/package-list +++ /dev/null @@ -1,4 +0,0 @@ -processing.core -processing.data -processing.event -processing.opengl diff --git a/build/javadoc/core/processing/core/PApplet.html b/build/javadoc/core/processing/core/PApplet.html deleted file mode 100644 index 9bdbf61a70..0000000000 --- a/build/javadoc/core/processing/core/PApplet.html +++ /dev/null @@ -1,19001 +0,0 @@ - - - - - -PApplet - - - - - - - - - - - -
-
processing.core
-

Class PApplet

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    -
    public class PApplet
    -extends Object
    -implements PConstants
    -
    Base class for all sketches that use processing.core. -

    - The - Window Size and Full Screen page on the Wiki has useful information - about sizing, multiple displays, full screen, etc. -

    - Processing uses active mode rendering. 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(). -

    - Starting with 3.0a6, blit operations are on the EDT, so as not to cause - GUI problems with Swing and AWT. In the case of the default renderer, the - sketch renders to an offscreen image, then the EDT is asked to bring that - image to the screen. -

    - For code that needs to run on the EDT, use EventQueue.invokeLater(). When - doing so, be careful to synchronize between that code and the Processing - animation thread. That is, you can't call Processing methods from the EDT - or at any random time from another 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 Processing 3.0, we have removed Applet as the base class for PApplet. - This means that we can remove lots of legacy code, however one downside is - that it's no longer possible (without extra code) to embed a PApplet into - another Java application. -

    - As of Processing 3.0, we have discontinued support for versions of Java - prior to 1.8. We don't have enough people to support it, and for a - project of our (tiny) size, we should be focusing on the future, rather - than working around legacy Java code.

    -
  • -
-
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      PApplet() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and TypeMethod and Description
      static floatabs(float n) -
      ( begin auto-generated from abs.xml ) - - Calculates the absolute value (magnitude) of a number.
      -
      static intabs(int n) 
      static floatacos(float value) -
      ( begin auto-generated from acos.xml ) - - The inverse of cos(), returns the arc cosine of a value.
      -
      floatalpha(int rgb) -
      ( begin auto-generated from alpha.xml ) - - Extracts the alpha value from a color.
      -
      voidambient(float gray) 
      voidambient(float v1, - float v2, - float v3) 
      voidambient(int rgb) -
      ( begin auto-generated from ambient.xml ) - - Sets the ambient reflectance for shapes drawn to the screen.
      -
      voidambientLight(float v1, - float v2, - float v3) -
      ( begin auto-generated from ambientLight.xml ) - - Adds an ambient light.
      -
      voidambientLight(float v1, - float v2, - float v3, - float x, - float y, - float z) 
      static byte[]append(byte[] array, - byte value) -
      ( begin auto-generated from append.xml ) - - Expands an array by one element and adds data to the new position.
      -
      static char[]append(char[] array, - char value) 
      static float[]append(float[] array, - float value) 
      static int[]append(int[] array, - int value) 
      static Objectappend(Object array, - Object value) 
      static String[]append(String[] array, - 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) -
      ( begin auto-generated from applyMatrix.xml ) - - Multiplies the current matrix by the one specified through the - parameters.
      -
      voidapplyMatrix(PMatrix2D source) 
      voidapplyMatrix(PMatrix3D source) 
      voidarc(float a, - float b, - float c, - float d, - float start, - float stop) -
      ( begin auto-generated from arc.xml ) - - Draws an arc in the display window.
      -
      voidarc(float a, - float b, - float c, - float d, - float start, - float stop, - int mode) 
      static voidarraycopy(Object src, - int srcPosition, - Object dst, - int dstPosition, - int length) -
      Deprecated.  -
      Use arrayCopy() instead.
      -
      -
      static voidarrayCopy(Object src, - int srcPosition, - Object dst, - int dstPosition, - int length) -
      ( begin auto-generated from arrayCopy.xml ) - - Copies an array (or part of an array) to another array.
      -
      static voidarraycopy(Object src, - Object dst) -
      Deprecated.  -
      Use arrayCopy() instead.
      -
      -
      static voidarrayCopy(Object src, - Object dst) -
      Shortcut to copy the entire contents of - the source into the destination array.
      -
      static voidarraycopy(Object src, - Object dst, - int length) -
      Deprecated.  -
      Use arrayCopy() instead.
      -
      -
      static voidarrayCopy(Object src, - Object dst, - int length) -
      Convenience method for arraycopy().
      -
      static floatasin(float value) -
      ( begin auto-generated from asin.xml ) - - The inverse of sin(), returns the arc sine of a value.
      -
      static floatatan(float value) -
      ( begin auto-generated from atan.xml ) - - The inverse of tan(), returns the arc tangent of a value.
      -
      static floatatan2(float y, - float x) -
      ( begin auto-generated from atan2.xml ) - - Calculates the angle (in radians) from a specified point to the - coordinate origin as measured from the positive x-axis.
      -
      voidattrib(String name, - boolean... values) 
      voidattrib(String name, - float... values) 
      voidattrib(String name, - int... values) 
      voidbackground(float gray) 
      voidbackground(float gray, - float alpha) 
      voidbackground(float v1, - float v2, - float v3) 
      voidbackground(float v1, - float v2, - float v3, - float alpha) 
      voidbackground(int rgb) -
      ( begin auto-generated from background.xml ) - - The background() function sets the color used for the background - of the Processing window.
      -
      voidbackground(int rgb, - float alpha) 
      voidbackground(PImage image) -
      Takes an RGB or ARGB image and sets it as the background.
      -
      voidbeginCamera() -
      ( begin auto-generated from beginCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
      -
      voidbeginContour() 
      PGLbeginPGL() 
      voidbeginRaw(PGraphics rawGraphics) 
      PGraphicsbeginRaw(String renderer, - String filename) -
      ( begin auto-generated from beginRaw.xml ) - - To create vectors from 3D data, use the beginRaw() and - endRaw() commands.
      -
      voidbeginRecord(PGraphics recorder) 
      PGraphicsbeginRecord(String renderer, - String filename) -
      ( begin auto-generated from beginRecord.xml ) - - Opens a new file and all subsequent drawing functions are echoed to this - file as well as the display window.
      -
      voidbeginShape() -
      Start a new shape of type POLYGON
      -
      voidbeginShape(int kind) -
      ( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms.
      -
      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) -
      ( begin auto-generated from bezier.xml ) - - Draws a Bezier curve on the screen.
      -
      voidbezierDetail(int detail) -
      ( begin auto-generated from bezierDetail.xml ) - - Sets the resolution at which Beziers display.
      -
      floatbezierPoint(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from bezierPoint.xml ) - - Evaluates the Bezier at point t for points a, b, c, d.
      -
      floatbezierTangent(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from bezierTangent.xml ) - - Calculates the tangent of a point on a 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) -
      ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves.
      -
      static Stringbinary(byte value) -
      Returns a String that contains the binary value of a byte.
      -
      static Stringbinary(char value) -
      Returns a String that contains the binary value of a char.
      -
      static Stringbinary(int value) -
      Returns a String that contains the binary value of an int.
      -
      static Stringbinary(int value, - int digits) -
      ( begin auto-generated from binary.xml ) - - Converts a byte, char, int, or color to a String containing the - equivalent binary notation.
      -
      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) -
      ( begin auto-generated from PImage_blend.xml ) - - Blends a region of pixels into the image specified by the img - parameter.
      -
      static intblendColor(int c1, - int c2, - int mode) 
      voidblendMode(int mode) -
      ( begin auto-generated from blendMode.xml ) - - This is a new reference entry for Processing 2.0.
      -
      floatblue(int rgb) -
      ( begin auto-generated from blue.xml ) - - Extracts the blue value from a color, scaled to match current - colorMode().
      -
      voidbox(float size) -
      ( begin auto-generated from box.xml ) - - A box is an extruded rectangle.
      -
      voidbox(float w, - float h, - float d) 
      floatbrightness(int rgb) -
      ( begin auto-generated from brightness.xml ) - - Extracts the brightness value from a color.
      -
      voidcamera() -
      ( begin auto-generated from camera.xml ) - - Sets the position of the camera through setting the eye position, the - center of the scene, and which axis is facing upward.
      -
      voidcamera(float eyeX, - float eyeY, - float eyeZ, - float centerX, - float centerY, - float centerZ, - float upX, - float upY, - float upZ) 
      booleancanDraw() -
      Not official API, not guaranteed to work in the future.
      -
      static intceil(float n) -
      ( begin auto-generated from ceil.xml ) - - Calculates the closest int value that is greater than or equal to the - value of the parameter.
      -
      static StringcheckExtension(String filename) -
      Get the compression-free extension for this filename.
      -
      voidclear() 
      voidclip(float a, - float b, - float c, - float d) 
      intcolor(float fgray) 
      intcolor(float fgray, - float falpha) 
      intcolor(float v1, - float v2, - float v3) 
      intcolor(float v1, - float v2, - float v3, - float alpha) 
      intcolor(int gray) -
      ( begin auto-generated from color.xml ) - - Creates colors for storing in variables of the color datatype.
      -
      intcolor(int gray, - int alpha) -
      As of 0116 this also takes color(#FF8800, alpha)
      -
      intcolor(int v1, - int v2, - int v3) 
      intcolor(int v1, - int v2, - int v3, - int alpha) 
      voidcolorMode(int mode) -
      ( begin auto-generated from colorMode.xml ) - - Changes the way Processing interprets color data.
      -
      voidcolorMode(int mode, - float max) 
      voidcolorMode(int mode, - float max1, - float max2, - float max3) 
      voidcolorMode(int mode, - float max1, - float max2, - float max3, - float maxA) 
      static boolean[]concat(boolean[] a, - boolean[] b) -
      ( begin auto-generated from concat.xml ) - - Concatenates two arrays.
      -
      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 Objectconcat(Object a, - Object b) 
      static String[]concat(String[] a, - String[] b) 
      static floatconstrain(float amt, - float low, - float high) -
      ( begin auto-generated from constrain.xml ) - - Constrains a value to not exceed a maximum and minimum value.
      -
      static intconstrain(int amt, - int low, - int high) 
      PImagecopy() 
      voidcopy(int sx, - int sy, - int sw, - int sh, - int dx, - int dy, - int dw, - int dh) -
      ( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another.
      -
      voidcopy(PImage src, - int sx, - int sy, - int sw, - int sh, - int dx, - int dy, - int dw, - int dh) 
      static floatcos(float angle) -
      ( begin auto-generated from cos.xml ) - - Calculates the cosine of an angle.
      -
      PFontcreateFont(String name, - float size) 
      PFontcreateFont(String name, - float size, - boolean smooth) 
      PFontcreateFont(String name, - float size, - boolean smooth, - char[] charset) -
      ( begin auto-generated from createFont.xml ) - - Dynamically converts a font to the format used by Processing from either - a font name that's installed on the computer, or from a .ttf or .otf - file inside the sketches "data" folder.
      -
      PGraphicscreateGraphics(int w, - int h) 
      PGraphicscreateGraphics(int w, - int h, - String renderer) -
      ( begin auto-generated from createGraphics.xml ) - - Creates and returns a new PGraphics object of the types P2D or - P3D.
      -
      PGraphicscreateGraphics(int w, - int h, - String renderer, - String path) -
      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 w, - int h, - int format) -
      ( begin auto-generated from createImage.xml ) - - Creates a new PImage (the datatype for storing images).
      -
      static InputStreamcreateInput(File file) 
      InputStreamcreateInput(String filename) -
      ( begin auto-generated from createInput.xml ) - - This is a function for advanced programmers to open a Java InputStream.
      -
      InputStreamcreateInputRaw(String filename) -
      Call openStream() without automatic gzip decompression.
      -
      static OutputStreamcreateOutput(File file) 
      OutputStreamcreateOutput(String filename) -
      ( begin auto-generated from createOutput.xml ) - - Similar to createInput(), this creates a Java OutputStream - for a given filename or path.
      -
      static voidcreatePath(File file) 
      static voidcreatePath(String path) -
      Takes a path and creates any in-between folders if they don't - already exist.
      -
      static BufferedReadercreateReader(File file) 
      static BufferedReadercreateReader(InputStream input) 
      BufferedReadercreateReader(String filename) -
      ( begin auto-generated from createReader.xml ) - - Creates a BufferedReader object that can be used to read files - line-by-line as individual String objects.
      -
      PShapecreateShape() 
      PShapecreateShape(int type) 
      PShapecreateShape(int kind, - float... p) 
      static PrintWritercreateWriter(File file) 
      static PrintWritercreateWriter(OutputStream output) 
      PrintWritercreateWriter(String filename) -
      ( begin auto-generated from createWriter.xml ) - - Creates a new file in the sketch folder, and a PrintWriter object - to write to it.
      -
      voidcursor() -
      Show the cursor after noCursor() was called.
      -
      voidcursor(int kind) -
      Set the cursor type
      -
      voidcursor(PImage img) -
      Replace the cursor with the specified PImage.
      -
      voidcursor(PImage img, - int x, - int y) -
      ( begin auto-generated from cursor.xml ) - - Sets the cursor to a predefined symbol, an image, or makes it visible if - already hidden.
      -
      voidcurve(float x1, - float y1, - float x2, - float y2, - float x3, - float y3, - float x4, - float y4) -
      ( begin auto-generated from curve.xml ) - - Draws a curved line on the screen.
      -
      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) -
      ( begin auto-generated from curveDetail.xml ) - - Sets the resolution at which curves display.
      -
      floatcurvePoint(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from curvePoint.xml ) - - Evalutes the curve at point t for points a, b, c, d.
      -
      floatcurveTangent(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from curveTangent.xml ) - - Calculates the tangent of a point on a curve.
      -
      voidcurveTightness(float tightness) -
      ( begin auto-generated from curveTightness.xml ) - - Modifies the quality of forms created with curve() and - curveVertex().
      -
      voidcurveVertex(float x, - float y) -
      ( begin auto-generated from curveVertex.xml ) - - Specifies vertex coordinates for curves.
      -
      voidcurveVertex(float x, - float y, - float z) 
      FiledataFile(String where) -
      Return a full path to an item in the data folder as a File object.
      -
      StringdataPath(String where) -
      Return a full path to an item in the data folder.
      -
      static intday() -
      ( begin auto-generated from day.xml ) - - Processing communicates with the clock on your computer.
      -
      static voiddebug(String msg) 
      static floatdegrees(float radians) -
      ( begin auto-generated from degrees.xml ) - - Converts a radian measurement to its corresponding value in degrees.
      -
      voiddelay(int napTime) -
      The delay() function causes the program to halt for a specified time.
      -
      static FiledesktopFile(String what) -
      Not a supported function.
      -
      static StringdesktopPath(String what) -
      Not a supported function.
      -
      voiddie(String what) -
      Function for an applet/application to kill itself and - display an error.
      -
      voiddie(String what, - Exception e) -
      Same as above but with an exception.
      -
      voiddirectionalLight(float v1, - float v2, - float v3, - float nx, - float ny, - float nz) -
      ( begin auto-generated from directionalLight.xml ) - - Adds a directional light.
      -
      intdisplayDensity() 
      static intdisplayDensity(int display) 
      voiddispose() -
      Called to dispose of resources and shut down the sketch.
      -
      static floatdist(float x1, - float y1, - float x2, - float y2) 
      static floatdist(float x1, - float y1, - float z1, - float x2, - float y2, - float z2) -
      ( begin auto-generated from dist.xml ) - - Calculates the distance between two points.
      -
      voiddraw() -
      ( begin auto-generated from draw.xml ) - - Called directly after setup() and continuously executes the lines - of code contained inside its block until the program is stopped or - noLoop() is called.
      -
      voidedge(boolean edge) -
      Sets whether the upcoming vertex is part of an edge.
      -
      voidellipse(float a, - float b, - float c, - float d) -
      ( begin auto-generated from ellipse.xml ) - - Draws an ellipse (oval) in the display window.
      -
      voidellipseMode(int mode) -
      ( begin auto-generated from ellipseMode.xml ) - - The origin of the ellipse is modified by the ellipseMode() - function.
      -
      voidemissive(float gray) -
      gray number specifying value between white and black
      -
      voidemissive(float v1, - float v2, - float v3) 
      voidemissive(int rgb) -
      ( begin auto-generated from emissive.xml ) - - Sets the emissive color of the material used for drawing shapes drawn to - the screen.
      -
      voidendCamera() -
      ( begin auto-generated from endCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
      -
      voidendContour() 
      voidendPGL() 
      voidendRaw() -
      ( begin auto-generated from endRaw.xml ) - - Complement to beginRaw(); they must always be used together.
      -
      voidendRecord() -
      ( begin auto-generated from endRecord.xml ) - - Stops the recording process started by beginRecord() and closes - the file.
      -
      voidendShape() 
      voidendShape(int mode) -
      ( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape().
      -
      static Processexec(String... args) 
      voidexit() -
      ( begin auto-generated from exit.xml ) - - Quits/stops/exits the program.
      -
      voidexitActual() -
      Some subclasses (I'm looking at you, processing.py) might wish to do something - other than actually terminate the JVM.
      -
      booleanexitCalled() 
      static floatexp(float n) -
      ( begin auto-generated from exp.xml ) - - Returns Euler's number e (2.71828...) raised to the power of the - value parameter.
      -
      static boolean[]expand(boolean[] list) -
      ( begin auto-generated from expand.xml ) - - Increases the size of an array.
      -
      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 double[]expand(double[] list) 
      static double[]expand(double[] 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 long[]expand(long[] list) 
      static long[]expand(long[] list, - int newSize) 
      static Objectexpand(Object array) 
      static Objectexpand(Object list, - int newSize) 
      static String[]expand(String[] list) 
      static String[]expand(String[] list, - int newSize) 
      voidfill(float gray) 
      voidfill(float gray, - float alpha) 
      voidfill(float v1, - float v2, - float v3) 
      voidfill(float v1, - float v2, - float v3, - float alpha) 
      voidfill(int rgb) -
      ( begin auto-generated from fill.xml ) - - Sets the color used to fill shapes.
      -
      voidfill(int rgb, - float alpha) 
      voidfilter(int kind) 
      voidfilter(int kind, - float param) -
      ( begin auto-generated from PImage_filter.xml ) - - Filters an image as defined by one of the following modes:

      THRESHOLD - converts the image to black and white pixels depending if - they are above or below the threshold defined by the level parameter.
      -
      voidfilter(PShader shader) 
      static intfloor(float n) -
      ( begin auto-generated from floor.xml ) - - Calculates the closest int value that is less than or equal to the value - of the parameter.
      -
      voidflush() 
      voidfocusGained() 
      voidfocusLost() 
      voidframeRate(float fps) -
      ( begin auto-generated from frameRate.xml ) - - Specifies the number of frames to be displayed every second.
      -
      voidfrustum(float left, - float right, - float bottom, - float top, - float near, - float far) -
      ( begin auto-generated from frustum.xml ) - - Sets a perspective matrix defined through the parameters.
      -
      voidfullScreen() -
      Create a full-screen sketch using the default renderer.
      -
      voidfullScreen(int display) 
      voidfullScreen(String renderer) -
      ( begin auto-generated from fullScreen.xml ) - - Description to come...
      -
      voidfullScreen(String renderer, - int display) 
      PImageget() -
      Returns a copy of this PImage.
      -
      intget(int x, - int y) -
      ( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image.
      -
      PImageget(int x, - int y, - int w, - int h) 
      static StringgetExtension(String filename) 
      FramegetFrame() 
      PGraphicsgetGraphics() 
      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.
      -
      floatgreen(int rgb) -
      ( begin auto-generated from green.xml ) - - Extracts the green value from a color, scaled to match current - colorMode().
      -
      voidhandleDraw() 
      static Stringhex(byte value) -
      ( begin auto-generated from hex.xml ) - - Converts a byte, char, int, or color to a String containing the - equivalent hexadecimal notation.
      -
      static Stringhex(char value) 
      static Stringhex(int value) 
      static Stringhex(int value, - int digits) 
      static voidhideMenuBar() -
      Convenience method, should only be called by PSurface subclasses.
      -
      voidhint(int which) 
      static inthour() -
      ( begin auto-generated from hour.xml ) - - Processing communicates with the clock on your computer.
      -
      floathue(int rgb) -
      ( begin auto-generated from hue.xml ) - - Extracts the hue value from a color.
      -
      voidimage(PImage img, - float a, - float b) -
      ( begin auto-generated from image.xml ) - - Displays images to the screen.
      -
      voidimage(PImage img, - float a, - float b, - float c, - float d) 
      voidimage(PImage img, - 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) -
      ( begin auto-generated from imageMode.xml ) - - Modifies the location from which images draw.
      -
      voidinit() -
      Applet initialization.
      -
      StringinsertFrame(String what) -
      Check a string for #### signs to see if the frame number should be - inserted.
      -
      static Stringjoin(String[] list, - char separator) -
      ( begin auto-generated from join.xml ) - - Combines an array of Strings into one String, each separated by the - character(s) used for the separator parameter.
      -
      static Stringjoin(String[] list, - String separator) 
      voidkeyPressed() -
      ( begin auto-generated from keyPressed.xml ) - - The keyPressed() function is called once every time a key is - pressed.
      -
      voidkeyPressed(KeyEvent event) 
      voidkeyReleased() -
      ( begin auto-generated from keyReleased.xml ) - - The keyReleased() function is called once every time a key is - released.
      -
      voidkeyReleased(KeyEvent event) 
      voidkeyTyped() -
      ( begin auto-generated from keyTyped.xml ) - - The keyTyped() function is called once every time a key is - pressed, but action keys such as Ctrl, Shift, and Alt are ignored.
      -
      voidkeyTyped(KeyEvent event) 
      static Processlaunch(String... args) -
      Launch a process using the platform's shell.
      -
      static voidlaunch(String filename) -
      ( begin auto-generated from launch.xml ) - - Attempts to open an application or file using your platform's launcher.
      -
      static floatlerp(float start, - float stop, - float amt) -
      ( begin auto-generated from lerp.xml ) - - Calculates a number between two numbers at a specific increment.
      -
      intlerpColor(int c1, - int c2, - float amt) -
      ( begin auto-generated from lerpColor.xml ) - - Calculates a color or colors between two color at a specific increment.
      -
      static intlerpColor(int c1, - int c2, - float amt, - int mode) 
      voidlightFalloff(float constant, - float linear, - float quadratic) -
      ( begin auto-generated from lightFalloff.xml ) - - Sets the falloff rates for point lights, spot lights, and ambient - lights.
      -
      voidlights() -
      ( begin auto-generated from lights.xml ) - - Sets the default ambient light, directional light, falloff, and specular - values.
      -
      voidlightSpecular(float v1, - float v2, - float v3) -
      ( begin auto-generated from lightSpecular.xml ) - - Sets the specular color for lights.
      -
      voidline(float x1, - float y1, - float x2, - float y2) -
      ( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen.
      -
      voidline(float x1, - float y1, - float z1, - float x2, - float y2, - float z2) 
      voidlink(String url) -
      Links to a webpage either in the same window or in a new window.
      -
      static byte[]loadBytes(File file) 
      static byte[]loadBytes(InputStream input) 
      byte[]loadBytes(String filename) -
      ( begin auto-generated from loadBytes.xml ) - - Reads the contents of a file or url and places it in a byte array.
      -
      PFontloadFont(String filename) -
      ( begin auto-generated from loadFont.xml ) - - Loads a font into a variable of type PFont.
      -
      PImageloadImage(String filename) -
      ( begin auto-generated from loadImage.xml ) - - Loads an image into a variable of type PImage.
      -
      PImageloadImage(String filename, - String extension) 
      static JSONArrayloadJSONArray(File file) 
      JSONArrayloadJSONArray(String filename) 
      static JSONObjectloadJSONObject(File file) 
      JSONObjectloadJSONObject(String filename) 
      voidloadPixels() -
      ( begin auto-generated from loadPixels.xml ) - - Loads the pixel data for the display window into the pixels[] - array.
      -
      PShaderloadShader(String fragFilename) -
      ( begin auto-generated from loadShader.xml ) - - This is a new reference entry for Processing 2.0.
      -
      PShaderloadShader(String fragFilename, - String vertFilename) 
      PShapeloadShape(String filename) 
      PShapeloadShape(String filename, - String options) 
      static String[]loadStrings(BufferedReader reader) 
      static String[]loadStrings(File file) 
      static String[]loadStrings(InputStream input) 
      String[]loadStrings(String filename) -
      ( begin auto-generated from loadStrings.xml ) - - Reads the contents of a file or url and creates a String array of its - individual lines.
      -
      TableloadTable(String filename) 
      TableloadTable(String filename, - String options) -
      Options may contain "header", "tsv", "csv", or "bin" separated by commas.
      -
      XMLloadXML(String filename) 
      XMLloadXML(String filename, - String options) 
      static floatlog(float n) -
      ( begin auto-generated from log.xml ) - - Calculates the natural logarithm (the base-e logarithm) of a - number.
      -
      voidloop() -
      ( begin auto-generated from loop.xml ) - - Causes Processing to continuously execute the code within draw().
      -
      static floatmag(float a, - float b) 
      static floatmag(float a, - float b, - float c) -
      ( begin auto-generated from mag.xml ) - - Calculates the magnitude (or length) of a vector.
      -
      static voidmain(String mainClass) -
      Convenience method so that PApplet.main("YourSketch") launches a sketch, - rather than having to wrap it into a single element String array.
      -
      static voidmain(String[] args) -
      main() method for running this class from the command line.
      -
      static voidmain(String mainClass, - String[] sketchArgs) -
      Convenience method so that PApplet.main("YourSketch", args) launches a - sketch, rather than having to wrap it into a String array, and appending - the 'args' array when not null.
      -
      static floatmap(float value, - float start1, - float stop1, - float start2, - float stop2) -
      ( begin auto-generated from map.xml ) - - Re-maps a number from one range to another.
      -
      voidmask(PImage img) -
      ( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel.
      -
      static String[]match(String str, - String regexp) -
      ( begin auto-generated from match.xml ) - - The match() function is used to apply a regular expression to a piece of - text, and return matching groups (elements found inside parentheses) as - a String array.
      -
      static String[][]matchAll(String str, - String regexp) -
      ( begin auto-generated from matchAll.xml ) - - This function is used to apply a regular expression to a piece of text, - and return a list of matching groups (elements found inside parentheses) - as a two-dimensional String array.
      -
      static floatmax(float[] list) 
      static floatmax(float a, - float b) 
      static floatmax(float a, - float b, - float c) 
      static intmax(int[] list) 
      static intmax(int a, - int b) -
      ( begin auto-generated from max.xml ) - - Determines the largest value in a sequence of numbers.
      -
      static intmax(int a, - int b, - int c) 
      voidmethod(String name) -
      Call a method in the current class based on its name.
      -
      intmillis() -
      ( begin auto-generated from millis.xml ) - - Returns the number of milliseconds (thousandths of a second) since - starting an applet.
      -
      static floatmin(float[] list) 
      static floatmin(float a, - float b) 
      static floatmin(float a, - float b, - float c) -
      ( begin auto-generated from min.xml ) - - Determines the smallest value in a sequence of numbers.
      -
      static intmin(int[] list) 
      static intmin(int a, - int b) -
      Find the maximum value in an array.
      -
      static intmin(int a, - int b, - int c) 
      static intminute() -
      ( begin auto-generated from minute.xml ) - - Processing communicates with the clock on your computer.
      -
      floatmodelX(float x, - float y, - float z) -
      ( begin auto-generated from modelX.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
      -
      floatmodelY(float x, - float y, - float z) -
      ( begin auto-generated from modelY.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
      -
      floatmodelZ(float x, - float y, - float z) -
      ( begin auto-generated from modelZ.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
      -
      static intmonth() -
      ( begin auto-generated from month.xml ) - - Processing communicates with the clock on your computer.
      -
      voidmouseClicked() -
      ( begin auto-generated from mouseClicked.xml ) - - The mouseClicked() function is called once after a mouse button - has been pressed and then released.
      -
      voidmouseClicked(MouseEvent event) 
      voidmouseDragged() -
      ( begin auto-generated from mouseDragged.xml ) - - The mouseDragged() function is called once every time the mouse - moves and a mouse button is pressed.
      -
      voidmouseDragged(MouseEvent event) 
      voidmouseEntered() 
      voidmouseEntered(MouseEvent event) 
      voidmouseExited() 
      voidmouseExited(MouseEvent event) 
      voidmouseMoved() -
      ( begin auto-generated from mouseMoved.xml ) - - The mouseMoved() function is called every time the mouse moves - and a mouse button is not pressed.
      -
      voidmouseMoved(MouseEvent event) 
      voidmousePressed() -
      ( begin auto-generated from mousePressed.xml ) - - The mousePressed() function is called once after every time a - mouse button is pressed.
      -
      voidmousePressed(MouseEvent event) 
      voidmouseReleased() -
      ( begin auto-generated from mouseReleased.xml ) - - The mouseReleased() function is called every time a mouse button - is released.
      -
      voidmouseReleased(MouseEvent event) 
      voidmouseWheel() 
      voidmouseWheel(MouseEvent event) -
      The event.getAmount() method returns negative values if the mouse wheel - if rotated up or away from the user and positive in the other direction.
      -
      static String[]nf(float[] num, - int left, - int right) 
      static Stringnf(float num, - int left, - int right) 
      static String[]nf(int[] num, - int digits) 
      static Stringnf(int num, - int digits) -
      ( begin auto-generated from nf.xml ) - - Utility function for formatting numbers into strings.
      -
      static String[]nfc(float[] num, - int right) 
      static Stringnfc(float num, - int right) 
      static Stringnfc(int num) -
      nfc() or "number format with commas".
      -
      static String[]nfc(int[] num) -
      ( begin auto-generated from nfc.xml ) - - Utility function for formatting numbers into strings and placing - appropriate commas to mark units of 1000.
      -
      static String[]nfp(float[] num, - int left, - int right) 
      static Stringnfp(float num, - int left, - int right) 
      static String[]nfp(int[] num, - int digits) 
      static Stringnfp(int num, - int digits) -
      ( begin auto-generated from nfp.xml ) - - Utility function for formatting numbers into strings.
      -
      static String[]nfs(float[] num, - int left, - int right) 
      static Stringnfs(float num, - int left, - int right) 
      static String[]nfs(int[] num, - int digits) 
      static Stringnfs(int num, - int digits) -
      ( begin auto-generated from nfs.xml ) - - Utility function for formatting numbers into strings.
      -
      voidnoClip() 
      voidnoCursor() -
      ( begin auto-generated from noCursor.xml ) - - Hides the cursor from view.
      -
      voidnoFill() -
      ( begin auto-generated from noFill.xml ) - - Disables filling geometry.
      -
      floatnoise(float x) 
      floatnoise(float x, - float y) 
      floatnoise(float x, - float y, - float z) -
      ( begin auto-generated from noise.xml ) - - Returns the Perlin noise value at specified coordinates.
      -
      voidnoiseDetail(int lod) -
      ( begin auto-generated from noiseDetail.xml ) - - Adjusts the character and level of detail produced by the Perlin noise - function.
      -
      voidnoiseDetail(int lod, - float falloff) 
      voidnoiseSeed(long seed) -
      ( begin auto-generated from noiseSeed.xml ) - - Sets the seed value for noise().
      -
      voidnoLights() -
      ( begin auto-generated from noLights.xml ) - - Disable all lighting.
      -
      voidnoLoop() -
      ( begin auto-generated from noLoop.xml ) - - Stops Processing from continuously executing the code within - draw().
      -
      static floatnorm(float value, - float start, - float stop) -
      ( begin auto-generated from norm.xml ) - - Normalizes a number from another range into a value between 0 and 1.
      -
      voidnormal(float nx, - float ny, - float nz) -
      ( begin auto-generated from normal.xml ) - - Sets the current normal vector.
      -
      voidnoSmooth() 
      voidnoStroke() -
      ( begin auto-generated from noStroke.xml ) - - Disables drawing the stroke (outline).
      -
      voidnoTexture() -
      Removes texture image for current shape.
      -
      voidnoTint() -
      ( begin auto-generated from noTint.xml ) - - Removes the current fill value for displaying images and reverts to - displaying images with their original hues.
      -
      voidorientation(int which) 
      voidortho() -
      ( begin auto-generated from ortho.xml ) - - Sets an orthographic projection and defines a parallel clipping volume.
      -
      voidortho(float left, - float right, - float bottom, - float top) 
      voidortho(float left, - float right, - float bottom, - float top, - float near, - float far) 
      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(String what) -
      Convert the string "true" or "false" to a boolean.
      -
      static boolean[]parseBoolean(String[] what) 
      static byteparseByte(boolean what) 
      static byte[]parseByte(boolean[] 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 float[]parseFloat(byte[] what) 
      static floatparseFloat(int what) -
      Convert an int to a float value.
      -
      static float[]parseFloat(int[] what) 
      static floatparseFloat(String what) 
      static float[]parseFloat(String[] what) 
      static float[]parseFloat(String[] what, - float missing) 
      static floatparseFloat(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(String what) -
      Parse a String into an int value.
      -
      static int[]parseInt(String[] what) -
      Make an array of int elements from an array of String objects.
      -
      static int[]parseInt(String[] what, - int missing) -
      Make an array of int elements from an array of String objects.
      -
      static intparseInt(String what, - int otherwise) -
      Parse a String to an int, and provide an alternate value that - should be used when the number is invalid.
      -
      JSONArrayparseJSONArray(String input) 
      JSONObjectparseJSONObject(String input) 
      XMLparseXML(String xmlString) 
      XMLparseXML(String xmlString, - String options) 
      voidpause() -
      Sketch has been paused.
      -
      voidperspective() -
      ( begin auto-generated from perspective.xml ) - - Sets a perspective projection applying foreshortening, making distant - objects appear smaller than closer ones.
      -
      voidperspective(float fovy, - float aspect, - float zNear, - float zFar) 
      voidpixelDensity(int density) 
      voidpoint(float x, - float y) -
      ( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel.
      -
      voidpoint(float x, - float y, - float z) 
      voidpointLight(float v1, - float v2, - float v3, - float x, - float y, - float z) -
      ( begin auto-generated from pointLight.xml ) - - Adds a point light.
      -
      voidpopMatrix() -
      ( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack.
      -
      voidpopStyle() -
      ( begin auto-generated from popStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings; these functions are - always used together.
      -
      voidpostEvent(Event pe) -
      Add an event to the internal event queue, or process it immediately if - the sketch is not currently looping.
      -
      static floatpow(float n, - float e) -
      ( begin auto-generated from pow.xml ) - - Facilitates exponential expressions.
      -
      static voidprint(boolean what) 
      static voidprint(byte what) -
      ( begin auto-generated from print.xml ) - - Writes to the console area of the Processing environment.
      -
      static voidprint(char what) 
      static voidprint(double what) 
      static voidprint(float what) 
      static voidprint(int what) 
      static voidprint(long what) 
      static voidprint(Object... variables) 
      static voidprint(String what) 
      static voidprintArray(Object what) -
      ( begin auto-generated from printArray.xml ) - - To come...
      -
      voidprintCamera() -
      ( begin auto-generated from printCamera.xml ) - - Prints the current camera matrix to the Console (the text window at the - bottom of Processing).
      -
      static voidprintln() -
      ( begin auto-generated from println.xml ) - - Writes to the text area of the Processing environment's console.
      -
      static voidprintln(boolean what) 
      static voidprintln(byte what) 
      static voidprintln(char what) 
      static voidprintln(double what) 
      static voidprintln(float what) 
      static voidprintln(int what) 
      static voidprintln(long what) 
      static voidprintln(Object... variables) 
      static voidprintln(Object what) -
      For arrays, use printArray() instead.
      -
      static voidprintln(String what) 
      voidprintMatrix() -
      ( begin auto-generated from printMatrix.xml ) - - Prints the current matrix to the Console (the text window at the bottom - of Processing).
      -
      voidprintProjection() -
      ( begin auto-generated from printProjection.xml ) - - Prints the current projection matrix to the Console (the text window at - the bottom of Processing).
      -
      voidpushMatrix() -
      ( begin auto-generated from pushMatrix.xml ) - - Pushes the current transformation matrix onto the matrix stack.
      -
      voidpushStyle() -
      ( begin auto-generated from pushStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings.
      -
      voidquad(float x1, - float y1, - float x2, - float y2, - float x3, - float y3, - float x4, - float y4) -
      ( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon.
      -
      voidquadraticVertex(float cx, - float cy, - float x3, - float y3) 
      voidquadraticVertex(float cx, - float cy, - float cz, - float x3, - float y3, - float z3) 
      static floatradians(float degrees) -
      ( begin auto-generated from radians.xml ) - - Converts a degree measurement to its corresponding value in radians.
      -
      floatrandom(float high) 
      floatrandom(float low, - float high) -
      ( begin auto-generated from random.xml ) - - Generates random numbers.
      -
      floatrandomGaussian() -
      ( begin auto-generated from randomGaussian.xml ) - - Returns a float from a random series of numbers having a mean of 0 - and standard deviation of 1.
      -
      voidrandomSeed(long seed) -
      ( begin auto-generated from randomSeed.xml ) - - Sets the seed value for random().
      -
      voidrect(float a, - float b, - float c, - float d) -
      ( begin auto-generated from rect.xml ) - - Draws a rectangle to the screen.
      -
      voidrect(float a, - float b, - float c, - float d, - float r) 
      voidrect(float a, - float b, - float c, - float d, - float tl, - float tr, - float br, - float bl) 
      voidrectMode(int mode) -
      ( begin auto-generated from rectMode.xml ) - - Modifies the location from which rectangles draw.
      -
      floatred(int rgb) -
      ( begin auto-generated from red.xml ) - - Extracts the red value from a color, scaled to match current - colorMode().
      -
      voidredraw() -
      ( begin auto-generated from redraw.xml ) - - Executes the code within draw() one time.
      -
      voidregisterMethod(String methodName, - Object target) -
      Register a built-in event so that it can be fired for libraries, etc.
      -
      PImagerequestImage(String filename) 
      PImagerequestImage(String filename, - String extension) -
      ( begin auto-generated from requestImage.xml ) - - This function load images on a separate thread so that your sketch does - not freeze while images load during setup().
      -
      voidresetMatrix() -
      ( begin auto-generated from resetMatrix.xml ) - - Replaces the current matrix with the identity matrix.
      -
      voidresetShader() -
      ( begin auto-generated from resetShader.xml ) - - This is a new reference entry for Processing 2.0.
      -
      voidresetShader(int kind) 
      voidresume() -
      Sketch has resumed.
      -
      static boolean[]reverse(boolean[] list) -
      ( begin auto-generated from reverse.xml ) - - Reverses the order of an array.
      -
      static byte[]reverse(byte[] list) 
      static char[]reverse(char[] list) 
      static float[]reverse(float[] list) 
      static int[]reverse(int[] list) 
      static Objectreverse(Object list) 
      static String[]reverse(String[] list) 
      voidrotate(float angle) -
      ( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter.
      -
      voidrotate(float angle, - float x, - float y, - float z) -
      Advanced
      -
      voidrotateX(float angle) -
      ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter.
      -
      voidrotateY(float angle) -
      ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter.
      -
      voidrotateZ(float angle) -
      ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter.
      -
      static intround(float n) -
      ( begin auto-generated from round.xml ) - - Calculates the integer closest to the value parameter.
      -
      static voidrunSketch(String[] args, - PApplet constructedSketch) 
      floatsaturation(int rgb) -
      ( begin auto-generated from saturation.xml ) - - Extracts the saturation value from a color.
      -
      voidsave(String filename) -
      ( begin auto-generated from save.xml ) - - Saves an image from the display window.
      -
      static voidsaveBytes(File file, - byte[] data) 
      static voidsaveBytes(OutputStream output, - byte[] data) 
      voidsaveBytes(String filename, - byte[] data) -
      ( begin auto-generated from saveBytes.xml ) - - Opposite of loadBytes(), will write an entire array of bytes to a - file.
      -
      FilesaveFile(String where) -
      Identical to savePath(), but returns a File object.
      -
      voidsaveFrame() 
      voidsaveFrame(String filename) -
      ( begin auto-generated from saveFrame.xml ) - - Saves a numbered sequence of images, one image each time the function is - run.
      -
      booleansaveJSONArray(JSONArray json, - String filename) 
      booleansaveJSONArray(JSONArray json, - String filename, - String options) 
      booleansaveJSONObject(JSONObject json, - String filename) 
      booleansaveJSONObject(JSONObject json, - String filename, - String options) 
      StringsavePath(String where) -
      Returns a path inside the applet folder to save to.
      -
      static booleansaveStream(File target, - InputStream source) 
      booleansaveStream(File target, - String source) -
      Identical to the other saveStream(), but writes to a File - object, for greater control over the file location.
      -
      static voidsaveStream(OutputStream target, - InputStream source) 
      booleansaveStream(String target, - InputStream source) 
      booleansaveStream(String target, - String source) -
      ( begin auto-generated from saveStream.xml ) - - Save the contents of a stream to a file in the sketch folder.
      -
      static voidsaveStrings(File file, - String[] data) 
      static voidsaveStrings(OutputStream output, - String[] data) 
      voidsaveStrings(String filename, - String[] data) -
      ( begin auto-generated from saveStrings.xml ) - - Writes an array of strings to a file, one line per string.
      -
      booleansaveTable(Table table, - String filename) 
      booleansaveTable(Table table, - String filename, - String options) 
      booleansaveXML(XML xml, - String filename) 
      booleansaveXML(XML xml, - String filename, - String options) 
      voidscale(float s) -
      ( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices.
      -
      voidscale(float x, - float y) -
      Advanced
      -
      voidscale(float x, - float y, - float z) 
      floatscreenX(float x, - float y) -
      ( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen.
      -
      floatscreenX(float x, - float y, - float z) 
      floatscreenY(float x, - float y) -
      ( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen.
      -
      floatscreenY(float x, - float y, - float z) 
      floatscreenZ(float x, - float y, - float z) -
      ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen.
      -
      static intsecond() -
      ( begin auto-generated from second.xml ) - - Processing communicates with the clock on your computer.
      -
      voidselectFolder(String prompt, - String callback) -
      See selectInput() for details.
      -
      voidselectFolder(String prompt, - String callback, - File file) 
      voidselectFolder(String prompt, - String callback, - File file, - Object callbackObject) 
      static voidselectFolder(String prompt, - String callbackMethod, - File defaultSelection, - Object callbackObject, - Frame parentFrame) 
      voidselectInput(String prompt, - String callback) -
      Open a platform-specific file chooser dialog to select a file for input.
      -
      voidselectInput(String prompt, - String callback, - File file) 
      voidselectInput(String prompt, - String callback, - File file, - Object callbackObject) 
      static voidselectInput(String prompt, - String callbackMethod, - File file, - Object callbackObject, - Frame parent) 
      voidselectOutput(String prompt, - String callback) -
      See selectInput() for details.
      -
      voidselectOutput(String prompt, - String callback, - File file) 
      voidselectOutput(String prompt, - String callback, - File file, - Object callbackObject) 
      static voidselectOutput(String prompt, - String callbackMethod, - File file, - Object callbackObject, - Frame parent) 
      voidset(int x, - int y, - int c) -
      ( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
      -
      - The x and y parameters specify the pixel to change and the - color parameter specifies the color value.
      -
      voidset(int x, - int y, - PImage img) -
      Advanced
      -
      voidsetFrame(Frame frame) 
      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.
      -
      voidsettings() -
      ( begin auto-generated from settings.xml ) - - Description to come...
      -
      voidsetup() -
      ( begin auto-generated from setup.xml ) - - The setup() function is called once when the program starts.
      -
      voidshader(PShader shader) -
      ( begin auto-generated from shader.xml ) - - This is a new reference entry for Processing 2.0.
      -
      voidshader(PShader shader, - int kind) 
      voidshape(PShape shape) 
      voidshape(PShape shape, - float x, - float y) -
      ( begin auto-generated from shape.xml ) - - Displays shapes to the screen.
      -
      voidshape(PShape shape, - float a, - float b, - float c, - float d) 
      voidshapeMode(int mode) -
      ( begin auto-generated from shapeMode.xml ) - - Modifies the location from which shapes draw.
      -
      voidshearX(float angle) -
      ( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter.
      -
      voidshearY(float angle) -
      ( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter.
      -
      voidshininess(float shine) -
      ( begin auto-generated from shininess.xml ) - - Sets the amount of gloss in the surface of shapes.
      -
      static boolean[]shorten(boolean[] list) -
      ( begin auto-generated from shorten.xml ) - - Decreases an array by one element and returns the shortened array.
      -
      static byte[]shorten(byte[] list) 
      static char[]shorten(char[] list) 
      static float[]shorten(float[] list) 
      static int[]shorten(int[] list) 
      static Objectshorten(Object list) 
      static String[]shorten(String[] list) 
      static voidshowDepthWarning(String method) -
      Display a warning that the specified method is only available with 3D.
      -
      static voidshowDepthWarningXYZ(String method) -
      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.
      -
      static voidshowMethodWarning(String method) -
      Display a warning that the specified method is simply unavailable.
      -
      static voidshowMissingWarning(String method) -
      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 voidshowVariationWarning(String str) -
      Error that a particular variation of a method is unavailable (even though - other variations are).
      -
      static floatsin(float angle) -
      ( begin auto-generated from sin.xml ) - - Calculates the sine of an angle.
      -
      voidsize(int width, - int height) -
      ( begin auto-generated from size.xml ) - - Defines the dimension of the display window in units of pixels.
      -
      voidsize(int width, - int height, - String renderer) 
      voidsize(int width, - int height, - String renderer, - String path) 
      intsketchDisplay() 
      FilesketchFile(String where) 
      booleansketchFullScreen() 
      intsketchHeight() 
      StringsketchOutputPath() 
      OutputStreamsketchOutputStream() 
      StringsketchPath() 
      StringsketchPath(String where) -
      Prepend the sketch folder path to the filename (or path) that is - passed in.
      -
      intsketchPixelDensity() 
      StringsketchRenderer() 
      intsketchSmooth() 
      intsketchWidth() 
      intsketchWindowColor() 
      voidsmooth() 
      voidsmooth(int level) 
      static byte[]sort(byte[] list) -
      ( begin auto-generated from sort.xml ) - - Sorts an array of numbers from smallest to largest and puts an array of - words in alphabetical order.
      -
      static byte[]sort(byte[] list, - int count) 
      static char[]sort(char[] list) 
      static char[]sort(char[] list, - int count) 
      static float[]sort(float[] list) 
      static float[]sort(float[] list, - int count) 
      static int[]sort(int[] list) 
      static int[]sort(int[] list, - int count) 
      static String[]sort(String[] list) 
      static String[]sort(String[] list, - int count) 
      voidspecular(float gray) -
      gray number specifying value between white and black
      -
      voidspecular(float v1, - float v2, - float v3) 
      voidspecular(int rgb) -
      ( begin auto-generated from specular.xml ) - - Sets the specular color of the materials used for shapes drawn to the - screen, which sets the color of hightlights.
      -
      voidsphere(float r) -
      ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles.
      -
      voidsphereDetail(int res) -
      ( begin auto-generated from sphereDetail.xml ) - - Controls the detail used to render a sphere by adjusting the number of - vertices of the sphere mesh.
      -
      voidsphereDetail(int ures, - int vres) 
      static boolean[]splice(boolean[] list, - boolean[] value, - int index) 
      static boolean[]splice(boolean[] list, - boolean value, - int index) -
      ( begin auto-generated from splice.xml ) - - Inserts a value or array of values into an existing array.
      -
      static byte[]splice(byte[] list, - byte[] value, - int index) 
      static byte[]splice(byte[] list, - byte value, - int index) 
      static char[]splice(char[] list, - char[] value, - int index) 
      static char[]splice(char[] list, - char value, - int index) 
      static float[]splice(float[] list, - float[] value, - int index) 
      static float[]splice(float[] list, - float value, - int index) 
      static int[]splice(int[] list, - int[] value, - int index) 
      static int[]splice(int[] list, - int value, - int index) 
      static Objectsplice(Object list, - Object value, - int index) 
      static String[]splice(String[] list, - String[] value, - int index) 
      static String[]splice(String[] list, - String value, - int index) 
      static String[]split(String value, - char delim) -
      ( begin auto-generated from split.xml ) - - The split() function breaks a string into pieces using a character or - string as the divider.
      -
      static String[]split(String value, - String delim) 
      static String[]splitTokens(String value) 
      static String[]splitTokens(String value, - String delim) -
      ( begin auto-generated from splitTokens.xml ) - - The splitTokens() function splits a String at one or many character - "tokens." The tokens parameter specifies the character or - characters to be used as a boundary.
      -
      voidspotLight(float v1, - float v2, - float v3, - float x, - float y, - float z, - float nx, - float ny, - float nz, - float angle, - float concentration) -
      ( begin auto-generated from spotLight.xml ) - - Adds a spot light.
      -
      static floatsq(float n) -
      ( begin auto-generated from sq.xml ) - - Squares a number (multiplies a number by itself).
      -
      static floatsqrt(float n) -
      ( begin auto-generated from sqrt.xml ) - - Calculates the square root of a number.
      -
      voidstart() -
      Called by the browser or applet viewer to inform this applet that it - should start its execution.
      -
      voidstop() -
      Called by the browser or applet viewer to inform - this applet that it should stop its execution.
      -
      static Stringstr(boolean x) 
      static String[]str(boolean[] x) 
      static Stringstr(byte x) 
      static String[]str(byte[] x) 
      static Stringstr(char x) 
      static String[]str(char[] x) 
      static Stringstr(float x) 
      static String[]str(float[] x) 
      static Stringstr(int x) 
      static String[]str(int[] x) 
      voidstroke(float gray) 
      voidstroke(float gray, - float alpha) 
      voidstroke(float v1, - float v2, - float v3) 
      voidstroke(float v1, - float v2, - float v3, - float alpha) 
      voidstroke(int rgb) -
      ( begin auto-generated from stroke.xml ) - - Sets the color used to draw lines and borders around shapes.
      -
      voidstroke(int rgb, - float alpha) 
      voidstrokeCap(int cap) -
      ( begin auto-generated from strokeCap.xml ) - - Sets the style for rendering line endings.
      -
      voidstrokeJoin(int join) -
      ( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments.
      -
      voidstrokeWeight(float weight) -
      ( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes.
      -
      voidstyle(PStyle s) 
      static boolean[]subset(boolean[] list, - int start) 
      static boolean[]subset(boolean[] list, - int start, - int count) -
      ( begin auto-generated from subset.xml ) - - Extracts an array of elements from an existing array.
      -
      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 Objectsubset(Object list, - int start) 
      static Objectsubset(Object list, - int start, - int count) 
      static String[]subset(String[] list, - int start) 
      static String[]subset(String[] list, - int start, - int count) 
      static floattan(float angle) -
      ( begin auto-generated from tan.xml ) - - Calculates the ratio of the sine and cosine of an angle.
      -
      voidtext(char[] chars, - int start, - int stop, - float x, - float y) -
      Advanced
      -
      voidtext(char[] chars, - int start, - int stop, - float x, - float y, - float z) 
      voidtext(char c, - float x, - float y) -
      ( begin auto-generated from text.xml ) - - Draws text to the screen.
      -
      voidtext(char c, - float x, - float y, - float z) 
      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(String str, - float x, - float y) -
      Advanced
      -
      voidtext(String str, - float x, - float y, - float z) -
      Same as above but with a z coordinate.
      -
      voidtext(String str, - float x1, - float y1, - float x2, - float y2) -
      Advanced
      -
      voidtextAlign(int alignX) 
      voidtextAlign(int alignX, - int alignY) -
      ( begin auto-generated from textAlign.xml ) - - Sets the current alignment for drawing text.
      -
      floattextAscent() -
      ( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size.
      -
      floattextDescent() -
      ( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size.
      -
      voidtextFont(PFont which) -
      ( begin auto-generated from textFont.xml ) - - Sets the current font that will be drawn with the text() - function.
      -
      voidtextFont(PFont which, - float size) 
      voidtextLeading(float leading) -
      ( begin auto-generated from textLeading.xml ) - - Sets the spacing between lines of text in units of pixels.
      -
      voidtextMode(int mode) -
      ( begin auto-generated from textMode.xml ) - - Sets the way text draws to the screen.
      -
      voidtextSize(float size) -
      ( begin auto-generated from textSize.xml ) - - Sets the current font size.
      -
      voidtexture(PImage image) -
      ( begin auto-generated from texture.xml ) - - Sets a texture to be applied to vertex points.
      -
      voidtextureMode(int mode) -
      ( begin auto-generated from textureMode.xml ) - - Sets the coordinate space for texture mapping.
      -
      voidtextureWrap(int wrap) -
      ( begin auto-generated from textureWrap.xml ) - - Description to come...
      -
      floattextWidth(char c) 
      floattextWidth(char[] chars, - int start, - int length) 
      floattextWidth(String str) -
      ( begin auto-generated from textWidth.xml ) - - Calculates and returns the width of any character or text string.
      -
      voidthread(String name) -
      Launch a new thread and call the specified function from that new thread.
      -
      voidtint(float gray) 
      voidtint(float gray, - float alpha) 
      voidtint(float v1, - float v2, - float v3) 
      voidtint(float v1, - float v2, - float v3, - float alpha) 
      voidtint(int rgb) -
      ( begin auto-generated from tint.xml ) - - Sets the fill value for displaying images.
      -
      voidtint(int rgb, - float alpha) 
      voidtranslate(float x, - float y) -
      ( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window.
      -
      voidtranslate(float x, - float y, - float z) 
      voidtriangle(float x1, - float y1, - float x2, - float y2, - float x3, - float y3) -
      ( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points.
      -
      static Stringtrim(String str) -
      ( begin auto-generated from trim.xml ) - - Removes whitespace characters from the beginning and end of a String.
      -
      static String[]trim(String[] array) 
      static intunbinary(String value) -
      ( begin auto-generated from unbinary.xml ) - - Converts a String representation of a binary number to its equivalent - integer value.
      -
      static intunhex(String value) -
      ( begin auto-generated from unhex.xml ) - - Converts a String representation of a hexadecimal number to its - equivalent integer value.
      -
      voidunregisterMethod(String name, - Object target) 
      voidupdatePixels() -
      ( begin auto-generated from updatePixels.xml ) - - Updates the display window with the data in the pixels[] array.
      -
      voidupdatePixels(int x1, - int y1, - int x2, - int y2) 
      static StringurlDecode(String str) 
      static StringurlEncode(String str) 
      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) -
      ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices.
      -
      static intyear() -
      ( begin auto-generated from year.xml ) - - Processing communicates with the clock on your computer.
      -
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        javaVersionName

        -
        public static final String javaVersionName
        -
        Full name of the Java version (i.e. 1.5.0_11).
        -
      • -
      - - - -
        -
      • -

        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 specifying a double with the preprocessor is awkward.

        -
      • -
      - - - -
        -
      • -

        platform

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

        useNativeSelect

        -
        public static boolean useNativeSelect
        -
        Whether to use native (AWT) dialogs for selectInput and selectOutput. - The native dialogs on Linux tend to be pretty awful. With selectFolder() - this is ignored, because there is no native folder selector, except on - Mac OS X. On OS X, the native folder selector will be used unless - useNativeSelect is set to false.
        -
      • -
      - - - -
        -
      • -

        g

        -
        public PGraphics g
        -
        The PGraphics renderer associated with this PApplet
        -
      • -
      - - - -
        -
      • -

        displayWidth

        -
        public int displayWidth
        -
        ( begin auto-generated from displayWidth.xml ) - - System variable which stores the width of the computer screen. For - example, if the current screen resolution is 1024x768, - displayWidth is 1024 and displayHeight is 768. These - dimensions are useful when exporting full-screen applications. -

        - To ensure that the sketch takes over the entire screen, use "Present" - instead of "Run". Otherwise the window will still have a frame border - around it and not be placed in the upper corner of the screen. On Mac OS - X, the menu bar will remain present unless "Present" mode is used. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        displayHeight

        -
        public int displayHeight
        -
        ( begin auto-generated from displayHeight.xml ) - - System variable that stores the height of the computer screen. For - example, if the current screen resolution is 1024x768, - displayWidth is 1024 and displayHeight is 768. These - dimensions are useful when exporting full-screen applications. -

        - To ensure that the sketch takes over the entire screen, use "Present" - instead of "Run". Otherwise the window will still have a frame border - around it and not be placed in the upper corner of the screen. On Mac OS - X, the menu bar will remain present unless "Present" mode is used. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        recorder

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

        args

        -
        public String[] args
        -
        Command line options passed in from main(). - This does not include the arguments passed in to PApplet itself.
        -
        -
        See Also:
        -
        main(java.lang.String[])
        -
        -
      • -
      - - - -
        -
      • -

        DEFAULT_WIDTH

        -
        public static final int DEFAULT_WIDTH
        -
        Default width and height for sketch when not specified
        -
        -
        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
        -
        ( begin auto-generated from pixels.xml ) - - Array containing the values for all the pixels in the display window. - These values are of the color datatype. This array is the size of the - display window. For example, if the image is 100x100 pixels, there will - be 10000 values and if the window is 200x300 pixels, there will be 60000 - values. The index value defines the position of a value within - the array. For example, the statement color b = pixels[230] will - set the variable b to be equal to the value at that location in - the array.
        -
        - Before accessing this array, the data must loaded with the - loadPixels() function. After the array data has been modified, - the updatePixels() function must be run to update the changes. - Without loadPixels(), running the code may (or will in future - releases) result in a NullPointerException. - - ( end auto-generated )
        -
        -
        See Also:
        -
        loadPixels(), -updatePixels(), -get(int, int, int, int), -set(int, int, int), -PImage
        -
        -
      • -
      - - - -
        -
      • -

        width

        -
        public int width
        -
        ( begin auto-generated from width.xml ) - - System variable which stores the width of the display window. This value - is set by the first parameter of the size() function. For - example, the function call size(320, 240) sets the width - variable to the value 320. The value of width is zero until - size() is called. - - ( end auto-generated )
        -
        -
        See Also:
        -
        height, -size(int, int)
        -
        -
      • -
      - - - -
        -
      • -

        height

        -
        public int height
        -
        ( begin auto-generated from height.xml ) - - System variable which stores the height of the display window. This - value is set by the second parameter of the size() function. For - example, the function call size(320, 240) sets the height - variable to the value 240. The value of height is zero until - size() is called. - - ( end auto-generated )
        -
        -
        See Also:
        -
        width, -size(int, int)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        pmouseX

        -
        public int pmouseX
        -
        ( begin auto-generated from pmouseX.xml ) - - The system variable pmouseX always contains the horizontal - position of the mouse in the frame previous to the current frame.
        -
        - You may find that pmouseX and pmouseY have different - values inside draw() and inside events like mousePressed() - and mouseMoved(). This is because they're used for different - roles, so don't mix them. Inside draw(), pmouseX and - pmouseY update only once per frame (once per trip through your - draw()). But, inside mouse events, they update each time the - event is called. If they weren't separated, then the mouse would be read - only once per frame, making response choppy. If the mouse variables were - always updated multiple times per frame, using line(pmouseX, - pmouseY, mouseX, mouseY) inside draw() would have lots - of gaps, because pmouseX may have changed several times in - between the calls to line(). Use pmouseX and - pmouseY inside draw() if you want values relative to the - previous frame. Use pmouseX and pmouseY inside the mouse - functions if you want continuous response. - - ( end auto-generated )
        -
        -
        See Also:
        -
        mouseX, -mouseY, -pmouseY, -mousePressed, -mousePressed(), -mouseReleased(), -mouseClicked(), -mouseMoved(), -mouseDragged(), -mouseButton, -mouseWheel(MouseEvent)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        firstMouse

        -
        @Deprecated
        -public boolean firstMouse
        -
        Deprecated. Please refrain from using this variable, it will be removed - from future releases of Processing because it cannot be used consistently - across platforms and input methods.
        -
        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
        -
        ( begin auto-generated from mouseButton.xml ) - - Processing automatically tracks if the mouse button is pressed and which - button is pressed. The value of the system variable mouseButton - is either LEFT, RIGHT, or CENTER depending on which - button is pressed. - - ( end auto-generated ) - -

        Advanced:

        - - If running on Mac OS, a ctrl-click will be interpreted as the right-hand - mouse button (unlike Java, which reports it as the left mouse).
        -
        -
        See Also:
        -
        mouseX, -mouseY, -pmouseX, -pmouseY, -mousePressed, -mousePressed(), -mouseReleased(), -mouseClicked(), -mouseMoved(), -mouseDragged(), -mouseWheel(MouseEvent)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        mouseEvent

        -
        @Deprecated
        -public MouseEvent mouseEvent
        -
        Deprecated. Use a mouse event handler that passes an event instead.
        -
      • -
      - - - -
        -
      • -

        key

        -
        public char key
        -
        ( begin auto-generated from key.xml ) - - The system variable key always contains the value of the most - recent key on the keyboard that was used (either pressed or released). -

        - For non-ASCII keys, use the keyCode variable. The keys included - in the ASCII specification (BACKSPACE, TAB, ENTER, RETURN, ESC, and - DELETE) do not require checking to see if they key is coded, and you - should simply use the key variable instead of keyCode If - you're making cross-platform projects, note that the ENTER key is - commonly used on PCs and Unix and the RETURN key is used instead on - Macintosh. Check for both ENTER and RETURN to make sure your program - will work for all platforms. - - ( end auto-generated ) - -

        Advanced

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

        -
        -
        See Also:
        -
        keyCode, -keyPressed, -keyPressed(), -keyReleased()
        -
        -
      • -
      - - - -
        -
      • -

        keyCode

        -
        public int keyCode
        -
        ( begin auto-generated from keyCode.xml ) - - The variable keyCode is used to detect special keys such as the - UP, DOWN, LEFT, RIGHT arrow keys and ALT, CONTROL, SHIFT. When checking - for these keys, it's first necessary to check and see if the key is - coded. This is done with the conditional "if (key == CODED)" as shown in - the example. -

        - The keys included in the ASCII specification (BACKSPACE, TAB, ENTER, - RETURN, ESC, and DELETE) do not require checking to see if they key is - coded, and you should simply use the key variable instead of - keyCode If you're making cross-platform projects, note that the - ENTER key is commonly used on PCs and Unix and the RETURN key is used - instead on Macintosh. Check for both ENTER and RETURN to make sure your - program will work for all platforms. -

        - For users familiar with Java, the values for UP and DOWN are simply - shorter versions of Java's KeyEvent.VK_UP and KeyEvent.VK_DOWN. Other - keyCode values can be found in the Java KeyEvent reference. - - ( end auto-generated ) - -

        Advanced

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

        -
        -
        See Also:
        -
        key, -keyPressed, -keyPressed(), -keyReleased()
        -
        -
      • -
      - - - -
        -
      • -

        keyPressed

        -
        public boolean keyPressed
        -
        ( begin auto-generated from keyPressed_var.xml ) - - The boolean system variable keyPressed is true if any key - is pressed and false if no keys are pressed. - - ( end auto-generated )
        -
        -
        See Also:
        -
        key, -keyCode, -keyPressed(), -keyReleased()
        -
        -
      • -
      - - - -
        -
      • -

        keyEvent

        -
        @Deprecated
        -public KeyEvent keyEvent
        -
        Deprecated. Use a key event handler that passes an event instead.
        -
        The last KeyEvent object passed into a mouse function.
        -
      • -
      - - - -
        -
      • -

        focused

        -
        public boolean focused
        -
        ( begin auto-generated from focused.xml ) - - Confirms if a Processing program is "focused", meaning that it is active - and will accept input from mouse or keyboard. This variable is "true" if - it is focused and "false" if not. This variable is often used when you - want to warn people they need to click on or roll over an applet before - it will work. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        frameRate

        -
        public float frameRate
        -
        ( begin auto-generated from frameRate_var.xml ) - - The system variable frameRate contains the approximate frame rate - of the software as it executes. The initial value is 10 fps and is - updated with each frame. The value is averaged (integrated) over several - frames. As such, this value won't be valid until after 5-10 frames. - - ( end auto-generated )
        -
        -
        See Also:
        -
        frameRate(float), -frameCount
        -
        -
      • -
      - - - -
        -
      • -

        frameCount

        -
        public int frameCount
        -
        ( begin auto-generated from frameCount.xml ) - - The system variable frameCount contains the number of frames - displayed since the program started. Inside setup() the value is - 0 and and after the first iteration of draw it is 1, etc. - - ( end auto-generated )
        -
        -
        See Also:
        -
        frameRate(float), -frameRate
        -
        -
      • -
      - - - -
        -
      • -

        finished

        -
        public volatile boolean finished
        -
        true if the sketch has stopped permanently.
        -
      • -
      - - - -
        -
      • -

        ARGS_EDITOR_LOCATION

        -
        public static final String ARGS_EDITOR_LOCATION
        -
        Position of the upper-lefthand corner of the editor window - that launched this applet.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - - - - - -
        -
      • -

        ARGS_LOCATION

        -
        public static final String ARGS_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.

        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        ARGS_DISPLAY

        -
        public static final String ARGS_DISPLAY
        -
        Used by the PDE to suggest a display (set in prefs, passed on Run)
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        ARGS_SKETCH_FOLDER

        -
        public static final 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 String EXTERNAL_STOP
        -
        When run externally to a PdeEditor, - this is sent by the sketch when it quits.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        EXTERNAL_MOVE

        -
        public static final 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
        -
        -
      • -
      - - - -
        -
      • -

        frame

        -
        public Frame frame
        -
        The frame containing this sketch (if any)
        -
      • -
      - - - -
        -
      • -

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

      Constructor Detail

      - - - -
        -
      • -

        PApplet

        -
        public PApplet()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getFrame

        -
        public Frame getFrame()
        -
      • -
      - - - -
        -
      • -

        setFrame

        -
        public void setFrame(Frame frame)
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init()
        -
        Applet initialization. This can do GUI work because the components have - not been 'realized' yet: things aren't visible, displayed, etc.
        -
      • -
      - - - -
        -
      • -

        settings

        -
        public void settings()
        -
        ( begin auto-generated from settings.xml ) - - Description to come... - - ( end auto-generated ) - - Override this method to call size() when not using the PDE.
        -
        -
        See Also:
        -
        fullScreen(), -setup(), -PApplet#size(), -smooth()
        -
        -
      • -
      - - - -
        -
      • -

        sketchWidth

        -
        public final int sketchWidth()
        -
      • -
      - - - -
        -
      • -

        sketchHeight

        -
        public final int sketchHeight()
        -
      • -
      - - - -
        -
      • -

        sketchRenderer

        -
        public final String sketchRenderer()
        -
      • -
      - - - -
        -
      • -

        sketchSmooth

        -
        public final int sketchSmooth()
        -
      • -
      - - - -
        -
      • -

        sketchFullScreen

        -
        public final boolean sketchFullScreen()
        -
      • -
      - - - -
        -
      • -

        sketchDisplay

        -
        public final int sketchDisplay()
        -
      • -
      - - - -
        -
      • -

        sketchOutputPath

        -
        public final String sketchOutputPath()
        -
      • -
      - - - -
        -
      • -

        sketchOutputStream

        -
        public final OutputStream sketchOutputStream()
        -
      • -
      - - - -
        -
      • -

        sketchWindowColor

        -
        public final int sketchWindowColor()
        -
      • -
      - - - -
        -
      • -

        sketchPixelDensity

        -
        public final int sketchPixelDensity()
        -
      • -
      - - - -
        -
      • -

        displayDensity

        -
        public int displayDensity()
        -
      • -
      - - - -
        -
      • -

        displayDensity

        -
        public static int displayDensity(int display)
        -
      • -
      - - - -
        -
      • -

        pixelDensity

        -
        public void pixelDensity(int density)
        -
        -
        Parameters:
        -
        density - 1 or 2
        -
        -
      • -
      - - - -
        -
      • -

        smooth

        -
        public void smooth()
        -
      • -
      - - - -
        -
      • -

        smooth

        -
        public void smooth(int level)
        -
        -
        Parameters:
        -
        level - either 0, 1, 2, 4, 8
        -
        -
      • -
      - - - -
        -
      • -

        noSmooth

        -
        public void noSmooth()
        -
      • -
      - - - -
        -
      • -

        getGraphics

        -
        public PGraphics getGraphics()
        -
      • -
      - - - -
        -
      • -

        orientation

        -
        public void orientation(int which)
        -
      • -
      - - - -
        -
      • -

        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.

        -
      • -
      - - - -
        -
      • -

        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.

        -
      • -
      - - - -
        -
      • -

        pause

        -
        public void pause()
        -
        Sketch has been paused. Called when switching tabs in a browser or - swapping to a different application on Android. Also called just before - quitting. Use to safely disable things like serial, sound, or sensors.
        -
      • -
      - - - -
        -
      • -

        resume

        -
        public void resume()
        -
        Sketch has resumed. Called when switching tabs in a browser or - swapping to this application on Android. Also called on startup. - Use this to safely disable things like serial, sound, or sensors.
        -
      • -
      - - - -
        -
      • -

        registerMethod

        -
        public void registerMethod(String methodName,
        -                           Object target)
        -
        Register a built-in event so that it can be fired for libraries, etc. - Supported events include: -
          -
        • pre – at the very top of the draw() method (safe to draw) -
        • draw – at the end of the draw() method (safe to draw) -
        • post – after draw() has exited (not safe to draw) -
        • pause – called when the sketch is paused -
        • resume – called when the sketch is resumed -
        • dispose – when the sketch is shutting down (definitely not safe to draw) -
            - In addition, the new (for 2.0) processing.event classes are passed to - the following event types: -
              -
            • mouseEvent -
            • keyEvent -
            • touchEvent -
            - The older java.awt events are no longer supported. - See the Library Wiki page for more details.
        -
        -
        Parameters:
        -
        methodName - name of the method to be called
        -
        target - the target object that should receive the event
        -
        -
      • -
      - - - -
        -
      • -

        unregisterMethod

        -
        public void unregisterMethod(String name,
        -                             Object target)
        -
      • -
      - - - -
        -
      • -

        setup

        -
        public void setup()
        -
        ( begin auto-generated from setup.xml ) - - The setup() function is called once when the program starts. It's - used to define initial - enviroment properties such as screen size and background color and to - load media such as images - and fonts as the program starts. There can only be one setup() - function for each program and - it shouldn't be called again after its initial execution. Note: - Variables declared within - setup() are not accessible within other functions, including - draw(). - - ( end auto-generated )
        -
        -
        See Also:
        -
        size(int, int), -loop(), -noLoop(), -draw()
        -
        -
      • -
      - - - -
        -
      • -

        draw

        -
        public void draw()
        -
        ( begin auto-generated from draw.xml ) - - Called directly after setup() and continuously executes the lines - of code contained inside its block until the program is stopped or - noLoop() is called. The draw() function is called - automatically and should never be called explicitly. It should always be - controlled with noLoop(), redraw() and loop(). - After noLoop() stops the code in draw() from executing, - redraw() causes the code inside draw() to execute once and - loop() will causes the code inside draw() to execute - continuously again. The number of times draw() executes in each - second may be controlled with frameRate() function. - There can only be one draw() function for each sketch - and draw() must exist if you want the code to run continuously or - to process events such as mousePressed(). Sometimes, you might - have an empty call to draw() in your program as shown in the - above example. - - ( end auto-generated )
        -
        -
        See Also:
        -
        setup(), -loop(), -noLoop(), -redraw(), -frameRate(float), -PGraphics.background(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        fullScreen

        -
        public void fullScreen()
        -
        Create a full-screen sketch using the default renderer.
        -
      • -
      - - - -
        -
      • -

        fullScreen

        -
        public void fullScreen(int display)
        -
      • -
      - - - -
        -
      • -

        fullScreen

        -
        public void fullScreen(String renderer)
        -
        ( begin auto-generated from fullScreen.xml ) - - Description to come... - - ( end auto-generated )
        -
        -
        Parameters:
        -
        renderer - the renderer to use, e.g. P2D, P3D, JAVA2D (default)
        -
        See Also:
        -
        settings(), -setup(), -PApplet#size(), -smooth()
        -
        -
      • -
      - - - -
        -
      • -

        fullScreen

        -
        public void fullScreen(String renderer,
        -                       int display)
        -
        -
        Parameters:
        -
        display - the screen to run the sketch on (1, 2, 3, etc.)
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public void size(int width,
        -                 int height)
        -
        ( begin auto-generated from size.xml ) - - Defines the dimension of the display window in units of pixels. The - size() function must be the first line in setup(). If - size() is not used, the default size of the window is 100x100 - pixels. The system variables width and height are set by - the parameters passed to this function.
        -
        - Do not use variables as the parameters to size() function, - because it will cause problems when exporting your sketch. When - variables are used, the dimensions of your sketch cannot be determined - during export. Instead, employ numeric values in the size() - statement, and then use the built-in width and height - variables inside your program when the dimensions of the display window - are needed.
        -
        - The size() function can only be used once inside a sketch, and - cannot be used for resizing.
        -
        renderer parameter selects which rendering engine to use. - For example, if you will be drawing 3D shapes, use P3D, if you - want to export images from a program as a PDF file use PDF. A - brief description of the three primary renderers follows:
        -
        - P2D (Processing 2D) - The default renderer that supports two - dimensional drawing.
        -
        - P3D (Processing 3D) - 3D graphics renderer that makes use of - OpenGL-compatible graphics hardware.
        -
        - PDF - The PDF renderer draws 2D graphics directly to an Acrobat - PDF file. This produces excellent results when you need vector shapes - for high resolution output or printing. You must first use Import - Library → PDF to make use of the library. More information can be - found in the PDF library reference.
        -
        - The P3D renderer doesn't support strokeCap() or - strokeJoin(), which can lead to ugly results when using - strokeWeight(). (Issue - 123)
        -
        - The maximum width and height is limited by your operating system, and is - usually the width and height of your actual screen. On some machines it - may simply be the number of pixels on your current screen, meaning that - a screen of 800x600 could support size(1600, 300), since it's the - same number of pixels. This varies widely so you'll have to try - different rendering modes and sizes until you get what you're looking - for. If you need something larger, use createGraphics to create a - non-visible drawing surface.
        -
        - Again, the size() function must be the first line of the code (or - first item inside setup). Any code that appears before the size() - command may run more than once, which can lead to confusing results. - - ( end auto-generated ) - -

        Advanced

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

        -
        -
        Parameters:
        -
        width - width of the display window in units of pixels
        -
        height - height of the display window in units of pixels
        -
        See Also:
        -
        width, -height
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public void size(int width,
        -                 int height,
        -                 String renderer)
        -
      • -
      - - - -
        -
      • -

        size

        -
        public void size(int width,
        -                 int height,
        -                 String renderer,
        -                 String path)
        -
      • -
      - - - -
        -
      • -

        createGraphics

        -
        public PGraphics createGraphics(int w,
        -                                int h)
        -
      • -
      - - - -
        -
      • -

        createGraphics

        -
        public PGraphics createGraphics(int w,
        -                                int h,
        -                                String renderer)
        -
        ( begin auto-generated from createGraphics.xml ) - - Creates and returns a new PGraphics object of the types P2D or - P3D. Use this class if you need to draw into an off-screen graphics - buffer. The PDF renderer requires the filename parameter. The DXF - renderer should not be used with createGraphics(), it's only - built for use with beginRaw() and endRaw().
        -
        - It's important to call any drawing functions between beginDraw() - and endDraw() statements. This is also true for any functions - that affect drawing, such as smooth() or colorMode().
        -
        the main drawing surface which is completely opaque, surfaces - created with createGraphics() can have transparency. This makes - it possible to draw into a graphics and maintain the alpha channel. By - using save() to write a PNG or TGA file, the transparency of the - graphics object will be honored. Note that transparency levels are - binary: pixels are either complete opaque or transparent. For the time - being, this means that text characters will be opaque blocks. This will - be fixed in a future release (Issue 80). - - ( end auto-generated ) -

        Advanced

        - 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(). -
          -
          - PGraphics big;
          -
          - void setup() {
          -   big = createGraphics(3000, 3000);
          -
          -   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. -
        • 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(). -
        -
        -
        Parameters:
        -
        w - width in pixels
        -
        h - height in pixels
        -
        renderer - Either P2D, P3D, or PDF
        -
        See Also:
        -
        PGraphics.PGraphics()
        -
        -
      • -
      - - - -
        -
      • -

        createGraphics

        -
        public PGraphics createGraphics(int w,
        -                                int h,
        -                                String renderer,
        -                                String path)
        -
        Create an offscreen graphics surface for drawing, in this case - for a renderer that writes to a file (such as PDF or DXF).
        -
        -
        Parameters:
        -
        path - the name of the file (can be an absolute or relative path)
        -
        -
      • -
      - - - -
        -
      • -

        createImage

        -
        public PImage createImage(int w,
        -                          int h,
        -                          int format)
        -
        ( begin auto-generated from createImage.xml ) - - Creates a new PImage (the datatype for storing images). This provides a - fresh buffer of pixels to play with. Set the size of the buffer with the - width and height parameters. The format parameter - defines how the pixels are stored. See the PImage reference for more information. -

        - Be sure to include all three parameters, specifying only the width and - height (but no format) will produce a strange error. -

        - Advanced users please note that createImage() should be used instead of - the syntax new PImage(). - - ( end auto-generated ) -

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        w - width in pixels
        -
        h - height in pixels
        -
        format - Either RGB, ARGB, ALPHA (grayscale alpha channel)
        -
        See Also:
        -
        PImage, -PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        handleDraw

        -
        public void handleDraw()
        -
      • -
      - - - -
        -
      • -

        canDraw

        -
        public boolean canDraw()
        -
        Not official API, not guaranteed to work in the future.
        -
      • -
      - - - -
        -
      • -

        redraw

        -
        public void redraw()
        -
        ( begin auto-generated from redraw.xml ) - - Executes the code within draw() one time. This functions allows - the program to update the display window only when necessary, for - example when an event registered by mousePressed() or - keyPressed() occurs. -

        structuring a program, it only makes sense to call redraw() - within events such as mousePressed(). This is because - redraw() does not run draw() immediately (it only sets a - flag that indicates an update is needed). -

        redraw() within draw() has no effect because - draw() is continuously called anyway. - - ( end auto-generated )
        -
        -
        See Also:
        -
        draw(), -loop(), -noLoop(), -frameRate(float)
        -
        -
      • -
      - - - -
        -
      • -

        loop

        -
        public void loop()
        -
        ( begin auto-generated from loop.xml ) - - Causes Processing to continuously execute the code within draw(). - If noLoop() is called, the code in draw() stops executing. - - ( end auto-generated )
        -
        -
        See Also:
        -
        noLoop(), -redraw(), -draw()
        -
        -
      • -
      - - - -
        -
      • -

        noLoop

        -
        public void noLoop()
        -
        ( begin auto-generated from noLoop.xml ) - - Stops Processing from continuously executing the code within - draw(). If loop() is called, the code in draw() - begin to run continuously again. If using noLoop() in - setup(), it should be the last line inside the block. -

        - When noLoop() is used, it's not possible to manipulate or access - the screen inside event handling functions such as mousePressed() - or keyPressed(). Instead, use those functions to call - redraw() or loop(), which will run draw(), which - can update the screen properly. This means that when noLoop() has been - called, no drawing can happen, and functions like saveFrame() or - loadPixels() may not be used. -

        - Note that if the sketch is resized, redraw() will be called to - update the sketch, even after noLoop() has been specified. - Otherwise, the sketch would enter an odd state until loop() was called. - - ( end auto-generated )
        -
        -
        See Also:
        -
        loop(), -redraw(), -draw()
        -
        -
      • -
      - - - -
        -
      • -

        postEvent

        -
        public void postEvent(Event pe)
        -
        Add an event to the internal event queue, or process it immediately if - the sketch is not currently looping.
        -
      • -
      - - - -
        -
      • -

        mousePressed

        -
        public void mousePressed()
        -
        ( begin auto-generated from mousePressed.xml ) - - The mousePressed() function is called once after every time a - mouse button is pressed. The mouseButton variable (see the - related reference entry) can be used to determine which button has been pressed. - - ( end auto-generated ) -

        Advanced

        - - 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.
        -
        -
        See Also:
        -
        mouseX, -mouseY, -pmouseX, -pmouseY, -mousePressed, -mouseReleased(), -mouseClicked(), -mouseMoved(), -mouseDragged(), -mouseButton, -mouseWheel(MouseEvent)
        -
        -
      • -
      - - - -
        -
      • -

        mousePressed

        -
        public void mousePressed(MouseEvent event)
        -
      • -
      - - - - - - - -
        -
      • -

        mouseReleased

        -
        public void mouseReleased(MouseEvent event)
        -
      • -
      - - - - - - - -
        -
      • -

        mouseClicked

        -
        public void mouseClicked(MouseEvent event)
        -
      • -
      - - - - - - - -
        -
      • -

        mouseDragged

        -
        public void mouseDragged(MouseEvent event)
        -
      • -
      - - - - - - - -
        -
      • -

        mouseMoved

        -
        public void mouseMoved(MouseEvent event)
        -
      • -
      - - - -
        -
      • -

        mouseEntered

        -
        public void mouseEntered()
        -
      • -
      - - - -
        -
      • -

        mouseEntered

        -
        public void mouseEntered(MouseEvent event)
        -
      • -
      - - - -
        -
      • -

        mouseExited

        -
        public void mouseExited()
        -
      • -
      - - - -
        -
      • -

        mouseExited

        -
        public void mouseExited(MouseEvent event)
        -
      • -
      - - - -
        -
      • -

        mouseWheel

        -
        public void mouseWheel()
        -
      • -
      - - - - - - - -
        -
      • -

        keyPressed

        -
        public void keyPressed()
        -
        ( begin auto-generated from keyPressed.xml ) - - The keyPressed() function is called once every time a key is - pressed. The key that was pressed is stored in the key variable. -

        - For non-ASCII keys, use the keyCode variable. The keys included - in the ASCII specification (BACKSPACE, TAB, ENTER, RETURN, ESC, and - DELETE) do not require checking to see if they key is coded, and you - should simply use the key variable instead of keyCode If - you're making cross-platform projects, note that the ENTER key is - commonly used on PCs and Unix and the RETURN key is used instead on - Macintosh. Check for both ENTER and RETURN to make sure your program - will work for all platforms. -

        - Because of how operating systems handle key repeats, holding down a key - may cause multiple calls to keyPressed() (and keyReleased() as well). - The rate of repeat is set by the operating system and how each computer - is configured. - - ( end auto-generated ) -

        Advanced

        - - 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.
        - 
        -
        -
        See Also:
        -
        key, -keyCode, -keyPressed, -keyReleased()
        -
        -
      • -
      - - - -
        -
      • -

        keyPressed

        -
        public void keyPressed(KeyEvent event)
        -
      • -
      - - - -
        -
      • -

        keyReleased

        -
        public void keyReleased()
        -
        ( begin auto-generated from keyReleased.xml ) - - The keyReleased() function is called once every time a key is - released. The key that was released will be stored in the key - variable. See key and keyReleased for more information. - - ( end auto-generated )
        -
        -
        See Also:
        -
        key, -keyCode, -keyPressed, -keyPressed()
        -
        -
      • -
      - - - -
        -
      • -

        keyReleased

        -
        public void keyReleased(KeyEvent event)
        -
      • -
      - - - -
        -
      • -

        keyTyped

        -
        public void keyTyped()
        -
        ( begin auto-generated from keyTyped.xml ) - - The keyTyped() function is called once every time a key is - pressed, but action keys such as Ctrl, Shift, and Alt are ignored. - Because of how operating systems handle key repeats, holding down a key - will cause multiple calls to keyTyped(), the rate is set by the - operating system and how each computer is configured. - - ( end auto-generated )
        -
        -
        See Also:
        -
        keyPressed, -key, -keyCode, -keyReleased()
        -
        -
      • -
      - - - -
        -
      • -

        keyTyped

        -
        public void keyTyped(KeyEvent event)
        -
      • -
      - - - -
        -
      • -

        focusGained

        -
        public void focusGained()
        -
      • -
      - - - -
        -
      • -

        focusLost

        -
        public void focusLost()
        -
      • -
      - - - -
        -
      • -

        millis

        -
        public int millis()
        -
        ( begin auto-generated from millis.xml ) - - Returns the number of milliseconds (thousandths of a second) since - starting an applet. This information is often used for timing animation - sequences. - - ( end auto-generated ) - -

        Advanced

        -

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

        -
        -
        See Also:
        -
        second(), -minute(), -hour(), -day(), -month(), -year()
        -
        -
      • -
      - - - -
        -
      • -

        second

        -
        public static int second()
        -
        ( begin auto-generated from second.xml ) - - Processing communicates with the clock on your computer. The - second() function returns the current second as a value from 0 - 59. - - ( end auto-generated )
        -
        -
        See Also:
        -
        millis(), -minute(), -hour(), -day(), -month(), -year()
        -
        -
      • -
      - - - -
        -
      • -

        minute

        -
        public static int minute()
        -
        ( begin auto-generated from minute.xml ) - - Processing communicates with the clock on your computer. The - minute() function returns the current minute as a value from 0 - 59. - - ( end auto-generated )
        -
        -
        See Also:
        -
        millis(), -second(), -hour(), -day(), -month(), -year()
        -
        -
      • -
      - - - -
        -
      • -

        hour

        -
        public static int hour()
        -
        ( begin auto-generated from hour.xml ) - - Processing communicates with the clock on your computer. The - hour() function returns the current hour as a value from 0 - 23. - - ( end auto-generated )
        -
        -
        See Also:
        -
        millis(), -second(), -minute(), -day(), -month(), -year()
        -
        -
      • -
      - - - -
        -
      • -

        day

        -
        public static int day()
        -
        ( begin auto-generated from day.xml ) - - Processing communicates with the clock on your computer. The - day() function returns the current day as a value from 1 - 31. - - ( end auto-generated ) -

        Advanced

        - 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()

        -
        -
        See Also:
        -
        millis(), -second(), -minute(), -hour(), -month(), -year()
        -
        -
      • -
      - - - -
        -
      • -

        month

        -
        public static int month()
        -
        ( begin auto-generated from month.xml ) - - Processing communicates with the clock on your computer. The - month() function returns the current month as a value from 1 - 12. - - ( end auto-generated )
        -
        -
        See Also:
        -
        millis(), -second(), -minute(), -hour(), -day(), -year()
        -
        -
      • -
      - - - -
        -
      • -

        year

        -
        public static int year()
        -
        ( begin auto-generated from year.xml ) - - Processing communicates with the clock on your computer. The - year() function returns the current year as an integer (2003, - 2004, 2005, etc). - - ( end auto-generated ) - The year() function returns the current year as an integer (2003, 2004, 2005, etc).
        -
        -
        See Also:
        -
        millis(), -second(), -minute(), -hour(), -day(), -month()
        -
        -
      • -
      - - - -
        -
      • -

        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. - - The screen only updates when the end of draw() is reached, so delay() - cannot be used to slow down drawing. For instance, you cannot use delay() - to control the timing of an animation. - - The delay() function should only be used for pausing scripts (i.e. - a script that needs to pause a few seconds before attempting a download, - or a sketch that needs to wait a few milliseconds before reading from - the serial port).
        -
      • -
      - - - -
        -
      • -

        frameRate

        -
        public void frameRate(float fps)
        -
        ( begin auto-generated from frameRate.xml ) - - Specifies the number of frames to be displayed every second. If the - processor is not fast enough to maintain the specified rate, it will not - be achieved. For example, the function call frameRate(30) will - attempt to refresh 30 times a second. It is recommended to set the frame - rate within setup(). The default rate is 60 frames per second. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        fps - number of desired frames per second
        -
        See Also:
        -
        frameRate, -frameCount, -setup(), -draw(), -loop(), -noLoop(), -redraw()
        -
        -
      • -
      - - - -
        -
      • -

        link

        -
        public void link(String url)
        -
        Links to a webpage either in the same window or in a new window. The - complete URL must be specified. - -

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        url - the complete URL, as a String in quotes
        -
        -
      • -
      - - - -
        -
      • -

        launch

        -
        public static void launch(String filename)
        -
        ( begin auto-generated from launch.xml ) - - Attempts to open an application or file using your platform's launcher. - The file parameter is a String specifying the file name and - location. The location parameter must be a full path name, or the name - of an executable in the system's PATH. In most cases, using a full path - is the best option, rather than relying on the system PATH. Be sure to - make the file executable before attempting to open it (chmod +x). -

        - The args parameter is a String or String array which is passed to - the command line. If you have multiple parameters, e.g. an application - and a document, or a command with multiple switches, use the version - that takes a String array, and place each individual item in a separate - element. -

        - If args is a String (not an array), then it can only be a single file or - application with no parameters. It's not the same as executing that - String using a shell. For instance, open("jikes -help") will not work properly. -

        - This function behaves differently on each platform. On Windows, the - parameters are sent to the Windows shell via "cmd /c". On Mac OS X, the - "open" command is used (type "man open" in Terminal.app for - documentation). On Linux, it first tries gnome-open, then kde-open, but - if neither are available, it sends the command to the shell without any - alterations. -

        - For users familiar with Java, this is not quite the same as - Runtime.exec(), because the launcher command is prepended. Instead, the - exec(String[]) function is a shortcut for - Runtime.getRuntime.exec(String[]). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of the file
        -
        -
      • -
      - - - -
        -
      • -

        launch

        -
        public static Process launch(String... args)
        -
        Launch a process using the platform's 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).
        -
        -
        Parameters:
        -
        args - list of commands passed to the command line
        -
        -
      • -
      - - - - - - - -
        -
      • -

        die

        -
        public void die(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(String what,
        -                Exception e)
        -
        Same as above but with an exception. Also needs work.
        -
      • -
      - - - -
        -
      • -

        exit

        -
        public void exit()
        -
        ( begin auto-generated from exit.xml ) - - Quits/stops/exits the program. Programs without a draw() function - exit automatically after the last line has run, but programs with - draw() run continuously until the program is manually stopped or - exit() is run.
        -
        - Rather than terminating immediately, exit() will cause the sketch - to exit after draw() has completed (or after setup() - completes if called during the setup() function).
        -
        - For Java programmers, this is not the same as System.exit(). - Further, System.exit() should not be used because closing out an - application while draw() is running may cause a crash - (particularly with P3D). - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        exitCalled

        -
        public boolean exitCalled()
        -
      • -
      - - - -
        -
      • -

        exitActual

        -
        public void exitActual()
        -
        Some subclasses (I'm looking at you, processing.py) might wish to do something - other than actually terminate the JVM. This gives them a chance to do whatever - they have in mind when cleaning up.
        -
      • -
      - - - -
        -
      • -

        dispose

        -
        public void dispose()
        -
        Called to dispose of resources and shut down the sketch. - Destroys the thread, dispose the renderer,and notify listeners. -

        - Not to be called or overriden by users. If called multiple times, - will only notify listeners once. Register a dispose listener instead.

        -
      • -
      - - - -
        -
      • -

        method

        -
        public void method(String name)
        -
        Call a method in the current class based on its name. -

        - Note that the function being called must be public. Inside the PDE, - 'public' is automatically added, but when used without the preprocessor, - (like from Eclipse) you'll have to do it yourself.

        -
      • -
      - - - -
        -
      • -

        thread

        -
        public void thread(String name)
        -
        Launch a new thread and call the specified function from that new thread. - This is a very simple way to do a thread without needing to get into - classes, runnables, etc. -

        - Note that the function being called must be public. Inside the PDE, - 'public' is automatically added, but when used without the preprocessor, - (like from Eclipse) you'll have to do it yourself.

        -
        -
        Parameters:
        -
        name - name of the function to be executed in a separate thread
        -
        See Also:
        -
        setup(), -draw(), -loop(), -noLoop()
        -
        -
      • -
      - - - -
        -
      • -

        save

        -
        public void save(String filename)
        -
        ( begin auto-generated from save.xml ) - - Saves an image from the display window. Images are saved in TIFF, TARGA, - JPEG, and PNG format depending on the extension within the - filename parameter. For example, "image.tif" will have a TIFF - image and "image.png" will save a PNG image. If no extension is included - in the filename, the image will save in TIFF format and .tif will - be added to the name. These files are saved to the sketch's folder, - which may be opened by selecting "Show sketch folder" from the "Sketch" - menu. It is not possible to use save() while running the program - in a web browser. -
        images saved from the main drawing window will be opaque. To save - images without a background, use createGraphics(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - any sequence of letters and numbers
        -
        See Also:
        -
        saveFrame(), -createGraphics(int, int, String)
        -
        -
      • -
      - - - -
        -
      • -

        saveFrame

        -
        public void saveFrame()
        -
      • -
      - - - -
        -
      • -

        saveFrame

        -
        public void saveFrame(String filename)
        -
        ( begin auto-generated from saveFrame.xml ) - - Saves a numbered sequence of images, one image each time the function is - run. To save an image that is identical to the display window, run the - function at the end of draw() or within mouse and key events such - as mousePressed() and keyPressed(). If saveFrame() - is called without parameters, it will save the files as screen-0000.tif, - screen-0001.tif, etc. It is possible to specify the name of the sequence - with the filename parameter and make the choice of saving TIFF, - TARGA, PNG, or JPEG files with the ext parameter. These image - sequences can be loaded into programs such as Apple's QuickTime software - and made into movies. These files are saved to the sketch's folder, - which may be opened by selecting "Show sketch folder" from the "Sketch" - menu.
        -
        - It is not possible to use saveXxxxx() functions inside a web browser - unless the sketch is signed applet. To - save a file back to a server, see the save to - web code snippet on the Processing Wiki.
        -
        - All images saved from the main drawing window will be opaque. To save - images without a background, use createGraphics(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - any sequence of letters or numbers that ends with either ".tif", ".tga", ".jpg", or ".png"
        -
        See Also:
        -
        save(String), -createGraphics(int, int, String, String), -frameCount
        -
        -
      • -
      - - - -
        -
      • -

        insertFrame

        -
        public String insertFrame(String what)
        -
        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.
        -
      • -
      - - - -
        -
      • -

        cursor

        -
        public void cursor(int kind)
        -
        Set the cursor type
        -
        -
        Parameters:
        -
        kind - either ARROW, CROSS, HAND, MOVE, TEXT, or WAIT
        -
        -
      • -
      - - - -
        -
      • -

        cursor

        -
        public void cursor(PImage img)
        -
        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 img,
        -                   int x,
        -                   int y)
        -
        ( begin auto-generated from cursor.xml ) - - Sets the cursor to a predefined symbol, an image, or makes it visible if - already hidden. If you are trying to set an image as the cursor, it is - recommended to make the size 16x16 or 32x32 pixels. It is not possible - to load an image as the cursor if you are exporting your program for the - Web and not all MODES work with all Web browsers. The values for - parameters x and y must be less than the dimensions of the image. -

        - Setting or hiding the cursor generally does not work with "Present" mode - (when running full-screen). - - ( end auto-generated ) -

        Advanced

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

        -
        -
        Parameters:
        -
        img - any variable of type PImage
        -
        x - the horizontal active spot of the cursor
        -
        y - the vertical active spot of the cursor
        -
        See Also:
        -
        noCursor()
        -
        -
      • -
      - - - -
        -
      • -

        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()
        -
        ( begin auto-generated from noCursor.xml ) - - Hides the cursor from view. Will not work when running the program in a - web browser or when running in full screen (Present) mode. - - ( end auto-generated ) -

        Advanced

        - Hide the cursor by creating a transparent image - and using it as a custom cursor.
        -
        -
        See Also:
        -
        cursor()
        -
        -
      • -
      - - - -
        -
      • -

        print

        -
        public static void print(byte what)
        -
        ( begin auto-generated from print.xml ) - - Writes to the console area of the Processing environment. This is often - helpful for looking at the data a program is producing. The companion - function println() works like print(), but creates a new - line of text for each call to the function. Individual elements can be - separated with quotes ("") and joined with the addition operator (+).
        -
        - Beginning with release 0125, to print the contents of an array, use - println(). There's no sensible way to do a print() of an array, - because there are too many possibilities for how to separate the data - (spaces, commas, etc). If you want to print an array as a single line, - use join(). With join(), you can choose any delimiter you - like and print() the result.
        -
        - Using print() on an object will output null, a memory - location that may look like "@10be08," or the result of the - toString() method from the object that's being printed. Advanced - users who want more useful output when calling print() on their - own classes can add a toString() method to the class that returns - a String. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        what - data to print to console
        -
        See Also:
        -
        println(), -printArray(Object), -join(String[], char)
        -
        -
      • -
      - - - -
        -
      • -

        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(long what)
        -
      • -
      - - - -
        -
      • -

        print

        -
        public static void print(float what)
        -
      • -
      - - - -
        -
      • -

        print

        -
        public static void print(double what)
        -
      • -
      - - - -
        -
      • -

        print

        -
        public static void print(String what)
        -
      • -
      - - - -
        -
      • -

        print

        -
        public static void print(Object... variables)
        -
        -
        Parameters:
        -
        variables - list of data, separated by commas
        -
        -
      • -
      - - - -
        -
      • -

        println

        -
        public static void println()
        -
        ( begin auto-generated from println.xml ) - - Writes to the text area of the Processing environment's console. This is - often helpful for looking at the data a program is producing. Each call - to this function creates a new line of output. Individual elements can - be separated with quotes ("") and joined with the string concatenation - operator (+). See print() for more about what to expect in the output. -

        println() on an array (by itself) will write the - contents of the array to the console. This is often helpful for looking - at the data a program is producing. A new line is put between each - element of the array. This function can only print one dimensional - arrays. For arrays with higher dimensions, the result will be closer to - that of print(). - - ( end auto-generated )
        -
        -
        See Also:
        -
        print(byte), -printArray(Object)
        -
        -
      • -
      - - - -
        -
      • -

        println

        -
        public static void println(byte what)
        -
        -
        Parameters:
        -
        what - data to print to console
        -
        -
      • -
      - - - -
        -
      • -

        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(long what)
        -
      • -
      - - - -
        -
      • -

        println

        -
        public static void println(float what)
        -
      • -
      - - - -
        -
      • -

        println

        -
        public static void println(double what)
        -
      • -
      - - - -
        -
      • -

        println

        -
        public static void println(String what)
        -
      • -
      - - - -
        -
      • -

        println

        -
        public static void println(Object... variables)
        -
        -
        Parameters:
        -
        variables - list of data, separated by commas
        -
        -
      • -
      - - - -
        -
      • -

        println

        -
        public static void println(Object what)
        -
        For arrays, use printArray() instead. This function causes a warning - because the new print(Object...) and println(Object...) functions can't - be reliably bound by the compiler.
        -
      • -
      - - - -
        -
      • -

        printArray

        -
        public static void printArray(Object what)
        -
        ( begin auto-generated from printArray.xml ) - - To come... - - ( end auto-generated )
        -
        -
        Parameters:
        -
        what - one-dimensional array
        -
        See Also:
        -
        print(byte), -println()
        -
        -
      • -
      - - - -
        -
      • -

        debug

        -
        public static void debug(String msg)
        -
      • -
      - - - -
        -
      • -

        abs

        -
        public static final float abs(float n)
        -
        ( begin auto-generated from abs.xml ) - - Calculates the absolute value (magnitude) of a number. The absolute - value of a number is always positive. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - number to compute
        -
        -
      • -
      - - - -
        -
      • -

        abs

        -
        public static final int abs(int n)
        -
      • -
      - - - -
        -
      • -

        sq

        -
        public static final float sq(float n)
        -
        ( begin auto-generated from sq.xml ) - - Squares a number (multiplies a number by itself). The result is always a - positive number, as multiplying two negative numbers always yields a - positive result. For example, -1 * -1 = 1. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - number to square
        -
        See Also:
        -
        sqrt(float)
        -
        -
      • -
      - - - -
        -
      • -

        sqrt

        -
        public static final float sqrt(float n)
        -
        ( begin auto-generated from sqrt.xml ) - - Calculates the square root of a number. The square root of a number is - always positive, even though there may be a valid negative root. The - square root s of number a is such that s*s = a. It - is the opposite of squaring. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - non-negative number
        -
        See Also:
        -
        pow(float, float), -sq(float)
        -
        -
      • -
      - - - -
        -
      • -

        log

        -
        public static final float log(float n)
        -
        ( begin auto-generated from log.xml ) - - Calculates the natural logarithm (the base-e logarithm) of a - number. This function expects the values greater than 0.0. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - number greater than 0.0
        -
        -
      • -
      - - - -
        -
      • -

        exp

        -
        public static final float exp(float n)
        -
        ( begin auto-generated from exp.xml ) - - Returns Euler's number e (2.71828...) raised to the power of the - value parameter. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - exponent to raise
        -
        -
      • -
      - - - -
        -
      • -

        pow

        -
        public static final float pow(float n,
        -                              float e)
        -
        ( begin auto-generated from pow.xml ) - - Facilitates exponential expressions. The pow() function is an - efficient way of multiplying numbers by themselves (or their reciprocal) - in large quantities. For example, pow(3, 5) is equivalent to the - expression 3*3*3*3*3 and pow(3, -5) is equivalent to 1 / 3*3*3*3*3. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - base of the exponential expression
        -
        e - power by which to raise the base
        -
        See Also:
        -
        sqrt(float)
        -
        -
      • -
      - - - -
        -
      • -

        max

        -
        public static final int max(int a,
        -                            int b)
        -
        ( begin auto-generated from max.xml ) - - Determines the largest value in a sequence of numbers. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - first number to compare
        -
        b - second number to compare
        -
        See Also:
        -
        min(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        max

        -
        public static final float max(float a,
        -                              float b)
        -
      • -
      - - - -
        -
      • -

        max

        -
        public static final int max(int a,
        -                            int b,
        -                            int c)
        -
        -
        Parameters:
        -
        c - third number to compare
        -
        -
      • -
      - - - -
        -
      • -

        max

        -
        public static final float max(float a,
        -                              float b,
        -                              float c)
        -
      • -
      - - - -
        -
      • -

        max

        -
        public static final int max(int[] list)
        -
        -
        Parameters:
        -
        list - array of numbers to compare
        -
        -
      • -
      - - - -
        -
      • -

        max

        -
        public static final float max(float[] list)
        -
      • -
      - - - -
        -
      • -

        min

        -
        public static final int min(int a,
        -                            int b)
        -
        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 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)
        -
        ( begin auto-generated from min.xml ) - - Determines the smallest value in a sequence of numbers. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - first number
        -
        b - second number
        -
        c - third number
        -
        See Also:
        -
        max(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        min

        -
        public static final int min(int[] list)
        -
        -
        Parameters:
        -
        list - array of numbers to compare
        -
        -
      • -
      - - - -
        -
      • -

        min

        -
        public static final float min(float[] list)
        -
      • -
      - - - -
        -
      • -

        constrain

        -
        public static final int constrain(int amt,
        -                                  int low,
        -                                  int high)
        -
      • -
      - - - -
        -
      • -

        constrain

        -
        public static final float constrain(float amt,
        -                                    float low,
        -                                    float high)
        -
        ( begin auto-generated from constrain.xml ) - - Constrains a value to not exceed a maximum and minimum value. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        amt - the value to constrain
        -
        low - minimum limit
        -
        high - maximum limit
        -
        See Also:
        -
        max(float, float, float), -min(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        sin

        -
        public static final float sin(float angle)
        -
        ( begin auto-generated from sin.xml ) - - Calculates the sine of an angle. This function expects the values of the - angle parameter to be provided in radians (values from 0 to - 6.28). Values are returned in the range -1 to 1. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - an angle in radians
        -
        See Also:
        -
        cos(float), -tan(float), -radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        cos

        -
        public static final float cos(float angle)
        -
        ( begin auto-generated from cos.xml ) - - Calculates the cosine of an angle. This function expects the values of - the angle parameter to be provided in radians (values from 0 to - PI*2). Values are returned in the range -1 to 1. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - an angle in radians
        -
        See Also:
        -
        sin(float), -tan(float), -radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        tan

        -
        public static final float tan(float angle)
        -
        ( begin auto-generated from tan.xml ) - - Calculates the ratio of the sine and cosine of an angle. This function - expects the values of the angle parameter to be provided in - radians (values from 0 to PI*2). Values are returned in the range - infinity to -infinity. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - an angle in radians
        -
        See Also:
        -
        cos(float), -sin(float), -radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        asin

        -
        public static final float asin(float value)
        -
        ( begin auto-generated from asin.xml ) - - The inverse of sin(), returns the arc sine of a value. This - function expects the values in the range of -1 to 1 and values are - returned in the range -PI/2 to PI/2. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - the value whose arc sine is to be returned
        -
        See Also:
        -
        sin(float), -acos(float), -atan(float)
        -
        -
      • -
      - - - -
        -
      • -

        acos

        -
        public static final float acos(float value)
        -
        ( begin auto-generated from acos.xml ) - - The inverse of cos(), returns the arc cosine of a value. This - function expects the values in the range of -1 to 1 and values are - returned in the range 0 to PI (3.1415927). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - the value whose arc cosine is to be returned
        -
        See Also:
        -
        cos(float), -asin(float), -atan(float)
        -
        -
      • -
      - - - -
        -
      • -

        atan

        -
        public static final float atan(float value)
        -
        ( begin auto-generated from atan.xml ) - - The inverse of tan(), returns the arc tangent of a value. This - function expects the values in the range of -Infinity to Infinity - (exclusive) and values are returned in the range -PI/2 to PI/2 . - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - -Infinity to Infinity (exclusive)
        -
        See Also:
        -
        tan(float), -asin(float), -acos(float)
        -
        -
      • -
      - - - -
        -
      • -

        atan2

        -
        public static final float atan2(float y,
        -                                float x)
        -
        ( begin auto-generated from atan2.xml ) - - Calculates the angle (in radians) from a specified point to the - coordinate origin as measured from the positive x-axis. Values are - returned as a float in the range from PI to -PI. - The atan2() function is most often used for orienting geometry to - the position of the cursor. Note: The y-coordinate of the point is the - first parameter and the x-coordinate is the second due the the structure - of calculating the tangent. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        y - y-coordinate of the point
        -
        x - x-coordinate of the point
        -
        See Also:
        -
        tan(float)
        -
        -
      • -
      - - - -
        -
      • -

        degrees

        -
        public static final float degrees(float radians)
        -
        ( begin auto-generated from degrees.xml ) - - Converts a radian measurement to its corresponding value in degrees. - Radians and degrees are two ways of measuring the same thing. There are - 360 degrees in a circle and 2*PI radians in a circle. For example, - 90° = PI/2 = 1.5707964. All trigonometric functions in Processing - require their parameters to be specified in radians. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        radians - radian value to convert to degrees
        -
        See Also:
        -
        radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        radians

        -
        public static final float radians(float degrees)
        -
        ( begin auto-generated from radians.xml ) - - Converts a degree measurement to its corresponding value in radians. - Radians and degrees are two ways of measuring the same thing. There are - 360 degrees in a circle and 2*PI radians in a circle. For example, - 90° = PI/2 = 1.5707964. All trigonometric functions in Processing - require their parameters to be specified in radians. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        degrees - degree value to convert to radians
        -
        See Also:
        -
        degrees(float)
        -
        -
      • -
      - - - -
        -
      • -

        ceil

        -
        public static final int ceil(float n)
        -
        ( begin auto-generated from ceil.xml ) - - Calculates the closest int value that is greater than or equal to the - value of the parameter. For example, ceil(9.03) returns the value 10. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - number to round up
        -
        See Also:
        -
        floor(float), -round(float)
        -
        -
      • -
      - - - -
        -
      • -

        floor

        -
        public static final int floor(float n)
        -
        ( begin auto-generated from floor.xml ) - - Calculates the closest int value that is less than or equal to the value - of the parameter. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - number to round down
        -
        See Also:
        -
        ceil(float), -round(float)
        -
        -
      • -
      - - - -
        -
      • -

        round

        -
        public static final int round(float n)
        -
        ( begin auto-generated from round.xml ) - - Calculates the integer closest to the value parameter. For - example, round(9.2) returns the value 9. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - number to round
        -
        See Also:
        -
        floor(float), -ceil(float)
        -
        -
      • -
      - - - -
        -
      • -

        mag

        -
        public static final float mag(float a,
        -                              float b)
        -
      • -
      - - - -
        -
      • -

        mag

        -
        public static final float mag(float a,
        -                              float b,
        -                              float c)
        -
        ( begin auto-generated from mag.xml ) - - Calculates the magnitude (or length) of a vector. A vector is a - direction in space commonly used in computer graphics and linear - algebra. Because it has no "start" position, the magnitude of a vector - can be thought of as the distance from coordinate (0,0) to its (x,y) - value. Therefore, mag() is a shortcut for writing "dist(0, 0, x, y)". - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - first value
        -
        b - second value
        -
        c - third value
        -
        See Also:
        -
        dist(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from dist.xml ) - - Calculates the distance between two points. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        z1 - z-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        z2 - z-coordinate of the second point
        -
        -
      • -
      - - - - - - - -
        -
      • -

        norm

        -
        public static final float norm(float value,
        -                               float start,
        -                               float stop)
        -
        ( begin auto-generated from norm.xml ) - - Normalizes a number from another range into a value between 0 and 1. -

        - Identical to map(value, low, high, 0, 1); -

        - Numbers outside the range are not clamped to 0 and 1, because - out-of-range values are often intentional and useful. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - the incoming value to be converted
        -
        start - lower bound of the value's current range
        -
        stop - upper bound of the value's current range
        -
        See Also:
        -
        map(float, float, float, float, float), -lerp(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        map

        -
        public static final float map(float value,
        -                              float start1,
        -                              float stop1,
        -                              float start2,
        -                              float stop2)
        -
        ( begin auto-generated from map.xml ) - - Re-maps a number from one range to another. In the example above, - the number '25' is converted from a value in the range 0..100 into - a value that ranges from the left edge (0) to the right edge (width) - of the screen. -

        - Numbers outside the range are not clamped to 0 and 1, because - out-of-range values are often intentional and useful. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - the incoming value to be converted
        -
        start1 - lower bound of the value's current range
        -
        stop1 - upper bound of the value's current range
        -
        start2 - lower bound of the value's target range
        -
        stop2 - upper bound of the value's target range
        -
        See Also:
        -
        norm(float, float, float), -lerp(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        random

        -
        public final float random(float high)
        -
      • -
      - - - -
        -
      • -

        randomGaussian

        -
        public final float randomGaussian()
        -
        ( begin auto-generated from randomGaussian.xml ) - - Returns a float from a random series of numbers having a mean of 0 - and standard deviation of 1. Each time the randomGaussian() - function is called, it returns a number fitting a Gaussian, or - normal, distribution. There is theoretically no minimum or maximum - value that randomGaussian() might return. Rather, there is - just a very low probability that values far from the mean will be - returned; and a higher probability that numbers near the mean will - be returned. - - ( end auto-generated )
        -
        -
        See Also:
        -
        random(float,float), -noise(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        random

        -
        public final float random(float low,
        -                          float high)
        -
        ( begin auto-generated from random.xml ) - - Generates random numbers. Each time the random() function is - called, it returns an unexpected value within the specified range. If - one parameter is passed to the function it will return a float - between zero and the value of the high parameter. The function - call random(5) returns values between 0 and 5 (starting at zero, - up to but not including 5). If two parameters are passed, it will return - a float with a value between the the parameters. The function - call random(-5, 10.2) returns values starting at -5 up to (but - not including) 10.2. To convert a floating-point random number to an - integer, use the int() function. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        low - lower limit
        -
        high - upper limit
        -
        See Also:
        -
        randomSeed(long), -noise(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        randomSeed

        -
        public final void randomSeed(long seed)
        -
        ( begin auto-generated from randomSeed.xml ) - - Sets the seed value for random(). By default, random() - produces different results each time the program is run. Set the - value parameter to a constant to return the same pseudo-random - numbers each time the software is run. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        seed - seed value
        -
        See Also:
        -
        random(float,float), -noise(float, float, float), -noiseSeed(long)
        -
        -
      • -
      - - - -
        -
      • -

        noise

        -
        public float noise(float x)
        -
      • -
      - - - -
        -
      • -

        noise

        -
        public float noise(float x,
        -                   float y)
        -
      • -
      - - - -
        -
      • -

        noise

        -
        public float noise(float x,
        -                   float y,
        -                   float z)
        -
        ( begin auto-generated from noise.xml ) - - Returns the Perlin noise value at specified coordinates. Perlin noise is - a random sequence generator producing a more natural ordered, harmonic - succession of numbers compared to the standard random() function. - It was invented by Ken Perlin in the 1980s and been used since in - graphical applications to produce procedural textures, natural motion, - shapes, terrains etc.

        The main difference to the - random() function is that Perlin noise is defined in an infinite - n-dimensional space where each pair of coordinates corresponds to a - fixed semi-random value (fixed only for the lifespan of the program). - The resulting value will always be between 0.0 and 1.0. Processing can - compute 1D, 2D and 3D noise, depending on the number of coordinates - given. The noise value can be animated by moving through the noise space - as demonstrated in the example above. The 2nd and 3rd dimension can also - be interpreted as time.

        The actual noise is structured - similar to an audio signal, in respect to the function's use of - frequencies. Similar to the concept of harmonics in physics, perlin - noise is computed over several octaves which are added together for the - final result.

        Another way to adjust the character of the - resulting sequence is the scale of the input coordinates. As the - function works within an infinite space the value of the coordinates - doesn't matter as such, only the distance between successive coordinates - does (eg. when using noise() within a loop). As a general rule - the smaller the difference between coordinates, the smoother the - resulting noise sequence will be. Steps of 0.005-0.03 work best for most - applications, but this will differ depending on use. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - x-coordinate in noise space
        -
        y - y-coordinate in noise space
        -
        z - z-coordinate in noise space
        -
        See Also:
        -
        noiseSeed(long), -noiseDetail(int, float), -random(float,float)
        -
        -
      • -
      - - - -
        -
      • -

        noiseDetail

        -
        public void noiseDetail(int lod)
        -
        ( begin auto-generated from noiseDetail.xml ) - - Adjusts the character and level of detail produced by the Perlin noise - function. Similar to harmonics in physics, noise is computed over - several octaves. Lower octaves contribute more to the output signal and - as such define the overal intensity of the noise, whereas higher octaves - create finer grained details in the noise sequence. By default, noise is - computed over 4 octaves with each octave contributing exactly half than - its predecessor, starting at 50% strength for the 1st octave. This - falloff amount can be changed by adding an additional function - parameter. Eg. a falloff factor of 0.75 means each octave will now have - 75% impact (25% less) of the previous lower octave. Any value between - 0.0 and 1.0 is valid, however note that values greater than 0.5 might - result in greater than 1.0 values returned by noise().

        By changing these parameters, the signal created by the noise() - function can be adapted to fit very specific needs and characteristics. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        lod - number of octaves to be used by the noise
        -
        falloff - falloff factor for each octave
        -
        See Also:
        -
        noise(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        noiseDetail

        -
        public void noiseDetail(int lod,
        -                        float falloff)
        -
        -
        Parameters:
        -
        falloff - falloff factor for each octave
        -
        -
      • -
      - - - -
        -
      • -

        noiseSeed

        -
        public void noiseSeed(long seed)
        -
        ( begin auto-generated from noiseSeed.xml ) - - Sets the seed value for noise(). By default, noise() - produces different results each time the program is run. Set the - value parameter to a constant to return the same pseudo-random - numbers each time the software is run. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        seed - seed value
        -
        See Also:
        -
        noise(float, float, float), -noiseDetail(int, float), -random(float,float), -randomSeed(long)
        -
        -
      • -
      - - - -
        -
      • -

        loadImage

        -
        public PImage loadImage(String filename)
        -
        ( begin auto-generated from loadImage.xml ) - - Loads an image into a variable of type PImage. Four types of - images ( .gif, .jpg, .tga, .png) images may - be loaded. To load correctly, images must be located in the data - directory of the current sketch. In most cases, load all images in - setup() to preload them at the start of the program. Loading - images inside draw() will reduce the speed of a program.
        -
        filename parameter can also be a URL to a file found - online. For security reasons, a Processing sketch found online can only - download files from the same server from which it came. Getting around - this restriction requires a signed - applet.
        -
        extension parameter is used to determine the image type in - cases where the image filename does not end with a proper extension. - Specify the extension as the second parameter to loadImage(), as - shown in the third example on this page.
        -
        an image is not loaded successfully, the null value is - returned and an error message will be printed to the console. The error - message does not halt the program, however the null value may cause a - NullPointerException if your code does not check whether the value - returned from loadImage() is null.
        -
        on the type of error, a PImage object may still be - returned, but the width and height of the image will be set to -1. This - happens if bad image data is returned or cannot be decoded properly. - Sometimes this happens with image URLs that produce a 403 error or that - redirect to a password prompt, because loadImage() will attempt - to interpret the HTML as image data. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of file to load, can be .gif, .jpg, .tga, or a handful of other image types depending on your platform
        -
        See Also:
        -
        PImage, -PGraphics.image(PImage, float, float, float, float), -PGraphics.imageMode(int), -PGraphics.background(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        loadImage

        -
        public PImage loadImage(String filename,
        -                        String extension)
        -
        -
        Parameters:
        -
        extension - type of image to load, for example "png", "gif", "jpg"
        -
        -
      • -
      - - - -
        -
      • -

        requestImage

        -
        public PImage requestImage(String filename)
        -
      • -
      - - - -
        -
      • -

        requestImage

        -
        public PImage requestImage(String filename,
        -                           String extension)
        -
        ( begin auto-generated from requestImage.xml ) - - This function load images on a separate thread so that your sketch does - not freeze while images load during setup(). While the image is - loading, its width and height will be 0. If an error occurs while - loading the image, its width and height will be set to -1. You'll know - when the image has loaded properly because its width and height will be - greater than 0. Asynchronous image loading (particularly when - downloading from a server) can dramatically improve performance.
        -
        extension parameter is used to determine the image type in - cases where the image filename does not end with a proper extension. - Specify the extension as the second parameter to requestImage(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of the file to load, can be .gif, .jpg, .tga, or a handful of other image types depending on your platform
        -
        extension - the type of image to load, for example "png", "gif", "jpg"
        -
        See Also:
        -
        PImage, -loadImage(String, String)
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        parseXML

        -
        public XML parseXML(String xmlString,
        -                    String options)
        -
      • -
      - - - -
        -
      • -

        saveXML

        -
        public boolean saveXML(XML xml,
        -                       String filename)
        -
        -
        Parameters:
        -
        xml - the XML object to save to disk
        -
        filename - name of the file to write to
        -
        See Also:
        -
        XML, -loadXML(String), -parseXML(String)
        -
        -
      • -
      - - - -
        -
      • -

        saveXML

        -
        public boolean saveXML(XML xml,
        -                       String filename,
        -                       String options)
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        loadJSONObject

        -
        public static JSONObject loadJSONObject(File file)
        -
      • -
      - - - - - - - -
        -
      • -

        saveJSONObject

        -
        public boolean saveJSONObject(JSONObject json,
        -                              String filename,
        -                              String options)
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        loadJSONArray

        -
        public static JSONArray loadJSONArray(File file)
        -
      • -
      - - - - - - - -
        -
      • -

        saveJSONArray

        -
        public boolean saveJSONArray(JSONArray json,
        -                             String filename,
        -                             String options)
        -
      • -
      - - - - - - - -
        -
      • -

        loadTable

        -
        public Table loadTable(String filename,
        -                       String options)
        -
        Options may contain "header", "tsv", "csv", or "bin" separated by commas. - - Another option is "dictionary=filename.tsv", which allows users to - specify a "dictionary" file that contains a mapping of the column titles - and the data types used in the table file. This can be far more efficient - (in terms of speed and memory usage) for loading and parsing tables. The - dictionary file can only be tab separated values (.tsv) and its extension - will be ignored. This option was added in Processing 2.0.2.
        -
      • -
      - - - -
        -
      • -

        saveTable

        -
        public boolean saveTable(Table table,
        -                         String filename)
        -
        -
        Parameters:
        -
        table - the Table object to save to a file
        -
        filename - the filename to which the Table should be saved
        -
        See Also:
        -
        Table, -loadTable(String)
        -
        -
      • -
      - - - -
        -
      • -

        saveTable

        -
        public boolean saveTable(Table table,
        -                         String filename,
        -                         String options)
        -
        -
        Parameters:
        -
        options - can be one of "tsv", "csv", "bin", or "html"
        -
        -
      • -
      - - - -
        -
      • -

        loadFont

        -
        public PFont loadFont(String filename)
        -
        ( begin auto-generated from loadFont.xml ) - - Loads a font into a variable of type PFont. To load correctly, - fonts must be located in the data directory of the current sketch. To - create a font to use with Processing, select "Create Font..." from the - Tools menu. This will create a font in the format Processing requires - and also adds it to the current sketch's data directory.
        -
        - Like loadImage() and other functions that load data, the - loadFont() function should not be used inside draw(), - because it will slow down the sketch considerably, as the font will be - re-loaded from the disk (or network) on each frame.
        -
        - For most renderers, Processing displays fonts using the .vlw font - format, which uses images for each letter, rather than defining them - through vector data. When hint(ENABLE_NATIVE_FONTS) is used with - the JAVA2D renderer, the native version of a font will be used if it is - installed on the user's machine.
        -
        - Using createFont() (instead of loadFont) enables vector data to - be used with the JAVA2D (default) renderer setting. This can be helpful - when many font sizes are needed, or when using any renderer based on - JAVA2D, such as the PDF library. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of the font to load
        -
        See Also:
        -
        PFont, -PGraphics.textFont(PFont, float), -createFont(String, float, boolean, char[])
        -
        -
      • -
      - - - -
        -
      • -

        createFont

        -
        public PFont createFont(String name,
        -                        float size)
        -
      • -
      - - - -
        -
      • -

        createFont

        -
        public PFont createFont(String name,
        -                        float size,
        -                        boolean smooth)
        -
      • -
      - - - -
        -
      • -

        createFont

        -
        public PFont createFont(String name,
        -                        float size,
        -                        boolean smooth,
        -                        char[] charset)
        -
        ( begin auto-generated from createFont.xml ) - - Dynamically converts a font to the format used by Processing from either - a font name that's installed on the computer, or from a .ttf or .otf - file inside the sketches "data" folder. This function is an advanced - feature for precise control. On most occasions you should create fonts - through selecting "Create Font..." from the Tools menu. -

        - Use the PFont.list() method to first determine the names for the - fonts recognized by the computer and are compatible with this function. - Because of limitations in Java, not all fonts can be used and some might - work with one operating system and not others. When sharing a sketch - with other people or posting it on the web, you may need to include a - .ttf or .otf version of your font in the data directory of the sketch - because other people might not have the font installed on their - computer. Only fonts that can legally be distributed should be included - with a sketch. -

        - The size parameter states the font size you want to generate. The - smooth parameter specifies if the font should be antialiased or - not, and the charset parameter is an array of chars that - specifies the characters to generate. -

        - This function creates a bitmapped version of a font in the same manner - as the Create Font tool. It loads a font by name, and converts it to a - series of images based on the size of the font. When possible, the - text() function will use a native font rather than the bitmapped - version created behind the scenes with createFont(). For - instance, when using P2D, the actual native version of the font will be - employed by the sketch, improving drawing quality and performance. With - the P3D renderer, the bitmapped version will be used. While this can - drastically improve speed and appearance, results are poor when - exporting if the sketch does not include the .otf or .ttf file, and the - requested font is not available on the machine running the sketch. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        name - name of the font to load
        -
        size - point size of the font
        -
        smooth - true for an antialiased font, false for aliased
        -
        charset - array containing characters to be generated
        -
        See Also:
        -
        PFont, -PGraphics.textFont(PFont, float), -PGraphics#text(String, float, float, float, float, float), -loadFont(String)
        -
        -
      • -
      - - - -
        -
      • -

        selectInput

        -
        public void selectInput(String prompt,
        -                        String callback)
        -
        Open a platform-specific file chooser dialog to select a file for input. - After the selection is made, the selected File will be passed to the - 'callback' function. If the dialog is closed or canceled, null will be - sent to the function, so that the program is not waiting for additional - input. The callback is necessary because of how threading works. - -
        - void setup() {
        -   selectInput("Select a file to process:", "fileSelected");
        - }
        -
        - void fileSelected(File selection) {
        -   if (selection == null) {
        -     println("Window was closed or the user hit cancel.");
        -   } else {
        -     println("User selected " + fileSeleted.getAbsolutePath());
        -   }
        - }
        - 
        - - For advanced users, the method must be 'public', which is true for all - methods inside a sketch when run from the PDE, but must explicitly be - set when using Eclipse or other development environments.
        -
        -
        Parameters:
        -
        prompt - message to the user
        -
        callback - name of the method to be called when the selection is made
        -
        -
      • -
      - - - -
        -
      • -

        selectInput

        -
        public void selectInput(String prompt,
        -                        String callback,
        -                        File file)
        -
      • -
      - - - -
        -
      • -

        selectInput

        -
        public void selectInput(String prompt,
        -                        String callback,
        -                        File file,
        -                        Object callbackObject)
        -
      • -
      - - - -
        -
      • -

        selectInput

        -
        public static void selectInput(String prompt,
        -                               String callbackMethod,
        -                               File file,
        -                               Object callbackObject,
        -                               Frame parent)
        -
      • -
      - - - -
        -
      • -

        selectOutput

        -
        public void selectOutput(String prompt,
        -                         String callback)
        -
        See selectInput() for details.
        -
        -
        Parameters:
        -
        prompt - message to the user
        -
        callback - name of the method to be called when the selection is made
        -
        -
      • -
      - - - -
        -
      • -

        selectOutput

        -
        public void selectOutput(String prompt,
        -                         String callback,
        -                         File file)
        -
      • -
      - - - -
        -
      • -

        selectOutput

        -
        public void selectOutput(String prompt,
        -                         String callback,
        -                         File file,
        -                         Object callbackObject)
        -
      • -
      - - - -
        -
      • -

        selectOutput

        -
        public static void selectOutput(String prompt,
        -                                String callbackMethod,
        -                                File file,
        -                                Object callbackObject,
        -                                Frame parent)
        -
      • -
      - - - -
        -
      • -

        selectFolder

        -
        public void selectFolder(String prompt,
        -                         String callback)
        -
        See selectInput() for details.
        -
        -
        Parameters:
        -
        prompt - message to the user
        -
        callback - name of the method to be called when the selection is made
        -
        -
      • -
      - - - -
        -
      • -

        selectFolder

        -
        public void selectFolder(String prompt,
        -                         String callback,
        -                         File file)
        -
      • -
      - - - -
        -
      • -

        selectFolder

        -
        public void selectFolder(String prompt,
        -                         String callback,
        -                         File file,
        -                         Object callbackObject)
        -
      • -
      - - - -
        -
      • -

        selectFolder

        -
        public static void selectFolder(String prompt,
        -                                String callbackMethod,
        -                                File defaultSelection,
        -                                Object callbackObject,
        -                                Frame parentFrame)
        -
      • -
      - - - -
        -
      • -

        checkExtension

        -
        public static String checkExtension(String filename)
        -
        Get the compression-free extension for this filename.
        -
        -
        Parameters:
        -
        filename - The filename to check
        -
        Returns:
        -
        an extension, skipping past .gz if it's present
        -
        -
      • -
      - - - -
        -
      • -

        createReader

        -
        public BufferedReader createReader(String filename)
        -
        ( begin auto-generated from createReader.xml ) - - Creates a BufferedReader object that can be used to read files - line-by-line as individual String objects. This is the complement - to the createWriter() function. -

        - Starting with Processing release 0134, all files loaded and saved by the - Processing API use UTF-8 encoding. In previous releases, the default - encoding for your platform was used, which causes problems when files - are moved to other platforms. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of the file to be opened
        -
        See Also:
        -
        BufferedReader, -createWriter(String), -PrintWriter
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        createWriter

        -
        public PrintWriter createWriter(String filename)
        -
        ( begin auto-generated from createWriter.xml ) - - Creates a new file in the sketch folder, and a PrintWriter object - to write to it. For the file to be made correctly, it should be flushed - and must be closed with its flush() and close() methods - (see above example). -

        - Starting with Processing release 0134, all files loaded and saved by the - Processing API use UTF-8 encoding. In previous releases, the default - encoding for your platform was used, which causes problems when files - are moved to other platforms. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of the file to be created
        -
        See Also:
        -
        PrintWriter, -createReader(java.lang.String), -BufferedReader
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        createInput

        -
        public InputStream createInput(String filename)
        -
        ( begin auto-generated from createInput.xml ) - - This is a function for advanced programmers to open a Java InputStream. - It's useful if you want to use the facilities provided by PApplet to - easily open files from the data folder or from a URL, but want an - InputStream object so that you can use other parts of Java to take more - control of how the stream is read.
        -
        - The filename passed in can be:
        - - A URL, for instance openStream("http://processing.org/")
        - - A file in the sketch's data folder
        - - The full path to a file to be opened locally (when running as an - application)
        -
        - If the requested item doesn't exist, null is returned. If not online, - this will also check to see if the user is asking for a file whose name - isn't properly capitalized. If capitalization is different, an error - will be printed to the console. This helps prevent issues that appear - when a sketch is exported to the web, where case sensitivity matters, as - opposed to running from inside the Processing Development Environment on - Windows or Mac OS, where case sensitivity is preserved but ignored.
        -
        - If the file ends with .gz, the stream will automatically be gzip - decompressed. If you don't want the automatic decompression, use the - related function createInputRaw(). -
        - In earlier releases, this function was called openStream().
        -
        - - ( end auto-generated ) - -

        Advanced

        - 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) -
        -
        -
        Parameters:
        -
        filename - the name of the file to use as input
        -
        See Also:
        -
        createOutput(String), -PApplet#selectOutput(String), -PApplet#selectInput(String)
        -
        -
      • -
      - - - -
        -
      • -

        createInputRaw

        -
        public InputStream createInputRaw(String filename)
        -
        Call openStream() without automatic gzip decompression.
        -
      • -
      - - - - - - - -
        -
      • -

        loadBytes

        -
        public byte[] loadBytes(String filename)
        -
        ( begin auto-generated from loadBytes.xml ) - - Reads the contents of a file or url and places it in a byte array. If a - file is specified, it must be located in the sketch's "data" - directory/folder.
        -
        - The filename parameter can also be a URL to a file found online. For - security reasons, a Processing sketch found online can only download - files from the same server from which it came. Getting around this - restriction requires a signed applet. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of a file in the data folder or a URL.
        -
        See Also:
        -
        loadStrings(String), -saveStrings(String, String[]), -saveBytes(String, byte[])
        -
        -
      • -
      - - - -
        -
      • -

        loadBytes

        -
        public static byte[] loadBytes(InputStream input)
        -
      • -
      - - - -
        -
      • -

        loadBytes

        -
        public static byte[] loadBytes(File file)
        -
      • -
      - - - -
        -
      • -

        loadStrings

        -
        public static String[] loadStrings(File file)
        -
      • -
      - - - -
        -
      • -

        loadStrings

        -
        public String[] loadStrings(String filename)
        -
        ( begin auto-generated from loadStrings.xml ) - - Reads the contents of a file or url and creates a String array of its - individual lines. If a file is specified, it must be located in the - sketch's "data" directory/folder.
        -
        - The filename parameter can also be a URL to a file found online. For - security reasons, a Processing sketch found online can only download - files from the same server from which it came. Getting around this - restriction requires a signed applet. -
        - If the file is not available or an error occurs, null will be - returned and an error message will be printed to the console. The error - message does not halt the program, however the null value may cause a - NullPointerException if your code does not check whether the value - returned is null. -

        - Starting with Processing release 0134, all files loaded and saved by the - Processing API use UTF-8 encoding. In previous releases, the default - encoding for your platform was used, which causes problems when files - are moved to other platforms. - - ( end auto-generated ) - -

        Advanced

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

        -
        -
        Parameters:
        -
        filename - name of the file or url to load
        -
        See Also:
        -
        loadBytes(String), -saveStrings(String, String[]), -saveBytes(String, byte[])
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        createOutput

        -
        public OutputStream createOutput(String filename)
        -
        ( begin auto-generated from createOutput.xml ) - - Similar to createInput(), 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. -

        - This function is a convenience over the Java approach that requires you - to 1) create a FileOutputStream object, 2) determine the exact file - location, and 3) handle exceptions. Exceptions are handled internally by - the function, which is more appropriate for "sketch" projects. -

        - If the output filename ends with .gz, the output will be - automatically GZIP compressed as it is written. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of the file to open
        -
        See Also:
        -
        createInput(String), -PApplet#selectOutput()
        -
        -
      • -
      - - - - - - - -
        -
      • -

        saveStream

        -
        public boolean saveStream(String target,
        -                          String source)
        -
        ( begin auto-generated from saveStream.xml ) - - 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).
        -
        - When using the targetFile parameter, it writes to a File - object for greater control over the file location. (Note that unlike - some other functions, this will not automatically compress or uncompress - gzip files.) - - ( end auto-generated )
        -
        -
        Parameters:
        -
        target - name of the file to write to
        -
        source - location to read from (a filename, path, or URL)
        -
        See Also:
        -
        createOutput(String)
        -
        -
      • -
      - - - -
        -
      • -

        saveStream

        -
        public boolean saveStream(File target,
        -                          String source)
        -
        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 boolean saveStream(String target,
        -                          InputStream source)
        -
      • -
      - - - -
        -
      • -

        saveStream

        -
        public static boolean saveStream(File target,
        -                                 InputStream source)
        -
      • -
      - - - - - - - -
        -
      • -

        saveBytes

        -
        public void saveBytes(String filename,
        -                      byte[] data)
        -
        ( begin auto-generated from saveBytes.xml ) - - Opposite of loadBytes(), will write an entire array of bytes to a - file. The data is saved in binary format. This file is saved to the - sketch's folder, which is opened by selecting "Show sketch folder" from - the "Sketch" menu.
        -
        - It is not possible to use saveXxxxx() functions inside a web browser - unless the sketch is signed applet. To - save a file back to a server, see the save to - web code snippet on the Processing Wiki. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of the file to write to
        -
        data - array of bytes to be written
        -
        See Also:
        -
        loadStrings(String), -loadBytes(String), -saveStrings(String, String[])
        -
        -
      • -
      - - - -
        -
      • -

        saveBytes

        -
        public static void saveBytes(File file,
        -                             byte[] data)
        -
      • -
      - - - -
        -
      • -

        saveBytes

        -
        public static void saveBytes(OutputStream output,
        -                             byte[] data)
        -
      • -
      - - - -
        -
      • -

        saveStrings

        -
        public void saveStrings(String filename,
        -                        String[] data)
        -
        ( begin auto-generated from saveStrings.xml ) - - Writes an array of strings to a file, one line per string. This file is - saved to the sketch's folder, which is opened by selecting "Show sketch - folder" from the "Sketch" menu.
        -
        - It is not possible to use saveXxxxx() functions inside a web browser - unless the sketch is signed applet. To - save a file back to a server, see the save to - web code snippet on the Processing Wiki.
        -
        - Starting with Processing 1.0, all files loaded and saved by the - Processing API use UTF-8 encoding. In previous releases, the default - encoding for your platform was used, which causes problems when files - are moved to other platforms. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - filename for output
        -
        data - string array to be written
        -
        See Also:
        -
        loadStrings(String), -loadBytes(String), -saveBytes(String, byte[])
        -
        -
      • -
      - - - -
        -
      • -

        saveStrings

        -
        public static void saveStrings(File file,
        -                               String[] data)
        -
      • -
      - - - -
        -
      • -

        saveStrings

        -
        public static void saveStrings(OutputStream output,
        -                               String[] data)
        -
      • -
      - - - -
        -
      • -

        sketchPath

        -
        public String sketchPath()
        -
      • -
      - - - -
        -
      • -

        sketchPath

        -
        public String sketchPath(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 File sketchFile(String where)
        -
      • -
      - - - -
        -
      • -

        savePath

        -
        public String savePath(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 File saveFile(String where)
        -
        Identical to savePath(), but returns a File object.
        -
      • -
      - - - -
        -
      • -

        desktopFile

        -
        public static File desktopFile(String what)
        -
        Not a supported function. For testing use only.
        -
      • -
      - - - -
        -
      • -

        desktopPath

        -
        public static String desktopPath(String what)
        -
        Not a supported function. For testing use only.
        -
      • -
      - - - -
        -
      • -

        dataPath

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

        - This is only available with applications, not applets or Android. - On Windows and Linux, this is simply the data folder, which is located - in the same directory as the EXE file and lib folders. On Mac OS X, this - is a path to the data folder buried inside Contents/Java. - For the latter point, that also means that the data folder should not be - considered writable. Use sketchPath() for now, or inputPath() and - outputPath() once they're available in the 2.0 release. -

        - dataPath() is not supported with applets because applets have their data - folder wrapped into the JAR file. To read data from the data folder that - works with an applet, you should use other methods such as createInput(), - createReader(), or loadStrings().

        -
      • -
      - - - -
        -
      • -

        dataFile

        -
        public File dataFile(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(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(File file)
        -
      • -
      - - - -
        -
      • -

        getExtension

        -
        public static String getExtension(String filename)
        -
      • -
      - - - -
        -
      • -

        urlEncode

        -
        public static String urlEncode(String str)
        -
      • -
      - - - -
        -
      • -

        urlDecode

        -
        public static String urlDecode(String str)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static byte[] sort(byte[] list)
        -
        ( begin auto-generated from sort.xml ) - - Sorts an array of numbers from smallest to largest and puts an array of - words in alphabetical order. The original array is not modified, a - re-ordered array is returned. The count parameter states the - number of elements to sort. For example if there are 12 elements in an - array and if count is the value 5, only the first five elements on the - array will be sorted. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        list - array to sort
        -
        See Also:
        -
        reverse(boolean[])
        -
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static byte[] sort(byte[] list,
        -                          int count)
        -
        -
        Parameters:
        -
        count - number of elements to sort, starting from 0
        -
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static char[] sort(char[] list)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static char[] sort(char[] list,
        -                          int count)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static int[] sort(int[] list)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static int[] sort(int[] list,
        -                         int count)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static float[] sort(float[] list)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static float[] sort(float[] list,
        -                           int count)
        -
      • -
      - - - - - - - -
        -
      • -

        sort

        -
        public static String[] sort(String[] list,
        -                            int count)
        -
      • -
      - - - -
        -
      • -

        arrayCopy

        -
        public static void arrayCopy(Object src,
        -                             int srcPosition,
        -                             Object dst,
        -                             int dstPosition,
        -                             int length)
        -
        ( begin auto-generated from arrayCopy.xml ) - - Copies an array (or part of an array) to another array. The src - array is copied to the dst array, beginning at the position - specified by srcPos and into the position specified by - dstPos. The number of elements to copy is determined by - length. The simplified version with two arguments copies an - entire array to another of the same size. It is equivalent to - "arrayCopy(src, 0, dst, 0, src.length)". This function is far more - efficient for copying array data than iterating through a for and - copying each element. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        src - the source array
        -
        srcPosition - starting position in the source array
        -
        dst - the destination array of the same data type as the source array
        -
        dstPosition - starting position in the destination array
        -
        length - number of array elements to be copied
        -
        See Also:
        -
        concat(boolean[], boolean[])
        -
        -
      • -
      - - - -
        -
      • -

        arrayCopy

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

        arrayCopy

        -
        public static void arrayCopy(Object src,
        -                             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(Object src,
        -                             int srcPosition,
        -                             Object dst,
        -                             int dstPosition,
        -                             int length)
        -
        Deprecated. Use arrayCopy() instead.
        -
      • -
      - - - -
        -
      • -

        arraycopy

        -
        public static void arraycopy(Object src,
        -                             Object dst,
        -                             int length)
        -
        Deprecated. Use arrayCopy() instead.
        -
      • -
      - - - -
        -
      • -

        arraycopy

        -
        public static void arraycopy(Object src,
        -                             Object dst)
        -
        Deprecated. Use arrayCopy() instead.
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static boolean[] expand(boolean[] list)
        -
        ( begin auto-generated from expand.xml ) - - Increases the size of an array. By default, this function doubles the - size of the array, but the optional newSize parameter provides - precise control over the increase in size. -

        - When using an array of objects, the data returned from the function must - be cast to the object array's data type. For example: SomeClass[] - items = (SomeClass[]) expand(originalArray). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        list - the array to expand
        -
        See Also:
        -
        shorten(boolean[])
        -
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static boolean[] expand(boolean[] list,
        -                               int newSize)
        -
        -
        Parameters:
        -
        newSize - new size for the array
        -
        -
      • -
      - - - -
        -
      • -

        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 long[] expand(long[] list)
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static long[] expand(long[] list,
        -                            int newSize)
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static float[] expand(float[] list)
        -
      • -
      - - - -
        -
      • -

        expand

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

        expand

        -
        public static double[] expand(double[] list)
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static double[] expand(double[] list,
        -                              int newSize)
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static String[] expand(String[] list)
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static String[] expand(String[] list,
        -                              int newSize)
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static Object expand(Object array)
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static Object expand(Object list,
        -                            int newSize)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public static byte[] append(byte[] array,
        -                            byte value)
        -
        ( begin auto-generated from append.xml ) - - Expands an array by one element and adds data to the new position. The - datatype of the element parameter must be the same as the - datatype of the array. -

        - When using an array of objects, the data returned from the function must - be cast to the object array's data type. For example: SomeClass[] - items = (SomeClass[]) append(originalArray, element). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        array - array to append
        -
        value - new data for the array
        -
        See Also:
        -
        shorten(boolean[]), -expand(boolean[])
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public static char[] append(char[] array,
        -                            char value)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public static int[] append(int[] array,
        -                           int value)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public static float[] append(float[] array,
        -                             float value)
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        shorten

        -
        public static boolean[] shorten(boolean[] list)
        -
        ( begin auto-generated from shorten.xml ) - - Decreases an array by one element and returns the shortened array. -

        - When using an array of objects, the data returned from the function must - be cast to the object array's data type. For example: SomeClass[] - items = (SomeClass[]) shorten(originalArray). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        list - array to shorten
        -
        See Also:
        -
        append(byte[], byte), -expand(boolean[])
        -
        -
      • -
      - - - -
        -
      • -

        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 String[] shorten(String[] list)
        -
      • -
      - - - -
        -
      • -

        shorten

        -
        public static Object shorten(Object list)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final boolean[] splice(boolean[] list,
        -                                     boolean value,
        -                                     int index)
        -
        ( begin auto-generated from splice.xml ) - - Inserts a value or array of values into an existing array. The first two - parameters must be of the same datatype. The array parameter - defines the array which will be modified and the second parameter - defines the data which will be inserted. -

        - When using an array of objects, the data returned from the function must - be cast to the object array's data type. For example: SomeClass[] - items = (SomeClass[]) splice(array1, array2, index). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        list - array to splice into
        -
        value - value to be spliced in
        -
        index - position in the array from which to insert data
        -
        See Also:
        -
        concat(boolean[], boolean[]), -subset(boolean[], int, int)
        -
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final boolean[] splice(boolean[] list,
        -                                     boolean[] value,
        -                                     int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final byte[] splice(byte[] list,
        -                                  byte value,
        -                                  int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final byte[] splice(byte[] list,
        -                                  byte[] value,
        -                                  int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final char[] splice(char[] list,
        -                                  char value,
        -                                  int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final char[] splice(char[] list,
        -                                  char[] value,
        -                                  int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final int[] splice(int[] list,
        -                                 int value,
        -                                 int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final int[] splice(int[] list,
        -                                 int[] value,
        -                                 int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final float[] splice(float[] list,
        -                                   float value,
        -                                   int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final float[] splice(float[] list,
        -                                   float[] value,
        -                                   int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final String[] splice(String[] list,
        -                                    String value,
        -                                    int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final String[] splice(String[] list,
        -                                    String[] value,
        -                                    int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final Object splice(Object list,
        -                                  Object value,
        -                                  int index)
        -
      • -
      - - - -
        -
      • -

        subset

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

        subset

        -
        public static boolean[] subset(boolean[] list,
        -                               int start,
        -                               int count)
        -
        ( begin auto-generated from subset.xml ) - - Extracts an array of elements from an existing array. The array - parameter defines the array from which the elements will be copied and - the offset and length parameters determine which elements - to extract. If no length is given, elements will be extracted - from the offset to the end of the array. When specifying the - offset remember the first array element is 0. This function does - not change the source array. -

        - When using an array of objects, the data returned from the function must - be cast to the object array's data type. For example: SomeClass[] - items = (SomeClass[]) subset(originalArray, 0, 4). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        list - array to extract from
        -
        start - position to begin
        -
        count - number of values to extract
        -
        See Also:
        -
        splice(boolean[], boolean, int)
        -
        -
      • -
      - - - -
        -
      • -

        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 String[] subset(String[] list,
        -                              int start)
        -
      • -
      - - - -
        -
      • -

        subset

        -
        public static String[] subset(String[] list,
        -                              int start,
        -                              int count)
        -
      • -
      - - - -
        -
      • -

        subset

        -
        public static Object subset(Object list,
        -                            int start)
        -
      • -
      - - - -
        -
      • -

        subset

        -
        public static Object subset(Object list,
        -                            int start,
        -                            int count)
        -
      • -
      - - - -
        -
      • -

        concat

        -
        public static boolean[] concat(boolean[] a,
        -                               boolean[] b)
        -
        ( begin auto-generated from concat.xml ) - - Concatenates two arrays. For example, concatenating the array { 1, 2, 3 - } and the array { 4, 5, 6 } yields { 1, 2, 3, 4, 5, 6 }. Both parameters - must be arrays of the same datatype. -

        - When using an array of objects, the data returned from the function must - be cast to the object array's data type. For example: SomeClass[] - items = (SomeClass[]) concat(array1, array2). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - first array to concatenate
        -
        b - second array to concatenate
        -
        See Also:
        -
        splice(boolean[], boolean, int), -arrayCopy(Object, int, Object, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        reverse

        -
        public static boolean[] reverse(boolean[] list)
        -
        ( begin auto-generated from reverse.xml ) - - Reverses the order of an array. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        list - booleans[], bytes[], chars[], ints[], floats[], or Strings[]
        -
        See Also:
        -
        sort(String[], int)
        -
        -
      • -
      - - - -
        -
      • -

        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 String[] reverse(String[] list)
        -
      • -
      - - - -
        -
      • -

        reverse

        -
        public static Object reverse(Object list)
        -
      • -
      - - - -
        -
      • -

        trim

        -
        public static String trim(String str)
        -
        ( begin auto-generated from trim.xml ) - - Removes whitespace characters from the beginning and end of a String. In - addition to standard whitespace characters such as space, carriage - return, and tab, this function also removes the Unicode "nbsp" character. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        str - any string
        -
        See Also:
        -
        split(String, String), -join(String[], char)
        -
        -
      • -
      - - - -
        -
      • -

        trim

        -
        public static String[] trim(String[] array)
        -
        -
        Parameters:
        -
        array - a String array
        -
        -
      • -
      - - - -
        -
      • -

        join

        -
        public static String join(String[] list,
        -                          char separator)
        -
        ( begin auto-generated from join.xml ) - - Combines an array of Strings into one String, each separated by the - character(s) used for the separator parameter. To join arrays of - ints or floats, it's necessary to first convert them to strings using - nf() or nfs(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        list - array of Strings
        -
        separator - char or String to be placed between each item
        -
        See Also:
        -
        split(String, String), -trim(String), -nf(float, int, int), -nfs(float, int, int)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        splitTokens

        -
        public static String[] splitTokens(String value)
        -
      • -
      - - - -
        -
      • -

        splitTokens

        -
        public static String[] splitTokens(String value,
        -                                   String delim)
        -
        ( begin auto-generated from splitTokens.xml ) - - The splitTokens() function splits a String at one or many character - "tokens." The tokens parameter specifies the character or - characters to be used as a boundary. -

        - If no tokens character is specified, any whitespace character is - used to split. Whitespace characters include tab (\\t), line feed (\\n), - carriage return (\\r), form feed (\\f), and space. To convert a String - to an array of integers or floats, use the datatype conversion functions - int() and float() to convert the array of Strings. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - the String to be split
        -
        delim - list of individual characters that will be used as separators
        -
        See Also:
        -
        split(String, String), -join(String[], String), -trim(String)
        -
        -
      • -
      - - - -
        -
      • -

        split

        -
        public static String[] split(String value,
        -                             char delim)
        -
        ( begin auto-generated from split.xml ) - - The split() function breaks a string into pieces using a character or - string as the divider. The delim parameter specifies the - character or characters that mark the boundaries between each piece. A - String[] array is returned that contains each of the pieces. -

        - If the result is a set of numbers, you can convert the String[] array to - to a float[] or int[] array using the datatype conversion functions - int() and float() (see example above). -

        - The splitTokens() function works in a similar fashion, except - that it splits using a range of characters instead of a specific - character or sequence. - - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - the String to be split
        -
        delim - the character or String used to separate the data
        -
        -
      • -
      - - - - - - - -
        -
      • -

        match

        -
        public static String[] match(String str,
        -                             String regexp)
        -
        ( begin auto-generated from match.xml ) - - The match() function is used to apply a regular expression to a piece of - text, and return matching groups (elements found inside parentheses) as - a String array. No match will return null. If no groups are specified in - the regexp, but the sequence matches, an array of length one (with the - matched text as the first element of the array) will be returned.
        -
        - To use the function, first check to see if the result is null. If the - result is null, then the sequence did not match. If the sequence did - match, an array is returned. - If there are groups (specified by sets of parentheses) in the regexp, - then the contents of each will be returned in the array. - Element [0] of a regexp match returns the entire matching string, and - the match groups start at element [1] (the first group is [1], the - second [2], and so on).
        -
        - The syntax can be found in the reference for Java's Pattern class. - For regular expression syntax, read the Java - Tutorial on the topic. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        str - the String to be searched
        -
        regexp - the regexp to be used for matching
        -
        See Also:
        -
        matchAll(String, String), -split(String, String), -splitTokens(String, String), -join(String[], String), -trim(String)
        -
        -
      • -
      - - - -
        -
      • -

        matchAll

        -
        public static String[][] matchAll(String str,
        -                                  String regexp)
        -
        ( begin auto-generated from matchAll.xml ) - - This function is used to apply a regular expression to a piece of text, - and return a list of matching groups (elements found inside parentheses) - as a two-dimensional String array. No matches will return null. If no - groups are specified in the regexp, but the sequence matches, a two - dimensional array is still returned, but the second dimension is only of - length one.
        -
        - To use the function, first check to see if the result is null. If the - result is null, then the sequence did not match at all. If the sequence - did match, a 2D array is returned. If there are groups (specified by - sets of parentheses) in the regexp, then the contents of each will be - returned in the array. - Assuming, a loop with counter variable i, element [i][0] of a regexp - match returns the entire matching string, and the match groups start at - element [i][1] (the first group is [i][1], the second [i][2], and so - on).
        -
        - The syntax can be found in the reference for Java's Pattern class. - For regular expression syntax, read the Java - Tutorial on the topic. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        str - the String to be searched
        -
        regexp - the regexp to be used for matching
        -
        See Also:
        -
        match(String, String), -split(String, String), -splitTokens(String, String), -join(String[], String), -trim(String)
        -
        -
      • -
      - - - -
        -
      • -

        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(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(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(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(String what)
        -
        Parse a String into an int value. Returns 0 if the value is bad.
        -
      • -
      - - - -
        -
      • -

        parseInt

        -
        public static final int parseInt(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(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(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(String what)
        -
      • -
      - - - -
        -
      • -

        parseFloat

        -
        public static final float parseFloat(String what,
        -                                     float otherwise)
        -
      • -
      - - - -
        -
      • -

        parseFloat

        -
        public static final float[] parseFloat(byte[] what)
        -
      • -
      - - - -
        -
      • -

        parseFloat

        -
        public static final float[] parseFloat(int[] what)
        -
      • -
      - - - -
        -
      • -

        parseFloat

        -
        public static final float[] parseFloat(String[] what)
        -
      • -
      - - - -
        -
      • -

        parseFloat

        -
        public static final float[] parseFloat(String[] what,
        -                                       float missing)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String str(boolean x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String str(byte x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String str(char x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String str(int x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String str(float x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String[] str(boolean[] x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String[] str(byte[] x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String[] str(char[] x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String[] str(int[] x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String[] str(float[] x)
        -
      • -
      - - - -
        -
      • -

        nf

        -
        public static String[] nf(int[] num,
        -                          int digits)
        -
      • -
      - - - -
        -
      • -

        nf

        -
        public static String nf(int num,
        -                        int digits)
        -
        ( begin auto-generated from nf.xml ) - - Utility function for formatting numbers into strings. There are two - versions, one for formatting floats and one for formatting ints. The - values for the digits, left, and right parameters - should always be positive integers.

        As shown in the above - example, nf() is used to add zeros to the left and/or right of a - number. This is typically for aligning a list of numbers. To - remove digits from a floating-point number, use the - int(), ceil(), floor(), or round() - functions. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        num - the number(s) to format
        -
        digits - number of digits to pad with zero
        -
        See Also:
        -
        nfs(float, int, int), -nfp(float, int, int), -nfc(float, int), -PApplet#int(float)
        -
        -
      • -
      - - - -
        -
      • -

        nfc

        -
        public static String[] nfc(int[] num)
        -
        ( begin auto-generated from nfc.xml ) - - Utility function for formatting numbers into strings and placing - appropriate commas to mark units of 1000. There are two versions, one - for formatting ints and one for formatting an array of ints. The value - for the digits parameter should always be a positive integer. -

        - For a non-US locale, this will insert periods instead of commas, or - whatever is apprioriate for that region. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        num - the number(s) to format
        -
        See Also:
        -
        nf(float, int, int), -nfp(float, int, int), -nfs(float, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        nfc

        -
        public static String nfc(int num)
        -
        nfc() or "number format with commas". This is an unfortunate misnomer - because in locales where a comma is not the separator for numbers, it - won't actually be outputting a comma, it'll use whatever makes sense for - the locale.
        -
      • -
      - - - -
        -
      • -

        nfs

        -
        public static String nfs(int num,
        -                         int digits)
        -
        ( begin auto-generated from nfs.xml ) - - Utility function for formatting numbers into strings. Similar to - nf() but leaves a blank space in front of positive numbers so - they align with negative numbers in spite of the minus symbol. There are - two versions, one for formatting floats and one for formatting ints. The - values for the digits, left, and right parameters - should always be positive integers. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        num - the number(s) to format
        -
        digits - number of digits to pad with zeroes
        -
        See Also:
        -
        nf(float, int, int), -nfp(float, int, int), -nfc(float, int)
        -
        -
      • -
      - - - -
        -
      • -

        nfs

        -
        public static String[] nfs(int[] num,
        -                           int digits)
        -
      • -
      - - - -
        -
      • -

        nfp

        -
        public static String nfp(int num,
        -                         int digits)
        -
        ( begin auto-generated from nfp.xml ) - - Utility function for formatting numbers into strings. Similar to - nf() but puts a "+" in front of positive numbers and a "-" in - front of negative numbers. There are two versions, one for formatting - floats and one for formatting ints. The values for the digits, - left, and right parameters should always be positive integers. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        num - the number(s) to format
        -
        digits - number of digits to pad with zeroes
        -
        See Also:
        -
        nf(float, int, int), -nfs(float, int, int), -nfc(float, int)
        -
        -
      • -
      - - - -
        -
      • -

        nfp

        -
        public static String[] nfp(int[] num,
        -                           int digits)
        -
      • -
      - - - -
        -
      • -

        nf

        -
        public static String[] nf(float[] num,
        -                          int left,
        -                          int right)
        -
      • -
      - - - -
        -
      • -

        nf

        -
        public static String nf(float num,
        -                        int left,
        -                        int right)
        -
        -
        Parameters:
        -
        num[] - the number(s) to format
        -
        left - number of digits to the left of the decimal point
        -
        right - number of digits to the right of the decimal point
        -
        -
      • -
      - - - -
        -
      • -

        nfc

        -
        public static String[] nfc(float[] num,
        -                           int right)
        -
        -
        Parameters:
        -
        num[] - the number(s) to format
        -
        right - number of digits to the right of the decimal point
        -
        -
      • -
      - - - -
        -
      • -

        nfc

        -
        public static String nfc(float num,
        -                         int right)
        -
      • -
      - - - -
        -
      • -

        nfs

        -
        public static String[] nfs(float[] num,
        -                           int left,
        -                           int right)
        -
        -
        Parameters:
        -
        num[] - the number(s) to format
        -
        left - the number of digits to the left of the decimal point
        -
        right - the number of digits to the right of the decimal point
        -
        -
      • -
      - - - -
        -
      • -

        nfs

        -
        public static String nfs(float num,
        -                         int left,
        -                         int right)
        -
      • -
      - - - -
        -
      • -

        nfp

        -
        public static String[] nfp(float[] num,
        -                           int left,
        -                           int right)
        -
        -
        Parameters:
        -
        left - the number of digits to the left of the decimal point
        -
        right - the number of digits to the right of the decimal point
        -
        -
      • -
      - - - -
        -
      • -

        nfp

        -
        public static String nfp(float num,
        -                         int left,
        -                         int right)
        -
      • -
      - - - -
        -
      • -

        hex

        -
        public static final String hex(byte value)
        -
        ( begin auto-generated from hex.xml ) - - Converts a byte, char, int, or color to a String containing the - equivalent hexadecimal notation. For example color(0, 102, 153) will - convert to the String "FF006699". This function can help make your geeky - debugging sessions much happier. -

        - Note that the maximum number of digits is 8, because an int value can - only represent up to 32 bits. Specifying more than eight digits will - simply shorten the string to eight anyway. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - the value to convert
        -
        See Also:
        -
        unhex(String), -binary(byte), -unbinary(String)
        -
        -
      • -
      - - - -
        -
      • -

        hex

        -
        public static final String hex(char value)
        -
      • -
      - - - -
        -
      • -

        hex

        -
        public static final String hex(int value)
        -
      • -
      - - - -
        -
      • -

        hex

        -
        public static final String hex(int value,
        -                               int digits)
        -
        -
        Parameters:
        -
        digits - the number of digits (maximum 8)
        -
        -
      • -
      - - - -
        -
      • -

        unhex

        -
        public static final int unhex(String value)
        -
        ( begin auto-generated from unhex.xml ) - - Converts a String representation of a hexadecimal number to its - equivalent integer value. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - String to convert to an integer
        -
        See Also:
        -
        hex(int, int), -binary(byte), -unbinary(String)
        -
        -
      • -
      - - - -
        -
      • -

        binary

        -
        public static final String binary(byte value)
        -
        Returns a String that contains the binary value of a byte. - The returned value will always have 8 digits.
        -
      • -
      - - - -
        -
      • -

        binary

        -
        public static final String binary(char value)
        -
        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 String binary(int value)
        -
        Returns a String that contains the binary value of an int. The length - depends on the size of the number itself. If you want a specific number - of digits use binary(int what, int digits) to specify how many.
        -
      • -
      - - - -
        -
      • -

        binary

        -
        public static final String binary(int value,
        -                                  int digits)
        -
        ( begin auto-generated from binary.xml ) - - Converts a byte, char, int, or color to a String containing the - equivalent binary notation. For example color(0, 102, 153, 255) will - convert to the String "11111111000000000110011010011001". This function - can help make your geeky debugging sessions much happier. -

        - Note that the maximum number of digits is 32, because an int value can - only represent up to 32 bits. Specifying more than 32 digits will simply - shorten the string to 32 anyway. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - value to convert
        -
        digits - number of digits to return
        -
        See Also:
        -
        unbinary(String), -hex(int,int), -unhex(String)
        -
        -
      • -
      - - - -
        -
      • -

        unbinary

        -
        public static final int unbinary(String value)
        -
        ( begin auto-generated from unbinary.xml ) - - Converts a String representation of a binary number to its equivalent - integer value. For example, unbinary("00001000") will return 8. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - String to convert to an integer
        -
        See Also:
        -
        binary(byte), -hex(int,int), -unhex(String)
        -
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int gray)
        -
        ( begin auto-generated from color.xml ) - - Creates colors for storing in variables of the color datatype. - The parameters are interpreted as RGB or HSB values depending on the - current colorMode(). The default mode is RGB values from 0 to 255 - and therefore, the function call color(255, 204, 0) will return a - bright yellow color. More about how colors are stored can be found in - the reference for the color datatype. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        gray - number specifying value between white and black
        -
        See Also:
        -
        colorMode(int)
        -
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(float fgray)
        -
        -
        Parameters:
        -
        fgray - number specifying value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int gray,
        -                       int alpha)
        -
        As of 0116 this also takes color(#FF8800, alpha)
        -
        -
        Parameters:
        -
        alpha - relative to current color range
        -
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(float fgray,
        -                       float falpha)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int v1,
        -                       int v2,
        -                       int v3)
        -
        -
        Parameters:
        -
        v1 - red or hue values relative to the current color range
        -
        v2 - green or saturation values relative to the current color range
        -
        v3 - blue or brightness values relative to the current color range
        -
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int v1,
        -                       int v2,
        -                       int v3,
        -                       int alpha)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(float v1,
        -                       float v2,
        -                       float v3)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(float v1,
        -                       float v2,
        -                       float v3,
        -                       float alpha)
        -
      • -
      - - - -
        -
      • -

        lerpColor

        -
        public int lerpColor(int c1,
        -                     int c2,
        -                     float amt)
        -
        ( begin auto-generated from lerpColor.xml ) - - Calculates a color or colors between two color at a specific increment. - The amt parameter is the amount to interpolate between the two - values where 0.0 equal to the first point, 0.1 is very near the first - point, 0.5 is half-way in between, etc. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        c1 - interpolate from this color
        -
        c2 - interpolate to this color
        -
        amt - between 0.0 and 1.0
        -
        See Also:
        -
        PImage.blendColor(int, int, int), -PGraphics.color(float, float, float, float), -lerp(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        blendColor

        -
        public static int blendColor(int c1,
        -                             int c2,
        -                             int mode)
        -
      • -
      - - - -
        -
      • -

        main

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

        - Usage: PApplet [options] <class name> [sketch args] -

          -
        • The [options] are one or several of the parameters seen below. -
        • The class name is required. If you're running outside the PDE and - your class is in a package, this should include the full name. That means - that if the class is called Sketchy and the package is com.sketchycompany - then com.sketchycompany.Sketchy should be used as the class name. -
        • The [sketch args] are any command line parameters you want to send to - the sketch itself. These will be passed into the args[] array in PApplet. -

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

          static public void main(String args[]) {
          -   PApplet.main("YourSketchName");
          - }
          - That will properly launch your code 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              Presentation mode: blanks the entire screen and
          -                        shows the sketch by itself. If the sketch is
          -                        smaller than the screen, the background around it
          -                        will use the --window-color setting.
          -
          - --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.
          -
          - --window-color=#xxxxxx Background color of the window. The color used
          -                        around the sketch when it's smaller than the
          -                        minimum window size for the OS, and the matte
          -                        color when using 'present' mode.
          -
          - --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 sketch.
          -                        Displays are numbered starting from 1. This will
          -                        be overridden by fullScreen() calls that specify
          -                        a display. Omitting this option will cause the
          -                        default display to be used.
          -
          - 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
          -
          - All parameters *after* the sketch class name are passed to the sketch
          - itself and available from its 'args' array while the sketch is running.
        -
        -
        See Also:
        -
        -
        -
      • -
      - - - -
        -
      • -

        main

        -
        public static void main(String mainClass)
        -
        Convenience method so that PApplet.main("YourSketch") launches a sketch, - rather than having to wrap it into a single element String array.
        -
        -
        Parameters:
        -
        mainClass - name of the class to load (with package if any)
        -
        -
      • -
      - - - -
        -
      • -

        main

        -
        public static void main(String mainClass,
        -                        String[] sketchArgs)
        -
        Convenience method so that PApplet.main("YourSketch", args) launches a - sketch, rather than having to wrap it into a String array, and appending - the 'args' array when not null.
        -
        -
        Parameters:
        -
        mainClass - name of the class to load (with package if any)
        -
        args - command line arguments to pass to the sketch's 'args' array. - Note that this is *not* the same as the args passed to (and - understood by) PApplet such as --display.
        -
        -
      • -
      - - - -
        -
      • -

        runSketch

        -
        public static void runSketch(String[] args,
        -                             PApplet constructedSketch)
        -
      • -
      - - - -
        -
      • -

        hideMenuBar

        -
        public static void hideMenuBar()
        -
        Convenience method, should only be called by PSurface subclasses.
        -
      • -
      - - - -
        -
      • -

        beginRecord

        -
        public PGraphics beginRecord(String renderer,
        -                             String filename)
        -
        ( begin auto-generated from beginRecord.xml ) - - Opens a new file and all subsequent drawing functions are echoed to this - file as well as the display window. The beginRecord() function - requires two parameters, the first is the renderer and the second is the - file name. This function is always used with endRecord() to stop - the recording process and close the file. -

        - Note that beginRecord() will only pick up any settings that happen after - it has been called. For instance, if you call textFont() before - beginRecord(), then that font will not be set for the file that you're - recording to. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        renderer - for example, PDF
        -
        filename - filename for output
        -
        See Also:
        -
        endRecord()
        -
        -
      • -
      - - - -
        -
      • -

        beginRecord

        -
        public void beginRecord(PGraphics recorder)
        -
      • -
      - - - -
        -
      • -

        endRecord

        -
        public void endRecord()
        -
        ( begin auto-generated from endRecord.xml ) - - Stops the recording process started by beginRecord() and closes - the file. - - ( end auto-generated )
        -
        -
        See Also:
        -
        beginRecord(String, String)
        -
        -
      • -
      - - - -
        -
      • -

        beginRaw

        -
        public PGraphics beginRaw(String renderer,
        -                          String filename)
        -
        ( begin auto-generated from beginRaw.xml ) - - To create vectors from 3D data, use the beginRaw() and - endRaw() commands. These commands will grab the shape data just - before it is rendered to the screen. At this stage, your entire scene is - nothing but a long list of individual lines and triangles. This means - that a shape created with sphere() function will be made up of - hundreds of triangles, rather than a single object. Or that a - multi-segment line shape (such as a curve) will be rendered as - individual segments. -

        - When using beginRaw() and endRaw(), it's possible to write - to either a 2D or 3D renderer. For instance, beginRaw() with the - PDF library will write the geometry as flattened triangles and lines, - even if recording from the P3D renderer. -

        - If you want a background to show up in your files, use rect(0, 0, - width, height) after setting the fill() to the background - color. Otherwise the background will not be rendered to the file because - the background is not shape. -

        - Using hint(ENABLE_DEPTH_SORT) can improve the appearance of 3D - geometry drawn to 2D file formats. See the hint() reference for - more details. -

        - See examples in the reference for the PDF and DXF - libraries for more information. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        renderer - for example, PDF or DXF
        -
        filename - filename for output
        -
        See Also:
        -
        endRaw(), -hint(int)
        -
        -
      • -
      - - - -
        -
      • -

        beginRaw

        -
        public void beginRaw(PGraphics rawGraphics)
        -
        -
        Parameters:
        -
        rawGraphics - ???
        -
        -
      • -
      - - - -
        -
      • -

        endRaw

        -
        public void endRaw()
        -
        ( begin auto-generated from endRaw.xml ) - - Complement to beginRaw(); they must always be used together. See - the beginRaw() reference for details. - - ( end auto-generated )
        -
        -
        See Also:
        -
        beginRaw(String, String)
        -
        -
      • -
      - - - -
        -
      • -

        loadPixels

        -
        public void loadPixels()
        -
        ( begin auto-generated from loadPixels.xml ) - - Loads the pixel data for the display window into the pixels[] - array. This function must always be called before reading from or - writing to pixels[]. -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. - - ( end auto-generated ) -

        Advanced

        - 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[].
        -
        -
        See Also:
        -
        pixels, -updatePixels()
        -
        -
      • -
      - - - -
        -
      • -

        updatePixels

        -
        public void updatePixels()
        -
        ( begin auto-generated from updatePixels.xml ) - - Updates the display window with the data in the pixels[] array. - Use in conjunction with loadPixels(). If you're only reading - pixels from the array, there's no need to call updatePixels() - unless there are changes. -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. -

        - Currently, none of the renderers use the additional parameters to - updatePixels(), however this may be implemented in the future. - - ( end auto-generated )
        -
        -
        See Also:
        -
        loadPixels(), -pixels
        -
        -
      • -
      - - - -
        -
      • -

        updatePixels

        -
        public void updatePixels(int x1,
        -                         int y1,
        -                         int x2,
        -                         int y2)
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the upper-left corner
        -
        y1 - y-coordinate of the upper-left corner
        -
        x2 - width of the region
        -
        y2 - height of the region
        -
        -
      • -
      - - - -
        -
      • -

        beginPGL

        -
        public PGL beginPGL()
        -
      • -
      - - - -
        -
      • -

        endPGL

        -
        public void endPGL()
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public void flush()
        -
      • -
      - - - -
        -
      • -

        hint

        -
        public void hint(int which)
        -
      • -
      - - - -
        -
      • -

        beginShape

        -
        public void beginShape()
        -
        Start a new shape of type POLYGON
        -
      • -
      - - - -
        -
      • -

        beginShape

        -
        public void beginShape(int kind)
        -
        ( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms. beginShape() begins recording - vertices for a shape and endShape() stops recording. The value of - the MODE parameter tells it which types of shapes to create from - the provided vertices. With no mode specified, the shape can be any - irregular polygon. The parameters available for beginShape() are POINTS, - LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, and QUAD_STRIP. - After calling the beginShape() function, a series of - vertex() commands must follow. To stop drawing the shape, call - endShape(). The vertex() function with two parameters - specifies a position in 2D and the vertex() function with three - parameters specifies a position in 3D. Each shape will be outlined with - the current stroke color and filled with the fill color. -

        - Transformations such as translate(), rotate(), and - scale() do not work within beginShape(). It is also not - possible to use other shapes, such as ellipse() or rect() - within beginShape(). -

        - The P3D renderer settings allow stroke() and fill() - settings to be altered per-vertex, however the default P2D renderer does - not. Settings such as strokeWeight(), strokeCap(), and - strokeJoin() cannot be changed while inside a - beginShape()/endShape() block with any renderer. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        kind - Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIP
        -
        See Also:
        -
        PShape, -PGraphics.endShape(), -PGraphics.vertex(float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from normal.xml ) - - Sets the current normal vector. This is for drawing three dimensional - shapes and surfaces and specifies a vector perpendicular to the surface - of the shape which determines how lighting affects it. Processing - attempts to automatically assign normals to shapes, but since that's - imperfect, this is a better option when you want more control. This - function is identical to glNormal3f() in OpenGL. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        nx - x direction
        -
        ny - y direction
        -
        nz - z direction
        -
        See Also:
        -
        PGraphics.beginShape(int), -PGraphics.endShape(int), -PGraphics.lights()
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   float... values)
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   int... values)
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   boolean... values)
        -
      • -
      - - - -
        -
      • -

        textureMode

        -
        public void textureMode(int mode)
        -
        ( begin auto-generated from textureMode.xml ) - - Sets the coordinate space for texture mapping. There are two options, - IMAGE, which refers to the actual coordinates of the image, and - NORMAL, which refers to a normalized space of values ranging from 0 - to 1. The default mode is IMAGE. In IMAGE, if an image is 100 x 200 - pixels, mapping the image onto the entire size of a quad would require - the points (0,0) (0,100) (100,200) (0,200). The same mapping in - NORMAL_SPACE is (0,0) (0,1) (1,1) (0,1). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either IMAGE or NORMAL
        -
        See Also:
        -
        PGraphics.texture(PImage), -PGraphics.textureWrap(int)
        -
        -
      • -
      - - - -
        -
      • -

        textureWrap

        -
        public void textureWrap(int wrap)
        -
        ( begin auto-generated from textureWrap.xml ) - - Description to come... - - ( end auto-generated from textureWrap.xml )
        -
        -
        Parameters:
        -
        wrap - Either CLAMP (default) or REPEAT
        -
        See Also:
        -
        PGraphics.texture(PImage), -PGraphics.textureMode(int)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        noTexture

        -
        public void noTexture()
        -
        Removes texture image for current shape. - Needs to be called between beginShape and endShape
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices. - vertex() is used to specify the vertex coordinates for points, - lines, triangles, quads, and polygons and is used exclusively within the - beginShape() and endShape() function.
        -
        - Drawing a vertex in 3D using the z parameter requires the P3D - parameter in combination with size as shown in the above example.
        -
        - This function is also used to map a texture onto the geometry. The - texture() function declares the texture to apply to the geometry - and the u and v coordinates set define the mapping of this - texture to the form. By default, the coordinates used for u and - v are specified in relation to the image's size in pixels, but - this relation can be changed with textureMode(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - x-coordinate of the vertex
        -
        y - y-coordinate of the vertex
        -
        z - z-coordinate of the vertex
        -
        u - horizontal coordinate for the texture mapping
        -
        v - vertical coordinate for the texture mapping
        -
        See Also:
        -
        PGraphics.beginShape(int), -PGraphics.endShape(int), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.texture(PImage)
        -
        -
      • -
      - - - -
        -
      • -

        beginContour

        -
        public void beginContour()
        -
      • -
      - - - -
        -
      • -

        endContour

        -
        public void endContour()
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape()
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape(int mode)
        -
        ( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape(). When endshape() - is called, all of image data defined since the previous call to - beginShape() is written into the image buffer. The constant CLOSE - as the value for the MODE parameter to close the shape (to connect the - beginning and the end). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - use CLOSE to close the shape
        -
        See Also:
        -
        PShape, -PGraphics.beginShape(int)
        -
        -
      • -
      - - - -
        -
      • -

        loadShape

        -
        public PShape loadShape(String filename)
        -
        -
        Parameters:
        -
        filename - name of file to load, can be .svg or .obj
        -
        See Also:
        -
        PShape, -createShape()
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        createShape

        -
        public PShape createShape(int type)
        -
      • -
      - - - -
        -
      • -

        createShape

        -
        public PShape createShape(int kind,
        -                          float... p)
        -
        -
        Parameters:
        -
        kind - either POINT, LINE, TRIANGLE, QUAD, RECT, ELLIPSE, ARC, BOX, SPHERE
        -
        p - parameters that match the kind of shape
        -
        -
      • -
      - - - -
        -
      • -

        loadShader

        -
        public PShader loadShader(String fragFilename)
        -
        ( begin auto-generated from loadShader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        fragFilename - name of fragment shader file
        -
        -
      • -
      - - - -
        -
      • -

        loadShader

        -
        public PShader loadShader(String fragFilename,
        -                          String vertFilename)
        -
        -
        Parameters:
        -
        vertFilename - name of vertex shader file
        -
        -
      • -
      - - - -
        -
      • -

        shader

        -
        public void shader(PShader shader)
        -
        ( begin auto-generated from shader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        shader - name of shader file
        -
        -
      • -
      - - - -
        -
      • -

        shader

        -
        public void shader(PShader shader,
        -                   int kind)
        -
        -
        Parameters:
        -
        kind - type of shader, either POINTS, LINES, or TRIANGLES
        -
        -
      • -
      - - - -
        -
      • -

        resetShader

        -
        public void resetShader()
        -
        ( begin auto-generated from resetShader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        resetShader

        -
        public void resetShader(int kind)
        -
        -
        Parameters:
        -
        kind - type of shader, either POINTS, LINES, or TRIANGLES
        -
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(PShader shader)
        -
        -
        Parameters:
        -
        shader - the fragment shader to apply
        -
        -
      • -
      - - - -
        -
      • -

        clip

        -
        public void clip(float a,
        -                 float b,
        -                 float c,
        -                 float d)
        -
      • -
      - - - -
        -
      • -

        noClip

        -
        public void noClip()
        -
      • -
      - - - -
        -
      • -

        blendMode

        -
        public void blendMode(int mode)
        -
        ( begin auto-generated from blendMode.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - the blending mode to use
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves. Each call to - bezierVertex() defines the position of two control points and one - anchor point of a Bezier curve, adding a new segment to a line or shape. - The first time bezierVertex() is used within a - beginShape() call, it must be prefaced with a call to - vertex() to set the first anchor point. This function must be - used between beginShape() and endShape() and only when - there is no MODE parameter specified to beginShape(). Using the - 3D version requires rendering with P3D (see the Environment reference - for more information). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x2 - the x-coordinate of the 1st control point
        -
        y2 - the y-coordinate of the 1st control point
        -
        z2 - the z-coordinate of the 1st control point
        -
        x3 - the x-coordinate of the 2nd control point
        -
        y3 - the y-coordinate of the 2nd control point
        -
        z3 - the z-coordinate of the 2nd control point
        -
        x4 - the x-coordinate of the anchor point
        -
        y4 - the y-coordinate of the anchor point
        -
        z4 - the z-coordinate of the anchor point
        -
        See Also:
        -
        PGraphics.curveVertex(float, float, float), -PGraphics.vertex(float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float cx,
        -                            float cy,
        -                            float cz,
        -                            float x3,
        -                            float y3,
        -                            float z3)
        -
        -
        Parameters:
        -
        cz - the z-coordinate of the control point
        -
        z3 - the z-coordinate of the anchor point
        -
        -
      • -
      - - - - - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
        -
        Parameters:
        -
        z - the z-coordinate of the vertex
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y)
        -
        ( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel. The - first parameter is the horizontal value for the point, the second value - is the vertical value for the point, and the optional third value is the - depth value. Drawing this shape in 3D with the z parameter - requires the P3D parameter in combination with size() as shown in - the above example. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - x-coordinate of the point
        -
        y - y-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y,
        -                  float z)
        -
        -
        Parameters:
        -
        z - z-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2)
        -
        ( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen. The - version of line() with four parameters draws the line in 2D. To - color a line, use the stroke() function. A line cannot be filled, - therefore the fill() function will not affect the color of a - line. 2D lines are drawn with a width of one pixel by default, but this - can be changed with the strokeWeight() function. The version with - six parameters allows the line to be placed anywhere within XYZ space. - Drawing this shape in 3D with the z parameter requires the P3D - parameter in combination with size() as shown in the above example. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        See Also:
        -
        PGraphics.strokeWeight(float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int), -PGraphics.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float z1,
        -                 float x2,
        -                 float y2,
        -                 float z2)
        -
        -
        Parameters:
        -
        z1 - z-coordinate of the first point
        -
        z2 - z-coordinate of the second point
        -
        -
      • -
      - - - -
        -
      • -

        triangle

        -
        public void triangle(float x1,
        -                     float y1,
        -                     float x2,
        -                     float y2,
        -                     float x3,
        -                     float y3)
        -
        ( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points. The first two - arguments specify the first point, the middle two arguments specify the - second point, and the last two arguments specify the third point. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        x3 - x-coordinate of the third point
        -
        y3 - y-coordinate of the third point
        -
        See Also:
        -
        beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        quad

        -
        public void quad(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2,
        -                 float x3,
        -                 float y3,
        -                 float x4,
        -                 float y4)
        -
        ( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon. It is similar to a - rectangle, but the angles between its edges are not constrained to - ninety degrees. The first pair of parameters (x1,y1) sets the first - vertex and the subsequent pairs should proceed clockwise or - counter-clockwise around the defined shape. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the first corner
        -
        y1 - y-coordinate of the first corner
        -
        x2 - x-coordinate of the second corner
        -
        y2 - y-coordinate of the second corner
        -
        x3 - x-coordinate of the third corner
        -
        y3 - y-coordinate of the third corner
        -
        x4 - x-coordinate of the fourth corner
        -
        y4 - y-coordinate of the fourth corner
        -
        -
      • -
      - - - -
        -
      • -

        rectMode

        -
        public void rectMode(int mode)
        -
        ( begin auto-generated from rectMode.xml ) - - Modifies the location from which rectangles draw. The default mode is - rectMode(CORNER), which specifies the location to be the upper - left corner of the shape and uses the third and fourth parameters of - rect() to specify the width and height. The syntax - rectMode(CORNERS) uses the first and second parameters of - rect() to set the location of one corner and uses the third and - fourth parameters to set the opposite corner. The syntax - rectMode(CENTER) draws the image from its center point and uses - the third and forth parameters of rect() to specify the image's - width and height. The syntax rectMode(RADIUS) draws the image - from its center point and uses the third and forth parameters of - rect() to specify half of the image's width and height. The - parameter must be written in ALL CAPS because Processing is a case - sensitive language. Note: In version 125, the mode named CENTER_RADIUS - was shortened to RADIUS. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CORNER, CORNERS, CENTER, or RADIUS
        -
        See Also:
        -
        PGraphics.rect(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rect

        -
        public void rect(float a,
        -                 float b,
        -                 float c,
        -                 float d)
        -
        ( begin auto-generated from rect.xml ) - - Draws a rectangle to the screen. A rectangle is a four-sided shape with - every angle at ninety degrees. By default, the first two parameters set - the location of the upper-left corner, the third sets the width, and the - fourth sets the height. These parameters may be changed with the - rectMode() function. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - x-coordinate of the rectangle by default
        -
        b - y-coordinate of the rectangle by default
        -
        c - width of the rectangle by default
        -
        d - height of the rectangle by default
        -
        See Also:
        -
        PGraphics.rectMode(int), -PGraphics.quad(float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rect

        -
        public void rect(float a,
        -                 float b,
        -                 float c,
        -                 float d,
        -                 float r)
        -
        -
        Parameters:
        -
        r - radii for all four corners
        -
        -
      • -
      - - - -
        -
      • -

        rect

        -
        public void rect(float a,
        -                 float b,
        -                 float c,
        -                 float d,
        -                 float tl,
        -                 float tr,
        -                 float br,
        -                 float bl)
        -
        -
        Parameters:
        -
        tl - radius for top-left corner
        -
        tr - radius for top-right corner
        -
        br - radius for bottom-right corner
        -
        bl - radius for bottom-left corner
        -
        -
      • -
      - - - -
        -
      • -

        ellipseMode

        -
        public void ellipseMode(int mode)
        -
        ( begin auto-generated from ellipseMode.xml ) - - The origin of the ellipse is modified by the ellipseMode() - function. The default configuration is ellipseMode(CENTER), which - specifies the location of the ellipse as the center of the shape. The - RADIUS mode is the same, but the width and height parameters to - ellipse() specify the radius of the ellipse, rather than the - diameter. The CORNER mode draws the shape from the upper-left - corner of its bounding box. The CORNERS mode uses the four - parameters to ellipse() to set two opposing corners of the - ellipse's bounding box. The parameter must be written in ALL CAPS - because Processing is a case-sensitive language. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CENTER, RADIUS, CORNER, or CORNERS
        -
        See Also:
        -
        ellipse(float, float, float, float), -arc(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        ellipse

        -
        public void ellipse(float a,
        -                    float b,
        -                    float c,
        -                    float d)
        -
        ( begin auto-generated from ellipse.xml ) - - Draws an ellipse (oval) in the display window. An ellipse with an equal - width and height is a circle. The first two parameters set - the location, the third sets the width, and the fourth sets the height. - The origin may be changed with the ellipseMode() function. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - x-coordinate of the ellipse
        -
        b - y-coordinate of the ellipse
        -
        c - width of the ellipse by default
        -
        d - height of the ellipse by default
        -
        See Also:
        -
        ellipseMode(int), -arc(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        arc

        -
        public void arc(float a,
        -                float b,
        -                float c,
        -                float d,
        -                float start,
        -                float stop)
        -
        ( begin auto-generated from arc.xml ) - - Draws an arc in the display window. Arcs are drawn along the outer edge - of an ellipse defined by the x, y, width and - height parameters. The origin or the arc's ellipse may be changed - with the ellipseMode() function. The start and stop - parameters specify the angles at which to draw the arc. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - x-coordinate of the arc's ellipse
        -
        b - y-coordinate of the arc's ellipse
        -
        c - width of the arc's ellipse by default
        -
        d - height of the arc's ellipse by default
        -
        start - angle to start the arc, specified in radians
        -
        stop - angle to stop the arc, specified in radians
        -
        See Also:
        -
        ellipse(float, float, float, float), -ellipseMode(int), -radians(float), -degrees(float)
        -
        -
      • -
      - - - -
        -
      • -

        arc

        -
        public void arc(float a,
        -                float b,
        -                float c,
        -                float d,
        -                float start,
        -                float stop,
        -                int mode)
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float size)
        -
        ( begin auto-generated from box.xml ) - - A box is an extruded rectangle. A box with equal dimension on all sides - is a cube. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        size - dimension of the box in all dimensions (creates a cube)
        -
        See Also:
        -
        PGraphics.sphere(float)
        -
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float w,
        -                float h,
        -                float d)
        -
        -
        Parameters:
        -
        w - dimension of the box in the x-dimension
        -
        h - dimension of the box in the y-dimension
        -
        d - dimension of the box in the z-dimension
        -
        -
      • -
      - - - -
        -
      • -

        sphereDetail

        -
        public void sphereDetail(int res)
        -
        ( begin auto-generated from sphereDetail.xml ) - - Controls the detail used to render a sphere by adjusting the number of - vertices of the sphere mesh. The default resolution is 30, which creates - a fairly detailed sphere definition with vertices every 360/30 = 12 - degrees. If you're going to render a great number of spheres per frame, - it is advised to reduce the level of detail using this function. The - setting stays active until sphereDetail() is called again with a - new parameter and so should not be called prior to every - sphere() statement, unless you wish to render spheres with - different settings, e.g. using less detail for smaller spheres or ones - further away from the camera. To control the detail of the horizontal - and vertical resolution independently, use the version of the functions - with two parameters. - - ( end auto-generated ) - -

        Advanced

        - Code for sphereDetail() submitted by toxi [031031]. - Code for enhanced u/v version from davbol [080801].
        -
        -
        Parameters:
        -
        res - number of segments (minimum 3) used per full circle revolution
        -
        See Also:
        -
        PGraphics.sphere(float)
        -
        -
      • -
      - - - -
        -
      • -

        sphereDetail

        -
        public void sphereDetail(int ures,
        -                         int vres)
        -
        -
        Parameters:
        -
        ures - number of segments used longitudinally per full circle revolutoin
        -
        vres - number of segments used latitudinally from top to bottom
        -
        -
      • -
      - - - -
        -
      • -

        sphere

        -
        public void sphere(float r)
        -
        ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles. - - ( end auto-generated ) - -

        Advanced

        -

        - 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
        - 
        -
        -
        Parameters:
        -
        r - the radius of the sphere
        -
        See Also:
        -
        PGraphics.sphereDetail(int)
        -
        -
      • -
      - - - -
        -
      • -

        bezierPoint

        -
        public float bezierPoint(float a,
        -                         float b,
        -                         float c,
        -                         float d,
        -                         float t)
        -
        ( begin auto-generated from bezierPoint.xml ) - - Evaluates the Bezier at point t for points a, b, c, d. The parameter t - varies between 0 and 1, a and d are points on the curve, and 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. - - ( end auto-generated ) - -

        Advanced

        - 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();
        -
        -
        Parameters:
        -
        a - coordinate of first point on the curve
        -
        b - coordinate of first control point
        -
        c - coordinate of second control point
        -
        d - coordinate of second point on the curve
        -
        t - value between 0 and 1
        -
        See Also:
        -
        PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float), -PGraphics.bezierVertex(float, float, float, float, float, float), -PGraphics.curvePoint(float, float, float, float, float)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from bezier.xml ) - - Draws a Bezier curve on the screen. These curves are defined by a series - of anchor and control points. The first two parameters specify the first - anchor point and the last two parameters specify the other anchor point. - The middle parameters specify the control points which define the shape - of the curve. Bezier curves were developed by French engineer Pierre - Bezier. Using the 3D version requires rendering with P3D (see the - Environment reference for more information). - - ( end auto-generated ) - -

        Advanced

        - 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);
        -
        -
        Parameters:
        -
        x1 - coordinates for the first anchor point
        -
        y1 - coordinates for the first anchor point
        -
        z1 - coordinates for the first anchor point
        -
        x2 - coordinates for the first control point
        -
        y2 - coordinates for the first control point
        -
        z2 - coordinates for the first control point
        -
        x3 - coordinates for the second control point
        -
        y3 - coordinates for the second control point
        -
        z3 - coordinates for the second control point
        -
        x4 - coordinates for the second anchor point
        -
        y4 - coordinates for the second anchor point
        -
        z4 - coordinates for the second anchor point
        -
        See Also:
        -
        PGraphics.bezierVertex(float, float, float, float, float, float), -PGraphics.curve(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        curveTightness

        -
        public void curveTightness(float tightness)
        -
        ( begin auto-generated from curveTightness.xml ) - - Modifies the quality of forms created with curve() and - curveVertex(). The parameter squishy determines how the - curve fits to the vertex points. The value 0.0 is the default value for - squishy (this value defines the curves to be Catmull-Rom splines) - and the value 1.0 connects all the points with straight lines. Values - within the range -5.0 and 5.0 will deform the curves but will leave them - recognizable and as values increase in magnitude, they will continue to deform. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        tightness - amount of deformation from the original vertices
        -
        See Also:
        -
        PGraphics.curve(float, float, float, float, float, float, float, float, float, float, float, float), -PGraphics.curveVertex(float, float)
        -
        -
      • -
      - - - -
        -
      • -

        curve

        -
        public void curve(float x1,
        -                  float y1,
        -                  float x2,
        -                  float y2,
        -                  float x3,
        -                  float y3,
        -                  float x4,
        -                  float y4)
        -
        ( begin auto-generated from curve.xml ) - - Draws a curved line on the screen. The first and second parameters - specify the beginning control point and the last two parameters specify - the ending control point. The middle parameters specify the start and - stop of the curve. Longer curves can be created by putting a series of - curve() functions together or using curveVertex(). An - additional function called curveTightness() provides control for - the visual quality of the curve. The curve() function is an - implementation of Catmull-Rom splines. Using the 3D version requires - rendering with P3D (see the Environment reference for more information). - - ( end auto-generated ) - -

        Advanced

        - As of revision 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();
        - 
        -
        -
        Parameters:
        -
        x1 - coordinates for the beginning control point
        -
        y1 - coordinates for the beginning control point
        -
        x2 - coordinates for the first point
        -
        y2 - coordinates for the first point
        -
        x3 - coordinates for the second point
        -
        y3 - coordinates for the second point
        -
        x4 - coordinates for the ending control point
        -
        y4 - coordinates for the ending control point
        -
        See Also:
        -
        PGraphics.curveVertex(float, float), -PGraphics.curveTightness(float), -PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Parameters:
        -
        z1 - coordinates for the beginning control point
        -
        z2 - coordinates for the first point
        -
        z3 - coordinates for the second point
        -
        z4 - coordinates for the ending control point
        -
        -
      • -
      - - - -
        -
      • -

        imageMode

        -
        public void imageMode(int mode)
        -
        ( begin auto-generated from imageMode.xml ) - - Modifies the location from which images draw. The default mode is - imageMode(CORNER), which specifies the location to be the upper - left corner and uses the fourth and fifth parameters of image() - to set the image's width and height. The syntax - imageMode(CORNERS) uses the second and third parameters of - image() to set the location of one corner of the image and uses - the fourth and fifth parameters to set the opposite corner. Use - imageMode(CENTER) to draw images centered at the given x and y - position.
        -
        - The parameter to imageMode() must be written in ALL CAPS because - Processing is a case-sensitive language. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CORNER, CORNERS, or CENTER
        -
        See Also:
        -
        loadImage(String, String), -PImage, -PGraphics.image(PImage, float, float, float, float), -PGraphics.background(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        image

        -
        public void image(PImage img,
        -                  float a,
        -                  float b)
        -
        ( begin auto-generated from image.xml ) - - Displays images to the screen. The images must be in the sketch's "data" - directory to load correctly. Select "Add file..." from the "Sketch" menu - to add the image. Processing currently works with GIF, JPEG, and Targa - images. The img parameter specifies the image to display and the - x and y parameters define the location of the image from - its upper-left corner. The image is displayed at its original size - unless the width and height parameters specify a different - size.
        -
        - The imageMode() function changes the way the parameters work. For - example, a call to imageMode(CORNERS) will change the - width and height parameters to define the x and y values - of the opposite corner of the image.
        -
        - The color of an image may be modified with the tint() function. - This function will maintain transparency for GIF and PNG images. - - ( end auto-generated ) - -

        Advanced

        - Starting with release 0124, when using the default (JAVA2D) renderer, - smooth() will also improve image quality of resized images.
        -
        -
        Parameters:
        -
        img - the image to display
        -
        a - x-coordinate of the image
        -
        b - y-coordinate of the image
        -
        See Also:
        -
        loadImage(String, String), -PImage, -PGraphics.imageMode(int), -PGraphics.tint(float), -PGraphics.background(float, float, float, float), -PGraphics.alpha(int)
        -
        -
      • -
      - - - -
        -
      • -

        image

        -
        public void image(PImage img,
        -                  float a,
        -                  float b,
        -                  float c,
        -                  float d)
        -
        -
        Parameters:
        -
        c - width to display the image
        -
        d - height to display the image
        -
        -
      • -
      - - - -
        -
      • -

        image

        -
        public void image(PImage img,
        -                  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)
        -
        ( begin auto-generated from shapeMode.xml ) - - Modifies the location from which shapes draw. The default mode is - shapeMode(CORNER), which specifies the location to be the upper - left corner of the shape and uses the third and fourth parameters of - shape() to specify the width and height. The syntax - shapeMode(CORNERS) uses the first and second parameters of - shape() to set the location of one corner and uses the third and - fourth parameters to set the opposite corner. The syntax - shapeMode(CENTER) draws the shape from its center point and uses - the third and forth parameters of shape() to specify the width - and height. The parameter must be written in "ALL CAPS" because - Processing is a case sensitive language. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CORNER, CORNERS, CENTER
        -
        See Also:
        -
        PShape, -PGraphics.shape(PShape), -PGraphics.rectMode(int)
        -
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape)
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float x,
        -                  float y)
        -
        ( begin auto-generated from shape.xml ) - - Displays shapes to the screen. The shapes must be in the sketch's "data" - directory to load correctly. Select "Add file..." from the "Sketch" menu - to add the shape. Processing currently works with SVG shapes only. The - sh parameter specifies the shape to display and the x and - y parameters define the location of the shape from its upper-left - corner. The shape is displayed at its original size unless the - width and height parameters specify a different size. The - shapeMode() function changes the way the parameters work. A call - to shapeMode(CORNERS), for example, will change the width and - height parameters to define the x and y values of the opposite corner of - the shape. -

        - Note complex shapes may draw awkwardly with P3D. This renderer does not - yet support shapes that have holes or complicated breaks. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        shape - the shape to display
        -
        x - x-coordinate of the shape
        -
        y - y-coordinate of the shape
        -
        See Also:
        -
        PShape, -loadShape(String), -Convenience method to draw at a particular location.
        -
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float a,
        -                  float b,
        -                  float c,
        -                  float d)
        -
        -
        Parameters:
        -
        a - x-coordinate of the shape
        -
        b - y-coordinate of the shape
        -
        c - width to display the shape
        -
        d - height to display the shape
        -
        -
      • -
      - - - -
        -
      • -

        textAlign

        -
        public void textAlign(int alignX)
        -
      • -
      - - - -
        -
      • -

        textAlign

        -
        public void textAlign(int alignX,
        -                      int alignY)
        -
        ( begin auto-generated from textAlign.xml ) - - Sets the current alignment for drawing text. The parameters LEFT, - CENTER, and RIGHT set the display characteristics of the letters in - relation to the values for the x and y parameters of the - text() function. -

        - In Processing 0125 and later, an optional second parameter can be used - to vertically align the text. BASELINE is the default, and the vertical - alignment will be reset to BASELINE if the second parameter is not used. - The TOP and CENTER parameters are straightforward. The BOTTOM parameter - offsets the line based on the current textDescent(). For multiple - lines, the final line will be aligned to the bottom, with the previous - lines appearing above it. -

        - When using text() with width and height parameters, BASELINE is - ignored, and treated as TOP. (Otherwise, text would by default draw - outside the box, since BASELINE is the default setting. BASELINE is not - a useful drawing mode for text drawn in a rectangle.) -

        - The vertical alignment is based on the value of textAscent(), - which many fonts do not specify correctly. It may be necessary to use a - hack and offset by a few pixels by hand so that the offset looks - correct. To do this as less of a hack, use some percentage of - textAscent() or textDescent() so that the hack works even - if you change the size of the font. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        alignX - horizontal alignment, either LEFT, CENTER, or RIGHT
        -
        alignY - vertical alignment, either TOP, BOTTOM, CENTER, or BASELINE
        -
        See Also:
        -
        loadFont(String), -PFont, -PGraphics.text(String, float, float), -PGraphics.textSize(float), -PGraphics.textAscent(), -PGraphics.textDescent()
        -
        -
      • -
      - - - -
        -
      • -

        textAscent

        -
        public float textAscent()
        -
        ( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size. This information - is useful for determining the height of the font above the baseline. For - example, adding the textAscent() and textDescent() values - will give you the total height of the line. - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.textDescent()
        -
        -
      • -
      - - - -
        -
      • -

        textDescent

        -
        public float textDescent()
        -
        ( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size. This - information is useful for determining the height of the font below the - baseline. For example, adding the textAscent() and - textDescent() values will give you the total height of the line. - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.textAscent()
        -
        -
      • -
      - - - -
        -
      • -

        textFont

        -
        public void textFont(PFont which)
        -
        ( begin auto-generated from textFont.xml ) - - Sets the current font that will be drawn with the text() - function. Fonts must be loaded with loadFont() before it can be - used. This font will be used in all subsequent calls to the - text() function. If no size parameter is input, the font - will appear at its original size (the size it was created at with the - "Create Font..." tool) until it is changed with textSize().

        Because fonts are usually bitmaped, you should create fonts at - the sizes that will be used most commonly. Using textFont() - without the size parameter will result in the cleanest-looking text.

        With the default (JAVA2D) and PDF renderers, it's also possible - to enable the use of native fonts via the command - hint(ENABLE_NATIVE_FONTS). This will produce vector text in - JAVA2D sketches and PDF output in cases where the vector data is - available: when the font is still installed, or the font is created via - the createFont() function (rather than the Create Font tool). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        which - any variable of the type PFont
        -
        See Also:
        -
        createFont(String, float, boolean), -loadFont(String), -PFont, -PGraphics.text(String, float, float), -PGraphics.textSize(float)
        -
        -
      • -
      - - - -
        -
      • -

        textFont

        -
        public void textFont(PFont which,
        -                     float size)
        -
        -
        Parameters:
        -
        size - the size of the letters in units of pixels
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textMode

        -
        public void textMode(int mode)
        -
        ( begin auto-generated from textMode.xml ) - - Sets the way text draws to the screen. In the default configuration, the - MODEL mode, it's possible to rotate, scale, and place letters in - two and three dimensional space.
        -
        - The SHAPE mode draws text using the the glyph outlines of - individual characters rather than as textures. This mode is only - supported with the PDF and P3D renderer settings. With the - PDF renderer, you must call textMode(SHAPE) before any - other drawing occurs. If the outlines are not available, then - textMode(SHAPE) will be ignored and textMode(MODEL) will - be used instead.
        -
        - The textMode(SHAPE) option in P3D can be combined with - beginRaw() to write vector-accurate text to 2D and 3D output - files, for instance DXF or PDF. The SHAPE mode is - not currently optimized for P3D, so if recording shape data, use - textMode(MODEL) until you're ready to capture the geometry with beginRaw(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either MODEL or SHAPE
        -
        See Also:
        -
        loadFont(String), -PFont.PFont(java.io.InputStream), -PGraphics.text(String, float, float), -PGraphics.textFont(PFont), -PGraphics.beginRaw(PGraphics), -createFont(String, float, boolean)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textWidth

        -
        public float textWidth(char c)
        -
        -
        Parameters:
        -
        c - the character to measure
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textWidth

        -
        public float textWidth(char[] chars,
        -                       int start,
        -                       int length)
        -
      • -
      - - - - - - - -
        -
      • -

        text

        -
        public void text(char c,
        -                 float x,
        -                 float y,
        -                 float z)
        -
        -
        Parameters:
        -
        z - z-coordinate of text
        -
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(String str,
        -                 float x,
        -                 float y)
        -

        Advanced

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

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        chars - the alphanumberic symbols to be displayed
        -
        start - array index at which to start writing characters
        -
        stop - array index at which to stop writing characters
        -
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(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(String str,
        -                 float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2)
        -

        Advanced

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

        -
        -
        Parameters:
        -
        x1 - by default, the x-coordinate of text, see rectMode() for more info
        -
        y1 - by default, the x-coordinate of text, see rectMode() for more info
        -
        x2 - by default, the width of the text box, see rectMode() for more info
        -
        y2 - by default, the height of the text box, see rectMode() for more info
        -
        -
      • -
      - - - -
        -
      • -

        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.
        -
        -
        Parameters:
        -
        num - the numeric value to be displayed
        -
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(float num,
        -                 float x,
        -                 float y,
        -                 float z)
        -
      • -
      - - - - - - - -
        -
      • -

        popMatrix

        -
        public void popMatrix()
        -
        ( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack. - Understanding pushing and popping requires understanding the concept of - a matrix stack. The pushMatrix() function saves the current - coordinate system to the stack and popMatrix() restores the prior - coordinate system. pushMatrix() and popMatrix() are used - in conjuction with the other transformation functions and may be - embedded to control the scope of the transformations. - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.pushMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float x,
        -                      float y)
        -
        ( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window. The - x parameter specifies left/right translation, the y - parameter specifies up/down translation, and the z parameter - specifies translations toward/away from the screen. Using this function - with the z parameter requires using P3D as a parameter in - combination with size as shown in the above example. Transformations - apply to everything that happens after and subsequent calls to the - function accumulates the effect. For example, calling translate(50, - 0) and then translate(20, 0) is the same as translate(70, - 0). If translate() is called within draw(), the - transformation is reset when the loop begins again. This function can be - further controlled by the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - left/right translation
        -
        y - up/down translation
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float x,
        -                      float y,
        -                      float z)
        -
        -
        Parameters:
        -
        z - forward/backward translation
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle)
        -
        ( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter. - Angles should be specified in radians (values from 0 to TWO_PI) or - converted to radians with the radians() function. -

        - Objects are always rotated around their relative position to the origin - and positive numbers rotate objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - rotate(HALF_PI) and then rotate(HALF_PI) is the same as - rotate(PI). All tranformations are reset when draw() - begins again. -

        - Technically, rotate() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateX(PI/2) and then rotateX(PI/2) is the same - as rotateX(PI). If rotateX() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the example above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateY(PI/2) and then rotateY(PI/2) is the same - as rotateY(PI). If rotateY() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateZ(PI/2) and then rotateZ(PI/2) is the same - as rotateZ(PI). If rotateZ() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle,
        -                   float x,
        -                   float y,
        -                   float z)
        -

        Advanced

        - Rotate about a vector in space. Same as the glRotatef() function.
        -
        -
        Parameters:
        -
        x -
        -
        y -
        -
        z -
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float s)
        -
        ( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices. Objects always scale from their relative origin to the - coordinate system. Scale values are specified as decimal percentages. - For example, the function call scale(2.0) increases the dimension - of a shape by 200%. Transformations apply to everything that happens - after and subsequent calls to the function multiply the effect. For - example, calling scale(2.0) and then scale(1.5) is the - same as scale(3.0). If scale() is called within - draw(), the transformation is reset when the loop begins again. - Using this fuction with the z parameter requires using P3D as a - parameter for size() as shown in the example above. This function - can be further controlled by pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        s - percentage to scale the object
        -
        See Also:
        -
        PGraphics.pushMatrix(), -PGraphics.popMatrix(), -PGraphics.translate(float, float, float), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float)
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y)
        -

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        x - percentage to scale the object in the x-axis
        -
        y - percentage to scale the object in the y-axis
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y,
        -                  float z)
        -
        -
        Parameters:
        -
        z - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - -
        -
      • -

        shearX

        -
        public void shearX(float angle)
        -
        ( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearX(PI/2) and then shearX(PI/2) is the same as - shearX(PI). If shearX() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearX() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        public void shearY(float angle)
        -
        ( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearY(PI/2) and then shearY(PI/2) is the same as - shearY(PI). If shearY() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearY() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearX(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -radians(float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(PMatrix source)
        -
        ( begin auto-generated from applyMatrix.xml ) - - Multiplies the current matrix by the one specified through the - parameters. This is very slow because it will try to calculate the - inverse of the transform, so avoid it whenever possible. The equivalent - function in OpenGL is glMultMatrix(). - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.pushMatrix(), -PGraphics.popMatrix(), -PGraphics.resetMatrix(), -PGraphics.printMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(PMatrix2D source)
        -
      • -
      - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(float n00,
        -                        float n01,
        -                        float n02,
        -                        float n10,
        -                        float n11,
        -                        float n12)
        -
        -
        Parameters:
        -
        n00 - numbers which define the 4x4 matrix to be multiplied
        -
        n01 - numbers which define the 4x4 matrix to be multiplied
        -
        n02 - numbers which define the 4x4 matrix to be multiplied
        -
        n10 - numbers which define the 4x4 matrix to be multiplied
        -
        n11 - numbers which define the 4x4 matrix to be multiplied
        -
        n12 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Parameters:
        -
        n03 - numbers which define the 4x4 matrix to be multiplied
        -
        n13 - numbers which define the 4x4 matrix to be multiplied
        -
        n20 - numbers which define the 4x4 matrix to be multiplied
        -
        n21 - numbers which define the 4x4 matrix to be multiplied
        -
        n22 - numbers which define the 4x4 matrix to be multiplied
        -
        n23 - numbers which define the 4x4 matrix to be multiplied
        -
        n30 - numbers which define the 4x4 matrix to be multiplied
        -
        n31 - numbers which define the 4x4 matrix to be multiplied
        -
        n32 - numbers which define the 4x4 matrix to be multiplied
        -
        n33 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - -
        -
      • -

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

        beginCamera

        -
        public void beginCamera()
        -
        ( begin auto-generated from beginCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space. The functions are useful if - you want to more control over camera movement, however for most users, - the camera() function will be sufficient.

        The camera - functions will replace any transformations (such as rotate() or - translate()) that occur before them in draw(), but they - will not automatically replace the camera transform itself. For this - reason, camera functions should be placed at the beginning of - draw() (so that transformations happen afterwards), and the - camera() function can be used after beginCamera() if you - want to reset the camera before applying transformations.

        This function sets the matrix mode to the camera matrix so calls such - as translate(), rotate(), applyMatrix() and resetMatrix() - affect the camera. beginCamera() should always be used with a - following endCamera() and pairs of beginCamera() and - endCamera() cannot be nested. - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.camera(), -PGraphics.endCamera(), -PGraphics.applyMatrix(PMatrix), -PGraphics.resetMatrix(), -PGraphics.translate(float, float, float), -PGraphics.scale(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        endCamera

        -
        public void endCamera()
        -
        ( begin auto-generated from endCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space. Please see the reference for - beginCamera() for a description of how the functions are used. - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.camera(float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        camera

        -
        public void camera()
        -
        ( begin auto-generated from camera.xml ) - - Sets the position of the camera through setting the eye position, the - center of the scene, and which axis is facing upward. Moving the eye - position and the direction it is pointing (the center of the scene) - allows the images to be seen from different angles. The version without - any parameters sets the camera to the default position, pointing to the - center of the display window with the Y axis as up. The default values - are camera(width/2.0, height/2.0, (height/2.0) / tan(PI*30.0 / - 180.0), width/2.0, height/2.0, 0, 0, 1, 0). This function is similar - to gluLookAt() in OpenGL, but it first clears the current camera settings. - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.endCamera(), -PGraphics.frustum(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        camera

        -
        public void camera(float eyeX,
        -                   float eyeY,
        -                   float eyeZ,
        -                   float centerX,
        -                   float centerY,
        -                   float centerZ,
        -                   float upX,
        -                   float upY,
        -                   float upZ)
        -
        -
        Parameters:
        -
        eyeX - x-coordinate for the eye
        -
        eyeY - y-coordinate for the eye
        -
        eyeZ - z-coordinate for the eye
        -
        centerX - x-coordinate for the center of the scene
        -
        centerY - y-coordinate for the center of the scene
        -
        centerZ - z-coordinate for the center of the scene
        -
        upX - usually 0.0, 1.0, or -1.0
        -
        upY - usually 0.0, 1.0, or -1.0
        -
        upZ - usually 0.0, 1.0, or -1.0
        -
        -
      • -
      - - - - - - - -
        -
      • -

        ortho

        -
        public void ortho()
        -
        ( begin auto-generated from ortho.xml ) - - Sets an orthographic projection and defines a parallel clipping volume. - All objects with the same dimension appear the same size, regardless of - whether they are near or far from the camera. The parameters to this - function specify the clipping volume where left and right are the - minimum and maximum x values, top and bottom are the minimum and maximum - y values, and near and far are the minimum and maximum z values. If no - parameters are given, the default is used: ortho(0, width, 0, height, - -10, 10). - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho(float left,
        -                  float right,
        -                  float bottom,
        -                  float top)
        -
        -
        Parameters:
        -
        left - left plane of the clipping volume
        -
        right - right plane of the clipping volume
        -
        bottom - bottom plane of the clipping volume
        -
        top - top plane of the clipping volume
        -
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho(float left,
        -                  float right,
        -                  float bottom,
        -                  float top,
        -                  float near,
        -                  float far)
        -
        -
        Parameters:
        -
        near - maximum distance from the origin to the viewer
        -
        far - maximum distance from the origin away from the viewer
        -
        -
      • -
      - - - -
        -
      • -

        perspective

        -
        public void perspective()
        -
        ( begin auto-generated from perspective.xml ) - - Sets a perspective projection applying foreshortening, making distant - objects appear smaller than closer ones. The parameters define a viewing - volume with the shape of truncated pyramid. Objects near to the front of - the volume appear their actual size, while farther objects appear - smaller. This projection simulates the perspective of the world more - accurately than orthographic projection. The version of perspective - without parameters sets the default perspective and the version with - four parameters allows the programmer to set the area precisely. The - default values are: perspective(PI/3.0, width/height, cameraZ/10.0, - cameraZ*10.0) where cameraZ is ((height/2.0) / tan(PI*60.0/360.0)); - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        perspective

        -
        public void perspective(float fovy,
        -                        float aspect,
        -                        float zNear,
        -                        float zFar)
        -
        -
        Parameters:
        -
        fovy - field-of-view angle (in radians) for vertical direction
        -
        aspect - ratio of width to height
        -
        zNear - z-position of nearest clipping plane
        -
        zFar - z-position of farthest clipping plane
        -
        -
      • -
      - - - -
        -
      • -

        frustum

        -
        public void frustum(float left,
        -                    float right,
        -                    float bottom,
        -                    float top,
        -                    float near,
        -                    float far)
        -
        ( begin auto-generated from frustum.xml ) - - Sets a perspective matrix defined through the parameters. Works like - glFrustum, except it wipes out the current perspective matrix rather - than muliplying itself with it. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        left - left coordinate of the clipping plane
        -
        right - right coordinate of the clipping plane
        -
        bottom - bottom coordinate of the clipping plane
        -
        top - top coordinate of the clipping plane
        -
        near - near component of the clipping plane; must be greater than zero
        -
        far - far component of the clipping plane; must be greater than the near value
        -
        See Also:
        -
        PGraphics.camera(float, float, float, float, float, float, float, float, float), -PGraphics.endCamera(), -PGraphics.perspective(float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y)
        -
        ( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenY(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y)
        -
        ( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y,
        -                     float z)
        -
        -
        Parameters:
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y,
        -                     float z)
        -
        -
        Parameters:
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenZ

        -
        public float screenZ(float x,
        -                     float y,
        -                     float z)
        -
        ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenY(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelX

        -
        public float modelX(float x,
        -                    float y,
        -                    float z)
        -
        ( begin auto-generated from modelX.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the X value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The X value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use. -

        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.modelY(float, float, float), -PGraphics.modelZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelY

        -
        public float modelY(float x,
        -                    float y,
        -                    float z)
        -
        ( begin auto-generated from modelY.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the Y value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The Y value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use.
        -
        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.modelX(float, float, float), -PGraphics.modelZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelZ

        -
        public float modelZ(float x,
        -                    float y,
        -                    float z)
        -
        ( begin auto-generated from modelZ.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the Z value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The Z value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use.
        -
        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.modelX(float, float, float), -PGraphics.modelY(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        pushStyle

        -
        public void pushStyle()
        -
        ( begin auto-generated from pushStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings. Note that these functions - are always used together. They allow you to change the style settings - and later return to what you had. When a new style is started with - pushStyle(), it builds on the current style information. The - pushStyle() and popStyle() functions can be embedded to - provide more control (see the second example above for a demonstration.) -

        - The style information controlled by the following functions are included - in the style: - fill(), stroke(), tint(), strokeWeight(), strokeCap(), strokeJoin(), - imageMode(), rectMode(), ellipseMode(), shapeMode(), colorMode(), - textAlign(), textFont(), textMode(), textSize(), textLeading(), - emissive(), specular(), shininess(), ambient() - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.popStyle()
        -
        -
      • -
      - - - -
        -
      • -

        popStyle

        -
        public void popStyle()
        -
        ( begin auto-generated from popStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings; these functions are - always used together. They allow you to change the style settings and - later return to what you had. When a new style is started with - pushStyle(), it builds on the current style information. The - pushStyle() and popStyle() functions can be embedded to - provide more control (see the second example above for a demonstration.) - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.pushStyle()
        -
        -
      • -
      - - - -
        -
      • -

        style

        -
        public void style(PStyle s)
        -
      • -
      - - - -
        -
      • -

        strokeWeight

        -
        public void strokeWeight(float weight)
        -
        ( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes. All widths are set in units of pixels. -

        - When drawing with P3D, series of connected lines (such as the stroke - around a polygon, triangle, or ellipse) produce unattractive results - when a thick stroke weight is set (see - Issue 123). With P3D, the minimum and maximum values for - strokeWeight() are controlled by the graphics card and the - operating system's OpenGL implementation. For instance, the thickness - may not go higher than 10 pixels. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        weight - the weight (in pixels) of the stroke
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        strokeJoin

        -
        public void strokeJoin(int join)
        -
        ( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments. These joints - are either mitered, beveled, or rounded and specified with the - corresponding parameters MITER, BEVEL, and ROUND. The default joint is - MITER. -

        - This function is not available with the P3D renderer, (see - Issue 123). More information about the renderers can be found in the - size() reference. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        join - either MITER, BEVEL, ROUND
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeWeight(float), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        strokeCap

        -
        public void strokeCap(int cap)
        -
        ( begin auto-generated from strokeCap.xml ) - - Sets the style for rendering line endings. These ends are either - squared, extended, or rounded and specified with the corresponding - parameters SQUARE, PROJECT, and ROUND. The default cap is ROUND. -

        - This function is not available with the P3D renderer (see - Issue 123). More information about the renderers can be found in the - size() reference. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        cap - either SQUARE, PROJECT, or ROUND
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeWeight(float), -PGraphics.strokeJoin(int), -size(int, int, String, String)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        stroke

        -
        public void stroke(int rgb)
        -
        ( begin auto-generated from stroke.xml ) - - Sets the color used to draw lines and borders around shapes. This color - is either specified in terms of the RGB or HSB color depending on the - current colorMode() (the default color space is RGB, with each - value in the range from 0 to 255). -

        - When using hexadecimal notation to specify a color, use "#" or "0x" - before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six - digits to specify a color (the way colors are specified in HTML and - CSS). When using the hexadecimal notation starting with "0x", the - hexadecimal value must be specified with eight characters; the first two - characters define the alpha component and the remainder the red, green, - and blue components. -

        - The value for the parameter "gray" must be less than or equal to the - current maximum value as specified by colorMode(). The default - maximum value is 255. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color value in hexadecimal notation
        -
        See Also:
        -
        PGraphics.noStroke(), -PGraphics.strokeWeight(float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int), -PGraphics.fill(int, float), -PGraphics.noFill(), -PGraphics.tint(int, float), -PGraphics.background(float, float, float, float), -PGraphics.colorMode(int, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(int rgb,
        -                   float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the stroke
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float gray)
        -
        -
        Parameters:
        -
        gray - specifies a value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float gray,
        -                   float alpha)
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float v1,
        -                   float v2,
        -                   float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float v1,
        -                   float v2,
        -                   float v3,
        -                   float alpha)
        -
      • -
      - - - - - - - -
        -
      • -

        tint

        -
        public void tint(int rgb)
        -
        ( begin auto-generated from tint.xml ) - - Sets the fill value for displaying images. Images can be tinted to - specified colors or made transparent by setting the alpha.
        -
        - To make an image transparent, but not change it's color, use white as - the tint color and specify an alpha value. For instance, tint(255, 128) - will make an image 50% transparent (unless colorMode() has been - used).
        -
        - When using hexadecimal notation to specify a color, use "#" or "0x" - before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six - digits to specify a color (the way colors are specified in HTML and - CSS). When using the hexadecimal notation starting with "0x", the - hexadecimal value must be specified with eight characters; the first two - characters define the alpha component and the remainder the red, green, - and blue components.
        -
        - The value for the parameter "gray" must be less than or equal to the - current maximum value as specified by colorMode(). The default - maximum value is 255.
        -
        - The tint() function is also used to control the coloring of - textures in 3D. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color value in hexadecimal notation
        -
        See Also:
        -
        PGraphics.noTint(), -PGraphics.image(PImage, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(int rgb,
        -                 float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the image
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float gray)
        -
        -
        Parameters:
        -
        gray - specifies a value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float gray,
        -                 float alpha)
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float v1,
        -                 float v2,
        -                 float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float v1,
        -                 float v2,
        -                 float v3,
        -                 float alpha)
        -
      • -
      - - - - - - - -
        -
      • -

        fill

        -
        public void fill(int rgb)
        -
        ( begin auto-generated from fill.xml ) - - Sets the color used to fill shapes. For example, if you run fill(204, - 102, 0), all subsequent shapes will be filled with orange. This - color is either specified in terms of the RGB or HSB color depending on - the current colorMode() (the default color space is RGB, with - each value in the range from 0 to 255). -

        - When using hexadecimal notation to specify a color, use "#" or "0x" - before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six - digits to specify a color (the way colors are specified in HTML and - CSS). When using the hexadecimal notation starting with "0x", the - hexadecimal value must be specified with eight characters; the first two - characters define the alpha component and the remainder the red, green, - and blue components. -

        - The value for the parameter "gray" must be less than or equal to the - current maximum value as specified by colorMode(). The default - maximum value is 255. -

        - To change the color of an image (or a texture), use tint(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color variable or hex value
        -
        See Also:
        -
        PGraphics.noFill(), -PGraphics.stroke(int, float), -PGraphics.noStroke(), -PGraphics.tint(int, float), -PGraphics.background(float, float, float, float), -PGraphics.colorMode(int, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(int rgb,
        -                 float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the fill
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float gray)
        -
        -
        Parameters:
        -
        gray - number specifying value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float gray,
        -                 float alpha)
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float v1,
        -                 float v2,
        -                 float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float v1,
        -                 float v2,
        -                 float v3,
        -                 float alpha)
        -
      • -
      - - - -
        -
      • -

        ambient

        -
        public void ambient(int rgb)
        -
        ( begin auto-generated from ambient.xml ) - - Sets the ambient reflectance for shapes drawn to the screen. This is - combined with the ambient light component of environment. The color - components set through the parameters define the reflectance. For - example in the default color mode, setting v1=255, v2=126, v3=0, would - cause all the red light to reflect and half of the green light to - reflect. Used in combination with emissive(), specular(), - and shininess() in setting the material properties of shapes. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        PGraphics.emissive(float, float, float), -PGraphics.specular(float, float, float), -PGraphics.shininess(float)
        -
        -
      • -
      - - - -
        -
      • -

        ambient

        -
        public void ambient(float gray)
        -
        -
        Parameters:
        -
        gray - number specifying value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        ambient

        -
        public void ambient(float v1,
        -                    float v2,
        -                    float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        specular

        -
        public void specular(float gray)
        -
        gray number specifying value between white and black
        -
      • -
      - - - -
        -
      • -

        specular

        -
        public void specular(float v1,
        -                     float v2,
        -                     float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        emissive

        -
        public void emissive(float gray)
        -
        gray number specifying value between white and black
        -
      • -
      - - - -
        -
      • -

        emissive

        -
        public void emissive(float v1,
        -                     float v2,
        -                     float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        noLights

        -
        public void noLights()
        -
        ( begin auto-generated from noLights.xml ) - - Disable all lighting. Lighting is turned off by default and enabled with - the lights() function. This function can be used to disable - lighting so that 2D geometry (which does not require lighting) can be - drawn after a set of lighted 3D geometry. - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.lights()
        -
        -
      • -
      - - - - - - - -
        -
      • -

        ambientLight

        -
        public void ambientLight(float v1,
        -                         float v2,
        -                         float v3,
        -                         float x,
        -                         float y,
        -                         float z)
        -
        -
        Parameters:
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        -
      • -
      - - - -
        -
      • -

        directionalLight

        -
        public void directionalLight(float v1,
        -                             float v2,
        -                             float v3,
        -                             float nx,
        -                             float ny,
        -                             float nz)
        -
        ( begin auto-generated from directionalLight.xml ) - - Adds a directional light. Directional light comes from one direction and - is stronger when hitting a surface squarely and weaker if it hits at a a - gentle angle. After hitting a surface, a directional lights scatters in - all directions. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The nx, ny, and nz parameters specify the - direction the light is facing. For example, setting ny to -1 will - cause the geometry to be lit from below (the light is facing directly upward). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        nx - direction along the x-axis
        -
        ny - direction along the y-axis
        -
        nz - direction along the z-axis
        -
        See Also:
        -
        PGraphics.lights(), -PGraphics.ambientLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        spotLight

        -
        public void spotLight(float v1,
        -                      float v2,
        -                      float v3,
        -                      float x,
        -                      float y,
        -                      float z,
        -                      float nx,
        -                      float ny,
        -                      float nz,
        -                      float angle,
        -                      float concentration)
        -
        ( begin auto-generated from spotLight.xml ) - - Adds a spot light. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The x, y, and z parameters specify the - position of the light and nx, ny, nz specify the - direction or light. The angle parameter affects angle of the - spotlight cone. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        nx - direction along the x axis
        -
        ny - direction along the y axis
        -
        nz - direction along the z axis
        -
        angle - angle of the spotlight cone
        -
        concentration - exponent determining the center bias of the cone
        -
        See Also:
        -
        PGraphics.lights(), -PGraphics.directionalLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.ambientLight(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        lightFalloff

        -
        public void lightFalloff(float constant,
        -                         float linear,
        -                         float quadratic)
        -
        ( begin auto-generated from lightFalloff.xml ) - - Sets the falloff rates for point lights, spot lights, and ambient - lights. The parameters are used to determine the falloff with the - following equation:

        d = distance from light position to - vertex position
        falloff = 1 / (CONSTANT + d * LINEAR + (d*d) * - QUADRATIC)

        Like fill(), it affects only the elements - which are created after it in the code. The default value if - LightFalloff(1.0, 0.0, 0.0). Thinking about an ambient light with - a falloff can be tricky. It is used, for example, if you wanted a region - of your scene to be lit ambiently one color and another region to be lit - ambiently by another color, you would use an ambient light with location - and falloff. You can think of it as a point light that doesn't care - which direction a surface is facing. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        constant - constant value or determining falloff
        -
        linear - linear value for determining falloff
        -
        quadratic - quadratic value for determining falloff
        -
        See Also:
        -
        PGraphics.lights(), -PGraphics.ambientLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float), -PGraphics.lightSpecular(float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        background

        -
        public void background(int rgb)
        -
        ( begin auto-generated from background.xml ) - - The background() function sets the color used for the background - of the Processing window. The default background is light gray. In the - draw() function, the background color is used to clear the - display window at the beginning of each frame. -

        - An image can also be used as the background for a sketch, however its - width and height must be the same size as the sketch window. To resize - an image 'b' to the size of the sketch window, use b.resize(width, height). -

        - Images used as background will ignore the current tint() setting. -

        - It is not possible to use transparency (alpha) in background colors with - the main drawing surface, however they will work properly with createGraphics(). - - ( end auto-generated ) - -

        Advanced

        -

        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.

        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        PGraphics.stroke(float), -PGraphics.fill(float), -PGraphics.tint(float), -PGraphics.colorMode(int)
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(int rgb,
        -                       float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the background
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float gray)
        -
        -
        Parameters:
        -
        gray - specifies a value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float gray,
        -                       float alpha)
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float v1,
        -                       float v2,
        -                       float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on the current color mode)
        -
        v2 - green or saturation value (depending on the current color mode)
        -
        v3 - blue or brightness value (depending on the current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float v1,
        -                       float v2,
        -                       float v3,
        -                       float alpha)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
      • -
      - - - -
        -
      • -

        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. Use image.filter(OPAQUE) to handle this easily.
        -
        - When using 3D, this will also clear the zbuffer (if it exists).
        -
        -
        Parameters:
        -
        image - PImage to set as background (must be same size as the sketch window)
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode)
        -
        ( begin auto-generated from colorMode.xml ) - - Changes the way Processing interprets color data. By default, the - parameters for fill(), stroke(), background(), and - color() are defined by values between 0 and 255 using the RGB - color model. The colorMode() function is used to change the - numerical range used for specifying colors and to switch color systems. - For example, calling colorMode(RGB, 1.0) will specify that values - are specified between 0 and 1. The limits for defining colors are - altered by setting the parameters range1, range2, range3, and range 4. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - Either RGB or HSB, corresponding to Red/Green/Blue and Hue/Saturation/Brightness
        -
        See Also:
        -
        PGraphics.background(float), -PGraphics.fill(float), -PGraphics.stroke(float)
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float max)
        -
        -
        Parameters:
        -
        max - range for all color elements
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float max1,
        -                      float max2,
        -                      float max3)
        -
        -
        Parameters:
        -
        max1 - range for the red or hue depending on the current color mode
        -
        max2 - range for the green or saturation depending on the current color mode
        -
        max3 - range for the blue or brightness depending on the current color mode
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float max1,
        -                      float max2,
        -                      float max3,
        -                      float maxA)
        -
        -
        Parameters:
        -
        maxA - range for the alpha
        -
        -
      • -
      - - - - - - - -
        -
      • -

        red

        -
        public final float red(int rgb)
        -
        ( begin auto-generated from red.xml ) - - Extracts the red value from a color, scaled to match current - colorMode(). This value is always returned as a float so be - careful not to assign it to an int value.

        The red() function - is easy to use and undestand, but is slower than another technique. To - achieve the same results when working in colorMode(RGB, 255), but - with greater speed, use the >> (right shift) operator with a bit - mask. For example, the following two lines of code are equivalent:
        float r1 = red(myColor);
        float r2 = myColor >> 16 - & 0xFF;
        - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        PGraphics.green(int), -PGraphics.blue(int), -PGraphics.alpha(int), -PGraphics.hue(int), -PGraphics.saturation(int), -PGraphics.brightness(int)
        -
        -
      • -
      - - - -
        -
      • -

        green

        -
        public final float green(int rgb)
        -
        ( begin auto-generated from green.xml ) - - Extracts the green value from a color, scaled to match current - colorMode(). This value is always returned as a float so be - careful not to assign it to an int value.

        The green() - function is easy to use and undestand, but is slower than another - technique. To achieve the same results when working in colorMode(RGB, - 255), but with greater speed, use the >> (right shift) - operator with a bit mask. For example, the following two lines of code - are equivalent:
        float r1 = green(myColor);
        float r2 = - myColor >> 8 & 0xFF;
        - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        PGraphics.red(int), -PGraphics.blue(int), -PGraphics.alpha(int), -PGraphics.hue(int), -PGraphics.saturation(int), -PGraphics.brightness(int)
        -
        -
      • -
      - - - -
        -
      • -

        blue

        -
        public final float blue(int rgb)
        -
        ( begin auto-generated from blue.xml ) - - Extracts the blue value from a color, scaled to match current - colorMode(). This value is always returned as a float so be - careful not to assign it to an int value.

        The blue() - function is easy to use and undestand, but is slower than another - technique. To achieve the same results when working in colorMode(RGB, - 255), but with greater speed, use a bit mask to remove the other - color components. For example, the following two lines of code are - equivalent:
        float r1 = blue(myColor);
        float r2 = myColor - & 0xFF;
        - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        PGraphics.red(int), -PGraphics.green(int), -PGraphics.alpha(int), -PGraphics.hue(int), -PGraphics.saturation(int), -PGraphics.brightness(int)
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        lerpColor

        -
        public static int lerpColor(int c1,
        -                            int c2,
        -                            float amt,
        -                            int mode)
        -
      • -
      - - - -
        -
      • -

        showDepthWarning

        -
        public static void showDepthWarning(String method)
        -
        Display a warning that the specified method is only available with 3D.
        -
        -
        Parameters:
        -
        method - The method name (no parentheses)
        -
        -
      • -
      - - - -
        -
      • -

        showDepthWarningXYZ

        -
        public static void showDepthWarningXYZ(String method)
        -
        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.
        -
        -
        Parameters:
        -
        method - The method name (no parentheses)
        -
        -
      • -
      - - - -
        -
      • -

        showMethodWarning

        -
        public static void showMethodWarning(String method)
        -
        Display a warning that the specified method is simply unavailable.
        -
      • -
      - - - -
        -
      • -

        showVariationWarning

        -
        public static void showVariationWarning(String str)
        -
        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.
        -
      • -
      - - - -
        -
      • -

        showMissingWarning

        -
        public static void showMissingWarning(String method)
        -
        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.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get(int x,
        -               int y)
        -
        ( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image. If no - parameters are specified, the entire image is returned. Use the x - and y parameters to get the value of one pixel. Get a section of - the display window by specifying an additional width and - height parameter. When getting an image, the x and - y parameters define the coordinates for the upper-left corner of - the image, regardless of the current imageMode().
        -
        - If the pixel requested is outside of the image window, black is - returned. The numbers returned are scaled according to the current color - ranges, but only RGB values are returned by this function. For example, - even though you may have drawn a shape with colorMode(HSB), the - numbers returned will be in RGB format.
        -
        - Getting the color of a single pixel with get(x, y) is easy, but - not as fast as grabbing the data directly from pixels[]. The - equivalent statement to get(x, y) using pixels[] is - pixels[y*width+x]. See the reference for pixels[] for more information. - - ( end auto-generated ) - -

        Advanced

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

        -
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        See Also:
        -
        set(int, int, int), -pixels, -copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public PImage get(int x,
        -                  int y,
        -                  int w,
        -                  int h)
        -
        -
        Parameters:
        -
        w - width of pixel rectangle to get
        -
        h - height of pixel rectangle to get
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public PImage get()
        -
        Returns a copy of this PImage. Equivalent to get(0, 0, width, height). - Deprecated, just use copy() instead.
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public PImage copy()
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                int c)
        -
        ( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
        -
        - The x and y parameters specify the pixel to change and the - color parameter specifies the color value. The color parameter is - affected by the current color mode (the default is RGB values from 0 to - 255). When setting an image, the x and y parameters define - the coordinates for the upper-left corner of the image, regardless of - the current imageMode(). -

        - Setting the color of a single pixel with set(x, y) is easy, but - not as fast as putting the data directly into pixels[]. The - equivalent statement to set(x, y, #000000) using pixels[] - is pixels[y*width+x] = #000000. See the reference for - pixels[] for more information. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        c - any value of the color datatype
        -
        See Also:
        -
        PImage.get(int, int, int, int), -PImage.pixels, -PImage.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                PImage img)
        -

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        img - image to copy into the original image
        -
        -
      • -
      - - - -
        -
      • -

        mask

        -
        public void mask(PImage img)
        -
        ( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel. This mask image should only contain - grayscale data, but only the blue color channel is used. The mask image - needs to be the same size as the image to which it is applied.
        -
        - In addition to using a mask image, an integer array containing the alpha - channel data can be specified directly. This method is useful for - creating dynamically generated alpha masks. This array must be of the - same length as the target image's pixels array and should contain only - grayscale data of values between 0-255. - - ( end auto-generated ) - -

        Advanced

        - - 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" grayscale by - performing a proper luminance-based conversion.

        -
        -
        Parameters:
        -
        maskArray - array of integers used as the alpha channel, needs to be the same length as the image's pixel array
        -
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(int kind)
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(int kind,
        -                   float param)
        -
        ( begin auto-generated from PImage_filter.xml ) - - Filters an image as defined by one of the following modes:

        THRESHOLD - converts the image to black and white pixels depending if - they are above or below the threshold defined by the level parameter. - The level must be between 0.0 (black) and 1.0(white). If no level is - specified, 0.5 is used.
        -
        - GRAY - converts any colors in the image to grayscale equivalents
        -
        - INVERT - sets each pixel to its inverse value
        -
        - POSTERIZE - limits each channel of the image to the number of colors - specified as the level parameter
        -
        - BLUR - executes a Guassian blur with the level parameter specifying the - extent of the blurring. If no level parameter is used, the blur is - equivalent to Guassian blur of radius 1
        -
        - OPAQUE - sets the alpha channel to entirely opaque
        -
        - ERODE - reduces the light areas with the amount defined by the level - parameter
        -
        - DILATE - increases the light areas with the amount defined by the level parameter - - ( end auto-generated ) - -

        Advanced

        - 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

        -
        -
        Parameters:
        -
        kind - Either THRESHOLD, GRAY, OPAQUE, INVERT, POSTERIZE, BLUR, ERODE, or DILATE
        -
        param - unique for each, see above
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(int sx,
        -                 int sy,
        -                 int sw,
        -                 int sh,
        -                 int dx,
        -                 int dy,
        -                 int dw,
        -                 int dh)
        -
        ( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another. If the source and - destination regions aren't the same size, it will automatically resize - source pixels to fit the specified target region. No alpha information - is used in the process, however if the source image has an alpha channel - set, it will be copied as well. -

        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        sx - X coordinate of the source's upper left corner
        -
        sy - Y coordinate of the source's upper left corner
        -
        sw - source image width
        -
        sh - source image height
        -
        dx - X coordinate of the destination's upper left corner
        -
        dy - Y coordinate of the destination's upper left corner
        -
        dw - destination image width
        -
        dh - destination image height
        -
        See Also:
        -
        PGraphics.alpha(int), -PImage.blend(PImage, int, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(PImage src,
        -                 int sx,
        -                 int sy,
        -                 int sw,
        -                 int sh,
        -                 int dx,
        -                 int dy,
        -                 int dw,
        -                 int dh)
        -
        -
        Parameters:
        -
        src - an image variable referring to the source image.
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from PImage_blend.xml ) - - Blends a region of pixels into the image specified by the img - parameter. These copies utilize full alpha channel support and a choice - of the following modes to blend the colors of source pixels (A) with the - ones of pixels in the destination image (B):
        -
        - BLEND - linear interpolation of colours: C = A*factor + B
        -
        - ADD - additive blending with white clip: C = min(A*factor + B, 255)
        -
        - SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, - 0)
        -
        - DARKEST - only the darkest colour succeeds: C = min(A*factor, B)
        -
        - LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)
        -
        - 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.
        -
        - All modes use the alpha information (highest byte) of source image - pixels as the blending factor. If the source and destination regions are - different sizes, the image will be automatically resized to match the - destination size. If the srcImg parameter is not used, the - display window is used as the source image.
        -
        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        src - an image variable referring to the source image
        -
        sx - X coordinate of the source's upper left corner
        -
        sy - Y coordinate of the source's upper left corner
        -
        sw - source image width
        -
        sh - source image height
        -
        dx - X coordinate of the destinations's upper left corner
        -
        dy - Y coordinate of the destinations's upper left corner
        -
        dw - destination image width
        -
        dh - destination image height
        -
        mode - Either BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN
        -
        See Also:
        -
        alpha(int), -PImage.copy(PImage, int, int, int, int, int, int, int, int), -PImage.blendColor(int,int,int)
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PConstants.html b/build/javadoc/core/processing/core/PConstants.html deleted file mode 100644 index 2ea1524f51..0000000000 --- a/build/javadoc/core/processing/core/PConstants.html +++ /dev/null @@ -1,3268 +0,0 @@ - - - - - -PConstants - - - - - - - - - - - -
-
processing.core
-

Interface PConstants

-
-
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PFont.Glyph.html b/build/javadoc/core/processing/core/PFont.Glyph.html deleted file mode 100644 index dc7eb6301a..0000000000 --- a/build/javadoc/core/processing/core/PFont.Glyph.html +++ /dev/null @@ -1,383 +0,0 @@ - - - - - -PFont.Glyph - - - - - - - - - - - -
-
processing.core
-

Class PFont.Glyph

-
-
- -
-
    -
  • -
    -
    Enclosing class:
    -
    PFont
    -
    -
    -
    -
    public class PFont.Glyph
    -extends Object
    -
    A single character, and its visage.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        image

        -
        public PImage image
        -
      • -
      - - - -
        -
      • -

        value

        -
        public int value
        -
      • -
      - - - -
        -
      • -

        height

        -
        public int height
        -
      • -
      - - - -
        -
      • -

        width

        -
        public int width
        -
      • -
      - - - -
        -
      • -

        index

        -
        public int index
        -
      • -
      - - - -
        -
      • -

        setWidth

        -
        public int setWidth
        -
      • -
      - - - -
        -
      • -

        topExtent

        -
        public int topExtent
        -
      • -
      - - - -
        -
      • -

        leftExtent

        -
        public int leftExtent
        -
      • -
      -
    • -
    - - -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PFont.html b/build/javadoc/core/processing/core/PFont.html deleted file mode 100644 index 5b0959a5c9..0000000000 --- a/build/javadoc/core/processing/core/PFont.html +++ /dev/null @@ -1,827 +0,0 @@ - - - - - -PFont - - - - - - - - - - - -
-
processing.core
-

Class PFont

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    -
    public class PFont
    -extends 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)
    - 
    -
    -
    See Also:
    -
    PApplet.loadFont(String), -PApplet.createFont(String, float, boolean, char[]), -PGraphics.textFont(PFont)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        CHARSET

        -
        public static char[] 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(Font font,
        -             boolean smooth)
        -
        ( begin auto-generated from PFont.xml ) - - PFont is the font class for Processing. To create a font to use with - Processing, select "Create Font..." from the Tools menu. This will - create a font in the format Processing requires and also adds it to the - current sketch's data directory. Processing displays fonts using the - .vlw font format, which uses images for each letter, rather than - defining them through vector data. The loadFont() function - constructs a new font and textFont() makes a font active. The - list() method creates a list of the fonts installed on the - computer, which is useful information to use with the - createFont() function for dynamically converting fonts into a - format to use with Processing. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        font - font the font object to create from
        -
        smooth - smooth true to enable smoothing/anti-aliasing
        -
        -
      • -
      - - - -
        -
      • -

        PFont

        -
        public PFont(Font font,
        -             boolean smooth,
        -             char[] charset)
        -
        Create a new image-based font on the fly. If charset is set to null, - the characters will only be created as bitmaps when they're drawn.
        -
        -
        Parameters:
        -
        charset - array of all unicode chars that should be included
        -
        -
      • -
      - - - -
        -
      • -

        PFont

        -
        public PFont(Font font,
        -             boolean smooth,
        -             char[] charset,
        -             boolean stream)
        -
        Adds an additional parameter that indicates the font came from a file, - not a built-in OS font.
        -
      • -
      - - - - -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        save

        -
        public void save(OutputStream output)
        -          throws 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:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        getName

        -
        public String getName()
        -
      • -
      - - - -
        -
      • -

        getPostScriptName

        -
        public String getPostScriptName()
        -
      • -
      - - - -
        -
      • -

        setNative

        -
        public void setNative(Object font)
        -
        Set the native complement of this font. Might be set internally via the - findFont() function, or externally by a deriveFont() call if the font - is resized by PGraphicsJava2D.
        -
      • -
      - - - -
        -
      • -

        getFont

        -
        @Deprecated
        -public Font getFont()
        -
        Deprecated. 
        -
        Use the getNative() method instead, which allows library interfaces to be - written in a cross-platform fashion for desktop, Android, and others.
        -
      • -
      - - - -
        -
      • -

        getNative

        -
        public Object getNative()
        -
        Return the native java.awt.Font associated with this PFont (if any).
        -
      • -
      - - - -
        -
      • -

        getSize

        -
        public int getSize()
        -
        Return size of this font.
        -
      • -
      - - - -
        -
      • -

        isStream

        -
        public boolean isStream()
        -
      • -
      - - - -
        -
      • -

        setSubsetting

        -
        public void setSubsetting()
        -
      • -
      - - - -
        -
      • -

        findNative

        -
        public Object findNative()
        -
        Attempt to find the native version of this font. - (Public so that it can be used by OpenGL or other renderers.)
        -
      • -
      - - - -
        -
      • -

        getGlyph

        -
        public PFont.Glyph getGlyph(char c)
        -
      • -
      - - - -
        -
      • -

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

        getGlyphCount

        -
        public int getGlyphCount()
        -
      • -
      - - - -
        -
      • -

        getGlyph

        -
        public PFont.Glyph getGlyph(int i)
        -
      • -
      - - - -
        -
      • -

        getShape

        -
        public PShape getShape(char ch)
        -
      • -
      - - - -
        -
      • -

        getShape

        -
        public PShape getShape(char ch,
        -                       float detail)
        -
      • -
      - - - -
        -
      • -

        list

        -
        public static String[] list()
        -
        ( begin auto-generated from PFont_list.xml ) - - Gets a list of the fonts installed on the system. The data is returned - as a String array. This list provides the names of each font for input - into createFont(), which allows Processing to dynamically format - fonts. This function is meant as a tool for programming local - applications and is not recommended for use in applets. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        loadFonts

        -
        public static void loadFonts()
        -
      • -
      - - - -
        -
      • -

        findFont

        -
        public static Font findFont(String name)
        -
        Starting with Java 1.5, Apple broke the ability to specify most fonts. - This bug was filed years ago as #4769141 at bugreporter.apple.com. More: - Bug 407.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PGraphics.html b/build/javadoc/core/processing/core/PGraphics.html deleted file mode 100644 index b91111b2c7..0000000000 --- a/build/javadoc/core/processing/core/PGraphics.html +++ /dev/null @@ -1,9564 +0,0 @@ - - - - - -PGraphics - - - - - - - - - - - -
-
processing.core
-

Class PGraphics

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Cloneable, PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    PGraphicsFX2D, PGraphicsJava2D, PGraphicsOpenGL
    -
    -
    -
    -
    public class PGraphics
    -extends PImage
    -implements PConstants
    -
    ( begin auto-generated from PGraphics.xml ) - - Main graphics and rendering context, as well as the base API - implementation for processing "core". Use this class if you need to draw - into an off-screen graphics buffer. A PGraphics object can be - constructed with the createGraphics() function. The - beginDraw() and endDraw() methods (see above example) are - necessary to set up the buffer and to finalize it. The fields and - methods for this class are extensive. For a complete list, visit the developer's reference. - - ( end auto-generated ) - -

    Advanced

    - 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. - - We're working right now on synchronizing the two references, so the website reference - is generated from the javadoc comments. Yay.
    -
    -
    See Also:
    -
    PApplet.createGraphics(int, int, String)
    -
    -
  • -
-
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      PGraphics() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      floatalpha(int rgb) -
      ( begin auto-generated from alpha.xml ) - - Extracts the alpha value from a color.
      -
      voidambient(float gray) 
      voidambient(float v1, - float v2, - float v3) 
      voidambient(int rgb) -
      ( begin auto-generated from ambient.xml ) - - Sets the ambient reflectance for shapes drawn to the screen.
      -
      voidambientLight(float v1, - float v2, - float v3) -
      ( begin auto-generated from ambientLight.xml ) - - Adds an ambient light.
      -
      voidambientLight(float v1, - float v2, - float v3, - float x, - float y, - float z) 
      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) -
      ( begin auto-generated from applyMatrix.xml ) - - Multiplies the current matrix by the one specified through the - parameters.
      -
      voidapplyMatrix(PMatrix2D source) 
      voidapplyMatrix(PMatrix3D source) 
      voidarc(float a, - float b, - float c, - float d, - float start, - float stop) -
      ( begin auto-generated from arc.xml ) - - Draws an arc in the display window.
      -
      voidarc(float a, - float b, - float c, - float d, - float start, - float stop, - int mode) 
      voidattrib(String name, - boolean... values) 
      voidattrib(String name, - float... values) 
      voidattrib(String name, - int... values) 
      voidbackground(float gray) 
      voidbackground(float gray, - float alpha) 
      voidbackground(float v1, - float v2, - float v3) 
      voidbackground(float v1, - float v2, - float v3, - float alpha) 
      voidbackground(int rgb) -
      ( begin auto-generated from background.xml ) - - The background() function sets the color used for the background - of the Processing window.
      -
      voidbackground(int rgb, - float alpha) 
      voidbackground(PImage image) -
      Takes an RGB or ARGB image and sets it as the background.
      -
      voidbeginCamera() -
      ( begin auto-generated from beginCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
      -
      voidbeginContour() 
      voidbeginDraw() -
      ( begin auto-generated from PGraphics_beginDraw.xml ) - - Sets the default properties for a PGraphics object.
      -
      PGLbeginPGL() 
      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) -
      ( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms.
      -
      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) -
      ( begin auto-generated from bezier.xml ) - - Draws a Bezier curve on the screen.
      -
      voidbezierDetail(int detail) -
      ( begin auto-generated from bezierDetail.xml ) - - Sets the resolution at which Beziers display.
      -
      floatbezierPoint(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from bezierPoint.xml ) - - Evaluates the Bezier at point t for points a, b, c, d.
      -
      floatbezierTangent(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from bezierTangent.xml ) - - Calculates the tangent of a point on a 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) -
      ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves.
      -
      voidblendMode(int mode) -
      ( begin auto-generated from blendMode.xml ) - - This is a new reference entry for Processing 2.0.
      -
      floatblue(int rgb) -
      ( begin auto-generated from blue.xml ) - - Extracts the blue value from a color, scaled to match current - colorMode().
      -
      voidbox(float size) -
      ( begin auto-generated from box.xml ) - - A box is an extruded rectangle.
      -
      voidbox(float w, - float h, - float d) 
      floatbrightness(int rgb) -
      ( begin auto-generated from brightness.xml ) - - Extracts the brightness value from a color.
      -
      voidcamera() -
      ( begin auto-generated from camera.xml ) - - Sets the position of the camera through setting the eye position, the - center of the scene, and which axis is facing upward.
      -
      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.
      -
      voidclear() 
      voidclip(float a, - float b, - float c, - float d) 
      intcolor(float gray) 
      intcolor(float gray, - float alpha) 
      intcolor(float v1, - float v2, - float v3) 
      intcolor(float v1, - float v2, - float v3, - float a) 
      intcolor(int c) 
      intcolor(int c, - float alpha) 
      intcolor(int c, - int alpha) 
      intcolor(int v1, - int v2, - int v3) 
      intcolor(int v1, - int v2, - int v3, - int a) 
      voidcolorMode(int mode) -
      ( begin auto-generated from colorMode.xml ) - - Changes the way Processing interprets color data.
      -
      voidcolorMode(int mode, - float max) 
      voidcolorMode(int mode, - float max1, - float max2, - float max3) 
      voidcolorMode(int mode, - float max1, - float max2, - float max3, - float maxA) 
      PShapecreateShape() 
      PShapecreateShape(int type) 
      PShapecreateShape(int kind, - float... p) 
      PSurfacecreateSurface() 
      voidcurve(float x1, - float y1, - float x2, - float y2, - float x3, - float y3, - float x4, - float y4) -
      ( begin auto-generated from curve.xml ) - - Draws a curved line on the screen.
      -
      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) -
      ( begin auto-generated from curveDetail.xml ) - - Sets the resolution at which curves display.
      -
      floatcurvePoint(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from curvePoint.xml ) - - Evalutes the curve at point t for points a, b, c, d.
      -
      floatcurveTangent(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from curveTangent.xml ) - - Calculates the tangent of a point on a curve.
      -
      voidcurveTightness(float tightness) -
      ( begin auto-generated from curveTightness.xml ) - - Modifies the quality of forms created with curve() and - curveVertex().
      -
      voidcurveVertex(float x, - float y) -
      ( begin auto-generated from curveVertex.xml ) - - Specifies vertex coordinates for curves.
      -
      voidcurveVertex(float x, - float y, - float z) 
      voiddirectionalLight(float v1, - float v2, - float v3, - float nx, - float ny, - float nz) -
      ( begin auto-generated from directionalLight.xml ) - - Adds a directional light.
      -
      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) -
      ( begin auto-generated from ellipse.xml ) - - Draws an ellipse (oval) in the display window.
      -
      voidellipseMode(int mode) -
      ( begin auto-generated from ellipseMode.xml ) - - The origin of the ellipse is modified by the ellipseMode() - function.
      -
      voidemissive(float gray) -
      gray number specifying value between white and black
      -
      voidemissive(float v1, - float v2, - float v3) 
      voidemissive(int rgb) -
      ( begin auto-generated from emissive.xml ) - - Sets the emissive color of the material used for drawing shapes drawn to - the screen.
      -
      voidendCamera() -
      ( begin auto-generated from endCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
      -
      voidendContour() 
      voidendDraw() -
      ( begin auto-generated from PGraphics_endDraw.xml ) - - Finalizes the rendering of a PGraphics object so that it can be shown on screen.
      -
      voidendPGL() 
      voidendRaw() 
      voidendShape() 
      voidendShape(int mode) -
      ( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape().
      -
      voidfill(float gray) 
      voidfill(float gray, - float alpha) 
      voidfill(float v1, - float v2, - float v3) 
      voidfill(float v1, - float v2, - float v3, - float alpha) 
      voidfill(int rgb) -
      ( begin auto-generated from fill.xml ) - - Sets the color used to fill shapes.
      -
      voidfill(int rgb, - float alpha) 
      voidfilter(PShader shader) 
      voidflush() 
      voidfrustum(float left, - float right, - float bottom, - float top, - float near, - float far) -
      ( begin auto-generated from frustum.xml ) - - Sets a perspective matrix defined through the parameters.
      -
      ObjectgetCache(PImage image) -
      Get cache storage data for the specified renderer.
      -
      FontMetricsgetFontMetrics(Font font) -
      Convenience method to get a legit FontMetrics object.
      -
      FontRenderContextgetFontRenderContext(Font font) -
      Convenience method to jump through some Java2D hoops and get an FRC.
      -
      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.
      -
      PGraphicsgetRaw() 
      PStylegetStyle() 
      PStylegetStyle(PStyle s) 
      floatgreen(int rgb) -
      ( begin auto-generated from green.xml ) - - Extracts the green value from a color, scaled to match current - colorMode().
      -
      booleanhaveRaw() 
      voidhint(int which) -
      ( begin auto-generated from hint.xml ) - - Set various hints and hacks for the renderer.
      -
      floathue(int rgb) -
      ( begin auto-generated from hue.xml ) - - Extracts the hue value from a color.
      -
      voidimage(PImage img, - float a, - float b) -
      ( begin auto-generated from image.xml ) - - Displays images to the screen.
      -
      voidimage(PImage img, - float a, - float b, - float c, - float d) 
      voidimage(PImage img, - 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) -
      ( begin auto-generated from imageMode.xml ) - - Modifies the location from which images draw.
      -
      booleanis2D() -
      Return true if this renderer supports 2D drawing.
      -
      booleanis2X() 
      booleanis3D() -
      Return true if this renderer supports 3D drawing.
      -
      booleanisGL() -
      Return true if this renderer does rendering through OpenGL.
      -
      intlerpColor(int c1, - int c2, - float amt) -
      ( begin auto-generated from lerpColor.xml ) - - Calculates a color or colors between two color at a specific increment.
      -
      static intlerpColor(int c1, - int c2, - float amt, - int mode) 
      voidlightFalloff(float constant, - float linear, - float quadratic) -
      ( begin auto-generated from lightFalloff.xml ) - - Sets the falloff rates for point lights, spot lights, and ambient - lights.
      -
      voidlights() -
      ( begin auto-generated from lights.xml ) - - Sets the default ambient light, directional light, falloff, and specular - values.
      -
      voidlightSpecular(float v1, - float v2, - float v3) -
      ( begin auto-generated from lightSpecular.xml ) - - Sets the specular color for lights.
      -
      voidline(float x1, - float y1, - float x2, - float y2) -
      ( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen.
      -
      voidline(float x1, - float y1, - float z1, - float x2, - float y2, - float z2) 
      PShaderloadShader(String fragFilename) -
      ( begin auto-generated from loadShader.xml ) - - This is a new reference entry for Processing 2.0.
      -
      PShaderloadShader(String fragFilename, - String vertFilename) 
      PShapeloadShape(String filename) 
      PShapeloadShape(String filename, - String options) 
      floatmodelX(float x, - float y, - float z) -
      ( begin auto-generated from modelX.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
      -
      floatmodelY(float x, - float y, - float z) -
      ( begin auto-generated from modelY.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
      -
      floatmodelZ(float x, - float y, - float z) -
      ( begin auto-generated from modelZ.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
      -
      voidnoClip() 
      voidnoFill() -
      ( begin auto-generated from noFill.xml ) - - Disables filling geometry.
      -
      voidnoLights() -
      ( begin auto-generated from noLights.xml ) - - Disable all lighting.
      -
      voidnormal(float nx, - float ny, - float nz) -
      ( begin auto-generated from normal.xml ) - - Sets the current normal vector.
      -
      voidnoSmooth() 
      voidnoStroke() -
      ( begin auto-generated from noStroke.xml ) - - Disables drawing the stroke (outline).
      -
      voidnoTexture() -
      Removes texture image for current shape.
      -
      voidnoTint() -
      ( begin auto-generated from noTint.xml ) - - Removes the current fill value for displaying images and reverts to - displaying images with their original hues.
      -
      voidortho() -
      ( begin auto-generated from ortho.xml ) - - Sets an orthographic projection and defines a parallel clipping volume.
      -
      voidortho(float left, - float right, - float bottom, - float top) 
      voidortho(float left, - float right, - float bottom, - float top, - float near, - float far) 
      voidperspective() -
      ( begin auto-generated from perspective.xml ) - - Sets a perspective projection applying foreshortening, making distant - objects appear smaller than closer ones.
      -
      voidperspective(float fovy, - float aspect, - float zNear, - float zFar) 
      voidpoint(float x, - float y) -
      ( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel.
      -
      voidpoint(float x, - float y, - float z) 
      voidpointLight(float v1, - float v2, - float v3, - float x, - float y, - float z) -
      ( begin auto-generated from pointLight.xml ) - - Adds a point light.
      -
      voidpopMatrix() -
      ( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack.
      -
      voidpopStyle() -
      ( begin auto-generated from popStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings; these functions are - always used together.
      -
      voidprintCamera() -
      ( begin auto-generated from printCamera.xml ) - - Prints the current camera matrix to the Console (the text window at the - bottom of Processing).
      -
      voidprintMatrix() -
      ( begin auto-generated from printMatrix.xml ) - - Prints the current matrix to the Console (the text window at the bottom - of Processing).
      -
      voidprintProjection() -
      ( begin auto-generated from printProjection.xml ) - - Prints the current projection matrix to the Console (the text window at - the bottom of Processing).
      -
      voidpushMatrix() -
      ( begin auto-generated from pushMatrix.xml ) - - Pushes the current transformation matrix onto the matrix stack.
      -
      voidpushStyle() -
      ( begin auto-generated from pushStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings.
      -
      voidquad(float x1, - float y1, - float x2, - float y2, - float x3, - float y3, - float x4, - float y4) -
      ( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon.
      -
      voidquadraticVertex(float cx, - float cy, - float x3, - float y3) 
      voidquadraticVertex(float cx, - float cy, - float cz, - float x3, - float y3, - float z3) 
      voidrect(float a, - float b, - float c, - float d) -
      ( begin auto-generated from rect.xml ) - - Draws a rectangle to the screen.
      -
      voidrect(float a, - float b, - float c, - float d, - float r) 
      voidrect(float a, - float b, - float c, - float d, - float tl, - float tr, - float br, - float bl) 
      voidrectMode(int mode) -
      ( begin auto-generated from rectMode.xml ) - - Modifies the location from which rectangles draw.
      -
      floatred(int rgb) -
      ( begin auto-generated from red.xml ) - - Extracts the red value from a color, scaled to match current - colorMode().
      -
      voidremoveCache(PImage image) -
      Remove information associated with this renderer from the cache, if any.
      -
      voidresetMatrix() -
      ( begin auto-generated from resetMatrix.xml ) - - Replaces the current matrix with the identity matrix.
      -
      voidresetShader() -
      ( begin auto-generated from resetShader.xml ) - - This is a new reference entry for Processing 2.0.
      -
      voidresetShader(int kind) 
      voidrotate(float angle) -
      ( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter.
      -
      voidrotate(float angle, - float x, - float y, - float z) -
      Advanced
      -
      voidrotateX(float angle) -
      ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter.
      -
      voidrotateY(float angle) -
      ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter.
      -
      voidrotateZ(float angle) -
      ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter.
      -
      floatsaturation(int rgb) -
      ( begin auto-generated from saturation.xml ) - - Extracts the saturation value from a color.
      -
      voidscale(float s) -
      ( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices.
      -
      voidscale(float x, - float y) -
      Advanced
      -
      voidscale(float x, - float y, - float z) 
      floatscreenX(float x, - float y) -
      ( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen.
      -
      floatscreenX(float x, - float y, - float z) 
      floatscreenY(float x, - float y) -
      ( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen.
      -
      floatscreenY(float x, - float y, - float z) 
      floatscreenZ(float x, - float y, - float z) -
      ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen.
      -
      voidsetCache(PImage image, - Object storage) -
      Store data of some kind for the renderer that requires extra metadata of - some kind.
      -
      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(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.
      -
      voidshader(PShader shader) -
      ( begin auto-generated from shader.xml ) - - This is a new reference entry for Processing 2.0.
      -
      voidshader(PShader shader, - int kind) 
      voidshape(PShape shape) 
      voidshape(PShape shape, - float x, - float y) -
      ( begin auto-generated from shape.xml ) - - Displays shapes to the screen.
      -
      voidshape(PShape shape, - float a, - float b, - float c, - float d) 
      voidshapeMode(int mode) -
      ( begin auto-generated from shapeMode.xml ) - - Modifies the location from which shapes draw.
      -
      voidshearX(float angle) -
      ( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter.
      -
      voidshearY(float angle) -
      ( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter.
      -
      voidshininess(float shine) -
      ( begin auto-generated from shininess.xml ) - - Sets the amount of gloss in the surface of shapes.
      -
      static voidshowDepthWarning(String method) -
      Display a warning that the specified method is only available with 3D.
      -
      static voidshowDepthWarningXYZ(String method) -
      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.
      -
      static voidshowException(String msg) -
      Show an renderer-related exception that halts the program.
      -
      static voidshowMethodWarning(String method) -
      Display a warning that the specified method is simply unavailable.
      -
      static voidshowMissingWarning(String method) -
      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 voidshowVariationWarning(String str) -
      Error that a particular variation of a method is unavailable (even though - other variations are).
      -
      static voidshowWarning(String msg) -
      Show a renderer error, and keep track of it so that it's only shown once.
      -
      static voidshowWarning(String msg, - Object... args) -
      Version of showWarning() that takes a parsed String.
      -
      voidsmooth() 
      voidsmooth(int quality) 
      voidspecular(float gray) -
      gray number specifying value between white and black
      -
      voidspecular(float v1, - float v2, - float v3) 
      voidspecular(int rgb) -
      ( begin auto-generated from specular.xml ) - - Sets the specular color of the materials used for shapes drawn to the - screen, which sets the color of hightlights.
      -
      voidsphere(float r) -
      ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles.
      -
      voidsphereDetail(int res) -
      ( begin auto-generated from sphereDetail.xml ) - - Controls the detail used to render a sphere by adjusting the number of - vertices of the sphere mesh.
      -
      voidsphereDetail(int ures, - int vres) 
      voidspotLight(float v1, - float v2, - float v3, - float x, - float y, - float z, - float nx, - float ny, - float nz, - float angle, - float concentration) -
      ( begin auto-generated from spotLight.xml ) - - Adds a spot light.
      -
      voidstroke(float gray) 
      voidstroke(float gray, - float alpha) 
      voidstroke(float v1, - float v2, - float v3) 
      voidstroke(float v1, - float v2, - float v3, - float alpha) 
      voidstroke(int rgb) -
      ( begin auto-generated from stroke.xml ) - - Sets the color used to draw lines and borders around shapes.
      -
      voidstroke(int rgb, - float alpha) 
      voidstrokeCap(int cap) -
      ( begin auto-generated from strokeCap.xml ) - - Sets the style for rendering line endings.
      -
      voidstrokeJoin(int join) -
      ( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments.
      -
      voidstrokeWeight(float weight) -
      ( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes.
      -
      voidstyle(PStyle s) 
      voidtext(char[] chars, - int start, - int stop, - float x, - float y) -
      Advanced
      -
      voidtext(char[] chars, - int start, - int stop, - float x, - float y, - float z) 
      voidtext(char c, - float x, - float y) -
      ( begin auto-generated from text.xml ) - - Draws text to the screen.
      -
      voidtext(char c, - float x, - float y, - float z) 
      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(String str, - float x, - float y) -
      Advanced
      -
      voidtext(String str, - float x, - float y, - float z) -
      Same as above but with a z coordinate.
      -
      voidtext(String str, - float x1, - float y1, - float x2, - float y2) -
      Advanced
      -
      voidtextAlign(int alignX) 
      voidtextAlign(int alignX, - int alignY) -
      ( begin auto-generated from textAlign.xml ) - - Sets the current alignment for drawing text.
      -
      floattextAscent() -
      ( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size.
      -
      floattextDescent() -
      ( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size.
      -
      voidtextFont(PFont which) -
      ( begin auto-generated from textFont.xml ) - - Sets the current font that will be drawn with the text() - function.
      -
      voidtextFont(PFont which, - float size) 
      voidtextLeading(float leading) -
      ( begin auto-generated from textLeading.xml ) - - Sets the spacing between lines of text in units of pixels.
      -
      voidtextMode(int mode) -
      ( begin auto-generated from textMode.xml ) - - Sets the way text draws to the screen.
      -
      voidtextSize(float size) -
      ( begin auto-generated from textSize.xml ) - - Sets the current font size.
      -
      voidtexture(PImage image) -
      ( begin auto-generated from texture.xml ) - - Sets a texture to be applied to vertex points.
      -
      voidtextureMode(int mode) -
      ( begin auto-generated from textureMode.xml ) - - Sets the coordinate space for texture mapping.
      -
      voidtextureWrap(int wrap) -
      ( begin auto-generated from textureWrap.xml ) - - Description to come...
      -
      floattextWidth(char c) 
      floattextWidth(char[] chars, - int start, - int length) 
      floattextWidth(String str) -
      ( begin auto-generated from textWidth.xml ) - - Calculates and returns the width of any character or text string.
      -
      voidtint(float gray) 
      voidtint(float gray, - float alpha) 
      voidtint(float v1, - float v2, - float v3) 
      voidtint(float v1, - float v2, - float v3, - float alpha) 
      voidtint(int rgb) -
      ( begin auto-generated from tint.xml ) - - Sets the fill value for displaying images.
      -
      voidtint(int rgb, - float alpha) 
      voidtranslate(float x, - float y) -
      ( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window.
      -
      voidtranslate(float x, - float y, - float z) 
      voidtriangle(float x1, - float y1, - float x2, - float y2, - float x3, - float y3) -
      ( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points.
      -
      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) -
      ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices.
      -
      - - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        pixelCount

        -
        public int pixelCount
        -
      • -
      - - - -
        -
      • -

        smooth

        -
        public int smooth
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        VERTEX_FIELD_COUNT

        -
        public static final int VERTEX_FIELD_COUNT
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
      • -
      - - - -
        -
      • -

        ambientColor

        -
        public int ambientColor
        -
      • -
      - - - -
        -
      • -

        ambientR

        -
        public float ambientR
        -
      • -
      - - - -
        -
      • -

        ambientG

        -
        public float ambientG
        -
      • -
      - - - -
        -
      • -

        ambientB

        -
        public float ambientB
        -
      • -
      - - - -
        -
      • -

        setAmbient

        -
        public boolean setAmbient
        -
      • -
      - - - -
        -
      • -

        specularColor

        -
        public int specularColor
        -
      • -
      - - - -
        -
      • -

        specularR

        -
        public float specularR
        -
      • -
      - - - -
        -
      • -

        specularG

        -
        public float specularG
        -
      • -
      - - - -
        -
      • -

        specularB

        -
        public float specularB
        -
      • -
      - - - -
        -
      • -

        emissiveColor

        -
        public int emissiveColor
        -
      • -
      - - - -
        -
      • -

        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 Image image
        -
        Java AWT Image object associated with this renderer. For the 1.0 version - of P2D and P3D, this was associated with their MemoryImageSource. - For PGraphicsJava2D, it will be the offscreen drawing buffer.
        -
      • -
      - - - -
        -
      • -

        DEFAULT_VERTICES

        -
        public static final int DEFAULT_VERTICES
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        bezierDetail

        -
        public int bezierDetail
        -
      • -
      - - - -
        -
      • -

        curveDetail

        -
        public int curveDetail
        -
      • -
      - - - -
        -
      • -

        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()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      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(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: this is ignored by the Methods task 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.

        -
      • -
      - - - -
        -
      • -

        createSurface

        -
        public PSurface createSurface()
        -
      • -
      - - - -
        -
      • -

        setCache

        -
        public void setCache(PImage image,
        -                     Object storage)
        -
        Store data of some kind for the 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.
        -
        -
        Parameters:
        -
        renderer - The PGraphics renderer associated to the image
        -
        storage - The metadata required by the renderer
        -
        -
      • -
      - - - -
        -
      • -

        getCache

        -
        public Object getCache(PImage image)
        -
        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:
        -
        renderer - The PGraphics renderer associated to the image
        -
        Returns:
        -
        metadata stored for the specified renderer
        -
        -
      • -
      - - - -
        -
      • -

        removeCache

        -
        public void removeCache(PImage image)
        -
        Remove information associated with this renderer from the cache, if any.
        -
        -
        Parameters:
        -
        renderer - The PGraphics renderer whose cache data should be removed
        -
        -
      • -
      - - - -
        -
      • -

        canDraw

        -
        public boolean canDraw()
        -
        Some renderers have requirements re: when they are ready to draw.
        -
      • -
      - - - -
        -
      • -

        beginDraw

        -
        public void beginDraw()
        -
        ( begin auto-generated from PGraphics_beginDraw.xml ) - - Sets the default properties for a PGraphics object. It should be called - before anything is drawn into the object. - - ( end auto-generated ) -

        Advanced

        - When creating your own PGraphics, you should call this before - drawing anything.
        -
      • -
      - - - -
        -
      • -

        endDraw

        -
        public void endDraw()
        -
        ( begin auto-generated from PGraphics_endDraw.xml ) - - Finalizes the rendering of a PGraphics object so that it can be shown on screen. - - ( end auto-generated ) -

        Advanced

        -

        - When creating your own PGraphics, you should call this when - you're finished drawing.

        -
      • -
      - - - -
        -
      • -

        beginPGL

        -
        public PGL beginPGL()
        -
      • -
      - - - -
        -
      • -

        endPGL

        -
        public void endPGL()
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public void flush()
        -
      • -
      - - - -
        -
      • -

        hint

        -
        public void hint(int which)
        -
        ( begin auto-generated from hint.xml ) - - Set various hints and hacks for the renderer. This is used to handle - obscure rendering features that cannot be implemented in a consistent - manner across renderers. Many options will often graduate to standard - features instead of hints over time. -

        - hint(ENABLE_OPENGL_4X_SMOOTH) - Enable 4x anti-aliasing for P3D. This - can help force anti-aliasing if it has not been enabled by the user. On - some graphics cards, this can also be set by the graphics driver's - control panel, however not all cards make this available. This hint must - be called immediately after the size() command because it resets the - renderer, obliterating any settings and anything drawn (and like size(), - re-running the code that came before it again). -

        - hint(DISABLE_OPENGL_2X_SMOOTH) - In Processing 1.0, Processing always - enables 2x smoothing when the P3D renderer is used. This hint disables - the default 2x smoothing and returns the smoothing behavior found in - earlier releases, where smooth() and noSmooth() could be used to enable - and disable smoothing, though the quality was inferior. -

        - hint(ENABLE_NATIVE_FONTS) - Use the native version fonts when they are - installed, rather than the bitmapped version from a .vlw file. This is - useful with the default (or JAVA2D) renderer setting, as it will improve - font rendering speed. This is not enabled by default, because it can be - misleading while testing because the type will look great on your - machine (because you have the font installed) but lousy on others' - machines if the identical font is unavailable. This option can only be - set per-sketch, and must be called before any use of textFont(). -

        - hint(DISABLE_DEPTH_TEST) - Disable the zbuffer, allowing you to draw on - top of everything at will. When depth testing is disabled, items will be - drawn to the screen sequentially, like a painting. This hint is most - often used to draw in 3D, then draw in 2D on top of it (for instance, to - draw GUI controls in 2D on top of a 3D interface). Starting in release - 0149, this will also clear the depth buffer. Restore the default with - hint(ENABLE_DEPTH_TEST), but note that with the depth buffer cleared, - any 3D drawing that happens later in draw() will ignore existing shapes - on the screen. -

        - hint(ENABLE_DEPTH_SORT) - Enable primitive z-sorting of triangles and - lines in P3D and OPENGL. This can slow performance considerably, and the - algorithm is not yet perfect. Restore the default with hint(DISABLE_DEPTH_SORT). -

        - hint(DISABLE_OPENGL_ERROR_REPORT) - Speeds up the P3D renderer setting - by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT). -

        - As of release 0149, unhint() has been removed in favor of adding - additional ENABLE/DISABLE constants to reset the default behavior. This - prevents the double negatives, and also reinforces which hints can be - enabled or disabled. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        which - name of the hint to be enabled or disabled
        -
        See Also:
        -
        PGraphics, -PApplet.createGraphics(int, int, String, String), -PApplet.size(int, int)
        -
        -
      • -
      - - - -
        -
      • -

        beginShape

        -
        public void beginShape()
        -
        Start a new shape of type POLYGON
        -
      • -
      - - - -
        -
      • -

        beginShape

        -
        public void beginShape(int kind)
        -
        ( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms. beginShape() begins recording - vertices for a shape and endShape() stops recording. The value of - the MODE parameter tells it which types of shapes to create from - the provided vertices. With no mode specified, the shape can be any - irregular polygon. The parameters available for beginShape() are POINTS, - LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, and QUAD_STRIP. - After calling the beginShape() function, a series of - vertex() commands must follow. To stop drawing the shape, call - endShape(). The vertex() function with two parameters - specifies a position in 2D and the vertex() function with three - parameters specifies a position in 3D. Each shape will be outlined with - the current stroke color and filled with the fill color. -

        - Transformations such as translate(), rotate(), and - scale() do not work within beginShape(). It is also not - possible to use other shapes, such as ellipse() or rect() - within beginShape(). -

        - The P3D renderer settings allow stroke() and fill() - settings to be altered per-vertex, however the default P2D renderer does - not. Settings such as strokeWeight(), strokeCap(), and - strokeJoin() cannot be changed while inside a - beginShape()/endShape() block with any renderer. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        kind - Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIP
        -
        See Also:
        -
        PShape, -endShape(), -vertex(float, float, float, float, float), -curveVertex(float, float, float), -bezierVertex(float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from normal.xml ) - - Sets the current normal vector. This is for drawing three dimensional - shapes and surfaces and specifies a vector perpendicular to the surface - of the shape which determines how lighting affects it. Processing - attempts to automatically assign normals to shapes, but since that's - imperfect, this is a better option when you want more control. This - function is identical to glNormal3f() in OpenGL. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        nx - x direction
        -
        ny - y direction
        -
        nz - z direction
        -
        See Also:
        -
        beginShape(int), -endShape(int), -lights()
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   float... values)
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   int... values)
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   boolean... values)
        -
      • -
      - - - -
        -
      • -

        textureMode

        -
        public void textureMode(int mode)
        -
        ( begin auto-generated from textureMode.xml ) - - Sets the coordinate space for texture mapping. There are two options, - IMAGE, which refers to the actual coordinates of the image, and - NORMAL, which refers to a normalized space of values ranging from 0 - to 1. The default mode is IMAGE. In IMAGE, if an image is 100 x 200 - pixels, mapping the image onto the entire size of a quad would require - the points (0,0) (0,100) (100,200) (0,200). The same mapping in - NORMAL_SPACE is (0,0) (0,1) (1,1) (0,1). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either IMAGE or NORMAL
        -
        See Also:
        -
        texture(PImage), -textureWrap(int)
        -
        -
      • -
      - - - -
        -
      • -

        textureWrap

        -
        public void textureWrap(int wrap)
        -
        ( begin auto-generated from textureWrap.xml ) - - Description to come... - - ( end auto-generated from textureWrap.xml )
        -
        -
        Parameters:
        -
        wrap - Either CLAMP (default) or REPEAT
        -
        See Also:
        -
        texture(PImage), -textureMode(int)
        -
        -
      • -
      - - - -
        -
      • -

        texture

        -
        public void texture(PImage image)
        -
        ( begin auto-generated from texture.xml ) - - Sets a texture to be applied to vertex points. The texture() - function must be called between beginShape() and - endShape() and before any calls to vertex(). -

        - When textures are in use, the fill color is ignored. Instead, use tint() - to specify the color of the texture as it is applied to the shape. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        image - reference to a PImage object
        -
        See Also:
        -
        textureMode(int), -textureWrap(int), -beginShape(int), -endShape(int), -vertex(float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        noTexture

        -
        public void noTexture()
        -
        Removes texture image for current shape. - Needs to be called between beginShape and endShape
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices. - vertex() is used to specify the vertex coordinates for points, - lines, triangles, quads, and polygons and is used exclusively within the - beginShape() and endShape() function.
        -
        - Drawing a vertex in 3D using the z parameter requires the P3D - parameter in combination with size as shown in the above example.
        -
        - This function is also used to map a texture onto the geometry. The - texture() function declares the texture to apply to the geometry - and the u and v coordinates set define the mapping of this - texture to the form. By default, the coordinates used for u and - v are specified in relation to the image's size in pixels, but - this relation can be changed with textureMode(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - x-coordinate of the vertex
        -
        y - y-coordinate of the vertex
        -
        z - z-coordinate of the vertex
        -
        u - horizontal coordinate for the texture mapping
        -
        v - vertical coordinate for the texture mapping
        -
        See Also:
        -
        beginShape(int), -endShape(int), -bezierVertex(float, float, float, float, float, float, float, float, float), -quadraticVertex(float, float, float, float, float, float), -curveVertex(float, float, float), -texture(PImage)
        -
        -
      • -
      - - - -
        -
      • -

        beginContour

        -
        public void beginContour()
        -
      • -
      - - - -
        -
      • -

        endContour

        -
        public void endContour()
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape()
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape(int mode)
        -
        ( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape(). When endshape() - is called, all of image data defined since the previous call to - beginShape() is written into the image buffer. The constant CLOSE - as the value for the MODE parameter to close the shape (to connect the - beginning and the end). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - use CLOSE to close the shape
        -
        See Also:
        -
        PShape, -beginShape(int)
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        createShape

        -
        public PShape createShape(int type)
        -
      • -
      - - - -
        -
      • -

        createShape

        -
        public PShape createShape(int kind,
        -                          float... p)
        -
        -
        Parameters:
        -
        kind - either POINT, LINE, TRIANGLE, QUAD, RECT, ELLIPSE, ARC, BOX, SPHERE
        -
        p - parameters that match the kind of shape
        -
        -
      • -
      - - - -
        -
      • -

        loadShader

        -
        public PShader loadShader(String fragFilename)
        -
        ( begin auto-generated from loadShader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        fragFilename - name of fragment shader file
        -
        -
      • -
      - - - -
        -
      • -

        loadShader

        -
        public PShader loadShader(String fragFilename,
        -                          String vertFilename)
        -
        -
        Parameters:
        -
        vertFilename - name of vertex shader file
        -
        -
      • -
      - - - -
        -
      • -

        shader

        -
        public void shader(PShader shader)
        -
        ( begin auto-generated from shader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        shader - name of shader file
        -
        -
      • -
      - - - -
        -
      • -

        shader

        -
        public void shader(PShader shader,
        -                   int kind)
        -
        -
        Parameters:
        -
        kind - type of shader, either POINTS, LINES, or TRIANGLES
        -
        -
      • -
      - - - -
        -
      • -

        resetShader

        -
        public void resetShader()
        -
        ( begin auto-generated from resetShader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        resetShader

        -
        public void resetShader(int kind)
        -
        -
        Parameters:
        -
        kind - type of shader, either POINTS, LINES, or TRIANGLES
        -
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(PShader shader)
        -
        -
        Parameters:
        -
        shader - the fragment shader to apply
        -
        -
      • -
      - - - -
        -
      • -

        clip

        -
        public void clip(float a,
        -                 float b,
        -                 float c,
        -                 float d)
        -
      • -
      - - - -
        -
      • -

        noClip

        -
        public void noClip()
        -
      • -
      - - - -
        -
      • -

        blendMode

        -
        public void blendMode(int mode)
        -
        ( begin auto-generated from blendMode.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - the blending mode to use
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves. Each call to - bezierVertex() defines the position of two control points and one - anchor point of a Bezier curve, adding a new segment to a line or shape. - The first time bezierVertex() is used within a - beginShape() call, it must be prefaced with a call to - vertex() to set the first anchor point. This function must be - used between beginShape() and endShape() and only when - there is no MODE parameter specified to beginShape(). Using the - 3D version requires rendering with P3D (see the Environment reference - for more information). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x2 - the x-coordinate of the 1st control point
        -
        y2 - the y-coordinate of the 1st control point
        -
        z2 - the z-coordinate of the 1st control point
        -
        x3 - the x-coordinate of the 2nd control point
        -
        y3 - the y-coordinate of the 2nd control point
        -
        z3 - the z-coordinate of the 2nd control point
        -
        x4 - the x-coordinate of the anchor point
        -
        y4 - the y-coordinate of the anchor point
        -
        z4 - the z-coordinate of the anchor point
        -
        See Also:
        -
        curveVertex(float, float, float), -vertex(float, float, float, float, float), -quadraticVertex(float, float, float, float, float, float), -bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float cx,
        -                            float cy,
        -                            float cz,
        -                            float x3,
        -                            float y3,
        -                            float z3)
        -
        -
        Parameters:
        -
        cz - the z-coordinate of the control point
        -
        z3 - the z-coordinate of the anchor point
        -
        -
      • -
      - - - - - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
        -
        Parameters:
        -
        z - the z-coordinate of the vertex
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y)
        -
        ( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel. The - first parameter is the horizontal value for the point, the second value - is the vertical value for the point, and the optional third value is the - depth value. Drawing this shape in 3D with the z parameter - requires the P3D parameter in combination with size() as shown in - the above example. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - x-coordinate of the point
        -
        y - y-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y,
        -                  float z)
        -
        -
        Parameters:
        -
        z - z-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2)
        -
        ( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen. The - version of line() with four parameters draws the line in 2D. To - color a line, use the stroke() function. A line cannot be filled, - therefore the fill() function will not affect the color of a - line. 2D lines are drawn with a width of one pixel by default, but this - can be changed with the strokeWeight() function. The version with - six parameters allows the line to be placed anywhere within XYZ space. - Drawing this shape in 3D with the z parameter requires the P3D - parameter in combination with size() as shown in the above example. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        See Also:
        -
        strokeWeight(float), -strokeJoin(int), -strokeCap(int), -beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float z1,
        -                 float x2,
        -                 float y2,
        -                 float z2)
        -
        -
        Parameters:
        -
        z1 - z-coordinate of the first point
        -
        z2 - z-coordinate of the second point
        -
        -
      • -
      - - - -
        -
      • -

        triangle

        -
        public void triangle(float x1,
        -                     float y1,
        -                     float x2,
        -                     float y2,
        -                     float x3,
        -                     float y3)
        -
        ( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points. The first two - arguments specify the first point, the middle two arguments specify the - second point, and the last two arguments specify the third point. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        x3 - x-coordinate of the third point
        -
        y3 - y-coordinate of the third point
        -
        See Also:
        -
        PApplet.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        quad

        -
        public void quad(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2,
        -                 float x3,
        -                 float y3,
        -                 float x4,
        -                 float y4)
        -
        ( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon. It is similar to a - rectangle, but the angles between its edges are not constrained to - ninety degrees. The first pair of parameters (x1,y1) sets the first - vertex and the subsequent pairs should proceed clockwise or - counter-clockwise around the defined shape. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the first corner
        -
        y1 - y-coordinate of the first corner
        -
        x2 - x-coordinate of the second corner
        -
        y2 - y-coordinate of the second corner
        -
        x3 - x-coordinate of the third corner
        -
        y3 - y-coordinate of the third corner
        -
        x4 - x-coordinate of the fourth corner
        -
        y4 - y-coordinate of the fourth corner
        -
        -
      • -
      - - - -
        -
      • -

        rectMode

        -
        public void rectMode(int mode)
        -
        ( begin auto-generated from rectMode.xml ) - - Modifies the location from which rectangles draw. The default mode is - rectMode(CORNER), which specifies the location to be the upper - left corner of the shape and uses the third and fourth parameters of - rect() to specify the width and height. The syntax - rectMode(CORNERS) uses the first and second parameters of - rect() to set the location of one corner and uses the third and - fourth parameters to set the opposite corner. The syntax - rectMode(CENTER) draws the image from its center point and uses - the third and forth parameters of rect() to specify the image's - width and height. The syntax rectMode(RADIUS) draws the image - from its center point and uses the third and forth parameters of - rect() to specify half of the image's width and height. The - parameter must be written in ALL CAPS because Processing is a case - sensitive language. Note: In version 125, the mode named CENTER_RADIUS - was shortened to RADIUS. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CORNER, CORNERS, CENTER, or RADIUS
        -
        See Also:
        -
        rect(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rect

        -
        public void rect(float a,
        -                 float b,
        -                 float c,
        -                 float d)
        -
        ( begin auto-generated from rect.xml ) - - Draws a rectangle to the screen. A rectangle is a four-sided shape with - every angle at ninety degrees. By default, the first two parameters set - the location of the upper-left corner, the third sets the width, and the - fourth sets the height. These parameters may be changed with the - rectMode() function. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - x-coordinate of the rectangle by default
        -
        b - y-coordinate of the rectangle by default
        -
        c - width of the rectangle by default
        -
        d - height of the rectangle by default
        -
        See Also:
        -
        rectMode(int), -quad(float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rect

        -
        public void rect(float a,
        -                 float b,
        -                 float c,
        -                 float d,
        -                 float r)
        -
        -
        Parameters:
        -
        r - radii for all four corners
        -
        -
      • -
      - - - -
        -
      • -

        rect

        -
        public void rect(float a,
        -                 float b,
        -                 float c,
        -                 float d,
        -                 float tl,
        -                 float tr,
        -                 float br,
        -                 float bl)
        -
        -
        Parameters:
        -
        tl - radius for top-left corner
        -
        tr - radius for top-right corner
        -
        br - radius for bottom-right corner
        -
        bl - radius for bottom-left corner
        -
        -
      • -
      - - - -
        -
      • -

        ellipseMode

        -
        public void ellipseMode(int mode)
        -
        ( begin auto-generated from ellipseMode.xml ) - - The origin of the ellipse is modified by the ellipseMode() - function. The default configuration is ellipseMode(CENTER), which - specifies the location of the ellipse as the center of the shape. The - RADIUS mode is the same, but the width and height parameters to - ellipse() specify the radius of the ellipse, rather than the - diameter. The CORNER mode draws the shape from the upper-left - corner of its bounding box. The CORNERS mode uses the four - parameters to ellipse() to set two opposing corners of the - ellipse's bounding box. The parameter must be written in ALL CAPS - because Processing is a case-sensitive language. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CENTER, RADIUS, CORNER, or CORNERS
        -
        See Also:
        -
        PApplet.ellipse(float, float, float, float), -PApplet.arc(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        ellipse

        -
        public void ellipse(float a,
        -                    float b,
        -                    float c,
        -                    float d)
        -
        ( begin auto-generated from ellipse.xml ) - - Draws an ellipse (oval) in the display window. An ellipse with an equal - width and height is a circle. The first two parameters set - the location, the third sets the width, and the fourth sets the height. - The origin may be changed with the ellipseMode() function. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - x-coordinate of the ellipse
        -
        b - y-coordinate of the ellipse
        -
        c - width of the ellipse by default
        -
        d - height of the ellipse by default
        -
        See Also:
        -
        PApplet.ellipseMode(int), -PApplet.arc(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        arc

        -
        public void arc(float a,
        -                float b,
        -                float c,
        -                float d,
        -                float start,
        -                float stop)
        -
        ( begin auto-generated from arc.xml ) - - Draws an arc in the display window. Arcs are drawn along the outer edge - of an ellipse defined by the x, y, width and - height parameters. The origin or the arc's ellipse may be changed - with the ellipseMode() function. The start and stop - parameters specify the angles at which to draw the arc. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - x-coordinate of the arc's ellipse
        -
        b - y-coordinate of the arc's ellipse
        -
        c - width of the arc's ellipse by default
        -
        d - height of the arc's ellipse by default
        -
        start - angle to start the arc, specified in radians
        -
        stop - angle to stop the arc, specified in radians
        -
        See Also:
        -
        PApplet.ellipse(float, float, float, float), -PApplet.ellipseMode(int), -PApplet.radians(float), -PApplet.degrees(float)
        -
        -
      • -
      - - - -
        -
      • -

        arc

        -
        public void arc(float a,
        -                float b,
        -                float c,
        -                float d,
        -                float start,
        -                float stop,
        -                int mode)
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float size)
        -
        ( begin auto-generated from box.xml ) - - A box is an extruded rectangle. A box with equal dimension on all sides - is a cube. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        size - dimension of the box in all dimensions (creates a cube)
        -
        See Also:
        -
        sphere(float)
        -
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float w,
        -                float h,
        -                float d)
        -
        -
        Parameters:
        -
        w - dimension of the box in the x-dimension
        -
        h - dimension of the box in the y-dimension
        -
        d - dimension of the box in the z-dimension
        -
        -
      • -
      - - - -
        -
      • -

        sphereDetail

        -
        public void sphereDetail(int res)
        -
        ( begin auto-generated from sphereDetail.xml ) - - Controls the detail used to render a sphere by adjusting the number of - vertices of the sphere mesh. The default resolution is 30, which creates - a fairly detailed sphere definition with vertices every 360/30 = 12 - degrees. If you're going to render a great number of spheres per frame, - it is advised to reduce the level of detail using this function. The - setting stays active until sphereDetail() is called again with a - new parameter and so should not be called prior to every - sphere() statement, unless you wish to render spheres with - different settings, e.g. using less detail for smaller spheres or ones - further away from the camera. To control the detail of the horizontal - and vertical resolution independently, use the version of the functions - with two parameters. - - ( end auto-generated ) - -

        Advanced

        - Code for sphereDetail() submitted by toxi [031031]. - Code for enhanced u/v version from davbol [080801].
        -
        -
        Parameters:
        -
        res - number of segments (minimum 3) used per full circle revolution
        -
        See Also:
        -
        sphere(float)
        -
        -
      • -
      - - - -
        -
      • -

        sphereDetail

        -
        public void sphereDetail(int ures,
        -                         int vres)
        -
        -
        Parameters:
        -
        ures - number of segments used longitudinally per full circle revolutoin
        -
        vres - number of segments used latitudinally from top to bottom
        -
        -
      • -
      - - - -
        -
      • -

        sphere

        -
        public void sphere(float r)
        -
        ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles. - - ( end auto-generated ) - -

        Advanced

        -

        - 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
        - 
        -
        -
        Parameters:
        -
        r - the radius of the sphere
        -
        See Also:
        -
        sphereDetail(int)
        -
        -
      • -
      - - - -
        -
      • -

        bezierPoint

        -
        public float bezierPoint(float a,
        -                         float b,
        -                         float c,
        -                         float d,
        -                         float t)
        -
        ( begin auto-generated from bezierPoint.xml ) - - Evaluates the Bezier at point t for points a, b, c, d. The parameter t - varies between 0 and 1, a and d are points on the curve, and 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. - - ( end auto-generated ) - -

        Advanced

        - 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();
        -
        -
        Parameters:
        -
        a - coordinate of first point on the curve
        -
        b - coordinate of first control point
        -
        c - coordinate of second control point
        -
        d - coordinate of second point on the curve
        -
        t - value between 0 and 1
        -
        See Also:
        -
        bezier(float, float, float, float, float, float, float, float, float, float, float, float), -bezierVertex(float, float, float, float, float, float), -curvePoint(float, float, float, float, float)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from bezier.xml ) - - Draws a Bezier curve on the screen. These curves are defined by a series - of anchor and control points. The first two parameters specify the first - anchor point and the last two parameters specify the other anchor point. - The middle parameters specify the control points which define the shape - of the curve. Bezier curves were developed by French engineer Pierre - Bezier. Using the 3D version requires rendering with P3D (see the - Environment reference for more information). - - ( end auto-generated ) - -

        Advanced

        - 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);
        -
        -
        Parameters:
        -
        x1 - coordinates for the first anchor point
        -
        y1 - coordinates for the first anchor point
        -
        z1 - coordinates for the first anchor point
        -
        x2 - coordinates for the first control point
        -
        y2 - coordinates for the first control point
        -
        z2 - coordinates for the first control point
        -
        x3 - coordinates for the second control point
        -
        y3 - coordinates for the second control point
        -
        z3 - coordinates for the second control point
        -
        x4 - coordinates for the second anchor point
        -
        y4 - coordinates for the second anchor point
        -
        z4 - coordinates for the second anchor point
        -
        See Also:
        -
        bezierVertex(float, float, float, float, float, float), -curve(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        curvePoint

        -
        public float curvePoint(float a,
        -                        float b,
        -                        float c,
        -                        float d,
        -                        float t)
        -
        ( begin auto-generated from curvePoint.xml ) - - Evalutes the curve at point t for points a, b, c, d. The parameter t - varies between 0 and 1, a and d are points on the curve, and 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 curve at t. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - coordinate of first point on the curve
        -
        b - coordinate of second point on the curve
        -
        c - coordinate of third point on the curve
        -
        d - coordinate of fourth point on the curve
        -
        t - value between 0 and 1
        -
        See Also:
        -
        curve(float, float, float, float, float, float, float, float, float, float, float, float), -curveVertex(float, float), -bezierPoint(float, float, float, float, float)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        curveTightness

        -
        public void curveTightness(float tightness)
        -
        ( begin auto-generated from curveTightness.xml ) - - Modifies the quality of forms created with curve() and - curveVertex(). The parameter squishy determines how the - curve fits to the vertex points. The value 0.0 is the default value for - squishy (this value defines the curves to be Catmull-Rom splines) - and the value 1.0 connects all the points with straight lines. Values - within the range -5.0 and 5.0 will deform the curves but will leave them - recognizable and as values increase in magnitude, they will continue to deform. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        tightness - amount of deformation from the original vertices
        -
        See Also:
        -
        curve(float, float, float, float, float, float, float, float, float, float, float, float), -curveVertex(float, float)
        -
        -
      • -
      - - - -
        -
      • -

        curve

        -
        public void curve(float x1,
        -                  float y1,
        -                  float x2,
        -                  float y2,
        -                  float x3,
        -                  float y3,
        -                  float x4,
        -                  float y4)
        -
        ( begin auto-generated from curve.xml ) - - Draws a curved line on the screen. The first and second parameters - specify the beginning control point and the last two parameters specify - the ending control point. The middle parameters specify the start and - stop of the curve. Longer curves can be created by putting a series of - curve() functions together or using curveVertex(). An - additional function called curveTightness() provides control for - the visual quality of the curve. The curve() function is an - implementation of Catmull-Rom splines. Using the 3D version requires - rendering with P3D (see the Environment reference for more information). - - ( end auto-generated ) - -

        Advanced

        - As of revision 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();
        - 
        -
        -
        Parameters:
        -
        x1 - coordinates for the beginning control point
        -
        y1 - coordinates for the beginning control point
        -
        x2 - coordinates for the first point
        -
        y2 - coordinates for the first point
        -
        x3 - coordinates for the second point
        -
        y3 - coordinates for the second point
        -
        x4 - coordinates for the ending control point
        -
        y4 - coordinates for the ending control point
        -
        See Also:
        -
        curveVertex(float, float), -curveTightness(float), -bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Parameters:
        -
        z1 - coordinates for the beginning control point
        -
        z2 - coordinates for the first point
        -
        z3 - coordinates for the second point
        -
        z4 - coordinates for the ending control point
        -
        -
      • -
      - - - -
        -
      • -

        smooth

        -
        public void smooth()
        -
      • -
      - - - -
        -
      • -

        smooth

        -
        public void smooth(int quality)
        -
      • -
      - - - -
        -
      • -

        noSmooth

        -
        public void noSmooth()
        -
      • -
      - - - -
        -
      • -

        imageMode

        -
        public void imageMode(int mode)
        -
        ( begin auto-generated from imageMode.xml ) - - Modifies the location from which images draw. The default mode is - imageMode(CORNER), which specifies the location to be the upper - left corner and uses the fourth and fifth parameters of image() - to set the image's width and height. The syntax - imageMode(CORNERS) uses the second and third parameters of - image() to set the location of one corner of the image and uses - the fourth and fifth parameters to set the opposite corner. Use - imageMode(CENTER) to draw images centered at the given x and y - position.
        -
        - The parameter to imageMode() must be written in ALL CAPS because - Processing is a case-sensitive language. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CORNER, CORNERS, or CENTER
        -
        See Also:
        -
        PApplet.loadImage(String, String), -PImage, -image(PImage, float, float, float, float), -background(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        image

        -
        public void image(PImage img,
        -                  float a,
        -                  float b)
        -
        ( begin auto-generated from image.xml ) - - Displays images to the screen. The images must be in the sketch's "data" - directory to load correctly. Select "Add file..." from the "Sketch" menu - to add the image. Processing currently works with GIF, JPEG, and Targa - images. The img parameter specifies the image to display and the - x and y parameters define the location of the image from - its upper-left corner. The image is displayed at its original size - unless the width and height parameters specify a different - size.
        -
        - The imageMode() function changes the way the parameters work. For - example, a call to imageMode(CORNERS) will change the - width and height parameters to define the x and y values - of the opposite corner of the image.
        -
        - The color of an image may be modified with the tint() function. - This function will maintain transparency for GIF and PNG images. - - ( end auto-generated ) - -

        Advanced

        - Starting with release 0124, when using the default (JAVA2D) renderer, - smooth() will also improve image quality of resized images.
        -
        -
        Parameters:
        -
        img - the image to display
        -
        a - x-coordinate of the image
        -
        b - y-coordinate of the image
        -
        See Also:
        -
        PApplet.loadImage(String, String), -PImage, -imageMode(int), -tint(float), -background(float, float, float, float), -alpha(int)
        -
        -
      • -
      - - - -
        -
      • -

        image

        -
        public void image(PImage img,
        -                  float a,
        -                  float b,
        -                  float c,
        -                  float d)
        -
        -
        Parameters:
        -
        c - width to display the image
        -
        d - height to display the image
        -
        -
      • -
      - - - -
        -
      • -

        image

        -
        public void image(PImage img,
        -                  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)
        -
        ( begin auto-generated from shapeMode.xml ) - - Modifies the location from which shapes draw. The default mode is - shapeMode(CORNER), which specifies the location to be the upper - left corner of the shape and uses the third and fourth parameters of - shape() to specify the width and height. The syntax - shapeMode(CORNERS) uses the first and second parameters of - shape() to set the location of one corner and uses the third and - fourth parameters to set the opposite corner. The syntax - shapeMode(CENTER) draws the shape from its center point and uses - the third and forth parameters of shape() to specify the width - and height. The parameter must be written in "ALL CAPS" because - Processing is a case sensitive language. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CORNER, CORNERS, CENTER
        -
        See Also:
        -
        PShape, -shape(PShape), -rectMode(int)
        -
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape)
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float x,
        -                  float y)
        -
        ( begin auto-generated from shape.xml ) - - Displays shapes to the screen. The shapes must be in the sketch's "data" - directory to load correctly. Select "Add file..." from the "Sketch" menu - to add the shape. Processing currently works with SVG shapes only. The - sh parameter specifies the shape to display and the x and - y parameters define the location of the shape from its upper-left - corner. The shape is displayed at its original size unless the - width and height parameters specify a different size. The - shapeMode() function changes the way the parameters work. A call - to shapeMode(CORNERS), for example, will change the width and - height parameters to define the x and y values of the opposite corner of - the shape. -

        - Note complex shapes may draw awkwardly with P3D. This renderer does not - yet support shapes that have holes or complicated breaks. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        shape - the shape to display
        -
        x - x-coordinate of the shape
        -
        y - y-coordinate of the shape
        -
        See Also:
        -
        PShape, -PApplet.loadShape(String), -Convenience method to draw at a particular location.
        -
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float a,
        -                  float b,
        -                  float c,
        -                  float d)
        -
        -
        Parameters:
        -
        a - x-coordinate of the shape
        -
        b - y-coordinate of the shape
        -
        c - width to display the shape
        -
        d - height to display the shape
        -
        -
      • -
      - - - -
        -
      • -

        textAlign

        -
        public void textAlign(int alignX)
        -
      • -
      - - - -
        -
      • -

        textAlign

        -
        public void textAlign(int alignX,
        -                      int alignY)
        -
        ( begin auto-generated from textAlign.xml ) - - Sets the current alignment for drawing text. The parameters LEFT, - CENTER, and RIGHT set the display characteristics of the letters in - relation to the values for the x and y parameters of the - text() function. -

        - In Processing 0125 and later, an optional second parameter can be used - to vertically align the text. BASELINE is the default, and the vertical - alignment will be reset to BASELINE if the second parameter is not used. - The TOP and CENTER parameters are straightforward. The BOTTOM parameter - offsets the line based on the current textDescent(). For multiple - lines, the final line will be aligned to the bottom, with the previous - lines appearing above it. -

        - When using text() with width and height parameters, BASELINE is - ignored, and treated as TOP. (Otherwise, text would by default draw - outside the box, since BASELINE is the default setting. BASELINE is not - a useful drawing mode for text drawn in a rectangle.) -

        - The vertical alignment is based on the value of textAscent(), - which many fonts do not specify correctly. It may be necessary to use a - hack and offset by a few pixels by hand so that the offset looks - correct. To do this as less of a hack, use some percentage of - textAscent() or textDescent() so that the hack works even - if you change the size of the font. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        alignX - horizontal alignment, either LEFT, CENTER, or RIGHT
        -
        alignY - vertical alignment, either TOP, BOTTOM, CENTER, or BASELINE
        -
        See Also:
        -
        PApplet.loadFont(String), -PFont, -text(String, float, float), -textSize(float), -textAscent(), -textDescent()
        -
        -
      • -
      - - - -
        -
      • -

        textAscent

        -
        public float textAscent()
        -
        ( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size. This information - is useful for determining the height of the font above the baseline. For - example, adding the textAscent() and textDescent() values - will give you the total height of the line. - - ( end auto-generated )
        -
        -
        See Also:
        -
        textDescent()
        -
        -
      • -
      - - - -
        -
      • -

        textDescent

        -
        public float textDescent()
        -
        ( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size. This - information is useful for determining the height of the font below the - baseline. For example, adding the textAscent() and - textDescent() values will give you the total height of the line. - - ( end auto-generated )
        -
        -
        See Also:
        -
        textAscent()
        -
        -
      • -
      - - - -
        -
      • -

        textFont

        -
        public void textFont(PFont which)
        -
        ( begin auto-generated from textFont.xml ) - - Sets the current font that will be drawn with the text() - function. Fonts must be loaded with loadFont() before it can be - used. This font will be used in all subsequent calls to the - text() function. If no size parameter is input, the font - will appear at its original size (the size it was created at with the - "Create Font..." tool) until it is changed with textSize().

        Because fonts are usually bitmaped, you should create fonts at - the sizes that will be used most commonly. Using textFont() - without the size parameter will result in the cleanest-looking text.

        With the default (JAVA2D) and PDF renderers, it's also possible - to enable the use of native fonts via the command - hint(ENABLE_NATIVE_FONTS). This will produce vector text in - JAVA2D sketches and PDF output in cases where the vector data is - available: when the font is still installed, or the font is created via - the createFont() function (rather than the Create Font tool). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        which - any variable of the type PFont
        -
        See Also:
        -
        PApplet.createFont(String, float, boolean), -PApplet.loadFont(String), -PFont, -text(String, float, float), -textSize(float)
        -
        -
      • -
      - - - -
        -
      • -

        textFont

        -
        public void textFont(PFont which,
        -                     float size)
        -
        -
        Parameters:
        -
        size - the size of the letters in units of pixels
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textMode

        -
        public void textMode(int mode)
        -
        ( begin auto-generated from textMode.xml ) - - Sets the way text draws to the screen. In the default configuration, the - MODEL mode, it's possible to rotate, scale, and place letters in - two and three dimensional space.
        -
        - The SHAPE mode draws text using the the glyph outlines of - individual characters rather than as textures. This mode is only - supported with the PDF and P3D renderer settings. With the - PDF renderer, you must call textMode(SHAPE) before any - other drawing occurs. If the outlines are not available, then - textMode(SHAPE) will be ignored and textMode(MODEL) will - be used instead.
        -
        - The textMode(SHAPE) option in P3D can be combined with - beginRaw() to write vector-accurate text to 2D and 3D output - files, for instance DXF or PDF. The SHAPE mode is - not currently optimized for P3D, so if recording shape data, use - textMode(MODEL) until you're ready to capture the geometry with beginRaw(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either MODEL or SHAPE
        -
        See Also:
        -
        PApplet.loadFont(String), -PFont.PFont(java.io.InputStream), -text(String, float, float), -textFont(PFont), -beginRaw(PGraphics), -PApplet.createFont(String, float, boolean)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textWidth

        -
        public float textWidth(char c)
        -
        -
        Parameters:
        -
        c - the character to measure
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textWidth

        -
        public float textWidth(char[] chars,
        -                       int start,
        -                       int length)
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(char c,
        -                 float x,
        -                 float y)
        -
        ( begin auto-generated from text.xml ) - - Draws text to the screen. Displays the information specified in the - data or stringdata parameters on the screen in the - position specified by the x and y parameters and the - optional z parameter. A default font will be used unless a font - is set with the textFont() function. Change the color of the text - with the fill() function. The text displays in relation to the - textAlign() function, which gives the option to draw to the left, - right, and center of the coordinates. -

        - The x2 and y2 parameters define a rectangular area to - display within and may only be used with string data. For text drawn - inside a rectangle, the coordinates are interpreted based on the current - rectMode() setting. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        c - the alphanumeric character to be displayed
        -
        x - x-coordinate of text
        -
        y - y-coordinate of text
        -
        See Also:
        -
        textAlign(int, int), -textFont(PFont), -textMode(int), -textSize(float), -textLeading(float), -textWidth(String), -textAscent(), -textDescent(), -rectMode(int), -fill(int, float)
        -
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(char c,
        -                 float x,
        -                 float y,
        -                 float z)
        -
        -
        Parameters:
        -
        z - z-coordinate of text
        -
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(String str,
        -                 float x,
        -                 float y)
        -

        Advanced

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

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        chars - the alphanumberic symbols to be displayed
        -
        start - array index at which to start writing characters
        -
        stop - array index at which to stop writing characters
        -
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(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(String str,
        -                 float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2)
        -

        Advanced

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

        -
        -
        Parameters:
        -
        x1 - by default, the x-coordinate of text, see rectMode() for more info
        -
        y1 - by default, the x-coordinate of text, see rectMode() for more info
        -
        x2 - by default, the width of the text box, see rectMode() for more info
        -
        y2 - by default, the height of the text box, see rectMode() for more info
        -
        -
      • -
      - - - -
        -
      • -

        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.
        -
        -
        Parameters:
        -
        num - the numeric value to be displayed
        -
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(float num,
        -                 float x,
        -                 float y,
        -                 float z)
        -
      • -
      - - - -
        -
      • -

        getFontMetrics

        -
        public FontMetrics getFontMetrics(Font font)
        -
        Convenience method to get a legit FontMetrics object. Where possible, - override this any renderer subclass so that you're not using what's - returned by getDefaultToolkit() to get your metrics.
        -
      • -
      - - - -
        -
      • -

        getFontRenderContext

        -
        public FontRenderContext getFontRenderContext(Font font)
        -
        Convenience method to jump through some Java2D hoops and get an FRC.
        -
      • -
      - - - -
        -
      • -

        pushMatrix

        -
        public void pushMatrix()
        -
        ( begin auto-generated from pushMatrix.xml ) - - Pushes the current transformation matrix onto the matrix stack. - Understanding pushMatrix() and popMatrix() requires - understanding the concept of a matrix stack. The pushMatrix() - function saves the current coordinate system to the stack and - popMatrix() restores the prior coordinate system. - pushMatrix() and popMatrix() are used in conjuction with - the other transformation functions and may be embedded to control the - scope of the transformations. - - ( end auto-generated )
        -
        -
        See Also:
        -
        popMatrix(), -translate(float, float, float), -scale(float), -rotate(float), -rotateX(float), -rotateY(float), -rotateZ(float)
        -
        -
      • -
      - - - -
        -
      • -

        popMatrix

        -
        public void popMatrix()
        -
        ( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack. - Understanding pushing and popping requires understanding the concept of - a matrix stack. The pushMatrix() function saves the current - coordinate system to the stack and popMatrix() restores the prior - coordinate system. pushMatrix() and popMatrix() are used - in conjuction with the other transformation functions and may be - embedded to control the scope of the transformations. - - ( end auto-generated )
        -
        -
        See Also:
        -
        pushMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float x,
        -                      float y)
        -
        ( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window. The - x parameter specifies left/right translation, the y - parameter specifies up/down translation, and the z parameter - specifies translations toward/away from the screen. Using this function - with the z parameter requires using P3D as a parameter in - combination with size as shown in the above example. Transformations - apply to everything that happens after and subsequent calls to the - function accumulates the effect. For example, calling translate(50, - 0) and then translate(20, 0) is the same as translate(70, - 0). If translate() is called within draw(), the - transformation is reset when the loop begins again. This function can be - further controlled by the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - left/right translation
        -
        y - up/down translation
        -
        See Also:
        -
        popMatrix(), -pushMatrix(), -rotate(float), -rotateX(float), -rotateY(float), -rotateZ(float), -scale(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float x,
        -                      float y,
        -                      float z)
        -
        -
        Parameters:
        -
        z - forward/backward translation
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle)
        -
        ( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter. - Angles should be specified in radians (values from 0 to TWO_PI) or - converted to radians with the radians() function. -

        - Objects are always rotated around their relative position to the origin - and positive numbers rotate objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - rotate(HALF_PI) and then rotate(HALF_PI) is the same as - rotate(PI). All tranformations are reset when draw() - begins again. -

        - Technically, rotate() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        popMatrix(), -pushMatrix(), -rotateX(float), -rotateY(float), -rotateZ(float), -scale(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateX(PI/2) and then rotateX(PI/2) is the same - as rotateX(PI). If rotateX() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the example above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        popMatrix(), -pushMatrix(), -rotate(float), -rotateY(float), -rotateZ(float), -scale(float, float, float), -translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateY(PI/2) and then rotateY(PI/2) is the same - as rotateY(PI). If rotateY() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        popMatrix(), -pushMatrix(), -rotate(float), -rotateX(float), -rotateZ(float), -scale(float, float, float), -translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateZ(PI/2) and then rotateZ(PI/2) is the same - as rotateZ(PI). If rotateZ() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        popMatrix(), -pushMatrix(), -rotate(float), -rotateX(float), -rotateY(float), -scale(float, float, float), -translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle,
        -                   float x,
        -                   float y,
        -                   float z)
        -

        Advanced

        - Rotate about a vector in space. Same as the glRotatef() function.
        -
        -
        Parameters:
        -
        x -
        -
        y -
        -
        z -
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float s)
        -
        ( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices. Objects always scale from their relative origin to the - coordinate system. Scale values are specified as decimal percentages. - For example, the function call scale(2.0) increases the dimension - of a shape by 200%. Transformations apply to everything that happens - after and subsequent calls to the function multiply the effect. For - example, calling scale(2.0) and then scale(1.5) is the - same as scale(3.0). If scale() is called within - draw(), the transformation is reset when the loop begins again. - Using this fuction with the z parameter requires using P3D as a - parameter for size() as shown in the example above. This function - can be further controlled by pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        s - percentage to scale the object
        -
        See Also:
        -
        pushMatrix(), -popMatrix(), -translate(float, float, float), -rotate(float), -rotateX(float), -rotateY(float), -rotateZ(float)
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y)
        -

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        x - percentage to scale the object in the x-axis
        -
        y - percentage to scale the object in the y-axis
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y,
        -                  float z)
        -
        -
        Parameters:
        -
        z - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - -
        -
      • -

        shearX

        -
        public void shearX(float angle)
        -
        ( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearX(PI/2) and then shearX(PI/2) is the same as - shearX(PI). If shearX() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearX() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        popMatrix(), -pushMatrix(), -shearY(float), -scale(float, float, float), -translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        public void shearY(float angle)
        -
        ( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearY(PI/2) and then shearY(PI/2) is the same as - shearY(PI). If shearY() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearY() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        popMatrix(), -pushMatrix(), -shearX(float), -scale(float, float, float), -translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        resetMatrix

        -
        public void resetMatrix()
        -
        ( begin auto-generated from resetMatrix.xml ) - - Replaces the current matrix with the identity matrix. The equivalent - function in OpenGL is glLoadIdentity(). - - ( end auto-generated )
        -
        -
        See Also:
        -
        pushMatrix(), -popMatrix(), -applyMatrix(PMatrix), -printMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(PMatrix source)
        -
        ( begin auto-generated from applyMatrix.xml ) - - Multiplies the current matrix by the one specified through the - parameters. This is very slow because it will try to calculate the - inverse of the transform, so avoid it whenever possible. The equivalent - function in OpenGL is glMultMatrix(). - - ( end auto-generated )
        -
        -
        See Also:
        -
        pushMatrix(), -popMatrix(), -resetMatrix(), -printMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(PMatrix2D source)
        -
      • -
      - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(float n00,
        -                        float n01,
        -                        float n02,
        -                        float n10,
        -                        float n11,
        -                        float n12)
        -
        -
        Parameters:
        -
        n00 - numbers which define the 4x4 matrix to be multiplied
        -
        n01 - numbers which define the 4x4 matrix to be multiplied
        -
        n02 - numbers which define the 4x4 matrix to be multiplied
        -
        n10 - numbers which define the 4x4 matrix to be multiplied
        -
        n11 - numbers which define the 4x4 matrix to be multiplied
        -
        n12 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Parameters:
        -
        n03 - numbers which define the 4x4 matrix to be multiplied
        -
        n13 - numbers which define the 4x4 matrix to be multiplied
        -
        n20 - numbers which define the 4x4 matrix to be multiplied
        -
        n21 - numbers which define the 4x4 matrix to be multiplied
        -
        n22 - numbers which define the 4x4 matrix to be multiplied
        -
        n23 - numbers which define the 4x4 matrix to be multiplied
        -
        n30 - numbers which define the 4x4 matrix to be multiplied
        -
        n31 - numbers which define the 4x4 matrix to be multiplied
        -
        n32 - numbers which define the 4x4 matrix to be multiplied
        -
        n33 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - -
        -
      • -

        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()
        -
        ( begin auto-generated from printMatrix.xml ) - - Prints the current matrix to the Console (the text window at the bottom - of Processing). - - ( end auto-generated )
        -
        -
        See Also:
        -
        pushMatrix(), -popMatrix(), -resetMatrix(), -applyMatrix(PMatrix)
        -
        -
      • -
      - - - -
        -
      • -

        beginCamera

        -
        public void beginCamera()
        -
        ( begin auto-generated from beginCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space. The functions are useful if - you want to more control over camera movement, however for most users, - the camera() function will be sufficient.

        The camera - functions will replace any transformations (such as rotate() or - translate()) that occur before them in draw(), but they - will not automatically replace the camera transform itself. For this - reason, camera functions should be placed at the beginning of - draw() (so that transformations happen afterwards), and the - camera() function can be used after beginCamera() if you - want to reset the camera before applying transformations.

        This function sets the matrix mode to the camera matrix so calls such - as translate(), rotate(), applyMatrix() and resetMatrix() - affect the camera. beginCamera() should always be used with a - following endCamera() and pairs of beginCamera() and - endCamera() cannot be nested. - - ( end auto-generated )
        -
        -
        See Also:
        -
        camera(), -endCamera(), -applyMatrix(PMatrix), -resetMatrix(), -translate(float, float, float), -scale(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        endCamera

        -
        public void endCamera()
        -
        ( begin auto-generated from endCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space. Please see the reference for - beginCamera() for a description of how the functions are used. - - ( end auto-generated )
        -
        -
        See Also:
        -
        camera(float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        camera

        -
        public void camera()
        -
        ( begin auto-generated from camera.xml ) - - Sets the position of the camera through setting the eye position, the - center of the scene, and which axis is facing upward. Moving the eye - position and the direction it is pointing (the center of the scene) - allows the images to be seen from different angles. The version without - any parameters sets the camera to the default position, pointing to the - center of the display window with the Y axis as up. The default values - are camera(width/2.0, height/2.0, (height/2.0) / tan(PI*30.0 / - 180.0), width/2.0, height/2.0, 0, 0, 1, 0). This function is similar - to gluLookAt() in OpenGL, but it first clears the current camera settings. - - ( end auto-generated )
        -
        -
        See Also:
        -
        endCamera(), -frustum(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        camera

        -
        public void camera(float eyeX,
        -                   float eyeY,
        -                   float eyeZ,
        -                   float centerX,
        -                   float centerY,
        -                   float centerZ,
        -                   float upX,
        -                   float upY,
        -                   float upZ)
        -
        -
        Parameters:
        -
        eyeX - x-coordinate for the eye
        -
        eyeY - y-coordinate for the eye
        -
        eyeZ - z-coordinate for the eye
        -
        centerX - x-coordinate for the center of the scene
        -
        centerY - y-coordinate for the center of the scene
        -
        centerZ - z-coordinate for the center of the scene
        -
        upX - usually 0.0, 1.0, or -1.0
        -
        upY - usually 0.0, 1.0, or -1.0
        -
        upZ - usually 0.0, 1.0, or -1.0
        -
        -
      • -
      - - - - - - - -
        -
      • -

        ortho

        -
        public void ortho()
        -
        ( begin auto-generated from ortho.xml ) - - Sets an orthographic projection and defines a parallel clipping volume. - All objects with the same dimension appear the same size, regardless of - whether they are near or far from the camera. The parameters to this - function specify the clipping volume where left and right are the - minimum and maximum x values, top and bottom are the minimum and maximum - y values, and near and far are the minimum and maximum z values. If no - parameters are given, the default is used: ortho(0, width, 0, height, - -10, 10). - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho(float left,
        -                  float right,
        -                  float bottom,
        -                  float top)
        -
        -
        Parameters:
        -
        left - left plane of the clipping volume
        -
        right - right plane of the clipping volume
        -
        bottom - bottom plane of the clipping volume
        -
        top - top plane of the clipping volume
        -
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho(float left,
        -                  float right,
        -                  float bottom,
        -                  float top,
        -                  float near,
        -                  float far)
        -
        -
        Parameters:
        -
        near - maximum distance from the origin to the viewer
        -
        far - maximum distance from the origin away from the viewer
        -
        -
      • -
      - - - -
        -
      • -

        perspective

        -
        public void perspective()
        -
        ( begin auto-generated from perspective.xml ) - - Sets a perspective projection applying foreshortening, making distant - objects appear smaller than closer ones. The parameters define a viewing - volume with the shape of truncated pyramid. Objects near to the front of - the volume appear their actual size, while farther objects appear - smaller. This projection simulates the perspective of the world more - accurately than orthographic projection. The version of perspective - without parameters sets the default perspective and the version with - four parameters allows the programmer to set the area precisely. The - default values are: perspective(PI/3.0, width/height, cameraZ/10.0, - cameraZ*10.0) where cameraZ is ((height/2.0) / tan(PI*60.0/360.0)); - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        perspective

        -
        public void perspective(float fovy,
        -                        float aspect,
        -                        float zNear,
        -                        float zFar)
        -
        -
        Parameters:
        -
        fovy - field-of-view angle (in radians) for vertical direction
        -
        aspect - ratio of width to height
        -
        zNear - z-position of nearest clipping plane
        -
        zFar - z-position of farthest clipping plane
        -
        -
      • -
      - - - -
        -
      • -

        frustum

        -
        public void frustum(float left,
        -                    float right,
        -                    float bottom,
        -                    float top,
        -                    float near,
        -                    float far)
        -
        ( begin auto-generated from frustum.xml ) - - Sets a perspective matrix defined through the parameters. Works like - glFrustum, except it wipes out the current perspective matrix rather - than muliplying itself with it. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        left - left coordinate of the clipping plane
        -
        right - right coordinate of the clipping plane
        -
        bottom - bottom coordinate of the clipping plane
        -
        top - top coordinate of the clipping plane
        -
        near - near component of the clipping plane; must be greater than zero
        -
        far - far component of the clipping plane; must be greater than the near value
        -
        See Also:
        -
        camera(float, float, float, float, float, float, float, float, float), -endCamera(), -perspective(float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y)
        -
        ( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        screenY(float, float, float), -screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y)
        -
        ( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        screenX(float, float, float), -screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y,
        -                     float z)
        -
        -
        Parameters:
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y,
        -                     float z)
        -
        -
        Parameters:
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenZ

        -
        public float screenZ(float x,
        -                     float y,
        -                     float z)
        -
        ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        screenX(float, float, float), -screenY(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelX

        -
        public float modelX(float x,
        -                    float y,
        -                    float z)
        -
        ( begin auto-generated from modelX.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the X value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The X value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use. -

        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        modelY(float, float, float), -modelZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelY

        -
        public float modelY(float x,
        -                    float y,
        -                    float z)
        -
        ( begin auto-generated from modelY.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the Y value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The Y value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use.
        -
        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        modelX(float, float, float), -modelZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelZ

        -
        public float modelZ(float x,
        -                    float y,
        -                    float z)
        -
        ( begin auto-generated from modelZ.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the Z value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The Z value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use.
        -
        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        modelX(float, float, float), -modelY(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        pushStyle

        -
        public void pushStyle()
        -
        ( begin auto-generated from pushStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings. Note that these functions - are always used together. They allow you to change the style settings - and later return to what you had. When a new style is started with - pushStyle(), it builds on the current style information. The - pushStyle() and popStyle() functions can be embedded to - provide more control (see the second example above for a demonstration.) -

        - The style information controlled by the following functions are included - in the style: - fill(), stroke(), tint(), strokeWeight(), strokeCap(), strokeJoin(), - imageMode(), rectMode(), ellipseMode(), shapeMode(), colorMode(), - textAlign(), textFont(), textMode(), textSize(), textLeading(), - emissive(), specular(), shininess(), ambient() - - ( end auto-generated )
        -
        -
        See Also:
        -
        popStyle()
        -
        -
      • -
      - - - -
        -
      • -

        popStyle

        -
        public void popStyle()
        -
        ( begin auto-generated from popStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings; these functions are - always used together. They allow you to change the style settings and - later return to what you had. When a new style is started with - pushStyle(), it builds on the current style information. The - pushStyle() and popStyle() functions can be embedded to - provide more control (see the second example above for a demonstration.) - - ( end auto-generated )
        -
        -
        See Also:
        -
        pushStyle()
        -
        -
      • -
      - - - -
        -
      • -

        style

        -
        public void style(PStyle s)
        -
      • -
      - - - -
        -
      • -

        getStyle

        -
        public PStyle getStyle()
        -
      • -
      - - - - - - - -
        -
      • -

        strokeWeight

        -
        public void strokeWeight(float weight)
        -
        ( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes. All widths are set in units of pixels. -

        - When drawing with P3D, series of connected lines (such as the stroke - around a polygon, triangle, or ellipse) produce unattractive results - when a thick stroke weight is set (see - Issue 123). With P3D, the minimum and maximum values for - strokeWeight() are controlled by the graphics card and the - operating system's OpenGL implementation. For instance, the thickness - may not go higher than 10 pixels. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        weight - the weight (in pixels) of the stroke
        -
        See Also:
        -
        stroke(int, float), -strokeJoin(int), -strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        strokeJoin

        -
        public void strokeJoin(int join)
        -
        ( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments. These joints - are either mitered, beveled, or rounded and specified with the - corresponding parameters MITER, BEVEL, and ROUND. The default joint is - MITER. -

        - This function is not available with the P3D renderer, (see - Issue 123). More information about the renderers can be found in the - size() reference. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        join - either MITER, BEVEL, ROUND
        -
        See Also:
        -
        stroke(int, float), -strokeWeight(float), -strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        strokeCap

        -
        public void strokeCap(int cap)
        -
        ( begin auto-generated from strokeCap.xml ) - - Sets the style for rendering line endings. These ends are either - squared, extended, or rounded and specified with the corresponding - parameters SQUARE, PROJECT, and ROUND. The default cap is ROUND. -

        - This function is not available with the P3D renderer (see - Issue 123). More information about the renderers can be found in the - size() reference. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        cap - either SQUARE, PROJECT, or ROUND
        -
        See Also:
        -
        stroke(int, float), -strokeWeight(float), -strokeJoin(int), -PApplet.size(int, int, String, String)
        -
        -
      • -
      - - - -
        -
      • -

        noStroke

        -
        public void noStroke()
        -
        ( begin auto-generated from noStroke.xml ) - - Disables drawing the stroke (outline). If both noStroke() and - noFill() are called, nothing will be drawn to the screen. - - ( end auto-generated )
        -
        -
        See Also:
        -
        stroke(int, float), -fill(float, float, float, float), -noFill()
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(int rgb)
        -
        ( begin auto-generated from stroke.xml ) - - Sets the color used to draw lines and borders around shapes. This color - is either specified in terms of the RGB or HSB color depending on the - current colorMode() (the default color space is RGB, with each - value in the range from 0 to 255). -

        - When using hexadecimal notation to specify a color, use "#" or "0x" - before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six - digits to specify a color (the way colors are specified in HTML and - CSS). When using the hexadecimal notation starting with "0x", the - hexadecimal value must be specified with eight characters; the first two - characters define the alpha component and the remainder the red, green, - and blue components. -

        - The value for the parameter "gray" must be less than or equal to the - current maximum value as specified by colorMode(). The default - maximum value is 255. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color value in hexadecimal notation
        -
        See Also:
        -
        noStroke(), -strokeWeight(float), -strokeJoin(int), -strokeCap(int), -fill(int, float), -noFill(), -tint(int, float), -background(float, float, float, float), -colorMode(int, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(int rgb,
        -                   float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the stroke
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float gray)
        -
        -
        Parameters:
        -
        gray - specifies a value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float gray,
        -                   float alpha)
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float v1,
        -                   float v2,
        -                   float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float v1,
        -                   float v2,
        -                   float v3,
        -                   float alpha)
        -
      • -
      - - - - - - - -
        -
      • -

        tint

        -
        public void tint(int rgb)
        -
        ( begin auto-generated from tint.xml ) - - Sets the fill value for displaying images. Images can be tinted to - specified colors or made transparent by setting the alpha.
        -
        - To make an image transparent, but not change it's color, use white as - the tint color and specify an alpha value. For instance, tint(255, 128) - will make an image 50% transparent (unless colorMode() has been - used).
        -
        - When using hexadecimal notation to specify a color, use "#" or "0x" - before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six - digits to specify a color (the way colors are specified in HTML and - CSS). When using the hexadecimal notation starting with "0x", the - hexadecimal value must be specified with eight characters; the first two - characters define the alpha component and the remainder the red, green, - and blue components.
        -
        - The value for the parameter "gray" must be less than or equal to the - current maximum value as specified by colorMode(). The default - maximum value is 255.
        -
        - The tint() function is also used to control the coloring of - textures in 3D. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color value in hexadecimal notation
        -
        See Also:
        -
        noTint(), -image(PImage, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(int rgb,
        -                 float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the image
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float gray)
        -
        -
        Parameters:
        -
        gray - specifies a value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float gray,
        -                 float alpha)
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float v1,
        -                 float v2,
        -                 float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float v1,
        -                 float v2,
        -                 float v3,
        -                 float alpha)
        -
      • -
      - - - -
        -
      • -

        noFill

        -
        public void noFill()
        -
        ( begin auto-generated from noFill.xml ) - - Disables filling geometry. If both noStroke() and noFill() - are called, nothing will be drawn to the screen. - - ( end auto-generated )
        -
        -
        See Also:
        -
        fill(float, float, float, float), -stroke(int, float), -noStroke()
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(int rgb)
        -
        ( begin auto-generated from fill.xml ) - - Sets the color used to fill shapes. For example, if you run fill(204, - 102, 0), all subsequent shapes will be filled with orange. This - color is either specified in terms of the RGB or HSB color depending on - the current colorMode() (the default color space is RGB, with - each value in the range from 0 to 255). -

        - When using hexadecimal notation to specify a color, use "#" or "0x" - before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six - digits to specify a color (the way colors are specified in HTML and - CSS). When using the hexadecimal notation starting with "0x", the - hexadecimal value must be specified with eight characters; the first two - characters define the alpha component and the remainder the red, green, - and blue components. -

        - The value for the parameter "gray" must be less than or equal to the - current maximum value as specified by colorMode(). The default - maximum value is 255. -

        - To change the color of an image (or a texture), use tint(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color variable or hex value
        -
        See Also:
        -
        noFill(), -stroke(int, float), -noStroke(), -tint(int, float), -background(float, float, float, float), -colorMode(int, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(int rgb,
        -                 float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the fill
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float gray)
        -
        -
        Parameters:
        -
        gray - number specifying value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float gray,
        -                 float alpha)
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float v1,
        -                 float v2,
        -                 float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float v1,
        -                 float v2,
        -                 float v3,
        -                 float alpha)
        -
      • -
      - - - -
        -
      • -

        ambient

        -
        public void ambient(int rgb)
        -
        ( begin auto-generated from ambient.xml ) - - Sets the ambient reflectance for shapes drawn to the screen. This is - combined with the ambient light component of environment. The color - components set through the parameters define the reflectance. For - example in the default color mode, setting v1=255, v2=126, v3=0, would - cause all the red light to reflect and half of the green light to - reflect. Used in combination with emissive(), specular(), - and shininess() in setting the material properties of shapes. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        emissive(float, float, float), -specular(float, float, float), -shininess(float)
        -
        -
      • -
      - - - -
        -
      • -

        ambient

        -
        public void ambient(float gray)
        -
        -
        Parameters:
        -
        gray - number specifying value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        ambient

        -
        public void ambient(float v1,
        -                    float v2,
        -                    float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        specular

        -
        public void specular(int rgb)
        -
        ( begin auto-generated from specular.xml ) - - Sets the specular color of the materials used for shapes drawn to the - screen, which sets the color of hightlights. Specular refers to light - which bounces off a surface in a perferred direction (rather than - bouncing in all directions like a diffuse light). Used in combination - with emissive(), ambient(), and shininess() in - setting the material properties of shapes. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color to set
        -
        See Also:
        -
        lightSpecular(float, float, float), -ambient(float, float, float), -emissive(float, float, float), -shininess(float)
        -
        -
      • -
      - - - -
        -
      • -

        specular

        -
        public void specular(float gray)
        -
        gray number specifying value between white and black
        -
      • -
      - - - -
        -
      • -

        specular

        -
        public void specular(float v1,
        -                     float v2,
        -                     float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        shininess

        -
        public void shininess(float shine)
        -
        ( begin auto-generated from shininess.xml ) - - Sets the amount of gloss in the surface of shapes. Used in combination - with ambient(), specular(), and emissive() in - setting the material properties of shapes. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        shine - degree of shininess
        -
        See Also:
        -
        emissive(float, float, float), -ambient(float, float, float), -specular(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        emissive

        -
        public void emissive(int rgb)
        -
        ( begin auto-generated from emissive.xml ) - - Sets the emissive color of the material used for drawing shapes drawn to - the screen. Used in combination with ambient(), - specular(), and shininess() in setting the material - properties of shapes. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color to set
        -
        See Also:
        -
        ambient(float, float, float), -specular(float, float, float), -shininess(float)
        -
        -
      • -
      - - - -
        -
      • -

        emissive

        -
        public void emissive(float gray)
        -
        gray number specifying value between white and black
        -
      • -
      - - - -
        -
      • -

        emissive

        -
        public void emissive(float v1,
        -                     float v2,
        -                     float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        noLights

        -
        public void noLights()
        -
        ( begin auto-generated from noLights.xml ) - - Disable all lighting. Lighting is turned off by default and enabled with - the lights() function. This function can be used to disable - lighting so that 2D geometry (which does not require lighting) can be - drawn after a set of lighted 3D geometry. - - ( end auto-generated )
        -
        -
        See Also:
        -
        lights()
        -
        -
      • -
      - - - -
        -
      • -

        ambientLight

        -
        public void ambientLight(float v1,
        -                         float v2,
        -                         float v3)
        -
        ( begin auto-generated from ambientLight.xml ) - - Adds an ambient light. Ambient light doesn't come from a specific - direction, the rays have light have bounced around so much that objects - are evenly lit from all sides. Ambient lights are almost always used in - combination with other types of lights. Lights need to be included in - the draw() to remain persistent in a looping program. Placing - them in the setup() of a looping program will cause them to only - have an effect the first time through the loop. The effect of the - parameters is determined by the current color mode. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        See Also:
        -
        lights(), -directionalLight(float, float, float, float, float, float), -pointLight(float, float, float, float, float, float), -spotLight(float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        ambientLight

        -
        public void ambientLight(float v1,
        -                         float v2,
        -                         float v3,
        -                         float x,
        -                         float y,
        -                         float z)
        -
        -
        Parameters:
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        -
      • -
      - - - -
        -
      • -

        directionalLight

        -
        public void directionalLight(float v1,
        -                             float v2,
        -                             float v3,
        -                             float nx,
        -                             float ny,
        -                             float nz)
        -
        ( begin auto-generated from directionalLight.xml ) - - Adds a directional light. Directional light comes from one direction and - is stronger when hitting a surface squarely and weaker if it hits at a a - gentle angle. After hitting a surface, a directional lights scatters in - all directions. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The nx, ny, and nz parameters specify the - direction the light is facing. For example, setting ny to -1 will - cause the geometry to be lit from below (the light is facing directly upward). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        nx - direction along the x-axis
        -
        ny - direction along the y-axis
        -
        nz - direction along the z-axis
        -
        See Also:
        -
        lights(), -ambientLight(float, float, float, float, float, float), -pointLight(float, float, float, float, float, float), -spotLight(float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        pointLight

        -
        public void pointLight(float v1,
        -                       float v2,
        -                       float v3,
        -                       float x,
        -                       float y,
        -                       float z)
        -
        ( begin auto-generated from pointLight.xml ) - - Adds a point light. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The x, y, and z parameters set the position - of the light. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        See Also:
        -
        lights(), -directionalLight(float, float, float, float, float, float), -ambientLight(float, float, float, float, float, float), -spotLight(float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        spotLight

        -
        public void spotLight(float v1,
        -                      float v2,
        -                      float v3,
        -                      float x,
        -                      float y,
        -                      float z,
        -                      float nx,
        -                      float ny,
        -                      float nz,
        -                      float angle,
        -                      float concentration)
        -
        ( begin auto-generated from spotLight.xml ) - - Adds a spot light. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The x, y, and z parameters specify the - position of the light and nx, ny, nz specify the - direction or light. The angle parameter affects angle of the - spotlight cone. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        nx - direction along the x axis
        -
        ny - direction along the y axis
        -
        nz - direction along the z axis
        -
        angle - angle of the spotlight cone
        -
        concentration - exponent determining the center bias of the cone
        -
        See Also:
        -
        lights(), -directionalLight(float, float, float, float, float, float), -pointLight(float, float, float, float, float, float), -ambientLight(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        lightFalloff

        -
        public void lightFalloff(float constant,
        -                         float linear,
        -                         float quadratic)
        -
        ( begin auto-generated from lightFalloff.xml ) - - Sets the falloff rates for point lights, spot lights, and ambient - lights. The parameters are used to determine the falloff with the - following equation:

        d = distance from light position to - vertex position
        falloff = 1 / (CONSTANT + d * LINEAR + (d*d) * - QUADRATIC)

        Like fill(), it affects only the elements - which are created after it in the code. The default value if - LightFalloff(1.0, 0.0, 0.0). Thinking about an ambient light with - a falloff can be tricky. It is used, for example, if you wanted a region - of your scene to be lit ambiently one color and another region to be lit - ambiently by another color, you would use an ambient light with location - and falloff. You can think of it as a point light that doesn't care - which direction a surface is facing. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        constant - constant value or determining falloff
        -
        linear - linear value for determining falloff
        -
        quadratic - quadratic value for determining falloff
        -
        See Also:
        -
        lights(), -ambientLight(float, float, float, float, float, float), -pointLight(float, float, float, float, float, float), -spotLight(float, float, float, float, float, float, float, float, float, float, float), -lightSpecular(float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        background

        -
        public void background(int rgb)
        -
        ( begin auto-generated from background.xml ) - - The background() function sets the color used for the background - of the Processing window. The default background is light gray. In the - draw() function, the background color is used to clear the - display window at the beginning of each frame. -

        - An image can also be used as the background for a sketch, however its - width and height must be the same size as the sketch window. To resize - an image 'b' to the size of the sketch window, use b.resize(width, height). -

        - Images used as background will ignore the current tint() setting. -

        - It is not possible to use transparency (alpha) in background colors with - the main drawing surface, however they will work properly with createGraphics(). - - ( end auto-generated ) - -

        Advanced

        -

        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.

        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        stroke(float), -fill(float), -tint(float), -colorMode(int)
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(int rgb,
        -                       float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the background
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float gray)
        -
        -
        Parameters:
        -
        gray - specifies a value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float gray,
        -                       float alpha)
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float v1,
        -                       float v2,
        -                       float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on the current color mode)
        -
        v2 - green or saturation value (depending on the current color mode)
        -
        v3 - blue or brightness value (depending on the current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float v1,
        -                       float v2,
        -                       float v3,
        -                       float alpha)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
      • -
      - - - -
        -
      • -

        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. Use image.filter(OPAQUE) to handle this easily.
        -
        - When using 3D, this will also clear the zbuffer (if it exists).
        -
        -
        Parameters:
        -
        image - PImage to set as background (must be same size as the sketch window)
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode)
        -
        ( begin auto-generated from colorMode.xml ) - - Changes the way Processing interprets color data. By default, the - parameters for fill(), stroke(), background(), and - color() are defined by values between 0 and 255 using the RGB - color model. The colorMode() function is used to change the - numerical range used for specifying colors and to switch color systems. - For example, calling colorMode(RGB, 1.0) will specify that values - are specified between 0 and 1. The limits for defining colors are - altered by setting the parameters range1, range2, range3, and range 4. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - Either RGB or HSB, corresponding to Red/Green/Blue and Hue/Saturation/Brightness
        -
        See Also:
        -
        background(float), -fill(float), -stroke(float)
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float max)
        -
        -
        Parameters:
        -
        max - range for all color elements
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float max1,
        -                      float max2,
        -                      float max3)
        -
        -
        Parameters:
        -
        max1 - range for the red or hue depending on the current color mode
        -
        max2 - range for the green or saturation depending on the current color mode
        -
        max3 - range for the blue or brightness depending on the current color mode
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float max1,
        -                      float max2,
        -                      float max3,
        -                      float maxA)
        -
        -
        Parameters:
        -
        maxA - range for the alpha
        -
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int c)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(float gray)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int c,
        -                       int alpha)
        -
        -
        Parameters:
        -
        c - can be packed ARGB or a gray in this case
        -
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int c,
        -                       float alpha)
        -
        -
        Parameters:
        -
        c - 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 v1,
        -                       int v2,
        -                       int v3)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(float v1,
        -                       float v2,
        -                       float v3)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int v1,
        -                       int v2,
        -                       int v3,
        -                       int a)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(float v1,
        -                       float v2,
        -                       float v3,
        -                       float a)
        -
      • -
      - - - - - - - -
        -
      • -

        red

        -
        public final float red(int rgb)
        -
        ( begin auto-generated from red.xml ) - - Extracts the red value from a color, scaled to match current - colorMode(). This value is always returned as a float so be - careful not to assign it to an int value.

        The red() function - is easy to use and undestand, but is slower than another technique. To - achieve the same results when working in colorMode(RGB, 255), but - with greater speed, use the >> (right shift) operator with a bit - mask. For example, the following two lines of code are equivalent:
        float r1 = red(myColor);
        float r2 = myColor >> 16 - & 0xFF;
        - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        green(int), -blue(int), -alpha(int), -hue(int), -saturation(int), -brightness(int)
        -
        -
      • -
      - - - -
        -
      • -

        green

        -
        public final float green(int rgb)
        -
        ( begin auto-generated from green.xml ) - - Extracts the green value from a color, scaled to match current - colorMode(). This value is always returned as a float so be - careful not to assign it to an int value.

        The green() - function is easy to use and undestand, but is slower than another - technique. To achieve the same results when working in colorMode(RGB, - 255), but with greater speed, use the >> (right shift) - operator with a bit mask. For example, the following two lines of code - are equivalent:
        float r1 = green(myColor);
        float r2 = - myColor >> 8 & 0xFF;
        - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        red(int), -blue(int), -alpha(int), -hue(int), -saturation(int), -brightness(int)
        -
        -
      • -
      - - - -
        -
      • -

        blue

        -
        public final float blue(int rgb)
        -
        ( begin auto-generated from blue.xml ) - - Extracts the blue value from a color, scaled to match current - colorMode(). This value is always returned as a float so be - careful not to assign it to an int value.

        The blue() - function is easy to use and undestand, but is slower than another - technique. To achieve the same results when working in colorMode(RGB, - 255), but with greater speed, use a bit mask to remove the other - color components. For example, the following two lines of code are - equivalent:
        float r1 = blue(myColor);
        float r2 = myColor - & 0xFF;
        - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        red(int), -green(int), -alpha(int), -hue(int), -saturation(int), -brightness(int)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        saturation

        -
        public final float saturation(int rgb)
        -
        ( begin auto-generated from saturation.xml ) - - Extracts the saturation value from a color. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        red(int), -green(int), -blue(int), -alpha(int), -hue(int), -brightness(int)
        -
        -
      • -
      - - - -
        -
      • -

        brightness

        -
        public final float brightness(int rgb)
        -
        ( begin auto-generated from brightness.xml ) - - Extracts the brightness value from a color. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        red(int), -green(int), -blue(int), -alpha(int), -hue(int), -saturation(int)
        -
        -
      • -
      - - - -
        -
      • -

        lerpColor

        -
        public int lerpColor(int c1,
        -                     int c2,
        -                     float amt)
        -
        ( begin auto-generated from lerpColor.xml ) - - Calculates a color or colors between two color at a specific increment. - The amt parameter is the amount to interpolate between the two - values where 0.0 equal to the first point, 0.1 is very near the first - point, 0.5 is half-way in between, etc. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        c1 - interpolate from this color
        -
        c2 - interpolate to this color
        -
        amt - between 0.0 and 1.0
        -
        See Also:
        -
        PImage.blendColor(int, int, int), -color(float, float, float, float), -PApplet.lerp(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        lerpColor

        -
        public static int lerpColor(int c1,
        -                            int c2,
        -                            float amt,
        -                            int mode)
        -
      • -
      - - - -
        -
      • -

        beginRaw

        -
        public void beginRaw(PGraphics rawGraphics)
        -
        Record individual lines and triangles by echoing them to another renderer.
        -
      • -
      - - - -
        -
      • -

        endRaw

        -
        public void endRaw()
        -
      • -
      - - - -
        -
      • -

        haveRaw

        -
        public boolean haveRaw()
        -
      • -
      - - - - - - - -
        -
      • -

        showWarning

        -
        public static void showWarning(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)
        -
        -
      • -
      - - - -
        -
      • -

        showWarning

        -
        public static void showWarning(String msg,
        -                               Object... args)
        -
        Version of showWarning() that takes a parsed String.
        -
      • -
      - - - -
        -
      • -

        showDepthWarning

        -
        public static void showDepthWarning(String method)
        -
        Display a warning that the specified method is only available with 3D.
        -
        -
        Parameters:
        -
        method - The method name (no parentheses)
        -
        -
      • -
      - - - -
        -
      • -

        showDepthWarningXYZ

        -
        public static void showDepthWarningXYZ(String method)
        -
        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.
        -
        -
        Parameters:
        -
        method - The method name (no parentheses)
        -
        -
      • -
      - - - -
        -
      • -

        showMethodWarning

        -
        public static void showMethodWarning(String method)
        -
        Display a warning that the specified method is simply unavailable.
        -
      • -
      - - - -
        -
      • -

        showVariationWarning

        -
        public static void showVariationWarning(String str)
        -
        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.
        -
      • -
      - - - -
        -
      • -

        showMissingWarning

        -
        public static void showMissingWarning(String method)
        -
        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.
        -
      • -
      - - - -
        -
      • -

        showException

        -
        public static void showException(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 3D drawing. Defaults to false.
        -
      • -
      - - - -
        -
      • -

        isGL

        -
        public boolean isGL()
        -
        Return true if this renderer does rendering through OpenGL. Defaults to false.
        -
      • -
      - - - -
        -
      • -

        is2X

        -
        public boolean is2X()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PGraphicsDanger2D.html b/build/javadoc/core/processing/core/PGraphicsDanger2D.html deleted file mode 100644 index af5432ec4c..0000000000 --- a/build/javadoc/core/processing/core/PGraphicsDanger2D.html +++ /dev/null @@ -1,1186 +0,0 @@ - - - - - -PGraphicsDanger2D - - - - - - - - - - - -
-
processing.core
-

Class PGraphicsDanger2D

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Cloneable, PConstants
    -
    -
    -
    -
    public class PGraphicsDanger2D
    -extends PGraphicsJava2D
    -
    Experimental/enhanced renderer that draws directly to the Graphics context - without an intermediate image. This greatly speeds up performance - (especially on hidpi displays), but prevents pixel access. It also causes - some rendering hiccups (frame rate is not as smooth), but that's why it's - experimental. - - Works with both normal and hidpi, without need for an extra E2D_2X. - - This is not the final class name, and it's not clear in what form (or if) - this will ship with 3.0.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PGraphicsDanger2D

        -
        public PGraphicsDanger2D()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        beginDraw

        -
        public void beginDraw()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from PGraphics_beginDraw.xml ) - - Sets the default properties for a PGraphics object. It should be called - before anything is drawn into the object. - - ( end auto-generated ) -

        Advanced

        - When creating your own PGraphics, you should call this before - drawing anything.
        -
        -
        Overrides:
        -
        beginDraw in class PGraphicsJava2D
        -
        -
      • -
      - - - -
        -
      • -

        loadPixels

        -
        public void loadPixels()
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_loadPixels.xml ) - - Loads the pixel data for the image into its pixels[] array. This - function must always be called before reading from or writing to pixels[]. -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. - - ( end auto-generated ) - -

        Advanced

        - 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()
        -
        -
        Overrides:
        -
        updatePixels in class PImage
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        Parameters:
        -
        x - x-coordinate of the upper-left corner
        -
        y - y-coordinate of the upper-left corner
        -
        c - width
        -
        d - height
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get(int x,
        -               int y)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image. If no - parameters are specified, the entire image is returned. Use the x - and y parameters to get the value of one pixel. Get a section of - the display window by specifying an additional width and - height parameter. When getting an image, the x and - y parameters define the coordinates for the upper-left corner of - the image, regardless of the current imageMode().
        -
        - If the pixel requested is outside of the image window, black is - returned. The numbers returned are scaled according to the current color - ranges, but only RGB values are returned by this function. For example, - even though you may have drawn a shape with colorMode(HSB), the - numbers returned will be in RGB format.
        -
        - Getting the color of a single pixel with get(x, y) is easy, but - not as fast as grabbing the data directly from pixels[]. The - equivalent statement to get(x, y) using pixels[] is - pixels[y*width+x]. See the reference for pixels[] for more information. - - ( end auto-generated ) - -

        Advanced

        - 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
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        See Also:
        -
        PApplet.set(int, int, int), -PApplet.pixels, -PApplet.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public PImage get(int x,
        -                  int y,
        -                  int c,
        -                  int d)
        -
        -
        Overrides:
        -
        get in class PImage
        -
        c - width of pixel rectangle to get
        -
        d - height of pixel rectangle to get
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public PImage get()
        -
        Description copied from class: PImage
        -
        Returns a copy of this PImage. Equivalent to get(0, 0, width, height). - Deprecated, just use copy() instead.
        -
        -
        Overrides:
        -
        get in class PGraphicsJava2D
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                int argb)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
        -
        - The x and y parameters specify the pixel to change and the - color parameter specifies the color value. The color parameter is - affected by the current color mode (the default is RGB values from 0 to - 255). When setting an image, the x and y parameters define - the coordinates for the upper-left corner of the image, regardless of - the current imageMode(). -

        - Setting the color of a single pixel with set(x, y) is easy, but - not as fast as putting the data directly into pixels[]. The - equivalent statement to set(x, y, #000000) using pixels[] - is pixels[y*width+x] = #000000. See the reference for - pixels[] for more information. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        set in class PGraphicsJava2D
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        argb - any value of the color datatype
        -
        See Also:
        -
        PImage.get(int, int, int, int), -PImage.pixels, -PImage.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                PImage image)
        -
        Description copied from class: PImage
        -

        Advanced

        - 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
        -
        image - image to copy into the original image
        -
        -
      • -
      - - - -
        -
      • -

        mask

        -
        public void mask(int[] alpha)
        -
        -
        Overrides:
        -
        mask in class PGraphicsJava2D
        -
        -
      • -
      - - - -
        -
      • -

        mask

        -
        public void mask(PImage alpha)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel. This mask image should only contain - grayscale data, but only the blue color channel is used. The mask image - needs to be the same size as the image to which it is applied.
        -
        - In addition to using a mask image, an integer array containing the alpha - channel data can be specified directly. This method is useful for - creating dynamically generated alpha masks. This array must be of the - same length as the target image's pixels array and should contain only - grayscale data of values between 0-255. - - ( end auto-generated ) - -

        Advanced

        - - 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" grayscale by - performing a proper luminance-based conversion.

        -
        -
        Overrides:
        -
        mask in class PGraphicsJava2D
        -
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(int kind)
        -
        -
        Overrides:
        -
        filter in class PImage
        -
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(int kind,
        -                   float param)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_filter.xml ) - - Filters an image as defined by one of the following modes:

        THRESHOLD - converts the image to black and white pixels depending if - they are above or below the threshold defined by the level parameter. - The level must be between 0.0 (black) and 1.0(white). If no level is - specified, 0.5 is used.
        -
        - GRAY - converts any colors in the image to grayscale equivalents
        -
        - INVERT - sets each pixel to its inverse value
        -
        - POSTERIZE - limits each channel of the image to the number of colors - specified as the level parameter
        -
        - BLUR - executes a Guassian blur with the level parameter specifying the - extent of the blurring. If no level parameter is used, the blur is - equivalent to Guassian blur of radius 1
        -
        - OPAQUE - sets the alpha channel to entirely opaque
        -
        - ERODE - reduces the light areas with the amount defined by the level - parameter
        -
        - DILATE - increases the light areas with the amount defined by the level parameter - - ( end auto-generated ) - -

        Advanced

        - 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
        -
        Parameters:
        -
        kind - Either THRESHOLD, GRAY, OPAQUE, INVERT, POSTERIZE, BLUR, ERODE, or DILATE
        -
        param - unique for each, see above
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        ( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another. If the source and - destination regions aren't the same size, it will automatically resize - source pixels to fit the specified target region. No alpha information - is used in the process, however if the source image has an alpha channel - set, it will be copied as well. -

        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        copy in class PGraphicsJava2D
        -
        Parameters:
        -
        sx1 - X coordinate of the source's upper left corner
        -
        sy1 - Y coordinate of the source's upper left corner
        -
        sx2 - source image width
        -
        sy2 - source image height
        -
        dx1 - X coordinate of the destination's upper left corner
        -
        dy1 - Y coordinate of the destination's upper left corner
        -
        dx2 - destination image width
        -
        dy2 - destination image height
        -
        See Also:
        -
        PGraphics.alpha(int), -PImage.blend(PImage, int, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(PImage src,
        -                 int sx1,
        -                 int sy1,
        -                 int sx2,
        -                 int sy2,
        -                 int dx1,
        -                 int dy1,
        -                 int dx2,
        -                 int dy2)
        -
        -
        Overrides:
        -
        copy in class PGraphicsJava2D
        -
        Parameters:
        -
        src - an image variable referring to the source image.
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Overrides:
        -
        blend in class PImage
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        ( begin auto-generated from PImage_blend.xml ) - - Blends a region of pixels into the image specified by the img - parameter. These copies utilize full alpha channel support and a choice - of the following modes to blend the colors of source pixels (A) with the - ones of pixels in the destination image (B):
        -
        - BLEND - linear interpolation of colours: C = A*factor + B
        -
        - ADD - additive blending with white clip: C = min(A*factor + B, 255)
        -
        - SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, - 0)
        -
        - DARKEST - only the darkest colour succeeds: C = min(A*factor, B)
        -
        - LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)
        -
        - 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.
        -
        - All modes use the alpha information (highest byte) of source image - pixels as the blending factor. If the source and destination regions are - different sizes, the image will be automatically resized to match the - destination size. If the srcImg parameter is not used, the - display window is used as the source image.
        -
        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        blend in class PImage
        -
        Parameters:
        -
        src - an image variable referring to the source image
        -
        sx1 - X coordinate of the source's upper left corner
        -
        sy1 - Y coordinate of the source's upper left corner
        -
        sx2 - source image width
        -
        sy2 - source image height
        -
        dx1 - X coordinate of the destinations's upper left corner
        -
        dy1 - Y coordinate of the destinations's upper left corner
        -
        dx2 - destination image width
        -
        dy2 - destination image height
        -
        mode - Either BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN
        -
        See Also:
        -
        PApplet.alpha(int), -PImage.copy(PImage, int, int, int, int, int, int, int, int), -PImage.blendColor(int,int,int)
        -
        -
      • -
      - - - -
        -
      • -

        save

        -
        public boolean save(String filename)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_save.xml ) - - Saves the image into a file. Images are saved in TIFF, TARGA, JPEG, and - PNG format depending on the extension within the filename - parameter. For example, "image.tif" will have a TIFF image and - "image.png" will save a PNG image. If no extension is included in the - filename, the image will save in TIFF format and .tif will be - added to the name. These files are saved to the sketch's folder, which - may be opened by selecting "Show sketch folder" from the "Sketch" menu. - It is not possible to use save() while running the program in a - web browser.

        To save an image created within the code, rather - than through loading, it's necessary to make the image with the - createImage() function so it is aware of the location of the - program and can therefore save the file to the right place. See the - createImage() reference for more information. - - ( end auto-generated ) -

        Advanced

        - 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
        -
        Parameters:
        -
        filename - a sequence of letters and numbers
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PGraphicsFX2D.html b/build/javadoc/core/processing/core/PGraphicsFX2D.html deleted file mode 100644 index d72c48d797..0000000000 --- a/build/javadoc/core/processing/core/PGraphicsFX2D.html +++ /dev/null @@ -1,2518 +0,0 @@ - - - - - -PGraphicsFX2D - - - - - - - - - - - -
-
processing.core
-

Class PGraphicsFX2D

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PGraphicsFX2D

        -
        public PGraphicsFX2D()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      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
        -
        ( begin auto-generated from PGraphics_beginDraw.xml ) - - Sets the default properties for a PGraphics object. It should be called - before anything is drawn into the object. - - ( end auto-generated ) -

        Advanced

        - 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
        -
        ( begin auto-generated from PGraphics_endDraw.xml ) - - Finalizes the rendering of a PGraphics object so that it can be shown on screen. - - ( end auto-generated ) -

        Advanced

        -

        - 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
        -
        ( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms. beginShape() begins recording - vertices for a shape and endShape() stops recording. The value of - the MODE parameter tells it which types of shapes to create from - the provided vertices. With no mode specified, the shape can be any - irregular polygon. The parameters available for beginShape() are POINTS, - LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, and QUAD_STRIP. - After calling the beginShape() function, a series of - vertex() commands must follow. To stop drawing the shape, call - endShape(). The vertex() function with two parameters - specifies a position in 2D and the vertex() function with three - parameters specifies a position in 3D. Each shape will be outlined with - the current stroke color and filled with the fill color. -

        - Transformations such as translate(), rotate(), and - scale() do not work within beginShape(). It is also not - possible to use other shapes, such as ellipse() or rect() - within beginShape(). -

        - The P3D renderer settings allow stroke() and fill() - settings to be altered per-vertex, however the default P2D renderer does - not. Settings such as strokeWeight(), strokeCap(), and - strokeJoin() cannot be changed while inside a - beginShape()/endShape() block with any renderer. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        beginShape in class PGraphics
        -
        Parameters:
        -
        kind - Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIP
        -
        See Also:
        -
        PShape, -PGraphics.endShape(), -PGraphics.vertex(float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        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[] v)
        -
        Description copied from class: PGraphics
        -
        Used by renderer subclasses or PShape to efficiently pass in already - formatted vertex information.
        -
        -
        Overrides:
        -
        vertex in class PGraphics
        -
        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)
        -
        -
        Overrides:
        -
        vertex in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float z,
        -                   float u,
        -                   float v)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices. - vertex() is used to specify the vertex coordinates for points, - lines, triangles, quads, and polygons and is used exclusively within the - beginShape() and endShape() function.
        -
        - Drawing a vertex in 3D using the z parameter requires the P3D - parameter in combination with size as shown in the above example.
        -
        - This function is also used to map a texture onto the geometry. The - texture() function declares the texture to apply to the geometry - and the u and v coordinates set define the mapping of this - texture to the form. By default, the coordinates used for u and - v are specified in relation to the image's size in pixels, but - this relation can be changed with textureMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        vertex in class PGraphics
        -
        Parameters:
        -
        x - x-coordinate of the vertex
        -
        y - y-coordinate of the vertex
        -
        z - z-coordinate of the vertex
        -
        u - horizontal coordinate for the texture mapping
        -
        v - vertical coordinate for the texture mapping
        -
        See Also:
        -
        PGraphics.beginShape(int), -PGraphics.endShape(int), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.texture(PImage)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        endContour

        -
        public void endContour()
        -
        -
        Overrides:
        -
        endContour in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape(int mode)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape(). When endshape() - is called, all of image data defined since the previous call to - beginShape() is written into the image buffer. The constant CLOSE - as the value for the MODE parameter to close the shape (to connect the - beginning and the end). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        endShape in class PGraphics
        -
        Parameters:
        -
        mode - use CLOSE to close the shape
        -
        See Also:
        -
        PShape, -PGraphics.beginShape(int)
        -
        -
      • -
      - - - -
        -
      • -

        noClip

        -
        public void noClip()
        -
        -
        Overrides:
        -
        noClip 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)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves. Each call to - bezierVertex() defines the position of two control points and one - anchor point of a Bezier curve, adding a new segment to a line or shape. - The first time bezierVertex() is used within a - beginShape() call, it must be prefaced with a call to - vertex() to set the first anchor point. This function must be - used between beginShape() and endShape() and only when - there is no MODE parameter specified to beginShape(). Using the - 3D version requires rendering with P3D (see the Environment reference - for more information). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        bezierVertex in class PGraphics
        -
        Parameters:
        -
        x2 - the x-coordinate of the 1st control point
        -
        y2 - the y-coordinate of the 1st control point
        -
        z2 - the z-coordinate of the 1st control point
        -
        x3 - the x-coordinate of the 2nd control point
        -
        y3 - the y-coordinate of the 2nd control point
        -
        z3 - the z-coordinate of the 2nd control point
        -
        x4 - the x-coordinate of the anchor point
        -
        y4 - the y-coordinate of the anchor point
        -
        z4 - the z-coordinate of the anchor point
        -
        See Also:
        -
        PGraphics.curveVertex(float, float, float), -PGraphics.vertex(float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float x2,
        -                            float y2,
        -                            float z2,
        -                            float x4,
        -                            float y4,
        -                            float z4)
        -
        -
        Overrides:
        -
        quadraticVertex in class PGraphics
        -
        z2 - the z-coordinate of the control point
        -
        z4 - the z-coordinate of the anchor point
        -
        -
      • -
      - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
        -
        Overrides:
        -
        curveVertex in class PGraphics
        -
        z - the z-coordinate of the vertex
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel. The - first parameter is the horizontal value for the point, the second value - is the vertical value for the point, and the optional third value is the - depth value. Drawing this shape in 3D with the z parameter - requires the P3D parameter in combination with size() as shown in - the above example. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        point in class PGraphics
        -
        Parameters:
        -
        x - x-coordinate of the point
        -
        y - y-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen. The - version of line() with four parameters draws the line in 2D. To - color a line, use the stroke() function. A line cannot be filled, - therefore the fill() function will not affect the color of a - line. 2D lines are drawn with a width of one pixel by default, but this - can be changed with the strokeWeight() function. The version with - six parameters allows the line to be placed anywhere within XYZ space. - Drawing this shape in 3D with the z parameter requires the P3D - parameter in combination with size() as shown in the above example. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        line in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        See Also:
        -
        PGraphics.strokeWeight(float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int), -PGraphics.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        triangle

        -
        public void triangle(float x1,
        -                     float y1,
        -                     float x2,
        -                     float y2,
        -                     float x3,
        -                     float y3)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points. The first two - arguments specify the first point, the middle two arguments specify the - second point, and the last two arguments specify the third point. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        triangle in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        x3 - x-coordinate of the third point
        -
        y3 - y-coordinate of the third point
        -
        See Also:
        -
        PApplet.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        quad

        -
        public void quad(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2,
        -                 float x3,
        -                 float y3,
        -                 float x4,
        -                 float y4)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon. It is similar to a - rectangle, but the angles between its edges are not constrained to - ninety degrees. The first pair of parameters (x1,y1) sets the first - vertex and the subsequent pairs should proceed clockwise or - counter-clockwise around the defined shape. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        quad in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first corner
        -
        y1 - y-coordinate of the first corner
        -
        x2 - x-coordinate of the second corner
        -
        y2 - y-coordinate of the second corner
        -
        x3 - x-coordinate of the third corner
        -
        y3 - y-coordinate of the third corner
        -
        x4 - x-coordinate of the fourth corner
        -
        y4 - y-coordinate of the fourth corner
        -
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float w,
        -                float h,
        -                float d)
        -
        -
        Overrides:
        -
        box in class PGraphics
        -
        Parameters:
        -
        w - dimension of the box in the x-dimension
        -
        h - dimension of the box in the y-dimension
        -
        d - dimension of the box in the z-dimension
        -
        -
      • -
      - - - -
        -
      • -

        sphere

        -
        public void sphere(float r)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles. - - ( end auto-generated ) - -

        Advanced

        -

        - 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
        -
        Parameters:
        -
        r - the radius of the sphere
        -
        See Also:
        -
        PGraphics.sphereDetail(int)
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        popMatrix

        -
        public void popMatrix()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack. - Understanding pushing and popping requires understanding the concept of - a matrix stack. The pushMatrix() function saves the current - coordinate system to the stack and popMatrix() restores the prior - coordinate system. pushMatrix() and popMatrix() are used - in conjuction with the other transformation functions and may be - embedded to control the scope of the transformations. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        popMatrix in class PGraphics
        -
        See Also:
        -
        PGraphics.pushMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float tx,
        -                      float ty)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window. The - x parameter specifies left/right translation, the y - parameter specifies up/down translation, and the z parameter - specifies translations toward/away from the screen. Using this function - with the z parameter requires using P3D as a parameter in - combination with size as shown in the above example. Transformations - apply to everything that happens after and subsequent calls to the - function accumulates the effect. For example, calling translate(50, - 0) and then translate(20, 0) is the same as translate(70, - 0). If translate() is called within draw(), the - transformation is reset when the loop begins again. This function can be - further controlled by the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        translate in class PGraphics
        -
        Parameters:
        -
        tx - left/right translation
        -
        ty - up/down translation
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter. - Angles should be specified in radians (values from 0 to TWO_PI) or - converted to radians with the radians() function. -

        - Objects are always rotated around their relative position to the origin - and positive numbers rotate objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - rotate(HALF_PI) and then rotate(HALF_PI) is the same as - rotate(PI). All tranformations are reset when draw() - begins again. -

        - Technically, rotate() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotate in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateX(PI/2) and then rotateX(PI/2) is the same - as rotateX(PI). If rotateX() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the example above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateX in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateY(PI/2) and then rotateY(PI/2) is the same - as rotateY(PI). If rotateY() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateY in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateZ(PI/2) and then rotateZ(PI/2) is the same - as rotateZ(PI). If rotateZ() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateZ in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle,
        -                   float vx,
        -                   float vy,
        -                   float vz)
        -
        Description copied from class: PGraphics
        -

        Advanced

        - 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
        -
        ( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices. Objects always scale from their relative origin to the - coordinate system. Scale values are specified as decimal percentages. - For example, the function call scale(2.0) increases the dimension - of a shape by 200%. Transformations apply to everything that happens - after and subsequent calls to the function multiply the effect. For - example, calling scale(2.0) and then scale(1.5) is the - same as scale(3.0). If scale() is called within - draw(), the transformation is reset when the loop begins again. - Using this fuction with the z parameter requires using P3D as a - parameter for size() as shown in the example above. This function - can be further controlled by pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        scale in class PGraphics
        -
        Parameters:
        -
        s - percentage to scale the object
        -
        See Also:
        -
        PGraphics.pushMatrix(), -PGraphics.popMatrix(), -PGraphics.translate(float, float, float), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float)
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float sx,
        -                  float sy)
        -
        Description copied from class: PGraphics
        -

        Advanced

        - 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
        -
        Parameters:
        -
        sx - percentage to scale the object in the x-axis
        -
        sy - percentage to scale the object in the y-axis
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float sx,
        -                  float sy,
        -                  float sz)
        -
        -
        Overrides:
        -
        scale in class PGraphics
        -
        sz - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - -
        -
      • -

        shearX

        -
        public void shearX(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearX(PI/2) and then shearX(PI/2) is the same as - shearX(PI). If shearX() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearX() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shearX in class PGraphics
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        public void shearY(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearY(PI/2) and then shearY(PI/2) is the same as - shearY(PI). If shearY() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearY() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shearY in class PGraphics
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearX(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(float n00,
        -                        float n01,
        -                        float n02,
        -                        float n10,
        -                        float n11,
        -                        float n12)
        -
        -
        Overrides:
        -
        applyMatrix in class PGraphics
        -
        Parameters:
        -
        n00 - numbers which define the 4x4 matrix to be multiplied
        -
        n01 - numbers which define the 4x4 matrix to be multiplied
        -
        n02 - numbers which define the 4x4 matrix to be multiplied
        -
        n10 - numbers which define the 4x4 matrix to be multiplied
        -
        n11 - numbers which define the 4x4 matrix to be multiplied
        -
        n12 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Overrides:
        -
        applyMatrix in class PGraphics
        -
        n03 - numbers which define the 4x4 matrix to be multiplied
        -
        n13 - numbers which define the 4x4 matrix to be multiplied
        -
        n20 - numbers which define the 4x4 matrix to be multiplied
        -
        n21 - numbers which define the 4x4 matrix to be multiplied
        -
        n22 - numbers which define the 4x4 matrix to be multiplied
        -
        n23 - numbers which define the 4x4 matrix to be multiplied
        -
        n30 - numbers which define the 4x4 matrix to be multiplied
        -
        n31 - numbers which define the 4x4 matrix to be multiplied
        -
        n32 - numbers which define the 4x4 matrix to be multiplied
        -
        n33 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - - - - - -
        -
      • -

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

        screenX

        -
        public float screenX(float x,
        -                     float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenX in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenY(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenY in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenX in class PGraphics
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenY in class PGraphics
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenZ

        -
        public float screenZ(float x,
        -                     float y,
        -                     float z)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenZ in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenY(float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        strokeJoin

        -
        public void strokeJoin(int join)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments. These joints - are either mitered, beveled, or rounded and specified with the - corresponding parameters MITER, BEVEL, and ROUND. The default joint is - MITER. -

        - This function is not available with the P3D renderer, (see - Issue 123). More information about the renderers can be found in the - size() reference. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        strokeJoin in class PGraphics
        -
        Parameters:
        -
        join - either MITER, BEVEL, ROUND
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeWeight(float), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        strokeWeight

        -
        public void strokeWeight(float weight)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes. All widths are set in units of pixels. -

        - When drawing with P3D, series of connected lines (such as the stroke - around a polygon, triangle, or ellipse) produce unattractive results - when a thick stroke weight is set (see - Issue 123). With P3D, the minimum and maximum values for - strokeWeight() are controlled by the graphics card and the - operating system's OpenGL implementation. For instance, the thickness - may not go higher than 10 pixels. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        strokeWeight in class PGraphics
        -
        Parameters:
        -
        weight - the weight (in pixels) of the stroke
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

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

        loadPixels

        -
        public void loadPixels()
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_loadPixels.xml ) - - Loads the pixel data for the image into its pixels[] array. This - function must always be called before reading from or writing to pixels[]. -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. - - ( end auto-generated ) - -

        Advanced

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

        mask

        -
        public void mask(PImage alpha)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel. This mask image should only contain - grayscale data, but only the blue color channel is used. The mask image - needs to be the same size as the image to which it is applied.
        -
        - In addition to using a mask image, an integer array containing the alpha - channel data can be specified directly. This method is useful for - creating dynamically generated alpha masks. This array must be of the - same length as the target image's pixels array and should contain only - grayscale data of values between 0-255. - - ( end auto-generated ) - -

        Advanced

        - - 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" grayscale by - performing a proper luminance-based conversion.

        -
        -
        Overrides:
        -
        mask in class PImage
        -
        -
      • -
      - - - -
        -
      • -

        showTodoWarning

        -
        public static void showTodoWarning(String method,
        -                                   int issue)
        -
        Display a warning that the specified method is simply unavailable.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PGraphicsJava2D.html b/build/javadoc/core/processing/core/PGraphicsJava2D.html deleted file mode 100644 index 13e6d3afdc..0000000000 --- a/build/javadoc/core/processing/core/PGraphicsJava2D.html +++ /dev/null @@ -1,3116 +0,0 @@ - - - - - -PGraphicsJava2D - - - - - - - - - - - -
-
processing.core
-

Class PGraphicsJava2D

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Cloneable, PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    PGraphicsDanger2D
    -
    -
    -
    -
    public class PGraphicsJava2D
    -extends PGraphics
    -
    Subclass for PGraphics that implements the graphics API using Java2D. -

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

    - Advanced debugging notes for Java2D.

    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - - - - - -
        -
      • -

        fillGradient

        -
        public boolean fillGradient
        -
      • -
      - - - -
        -
      • -

        fillGradientObject

        -
        public Paint fillGradientObject
        -
      • -
      - - - -
        -
      • -

        strokeGradient

        -
        public boolean strokeGradient
        -
      • -
      - - - -
        -
      • -

        strokeGradientObject

        -
        public Paint strokeGradientObject
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PGraphicsJava2D

        -
        public PGraphicsJava2D()
        -
      • -
      -
    • -
    - -
      -
    • - - -

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

        checkImage

        -
        public Graphics2D checkImage()
        -
      • -
      - - - -
        -
      • -

        beginDraw

        -
        public void beginDraw()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from PGraphics_beginDraw.xml ) - - Sets the default properties for a PGraphics object. It should be called - before anything is drawn into the object. - - ( end auto-generated ) -

        Advanced

        - 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
        -
        ( begin auto-generated from PGraphics_endDraw.xml ) - - Finalizes the rendering of a PGraphics object so that it can be shown on screen. - - ( end auto-generated ) -

        Advanced

        -

        - When creating your own PGraphics, you should call this when - you're finished drawing.

        -
        -
        Overrides:
        -
        endDraw in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        hint

        -
        public void hint(int which)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from hint.xml ) - - Set various hints and hacks for the renderer. This is used to handle - obscure rendering features that cannot be implemented in a consistent - manner across renderers. Many options will often graduate to standard - features instead of hints over time. -

        - hint(ENABLE_OPENGL_4X_SMOOTH) - Enable 4x anti-aliasing for P3D. This - can help force anti-aliasing if it has not been enabled by the user. On - some graphics cards, this can also be set by the graphics driver's - control panel, however not all cards make this available. This hint must - be called immediately after the size() command because it resets the - renderer, obliterating any settings and anything drawn (and like size(), - re-running the code that came before it again). -

        - hint(DISABLE_OPENGL_2X_SMOOTH) - In Processing 1.0, Processing always - enables 2x smoothing when the P3D renderer is used. This hint disables - the default 2x smoothing and returns the smoothing behavior found in - earlier releases, where smooth() and noSmooth() could be used to enable - and disable smoothing, though the quality was inferior. -

        - hint(ENABLE_NATIVE_FONTS) - Use the native version fonts when they are - installed, rather than the bitmapped version from a .vlw file. This is - useful with the default (or JAVA2D) renderer setting, as it will improve - font rendering speed. This is not enabled by default, because it can be - misleading while testing because the type will look great on your - machine (because you have the font installed) but lousy on others' - machines if the identical font is unavailable. This option can only be - set per-sketch, and must be called before any use of textFont(). -

        - hint(DISABLE_DEPTH_TEST) - Disable the zbuffer, allowing you to draw on - top of everything at will. When depth testing is disabled, items will be - drawn to the screen sequentially, like a painting. This hint is most - often used to draw in 3D, then draw in 2D on top of it (for instance, to - draw GUI controls in 2D on top of a 3D interface). Starting in release - 0149, this will also clear the depth buffer. Restore the default with - hint(ENABLE_DEPTH_TEST), but note that with the depth buffer cleared, - any 3D drawing that happens later in draw() will ignore existing shapes - on the screen. -

        - hint(ENABLE_DEPTH_SORT) - Enable primitive z-sorting of triangles and - lines in P3D and OPENGL. This can slow performance considerably, and the - algorithm is not yet perfect. Restore the default with hint(DISABLE_DEPTH_SORT). -

        - hint(DISABLE_OPENGL_ERROR_REPORT) - Speeds up the P3D renderer setting - by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT). -

        - As of release 0149, unhint() has been removed in favor of adding - additional ENABLE/DISABLE constants to reset the default behavior. This - prevents the double negatives, and also reinforces which hints can be - enabled or disabled. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        hint in class PGraphics
        -
        Parameters:
        -
        which - name of the hint to be enabled or disabled
        -
        See Also:
        -
        PGraphics, -PApplet.createGraphics(int, int, String, String), -PApplet.size(int, int)
        -
        -
      • -
      - - - -
        -
      • -

        beginShape

        -
        public void beginShape(int kind)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms. beginShape() begins recording - vertices for a shape and endShape() stops recording. The value of - the MODE parameter tells it which types of shapes to create from - the provided vertices. With no mode specified, the shape can be any - irregular polygon. The parameters available for beginShape() are POINTS, - LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, and QUAD_STRIP. - After calling the beginShape() function, a series of - vertex() commands must follow. To stop drawing the shape, call - endShape(). The vertex() function with two parameters - specifies a position in 2D and the vertex() function with three - parameters specifies a position in 3D. Each shape will be outlined with - the current stroke color and filled with the fill color. -

        - Transformations such as translate(), rotate(), and - scale() do not work within beginShape(). It is also not - possible to use other shapes, such as ellipse() or rect() - within beginShape(). -

        - The P3D renderer settings allow stroke() and fill() - settings to be altered per-vertex, however the default P2D renderer does - not. Settings such as strokeWeight(), strokeCap(), and - strokeJoin() cannot be changed while inside a - beginShape()/endShape() block with any renderer. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        beginShape in class PGraphics
        -
        Parameters:
        -
        kind - Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIP
        -
        See Also:
        -
        PShape, -PGraphics.endShape(), -PGraphics.vertex(float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        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[] v)
        -
        Description copied from class: PGraphics
        -
        Used by renderer subclasses or PShape to efficiently pass in already - formatted vertex information.
        -
        -
        Overrides:
        -
        vertex in class PGraphics
        -
        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)
        -
        -
        Overrides:
        -
        vertex in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float z,
        -                   float u,
        -                   float v)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices. - vertex() is used to specify the vertex coordinates for points, - lines, triangles, quads, and polygons and is used exclusively within the - beginShape() and endShape() function.
        -
        - Drawing a vertex in 3D using the z parameter requires the P3D - parameter in combination with size as shown in the above example.
        -
        - This function is also used to map a texture onto the geometry. The - texture() function declares the texture to apply to the geometry - and the u and v coordinates set define the mapping of this - texture to the form. By default, the coordinates used for u and - v are specified in relation to the image's size in pixels, but - this relation can be changed with textureMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        vertex in class PGraphics
        -
        Parameters:
        -
        x - x-coordinate of the vertex
        -
        y - y-coordinate of the vertex
        -
        z - z-coordinate of the vertex
        -
        u - horizontal coordinate for the texture mapping
        -
        v - vertical coordinate for the texture mapping
        -
        See Also:
        -
        PGraphics.beginShape(int), -PGraphics.endShape(int), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.texture(PImage)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        endContour

        -
        public void endContour()
        -
        -
        Overrides:
        -
        endContour in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape(int mode)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape(). When endshape() - is called, all of image data defined since the previous call to - beginShape() is written into the image buffer. The constant CLOSE - as the value for the MODE parameter to close the shape (to connect the - beginning and the end). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        endShape in class PGraphics
        -
        Parameters:
        -
        mode - use CLOSE to close the shape
        -
        See Also:
        -
        PShape, -PGraphics.beginShape(int)
        -
        -
      • -
      - - - -
        -
      • -

        noClip

        -
        public void noClip()
        -
        -
        Overrides:
        -
        noClip 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)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves. Each call to - bezierVertex() defines the position of two control points and one - anchor point of a Bezier curve, adding a new segment to a line or shape. - The first time bezierVertex() is used within a - beginShape() call, it must be prefaced with a call to - vertex() to set the first anchor point. This function must be - used between beginShape() and endShape() and only when - there is no MODE parameter specified to beginShape(). Using the - 3D version requires rendering with P3D (see the Environment reference - for more information). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        bezierVertex in class PGraphics
        -
        Parameters:
        -
        x2 - the x-coordinate of the 1st control point
        -
        y2 - the y-coordinate of the 1st control point
        -
        z2 - the z-coordinate of the 1st control point
        -
        x3 - the x-coordinate of the 2nd control point
        -
        y3 - the y-coordinate of the 2nd control point
        -
        z3 - the z-coordinate of the 2nd control point
        -
        x4 - the x-coordinate of the anchor point
        -
        y4 - the y-coordinate of the anchor point
        -
        z4 - the z-coordinate of the anchor point
        -
        See Also:
        -
        PGraphics.curveVertex(float, float, float), -PGraphics.vertex(float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float x2,
        -                            float y2,
        -                            float z2,
        -                            float x4,
        -                            float y4,
        -                            float z4)
        -
        -
        Overrides:
        -
        quadraticVertex in class PGraphics
        -
        z2 - the z-coordinate of the control point
        -
        z4 - the z-coordinate of the anchor point
        -
        -
      • -
      - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
        -
        Overrides:
        -
        curveVertex in class PGraphics
        -
        z - the z-coordinate of the vertex
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel. The - first parameter is the horizontal value for the point, the second value - is the vertical value for the point, and the optional third value is the - depth value. Drawing this shape in 3D with the z parameter - requires the P3D parameter in combination with size() as shown in - the above example. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        point in class PGraphics
        -
        Parameters:
        -
        x - x-coordinate of the point
        -
        y - y-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen. The - version of line() with four parameters draws the line in 2D. To - color a line, use the stroke() function. A line cannot be filled, - therefore the fill() function will not affect the color of a - line. 2D lines are drawn with a width of one pixel by default, but this - can be changed with the strokeWeight() function. The version with - six parameters allows the line to be placed anywhere within XYZ space. - Drawing this shape in 3D with the z parameter requires the P3D - parameter in combination with size() as shown in the above example. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        line in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        See Also:
        -
        PGraphics.strokeWeight(float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int), -PGraphics.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        triangle

        -
        public void triangle(float x1,
        -                     float y1,
        -                     float x2,
        -                     float y2,
        -                     float x3,
        -                     float y3)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points. The first two - arguments specify the first point, the middle two arguments specify the - second point, and the last two arguments specify the third point. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        triangle in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        x3 - x-coordinate of the third point
        -
        y3 - y-coordinate of the third point
        -
        See Also:
        -
        PApplet.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        quad

        -
        public void quad(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2,
        -                 float x3,
        -                 float y3,
        -                 float x4,
        -                 float y4)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon. It is similar to a - rectangle, but the angles between its edges are not constrained to - ninety degrees. The first pair of parameters (x1,y1) sets the first - vertex and the subsequent pairs should proceed clockwise or - counter-clockwise around the defined shape. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        quad in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first corner
        -
        y1 - y-coordinate of the first corner
        -
        x2 - x-coordinate of the second corner
        -
        y2 - y-coordinate of the second corner
        -
        x3 - x-coordinate of the third corner
        -
        y3 - y-coordinate of the third corner
        -
        x4 - x-coordinate of the fourth corner
        -
        y4 - y-coordinate of the fourth corner
        -
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float w,
        -                float h,
        -                float d)
        -
        -
        Overrides:
        -
        box in class PGraphics
        -
        Parameters:
        -
        w - dimension of the box in the x-dimension
        -
        h - dimension of the box in the y-dimension
        -
        d - dimension of the box in the z-dimension
        -
        -
      • -
      - - - -
        -
      • -

        sphere

        -
        public void sphere(float r)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles. - - ( end auto-generated ) - -

        Advanced

        -

        - 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
        -
        Parameters:
        -
        r - the radius of the sphere
        -
        See Also:
        -
        PGraphics.sphereDetail(int)
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        textAscent

        -
        public float textAscent()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size. This information - is useful for determining the height of the font above the baseline. For - example, adding the textAscent() and textDescent() values - will give you the total height of the line. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        textAscent in class PGraphics
        -
        See Also:
        -
        PGraphics.textDescent()
        -
        -
      • -
      - - - -
        -
      • -

        textDescent

        -
        public float textDescent()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size. This - information is useful for determining the height of the font below the - baseline. For example, adding the textAscent() and - textDescent() values will give you the total height of the line. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        textDescent in class PGraphics
        -
        See Also:
        -
        PGraphics.textAscent()
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getFontMetrics

        -
        public FontMetrics getFontMetrics(Font font)
        -
        Description copied from class: PGraphics
        -
        Convenience method to get a legit FontMetrics object. Where possible, - override this any renderer subclass so that you're not using what's - returned by getDefaultToolkit() to get your metrics.
        -
        -
        Overrides:
        -
        getFontMetrics in class PGraphics
        -
        -
      • -
      - - - - - - - -
        -
      • -

        popMatrix

        -
        public void popMatrix()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack. - Understanding pushing and popping requires understanding the concept of - a matrix stack. The pushMatrix() function saves the current - coordinate system to the stack and popMatrix() restores the prior - coordinate system. pushMatrix() and popMatrix() are used - in conjuction with the other transformation functions and may be - embedded to control the scope of the transformations. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        popMatrix in class PGraphics
        -
        See Also:
        -
        PGraphics.pushMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float tx,
        -                      float ty)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window. The - x parameter specifies left/right translation, the y - parameter specifies up/down translation, and the z parameter - specifies translations toward/away from the screen. Using this function - with the z parameter requires using P3D as a parameter in - combination with size as shown in the above example. Transformations - apply to everything that happens after and subsequent calls to the - function accumulates the effect. For example, calling translate(50, - 0) and then translate(20, 0) is the same as translate(70, - 0). If translate() is called within draw(), the - transformation is reset when the loop begins again. This function can be - further controlled by the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        translate in class PGraphics
        -
        Parameters:
        -
        tx - left/right translation
        -
        ty - up/down translation
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter. - Angles should be specified in radians (values from 0 to TWO_PI) or - converted to radians with the radians() function. -

        - Objects are always rotated around their relative position to the origin - and positive numbers rotate objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - rotate(HALF_PI) and then rotate(HALF_PI) is the same as - rotate(PI). All tranformations are reset when draw() - begins again. -

        - Technically, rotate() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotate in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateX(PI/2) and then rotateX(PI/2) is the same - as rotateX(PI). If rotateX() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the example above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateX in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateY(PI/2) and then rotateY(PI/2) is the same - as rotateY(PI). If rotateY() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateY in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateZ(PI/2) and then rotateZ(PI/2) is the same - as rotateZ(PI). If rotateZ() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateZ in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle,
        -                   float vx,
        -                   float vy,
        -                   float vz)
        -
        Description copied from class: PGraphics
        -

        Advanced

        - 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
        -
        ( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices. Objects always scale from their relative origin to the - coordinate system. Scale values are specified as decimal percentages. - For example, the function call scale(2.0) increases the dimension - of a shape by 200%. Transformations apply to everything that happens - after and subsequent calls to the function multiply the effect. For - example, calling scale(2.0) and then scale(1.5) is the - same as scale(3.0). If scale() is called within - draw(), the transformation is reset when the loop begins again. - Using this fuction with the z parameter requires using P3D as a - parameter for size() as shown in the example above. This function - can be further controlled by pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        scale in class PGraphics
        -
        Parameters:
        -
        s - percentage to scale the object
        -
        See Also:
        -
        PGraphics.pushMatrix(), -PGraphics.popMatrix(), -PGraphics.translate(float, float, float), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float)
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float sx,
        -                  float sy)
        -
        Description copied from class: PGraphics
        -

        Advanced

        - 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
        -
        Parameters:
        -
        sx - percentage to scale the object in the x-axis
        -
        sy - percentage to scale the object in the y-axis
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float sx,
        -                  float sy,
        -                  float sz)
        -
        -
        Overrides:
        -
        scale in class PGraphics
        -
        sz - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - -
        -
      • -

        shearX

        -
        public void shearX(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearX(PI/2) and then shearX(PI/2) is the same as - shearX(PI). If shearX() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearX() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shearX in class PGraphics
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        public void shearY(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearY(PI/2) and then shearY(PI/2) is the same as - shearY(PI). If shearY() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearY() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shearY in class PGraphics
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearX(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(float n00,
        -                        float n01,
        -                        float n02,
        -                        float n10,
        -                        float n11,
        -                        float n12)
        -
        -
        Overrides:
        -
        applyMatrix in class PGraphics
        -
        Parameters:
        -
        n00 - numbers which define the 4x4 matrix to be multiplied
        -
        n01 - numbers which define the 4x4 matrix to be multiplied
        -
        n02 - numbers which define the 4x4 matrix to be multiplied
        -
        n10 - numbers which define the 4x4 matrix to be multiplied
        -
        n11 - numbers which define the 4x4 matrix to be multiplied
        -
        n12 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Overrides:
        -
        applyMatrix in class PGraphics
        -
        n03 - numbers which define the 4x4 matrix to be multiplied
        -
        n13 - numbers which define the 4x4 matrix to be multiplied
        -
        n20 - numbers which define the 4x4 matrix to be multiplied
        -
        n21 - numbers which define the 4x4 matrix to be multiplied
        -
        n22 - numbers which define the 4x4 matrix to be multiplied
        -
        n23 - numbers which define the 4x4 matrix to be multiplied
        -
        n30 - numbers which define the 4x4 matrix to be multiplied
        -
        n31 - numbers which define the 4x4 matrix to be multiplied
        -
        n32 - numbers which define the 4x4 matrix to be multiplied
        -
        n33 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - - - - - -
        -
      • -

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

        screenX

        -
        public float screenX(float x,
        -                     float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenX in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenY(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenY in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenX in class PGraphics
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenY in class PGraphics
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenZ

        -
        public float screenZ(float x,
        -                     float y,
        -                     float z)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenZ in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenY(float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        strokeJoin

        -
        public void strokeJoin(int join)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments. These joints - are either mitered, beveled, or rounded and specified with the - corresponding parameters MITER, BEVEL, and ROUND. The default joint is - MITER. -

        - This function is not available with the P3D renderer, (see - Issue 123). More information about the renderers can be found in the - size() reference. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        strokeJoin in class PGraphics
        -
        Parameters:
        -
        join - either MITER, BEVEL, ROUND
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeWeight(float), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        strokeWeight

        -
        public void strokeWeight(float weight)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes. All widths are set in units of pixels. -

        - When drawing with P3D, series of connected lines (such as the stroke - around a polygon, triangle, or ellipse) produce unattractive results - when a thick stroke weight is set (see - Issue 123). With P3D, the minimum and maximum values for - strokeWeight() are controlled by the graphics card and the - operating system's OpenGL implementation. For instance, the thickness - may not go higher than 10 pixels. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        strokeWeight in class PGraphics
        -
        Parameters:
        -
        weight - the weight (in pixels) of the stroke
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        ( begin auto-generated from PImage_loadPixels.xml ) - - Loads the pixel data for the image into its pixels[] array. This - function must always be called before reading from or writing to pixels[]. -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. - - ( end auto-generated ) - -

        Advanced

        - 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(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
        -
        Parameters:
        -
        x - x-coordinate of the upper-left corner
        -
        y - y-coordinate of the upper-left corner
        -
        c - width
        -
        d - height
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get(int x,
        -               int y)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image. If no - parameters are specified, the entire image is returned. Use the x - and y parameters to get the value of one pixel. Get a section of - the display window by specifying an additional width and - height parameter. When getting an image, the x and - y parameters define the coordinates for the upper-left corner of - the image, regardless of the current imageMode().
        -
        - If the pixel requested is outside of the image window, black is - returned. The numbers returned are scaled according to the current color - ranges, but only RGB values are returned by this function. For example, - even though you may have drawn a shape with colorMode(HSB), the - numbers returned will be in RGB format.
        -
        - Getting the color of a single pixel with get(x, y) is easy, but - not as fast as grabbing the data directly from pixels[]. The - equivalent statement to get(x, y) using pixels[] is - pixels[y*width+x]. See the reference for pixels[] for more information. - - ( end auto-generated ) - -

        Advanced

        - 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
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        See Also:
        -
        PApplet.set(int, int, int), -PApplet.pixels, -PApplet.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public PImage get()
        -
        Description copied from class: PImage
        -
        Returns a copy of this PImage. Equivalent to get(0, 0, width, height). - Deprecated, just use copy() instead.
        -
        -
        Overrides:
        -
        get in class PImage
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                int argb)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
        -
        - The x and y parameters specify the pixel to change and the - color parameter specifies the color value. The color parameter is - affected by the current color mode (the default is RGB values from 0 to - 255). When setting an image, the x and y parameters define - the coordinates for the upper-left corner of the image, regardless of - the current imageMode(). -

        - Setting the color of a single pixel with set(x, y) is easy, but - not as fast as putting the data directly into pixels[]. The - equivalent statement to set(x, y, #000000) using pixels[] - is pixels[y*width+x] = #000000. See the reference for - pixels[] for more information. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        set in class PImage
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        argb - any value of the color datatype
        -
        See Also:
        -
        PImage.get(int, int, int, int), -PImage.pixels, -PImage.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        mask

        -
        public void mask(int[] alpha)
        -
        -
        Overrides:
        -
        mask in class PImage
        -
        -
      • -
      - - - -
        -
      • -

        mask

        -
        public void mask(PImage alpha)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel. This mask image should only contain - grayscale data, but only the blue color channel is used. The mask image - needs to be the same size as the image to which it is applied.
        -
        - In addition to using a mask image, an integer array containing the alpha - channel data can be specified directly. This method is useful for - creating dynamically generated alpha masks. This array must be of the - same length as the target image's pixels array and should contain only - grayscale data of values between 0-255. - - ( end auto-generated ) - -

        Advanced

        - - 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" grayscale by - performing a proper luminance-based conversion.

        -
        -
        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
        -
        ( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another. If the source and - destination regions aren't the same size, it will automatically resize - source pixels to fit the specified target region. No alpha information - is used in the process, however if the source image has an alpha channel - set, it will be copied as well. -

        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        copy in class PImage
        -
        Parameters:
        -
        sx - X coordinate of the source's upper left corner
        -
        sy - Y coordinate of the source's upper left corner
        -
        sw - source image width
        -
        sh - source image height
        -
        dx - X coordinate of the destination's upper left corner
        -
        dy - Y coordinate of the destination's upper left corner
        -
        dw - destination image width
        -
        dh - destination image height
        -
        See Also:
        -
        PGraphics.alpha(int), -PImage.blend(PImage, int, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(PImage src,
        -                 int sx,
        -                 int sy,
        -                 int sw,
        -                 int sh,
        -                 int dx,
        -                 int dy,
        -                 int dw,
        -                 int dh)
        -
        -
        Overrides:
        -
        copy in class PImage
        -
        Parameters:
        -
        src - an image variable referring to the source image.
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PImage.html b/build/javadoc/core/processing/core/PImage.html deleted file mode 100644 index 07f2b8acf7..0000000000 --- a/build/javadoc/core/processing/core/PImage.html +++ /dev/null @@ -1,1786 +0,0 @@ - - - - - -PImage - - - - - - - - - - - -
-
processing.core
-

Class PImage

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Cloneable, PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    PGraphics
    -
    -
    -
    -
    public class PImage
    -extends Object
    -implements PConstants, Cloneable
    -
    ( begin auto-generated from PImage.xml ) - - Datatype for storing images. Processing can display .gif, - .jpg, .tga, and .png images. Images may be - displayed in 2D and 3D space. Before an image is used, it must be loaded - with the loadImage() function. The PImage class contains - fields for the width and height of the image, as well as - an array called pixels[] that contains the values for every pixel - in the image. The methods described below allow easy access to the - image's pixels and alpha channel and simplify the process of compositing.
    -
    using the pixels[] array, be sure to use the - loadPixels() method on the image to make sure that the pixel data - is properly loaded.
    -
    create a new image, use the createImage() function. Do not - use the syntax new PImage(). - - ( end auto-generated )
    -
    -
    See Also:
    -
    PApplet.loadImage(String), -PApplet.imageMode(int), -PApplet.createImage(int, int, int)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      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
        -
        ( begin auto-generated from pixels.xml ) - - Array containing the values for all the pixels in the display window. - These values are of the color datatype. This array is the size of the - display window. For example, if the image is 100x100 pixels, there will - be 10000 values and if the window is 200x300 pixels, there will be 60000 - values. The index value defines the position of a value within - the array. For example, the statement color b = pixels[230] will - set the variable b to be equal to the value at that location in - the array.
        -
        - Before accessing this array, the data must loaded with the - loadPixels() function. After the array data has been modified, - the updatePixels() function must be run to update the changes. - Without loadPixels(), running the code may (or will in future - releases) result in a NullPointerException. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        pixelDensity

        -
        public int pixelDensity
        -
        1 for most images, 2 for hi-dpi/retina
        -
      • -
      - - - -
        -
      • -

        pixelWidth

        -
        public int pixelWidth
        -
        Actual dimensions of pixels array, taking into account the 2x setting.
        -
      • -
      - - - -
        -
      • -

        pixelHeight

        -
        public int pixelHeight
        -
      • -
      - - - -
        -
      • -

        width

        -
        public int width
        -
        ( begin auto-generated from PImage_width.xml ) - - The width of the image in units of pixels. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        height

        -
        public int height
        -
        ( begin auto-generated from PImage_height.xml ) - - The height of the image in units of pixels. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        parent

        -
        public PApplet parent
        -
        Path to parent object that will be used with save(). - This prevents users from needing savePath() to use PImage.save().
        -
      • -
      - - - -
        -
      • -

        loaded

        -
        public boolean loaded
        -
        Loaded pixels flag
        -
      • -
      - - - - - - - - - - - - - - - - -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PImage

        -
        public PImage()
        -
        ( begin auto-generated from PImage.xml ) - - Datatype for storing images. Processing can display .gif, - .jpg, .tga, and .png images. Images may be - displayed in 2D and 3D space. Before an image is used, it must be loaded - with the loadImage() function. The PImage object contains - fields for the width and height of the image, as well as - an array called pixels[] which contains the values for every - pixel in the image. A group of methods, described below, allow easy - access to the image's pixels and alpha channel and simplify the process - of compositing. -

        - Before using the pixels[] array, be sure to use the - loadPixels() method on the image to make sure that the pixel data - is properly loaded. -

        - To create a new image, use the createImage() function (do not use - new PImage()). - ( end auto-generated )
        -
        -
        See Also:
        -
        PApplet.loadImage(String, String), -PApplet.imageMode(int), -PApplet.createImage(int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        PImage

        -
        public PImage(int width,
        -              int height)
        -
        -
        Parameters:
        -
        width - image width
        -
        height - image height
        -
        -
      • -
      - - - -
        -
      • -

        PImage

        -
        public PImage(int width,
        -              int height,
        -              int format)
        -
        -
        Parameters:
        -
        format - Either RGB, ARGB, ALPHA (grayscale alpha channel)
        -
        -
      • -
      - - - -
        -
      • -

        PImage

        -
        public PImage(int width,
        -              int height,
        -              int format,
        -              int factor)
        -
      • -
      - - - -
        -
      • -

        PImage

        -
        public PImage(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.
        -
        -
        Parameters:
        -
        img - assumes a MediaTracker has been used to fully download - the data and the img is valid
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        init

        -
        public void init(int width,
        -                 int height,
        -                 int format)
        -
        Do not remove, see notes in the other variant.
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init(int width,
        -                 int height,
        -                 int format,
        -                 int factor)
        -
        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

        -
        @Deprecated
        -public Image getImage()
        -
        Deprecated. 
        -
        Use the getNative() method instead, which allows library interfaces to be - written in a cross-platform fashion for desktop, Android, and others.
        -
      • -
      - - - -
        -
      • -

        getNative

        -
        public Object getNative()
        -
        Returns a native BufferedImage from this PImage.
        -
      • -
      - - - -
        -
      • -

        isModified

        -
        public boolean isModified()
        -
      • -
      - - - -
        -
      • -

        setModified

        -
        public void setModified()
        -
      • -
      - - - -
        -
      • -

        setModified

        -
        public void setModified(boolean m)
        -
      • -
      - - - -
        -
      • -

        getModifiedX1

        -
        public int getModifiedX1()
        -
      • -
      - - - -
        -
      • -

        getModifiedX2

        -
        public int getModifiedX2()
        -
      • -
      - - - -
        -
      • -

        getModifiedY1

        -
        public int getModifiedY1()
        -
      • -
      - - - -
        -
      • -

        getModifiedY2

        -
        public int getModifiedY2()
        -
      • -
      - - - -
        -
      • -

        loadPixels

        -
        public void loadPixels()
        -
        ( begin auto-generated from PImage_loadPixels.xml ) - - Loads the pixel data for the image into its pixels[] array. This - function must always be called before reading from or writing to pixels[]. -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. - - ( end auto-generated ) - -

        Advanced

        - 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()
        -
      • -
      - - - -
        -
      • -

        updatePixels

        -
        public void updatePixels(int x,
        -                         int y,
        -                         int w,
        -                         int h)
        -
        ( begin auto-generated from PImage_updatePixels.xml ) - - Updates the image with the data in its pixels[] array. Use in - conjunction with loadPixels(). If you're only reading pixels from - the array, there's no need to call updatePixels(). -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. -

        - Currently, none of the renderers use the additional parameters to - updatePixels(), however this may be implemented in the future. - - ( end auto-generated ) -

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        x - x-coordinate of the upper-left corner
        -
        y - y-coordinate of the upper-left corner
        -
        w - width
        -
        h - height
        -
        -
      • -
      - - - -
        -
      • -

        clone

        -
        public Object clone()
        -             throws 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 Object
        -
        Throws:
        -
        CloneNotSupportedException
        -
        -
      • -
      - - - -
        -
      • -

        resize

        -
        public void resize(int w,
        -                   int h)
        -
        ( begin auto-generated from PImage_resize.xml ) - - Resize the image to a new width and height. To make the image scale - proportionally, use 0 as the value for the wide or high - parameter. For instance, to make the width of an image 150 pixels, and - change the height using the same proportion, use resize(150, 0).
        -
        - Even though a PGraphics is technically a PImage, it is not possible to - rescale the image data found in a PGraphics. (It's simply not possible - to do this consistently across renderers: technically infeasible with - P3D, or what would it even do with PDF?) If you want to resize PGraphics - content, first get a copy of its image data using the get() - method, and call resize() on the PImage that is returned. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        w - the resized image width
        -
        h - the resized image height
        -
        See Also:
        -
        get(int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        isLoaded

        -
        public boolean isLoaded()
        -
      • -
      - - - -
        -
      • -

        setLoaded

        -
        public void setLoaded()
        -
      • -
      - - - -
        -
      • -

        setLoaded

        -
        public void setLoaded(boolean l)
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get(int x,
        -               int y)
        -
        ( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image. If no - parameters are specified, the entire image is returned. Use the x - and y parameters to get the value of one pixel. Get a section of - the display window by specifying an additional width and - height parameter. When getting an image, the x and - y parameters define the coordinates for the upper-left corner of - the image, regardless of the current imageMode().
        -
        - If the pixel requested is outside of the image window, black is - returned. The numbers returned are scaled according to the current color - ranges, but only RGB values are returned by this function. For example, - even though you may have drawn a shape with colorMode(HSB), the - numbers returned will be in RGB format.
        -
        - Getting the color of a single pixel with get(x, y) is easy, but - not as fast as grabbing the data directly from pixels[]. The - equivalent statement to get(x, y) using pixels[] is - pixels[y*width+x]. See the reference for pixels[] for more information. - - ( end auto-generated ) - -

        Advanced

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

        -
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        See Also:
        -
        PApplet.set(int, int, int), -PApplet.pixels, -PApplet.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public PImage get(int x,
        -                  int y,
        -                  int w,
        -                  int h)
        -
        -
        Parameters:
        -
        w - width of pixel rectangle to get
        -
        h - height of pixel rectangle to get
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public PImage get()
        -
        Returns a copy of this PImage. Equivalent to get(0, 0, width, height). - Deprecated, just use copy() instead.
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public PImage copy()
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                int c)
        -
        ( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
        -
        - The x and y parameters specify the pixel to change and the - color parameter specifies the color value. The color parameter is - affected by the current color mode (the default is RGB values from 0 to - 255). When setting an image, the x and y parameters define - the coordinates for the upper-left corner of the image, regardless of - the current imageMode(). -

        - Setting the color of a single pixel with set(x, y) is easy, but - not as fast as putting the data directly into pixels[]. The - equivalent statement to set(x, y, #000000) using pixels[] - is pixels[y*width+x] = #000000. See the reference for - pixels[] for more information. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        c - any value of the color datatype
        -
        See Also:
        -
        get(int, int, int, int), -pixels, -copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                PImage img)
        -

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        img - image to copy into the original image
        -
        -
      • -
      - - - -
        -
      • -

        mask

        -
        @Deprecated
        -public void mask(int[] maskArray)
        -
        Deprecated. 
        -
      • -
      - - - -
        -
      • -

        mask

        -
        public void mask(PImage img)
        -
        ( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel. This mask image should only contain - grayscale data, but only the blue color channel is used. The mask image - needs to be the same size as the image to which it is applied.
        -
        - In addition to using a mask image, an integer array containing the alpha - channel data can be specified directly. This method is useful for - creating dynamically generated alpha masks. This array must be of the - same length as the target image's pixels array and should contain only - grayscale data of values between 0-255. - - ( end auto-generated ) - -

        Advanced

        - - 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" grayscale by - performing a proper luminance-based conversion.

        -
        -
        Parameters:
        -
        maskArray - array of integers used as the alpha channel, needs to be the same length as the image's pixel array
        -
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(int kind)
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(int kind,
        -                   float param)
        -
        ( begin auto-generated from PImage_filter.xml ) - - Filters an image as defined by one of the following modes:

        THRESHOLD - converts the image to black and white pixels depending if - they are above or below the threshold defined by the level parameter. - The level must be between 0.0 (black) and 1.0(white). If no level is - specified, 0.5 is used.
        -
        - GRAY - converts any colors in the image to grayscale equivalents
        -
        - INVERT - sets each pixel to its inverse value
        -
        - POSTERIZE - limits each channel of the image to the number of colors - specified as the level parameter
        -
        - BLUR - executes a Guassian blur with the level parameter specifying the - extent of the blurring. If no level parameter is used, the blur is - equivalent to Guassian blur of radius 1
        -
        - OPAQUE - sets the alpha channel to entirely opaque
        -
        - ERODE - reduces the light areas with the amount defined by the level - parameter
        -
        - DILATE - increases the light areas with the amount defined by the level parameter - - ( end auto-generated ) - -

        Advanced

        - 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

        -
        -
        Parameters:
        -
        kind - Either THRESHOLD, GRAY, OPAQUE, INVERT, POSTERIZE, BLUR, ERODE, or DILATE
        -
        param - unique for each, see above
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(int sx,
        -                 int sy,
        -                 int sw,
        -                 int sh,
        -                 int dx,
        -                 int dy,
        -                 int dw,
        -                 int dh)
        -
        ( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another. If the source and - destination regions aren't the same size, it will automatically resize - source pixels to fit the specified target region. No alpha information - is used in the process, however if the source image has an alpha channel - set, it will be copied as well. -

        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        sx - X coordinate of the source's upper left corner
        -
        sy - Y coordinate of the source's upper left corner
        -
        sw - source image width
        -
        sh - source image height
        -
        dx - X coordinate of the destination's upper left corner
        -
        dy - Y coordinate of the destination's upper left corner
        -
        dw - destination image width
        -
        dh - destination image height
        -
        See Also:
        -
        PGraphics.alpha(int), -blend(PImage, int, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(PImage src,
        -                 int sx,
        -                 int sy,
        -                 int sw,
        -                 int sh,
        -                 int dx,
        -                 int dy,
        -                 int dw,
        -                 int dh)
        -
        -
        Parameters:
        -
        src - an image variable referring to the source image.
        -
        -
      • -
      - - - -
        -
      • -

        blendColor

        -
        public static int blendColor(int c1,
        -                             int c2,
        -                             int mode)
        -
        ( begin auto-generated from blendColor.xml ) - - Blends two color values together based on the blending mode given as the - MODE parameter. The possible modes are described in the reference - for the blend() function. - - ( end auto-generated ) -

        Advanced

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

        -
        -
        Parameters:
        -
        c1 - the first color to blend
        -
        c2 - the second color to blend
        -
        mode - either BLEND, ADD, SUBTRACT, DARKEST, LIGHTEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, or BURN
        -
        See Also:
        -
        blend(PImage, int, int, int, int, int, int, int, int, int), -PApplet.color(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from PImage_blend.xml ) - - Blends a region of pixels into the image specified by the img - parameter. These copies utilize full alpha channel support and a choice - of the following modes to blend the colors of source pixels (A) with the - ones of pixels in the destination image (B):
        -
        - BLEND - linear interpolation of colours: C = A*factor + B
        -
        - ADD - additive blending with white clip: C = min(A*factor + B, 255)
        -
        - SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, - 0)
        -
        - DARKEST - only the darkest colour succeeds: C = min(A*factor, B)
        -
        - LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)
        -
        - 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.
        -
        - All modes use the alpha information (highest byte) of source image - pixels as the blending factor. If the source and destination regions are - different sizes, the image will be automatically resized to match the - destination size. If the srcImg parameter is not used, the - display window is used as the source image.
        -
        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        src - an image variable referring to the source image
        -
        sx - X coordinate of the source's upper left corner
        -
        sy - Y coordinate of the source's upper left corner
        -
        sw - source image width
        -
        sh - source image height
        -
        dx - X coordinate of the destinations's upper left corner
        -
        dy - Y coordinate of the destinations's upper left corner
        -
        dw - destination image width
        -
        dh - destination image height
        -
        mode - Either BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN
        -
        See Also:
        -
        PApplet.alpha(int), -copy(PImage, int, int, int, int, int, int, int, int), -blendColor(int,int,int)
        -
        -
      • -
      - - - -
        -
      • -

        save

        -
        public boolean save(String filename)
        -
        ( begin auto-generated from PImage_save.xml ) - - Saves the image into a file. Images are saved in TIFF, TARGA, JPEG, and - PNG format depending on the extension within the filename - parameter. For example, "image.tif" will have a TIFF image and - "image.png" will save a PNG image. If no extension is included in the - filename, the image will save in TIFF format and .tif will be - added to the name. These files are saved to the sketch's folder, which - may be opened by selecting "Show sketch folder" from the "Sketch" menu. - It is not possible to use save() while running the program in a - web browser.

        To save an image created within the code, rather - than through loading, it's necessary to make the image with the - createImage() function so it is aware of the location of the - program and can therefore save the file to the right place. See the - createImage() reference for more information. - - ( end auto-generated ) -

        Advanced

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

        -
        -
        Parameters:
        -
        filename - a sequence of letters and numbers
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PMatrix.html b/build/javadoc/core/processing/core/PMatrix.html deleted file mode 100644 index 130d92602f..0000000000 --- a/build/javadoc/core/processing/core/PMatrix.html +++ /dev/null @@ -1,826 +0,0 @@ - - - - - -PMatrix - - - - - - - - - - - -
-
processing.core
-

Interface PMatrix

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    PMatrix2D, PMatrix3D
    -
    -
    -
    -
    public interface PMatrix
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      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(PMatrix left) -
      Apply another matrix to the left of this one.
      -
      voidpreApply(PMatrix2D left) 
      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) 
      voidshearX(float angle) 
      voidshearY(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)
        -
      • -
      - - - -
        -
      • -

        shearX

        -
        void shearX(float angle)
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        void shearY(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(PMatrix left)
        -
        Apply another matrix to the left of this one.
        -
      • -
      - - - -
        -
      • -

        preApply

        -
        void preApply(PMatrix2D left)
        -
      • -
      - - - -
        -
      • -

        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

        -
        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 deleted file mode 100644 index bf3d1c9b1e..0000000000 --- a/build/javadoc/core/processing/core/PMatrix2D.html +++ /dev/null @@ -1,1204 +0,0 @@ - - - - - -PMatrix2D - - - - - - - - - - - -
-
processing.core
-

Class PMatrix2D

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PMatrix
    -
    -
    -
    -
    public class PMatrix2D
    -extends Object
    -implements PMatrix
    -
    3x2 affine matrix implementation.
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      floatm00 
      floatm01 
      floatm02 
      floatm10 
      floatm11 
      floatm12 
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      Constructor and Description
      PMatrix2D() 
      PMatrix2D(float m00, - float m01, - float m02, - float m10, - float m11, - float m12) 
      PMatrix2D(PMatrix matrix) 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      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(PMatrix source) -
      Apply another matrix to the left of this one.
      -
      voidpreApply(PMatrix2D left) 
      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) 
      voidshearX(float angle) 
      voidshearY(float angle) 
      voidtranslate(float tx, - float ty) 
      voidtranslate(float x, - float y, - float z) 
      voidtranspose() -
      Transpose this matrix.
      -
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

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

        shearX

        -
        public void shearX(float angle)
        -
        -
        Specified by:
        -
        shearX in interface PMatrix
        -
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        public void shearY(float angle)
        -
        -
        Specified by:
        -
        shearY 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(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(PMatrix source)
        -
        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)
        -
        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 deleted file mode 100644 index 56925e113e..0000000000 --- a/build/javadoc/core/processing/core/PMatrix3D.html +++ /dev/null @@ -1,1507 +0,0 @@ - - - - - -PMatrix3D - - - - - - - - - - - -
-
processing.core
-

Class PMatrix3D

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PMatrix
    -
    -
    -
    -
    public final class PMatrix3D
    -extends Object
    -implements PMatrix
    -
    4x4 matrix implementation.
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      floatm00 
      floatm01 
      floatm02 
      floatm03 
      floatm10 
      floatm11 
      floatm12 
      floatm13 
      floatm20 
      floatm21 
      floatm22 
      floatm23 
      floatm30 
      floatm31 
      floatm32 
      floatm33 
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - -
      Constructors 
      Constructor and Description
      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

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      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(PMatrix source) -
      Apply another matrix to the left of this one.
      -
      voidpreApply(PMatrix2D left) 
      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) 
      voidshearX(float angle) 
      voidshearY(float angle) 
      voidtranslate(float tx, - float ty) 
      voidtranslate(float tx, - float ty, - float tz) 
      voidtranspose() -
      Transpose this matrix.
      -
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

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

        shearX

        -
        public void shearX(float angle)
        -
        -
        Specified by:
        -
        shearX in interface PMatrix
        -
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        public void shearY(float angle)
        -
        -
        Specified by:
        -
        shearY 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(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(PMatrix source)
        -
        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/PShape.html b/build/javadoc/core/processing/core/PShape.html deleted file mode 100644 index f9b8e5b6c4..0000000000 --- a/build/javadoc/core/processing/core/PShape.html +++ /dev/null @@ -1,3557 +0,0 @@ - - - - - -PShape - - - - - - - - - - - -
-
processing.core
-

Class PShape

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    PShapeOBJ, PShapeOpenGL, PShapeSVG
    -
    -
    -
    -
    public class PShape
    -extends Object
    -implements PConstants
    -
    ( begin auto-generated from PShape.xml ) - - Datatype for storing shapes. Processing can currently load and display - SVG (Scalable Vector Graphics) shapes. Before a shape is used, it must - be loaded with the loadShape() function. The shape() - function is used to draw the shape to the display window. The - PShape object contain a group of methods, linked below, that can - operate on the shape data. -

    - The loadShape() function supports SVG files created with Inkscape - and Adobe Illustrator. It is not a full SVG implementation, but offers - some straightforward support for handling vector data. - - ( end auto-generated ) -

    Advanced

    - - 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().

    -
    -
    See Also:
    -
    PApplet.loadShape(String), -PApplet.createShape(), -PApplet.shapeMode(int)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        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
        -
        ( begin auto-generated from PShape_width.xml ) - - The width of the PShape document. - - ( end auto-generated )
        -
        -
        See Also:
        -
        height
        -
        -
      • -
      - - - -
        -
      • -

        height

        -
        public float height
        -
        ( begin auto-generated from PShape_height.xml ) - - The height of the PShape document. - - ( end auto-generated )
        -
        -
        See Also:
        -
        width
        -
        -
      • -
      - - - -
        -
      • -

        depth

        -
        public float depth
        -
      • -
      - - - -
        -
      • -

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

      Constructor Detail

      - - - -
        -
      • -

        PShape

        -
        public PShape()
        -
      • -
      - - - -
        -
      • -

        PShape

        -
        public PShape(int family)
        -
      • -
      - - - -
        -
      • -

        PShape

        -
        public PShape(PGraphics g,
        -              int family)
        -
      • -
      - - - -
        -
      • -

        PShape

        -
        public PShape(PGraphics g,
        -              int kind,
        -              float... params)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setFamily

        -
        public void setFamily(int family)
        -
      • -
      - - - -
        -
      • -

        setKind

        -
        public void setKind(int kind)
        -
      • -
      - - - -
        -
      • -

        setName

        -
        public void setName(String name)
        -
      • -
      - - - -
        -
      • -

        getName

        -
        public String getName()
        -
      • -
      - - - -
        -
      • -

        isVisible

        -
        public boolean isVisible()
        -
        ( begin auto-generated from PShape_isVisible.xml ) - - Returns a boolean value "true" if the image is set to be visible, - "false" if not. This is modified with the setVisible() parameter. -

        - The visibility of a shape is usually controlled by whatever program - created the SVG file. For instance, this parameter is controlled by - showing or hiding the shape in the layers palette in Adobe Illustrator. - - ( end auto-generated )
        -
        -
        See Also:
        -
        setVisible(boolean)
        -
        -
      • -
      - - - -
        -
      • -

        setVisible

        -
        public void setVisible(boolean visible)
        -
        ( begin auto-generated from PShape_setVisible.xml ) - - Sets the shape to be visible or invisible. This is determined by the - value of the visible parameter. -

        - The visibility of a shape is usually controlled by whatever program - created the SVG file. For instance, this parameter is controlled by - showing or hiding the shape in the layers palette in Adobe Illustrator. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        visible - "false" makes the shape invisible and "true" makes it visible
        -
        See Also:
        -
        isVisible()
        -
        -
      • -
      - - - -
        -
      • -

        disableStyle

        -
        public void disableStyle()
        -
        ( begin auto-generated from PShape_disableStyle.xml ) - - Disables the shape's style data and uses Processing's current styles. - Styles include attributes such as colors, stroke weight, and stroke - joints. - - ( end auto-generated ) -

        Advanced

        - Overrides this shape's style information and uses PGraphics styles and - colors. Identical to ignoreStyles(true). Also disables styles for all - child shapes.
        -
        -
        See Also:
        -
        enableStyle()
        -
        -
      • -
      - - - -
        -
      • -

        enableStyle

        -
        public void enableStyle()
        -
        ( begin auto-generated from PShape_enableStyle.xml ) - - Enables the shape's style data and ignores Processing's current styles. - Styles include attributes such as colors, stroke weight, and stroke - joints. - - ( end auto-generated )
        -
        -
        See Also:
        -
        disableStyle()
        -
        -
      • -
      - - - -
        -
      • -

        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).
        -
      • -
      - - - -
        -
      • -

        getDepth

        -
        public float getDepth()
        -
        Get the depth of the shape area (not necessarily the shape boundary). Only makes sense for 3D PShape subclasses, - such as PShape3D.
        -
      • -
      - - - -
        -
      • -

        is2D

        -
        public boolean is2D()
        -
        Return true if this shape is 2D. Defaults to true.
        -
      • -
      - - - -
        -
      • -

        is3D

        -
        public boolean is3D()
        -
        Return true if this shape is 3D. Defaults to false.
        -
      • -
      - - - -
        -
      • -

        set3D

        -
        public void set3D(boolean val)
        -
      • -
      - - - -
        -
      • -

        textureMode

        -
        public void textureMode(int mode)
        -
      • -
      - - - -
        -
      • -

        texture

        -
        public void texture(PImage tex)
        -
      • -
      - - - -
        -
      • -

        noTexture

        -
        public void noTexture()
        -
      • -
      - - - -
        -
      • -

        beginContour

        -
        public void beginContour()
        -
        -
        See Also:
        -
        endContour()
        -
        -
      • -
      - - - -
        -
      • -

        endContour

        -
        public void endContour()
        -
        -
        See Also:
        -
        beginContour()
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y)
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float u,
        -                   float v)
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float z)
        -
      • -
      - - - -
        -
      • -

        vertex

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

        normal

        -
        public void normal(float nx,
        -                   float ny,
        -                   float nz)
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   float... values)
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   int... values)
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   boolean... values)
        -
      • -
      - - - - - - - -
        -
      • -

        beginShape

        -
        public void beginShape(int kind)
        -
      • -
      - - - - - - - -
        -
      • -

        endShape

        -
        public void endShape(int mode)
        -
      • -
      - - - -
        -
      • -

        strokeWeight

        -
        public void strokeWeight(float weight)
        -
      • -
      - - - -
        -
      • -

        strokeJoin

        -
        public void strokeJoin(int join)
        -
      • -
      - - - -
        -
      • -

        strokeCap

        -
        public void strokeCap(int cap)
        -
      • -
      - - - -
        -
      • -

        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)
        -
      • -
      - - - -
        -
      • -

        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 alpha)
        -
      • -
      - - - -
        -
      • -

        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 alpha)
        -
      • -
      - - - -
        -
      • -

        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)
        -
      • -
      - - - -
        -
      • -

        emissive

        -
        public void emissive(int rgb)
        -
      • -
      - - - -
        -
      • -

        emissive

        -
        public void emissive(float gray)
        -
      • -
      - - - -
        -
      • -

        emissive

        -
        public void emissive(float x,
        -                     float y,
        -                     float z)
        -
      • -
      - - - -
        -
      • -

        shininess

        -
        public void shininess(float shine)
        -
      • -
      - - - -
        -
      • -

        bezierDetail

        -
        public void bezierDetail(int detail)
        -
      • -
      - - - -
        -
      • -

        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)
        -
      • -
      - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float cx,
        -                            float cy,
        -                            float x3,
        -                            float y3)
        -
      • -
      - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float cx,
        -                            float cy,
        -                            float cz,
        -                            float x3,
        -                            float y3,
        -                            float z3)
        -
      • -
      - - - -
        -
      • -

        curveDetail

        -
        public void curveDetail(int detail)
        -
      • -
      - - - -
        -
      • -

        curveTightness

        -
        public void curveTightness(float tightness)
        -
      • -
      - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y)
        -
      • -
      - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
      • -
      - - - -
        -
      • -

        draw

        -
        public void draw(PGraphics g)
        -
        Called by the following (the shape() command adds the g) - PShape s = loadShape("blah.svg"); - shape(s);
        -
      • -
      - - - -
        -
      • -

        getParent

        -
        public PShape getParent()
        -
      • -
      - - - -
        -
      • -

        getChildCount

        -
        public int getChildCount()
        -
      • -
      - - - -
        -
      • -

        getChildren

        -
        public PShape[] getChildren()
        -
      • -
      - - - -
        -
      • -

        getChild

        -
        public PShape getChild(int index)
        -
        ( begin auto-generated from PShape_getChild.xml ) - - Extracts a child shape from a parent shape. Specify the name of the - shape with the target parameter. The shape is returned as a - PShape object, or null is returned if there is an error. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        index - the layer position of the shape to get
        -
        See Also:
        -
        addChild(PShape)
        -
        -
      • -
      - - - -
        -
      • -

        getChild

        -
        public PShape getChild(String target)
        -
        -
        Parameters:
        -
        target - the name of the shape to get
        -
        -
      • -
      - - - -
        -
      • -

        findChild

        -
        public PShape findChild(String target)
        -
        Same as getChild(name), except that it first walks all the way up the - hierarchy to the eldest grandparent, so that children can be found anywhere.
        -
      • -
      - - - -
        -
      • -

        addChild

        -
        public void addChild(PShape who)
        -
        -
        Parameters:
        -
        who - any variable of type PShape
        -
        See Also:
        -
        getChild(int)
        -
        -
      • -
      - - - -
        -
      • -

        addChild

        -
        public void addChild(PShape who,
        -                     int idx)
        -
        -
        Parameters:
        -
        idx - the layer position in which to insert the new child
        -
        -
      • -
      - - - -
        -
      • -

        removeChild

        -
        public void removeChild(int idx)
        -
        Remove the child shape with index idx.
        -
      • -
      - - - -
        -
      • -

        addName

        -
        public void addName(String nom,
        -                    PShape shape)
        -
        Add a shape to the name lookup table.
        -
      • -
      - - - -
        -
      • -

        getChildIndex

        -
        public int getChildIndex(PShape who)
        -
        Returns the index of child who.
        -
      • -
      - - - -
        -
      • -

        getTessellation

        -
        public PShape getTessellation()
        -
      • -
      - - - -
        -
      • -

        getFamily

        -
        public int getFamily()
        -
        The shape type, one of GROUP, PRIMITIVE, PATH, or GEOMETRY.
        -
      • -
      - - - -
        -
      • -

        getKind

        -
        public int getKind()
        -
      • -
      - - - -
        -
      • -

        getParams

        -
        public float[] getParams()
        -
      • -
      - - - -
        -
      • -

        getParams

        -
        public float[] getParams(float[] target)
        -
      • -
      - - - -
        -
      • -

        getParam

        -
        public float getParam(int index)
        -
      • -
      - - - -
        -
      • -

        setPath

        -
        public void setPath(int vcount,
        -                    float[][] verts)
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getVertex

        -
        public PVector getVertex(int index,
        -                         PVector vec)
        -
        -
        Parameters:
        -
        vec - PVector to assign the data to
        -
        -
      • -
      - - - -
        -
      • -

        getVertexX

        -
        public float getVertexX(int index)
        -
      • -
      - - - -
        -
      • -

        getVertexY

        -
        public float getVertexY(int index)
        -
      • -
      - - - -
        -
      • -

        getVertexZ

        -
        public float getVertexZ(int index)
        -
      • -
      - - - -
        -
      • -

        setVertex

        -
        public void setVertex(int index,
        -                      float x,
        -                      float y)
        -
        -
        Parameters:
        -
        index - the location of the vertex
        -
        x - the x value for the vertex
        -
        y - the y value for the vertex
        -
        See Also:
        -
        getVertex(int), -getVertexCount()
        -
        -
      • -
      - - - -
        -
      • -

        setVertex

        -
        public void setVertex(int index,
        -                      float x,
        -                      float y,
        -                      float z)
        -
        -
        Parameters:
        -
        z - the z value for the vertex
        -
        -
      • -
      - - - -
        -
      • -

        setVertex

        -
        public void setVertex(int index,
        -                      PVector vec)
        -
        -
        Parameters:
        -
        vec - the PVector to define the x, y, z coordinates
        -
        -
      • -
      - - - -
        -
      • -

        getNormal

        -
        public PVector getNormal(int index)
        -
      • -
      - - - -
        -
      • -

        getNormal

        -
        public PVector getNormal(int index,
        -                         PVector vec)
        -
      • -
      - - - -
        -
      • -

        getNormalX

        -
        public float getNormalX(int index)
        -
      • -
      - - - -
        -
      • -

        getNormalY

        -
        public float getNormalY(int index)
        -
      • -
      - - - -
        -
      • -

        getNormalZ

        -
        public float getNormalZ(int index)
        -
      • -
      - - - -
        -
      • -

        setNormal

        -
        public void setNormal(int index,
        -                      float nx,
        -                      float ny,
        -                      float nz)
        -
      • -
      - - - -
        -
      • -

        setAttrib

        -
        public void setAttrib(String name,
        -                      int index,
        -                      float... values)
        -
      • -
      - - - -
        -
      • -

        setAttrib

        -
        public void setAttrib(String name,
        -                      int index,
        -                      int... values)
        -
      • -
      - - - -
        -
      • -

        setAttrib

        -
        public void setAttrib(String name,
        -                      int index,
        -                      boolean... values)
        -
      • -
      - - - -
        -
      • -

        getTextureU

        -
        public float getTextureU(int index)
        -
      • -
      - - - -
        -
      • -

        getTextureV

        -
        public float getTextureV(int index)
        -
      • -
      - - - -
        -
      • -

        setTextureUV

        -
        public void setTextureUV(int index,
        -                         float u,
        -                         float v)
        -
      • -
      - - - -
        -
      • -

        setTextureMode

        -
        public void setTextureMode(int mode)
        -
      • -
      - - - -
        -
      • -

        setTexture

        -
        public void setTexture(PImage tex)
        -
      • -
      - - - -
        -
      • -

        getFill

        -
        public int getFill(int index)
        -
      • -
      - - - -
        -
      • -

        setFill

        -
        public void setFill(boolean fill)
        -
      • -
      - - - -
        -
      • -

        setFill

        -
        public void setFill(int fill)
        -
      • -
      - - - -
        -
      • -

        setFill

        -
        public void setFill(int index,
        -                    int fill)
        -
      • -
      - - - -
        -
      • -

        getTint

        -
        public int getTint(int index)
        -
      • -
      - - - -
        -
      • -

        setTint

        -
        public void setTint(boolean tint)
        -
      • -
      - - - -
        -
      • -

        setTint

        -
        public void setTint(int fill)
        -
      • -
      - - - -
        -
      • -

        setTint

        -
        public void setTint(int index,
        -                    int tint)
        -
      • -
      - - - -
        -
      • -

        getStroke

        -
        public int getStroke(int index)
        -
      • -
      - - - -
        -
      • -

        setStroke

        -
        public void setStroke(boolean stroke)
        -
      • -
      - - - -
        -
      • -

        setStroke

        -
        public void setStroke(int stroke)
        -
      • -
      - - - -
        -
      • -

        setStroke

        -
        public void setStroke(int index,
        -                      int stroke)
        -
      • -
      - - - -
        -
      • -

        getStrokeWeight

        -
        public float getStrokeWeight(int index)
        -
      • -
      - - - -
        -
      • -

        setStrokeWeight

        -
        public void setStrokeWeight(float weight)
        -
      • -
      - - - -
        -
      • -

        setStrokeWeight

        -
        public void setStrokeWeight(int index,
        -                            float weight)
        -
      • -
      - - - -
        -
      • -

        setStrokeJoin

        -
        public void setStrokeJoin(int join)
        -
      • -
      - - - -
        -
      • -

        setStrokeCap

        -
        public void setStrokeCap(int cap)
        -
      • -
      - - - -
        -
      • -

        getAmbient

        -
        public int getAmbient(int index)
        -
      • -
      - - - -
        -
      • -

        setAmbient

        -
        public void setAmbient(int ambient)
        -
      • -
      - - - -
        -
      • -

        setAmbient

        -
        public void setAmbient(int index,
        -                       int ambient)
        -
      • -
      - - - -
        -
      • -

        getSpecular

        -
        public int getSpecular(int index)
        -
      • -
      - - - -
        -
      • -

        setSpecular

        -
        public void setSpecular(int specular)
        -
      • -
      - - - -
        -
      • -

        setSpecular

        -
        public void setSpecular(int index,
        -                        int specular)
        -
      • -
      - - - -
        -
      • -

        getEmissive

        -
        public int getEmissive(int index)
        -
      • -
      - - - -
        -
      • -

        setEmissive

        -
        public void setEmissive(int emissive)
        -
      • -
      - - - -
        -
      • -

        setEmissive

        -
        public void setEmissive(int index,
        -                        int emissive)
        -
      • -
      - - - -
        -
      • -

        getShininess

        -
        public float getShininess(int index)
        -
      • -
      - - - -
        -
      • -

        setShininess

        -
        public void setShininess(float shine)
        -
      • -
      - - - -
        -
      • -

        setShininess

        -
        public void setShininess(int index,
        -                         float shine)
        -
      • -
      - - - -
        -
      • -

        getVertexCodes

        -
        public int[] getVertexCodes()
        -
      • -
      - - - -
        -
      • -

        getVertexCodeCount

        -
        public int getVertexCodeCount()
        -
      • -
      - - - -
        -
      • -

        getVertexCode

        -
        public int getVertexCode(int index)
        -
        One of VERTEX, BEZIER_VERTEX, CURVE_VERTEX, or BREAK.
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public boolean isClosed()
        -
      • -
      - - - -
        -
      • -

        contains

        -
        public boolean contains(float x,
        -                        float y)
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float x,
        -                      float y)
        -
        ( begin auto-generated from PShape_translate.xml ) - - Specifies an amount to displace the shape. The x parameter - specifies left/right translation, the y parameter specifies - up/down translation, and the z parameter specifies translations - toward/away from the screen. Subsequent calls to the method accumulates - the effect. For example, calling translate(50, 0) and then - translate(20, 0) is the same as translate(70, 0). This - transformation is applied directly to the shape, it's not refreshed each - time draw() is run. -

        - Using this method with the z parameter requires using the P3D - parameter in combination with size. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        tx - left/right translation
        -
        ty - up/down translation
        -
        See Also:
        -
        rotate(float), -scale(float), -resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float x,
        -                      float y,
        -                      float z)
        -
        -
        Parameters:
        -
        tz - forward/back translation
        -
        -
      • -
      - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        ( begin auto-generated from PShape_rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to TWO_PI) or converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Subsequent calls to the method accumulates the effect. For example, - calling rotateX(HALF_PI) and then rotateX(HALF_PI) is the - same as rotateX(PI). This transformation is applied directly to - the shape, it's not refreshed each time draw() is run. -

        - This method requires a 3D renderer. You need to use P3D as a third - parameter for the size() function as shown in the example above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        rotate(float), -rotateY(float), -rotateZ(float), -scale(float), -translate(float, float), -resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        ( begin auto-generated from PShape_rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to TWO_PI) or converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Subsequent calls to the method accumulates the effect. For example, - calling rotateY(HALF_PI) and then rotateY(HALF_PI) is the - same as rotateY(PI). This transformation is applied directly to - the shape, it's not refreshed each time draw() is run. -

        - This method requires a 3D renderer. You need to use P3D as a third - parameter for the size() function as shown in the example above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        rotate(float), -rotateX(float), -rotateZ(float), -scale(float), -translate(float, float), -resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        ( begin auto-generated from PShape_rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to TWO_PI) or converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Subsequent calls to the method accumulates the effect. For example, - calling rotateZ(HALF_PI) and then rotateZ(HALF_PI) is the - same as rotateZ(PI). This transformation is applied directly to - the shape, it's not refreshed each time draw() is run. -

        - This method requires a 3D renderer. You need to use P3D as a third - parameter for the size() function as shown in the example above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        rotate(float), -rotateX(float), -rotateY(float), -scale(float), -translate(float, float), -resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle)
        -
        ( begin auto-generated from PShape_rotate.xml ) - - Rotates a shape the amount specified by the angle parameter. - Angles should be specified in radians (values from 0 to TWO_PI) or - converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the method accumulates the effect. For example, calling - rotate(HALF_PI) and then rotate(HALF_PI) is the same as - rotate(PI). This transformation is applied directly to the shape, - it's not refreshed each time draw() is run. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        rotateX(float), -rotateY(float), -rotateZ(float), -scale(float), -translate(float, float), -resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle,
        -                   float v0,
        -                   float v1,
        -                   float v2)
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float s)
        -
        ( begin auto-generated from PShape_scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices. Shapes always scale from the relative origin of their bounding - box. Scale values are specified as decimal percentages. For example, the - method call scale(2.0) increases the dimension of a shape by - 200%. Subsequent calls to the method multiply the effect. For example, - calling scale(2.0) and then scale(1.5) is the same as - scale(3.0). This transformation is applied directly to the shape, - it's not refreshed each time draw() is run. -

        - Using this method with the z parameter requires using the P3D - parameter in combination with size. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        s - percentate to scale the object
        -
        See Also:
        -
        rotate(float), -translate(float, float), -resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y)
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y,
        -                  float z)
        -
        -
        Parameters:
        -
        x - percentage to scale the object in the x-axis
        -
        y - percentage to scale the object in the y-axis
        -
        z - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - -
        -
      • -

        resetMatrix

        -
        public void resetMatrix()
        -
        ( begin auto-generated from PShape_resetMatrix.xml ) - - Replaces the current matrix of a shape with the identity matrix. The - equivalent function in OpenGL is glLoadIdentity(). - - ( end auto-generated )
        -
        -
        See Also:
        -
        rotate(float), -scale(float), -translate(float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode)
        -
        Set the pivot point for all transformations.
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float max)
        -
        -
        Parameters:
        -
        max - range for all color elements
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float maxX,
        -                      float maxY,
        -                      float maxZ)
        -
        -
        Parameters:
        -
        maxX - range for the red or hue depending on the current color mode
        -
        maxY - range for the green or saturation depending on the current color mode
        -
        maxZ - range for the blue or brightness depending on the current color mode
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float maxX,
        -                      float maxY,
        -                      float maxZ,
        -                      float maxA)
        -
        -
        Parameters:
        -
        maxA - range for the alpha
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PShapeOBJ.html b/build/javadoc/core/processing/core/PShapeOBJ.html deleted file mode 100644 index 8bf2aaf772..0000000000 --- a/build/javadoc/core/processing/core/PShapeOBJ.html +++ /dev/null @@ -1,316 +0,0 @@ - - - - - -PShapeOBJ - - - - - - - - - - - -
-
processing.core
-

Class PShapeOBJ

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    -
    public class PShapeOBJ
    -extends PShape
    -
    This class is not part of the Processing API and should not be used - directly. Instead, use loadShape() and methods like it, which will make - use of this class. Using this class directly will cause your code to break - when combined with future versions of Processing. -

    - OBJ loading implemented using code from Saito's OBJLoader library: - http://code.google.com/p/saitoobjloader/ - and OBJReader from Ahmet Kizilay - http://www.openprocessing.org/visuals/?visualID=191

    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PShapeSVG.Font.html b/build/javadoc/core/processing/core/PShapeSVG.Font.html deleted file mode 100644 index 35b32f21cb..0000000000 --- a/build/javadoc/core/processing/core/PShapeSVG.Font.html +++ /dev/null @@ -1,476 +0,0 @@ - - - - - -PShapeSVG.Font - - - - - - - - - - - -
-
processing.core
-

Class PShapeSVG.Font

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    Enclosing class:
    -
    PShapeSVG
    -
    -
    -
    -
    public static class PShapeSVG.Font
    -extends PShapeSVG
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PShapeSVG.FontGlyph.html b/build/javadoc/core/processing/core/PShapeSVG.FontGlyph.html deleted file mode 100644 index de4fe7543b..0000000000 --- a/build/javadoc/core/processing/core/PShapeSVG.FontGlyph.html +++ /dev/null @@ -1,335 +0,0 @@ - - - - - -PShapeSVG.FontGlyph - - - - - - - - - - - -
-
processing.core
-

Class PShapeSVG.FontGlyph

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    Enclosing class:
    -
    PShapeSVG
    -
    -
    -
    -
    public static class PShapeSVG.FontGlyph
    -extends PShapeSVG
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PShapeSVG.html b/build/javadoc/core/processing/core/PShapeSVG.html deleted file mode 100644 index 5cab84b6ca..0000000000 --- a/build/javadoc/core/processing/core/PShapeSVG.html +++ /dev/null @@ -1,475 +0,0 @@ - - - - - -PShapeSVG - - - - - - - - - - - -
-
processing.core
-

Class PShapeSVG

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    PShapeSVG.Font, PShapeSVG.FontGlyph
    -
    -
    -
    -
    public class PShapeSVG
    -extends PShape
    -
    This class is not part of the Processing API and should not be used - directly. Instead, use loadShape() and methods like it, which will make - use of this class. Using this class directly will cause your code to break - when combined with future versions of Processing. -

    - 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 <g> 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.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PShapeSVG

        -
        public PShapeSVG(XML svg)
        -
        Initializes a new SVG Object from the given XML.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getChild

        -
        public PShape getChild(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.
        - PShape layer3 = svg.getChild("Layer 3");
        - 
        -
        -
        Overrides:
        -
        getChild in class PShape
        -
        Parameters:
        -
        name - the name of the shape to get
        -
        -
      • -
      - - - -
        -
      • -

        print

        -
        public void print()
        -
        Prints out the SVG document. Useful for parsing.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PStyle.html b/build/javadoc/core/processing/core/PStyle.html deleted file mode 100644 index 27caa1dc3b..0000000000 --- a/build/javadoc/core/processing/core/PStyle.html +++ /dev/null @@ -1,724 +0,0 @@ - - - - - -PStyle - - - - - - - - - - - -
-
processing.core
-

Class PStyle

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        imageMode

        -
        public int imageMode
        -
      • -
      - - - -
        -
      • -

        rectMode

        -
        public int rectMode
        -
      • -
      - - - -
        -
      • -

        ellipseMode

        -
        public int ellipseMode
        -
      • -
      - - - -
        -
      • -

        shapeMode

        -
        public int shapeMode
        -
      • -
      - - - -
        -
      • -

        blendMode

        -
        public int blendMode
        -
      • -
      - - - -
        -
      • -

        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/PSurface.html b/build/javadoc/core/processing/core/PSurface.html deleted file mode 100644 index 1188e6ed35..0000000000 --- a/build/javadoc/core/processing/core/PSurface.html +++ /dev/null @@ -1,570 +0,0 @@ - - - - - -PSurface - - - - - - - - - - - -
-
processing.core
-

Interface PSurface

-
-
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        MIN_WINDOW_WIDTH

        -
        static final int MIN_WINDOW_WIDTH
        -
        Minimum dimensions for the window holding an applet. This varies between - platforms, Mac OS X 10.3 (confirmed with 10.7 and Java 6) 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 allows window - sizes to be negative numbers.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - - -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        initOffscreen

        -
        void initOffscreen(PApplet sketch)
        -
      • -
      - - - -
        -
      • -

        initFrame

        -
        void initFrame(PApplet sketch)
        -
      • -
      - - - -
        -
      • -

        setTitle

        -
        void setTitle(String title)
        -
        Set the window (and dock, or whatever necessary) title.
        -
      • -
      - - - -
        -
      • -

        setVisible

        -
        void setVisible(boolean visible)
        -
        Show or hide the window.
        -
      • -
      - - - -
        -
      • -

        setResizable

        -
        void setResizable(boolean resizable)
        -
        Set true if we want to resize things (default is not resizable)
        -
      • -
      - - - -
        -
      • -

        placeWindow

        -
        void placeWindow(int[] location,
        -                 int[] editorLocation)
        -
      • -
      - - - -
        -
      • -

        placePresent

        -
        void placePresent(int stopColor)
        -
      • -
      - - - -
        -
      • -

        setupExternalMessages

        -
        void setupExternalMessages()
        -
      • -
      - - - -
        -
      • -

        setSize

        -
        void setSize(int width,
        -             int height)
        -
      • -
      - - - -
        -
      • -

        setSmooth

        -
        void setSmooth(int level)
        -
        Sometimes smoothing must be set at the drawing surface level - not just inside the renderer itself.
        -
      • -
      - - - -
        -
      • -

        setFrameRate

        -
        void setFrameRate(float fps)
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        void setCursor(int kind)
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        void setCursor(PImage image,
        -               int hotspotX,
        -               int hotspotY)
        -
      • -
      - - - -
        -
      • -

        showCursor

        -
        void showCursor()
        -
      • -
      - - - -
        -
      • -

        hideCursor

        -
        void hideCursor()
        -
      • -
      - - - -
        -
      • -

        startThread

        -
        void startThread()
        -
        Start the animation thread
        -
      • -
      - - - -
        -
      • -

        pauseThread

        -
        void pauseThread()
        -
        On the next trip through the animation thread, things should go sleepy-bye. - Does not pause the thread immediately because that needs to happen on the - animation thread itself, so fires on the next trip through draw().
        -
      • -
      - - - -
        -
      • -

        resumeThread

        -
        void resumeThread()
        -
      • -
      - - - -
        -
      • -

        stopThread

        -
        boolean stopThread()
        -
        Stop the animation thread (set it null)
        -
        -
        Returns:
        -
        false if already stopped
        -
        -
      • -
      - - - -
        -
      • -

        isStopped

        -
        boolean isStopped()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PSurfaceAWT.html b/build/javadoc/core/processing/core/PSurfaceAWT.html deleted file mode 100644 index c38ea19f87..0000000000 --- a/build/javadoc/core/processing/core/PSurfaceAWT.html +++ /dev/null @@ -1,622 +0,0 @@ - - - - - -PSurfaceAWT - - - - - - - - - - - -
-
processing.core
-

Class PSurfaceAWT

-
-
- -
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PSurfaceDanger.html b/build/javadoc/core/processing/core/PSurfaceDanger.html deleted file mode 100644 index 18350ef0fb..0000000000 --- a/build/javadoc/core/processing/core/PSurfaceDanger.html +++ /dev/null @@ -1,315 +0,0 @@ - - - - - -PSurfaceDanger - - - - - - - - - - - -
-
processing.core
-

Class PSurfaceDanger

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PSurface
    -
    -
    -
    -
    public class PSurfaceDanger
    -extends PSurfaceAWT
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PSurfaceFX.PApplicationFX.html b/build/javadoc/core/processing/core/PSurfaceFX.PApplicationFX.html deleted file mode 100644 index d2e97acf0f..0000000000 --- a/build/javadoc/core/processing/core/PSurfaceFX.PApplicationFX.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - -PSurfaceFX.PApplicationFX - - - - - - - - - - - -
-
processing.core
-

Class PSurfaceFX.PApplicationFX

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • javafx.application.Application
    • -
    • -
        -
      • processing.core.PSurfaceFX.PApplicationFX
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    Enclosing class:
    -
    PSurfaceFX
    -
    -
    -
    -
    public static class PSurfaceFX.PApplicationFX
    -extends javafx.application.Application
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from class javafx.application.Application

        -javafx.application.Application.Parameters
      • -
      -
    • -
    - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      static PSurfaceFXsurface 
      -
        -
      • - - -

        Fields inherited from class javafx.application.Application

        -STYLESHEET_CASPIAN, STYLESHEET_MODENA
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      PApplicationFX() 
      -
    • -
    - - -
  • -
-
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PApplicationFX

        -
        public PApplicationFX()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        start

        -
        public void start(javafx.stage.Stage stage)
        -
        -
        Specified by:
        -
        start in class javafx.application.Application
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PSurfaceFX.html b/build/javadoc/core/processing/core/PSurfaceFX.html deleted file mode 100644 index 6178ff0695..0000000000 --- a/build/javadoc/core/processing/core/PSurfaceFX.html +++ /dev/null @@ -1,673 +0,0 @@ - - - - - -PSurfaceFX - - - - - - - - - - - -
-
processing.core
-

Class PSurfaceFX

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PSurface
    -
    -
    -
    -
    public class PSurfaceFX
    -extends Object
    -implements PSurface
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Method Detail

      - - - - - - - - - - - -
        -
      • -

        setTitle

        -
        public void setTitle(String title)
        -
        Set the window (and dock, or whatever necessary) title.
        -
        -
        Specified by:
        -
        setTitle in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setVisible

        -
        public void setVisible(boolean visible)
        -
        Show or hide the window.
        -
        -
        Specified by:
        -
        setVisible in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setResizable

        -
        public void setResizable(boolean resizable)
        -
        Set true if we want to resize things (default is not resizable)
        -
        -
        Specified by:
        -
        setResizable in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        placeWindow

        -
        public void placeWindow(int[] location,
        -                        int[] editorLocation)
        -
        -
        Specified by:
        -
        placeWindow in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        placePresent

        -
        public void placePresent(int stopColor)
        -
        -
        Specified by:
        -
        placePresent in interface PSurface
        -
        -
      • -
      - - - - - - - -
        -
      • -

        setSize

        -
        public void setSize(int width,
        -                    int height)
        -
        -
        Specified by:
        -
        setSize in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setSmooth

        -
        public void setSmooth(int level)
        -
        Description copied from interface: PSurface
        -
        Sometimes smoothing must be set at the drawing surface level - not just inside the renderer itself.
        -
        -
        Specified by:
        -
        setSmooth in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setFrameRate

        -
        public void setFrameRate(float fps)
        -
        -
        Specified by:
        -
        setFrameRate in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        public void setCursor(int kind)
        -
        -
        Specified by:
        -
        setCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        public void setCursor(PImage image,
        -                      int hotspotX,
        -                      int hotspotY)
        -
        -
        Specified by:
        -
        setCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        showCursor

        -
        public void showCursor()
        -
        -
        Specified by:
        -
        showCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        hideCursor

        -
        public void hideCursor()
        -
        -
        Specified by:
        -
        hideCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        startThread

        -
        public void startThread()
        -
        Description copied from interface: PSurface
        -
        Start the animation thread
        -
        -
        Specified by:
        -
        startThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        pauseThread

        -
        public void pauseThread()
        -
        Description copied from interface: PSurface
        -
        On the next trip through the animation thread, things should go sleepy-bye. - Does not pause the thread immediately because that needs to happen on the - animation thread itself, so fires on the next trip through draw().
        -
        -
        Specified by:
        -
        pauseThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        resumeThread

        -
        public void resumeThread()
        -
        -
        Specified by:
        -
        resumeThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        stopThread

        -
        public boolean stopThread()
        -
        Description copied from interface: PSurface
        -
        Stop the animation thread (set it null)
        -
        -
        Specified by:
        -
        stopThread in interface PSurface
        -
        Returns:
        -
        false if already stopped
        -
        -
      • -
      - - - -
        -
      • -

        isStopped

        -
        public boolean isStopped()
        -
        -
        Specified by:
        -
        isStopped in interface PSurface
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PSurfaceNone.html b/build/javadoc/core/processing/core/PSurfaceNone.html deleted file mode 100644 index 4ce9e4b5d9..0000000000 --- a/build/javadoc/core/processing/core/PSurfaceNone.html +++ /dev/null @@ -1,673 +0,0 @@ - - - - - -PSurfaceNone - - - - - - - - - - - -
-
processing.core
-

Class PSurfaceNone

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PSurface
    -
    -
    -
    Direct Known Subclasses:
    -
    PSurfaceAWT
    -
    -
    -
    -
    public class PSurfaceNone
    -extends Object
    -implements PSurface
    -
    Surface that's not really visible. Used for PDF and friends, or as a base - class for other drawing surfaces. It includes the standard rendering loop.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PSurfaceNone

        -
        public PSurfaceNone(PGraphics graphics)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - - - - - -
        -
      • -

        setTitle

        -
        public void setTitle(String title)
        -
        Set the window (and dock, or whatever necessary) title.
        -
        -
        Specified by:
        -
        setTitle in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setVisible

        -
        public void setVisible(boolean visible)
        -
        Show or hide the window.
        -
        -
        Specified by:
        -
        setVisible in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setResizable

        -
        public void setResizable(boolean resizable)
        -
        Set true if we want to resize things (default is not resizable)
        -
        -
        Specified by:
        -
        setResizable in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        placeWindow

        -
        public void placeWindow(int[] location,
        -                        int[] editorLocation)
        -
        -
        Specified by:
        -
        placeWindow in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        placePresent

        -
        public void placePresent(int stopColor)
        -
        -
        Specified by:
        -
        placePresent in interface PSurface
        -
        -
      • -
      - - - - - - - -
        -
      • -

        setSize

        -
        public void setSize(int wide,
        -                    int high)
        -
        -
        Specified by:
        -
        setSize in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setSmooth

        -
        public void setSmooth(int level)
        -
        Description copied from interface: PSurface
        -
        Sometimes smoothing must be set at the drawing surface level - not just inside the renderer itself.
        -
        -
        Specified by:
        -
        setSmooth in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        public void setCursor(int kind)
        -
        -
        Specified by:
        -
        setCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        public void setCursor(PImage image,
        -                      int hotspotX,
        -                      int hotspotY)
        -
        -
        Specified by:
        -
        setCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        showCursor

        -
        public void showCursor()
        -
        -
        Specified by:
        -
        showCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        hideCursor

        -
        public void hideCursor()
        -
        -
        Specified by:
        -
        hideCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        createThread

        -
        public Thread createThread()
        -
      • -
      - - - -
        -
      • -

        startThread

        -
        public void startThread()
        -
        Description copied from interface: PSurface
        -
        Start the animation thread
        -
        -
        Specified by:
        -
        startThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        stopThread

        -
        public boolean stopThread()
        -
        Description copied from interface: PSurface
        -
        Stop the animation thread (set it null)
        -
        -
        Specified by:
        -
        stopThread in interface PSurface
        -
        Returns:
        -
        false if already stopped
        -
        -
      • -
      - - - -
        -
      • -

        isStopped

        -
        public boolean isStopped()
        -
        -
        Specified by:
        -
        isStopped in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        pauseThread

        -
        public void pauseThread()
        -
        Description copied from interface: PSurface
        -
        On the next trip through the animation thread, things should go sleepy-bye. - Does not pause the thread immediately because that needs to happen on the - animation thread itself, so fires on the next trip through draw().
        -
        -
        Specified by:
        -
        pauseThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        resumeThread

        -
        public void resumeThread()
        -
        -
        Specified by:
        -
        resumeThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setFrameRate

        -
        public void setFrameRate(float fps)
        -
        -
        Specified by:
        -
        setFrameRate in interface PSurface
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/PVector.html b/build/javadoc/core/processing/core/PVector.html deleted file mode 100644 index 0cebb9f785..0000000000 --- a/build/javadoc/core/processing/core/PVector.html +++ /dev/null @@ -1,1811 +0,0 @@ - - - - - -PVector - - - - - - - - - - - -
-
processing.core
-

Class PVector

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    -
    public class PVector
    -extends Object
    -implements Serializable
    -
    ( begin auto-generated from PVector.xml ) - - A class to describe a two or three dimensional vector. This datatype - stores two or three variables that are commonly used as a position, - velocity, and/or acceleration. Technically, position is a point - and velocity and acceleration are vectors, but this is - often simplified to consider all three as vectors. For example, if you - consider a rectangle moving across the screen, at any given instant it - has a position (the object's location, expressed as a point.), a - velocity (the rate at which the object's position changes per time unit, - expressed as a vector), and acceleration (the rate at which the object's - velocity changes per time unit, expressed as a vector). Since vectors - represent groupings of values, we cannot simply use traditional - addition/multiplication/etc. Instead, we'll need to do some "vector" - math, which is made easy by the methods inside the PVector - class.
    -
    - The methods for this class are extensive. For a complete list, visit the - developer's reference. - - ( end auto-generated ) - - 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.

    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      floatx -
      ( begin auto-generated from PVector_x.xml ) - - The x component of the vector.
      -
      floaty -
      ( begin auto-generated from PVector_y.xml ) - - The y component of the vector.
      -
      floatz -
      ( begin auto-generated from PVector_z.xml ) - - The z component of the vector.
      -
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      Constructor and Description
      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

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and TypeMethod and Description
      PVectoradd(float x, - float y, - float z) 
      PVectoradd(PVector v) -
      ( begin auto-generated from PVector_add.xml ) - - Adds x, y, and z components to a vector, adds one vector to another, or - adds two independent vectors together.
      -
      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) -
      ( begin auto-generated from PVector_angleBetween.xml ) - - Calculates and returns the angle (in radians) between two vectors.
      -
      float[]array() -
      ( begin auto-generated from PVector_array.xml ) - - Return a representation of this vector as a float array.
      -
      PVectorcopy() 
      PVectorcross(PVector v) -
      ( begin auto-generated from PVector_cross.xml ) - - Calculates and returns a vector composed of the cross product between - two vectors.
      -
      PVectorcross(PVector v, - PVector target) 
      static PVectorcross(PVector v1, - PVector v2, - PVector target) 
      floatdist(PVector v) -
      ( begin auto-generated from PVector_dist.xml ) - - Calculates the Euclidean distance between two points (considering a - point as a vector object).
      -
      static floatdist(PVector v1, - PVector v2) 
      PVectordiv(float n) -
      ( begin auto-generated from PVector_div.xml ) - - Divides a vector by a scalar or divides one vector by another.
      -
      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) -
      Divide a vector by a scalar and store the result in another vector.
      -
      floatdot(float x, - float y, - float z) 
      floatdot(PVector v) -
      ( begin auto-generated from PVector_dot.xml ) - - Calculates the dot product of two vectors.
      -
      static floatdot(PVector v1, - PVector v2) 
      booleanequals(Object obj) 
      static PVectorfromAngle(float angle) -
      ( begin auto-generated from PVector_sub.xml ) - - Make a new 2D unit vector from an angle.
      -
      static PVectorfromAngle(float angle, - PVector target) -
      Make a new 2D unit vector from an angle
      -
      PVectorget() -
      Deprecated. 
      -
      float[]get(float[] target) 
      inthashCode() 
      floatheading() -
      ( begin auto-generated from PVector_setMag.xml ) - - Calculate the angle of rotation for this vector (only 2D vectors) - - ( end auto-generated )
      -
      floatheading2D() -
      Deprecated. 
      -
      PVectorlerp(float x, - float y, - float z, - float amt) -
      Linear interpolate the vector to x,y,z values
      -
      PVectorlerp(PVector v, - float amt) -
      ( begin auto-generated from PVector_rotate.xml ) - - Linear interpolate the vector to another vector - - ( end auto-generated )
      -
      static PVectorlerp(PVector v1, - PVector v2, - float amt) -
      Linear interpolate between two vectors (returns a new PVector object)
      -
      PVectorlimit(float max) -
      ( begin auto-generated from PVector_limit.xml ) - - Limit the magnitude of this vector to the value used for the max parameter.
      -
      floatmag() -
      ( begin auto-generated from PVector_mag.xml ) - - Calculates the magnitude (length) of the vector and returns the result - as a float (this is simply the equation sqrt(x*x + y*y + z*z).) - - ( end auto-generated )
      -
      floatmagSq() -
      ( begin auto-generated from PVector_mag.xml ) - - Calculates the squared magnitude of the vector and returns the result - as a float (this is simply the equation (x*x + y*y + z*z).) - Faster if the real length is not required in the - case of comparing vectors, etc.
      -
      PVectormult(float n) -
      ( begin auto-generated from PVector_mult.xml ) - - Multiplies a vector by a scalar or multiplies one vector by another.
      -
      static PVectormult(PVector v, - float n) 
      static PVectormult(PVector v, - float n, - PVector target) -
      Multiply a vector by a scalar, and write the result into a target PVector.
      -
      PVectornormalize() -
      ( begin auto-generated from PVector_normalize.xml ) - - Normalize the vector to length 1 (make it a unit vector).
      -
      PVectornormalize(PVector target) 
      static PVectorrandom2D() -
      ( begin auto-generated from PVector_random2D.xml ) - - Make a new 2D unit vector with a random direction.
      -
      static PVectorrandom2D(PApplet parent) -
      Make a new 2D unit vector with a random direction - using Processing's current random number generator
      -
      static PVectorrandom2D(PVector target) -
      Set a 2D vector to a random unit vector with a random direction
      -
      static PVectorrandom2D(PVector target, - PApplet parent) -
      Make a new 2D unit vector with a random direction.
      -
      static PVectorrandom3D() -
      ( begin auto-generated from PVector_random3D.xml ) - - Make a new 3D unit vector with a random direction.
      -
      static PVectorrandom3D(PApplet parent) -
      Make a new 3D unit vector with a random direction - using Processing's current random number generator
      -
      static PVectorrandom3D(PVector target) -
      Set a 3D vector to a random unit vector with a random direction
      -
      static PVectorrandom3D(PVector target, - PApplet parent) -
      Make a new 3D unit vector with a random direction
      -
      PVectorrotate(float theta) -
      ( begin auto-generated from PVector_rotate.xml ) - - Rotate the vector by an angle (only 2D vectors), magnitude remains the same - - ( end auto-generated )
      -
      PVectorset(float[] source) -
      Set the x, y (and maybe z) coordinates using a float[] array as the source.
      -
      PVectorset(float x, - float y) 
      PVectorset(float x, - float y, - float z) -
      ( begin auto-generated from PVector_set.xml ) - - Sets the x, y, and z component of the vector using two or three separate - variables, the data from a PVector, or the values from a float array.
      -
      PVectorset(PVector v) 
      PVectorsetMag(float len) -
      ( begin auto-generated from PVector_setMag.xml ) - - Set the magnitude of this vector to the value used for the len parameter.
      -
      PVectorsetMag(PVector target, - float len) -
      Sets the magnitude of this vector, storing the result in another vector.
      -
      PVectorsub(float x, - float y, - float z) 
      PVectorsub(PVector v) -
      ( begin auto-generated from PVector_sub.xml ) - - Subtracts x, y, and z components from a vector, subtracts one vector - from another, or subtracts two independent vectors.
      -
      static PVectorsub(PVector v1, - PVector v2) -
      Subtract one vector from another
      -
      static PVectorsub(PVector v1, - PVector v2, - PVector target) -
      Subtract one vector from another and store in another vector
      -
      StringtoString() 
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        x

        -
        public float x
        -
        ( begin auto-generated from PVector_x.xml ) - - The x component of the vector. This field (variable) can be used to both - get and set the value (see above example.) - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        y

        -
        public float y
        -
        ( begin auto-generated from PVector_y.xml ) - - The y component of the vector. This field (variable) can be used to both - get and set the value (see above example.) - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        z

        -
        public float z
        -
        ( begin auto-generated from PVector_z.xml ) - - The z component of the vector. This field (variable) can be used to both - get and set the value (see above example.) - - ( end auto-generated )
        -
      • -
      -
    • -
    - -
      -
    • - - -

      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 z coordinate.
        -
        -
      • -
      - - - -
        -
      • -

        PVector

        -
        public PVector(float x,
        -               float y)
        -
        Constructor for a 2D vector: z coordinate is set to 0.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        set

        -
        public PVector set(float x,
        -                   float y,
        -                   float z)
        -
        ( begin auto-generated from PVector_set.xml ) - - Sets the x, y, and z component of the vector using two or three separate - variables, the data from a PVector, or the values from a float array. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - the x component of the vector
        -
        y - the y component of the vector
        -
        z - the z component of the vector
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public PVector set(float x,
        -                   float y)
        -
        -
        Parameters:
        -
        x - the x component of the vector
        -
        y - the y component of the vector
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public PVector set(PVector v)
        -
        -
        Parameters:
        -
        v - any variable of type PVector
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public PVector set(float[] source)
        -
        Set the x, y (and maybe z) coordinates using a float[] array as the source.
        -
        -
        Parameters:
        -
        source - array to copy from
        -
        -
      • -
      - - - -
        -
      • -

        random2D

        -
        public static PVector random2D()
        -
        ( begin auto-generated from PVector_random2D.xml ) - - Make a new 2D unit vector with a random direction. If you pass in "this" - as an argument, it will use the PApplet's random number generator. You can - also pass in a target PVector to fill.
        -
        -
        Returns:
        -
        the random PVector
        -
        See Also:
        -
        random3D()
        -
        -
      • -
      - - - -
        -
      • -

        random2D

        -
        public static PVector random2D(PApplet parent)
        -
        Make a new 2D unit vector with a random direction - using Processing's current random number generator
        -
        -
        Parameters:
        -
        parent - current PApplet instance
        -
        Returns:
        -
        the random PVector
        -
        -
      • -
      - - - -
        -
      • -

        random2D

        -
        public static PVector random2D(PVector target)
        -
        Set a 2D vector to a random unit vector with a random direction
        -
        -
        Parameters:
        -
        target - the target vector (if null, a new vector will be created)
        -
        Returns:
        -
        the random PVector
        -
        -
      • -
      - - - -
        -
      • -

        random2D

        -
        public static PVector random2D(PVector target,
        -                               PApplet parent)
        -
        Make a new 2D unit vector with a random direction. Pass in the parent - PApplet if you want randomSeed() to work (and be predictable). Or leave - it null and be... random.
        -
        -
        Returns:
        -
        the random PVector
        -
        -
      • -
      - - - -
        -
      • -

        random3D

        -
        public static PVector random3D()
        -
        ( begin auto-generated from PVector_random3D.xml ) - - Make a new 3D unit vector with a random direction. If you pass in "this" - as an argument, it will use the PApplet's random number generator. You can - also pass in a target PVector to fill.
        -
        -
        Returns:
        -
        the random PVector
        -
        See Also:
        -
        random2D()
        -
        -
      • -
      - - - -
        -
      • -

        random3D

        -
        public static PVector random3D(PApplet parent)
        -
        Make a new 3D unit vector with a random direction - using Processing's current random number generator
        -
        -
        Parameters:
        -
        parent - current PApplet instance
        -
        Returns:
        -
        the random PVector
        -
        -
      • -
      - - - -
        -
      • -

        random3D

        -
        public static PVector random3D(PVector target)
        -
        Set a 3D vector to a random unit vector with a random direction
        -
        -
        Parameters:
        -
        target - the target vector (if null, a new vector will be created)
        -
        Returns:
        -
        the random PVector
        -
        -
      • -
      - - - -
        -
      • -

        random3D

        -
        public static PVector random3D(PVector target,
        -                               PApplet parent)
        -
        Make a new 3D unit vector with a random direction
        -
        -
        Returns:
        -
        the random PVector
        -
        -
      • -
      - - - -
        -
      • -

        fromAngle

        -
        public static PVector fromAngle(float angle)
        -
        ( begin auto-generated from PVector_sub.xml ) - - Make a new 2D unit vector from an angle. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - the angle in radians
        -
        Returns:
        -
        the new unit PVector
        -
        -
      • -
      - - - -
        -
      • -

        fromAngle

        -
        public static PVector fromAngle(float angle,
        -                                PVector target)
        -
        Make a new 2D unit vector from an angle
        -
        -
        Parameters:
        -
        target - the target vector (if null, a new vector will be created)
        -
        Returns:
        -
        the PVector
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public PVector copy()
        -
      • -
      - - - -
        -
      • -

        get

        -
        @Deprecated
        -public PVector get()
        -
        Deprecated. 
        -
        ( begin auto-generated from PVector_get.xml ) - - Gets a copy of the vector, returns a PVector object. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        get

        -
        public float[] get(float[] target)
        -
        -
        Parameters:
        -
        target -
        -
        -
      • -
      - - - -
        -
      • -

        mag

        -
        public float mag()
        -
        ( begin auto-generated from PVector_mag.xml ) - - Calculates the magnitude (length) of the vector and returns the result - as a float (this is simply the equation sqrt(x*x + y*y + z*z).) - - ( end auto-generated )
        -
        -
        Returns:
        -
        magnitude (length) of the vector
        -
        See Also:
        -
        magSq()
        -
        -
      • -
      - - - -
        -
      • -

        magSq

        -
        public float magSq()
        -
        ( begin auto-generated from PVector_mag.xml ) - - Calculates the squared magnitude of the vector and returns the result - as a float (this is simply the equation (x*x + y*y + z*z).) - Faster if the real length is not required in the - case of comparing vectors, etc. - - ( end auto-generated )
        -
        -
        Returns:
        -
        squared magnitude of the vector
        -
        See Also:
        -
        mag()
        -
        -
      • -
      - - - -
        -
      • -

        add

        -
        public PVector add(PVector v)
        -
        ( begin auto-generated from PVector_add.xml ) - - Adds x, y, and z components to a vector, adds one vector to another, or - adds two independent vectors together. The version of the method that - adds two vectors together is a static method and returns a PVector, the - others have no return value -- they act directly on the vector. See the - examples for more context. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v - the vector to be added
        -
        -
      • -
      - - - -
        -
      • -

        add

        -
        public PVector add(float x,
        -                   float y,
        -                   float z)
        -
        -
        Parameters:
        -
        x - x component of the vector
        -
        y - y component of the vector
        -
        z - z component of the vector
        -
        -
      • -
      - - - -
        -
      • -

        add

        -
        public static PVector add(PVector v1,
        -                          PVector v2)
        -
        Add two vectors
        -
        -
        Parameters:
        -
        v1 - a vector
        -
        v2 - another vector
        -
        -
      • -
      - - - -
        -
      • -

        add

        -
        public static PVector add(PVector v1,
        -                          PVector v2,
        -                          PVector target)
        -
        Add two vectors into a target vector
        -
        -
        Parameters:
        -
        target - the target vector (if null, a new vector will be created)
        -
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public PVector sub(PVector v)
        -
        ( begin auto-generated from PVector_sub.xml ) - - Subtracts x, y, and z components from a vector, subtracts one vector - from another, or subtracts two independent vectors. The version of the - method that subtracts two vectors is a static method and returns a - PVector, the others have no return value -- they act directly on the - vector. See the examples for more context. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v - any variable of type PVector
        -
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public PVector sub(float x,
        -                   float y,
        -                   float z)
        -
        -
        Parameters:
        -
        x - the x component of the vector
        -
        y - the y component of the vector
        -
        z - the z component of the vector
        -
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public static PVector sub(PVector v1,
        -                          PVector v2)
        -
        Subtract one vector from another
        -
        -
        Parameters:
        -
        v1 - the x, y, and z components of a PVector object
        -
        v2 - the x, y, and z components of a PVector object
        -
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public static PVector sub(PVector v1,
        -                          PVector v2,
        -                          PVector target)
        -
        Subtract one vector from another and store in another vector
        -
        -
        Parameters:
        -
        v1 - the x, y, and z components of a PVector object
        -
        v2 - the x, y, and z components of a PVector object
        -
        target - PVector in which to store the result
        -
        -
      • -
      - - - -
        -
      • -

        mult

        -
        public PVector mult(float n)
        -
        ( begin auto-generated from PVector_mult.xml ) - - Multiplies a vector by a scalar or multiplies one vector by another. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - the number to multiply with the vector
        -
        -
      • -
      - - - -
        -
      • -

        mult

        -
        public static PVector mult(PVector v,
        -                           float n)
        -
        -
        Parameters:
        -
        v - the vector to multiply by the scalar
        -
        -
      • -
      - - - -
        -
      • -

        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:
        -
        target - PVector in which to store the result
        -
        -
      • -
      - - - -
        -
      • -

        div

        -
        public PVector div(float n)
        -
        ( begin auto-generated from PVector_div.xml ) - - Divides a vector by a scalar or divides one vector by another. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - the number by which to divide the vector
        -
        -
      • -
      - - - -
        -
      • -

        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 - the vector to divide by the scalar
        -
        Returns:
        -
        a new vector that is v1 / n
        -
        -
      • -
      - - - -
        -
      • -

        div

        -
        public static PVector div(PVector v,
        -                          float n,
        -                          PVector target)
        -
        Divide a vector by a scalar and store the result in another vector.
        -
        -
        Parameters:
        -
        target - PVector in which to store the result
        -
        -
      • -
      - - - -
        -
      • -

        dist

        -
        public float dist(PVector v)
        -
        ( begin auto-generated from PVector_dist.xml ) - - Calculates the Euclidean distance between two points (considering a - point as a vector object). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v - the x, y, and z coordinates of a PVector
        -
        -
      • -
      - - - -
        -
      • -

        dist

        -
        public static float dist(PVector v1,
        -                         PVector v2)
        -
        -
        Parameters:
        -
        v1 - any variable of type PVector
        -
        v2 - any variable of type PVector
        -
        Returns:
        -
        the Euclidean distance between v1 and v2
        -
        -
      • -
      - - - -
        -
      • -

        dot

        -
        public float dot(PVector v)
        -
        ( begin auto-generated from PVector_dot.xml ) - - Calculates the dot product of two vectors. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v - any variable of type PVector
        -
        Returns:
        -
        the dot product
        -
        -
      • -
      - - - -
        -
      • -

        dot

        -
        public float dot(float x,
        -                 float y,
        -                 float z)
        -
        -
        Parameters:
        -
        x - x component of the vector
        -
        y - y component of the vector
        -
        z - z component of the vector
        -
        -
      • -
      - - - -
        -
      • -

        dot

        -
        public static float dot(PVector v1,
        -                        PVector v2)
        -
        -
        Parameters:
        -
        v1 - any variable of type PVector
        -
        v2 - any variable of type PVector
        -
        -
      • -
      - - - -
        -
      • -

        cross

        -
        public PVector cross(PVector v)
        -
        ( begin auto-generated from PVector_cross.xml ) - - Calculates and returns a vector composed of the cross product between - two vectors. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v - the vector to calculate the cross product
        -
        -
      • -
      - - - -
        -
      • -

        cross

        -
        public PVector cross(PVector v,
        -                     PVector target)
        -
        -
        Parameters:
        -
        v - any variable of type PVector
        -
        target - PVector to store the result
        -
        -
      • -
      - - - -
        -
      • -

        cross

        -
        public static PVector cross(PVector v1,
        -                            PVector v2,
        -                            PVector target)
        -
        -
        Parameters:
        -
        v1 - any variable of type PVector
        -
        v2 - any variable of type PVector
        -
        target - PVector to store the result
        -
        -
      • -
      - - - -
        -
      • -

        normalize

        -
        public PVector normalize()
        -
        ( begin auto-generated from PVector_normalize.xml ) - - Normalize the vector to length 1 (make it a unit vector). - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        normalize

        -
        public PVector normalize(PVector target)
        -
        -
        Parameters:
        -
        target - Set to null to create a new vector
        -
        Returns:
        -
        a new vector (if target was null), or target
        -
        -
      • -
      - - - -
        -
      • -

        limit

        -
        public PVector limit(float max)
        -
        ( begin auto-generated from PVector_limit.xml ) - - Limit the magnitude of this vector to the value used for the max parameter. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        max - the maximum magnitude for the vector
        -
        -
      • -
      - - - -
        -
      • -

        setMag

        -
        public PVector setMag(float len)
        -
        ( begin auto-generated from PVector_setMag.xml ) - - Set the magnitude of this vector to the value used for the len parameter. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        len - the new length for this vector
        -
        -
      • -
      - - - -
        -
      • -

        setMag

        -
        public PVector setMag(PVector target,
        -                      float len)
        -
        Sets the magnitude of this vector, storing the result in another vector.
        -
        -
        Parameters:
        -
        target - Set to null to create a new vector
        -
        len - the new length for the new vector
        -
        Returns:
        -
        a new vector (if target was null), or target
        -
        -
      • -
      - - - -
        -
      • -

        heading

        -
        public float heading()
        -
        ( begin auto-generated from PVector_setMag.xml ) - - Calculate the angle of rotation for this vector (only 2D vectors) - - ( end auto-generated )
        -
        -
        Returns:
        -
        the angle of rotation
        -
        -
      • -
      - - - -
        -
      • -

        heading2D

        -
        @Deprecated
        -public float heading2D()
        -
        Deprecated. 
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public PVector rotate(float theta)
        -
        ( begin auto-generated from PVector_rotate.xml ) - - Rotate the vector by an angle (only 2D vectors), magnitude remains the same - - ( end auto-generated )
        -
        -
        Parameters:
        -
        theta - the angle of rotation
        -
        -
      • -
      - - - -
        -
      • -

        lerp

        -
        public PVector lerp(PVector v,
        -                    float amt)
        -
        ( begin auto-generated from PVector_rotate.xml ) - - Linear interpolate the vector to another vector - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v - the vector to lerp to
        -
        amt - The amount of interpolation; some value between 0.0 (old vector) and 1.0 (new vector). 0.1 is very near the new vector. 0.5 is halfway in between.
        -
        See Also:
        -
        PApplet.lerp(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        lerp

        -
        public static PVector lerp(PVector v1,
        -                           PVector v2,
        -                           float amt)
        -
        Linear interpolate between two vectors (returns a new PVector object)
        -
        -
        Parameters:
        -
        v1 - the vector to start from
        -
        v2 - the vector to lerp to
        -
        -
      • -
      - - - -
        -
      • -

        lerp

        -
        public PVector lerp(float x,
        -                    float y,
        -                    float z,
        -                    float amt)
        -
        Linear interpolate the vector to x,y,z values
        -
        -
        Parameters:
        -
        x - the x component to lerp to
        -
        y - the y component to lerp to
        -
        z - the z component to lerp to
        -
        -
      • -
      - - - -
        -
      • -

        angleBetween

        -
        public static float angleBetween(PVector v1,
        -                                 PVector v2)
        -
        ( begin auto-generated from PVector_angleBetween.xml ) - - Calculates and returns the angle (in radians) between two vectors. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v1 - the x, y, and z components of a PVector
        -
        v2 - the x, y, and z components of a PVector
        -
        -
      • -
      - - - - - - - -
        -
      • -

        array

        -
        public float[] array()
        -
        ( begin auto-generated from PVector_array.xml ) - - 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 PVector.get() method to copy into your own array. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        equals

        -
        public boolean equals(Object obj)
        -
        -
        Overrides:
        -
        equals in class Object
        -
        -
      • -
      - - - -
        -
      • -

        hashCode

        -
        public int hashCode()
        -
        -
        Overrides:
        -
        hashCode in class Object
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/ThinkDifferent.html b/build/javadoc/core/processing/core/ThinkDifferent.html deleted file mode 100644 index 0aaaef772d..0000000000 --- a/build/javadoc/core/processing/core/ThinkDifferent.html +++ /dev/null @@ -1,273 +0,0 @@ - - - - - -ThinkDifferent - - - - - - - - - - - -
-
processing.core
-

Class ThinkDifferent

-
-
- -
-
    -
  • -
    -
    -
    public class ThinkDifferent
    -extends Object
    -
    Deal with issues related to thinking differently. This handles the basic - Mac OS X menu commands (and apple events) for open, about, prefs, etc. - - This is a stripped-down version of what's in processing.app.platform to fix - 3301.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ThinkDifferent

        -
        public ThinkDifferent()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        init

        -
        public static void init(PApplet sketch)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/core/package-frame.html b/build/javadoc/core/processing/core/package-frame.html deleted file mode 100644 index 420b7ff9fa..0000000000 --- a/build/javadoc/core/processing/core/package-frame.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - -processing.core - - - - -

processing.core

- - - diff --git a/build/javadoc/core/processing/core/package-summary.html b/build/javadoc/core/processing/core/package-summary.html deleted file mode 100644 index 80226f6c8d..0000000000 --- a/build/javadoc/core/processing/core/package-summary.html +++ /dev/null @@ -1,288 +0,0 @@ - - - - - -processing.core - - - - - - - - - - -
-

Package processing.core

-
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    PConstants -
    Numbers shared throughout processing.core.
    -
    PMatrix 
    PSurface 
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    PApplet -
    Base class for all sketches that use processing.core.
    -
    PFont -
    Grayscale bitmap font class used by Processing.
    -
    PGraphics -
    ( begin auto-generated from PGraphics.xml ) - - Main graphics and rendering context, as well as the base API - implementation for processing "core".
    -
    PGraphicsDanger2D -
    Experimental/enhanced renderer that draws directly to the Graphics context - without an intermediate image.
    -
    PGraphicsFX2D 
    PGraphicsJava2D -
    Subclass for PGraphics that implements the graphics API using Java2D.
    -
    PImage -
    ( begin auto-generated from PImage.xml ) - - Datatype for storing images.
    -
    PMatrix2D -
    3x2 affine matrix implementation.
    -
    PMatrix3D -
    4x4 matrix implementation.
    -
    PShape -
    ( begin auto-generated from PShape.xml ) - - Datatype for storing shapes.
    -
    PShapeOBJ -
    This class is not part of the Processing API and should not be used - directly.
    -
    PShapeSVG -
    This class is not part of the Processing API and should not be used - directly.
    -
    PShapeSVG.Font 
    PShapeSVG.FontGlyph 
    PStyle 
    PSurfaceAWT 
    PSurfaceDanger 
    PSurfaceFX 
    PSurfaceFX.PApplicationFX 
    PSurfaceNone -
    Surface that's not really visible.
    -
    PVector -
    ( begin auto-generated from PVector.xml ) - - A class to describe a two or three dimensional vector.
    -
    ThinkDifferent -
    Deal with issues related to thinking differently.
    -
    -
  • -
-
- - - - - - diff --git a/build/javadoc/core/processing/core/package-tree.html b/build/javadoc/core/processing/core/package-tree.html deleted file mode 100644 index 733417e79d..0000000000 --- a/build/javadoc/core/processing/core/package-tree.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - -processing.core Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.core

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Interface Hierarchy

- -
- - - - - - diff --git a/build/javadoc/core/processing/data/FloatDict.html b/build/javadoc/core/processing/data/FloatDict.html deleted file mode 100644 index 226d215f3c..0000000000 --- a/build/javadoc/core/processing/data/FloatDict.html +++ /dev/null @@ -1,878 +0,0 @@ - - - - - -FloatDict - - - - - - - - - - - -
-
processing.data
-

Class FloatDict

-
-
- -
-
    -
  • -
    -
    -
    public class FloatDict
    -extends Object
    -
    A simple table class to use a String as a lookup for an float value.
    -
    -
    See Also:
    -
    IntDict, -StringDict
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        FloatDict

        -
        public FloatDict()
        -
      • -
      - - - -
        -
      • -

        FloatDict

        -
        public FloatDict(int length)
        -
        Create a new lookup with a specific size. This is more efficient than not - specifying a size. Use it when you know the rough size of the thing you're creating.
        -
      • -
      - - - -
        -
      • -

        FloatDict

        -
        public FloatDict(BufferedReader reader)
        -
        Read a set of entries from a Reader that has each key/value pair on - a single line, separated by a tab.
        -
      • -
      - - - -
        -
      • -

        FloatDict

        -
        public FloatDict(Object[][] pairs)
        -
        Constructor to allow (more intuitive) inline initialization, e.g.: -
        - new FloatDict(new Object[][] {
        -   { "key1", 1 },
        -   { "key2", 2 }
        - });
        - 
        -
      • -
      - - - -
        -
      • -

        FloatDict

        -
        public FloatDict(String[] keys,
        -                 float[] values)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        size

        -
        public int size()
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        Remove all entries.
        -
      • -
      - - - -
        -
      • -

        key

        -
        public String key(int index)
        -
      • -
      - - - - - - - -
        -
      • -

        keyArray

        -
        public String[] keyArray()
        -
        Return a copy of the internal keys array. This array can be modified.
        -
      • -
      - - - -
        -
      • -

        keyArray

        -
        public String[] keyArray(String[] outgoing)
        -
      • -
      - - - -
        -
      • -

        value

        -
        public float value(int index)
        -
      • -
      - - - - - - - -
        -
      • -

        valueArray

        -
        public float[] valueArray()
        -
        Create a new array and copy each of the values into it.
        -
      • -
      - - - -
        -
      • -

        valueArray

        -
        public float[] valueArray(float[] array)
        -
        Fill an already-allocated array with the values (more efficient than - creating a new array each time). If 'array' is null, or not the same - size as the number of values, a new array will be allocated and returned.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public float get(String key)
        -
        Return a value for the specified key.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public float get(String key,
        -                 float alternate)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String key,
        -                float amount)
        -
      • -
      - - - -
        -
      • -

        hasKey

        -
        public boolean hasKey(String key)
        -
      • -
      - - - -
        -
      • -

        add

        -
        public void add(String key,
        -                float amount)
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public void sub(String key,
        -                float amount)
        -
      • -
      - - - -
        -
      • -

        mult

        -
        public void mult(String key,
        -                 float amount)
        -
      • -
      - - - -
        -
      • -

        div

        -
        public void div(String key,
        -                float amount)
        -
      • -
      - - - -
        -
      • -

        minIndex

        -
        public int minIndex()
        -
      • -
      - - - -
        -
      • -

        minKey

        -
        public String minKey()
        -
      • -
      - - - -
        -
      • -

        minValue

        -
        public float minValue()
        -
      • -
      - - - -
        -
      • -

        maxIndex

        -
        public int maxIndex()
        -
      • -
      - - - -
        -
      • -

        maxKey

        -
        public String maxKey()
        -
        The key for a max value, or null if everything is NaN (no max).
        -
      • -
      - - - -
        -
      • -

        maxValue

        -
        public float maxValue()
        -
        The max value. (Or NaN if they're all NaN.)
        -
      • -
      - - - -
        -
      • -

        index

        -
        public int index(String what)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public int remove(String key)
        -
      • -
      - - - -
        -
      • -

        removeIndex

        -
        public String removeIndex(int index)
        -
      • -
      - - - -
        -
      • -

        swap

        -
        public void swap(int a,
        -                 int b)
        -
      • -
      - - - -
        -
      • -

        sortKeys

        -
        public void sortKeys()
        -
        Sort the keys alphabetically (ignoring case). Uses the value as a - tie-breaker (only really possible with a key that has a case change).
        -
      • -
      - - - -
        -
      • -

        sortKeysReverse

        -
        public void sortKeysReverse()
        -
      • -
      - - - -
        -
      • -

        sortValues

        -
        public void sortValues()
        -
        Sort by values in descending order (largest value will be at [0]).
        -
      • -
      - - - -
        -
      • -

        sortValuesReverse

        -
        public void sortValuesReverse()
        -
      • -
      - - - -
        -
      • -

        getPercent

        -
        public FloatDict getPercent()
        -
        Sum all of the values in this dictionary, then return a new FloatDict of - each key, divided by the total sum. The total for all values will be ~1.0.
        -
        -
        Returns:
        -
        a Dict with the original keys, mapped to their pct of the total
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public FloatDict copy()
        -
        Returns a duplicate copy of this object.
        -
      • -
      - - - -
        -
      • -

        print

        -
        public void print()
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write(PrintWriter writer)
        -
        Write tab-delimited entries out to
        -
        -
        Parameters:
        -
        writer -
        -
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/data/FloatList.html b/build/javadoc/core/processing/data/FloatList.html deleted file mode 100644 index dfb4533da2..0000000000 --- a/build/javadoc/core/processing/data/FloatList.html +++ /dev/null @@ -1,1042 +0,0 @@ - - - - - -FloatList - - - - - - - - - - - -
-
processing.data
-

Class FloatList

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Iterable<Float>
    -
    -
    -
    -
    public class FloatList
    -extends Object
    -implements Iterable<Float>
    -
    Helper class for a list of floats. Lists are designed to have some of the - features of ArrayLists, but to maintain the simplicity and efficiency of - working with arrays. - - Functions like sort() and shuffle() always act on the list itself. To get - a sorted copy, use list.copy().sort().
    -
    -
    See Also:
    -
    IntList, -StringList
    -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - - - -
      Constructors 
      Constructor and Description
      FloatList() 
      FloatList(float[] list) 
      FloatList(int length) 
      FloatList(Iterable<Object> iter) -
      Construct an FloatList from an iterable pile of objects.
      -
      FloatList(Object... items) -
      Construct an FloatList from a random pile of objects.
      -
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidadd(int index, - float amount) 
      voidappend(float value) -
      Add a new entry to the list.
      -
      voidappend(float[] values) 
      voidappend(FloatList list) 
      voidappendUnique(float value) -
      Add this value, but only if it's not already in the list.
      -
      float[]array() -
      Create a new array with a copy of all the values.
      -
      float[]array(float[] array) -
      Copy values into the specified array.
      -
      voidclear() -
      Remove all entries from the list.
      -
      FloatListcopy() 
      voiddiv(int index, - float amount) 
      floatget(int index) -
      Get an entry at a particular index.
      -
      FloatListgetPercent() -
      Returns a normalized version of this array.
      -
      FloatListgetSubset(int start) 
      FloatListgetSubset(int start, - int num) 
      booleanhasValue(float value) 
      intindex(float what) -
      Return the first index of a particular value.
      -
      voidinsert(int index, - float value) 
      voidinsert(int index, - float[] values) 
      voidinsert(int index, - FloatList list) 
      Iterator<Float>iterator() -
      Implemented this way so that we can use a FloatList in a for loop.
      -
      Stringjoin(String separator) 
      floatmax() 
      intmaxIndex() 
      floatmin() 
      intminIndex() 
      voidmult(int index, - float amount) 
      floatpop() 
      voidprint() 
      voidpush(float value) -
      Just an alias for append(), but matches pop()
      -
      floatremove(int index) -
      Remove an element from the specified index.
      -
      intremoveValue(int value) 
      intremoveValues(int value) 
      booleanreplaceValue(float value, - float newValue) -
      Replace the first instance of a particular value
      -
      booleanreplaceValues(float value, - float newValue) -
      Replace all instances of a particular value
      -
      voidresize(int length) 
      voidreverse() 
      voidset(int index, - float what) -
      Set the entry at a particular index.
      -
      voidshuffle() -
      Randomize the order of the list elements.
      -
      voidshuffle(PApplet sketch) -
      Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
      -
      intsize() -
      Get the length of the list.
      -
      voidsort() -
      Sorts the array in place.
      -
      voidsortReverse() -
      Reverse sort, orders values from highest to lowest
      -
      voidsub(int index, - float amount) 
      floatsum() 
      StringtoString() 
      float[]values() -
      Returns the actual array being used to store the data.
      -
      - - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        FloatList

        -
        public FloatList()
        -
      • -
      - - - -
        -
      • -

        FloatList

        -
        public FloatList(int length)
        -
      • -
      - - - -
        -
      • -

        FloatList

        -
        public FloatList(float[] list)
        -
      • -
      - - - -
        -
      • -

        FloatList

        -
        public FloatList(Iterable<Object> iter)
        -
        Construct an FloatList from an iterable pile of objects. - For instance, a float array, an array of strings, who knows). - Un-parseable or null values will be set to NaN.
        -
      • -
      - - - -
        -
      • -

        FloatList

        -
        public FloatList(Object... items)
        -
        Construct an FloatList from a random pile of objects. - Un-parseable or null values will be set to NaN.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        size

        -
        public int size()
        -
        Get the length of the list.
        -
      • -
      - - - -
        -
      • -

        resize

        -
        public void resize(int length)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        Remove all entries from the list.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public float get(int index)
        -
        Get an entry at a particular index.
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int index,
        -                float what)
        -
        Set the entry at a particular index. If the index is past the length of - the list, it'll expand the list to accommodate, and fill the intermediate - entries with 0s.
        -
      • -
      - - - -
        -
      • -

        push

        -
        public void push(float value)
        -
        Just an alias for append(), but matches pop()
        -
      • -
      - - - -
        -
      • -

        pop

        -
        public float pop()
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public float remove(int index)
        -
        Remove an element from the specified index.
        -
      • -
      - - - -
        -
      • -

        removeValue

        -
        public int removeValue(int value)
        -
      • -
      - - - -
        -
      • -

        removeValues

        -
        public int removeValues(int value)
        -
      • -
      - - - -
        -
      • -

        replaceValue

        -
        public boolean replaceValue(float value,
        -                            float newValue)
        -
        Replace the first instance of a particular value
        -
      • -
      - - - -
        -
      • -

        replaceValues

        -
        public boolean replaceValues(float value,
        -                             float newValue)
        -
        Replace all instances of a particular value
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(float value)
        -
        Add a new entry to the list.
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(float[] values)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(FloatList list)
        -
      • -
      - - - -
        -
      • -

        appendUnique

        -
        public void appendUnique(float value)
        -
        Add this value, but only if it's not already in the list.
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   float value)
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   float[] values)
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   FloatList list)
        -
      • -
      - - - -
        -
      • -

        index

        -
        public int index(float what)
        -
        Return the first index of a particular value.
        -
      • -
      - - - -
        -
      • -

        hasValue

        -
        public boolean hasValue(float value)
        -
      • -
      - - - -
        -
      • -

        add

        -
        public void add(int index,
        -                float amount)
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public void sub(int index,
        -                float amount)
        -
      • -
      - - - -
        -
      • -

        mult

        -
        public void mult(int index,
        -                 float amount)
        -
      • -
      - - - -
        -
      • -

        div

        -
        public void div(int index,
        -                float amount)
        -
      • -
      - - - -
        -
      • -

        min

        -
        public float min()
        -
      • -
      - - - -
        -
      • -

        minIndex

        -
        public int minIndex()
        -
      • -
      - - - -
        -
      • -

        max

        -
        public float max()
        -
      • -
      - - - -
        -
      • -

        maxIndex

        -
        public int maxIndex()
        -
      • -
      - - - -
        -
      • -

        sum

        -
        public float sum()
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public void sort()
        -
        Sorts the array in place.
        -
      • -
      - - - -
        -
      • -

        sortReverse

        -
        public void sortReverse()
        -
        Reverse sort, orders values from highest to lowest
        -
      • -
      - - - -
        -
      • -

        reverse

        -
        public void reverse()
        -
      • -
      - - - -
        -
      • -

        shuffle

        -
        public void shuffle()
        -
        Randomize the order of the list elements. Note that this does not - obey the randomSeed() function in PApplet.
        -
      • -
      - - - -
        -
      • -

        shuffle

        -
        public void shuffle(PApplet sketch)
        -
        Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
        -
      • -
      - - - - - - - -
        -
      • -

        values

        -
        public float[] values()
        -
        Returns the actual array being used to store the data. For advanced users, - this is the fastest way to access a large list. Suitable for iterating - with a for() loop, but modifying the list will have terrible consequences.
        -
      • -
      - - - -
        -
      • -

        iterator

        -
        public Iterator<Float> iterator()
        -
        Implemented this way so that we can use a FloatList in a for loop.
        -
        -
        Specified by:
        -
        iterator in interface Iterable<Float>
        -
        -
      • -
      - - - -
        -
      • -

        array

        -
        public float[] array()
        -
        Create a new array with a copy of all the values.
        -
        -
        Returns:
        -
        an array sized by the length of the list with each of the values.
        -
        -
      • -
      - - - -
        -
      • -

        array

        -
        public float[] array(float[] array)
        -
        Copy values into the specified array. If the specified array is null or - not the same size, a new array will be allocated.
        -
        -
        Parameters:
        -
        array -
        -
        -
      • -
      - - - -
        -
      • -

        getPercent

        -
        public FloatList getPercent()
        -
        Returns a normalized version of this array. Called getPercent() for - consistency with the Dict classes. It's a getter method because it needs - to returns a new list (because IntList/Dict can't do percentages or - normalization in place on int values).
        -
      • -
      - - - -
        -
      • -

        getSubset

        -
        public FloatList getSubset(int start)
        -
      • -
      - - - -
        -
      • -

        getSubset

        -
        public FloatList getSubset(int start,
        -                           int num)
        -
      • -
      - - - - - - - -
        -
      • -

        print

        -
        public void print()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/data/IntDict.html b/build/javadoc/core/processing/data/IntDict.html deleted file mode 100644 index d0b045bda3..0000000000 --- a/build/javadoc/core/processing/data/IntDict.html +++ /dev/null @@ -1,935 +0,0 @@ - - - - - -IntDict - - - - - - - - - - - -
-
processing.data
-

Class IntDict

-
-
- -
-
    -
  • -
    -
    -
    public class IntDict
    -extends Object
    -
    A simple class to use a String as a lookup for an int value.
    -
    -
    See Also:
    -
    FloatDict, -StringDict
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        IntDict

        -
        public IntDict()
        -
      • -
      - - - -
        -
      • -

        IntDict

        -
        public IntDict(int length)
        -
        Create a new lookup with a specific size. This is more efficient than not - specifying a size. Use it when you know the rough size of the thing you're creating.
        -
      • -
      - - - -
        -
      • -

        IntDict

        -
        public IntDict(BufferedReader reader)
        -
        Read a set of entries from a Reader that has each key/value pair on - a single line, separated by a tab.
        -
      • -
      - - - -
        -
      • -

        IntDict

        -
        public IntDict(String[] keys,
        -               int[] values)
        -
      • -
      - - - -
        -
      • -

        IntDict

        -
        public IntDict(Object[][] pairs)
        -
        Constructor to allow (more intuitive) inline initialization, e.g.: -
        - new FloatDict(new Object[][] {
        -   { "key1", 1 },
        -   { "key2", 2 }
        - });
        - 
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        size

        -
        public int size()
        -
        Returns the number of key/value pairs
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        Remove all entries.
        -
      • -
      - - - -
        -
      • -

        key

        -
        public String key(int index)
        -
      • -
      - - - -
        -
      • -

        keys

        -
        public Iterable<String> keys()
        -
        Return the internal array being used to store the keys. Allocated but - unused entries will be removed. This array should not be modified.
        -
      • -
      - - - - - - - -
        -
      • -

        keyArray

        -
        public String[] keyArray()
        -
        Return a copy of the internal keys array. This array can be modified.
        -
      • -
      - - - -
        -
      • -

        keyArray

        -
        public String[] keyArray(String[] outgoing)
        -
      • -
      - - - -
        -
      • -

        value

        -
        public int value(int index)
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        valueArray

        -
        public int[] valueArray()
        -
        Create a new array and copy each of the values into it.
        -
      • -
      - - - -
        -
      • -

        valueArray

        -
        public int[] valueArray(int[] array)
        -
        Fill an already-allocated array with the values (more efficient than - creating a new array each time). If 'array' is null, or not the same - size as the number of values, a new array will be allocated and returned.
        -
        -
        Parameters:
        -
        array - values to copy into the array
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get(String key)
        -
        Return a value for the specified key.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get(String key,
        -               int alternate)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String key,
        -                int amount)
        -
        Create a new key/value pair or change the value of one.
        -
      • -
      - - - -
        -
      • -

        hasKey

        -
        public boolean hasKey(String key)
        -
      • -
      - - - -
        -
      • -

        increment

        -
        public void increment(String key)
        -
        Increase the value associated with a specific key by 1.
        -
      • -
      - - - -
        -
      • -

        add

        -
        public void add(String key,
        -                int amount)
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public void sub(String key,
        -                int amount)
        -
      • -
      - - - -
        -
      • -

        mult

        -
        public void mult(String key,
        -                 int amount)
        -
      • -
      - - - -
        -
      • -

        div

        -
        public void div(String key,
        -                int amount)
        -
      • -
      - - - -
        -
      • -

        minIndex

        -
        public int minIndex()
        -
      • -
      - - - -
        -
      • -

        minValue

        -
        public int minValue()
        -
      • -
      - - - -
        -
      • -

        minKey

        -
        public String minKey()
        -
      • -
      - - - -
        -
      • -

        maxIndex

        -
        public int maxIndex()
        -
      • -
      - - - -
        -
      • -

        maxValue

        -
        public int maxValue()
        -
      • -
      - - - -
        -
      • -

        maxKey

        -
        public String maxKey()
        -
      • -
      - - - -
        -
      • -

        index

        -
        public int index(String what)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public int remove(String key)
        -
      • -
      - - - -
        -
      • -

        removeIndex

        -
        public String removeIndex(int index)
        -
      • -
      - - - -
        -
      • -

        swap

        -
        public void swap(int a,
        -                 int b)
        -
      • -
      - - - -
        -
      • -

        sortKeys

        -
        public void sortKeys()
        -
        Sort the keys alphabetically (ignoring case). Uses the value as a - tie-breaker (only really possible with a key that has a case change).
        -
      • -
      - - - -
        -
      • -

        sortKeysReverse

        -
        public void sortKeysReverse()
        -
        Sort the keys alphabetically in reverse (ignoring case). Uses the value as a - tie-breaker (only really possible with a key that has a case change).
        -
      • -
      - - - -
        -
      • -

        sortValues

        -
        public void sortValues()
        -
        Sort by values in ascending order. The smallest value will be at [0].
        -
      • -
      - - - -
        -
      • -

        sortValuesReverse

        -
        public void sortValuesReverse()
        -
        Sort by values in descending order. The largest value will be at [0].
        -
      • -
      - - - -
        -
      • -

        getPercent

        -
        public FloatDict getPercent()
        -
        Sum all of the values in this dictionary, then return a new FloatDict of - each key, divided by the total sum. The total for all values will be ~1.0.
        -
        -
        Returns:
        -
        a Dict with the original keys, mapped to their pct of the total
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public IntDict copy()
        -
        Returns a duplicate copy of this object.
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write(PrintWriter writer)
        -
        Write tab-delimited entries out to
        -
        -
        Parameters:
        -
        writer -
        -
        -
      • -
      - - - -
        -
      • -

        print

        -
        public void print()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/data/IntList.html b/build/javadoc/core/processing/data/IntList.html deleted file mode 100644 index b7b469641c..0000000000 --- a/build/javadoc/core/processing/data/IntList.html +++ /dev/null @@ -1,1044 +0,0 @@ - - - - - -IntList - - - - - - - - - - - -
-
processing.data
-

Class IntList

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Iterable<Integer>
    -
    -
    -
    -
    public class IntList
    -extends Object
    -implements Iterable<Integer>
    -
    Helper class for a list of ints. Lists are designed to have some of the - features of ArrayLists, but to maintain the simplicity and efficiency of - working with arrays. - - Functions like sort() and shuffle() always act on the list itself. To get - a sorted copy, use list.copy().sort().
    -
    -
    See Also:
    -
    FloatList, -StringList
    -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - - - -
      Constructors 
      Constructor and Description
      IntList() 
      IntList(int length) 
      IntList(int[] source) 
      IntList(Iterable<Object> iter) -
      Construct an IntList from an iterable pile of objects.
      -
      IntList(Object... items) -
      Construct an IntList from a random pile of objects.
      -
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidadd(int index, - int amount) 
      voidappend(int value) -
      Add a new entry to the list.
      -
      voidappend(int[] values) 
      voidappend(IntList list) 
      voidappendUnique(int value) -
      Add this value, but only if it's not already in the list.
      -
      int[]array() -
      Create a new array with a copy of all the values.
      -
      int[]array(int[] array) -
      Copy values into the specified array.
      -
      voidclear() -
      Remove all entries from the list.
      -
      IntListcopy() 
      voiddiv(int index, - int amount) 
      static IntListfromRange(int stop) 
      static IntListfromRange(int start, - int stop) 
      intget(int index) -
      Get an entry at a particular index.
      -
      FloatListgetPercent() -
      Returns a normalized version of this array.
      -
      IntListgetSubset(int start) 
      IntListgetSubset(int start, - int num) 
      booleanhasValue(int value) 
      voidincrement(int index) 
      intindex(int what) -
      Return the first index of a particular value.
      -
      voidinsert(int index, - int value) 
      voidinsert(int index, - int[] values) 
      voidinsert(int index, - IntList list) 
      Iterator<Integer>iterator() 
      Stringjoin(String separator) 
      intmax() 
      intmaxIndex() 
      intmin() 
      intminIndex() 
      voidmult(int index, - int amount) 
      intpop() 
      voidprint() 
      voidpush(int value) -
      Just an alias for append(), but matches pop()
      -
      intremove(int index) -
      Remove an element from the specified index
      -
      intremoveValue(int value) 
      intremoveValues(int value) 
      voidresize(int length) 
      voidreverse() 
      voidset(int index, - int what) -
      Set the entry at a particular index.
      -
      voidshuffle() -
      Randomize the order of the list elements.
      -
      voidshuffle(PApplet sketch) -
      Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
      -
      intsize() -
      Get the length of the list.
      -
      voidsort() -
      Sorts the array in place.
      -
      voidsortReverse() -
      Reverse sort, orders values from highest to lowest.
      -
      voidsub(int index, - int amount) 
      intsum() 
      StringtoString() 
      int[]values() -
      Returns the actual array being used to store the data.
      -
      - - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        IntList

        -
        public IntList()
        -
      • -
      - - - -
        -
      • -

        IntList

        -
        public IntList(int length)
        -
      • -
      - - - -
        -
      • -

        IntList

        -
        public IntList(int[] source)
        -
      • -
      - - - -
        -
      • -

        IntList

        -
        public IntList(Iterable<Object> iter)
        -
        Construct an IntList from an iterable pile of objects. - For instance, a float array, an array of strings, who knows). - Un-parseable or null values will be set to 0.
        -
      • -
      - - - -
        -
      • -

        IntList

        -
        public IntList(Object... items)
        -
        Construct an IntList from a random pile of objects. - Un-parseable or null values will be set to zero.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        fromRange

        -
        public static IntList fromRange(int stop)
        -
      • -
      - - - -
        -
      • -

        fromRange

        -
        public static IntList fromRange(int start,
        -                                int stop)
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
        Get the length of the list.
        -
      • -
      - - - -
        -
      • -

        resize

        -
        public void resize(int length)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        Remove all entries from the list.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get(int index)
        -
        Get an entry at a particular index.
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int index,
        -                int what)
        -
        Set the entry at a particular index. If the index is past the length of - the list, it'll expand the list to accommodate, and fill the intermediate - entries with 0s.
        -
      • -
      - - - -
        -
      • -

        push

        -
        public void push(int value)
        -
        Just an alias for append(), but matches pop()
        -
      • -
      - - - -
        -
      • -

        pop

        -
        public int pop()
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public int remove(int index)
        -
        Remove an element from the specified index
        -
      • -
      - - - -
        -
      • -

        removeValue

        -
        public int removeValue(int value)
        -
      • -
      - - - -
        -
      • -

        removeValues

        -
        public int removeValues(int value)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(int value)
        -
        Add a new entry to the list.
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(int[] values)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(IntList list)
        -
      • -
      - - - -
        -
      • -

        appendUnique

        -
        public void appendUnique(int value)
        -
        Add this value, but only if it's not already in the list.
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   int value)
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   int[] values)
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   IntList list)
        -
      • -
      - - - -
        -
      • -

        index

        -
        public int index(int what)
        -
        Return the first index of a particular value.
        -
      • -
      - - - -
        -
      • -

        hasValue

        -
        public boolean hasValue(int value)
        -
      • -
      - - - -
        -
      • -

        increment

        -
        public void increment(int index)
        -
      • -
      - - - -
        -
      • -

        add

        -
        public void add(int index,
        -                int amount)
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public void sub(int index,
        -                int amount)
        -
      • -
      - - - -
        -
      • -

        mult

        -
        public void mult(int index,
        -                 int amount)
        -
      • -
      - - - -
        -
      • -

        div

        -
        public void div(int index,
        -                int amount)
        -
      • -
      - - - -
        -
      • -

        min

        -
        public int min()
        -
      • -
      - - - -
        -
      • -

        minIndex

        -
        public int minIndex()
        -
      • -
      - - - -
        -
      • -

        max

        -
        public int max()
        -
      • -
      - - - -
        -
      • -

        maxIndex

        -
        public int maxIndex()
        -
      • -
      - - - -
        -
      • -

        sum

        -
        public int sum()
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public void sort()
        -
        Sorts the array in place.
        -
      • -
      - - - -
        -
      • -

        sortReverse

        -
        public void sortReverse()
        -
        Reverse sort, orders values from highest to lowest.
        -
      • -
      - - - -
        -
      • -

        reverse

        -
        public void reverse()
        -
      • -
      - - - -
        -
      • -

        shuffle

        -
        public void shuffle()
        -
        Randomize the order of the list elements. Note that this does not - obey the randomSeed() function in PApplet.
        -
      • -
      - - - -
        -
      • -

        shuffle

        -
        public void shuffle(PApplet sketch)
        -
        Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public IntList copy()
        -
      • -
      - - - -
        -
      • -

        values

        -
        public int[] values()
        -
        Returns the actual array being used to store the data. For advanced users, - this is the fastest way to access a large list. Suitable for iterating - with a for() loop, but modifying the list will have terrible consequences.
        -
      • -
      - - - - - - - -
        -
      • -

        array

        -
        public int[] array()
        -
        Create a new array with a copy of all the values.
        -
        -
        Returns:
        -
        an array sized by the length of the list with each of the values.
        -
        -
      • -
      - - - -
        -
      • -

        array

        -
        public int[] array(int[] array)
        -
        Copy values into the specified array. If the specified array is null or - not the same size, a new array will be allocated.
        -
        -
        Parameters:
        -
        array -
        -
        -
      • -
      - - - -
        -
      • -

        getPercent

        -
        public FloatList getPercent()
        -
        Returns a normalized version of this array. Called getPercent() for - consistency with the Dict classes. It's a getter method because it needs - to returns a new list (because IntList/Dict can't do percentages or - normalization in place on int values).
        -
      • -
      - - - -
        -
      • -

        getSubset

        -
        public IntList getSubset(int start)
        -
      • -
      - - - -
        -
      • -

        getSubset

        -
        public IntList getSubset(int start,
        -                         int num)
        -
      • -
      - - - - - - - -
        -
      • -

        print

        -
        public void print()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/data/JSONArray.html b/build/javadoc/core/processing/data/JSONArray.html deleted file mode 100644 index e032466f16..0000000000 --- a/build/javadoc/core/processing/data/JSONArray.html +++ /dev/null @@ -1,1484 +0,0 @@ - - - - - -JSONArray - - - - - - - - - - - -
-
processing.data
-

Class JSONArray

-
-
- -
-
    -
  • -
    -
    -
    public class JSONArray
    -extends Object
    -
    A JSONArray is an ordered sequence of values. Its external text form is a - string wrapped in square brackets with commas separating the values. The - internal form is an object having get and opt - methods for accessing the values by index, and put methods for - adding or replacing values. The values can be any of these types: - Boolean, JSONArray, JSONObject, - Number, String, or the - JSONObject.NULL object. -

    - The constructor can convert a JSON text into a Java object. The - toString method converts to JSON text. -

    - A get method returns a value if one can be found, and throws an - exception if one cannot be found. An opt method returns a - default value instead of throwing an exception, and so is useful for - obtaining optional values. -

    - The generic get() and opt() methods return an - object which you can cast or query for type. There are also typed - get and opt methods that do type checking and type - coercion for you. -

    - The texts produced by the toString methods strictly conform to - JSON syntax rules. The constructors are more forgiving in the texts they will - accept: -

      -
    • An extra , (comma) may appear just - before the closing bracket.
    • -
    • The null value will be inserted when there is , -  (comma) elision.
    • -
    • Strings may be quoted with ' (single - quote).
    • -
    • Strings do not need to be quoted at all if they do not begin with a quote - or single quote, and if they do not contain leading or trailing spaces, and - if they do not contain any of these characters: - { } [ ] / \ : , = ; # and if they do not look like numbers and - if they are not the reserved words true, false, or - null.
    • -
    • Values can be separated by ; (semicolon) as - well as by , (comma).
    • -
    -
    -
    See Also:
    -
    JSONObject, -PApplet.loadJSONObject(String), -PApplet.loadJSONArray(String), -PApplet.saveJSONObject(JSONObject, String), -PApplet.saveJSONArray(JSONArray, String)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JSONArray

        -
        public JSONArray()
        -
        Construct an empty JSONArray.
        -
      • -
      - - - -
        -
      • -

        JSONArray

        -
        public JSONArray(Reader reader)
        -
      • -
      - - - -
        -
      • -

        JSONArray

        -
        public JSONArray(IntList list)
        -
      • -
      - - - -
        -
      • -

        JSONArray

        -
        public JSONArray(FloatList list)
        -
      • -
      - - - -
        -
      • -

        JSONArray

        -
        public JSONArray(StringList list)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        parse

        -
        public static JSONArray parse(String source)
        -
        Construct a JSONArray from a source JSON text.
        -
        -
        Parameters:
        -
        source - A string that begins with - [ (left bracket) - and ends with ] (right bracket).
        -
        Throws:
        -
        JSONException - If there is a syntax error.
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public String getString(int index)
        -
        Get the string associated with an index.
        -
        -
        Parameters:
        -
        index - must be between 0 and length() - 1
        -
        Returns:
        -
        A string value.
        -
        Throws:
        -
        JSONException - If there is no string value for the index.
        -
        See Also:
        -
        getInt(int), -getFloat(int), -getBoolean(int)
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public String getString(int index,
        -                        String defaultValue)
        -
        Get the optional string associated with an index. - The defaultValue is returned if the key is not found.
        -
        -
        Parameters:
        -
        index - The index must be between 0 and length() - 1.
        -
        defaultValue - The default value.
        -
        Returns:
        -
        A String value.
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt(int index)
        -
        Get the int value associated with an index.
        -
        -
        Parameters:
        -
        index - must be between 0 and length() - 1
        -
        Returns:
        -
        The value.
        -
        Throws:
        -
        JSONException - If the key is not found or if the value is not a number.
        -
        See Also:
        -
        getFloat(int), -getString(int), -getBoolean(int)
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt(int index,
        -                  int defaultValue)
        -
        Get the optional int value associated with an index. - The defaultValue is returned if there is no value for the index, - or if the value is not a number and cannot be converted to a number.
        -
        -
        Parameters:
        -
        index - The index must be between 0 and length() - 1.
        -
        defaultValue - The default value.
        -
        Returns:
        -
        The value.
        -
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong(int index)
        -
        Get the long value associated with an index.
        -
        -
        Parameters:
        -
        index - The index must be between 0 and length() - 1
        -
        Returns:
        -
        The value.
        -
        Throws:
        -
        JSONException - If the key is not found or if the value cannot - be converted to a number.
        -
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong(int index,
        -                    long defaultValue)
        -
        Get the optional long value associated with an index. - The defaultValue is returned if there is no value for the index, - or if the value is not a number and cannot be converted to a number.
        -
        -
        Parameters:
        -
        index - The index must be between 0 and length() - 1.
        -
        defaultValue - The default value.
        -
        Returns:
        -
        The value.
        -
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        public float getFloat(int index)
        -
        Get a value from an index as a float. JSON uses 'double' values - internally, so this is simply getDouble() cast to a float.
        -
        -
        Parameters:
        -
        index - must be between 0 and length() - 1
        -
        See Also:
        -
        getInt(int), -getString(int), -getBoolean(int)
        -
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        public float getFloat(int index,
        -                      float defaultValue)
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(int index)
        -
        Get the double value associated with an index.
        -
        -
        Parameters:
        -
        index - must be between 0 and length() - 1
        -
        Returns:
        -
        The value.
        -
        Throws:
        -
        JSONException - If the key is not found or if the value cannot - be converted to a number.
        -
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(int index,
        -                        double defaultValue)
        -
        Get the optional double value associated with an index. - The defaultValue is returned if there is no value for the index, - or if the value is not a number and cannot be converted to a number.
        -
        -
        Parameters:
        -
        index - subscript
        -
        defaultValue - The default value.
        -
        Returns:
        -
        The value.
        -
        -
      • -
      - - - -
        -
      • -

        getBoolean

        -
        public boolean getBoolean(int index)
        -
        Get the boolean value associated with an index. - The string values "true" and "false" are converted to boolean.
        -
        -
        Parameters:
        -
        index - must be between 0 and length() - 1
        -
        Returns:
        -
        The truth.
        -
        Throws:
        -
        JSONException - If there is no value for the index or if the - value is not convertible to boolean.
        -
        See Also:
        -
        getInt(int), -getFloat(int), -getString(int)
        -
        -
      • -
      - - - -
        -
      • -

        getBoolean

        -
        public boolean getBoolean(int index,
        -                          boolean defaultValue)
        -
        Get the optional boolean value associated with an index. - It returns the defaultValue if there is no value at that index or if - it is not a Boolean or the String "true" or "false" (case insensitive).
        -
        -
        Parameters:
        -
        index - The index must be between 0 and length() - 1.
        -
        defaultValue - A boolean default.
        -
        Returns:
        -
        The truth.
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getJSONArray

        -
        public JSONArray getJSONArray(int index,
        -                              JSONArray defaultValue)
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getStringArray

        -
        public String[] getStringArray()
        -
        Get this entire array as a String array.
        -
        -
        See Also:
        -
        getIntArray()
        -
        -
      • -
      - - - -
        -
      • -

        getIntArray

        -
        public int[] getIntArray()
        -
        Get this entire array as an int array. Everything must be an int.
        -
        -
        See Also:
        -
        getStringArray()
        -
        -
      • -
      - - - -
        -
      • -

        getLongArray

        -
        public long[] getLongArray()
        -
        Get this entire array as a long array. Everything must be an long.
        -
      • -
      - - - -
        -
      • -

        getFloatArray

        -
        public float[] getFloatArray()
        -
        Get this entire array as a float array. Everything must be an float.
        -
      • -
      - - - -
        -
      • -

        getDoubleArray

        -
        public double[] getDoubleArray()
        -
        Get this entire array as a double array. Everything must be an double.
        -
      • -
      - - - -
        -
      • -

        getBooleanArray

        -
        public boolean[] getBooleanArray()
        -
        Get this entire array as a boolean array. Everything must be a boolean.
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(String value)
        -
        Append an String value. This increases the array's length by one.
        -
        -
        Parameters:
        -
        value - a String value
        -
        Returns:
        -
        this.
        -
        See Also:
        -
        size(), -remove(int)
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(int value)
        -
        Append an int value. This increases the array's length by one.
        -
        -
        Parameters:
        -
        value - an int value
        -
        Returns:
        -
        this.
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(long value)
        -
        Append an long value. This increases the array's length by one.
        -
        -
        Parameters:
        -
        value - A long value.
        -
        Returns:
        -
        this.
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(float value)
        -
        Append a float value. This increases the array's length by one. - This will store the value as a double, since there are no floats in JSON.
        -
        -
        Parameters:
        -
        value - a float value
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - if the value is not finite.
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(double value)
        -
        Append a double value. This increases the array's length by one.
        -
        -
        Parameters:
        -
        value - A double value.
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - if the value is not finite.
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(boolean value)
        -
        Append a boolean value. This increases the array's length by one.
        -
        -
        Parameters:
        -
        value - a boolean value
        -
        Returns:
        -
        this.
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(JSONArray value)
        -
        -
        Parameters:
        -
        value - a JSONArray value
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(JSONObject value)
        -
        -
        Parameters:
        -
        value - a JSONObject value
        -
        -
      • -
      - - - -
        -
      • -

        setString

        -
        public JSONArray setString(int index,
        -                           String value)
        -
        Put or replace a String value. If the index is greater than the length of - the JSONArray, then null elements will be added as necessary to pad - it out.
        -
        -
        Parameters:
        -
        index - an index value
        -
        value - the value to assign
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - If the index is negative.
        -
        See Also:
        -
        setInt(int, int), -setFloat(int, float), -setBoolean(int, boolean)
        -
        -
      • -
      - - - -
        -
      • -

        setInt

        -
        public JSONArray setInt(int index,
        -                        int value)
        -
        Put or replace an int value. If the index is greater than the length of - the JSONArray, then null elements will be added as necessary to pad - it out.
        -
        -
        Parameters:
        -
        index - an index value
        -
        value - the value to assign
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - If the index is negative.
        -
        See Also:
        -
        setFloat(int, float), -setString(int, String), -setBoolean(int, boolean)
        -
        -
      • -
      - - - -
        -
      • -

        setLong

        -
        public JSONArray setLong(int index,
        -                         long value)
        -
        Put or replace a long value. If the index is greater than the length of - the JSONArray, then null elements will be added as necessary to pad - it out.
        -
        -
        Parameters:
        -
        index - The subscript.
        -
        value - A long value.
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - If the index is negative.
        -
        -
      • -
      - - - -
        -
      • -

        setFloat

        -
        public JSONArray setFloat(int index,
        -                          float value)
        -
        Put or replace a float value. If the index is greater than the length - of the JSONArray, then null elements will be added as necessary to pad - it out. There are no 'double' values in JSON, so this is passed to - setDouble(value).
        -
        -
        Parameters:
        -
        index - an index value
        -
        value - the value to assign
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        RuntimeException - If the index is negative or if the value is - not finite.
        -
        See Also:
        -
        setInt(int, int), -setString(int, String), -setBoolean(int, boolean)
        -
        -
      • -
      - - - -
        -
      • -

        setDouble

        -
        public JSONArray setDouble(int index,
        -                           double value)
        -
        Put or replace a double value. If the index is greater than the length of - the JSONArray, then null elements will be added as necessary to pad - it out.
        -
        -
        Parameters:
        -
        index - The subscript.
        -
        value - A double value.
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - If the index is negative or if the value is - not finite.
        -
        -
      • -
      - - - -
        -
      • -

        setBoolean

        -
        public JSONArray setBoolean(int index,
        -                            boolean value)
        -
        Put or replace a boolean value in the JSONArray. If the index is greater - than the length of the JSONArray, then null elements will be added as - necessary to pad it out.
        -
        -
        Parameters:
        -
        index - an index value
        -
        value - the value to assign
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - If the index is negative.
        -
        See Also:
        -
        setInt(int, int), -setFloat(int, float), -setString(int, String)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        size

        -
        public int size()
        -
        Get the number of elements in the JSONArray, included nulls.
        -
        -
        Returns:
        -
        The length (or size).
        -
        See Also:
        -
        append(String), -remove(int)
        -
        -
      • -
      - - - -
        -
      • -

        isNull

        -
        public boolean isNull(int index)
        -
        Determine if the value is null.
        -
        -
        Parameters:
        -
        index - must be between 0 and length() - 1
        -
        Returns:
        -
        true if the value at the index is null, or if there is no value.
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public Object remove(int index)
        -
        Remove an index and close the hole.
        -
        -
        Parameters:
        -
        index - the index value of the element to be removed
        -
        Returns:
        -
        The value that was associated with the index, or null if there was no value.
        -
        See Also:
        -
        size(), -append(String)
        -
        -
      • -
      - - - -
        -
      • -

        save

        -
        public boolean save(File file,
        -                    String options)
        -
      • -
      - - - -
        -
      • -

        write

        -
        public boolean write(PrintWriter output)
        -
      • -
      - - - - - - - -
        -
      • -

        toString

        -
        public String toString()
        -
        Return the JSON data formatted with two spaces for indents. - Chosen to do this since it's the most common case (e.g. with println()). - Same as format(2). Use the format() function for more options.
        -
        -
        Overrides:
        -
        toString in class Object
        -
        -
      • -
      - - - -
        -
      • -

        format

        -
        public String format(int indentFactor)
        -
        Make a pretty-printed JSON text of this JSONArray. - Warning: This method assumes that the data structure is acyclical.
        -
        -
        Parameters:
        -
        indentFactor - The number of spaces to add to each level of - indentation. Use -1 to specify no indentation and no newlines.
        -
        Returns:
        -
        a printable, displayable, transmittable - representation of the object, beginning - with [ (left bracket) and ending - with ] (right bracket).
        -
        -
      • -
      - - - -
        -
      • -

        join

        -
        public String join(String separator)
        -
        Make a string from the contents of this JSONArray. The - separator string is inserted between each element. - Warning: This method assumes that the data structure is acyclic.
        -
        -
        Parameters:
        -
        separator - A string that will be inserted between the elements.
        -
        Returns:
        -
        a string.
        -
        Throws:
        -
        JSONException - If the array contains an invalid number.
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/data/JSONObject.html b/build/javadoc/core/processing/data/JSONObject.html deleted file mode 100644 index 2cdce3619c..0000000000 --- a/build/javadoc/core/processing/data/JSONObject.html +++ /dev/null @@ -1,1236 +0,0 @@ - - - - - -JSONObject - - - - - - - - - - - -
-
processing.data
-

Class JSONObject

-
-
- -
-
    -
  • -
    -
    -
    public class JSONObject
    -extends Object
    -
    A JSONObject is an unordered collection of name/value pairs. Its external - form is a string wrapped in curly braces with colons between the names and - values, and commas between the values and names. The internal form is an - object having get and opt methods for accessing the - values by name, and put methods for adding or replacing values - by name. The values can be any of these types: Boolean, - JSONArray, JSONObject, Number, - String, or the JSONObject.NULL object. A JSONObject - constructor can be used to convert an external form JSON text into an - internal form whose values can be retrieved with the get and - opt methods, or to convert values into a JSON text using the - put and toString methods. A get method - returns a value if one can be found, and throws an exception if one cannot be - found. An opt method returns a default value instead of throwing - an exception, and so is useful for obtaining optional values. -

    - The generic get() and opt() methods return an - object, which you can cast or query for type. There are also typed - get and opt methods that do type checking and type - coercion for you. The opt methods differ from the get methods in that they do - not throw. Instead, they return a specified value, such as null. -

    - The put methods add or replace values in an object. For example, - -

    - myString = new JSONObject().put("JSON", "Hello, World!").toString();
    - 
    - - produces the string {"JSON": "Hello, World"}. -

    - The texts produced by the toString methods strictly conform to - the JSON syntax rules. The constructors are more forgiving in the texts they - will accept: -

      -
    • An extra , (comma) may appear just - before the closing brace.
    • -
    • Strings may be quoted with ' (single - quote).
    • -
    • Strings do not need to be quoted at all if they do not begin with a quote - or single quote, and if they do not contain leading or trailing spaces, and - if they do not contain any of these characters: - { } [ ] / \ : , = ; # and if they do not look like numbers and - if they are not the reserved words true, false, or - null.
    • -
    • Keys can be followed by = or => as well as by - :.
    • -
    • Values can be followed by ; (semicolon) as - well as by , (comma).
    • -
    -
    -
    See Also:
    -
    JSONArray, -PApplet.loadJSONObject(String), -PApplet.loadJSONArray(String), -PApplet.saveJSONObject(JSONObject, String), -PApplet.saveJSONArray(JSONArray, String)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        NULL

        -
        public static final Object NULL
        -
        It is sometimes more convenient and less ambiguous to have a - NULL object than to use Java's null value. - JSONObject.NULL.equals(null) returns true. - JSONObject.NULL.toString() returns "null".
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JSONObject

        -
        public JSONObject()
        -
        Construct an empty JSONObject.
        -
      • -
      - - - -
        -
      • -

        JSONObject

        -
        public JSONObject(Reader reader)
        -
      • -
      - - - -
        -
      • -

        JSONObject

        -
        public JSONObject(IntDict dict)
        -
      • -
      - - - -
        -
      • -

        JSONObject

        -
        public JSONObject(FloatDict dict)
        -
      • -
      - - - -
        -
      • -

        JSONObject

        -
        public JSONObject(StringDict dict)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        parse

        -
        public static JSONObject parse(String source)
        -
        Construct a JSONObject from a source JSON text string. - This is the most commonly used JSONObject constructor.
        -
        -
        Parameters:
        -
        source - A string beginning - with { (left brace) and ending - with } (right brace).
        -
        Throws:
        -
        JSONException - If there is a syntax error in the source - string or a duplicated key.
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public String getString(String key)
        -
        Gets the String associated with a key
        -
        -
        Parameters:
        -
        key - a key string
        -
        Returns:
        -
        A string which is the value.
        -
        Throws:
        -
        JSONException - if there is no string value for the key.
        -
        See Also:
        -
        getInt(String), -getFloat(String), -getBoolean(String)
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public String getString(String key,
        -                        String defaultValue)
        -
        Get an optional string associated with a key. - It returns the defaultValue if there is no such key.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        defaultValue - The default.
        -
        Returns:
        -
        A string which is the value.
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt(String key)
        -
        Gets the int value associated with a key
        -
        -
        Parameters:
        -
        key - a key string
        -
        Returns:
        -
        The integer value.
        -
        Throws:
        -
        JSONException - if the key is not found or if the value cannot - be converted to an integer.
        -
        See Also:
        -
        getFloat(String), -getString(String), -getBoolean(String)
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt(String key,
        -                  int defaultValue)
        -
        Get an optional int value associated with a key, - or the default if there is no such key or if the value is not a number. - If the value is a string, an attempt will be made to evaluate it as - a number.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        defaultValue - The default.
        -
        Returns:
        -
        An object which is the value.
        -
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong(String key)
        -
        Get the long value associated with a key.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        Returns:
        -
        The long value.
        -
        Throws:
        -
        JSONException - if the key is not found or if the value cannot - be converted to a long.
        -
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong(String key,
        -                    long defaultValue)
        -
        Get an optional long value associated with a key, - or the default if there is no such key or if the value is not a number. - If the value is a string, an attempt will be made to evaluate it as - a number.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        defaultValue - The default.
        -
        Returns:
        -
        An object which is the value.
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getFloat

        -
        public float getFloat(String key,
        -                      float defaultValue)
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(String key)
        -
        Get the double value associated with a key.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        Returns:
        -
        The numeric value.
        -
        Throws:
        -
        JSONException - if the key is not found or - if the value is not a Number object and cannot be converted to a number.
        -
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(String key,
        -                        double defaultValue)
        -
        Get an optional double associated with a key, or the - defaultValue if there is no such key or if its value is not a number. - If the value is a string, an attempt will be made to evaluate it as - a number.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        defaultValue - The default.
        -
        Returns:
        -
        An object which is the value.
        -
        -
      • -
      - - - -
        -
      • -

        getBoolean

        -
        public boolean getBoolean(String key)
        -
        Get the boolean value associated with a key.
        -
        -
        Parameters:
        -
        key - a key string
        -
        Returns:
        -
        The truth.
        -
        Throws:
        -
        JSONException - if the value is not a Boolean or the String "true" or "false".
        -
        See Also:
        -
        getInt(String), -getFloat(String), -getString(String)
        -
        -
      • -
      - - - -
        -
      • -

        getBoolean

        -
        public boolean getBoolean(String key,
        -                          boolean defaultValue)
        -
        Get an optional boolean associated with a key. - It returns the defaultValue if there is no such key, or if it is not - a Boolean or the String "true" or "false" (case insensitive).
        -
        -
        Parameters:
        -
        key - A key string.
        -
        defaultValue - The default.
        -
        Returns:
        -
        The truth.
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        hasKey

        -
        public boolean hasKey(String key)
        -
        Determine if the JSONObject contains a specific key.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        Returns:
        -
        true if the key exists in the JSONObject.
        -
        -
      • -
      - - - -
        -
      • -

        isNull

        -
        public boolean isNull(String key)
        -
        Determine if the value associated with the key is null or if there is - no value.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        Returns:
        -
        true if there is no value associated with the key or if - the value is the JSONObject.NULL object.
        -
        -
      • -
      - - - -
        -
      • -

        keyIterator

        -
        public Iterator keyIterator()
        -
        Get an enumeration of the keys of the JSONObject.
        -
        -
        Returns:
        -
        An iterator of the keys.
        -
        -
      • -
      - - - -
        -
      • -

        keys

        -
        public Set keys()
        -
        Get a set of keys of the JSONObject.
        -
        -
        Returns:
        -
        A keySet.
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
        Get the number of keys stored in the JSONObject.
        -
        -
        Returns:
        -
        The number of keys in the JSONObject.
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        setLong

        -
        public JSONObject setLong(String key,
        -                          long value)
        -
        Put a key/long pair in the JSONObject.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        value - A long which is the value.
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - If the key is null.
        -
        -
      • -
      - - - - - - - -
        -
      • -

        setDouble

        -
        public JSONObject setDouble(String key,
        -                            double value)
        -
        Put a key/double pair in the JSONObject.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        value - A double which is the value.
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - If the key is null or if the number is invalid.
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        remove

        -
        public Object remove(String key)
        -
        Remove a name and its value, if present.
        -
        -
        Parameters:
        -
        key - The name to be removed.
        -
        Returns:
        -
        The value that was associated with the name, - or null if there was no value.
        -
        -
      • -
      - - - -
        -
      • -

        save

        -
        public boolean save(File file,
        -                    String options)
        -
      • -
      - - - -
        -
      • -

        write

        -
        public boolean write(PrintWriter output)
        -
      • -
      - - - - - - - -
        -
      • -

        toString

        -
        public String toString()
        -
        Return the JSON data formatted with two spaces for indents. - Chosen to do this since it's the most common case (e.g. with println()). - Same as format(2). Use the format() function for more options.
        -
        -
        Overrides:
        -
        toString in class Object
        -
        -
      • -
      - - - -
        -
      • -

        format

        -
        public String format(int indentFactor)
        -
        Make a prettyprinted JSON text of this JSONObject. -

        - Warning: This method assumes that the data structure is acyclical.

        -
        -
        Parameters:
        -
        indentFactor - The number of spaces to add to each level of - indentation.
        -
        Returns:
        -
        a printable, displayable, portable, transmittable - representation of the object, beginning - with { (left brace) and ending - with } (right brace).
        -
        Throws:
        -
        JSONException - If the object contains an invalid number.
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/data/Sort.html b/build/javadoc/core/processing/data/Sort.html deleted file mode 100644 index 8595aafe05..0000000000 --- a/build/javadoc/core/processing/data/Sort.html +++ /dev/null @@ -1,322 +0,0 @@ - - - - - -Sort - - - - - - - - - - - -
-
processing.data
-

Class Sort

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Runnable
    -
    -
    -
    -
    public abstract class Sort
    -extends Object
    -implements Runnable
    -
    Internal sorter used by several data classes. - Advanced users only, not official API.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Sort

        -
        public Sort()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        run

        -
        public void run()
        -
        -
        Specified by:
        -
        run in interface Runnable
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public abstract int size()
        -
      • -
      - - - -
        -
      • -

        compare

        -
        public abstract float compare(int a,
        -                              int b)
        -
      • -
      - - - -
        -
      • -

        swap

        -
        public abstract void swap(int a,
        -                          int b)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/data/StringDict.html b/build/javadoc/core/processing/data/StringDict.html deleted file mode 100644 index 73cf0b8da7..0000000000 --- a/build/javadoc/core/processing/data/StringDict.html +++ /dev/null @@ -1,714 +0,0 @@ - - - - - -StringDict - - - - - - - - - - - -
-
processing.data
-

Class StringDict

-
-
- -
-
    -
  • -
    -
    -
    public class StringDict
    -extends Object
    -
    A simple table class to use a String as a lookup for another String value.
    -
    -
    See Also:
    -
    IntDict, -FloatDict
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        StringDict

        -
        public StringDict()
        -
      • -
      - - - -
        -
      • -

        StringDict

        -
        public StringDict(int length)
        -
        Create a new lookup pre-allocated to a specific length. This will not - change the size(), but is more efficient than not specifying a length. - Use it when you know the rough size of the thing you're creating.
        -
      • -
      - - - -
        -
      • -

        StringDict

        -
        public StringDict(BufferedReader reader)
        -
        Read a set of entries from a Reader that has each key/value pair on - a single line, separated by a tab.
        -
      • -
      - - - -
        -
      • -

        StringDict

        -
        public StringDict(String[] keys,
        -                  String[] values)
        -
      • -
      - - - -
        -
      • -

        StringDict

        -
        public StringDict(String[][] pairs)
        -
        Constructor to allow (more intuitive) inline initialization, e.g.: -
        - new StringDict(new String[][] {
        -   { "key1", "value1" },
        -   { "key2", "value2" }
        - });
        - 
        - It's no Python, but beats a static { } block with HashMap.put() statements.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        size

        -
        public int size()
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        Remove all entries.
        -
      • -
      - - - -
        -
      • -

        key

        -
        public String key(int index)
        -
      • -
      - - - - - - - -
        -
      • -

        keyArray

        -
        public String[] keyArray()
        -
        Return a copy of the internal keys array. This array can be modified.
        -
      • -
      - - - -
        -
      • -

        keyArray

        -
        public String[] keyArray(String[] outgoing)
        -
      • -
      - - - -
        -
      • -

        value

        -
        public String value(int index)
        -
      • -
      - - - - - - - -
        -
      • -

        valueArray

        -
        public String[] valueArray()
        -
        Create a new array and copy each of the values into it.
        -
      • -
      - - - -
        -
      • -

        valueArray

        -
        public String[] valueArray(String[] array)
        -
        Fill an already-allocated array with the values (more efficient than - creating a new array each time). If 'array' is null, or not the same - size as the number of values, a new array will be allocated and returned.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public String get(String key)
        -
        Return a value for the specified key.
        -
      • -
      - - - - - - - -
        -
      • -

        set

        -
        public void set(String key,
        -                String value)
        -
      • -
      - - - -
        -
      • -

        index

        -
        public int index(String what)
        -
      • -
      - - - -
        -
      • -

        hasKey

        -
        public boolean hasKey(String key)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public int remove(String key)
        -
      • -
      - - - -
        -
      • -

        removeIndex

        -
        public String removeIndex(int index)
        -
      • -
      - - - -
        -
      • -

        swap

        -
        public void swap(int a,
        -                 int b)
        -
      • -
      - - - -
        -
      • -

        sortKeys

        -
        public void sortKeys()
        -
        Sort the keys alphabetically (ignoring case). Uses the value as a - tie-breaker (only really possible with a key that has a case change).
        -
      • -
      - - - -
        -
      • -

        sortKeysReverse

        -
        public void sortKeysReverse()
        -
      • -
      - - - -
        -
      • -

        sortValues

        -
        public void sortValues()
        -
        Sort by values in descending order (largest value will be at [0]).
        -
      • -
      - - - -
        -
      • -

        sortValuesReverse

        -
        public void sortValuesReverse()
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public StringDict copy()
        -
        Returns a duplicate copy of this object.
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write(PrintWriter writer)
        -
        Write tab-delimited entries out to
        -
        -
        Parameters:
        -
        writer -
        -
        -
      • -
      - - - -
        -
      • -

        print

        -
        public void print()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/data/StringList.html b/build/javadoc/core/processing/data/StringList.html deleted file mode 100644 index 965f9286c1..0000000000 --- a/build/javadoc/core/processing/data/StringList.html +++ /dev/null @@ -1,969 +0,0 @@ - - - - - -StringList - - - - - - - - - - - -
-
processing.data
-

Class StringList

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Iterable<String>
    -
    -
    -
    -
    public class StringList
    -extends Object
    -implements Iterable<String>
    -
    Helper class for a list of Strings. Lists are designed to have some of the - features of ArrayLists, but to maintain the simplicity and efficiency of - working with arrays. - - Functions like sort() and shuffle() always act on the list itself. To get - a sorted copy, use list.copy().sort().
    -
    -
    See Also:
    -
    IntList, -FloatList
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        StringList

        -
        public StringList()
        -
      • -
      - - - -
        -
      • -

        StringList

        -
        public StringList(int length)
        -
      • -
      - - - -
        -
      • -

        StringList

        -
        public StringList(String[] list)
        -
      • -
      - - - -
        -
      • -

        StringList

        -
        public StringList(Object... items)
        -
        Construct a StringList from a random pile of objects. Null values will - stay null, but all the others will be converted to String values.
        -
      • -
      - - - -
        -
      • -

        StringList

        -
        public StringList(Iterable<String> iter)
        -
        Create from something iterable, for instance: - StringList list = new StringList(hashMap.keySet());
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        size

        -
        public int size()
        -
        Get the length of the list.
        -
      • -
      - - - -
        -
      • -

        resize

        -
        public void resize(int length)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        Remove all entries from the list.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public String get(int index)
        -
        Get an entry at a particular index.
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int index,
        -                String what)
        -
        Set the entry at a particular index. If the index is past the length of - the list, it'll expand the list to accommodate, and fill the intermediate - entries with 0s.
        -
      • -
      - - - -
        -
      • -

        push

        -
        public void push(String value)
        -
        Just an alias for append(), but matches pop()
        -
      • -
      - - - -
        -
      • -

        pop

        -
        public String pop()
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public String remove(int index)
        -
        Remove an element from the specified index.
        -
      • -
      - - - -
        -
      • -

        removeValue

        -
        public int removeValue(String value)
        -
      • -
      - - - -
        -
      • -

        removeValues

        -
        public int removeValues(String value)
        -
      • -
      - - - -
        -
      • -

        replaceValue

        -
        public int replaceValue(String value,
        -                        String newValue)
        -
      • -
      - - - -
        -
      • -

        replaceValues

        -
        public int replaceValues(String value,
        -                         String newValue)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(String value)
        -
        Add a new entry to the list.
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(String[] values)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(StringList list)
        -
      • -
      - - - -
        -
      • -

        appendUnique

        -
        public void appendUnique(String value)
        -
        Add this value, but only if it's not already in the list.
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   String value)
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   String[] values)
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   StringList list)
        -
      • -
      - - - -
        -
      • -

        index

        -
        public int index(String what)
        -
        Return the first index of a particular value.
        -
      • -
      - - - -
        -
      • -

        hasValue

        -
        public boolean hasValue(String value)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public void sort()
        -
        Sorts the array in place.
        -
      • -
      - - - -
        -
      • -

        sortReverse

        -
        public void sortReverse()
        -
        Reverse sort, orders values from highest to lowest.
        -
      • -
      - - - -
        -
      • -

        reverse

        -
        public void reverse()
        -
      • -
      - - - -
        -
      • -

        shuffle

        -
        public void shuffle()
        -
        Randomize the order of the list elements. Note that this does not - obey the randomSeed() function in PApplet.
        -
      • -
      - - - -
        -
      • -

        shuffle

        -
        public void shuffle(PApplet sketch)
        -
        Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
        -
      • -
      - - - -
        -
      • -

        lower

        -
        public void lower()
        -
        Make the entire list lower case.
        -
      • -
      - - - -
        -
      • -

        upper

        -
        public void upper()
        -
        Make the entire list upper case.
        -
      • -
      - - - - - - - -
        -
      • -

        values

        -
        public String[] values()
        -
        Returns the actual array being used to store the data. Suitable for - iterating with a for() loop, but modifying the list could cause terrible - things to happen.
        -
      • -
      - - - - - - - -
        -
      • -

        array

        -
        public String[] array()
        -
        Create a new array with a copy of all the values.
        -
        -
        Returns:
        -
        an array sized by the length of the list with each of the values.
        -
        -
      • -
      - - - -
        -
      • -

        array

        -
        public String[] array(String[] array)
        -
        Copy values into the specified array. If the specified array is null or - not the same size, a new array will be allocated.
        -
        -
        Parameters:
        -
        array -
        -
        -
      • -
      - - - -
        -
      • -

        getSubset

        -
        public StringList getSubset(int start)
        -
      • -
      - - - -
        -
      • -

        getSubset

        -
        public StringList getSubset(int start,
        -                            int num)
        -
      • -
      - - - -
        -
      • -

        getUnique

        -
        public String[] getUnique()
        -
        Get a list of all unique entries.
        -
      • -
      - - - -
        -
      • -

        getTally

        -
        public IntDict getTally()
        -
        Count the number of times each String entry is found in this list.
        -
      • -
      - - - -
        -
      • -

        getOrder

        -
        public IntDict getOrder()
        -
        Create a dictionary associating each entry in this list to its index.
        -
      • -
      - - - - - - - -
        -
      • -

        print

        -
        public void print()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/data/Table.html b/build/javadoc/core/processing/data/Table.html deleted file mode 100644 index c0ca30bf5a..0000000000 --- a/build/javadoc/core/processing/data/Table.html +++ /dev/null @@ -1,3020 +0,0 @@ - - - - - -Table - - - - - - - - - - - -
-
processing.data
-

Class Table

-
-
- -
-
    -
  • -
    -
    -
    public class Table
    -extends Object
    -

    Generic class for handling tabular data, typically from a CSV, TSV, or - other sort of spreadsheet file.

    -

    CSV files are - comma separated values, - often with the data in quotes. TSV files use tabs as separators, and usually - don't bother with the quotes.

    -

    File names should end with .csv if they're comma separated.

    -

    A rough "spec" for CSV can be found here.

    -
    -
    See Also:
    -
    PApplet.loadTable(String), -PApplet.saveTable(Table, String), -TableRow
    -
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Table

        -
        public Table()
        -
        Creates a new, empty table. Use addRow() to add additional rows.
        -
      • -
      - - - - - - - -
        -
      • -

        Table

        -
        public Table(File file,
        -             String options)
        -      throws IOException
        -
        version that uses a File object; future releases (or data types) - may include additional optimizations here
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        Table

        -
        public Table(InputStream input,
        -             String options)
        -      throws IOException
        -
        Read the table from a stream. Possible options include: -
          -
        • csv - parse the table as comma-separated values -
        • tsv - parse the table as tab-separated values -
        • newlines - this CSV file contains newlines inside individual cells -
        • header - this table has a header (title) row -
        -
        -
        Parameters:
        -
        input -
        -
        options -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        extensionOptions

        -
        public static String extensionOptions(boolean loading,
        -                                      String filename,
        -                                      String options)
        -
      • -
      - - - -
        -
      • -

        parseInto

        -
        public void parseInto(Object enclosingObject,
        -                      String fieldName)
        -
        incomplete, do not use
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        addColumn

        -
        public void addColumn(String title)
        -
        -
        Parameters:
        -
        title - the title to be used for the new column
        -
        -
      • -
      - - - -
        -
      • -

        addColumn

        -
        public void addColumn(String title,
        -                      int type)
        -
        -
        Parameters:
        -
        type - the type to be used for the new column: INT, LONG, FLOAT, DOUBLE, STRING, or CATEGORY
        -
        -
      • -
      - - - -
        -
      • -

        insertColumn

        -
        public void insertColumn(int index)
        -
      • -
      - - - -
        -
      • -

        insertColumn

        -
        public void insertColumn(int index,
        -                         String title)
        -
      • -
      - - - -
        -
      • -

        insertColumn

        -
        public void insertColumn(int index,
        -                         String title,
        -                         int type)
        -
      • -
      - - - -
        -
      • -

        removeColumn

        -
        public void removeColumn(String columnName)
        -
        -
        Parameters:
        -
        columnName - the title of the column to be removed
        -
        See Also:
        -
        addColumn()
        -
        -
      • -
      - - - -
        -
      • -

        removeColumn

        -
        public void removeColumn(int column)
        -
        -
        Parameters:
        -
        column - the index number of the column to be removed
        -
        -
      • -
      - - - -
        -
      • -

        getColumnCount

        -
        public int getColumnCount()
        -
        -
        See Also:
        -
        getRowCount()
        -
        -
      • -
      - - - -
        -
      • -

        setColumnCount

        -
        public void setColumnCount(int newCount)
        -
        Change the number of columns in this table. Resizes all rows to ensure - the same number of columns in each row. Entries in the additional (empty) - columns will be set to null.
        -
        -
        Parameters:
        -
        newCount -
        -
        -
      • -
      - - - -
        -
      • -

        setColumnType

        -
        public void setColumnType(String columnName,
        -                          String columnType)
        -
      • -
      - - - -
        -
      • -

        setColumnType

        -
        public void setColumnType(int column,
        -                          String columnType)
        -
        Set the data type for a column so that using it is more efficient.
        -
        -
        Parameters:
        -
        column - the column to change
        -
        columnType - One of int, long, float, double, string, or category.
        -
        -
      • -
      - - - -
        -
      • -

        setColumnType

        -
        public void setColumnType(String columnName,
        -                          int newType)
        -
      • -
      - - - -
        -
      • -

        setColumnType

        -
        public void setColumnType(int column,
        -                          int newType)
        -
        Sets the column type. If data already exists, then it'll be converted to - the new type.
        -
        -
        Parameters:
        -
        column - the column whose type should be changed
        -
        newType - something fresh, maybe try an int or a float for size?
        -
        -
      • -
      - - - -
        -
      • -

        setTableType

        -
        public void setTableType(String type)
        -
        Set the entire table to a specific data type.
        -
      • -
      - - - -
        -
      • -

        setColumnTypes

        -
        public void setColumnTypes(int[] types)
        -
      • -
      - - - -
        -
      • -

        setColumnTypes

        -
        public void setColumnTypes(Table dictionary)
        -
        Set the titles (and if a second column is present) the data types for - this table based on a file loaded separately. This will look for the - title in column 0, and the type in column 1. Better yet, specify a - column named "title" and another named "type" in the dictionary table - to future-proof the code.
        -
        -
        Parameters:
        -
        dictionary -
        -
        -
      • -
      - - - -
        -
      • -

        getColumnType

        -
        public int getColumnType(String columnName)
        -
      • -
      - - - -
        -
      • -

        getColumnType

        -
        public int getColumnType(int column)
        -
        Returns one of Table.STRING, Table.INT, etc...
        -
      • -
      - - - -
        -
      • -

        getColumnTypes

        -
        public int[] getColumnTypes()
        -
      • -
      - - - -
        -
      • -

        removeTitleRow

        -
        @Deprecated
        -public String[] removeTitleRow()
        -
        Deprecated. 
        -
        Remove the first row from the data set, and use it as the column titles. - Use loadTable("table.csv", "header") instead.
        -
      • -
      - - - -
        -
      • -

        setColumnTitles

        -
        public void setColumnTitles(String[] titles)
        -
      • -
      - - - -
        -
      • -

        setColumnTitle

        -
        public void setColumnTitle(int column,
        -                           String title)
        -
      • -
      - - - -
        -
      • -

        hasColumnTitles

        -
        public boolean hasColumnTitles()
        -
      • -
      - - - -
        -
      • -

        getColumnTitles

        -
        public String[] getColumnTitles()
        -
      • -
      - - - -
        -
      • -

        getColumnTitle

        -
        public String getColumnTitle(int col)
        -
      • -
      - - - -
        -
      • -

        getColumnIndex

        -
        public int getColumnIndex(String columnName)
        -
      • -
      - - - -
        -
      • -

        checkColumnIndex

        -
        public int checkColumnIndex(String title)
        -
        Same as getColumnIndex(), but creates the column if it doesn't exist. - Named this way to not conflict with checkColumn(), an internal function - used to ensure that a columns exists, and also to denote that it returns - an int for the column index.
        -
        -
        Parameters:
        -
        title - column title
        -
        Returns:
        -
        index of a new or previously existing column
        -
        -
      • -
      - - - -
        -
      • -

        getRowCount

        -
        public int getRowCount()
        -
        -
        See Also:
        -
        getColumnCount()
        -
        -
      • -
      - - - -
        -
      • -

        lastRowIndex

        -
        public int lastRowIndex()
        -
      • -
      - - - - - - - -
        -
      • -

        setRowCount

        -
        public void setRowCount(int newCount)
        -
      • -
      - - - - - - - -
        -
      • -

        addRow

        -
        public TableRow addRow(TableRow source)
        -
        -
        Parameters:
        -
        source - a reference to the original row to be duplicated
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        addRows

        -
        public void addRows(Table source)
        -
      • -
      - - - -
        -
      • -

        insertRow

        -
        public void insertRow(int insert,
        -                      Object[] columnData)
        -
      • -
      - - - -
        -
      • -

        removeRow

        -
        public void removeRow(int row)
        -
        -
        Parameters:
        -
        row - ID number of the row to remove
        -
        See Also:
        -
        addRow(), -clearRows()
        -
        -
      • -
      - - - -
        -
      • -

        setRow

        -
        public void setRow(int row,
        -                   Object[] pieces)
        -
      • -
      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        getInt

        -
        public int getInt(int row,
        -                  String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to reference
        -
        -
      • -
      - - - -
        -
      • -

        setMissingInt

        -
        public void setMissingInt(int value)
        -
      • -
      - - - - - - - -
        -
      • -

        setInt

        -
        public void setInt(int row,
        -                   String columnName,
        -                   int value)
        -
        -
        Parameters:
        -
        columnName - title of the target column
        -
        -
      • -
      - - - -
        -
      • -

        getIntColumn

        -
        public int[] getIntColumn(String name)
        -
      • -
      - - - -
        -
      • -

        getIntColumn

        -
        public int[] getIntColumn(int col)
        -
      • -
      - - - -
        -
      • -

        getIntRow

        -
        public int[] getIntRow(int row)
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong(int row,
        -                    int column)
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong(int row,
        -                    String columnName)
        -
      • -
      - - - -
        -
      • -

        setMissingLong

        -
        public void setMissingLong(long value)
        -
      • -
      - - - -
        -
      • -

        setLong

        -
        public void setLong(int row,
        -                    int column,
        -                    long value)
        -
      • -
      - - - -
        -
      • -

        setLong

        -
        public void setLong(int row,
        -                    String columnName,
        -                    long value)
        -
      • -
      - - - -
        -
      • -

        getLongColumn

        -
        public long[] getLongColumn(String name)
        -
      • -
      - - - -
        -
      • -

        getLongColumn

        -
        public long[] getLongColumn(int col)
        -
      • -
      - - - -
        -
      • -

        getLongRow

        -
        public long[] getLongRow(int row)
        -
      • -
      - - - - - - - -
        -
      • -

        getFloat

        -
        public float getFloat(int row,
        -                      String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to reference
        -
        -
      • -
      - - - -
        -
      • -

        setMissingFloat

        -
        public void setMissingFloat(float value)
        -
      • -
      - - - - - - - -
        -
      • -

        setFloat

        -
        public void setFloat(int row,
        -                     String columnName,
        -                     float value)
        -
        -
        Parameters:
        -
        columnName - title of the target column
        -
        -
      • -
      - - - -
        -
      • -

        getFloatColumn

        -
        public float[] getFloatColumn(String name)
        -
      • -
      - - - -
        -
      • -

        getFloatColumn

        -
        public float[] getFloatColumn(int col)
        -
      • -
      - - - -
        -
      • -

        getFloatRow

        -
        public float[] getFloatRow(int row)
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(int row,
        -                        int column)
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(int row,
        -                        String columnName)
        -
      • -
      - - - -
        -
      • -

        setMissingDouble

        -
        public void setMissingDouble(double value)
        -
      • -
      - - - -
        -
      • -

        setDouble

        -
        public void setDouble(int row,
        -                      int column,
        -                      double value)
        -
      • -
      - - - -
        -
      • -

        setDouble

        -
        public void setDouble(int row,
        -                      String columnName,
        -                      double value)
        -
      • -
      - - - -
        -
      • -

        getDoubleColumn

        -
        public double[] getDoubleColumn(String name)
        -
      • -
      - - - -
        -
      • -

        getDoubleColumn

        -
        public double[] getDoubleColumn(int col)
        -
      • -
      - - - -
        -
      • -

        getDoubleRow

        -
        public double[] getDoubleRow(int row)
        -
      • -
      - - - - - - - -
        -
      • -

        getString

        -
        public String getString(int row,
        -                        String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to reference
        -
        -
      • -
      - - - -
        -
      • -

        setMissingString

        -
        public void setMissingString(String value)
        -
        Treat entries with this string as "missing". Also used for categorial.
        -
      • -
      - - - - - - - -
        -
      • -

        setString

        -
        public void setString(int row,
        -                      String columnName,
        -                      String value)
        -
        -
        Parameters:
        -
        columnName - title of the target column
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getStringColumn

        -
        public String[] getStringColumn(int column)
        -
        -
        Parameters:
        -
        column - ID number of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        getStringRow

        -
        public String[] getStringRow(int row)
        -
      • -
      - - - -
        -
      • -

        findRowIndex

        -
        public int findRowIndex(String value,
        -                        int column)
        -
        Return the row that contains the first String that matches.
        -
        -
        Parameters:
        -
        value - the String to match
        -
        column - ID number of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        findRowIndex

        -
        public int findRowIndex(String value,
        -                        String columnName)
        -
        Return the row that contains the first String that matches.
        -
        -
        Parameters:
        -
        value - the String to match
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        findRowIndices

        -
        public int[] findRowIndices(String value,
        -                            int column)
        -
        Return a list of rows that contain the String passed in. If there are no - matches, a zero length array will be returned (not a null array).
        -
        -
        Parameters:
        -
        value - the String to match
        -
        column - ID number of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        findRowIndices

        -
        public int[] findRowIndices(String value,
        -                            String columnName)
        -
        Return a list of rows that contain the String passed in. If there are no - matches, a zero length array will be returned (not a null array).
        -
        -
        Parameters:
        -
        value - the String to match
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - - - - - -
        -
      • -

        findRow

        -
        public TableRow findRow(String value,
        -                        String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - - - - - -
        -
      • -

        findRows

        -
        public Iterable<TableRow> findRows(String value,
        -                                   String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        findRowIterator

        -
        public Iterator<TableRow> findRowIterator(String value,
        -                                          int column)
        -
        -
        Parameters:
        -
        value - the value to match
        -
        column - ID number of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        findRowIterator

        -
        public Iterator<TableRow> findRowIterator(String value,
        -                                          String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        matchRowIndex

        -
        public int matchRowIndex(String regexp,
        -                         int column)
        -
        Return the row that contains the first String that matches.
        -
        -
        Parameters:
        -
        regexp - the String to match
        -
        column - ID number of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        matchRowIndex

        -
        public int matchRowIndex(String what,
        -                         String columnName)
        -
        Return the row that contains the first String that matches.
        -
        -
        Parameters:
        -
        what - the String to match
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        matchRowIndices

        -
        public int[] matchRowIndices(String regexp,
        -                             int column)
        -
        Return a list of rows that contain the String passed in. If there are no - matches, a zero length array will be returned (not a null array).
        -
        -
        Parameters:
        -
        what - the String to match
        -
        column - ID number of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        matchRowIndices

        -
        public int[] matchRowIndices(String what,
        -                             String columnName)
        -
        Return a list of rows that match the regex passed in. If there are no - matches, a zero length array will be returned (not a null array).
        -
        -
        Parameters:
        -
        what - the String to match
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - - - - - -
        -
      • -

        matchRow

        -
        public TableRow matchRow(String regexp,
        -                         String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - - - - - -
        -
      • -

        matchRows

        -
        public Iterable<TableRow> matchRows(String regexp,
        -                                    String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        matchRowIterator

        -
        public Iterator<TableRow> matchRowIterator(String value,
        -                                           int column)
        -
        -
        Parameters:
        -
        value - the regular expression to match
        -
        column - ID number of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        matchRowIterator

        -
        public Iterator<TableRow> matchRowIterator(String value,
        -                                           String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        replace

        -
        public void replace(String orig,
        -                    String replacement)
        -
        Replace a String with another. Set empty entries null by using - replace("", null) or use replace(null, "") to go the other direction. - If this is a typed table, only String columns will be modified.
        -
        -
        Parameters:
        -
        orig -
        -
        replacement -
        -
        -
      • -
      - - - -
        -
      • -

        replace

        -
        public void replace(String orig,
        -                    String replacement,
        -                    int col)
        -
      • -
      - - - -
        -
      • -

        replace

        -
        public void replace(String orig,
        -                    String replacement,
        -                    String colName)
        -
      • -
      - - - -
        -
      • -

        replaceAll

        -
        public void replaceAll(String regex,
        -                       String replacement)
        -
      • -
      - - - -
        -
      • -

        replaceAll

        -
        public void replaceAll(String regex,
        -                       String replacement,
        -                       int column)
        -
      • -
      - - - -
        -
      • -

        replaceAll

        -
        public void replaceAll(String regex,
        -                       String replacement,
        -                       String columnName)
        -
        Run String.replaceAll() on all entries in a column. - Only works with columns that are already String values.
        -
        -
        Parameters:
        -
        what - the String to match
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        removeTokens

        -
        public void removeTokens(String tokens)
        -
        Remove any of the specified characters from the entire table.
        -
        -
        Parameters:
        -
        tokens - a list of individual characters to be removed
        -
        See Also:
        -
        trim()
        -
        -
      • -
      - - - -
        -
      • -

        removeTokens

        -
        public void removeTokens(String tokens,
        -                         int column)
        -
        Removed any of the specified characters from a column. For instance, - the following code removes dollar signs and commas from column 2: -
        - table.removeTokens(",$", 2);
        - 
        -
        -
        Parameters:
        -
        column - ID number of the column to process
        -
        -
      • -
      - - - -
        -
      • -

        removeTokens

        -
        public void removeTokens(String tokens,
        -                         String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to process
        -
        -
      • -
      - - - - - - - -
        -
      • -

        trim

        -
        public void trim(int column)
        -
        -
        Parameters:
        -
        column - ID number of the column to trim
        -
        -
      • -
      - - - -
        -
      • -

        trim

        -
        public void trim(String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to trim
        -
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public void sort(String columnName)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public void sort(int column)
        -
      • -
      - - - -
        -
      • -

        sortReverse

        -
        public void sortReverse(String columnName)
        -
      • -
      - - - -
        -
      • -

        sortReverse

        -
        public void sortReverse(int column)
        -
      • -
      - - - -
        -
      • -

        getUnique

        -
        public String[] getUnique(String columnName)
        -
      • -
      - - - -
        -
      • -

        getUnique

        -
        public String[] getUnique(int column)
        -
      • -
      - - - - - - - -
        -
      • -

        getTally

        -
        public IntDict getTally(int column)
        -
      • -
      - - - - - - - -
        -
      • -

        getOrder

        -
        public IntDict getOrder(int column)
        -
      • -
      - - - -
        -
      • -

        getIntList

        -
        public IntList getIntList(String columnName)
        -
      • -
      - - - -
        -
      • -

        getIntList

        -
        public IntList getIntList(int column)
        -
      • -
      - - - - - - - -
        -
      • -

        getFloatList

        -
        public FloatList getFloatList(int column)
        -
      • -
      - - - - - - - -
        -
      • -

        getStringList

        -
        public StringList getStringList(int column)
        -
      • -
      - - - -
        -
      • -

        getIntDict

        -
        public IntDict getIntDict(String keyColumnName,
        -                          String valueColumnName)
        -
      • -
      - - - -
        -
      • -

        getIntDict

        -
        public IntDict getIntDict(int keyColumn,
        -                          int valueColumn)
        -
      • -
      - - - - - - - -
        -
      • -

        getFloatDict

        -
        public FloatDict getFloatDict(int keyColumn,
        -                              int valueColumn)
        -
      • -
      - - - - - - - -
        -
      • -

        getStringDict

        -
        public StringDict getStringDict(int keyColumn,
        -                                int valueColumn)
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public Table copy()
        -
        Make a copy of the current table
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/data/TableRow.html b/build/javadoc/core/processing/data/TableRow.html deleted file mode 100644 index dd4ddcb124..0000000000 --- a/build/javadoc/core/processing/data/TableRow.html +++ /dev/null @@ -1,641 +0,0 @@ - - - - - -TableRow - - - - - - - - - - - -
-
processing.data
-

Interface TableRow

-
-
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getString

        -
        String getString(int column)
        -
        -
        Parameters:
        -
        column - ID number of the column to reference
        -
        See Also:
        -
        getInt(int), -getFloat(int)
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        String getString(String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to reference
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        int getInt(int column)
        -
        -
        Parameters:
        -
        column - ID number of the column to reference
        -
        See Also:
        -
        getFloat(int), -getString(int)
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        int getInt(String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to reference
        -
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        long getLong(int column)
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        long getLong(String columnName)
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        float getFloat(int column)
        -
        -
        Parameters:
        -
        column - ID number of the column to reference
        -
        See Also:
        -
        getInt(int), -getString(int)
        -
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        float getFloat(String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to reference
        -
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        double getDouble(int column)
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        double getDouble(String columnName)
        -
      • -
      - - - - - - - -
        -
      • -

        setString

        -
        void setString(String columnName,
        -               String value)
        -
        -
        Parameters:
        -
        columnName - title of the target column
        -
        -
      • -
      - - - - - - - -
        -
      • -

        setInt

        -
        void setInt(String columnName,
        -            int value)
        -
        -
        Parameters:
        -
        columnName - title of the target column
        -
        -
      • -
      - - - -
        -
      • -

        setLong

        -
        void setLong(int column,
        -             long value)
        -
      • -
      - - - -
        -
      • -

        setLong

        -
        void setLong(String columnName,
        -             long value)
        -
      • -
      - - - -
        -
      • -

        setFloat

        -
        void setFloat(int column,
        -              float value)
        -
        -
        Parameters:
        -
        column - ID number of the target column
        -
        value - value to assign
        -
        See Also:
        -
        setInt(int, int), -setString(int, String)
        -
        -
      • -
      - - - -
        -
      • -

        setFloat

        -
        void setFloat(String columnName,
        -              float value)
        -
        -
        Parameters:
        -
        columnName - title of the target column
        -
        -
      • -
      - - - -
        -
      • -

        setDouble

        -
        void setDouble(int column,
        -               double value)
        -
      • -
      - - - -
        -
      • -

        setDouble

        -
        void setDouble(String columnName,
        -               double value)
        -
      • -
      - - - -
        -
      • -

        getColumnCount

        -
        int getColumnCount()
        -
      • -
      - - - -
        -
      • -

        getColumnType

        -
        int getColumnType(String columnName)
        -
      • -
      - - - -
        -
      • -

        getColumnType

        -
        int getColumnType(int column)
        -
      • -
      - - - -
        -
      • -

        getColumnTypes

        -
        int[] getColumnTypes()
        -
      • -
      - - - -
        -
      • -

        getColumnTitle

        -
        String getColumnTitle(int column)
        -
      • -
      - - - -
        -
      • -

        getColumnTitles

        -
        String[] getColumnTitles()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/data/XML.html b/build/javadoc/core/processing/data/XML.html deleted file mode 100644 index e28410b6c8..0000000000 --- a/build/javadoc/core/processing/data/XML.html +++ /dev/null @@ -1,1346 +0,0 @@ - - - - - -XML - - - - - - - - - - - -
-
processing.data
-

Class XML

-
-
- -
- -
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Method Detail

      - - - - - - - - - - - -
        -
      • -

        save

        -
        public boolean save(File file)
        -
      • -
      - - - -
        -
      • -

        save

        -
        public boolean save(File file,
        -                    String options)
        -
      • -
      - - - -
        -
      • -

        write

        -
        public boolean write(PrintWriter output)
        -
      • -
      - - - -
        -
      • -

        getParent

        -
        public XML getParent()
        -
        Returns the parent element. This method returns null for the root - element.
        -
      • -
      - - - -
        -
      • -

        getName

        -
        public 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.
        -
        -
      • -
      - - - -
        -
      • -

        setName

        -
        public void setName(String newName)
        -
      • -
      - - - -
        -
      • -

        getLocalName

        -
        public String getLocalName()
        -
        Returns the name of the element (without namespace prefix). - - Internal function; not included in reference.
        -
      • -
      - - - -
        -
      • -

        getChildCount

        -
        public int getChildCount()
        -
        Returns the number of children.
        -
        -
        Returns:
        -
        the count.
        -
        -
      • -
      - - - -
        -
      • -

        hasChildren

        -
        public boolean hasChildren()
        -
        Returns a boolean of whether or not there are children.
        -
      • -
      - - - -
        -
      • -

        listChildren

        -
        public 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 XML[] getChildren()
        -
        Returns an array containing all the child elements.
        -
      • -
      - - - -
        -
      • -

        getChild

        -
        public XML getChild(int index)
        -
        Quick accessor for an element at a particular index.
        -
      • -
      - - - -
        -
      • -

        getChild

        -
        public XML getChild(String name)
        -
        Get a child by its name or path.
        -
        -
        Parameters:
        -
        name - element name or path/to/element
        -
        Returns:
        -
        the first matching element
        -
        -
      • -
      - - - -
        -
      • -

        getChildren

        -
        public XML[] getChildren(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
        -
        -
      • -
      - - - -
        -
      • -

        addChild

        -
        public XML addChild(String tag)
        -
      • -
      - - - -
        -
      • -

        addChild

        -
        public XML addChild(XML child)
        -
      • -
      - - - -
        -
      • -

        removeChild

        -
        public void removeChild(XML kid)
        -
      • -
      - - - -
        -
      • -

        trim

        -
        public void trim()
        -
      • -
      - - - -
        -
      • -

        getAttributeCount

        -
        public int getAttributeCount()
        -
        Returns the number of attributes.
        -
      • -
      - - - -
        -
      • -

        listAttributes

        -
        public String[] listAttributes()
        -
        Get a list of the names for all of the attributes for this node.
        -
      • -
      - - - -
        -
      • -

        hasAttribute

        -
        public boolean hasAttribute(String name)
        -
        Returns whether an attribute exists.
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        setString

        -
        public void setString(String name,
        -                      String value)
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt(String name)
        -
      • -
      - - - -
        -
      • -

        setInt

        -
        public void setInt(String name,
        -                   int value)
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt(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
        -
        -
      • -
      - - - -
        -
      • -

        setLong

        -
        public void setLong(String name,
        -                    long value)
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong(String name,
        -                    long 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.
        -
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        public float getFloat(String name)
        -
        Returns the value of an attribute, or zero if not present.
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        public float getFloat(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.
        -
        -
      • -
      - - - -
        -
      • -

        setFloat

        -
        public void setFloat(String name,
        -                     float value)
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(String name)
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(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
        -
        -
      • -
      - - - -
        -
      • -

        setDouble

        -
        public void setDouble(String name,
        -                      double value)
        -
      • -
      - - - -
        -
      • -

        getContent

        -
        public 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.
        -
        See Also:
        -
        getIntContent(), -getFloatContent()
        -
        -
      • -
      - - - -
        -
      • -

        getContent

        -
        public String getContent(String defaultValue)
        -
      • -
      - - - - - - - -
        -
      • -

        getIntContent

        -
        public int getIntContent(int defaultValue)
        -
        -
        Parameters:
        -
        defaultValue - the default value of the attribute
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getFloatContent

        -
        public float getFloatContent(float defaultValue)
        -
        -
        Parameters:
        -
        defaultValue - the default value of the attribute
        -
        -
      • -
      - - - -
        -
      • -

        getLongContent

        -
        public long getLongContent()
        -
      • -
      - - - -
        -
      • -

        getLongContent

        -
        public long getLongContent(long defaultValue)
        -
      • -
      - - - -
        -
      • -

        getDoubleContent

        -
        public double getDoubleContent()
        -
      • -
      - - - -
        -
      • -

        getDoubleContent

        -
        public double getDoubleContent(double defaultValue)
        -
      • -
      - - - -
        -
      • -

        setContent

        -
        public void setContent(String text)
        -
      • -
      - - - -
        -
      • -

        setIntContent

        -
        public void setIntContent(int value)
        -
      • -
      - - - -
        -
      • -

        setFloatContent

        -
        public void setFloatContent(float value)
        -
      • -
      - - - -
        -
      • -

        setLongContent

        -
        public void setLongContent(long value)
        -
      • -
      - - - -
        -
      • -

        setDoubleContent

        -
        public void setDoubleContent(double value)
        -
      • -
      - - - -
        -
      • -

        format

        -
        public String format(int indent)
        -
        Format this XML data as a String.
        -
        -
        Parameters:
        -
        indent - -1 for a single line (and no declaration), >= 0 for indents and newlines
        -
        Returns:
        -
        the content
        -
        See Also:
        -
        toString()
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public String toString()
        -
        Return the XML document formatted with two spaces for indents. - Chosen to do this since it's the most common case (e.g. with println()). - Same as format(2). Use the format() function for more options.
        -
        -
        Overrides:
        -
        toString in class Object
        -
        Returns:
        -
        the content
        -
        See Also:
        -
        format(int)
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/data/package-frame.html b/build/javadoc/core/processing/data/package-frame.html deleted file mode 100644 index 1875f0f2ba..0000000000 --- a/build/javadoc/core/processing/data/package-frame.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - -processing.data - - - - -

processing.data

- - - diff --git a/build/javadoc/core/processing/data/package-summary.html b/build/javadoc/core/processing/data/package-summary.html deleted file mode 100644 index 2763db48f0..0000000000 --- a/build/javadoc/core/processing/data/package-summary.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - - -processing.data - - - - - - - - - - -
-

Package processing.data

-
-
-
    -
  • - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    TableRow 
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    FloatDict -
    A simple table class to use a String as a lookup for an float value.
    -
    FloatList -
    Helper class for a list of floats.
    -
    IntDict -
    A simple class to use a String as a lookup for an int value.
    -
    IntList -
    Helper class for a list of ints.
    -
    JSONArray -
    A JSONArray is an ordered sequence of values.
    -
    JSONObject -
    A JSONObject is an unordered collection of name/value pairs.
    -
    Sort -
    Internal sorter used by several data classes.
    -
    StringDict -
    A simple table class to use a String as a lookup for another String value.
    -
    StringList -
    Helper class for a list of Strings.
    -
    Table -
    Generic class for handling tabular data, typically from a CSV, TSV, or - other sort of spreadsheet file.
    -
    XML -
    This is the base class used for the Processing XML library, - representing a single node of an XML tree.
    -
    -
  • -
-
- - - - - - diff --git a/build/javadoc/core/processing/data/package-tree.html b/build/javadoc/core/processing/data/package-tree.html deleted file mode 100644 index 3ea7249487..0000000000 --- a/build/javadoc/core/processing/data/package-tree.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - -processing.data Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.data

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Interface Hierarchy

- -
- - - - - - diff --git a/build/javadoc/core/processing/event/Event.html b/build/javadoc/core/processing/event/Event.html deleted file mode 100644 index 85ecc512b1..0000000000 --- a/build/javadoc/core/processing/event/Event.html +++ /dev/null @@ -1,531 +0,0 @@ - - - - - -Event - - - - - - - - - - - -
-
processing.event
-

Class Event

-
-
- -
- -
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Event

        -
        public Event(Object nativeObject,
        -             long millis,
        -             int action,
        -             int modifiers)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getFlavor

        -
        public int getFlavor()
        -
      • -
      - - - -
        -
      • -

        getNative

        -
        public Object getNative()
        -
        Get the platform-native event object. This might be the java.awt event - on the desktop, though if you're using OpenGL on the desktop it'll be a - NEWT event that JOGL uses. Android events are something else altogether. - Bottom line, use this only if you know what you're doing, and don't make - assumptions about the class type.
        -
      • -
      - - - -
        -
      • -

        getMillis

        -
        public long getMillis()
        -
      • -
      - - - -
        -
      • -

        getAction

        -
        public int getAction()
        -
      • -
      - - - -
        -
      • -

        getModifiers

        -
        public int getModifiers()
        -
      • -
      - - - -
        -
      • -

        isShiftDown

        -
        public boolean isShiftDown()
        -
      • -
      - - - -
        -
      • -

        isControlDown

        -
        public boolean isControlDown()
        -
      • -
      - - - -
        -
      • -

        isMetaDown

        -
        public boolean isMetaDown()
        -
      • -
      - - - -
        -
      • -

        isAltDown

        -
        public boolean isAltDown()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/event/KeyEvent.html b/build/javadoc/core/processing/event/KeyEvent.html deleted file mode 100644 index df43f08df6..0000000000 --- a/build/javadoc/core/processing/event/KeyEvent.html +++ /dev/null @@ -1,384 +0,0 @@ - - - - - -KeyEvent - - - - - - - - - - - -
-
processing.event
-

Class KeyEvent

-
-
- -
-
    -
  • -
    -
    -
    public class KeyEvent
    -extends Event
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        KeyEvent

        -
        public KeyEvent(Object nativeObject,
        -                long millis,
        -                int action,
        -                int modifiers,
        -                char key,
        -                int keyCode)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getKey

        -
        public char getKey()
        -
      • -
      - - - -
        -
      • -

        getKeyCode

        -
        public int getKeyCode()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/event/MouseEvent.html b/build/javadoc/core/processing/event/MouseEvent.html deleted file mode 100644 index 100856c9a8..0000000000 --- a/build/javadoc/core/processing/event/MouseEvent.html +++ /dev/null @@ -1,565 +0,0 @@ - - - - - -MouseEvent - - - - - - - - - - - -
-
processing.event
-

Class MouseEvent

-
-
- -
-
    -
  • -
    -
    -
    public class MouseEvent
    -extends Event
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        MouseEvent

        -
        public MouseEvent(Object nativeObject,
        -                  long millis,
        -                  int action,
        -                  int modifiers,
        -                  int x,
        -                  int y,
        -                  int button,
        -                  int count)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getX

        -
        public int getX()
        -
      • -
      - - - -
        -
      • -

        getY

        -
        public int getY()
        -
      • -
      - - - -
        -
      • -

        getButton

        -
        public int getButton()
        -
        Which button was pressed, either LEFT, CENTER, or RIGHT.
        -
      • -
      - - - -
        -
      • -

        getClickCount

        -
        @Deprecated
        -public int getClickCount()
        -
        Deprecated. 
        -
        Do not use, getCount() is the correct method.
        -
      • -
      - - - -
        -
      • -

        getAmount

        -
        @Deprecated
        -public float getAmount()
        -
        Deprecated. 
        -
        Do not use, getCount() is the correct method.
        -
      • -
      - - - -
        -
      • -

        getCount

        -
        public int getCount()
        -
        Number of clicks for mouse button events, or the number of steps (positive - or negative depending on direction) for a mouse wheel event. - Wheel events follow Java (see here), so - getAmount() will return "negative values if the mouse wheel was rotated - up or away from the user" and positive values in the other direction. - On Mac OS X, this will be reversed when "natural" scrolling is enabled - in System Preferences &rarr Mouse.
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/event/TouchEvent.html b/build/javadoc/core/processing/event/TouchEvent.html deleted file mode 100644 index 3306450665..0000000000 --- a/build/javadoc/core/processing/event/TouchEvent.html +++ /dev/null @@ -1,267 +0,0 @@ - - - - - -TouchEvent - - - - - - - - - - - -
-
processing.event
-

Class TouchEvent

-
-
- -
-
    -
  • -
    -
    -
    public class TouchEvent
    -extends Event
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TouchEvent

        -
        public TouchEvent(Object nativeObject,
        -                  long millis,
        -                  int action,
        -                  int modifiers)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/event/package-frame.html b/build/javadoc/core/processing/event/package-frame.html deleted file mode 100644 index 8b8020b270..0000000000 --- a/build/javadoc/core/processing/event/package-frame.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - -processing.event - - - - -

processing.event

-
-

Classes

- -
- - diff --git a/build/javadoc/core/processing/event/package-summary.html b/build/javadoc/core/processing/event/package-summary.html deleted file mode 100644 index 21e2c00210..0000000000 --- a/build/javadoc/core/processing/event/package-summary.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - -processing.event - - - - - - - - - - -
-

Package processing.event

-
-
- -
- - - - - - diff --git a/build/javadoc/core/processing/event/package-tree.html b/build/javadoc/core/processing/event/package-tree.html deleted file mode 100644 index b7074dd930..0000000000 --- a/build/javadoc/core/processing/event/package-tree.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - -processing.event Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.event

-Package Hierarchies: - -
-
-

Class Hierarchy

- -
- - - - - - diff --git a/build/javadoc/core/processing/opengl/FrameBuffer.html b/build/javadoc/core/processing/opengl/FrameBuffer.html deleted file mode 100644 index d463a93617..0000000000 --- a/build/javadoc/core/processing/opengl/FrameBuffer.html +++ /dev/null @@ -1,619 +0,0 @@ - - - - - -FrameBuffer - - - - - - - - - - - -
-
processing.opengl
-

Class FrameBuffer

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    -
    public class FrameBuffer
    -extends Object
    -implements PConstants
    -
    Encapsulates a Frame Buffer Object for offscreen rendering. - When created with onscreen == true, it represents the normal - framebuffer. Needed by the stack mechanism in OPENGL2 to return - to onscreen rendering after a sequence of pushFramebuffer calls. - It transparently handles the situations when the FBO extension is - not available. - - By Andres Colubri.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        glFbo

        -
        public int glFbo
        -
      • -
      - - - -
        -
      • -

        glDepth

        -
        public int glDepth
        -
      • -
      - - - -
        -
      • -

        glStencil

        -
        public int glStencil
        -
      • -
      - - - -
        -
      • -

        glDepthStencil

        -
        public int glDepthStencil
        -
      • -
      - - - -
        -
      • -

        glMultisample

        -
        public int glMultisample
        -
      • -
      - - - -
        -
      • -

        width

        -
        public int width
        -
      • -
      - - - -
        -
      • -

        height

        -
        public int height
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
      • -
      - - - -
        -
      • -

        copyColor

        -
        public void copyColor(FrameBuffer dest)
        -
      • -
      - - - -
        -
      • -

        copyDepth

        -
        public void copyDepth(FrameBuffer dest)
        -
      • -
      - - - -
        -
      • -

        copyStencil

        -
        public void copyStencil(FrameBuffer dest)
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(FrameBuffer dest,
        -                 int mask)
        -
      • -
      - - - -
        -
      • -

        bind

        -
        public void bind()
        -
      • -
      - - - -
        -
      • -

        disableDepthTest

        -
        public void disableDepthTest()
        -
      • -
      - - - -
        -
      • -

        finish

        -
        public void finish()
        -
      • -
      - - - -
        -
      • -

        readPixels

        -
        public void readPixels()
        -
      • -
      - - - -
        -
      • -

        getPixels

        -
        public void getPixels(int[] pixels)
        -
      • -
      - - - -
        -
      • -

        getPixelBuffer

        -
        public IntBuffer getPixelBuffer()
        -
      • -
      - - - -
        -
      • -

        hasDepthBuffer

        -
        public boolean hasDepthBuffer()
        -
      • -
      - - - -
        -
      • -

        hasStencilBuffer

        -
        public boolean hasStencilBuffer()
        -
      • -
      - - - -
        -
      • -

        setFBO

        -
        public void setFBO(int id)
        -
      • -
      - - - -
        -
      • -

        setColorBuffer

        -
        public void setColorBuffer(Texture tex)
        -
      • -
      - - - -
        -
      • -

        setColorBuffers

        -
        public void setColorBuffers(Texture[] textures)
        -
      • -
      - - - -
        -
      • -

        setColorBuffers

        -
        public void setColorBuffers(Texture[] textures,
        -                            int n)
        -
      • -
      - - - -
        -
      • -

        swapColorBuffers

        -
        public void swapColorBuffers()
        -
      • -
      - - - -
        -
      • -

        getDefaultReadBuffer

        -
        public int getDefaultReadBuffer()
        -
      • -
      - - - -
        -
      • -

        getDefaultDrawBuffer

        -
        public int getDefaultDrawBuffer()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/opengl/LinePath.PathIterator.html b/build/javadoc/core/processing/opengl/LinePath.PathIterator.html deleted file mode 100644 index e1e932a337..0000000000 --- a/build/javadoc/core/processing/opengl/LinePath.PathIterator.html +++ /dev/null @@ -1,290 +0,0 @@ - - - - - -LinePath.PathIterator - - - - - - - - - - - -
-
processing.opengl
-

Class LinePath.PathIterator

-
-
- -
-
    -
  • -
    -
    Enclosing class:
    -
    LinePath
    -
    -
    -
    -
    public static class LinePath.PathIterator
    -extends Object
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        currentSegment

        -
        public int currentSegment(float[] coords)
        -
      • -
      - - - -
        -
      • -

        currentSegment

        -
        public int currentSegment(double[] coords)
        -
      • -
      - - - -
        -
      • -

        getWindingRule

        -
        public int getWindingRule()
        -
      • -
      - - - -
        -
      • -

        isDone

        -
        public boolean isDone()
        -
      • -
      - - - -
        -
      • -

        next

        -
        public void next()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/opengl/LinePath.html b/build/javadoc/core/processing/opengl/LinePath.html deleted file mode 100644 index 5a3a4f14d1..0000000000 --- a/build/javadoc/core/processing/opengl/LinePath.html +++ /dev/null @@ -1,961 +0,0 @@ - - - - - -LinePath - - - - - - - - - - - -
-
processing.opengl
-

Class LinePath

-
-
- -
-
    -
  • -
    -
    -
    public class LinePath
    -extends Object
    -
    The LinePath class allows to represent polygonal paths, - potentially composed by several disjoint polygonal segments. - It can be iterated by the LinePath.PathIterator class including all - of its segment types and winding rules
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Nested Class Summary

      - - - - - - - - - - -
      Nested Classes 
      Modifier and TypeClass and Description
      static class LinePath.PathIterator 
      -
    • -
    - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      static intCAP_BUTT -
      Ends unclosed subpaths and dash segments with no added decoration.
      -
      static intCAP_ROUND -
      Ends unclosed subpaths and dash segments with a round decoration that has a - radius equal to half of the width of the pen.
      -
      static intCAP_SQUARE -
      Ends unclosed subpaths and dash segments with a square projection that - extends beyond the end of the segment to a distance equal to half of the - line width.
      -
      static intJOIN_BEVEL -
      Joins path segments by connecting the outer corners of their wide outlines - with a straight segment.
      -
      static intJOIN_MITER -
      Joins path segments by extending their outside edges until they meet.
      -
      static intJOIN_ROUND -
      Joins path segments by rounding off the corner at a radius of half the line - width.
      -
      static byteSEG_CLOSE -
      Closes segment at current position.
      -
      static byteSEG_LINETO -
      Extends segment by adding a line to a given position.
      -
      static byteSEG_MOVETO -
      Starts segment at a given position.
      -
      static intWIND_EVEN_ODD -
      The winding rule constant for specifying an even-odd rule - for determining the interior of a path.
      -
      static intWIND_NON_ZERO -
      The winding rule constant for specifying a non-zero rule - for determining the interior of a path.
      -
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      Constructor and Description
      LinePath() -
      Constructs a new empty single precision LinePath object with a - default winding rule of WIND_NON_ZERO.
      -
      LinePath(int rule) -
      Constructs a new empty single precision LinePath object with the - specified winding rule to control operations that require the interior of - the path to be defined.
      -
      LinePath(int rule, - int initialCapacity) -
      Constructs a new LinePath object from the given specified initial - values.
      -
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidclosePath() -
      Closes the current subpath by drawing a straight line back to the - coordinates of the last moveTo.
      -
      static byte[]copyOf(byte[] source, - int length) 
      static float[]copyOf(float[] source, - int length) 
      static int[]copyOf(int[] source, - int length) 
      static LinePathcreateStrokedPath(LinePath src, - float weight, - int caps, - int join) 
      static LinePathcreateStrokedPath(LinePath src, - float weight, - int caps, - int join, - float miterlimit) 
      static LinePathcreateStrokedPath(LinePath src, - float weight, - int caps, - int join, - float miterlimit, - PMatrix2D transform) -
      Constructs a solid LinePath with the specified attributes.
      -
      LinePath.PathIteratorgetPathIterator() -
      The iterator for this class is not multi-threaded safe, which means that - the LinePath class does not guarantee that modifications to the - geometry of this LinePath object do not affect any iterations of that - geometry that are already in process.
      -
      intgetWindingRule() -
      Returns the fill style winding rule.
      -
      static doublehypot(double x, - double y) 
      static inthypot(int x, - int y) 
      static longhypot(long x, - long y) 
      static intisqrt(int x) 
      voidlineTo(float x, - float y, - int c) -
      Adds a point to the path by drawing a straight line from the current - coordinates to the new specified coordinates specified in float precision.
      -
      static longlsqrt(long x) 
      voidmoveTo(float x, - float y, - int c) -
      Adds a point to the path by moving to the specified coordinates specified - in float precision.
      -
      voidreset() -
      Resets the path to empty.
      -
      voidsetWindingRule(int rule) -
      Sets the winding rule for this path to the specified value.
      -
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        WIND_EVEN_ODD

        -
        public static final int WIND_EVEN_ODD
        -
        The winding rule constant for specifying an even-odd rule - for determining the interior of a path. - The even-odd rule specifies that a point lies inside the - path if a ray drawn in any direction from that point to - infinity is crossed by path segments an odd number of times.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        WIND_NON_ZERO

        -
        public static final int WIND_NON_ZERO
        -
        The winding rule constant for specifying a non-zero rule - for determining the interior of a path. - The non-zero rule specifies that a point lies inside the - path if a ray drawn in any direction from that point to - infinity is crossed by path segments a different number - of times in the counter-clockwise direction than the - clockwise direction.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        SEG_MOVETO

        -
        public static final byte SEG_MOVETO
        -
        Starts segment at a given position.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        SEG_LINETO

        -
        public static final byte SEG_LINETO
        -
        Extends segment by adding a line to a given position.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        SEG_CLOSE

        -
        public static final byte SEG_CLOSE
        -
        Closes segment at current position.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        JOIN_MITER

        -
        public static final int JOIN_MITER
        -
        Joins path segments by extending their outside edges until they meet.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        JOIN_ROUND

        -
        public static final int JOIN_ROUND
        -
        Joins path segments by rounding off the corner at a radius of half the line - width.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        JOIN_BEVEL

        -
        public static final int JOIN_BEVEL
        -
        Joins path segments by connecting the outer corners of their wide outlines - with a straight segment.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        CAP_BUTT

        -
        public static final int CAP_BUTT
        -
        Ends unclosed subpaths and dash segments with no added decoration.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        CAP_ROUND

        -
        public static final int CAP_ROUND
        -
        Ends unclosed subpaths and dash segments with a round decoration that has a - radius equal to half of the width of the pen.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        CAP_SQUARE

        -
        public static final int CAP_SQUARE
        -
        Ends unclosed subpaths and dash segments with a square projection that - extends beyond the end of the segment to a distance equal to half of the - line width.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        LinePath

        -
        public LinePath()
        -
        Constructs a new empty single precision LinePath object with a - default winding rule of WIND_NON_ZERO.
        -
      • -
      - - - -
        -
      • -

        LinePath

        -
        public LinePath(int rule)
        -
        Constructs a new empty single precision LinePath object with the - specified winding rule to control operations that require the interior of - the path to be defined.
        -
        -
        Parameters:
        -
        rule - the winding rule
        -
        See Also:
        -
        WIND_EVEN_ODD, -WIND_NON_ZERO
        -
        -
      • -
      - - - -
        -
      • -

        LinePath

        -
        public LinePath(int rule,
        -                int initialCapacity)
        -
        Constructs a new LinePath object from the given specified initial - values. This method is only intended for internal use and should not be - made public if the other constructors for this class are ever exposed.
        -
        -
        Parameters:
        -
        rule - the winding rule
        -
        initialTypes - the size to make the initial array to store the path segment types
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        moveTo

        -
        public final void moveTo(float x,
        -                         float y,
        -                         int c)
        -
        Adds a point to the path by moving to the specified coordinates specified - in float precision. -

        - This method provides a single precision variant of the double precision - moveTo() method on the base LinePath class.

        -
        -
        Parameters:
        -
        x - the specified X coordinate
        -
        y - the specified Y coordinate
        -
        See Also:
        -
        moveTo(float, float, int)
        -
        -
      • -
      - - - -
        -
      • -

        lineTo

        -
        public final void lineTo(float x,
        -                         float y,
        -                         int c)
        -
        Adds a point to the path by drawing a straight line from the current - coordinates to the new specified coordinates specified in float precision. -

        - This method provides a single precision variant of the double precision - lineTo() method on the base LinePath class.

        -
        -
        Parameters:
        -
        x - the specified X coordinate
        -
        y - the specified Y coordinate
        -
        See Also:
        -
        lineTo(float, float, int)
        -
        -
      • -
      - - - -
        -
      • -

        getPathIterator

        -
        public LinePath.PathIterator getPathIterator()
        -
        The iterator for this class is not multi-threaded safe, which means that - the LinePath class does not guarantee that modifications to the - geometry of this LinePath object do not affect any iterations of that - geometry that are already in process.
        -
      • -
      - - - -
        -
      • -

        closePath

        -
        public final void closePath()
        -
        Closes the current subpath by drawing a straight line back to the - coordinates of the last moveTo. If the path is already closed then - this method has no effect.
        -
      • -
      - - - -
        -
      • -

        getWindingRule

        -
        public final int getWindingRule()
        -
        Returns the fill style winding rule.
        -
        -
        Returns:
        -
        an integer representing the current winding rule.
        -
        See Also:
        -
        WIND_EVEN_ODD, -WIND_NON_ZERO, -setWindingRule(int)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        reset

        -
        public final void reset()
        -
        Resets the path to empty. The append position is set back to the beginning - of the path and all coordinates and point types are forgotten.
        -
      • -
      - - - -
        -
      • -

        createStrokedPath

        -
        public static LinePath createStrokedPath(LinePath src,
        -                                         float weight,
        -                                         int caps,
        -                                         int join)
        -
      • -
      - - - -
        -
      • -

        createStrokedPath

        -
        public static LinePath createStrokedPath(LinePath src,
        -                                         float weight,
        -                                         int caps,
        -                                         int join,
        -                                         float miterlimit)
        -
      • -
      - - - -
        -
      • -

        createStrokedPath

        -
        public static LinePath createStrokedPath(LinePath src,
        -                                         float weight,
        -                                         int caps,
        -                                         int join,
        -                                         float miterlimit,
        -                                         PMatrix2D transform)
        -
        Constructs a solid LinePath with the specified attributes.
        -
        -
        Parameters:
        -
        src - the original path to be stroked
        -
        weight - the weight of the stroked path
        -
        cap - the decoration of the ends of the segments in the path
        -
        join - the decoration applied where path segments meet
        -
        miterlimit -
        -
        transform -
        -
        -
      • -
      - - - -
        -
      • -

        copyOf

        -
        public static float[] copyOf(float[] source,
        -                             int length)
        -
      • -
      - - - -
        -
      • -

        copyOf

        -
        public static byte[] copyOf(byte[] source,
        -                            int length)
        -
      • -
      - - - -
        -
      • -

        copyOf

        -
        public static int[] copyOf(int[] source,
        -                           int length)
        -
      • -
      - - - -
        -
      • -

        isqrt

        -
        public static int isqrt(int x)
        -
      • -
      - - - -
        -
      • -

        lsqrt

        -
        public static long lsqrt(long x)
        -
      • -
      - - - -
        -
      • -

        hypot

        -
        public static double hypot(double x,
        -                           double y)
        -
      • -
      - - - -
        -
      • -

        hypot

        -
        public static int hypot(int x,
        -                        int y)
        -
      • -
      - - - -
        -
      • -

        hypot

        -
        public static long hypot(long x,
        -                         long y)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/opengl/LineStroker.html b/build/javadoc/core/processing/opengl/LineStroker.html deleted file mode 100644 index ca5402b3b3..0000000000 --- a/build/javadoc/core/processing/opengl/LineStroker.html +++ /dev/null @@ -1,428 +0,0 @@ - - - - - -LineStroker - - - - - - - - - - - -
-
processing.opengl
-

Class LineStroker

-
-
- -
-
    -
  • -
    -
    -
    public class LineStroker
    -extends Object
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        LineStroker

        -
        public LineStroker()
        -
        Empty constructor. setOutput and setParameters - must be called prior to calling any other methods.
        -
      • -
      - - - -
        -
      • -

        LineStroker

        -
        public LineStroker(LineStroker output,
        -                   int lineWidth,
        -                   int capStyle,
        -                   int joinStyle,
        -                   int miterLimit,
        -                   PMatrix2D transform)
        -
        Constructs a LineStroker.
        -
        -
        Parameters:
        -
        output - an output LineStroker.
        -
        lineWidth - the desired line width in pixels, in S15.16 format.
        -
        capStyle - the desired end cap style, one of CAP_BUTT, - CAP_ROUND or CAP_SQUARE.
        -
        joinStyle - the desired line join style, one of JOIN_MITER, - JOIN_ROUND or JOIN_BEVEL.
        -
        miterLimit - the desired miter limit, in S15.16 format.
        -
        transform - a Transform4 object indicating the transform that has - been previously applied to all incoming coordinates. This is - required in order to produce consistently shaped end caps and - joins.
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setOutput

        -
        public void setOutput(LineStroker output)
        -
        Sets the output LineStroker of this LineStroker.
        -
        -
        Parameters:
        -
        output - an output LineStroker.
        -
        -
      • -
      - - - -
        -
      • -

        setParameters

        -
        public void setParameters(int lineWidth,
        -                          int capStyle,
        -                          int joinStyle,
        -                          int miterLimit,
        -                          PMatrix2D transform)
        -
        Sets the parameters of this LineStroker.
        -
        -
        Parameters:
        -
        lineWidth - the desired line width in pixels, in S15.16 format.
        -
        capStyle - the desired end cap style, one of CAP_BUTT, - CAP_ROUND or CAP_SQUARE.
        -
        joinStyle - the desired line join style, one of JOIN_MITER, - JOIN_ROUND or JOIN_BEVEL.
        -
        miterLimit - the desired miter limit, in S15.16 format.
        -
        transform - a Transform4 object indicating the transform that has - been previously applied to all incoming coordinates. This is - required in order to produce consistently shaped end caps and - joins.
        -
        -
      • -
      - - - -
        -
      • -

        moveTo

        -
        public void moveTo(int x0,
        -                   int y0,
        -                   int c0)
        -
      • -
      - - - -
        -
      • -

        lineJoin

        -
        public void lineJoin()
        -
      • -
      - - - -
        -
      • -

        lineTo

        -
        public void lineTo(int x1,
        -                   int y1,
        -                   int c1)
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -
      • -
      - - - -
        -
      • -

        end

        -
        public void end()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/opengl/PGL.html b/build/javadoc/core/processing/opengl/PGL.html deleted file mode 100644 index a216374222..0000000000 --- a/build/javadoc/core/processing/opengl/PGL.html +++ /dev/null @@ -1,6199 +0,0 @@ - - - - - -PGL - - - - - - - - - - - -
-
processing.opengl
-

Class PGL

-
-
- -
-
    -
  • -
    -
    Direct Known Subclasses:
    -
    PJOGL
    -
    -
    -
    -
    public abstract class PGL
    -extends Object
    -
    Processing-OpenGL abstraction layer. Needs to be implemented by subclasses - using specific OpenGL-Java bindings. - - It includes a full GLES 2.0 interface.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        primaryPGL

        -
        public boolean primaryPGL
        -
        true if this is the GL interface for a primary surface PGraphics
        -
      • -
      - - - -
        -
      • -

        REQUESTED_DEPTH_BITS

        -
        public static int REQUESTED_DEPTH_BITS
        -
      • -
      - - - -
        -
      • -

        REQUESTED_STENCIL_BITS

        -
        public static int REQUESTED_STENCIL_BITS
        -
      • -
      - - - -
        -
      • -

        REQUESTED_ALPHA_BITS

        -
        public static int REQUESTED_ALPHA_BITS
        -
      • -
      - - - -
        -
      • -

        reqNumSamples

        -
        public int reqNumSamples
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        presentMode

        -
        public boolean presentMode
        -
      • -
      - - - -
        -
      • -

        offsetX

        -
        public float offsetX
        -
      • -
      - - - -
        -
      • -

        offsetY

        -
        public float offsetY
        -
      • -
      - - - -
        -
      • -

        FALSE

        -
        public static int FALSE
        -
      • -
      - - - -
        -
      • -

        TRUE

        -
        public static int TRUE
        -
      • -
      - - - -
        -
      • -

        INT

        -
        public static int INT
        -
      • -
      - - - -
        -
      • -

        BYTE

        -
        public static int BYTE
        -
      • -
      - - - -
        -
      • -

        SHORT

        -
        public static int SHORT
        -
      • -
      - - - -
        -
      • -

        FLOAT

        -
        public static int FLOAT
        -
      • -
      - - - -
        -
      • -

        BOOL

        -
        public static int BOOL
        -
      • -
      - - - -
        -
      • -

        UNSIGNED_INT

        -
        public static int UNSIGNED_INT
        -
      • -
      - - - -
        -
      • -

        UNSIGNED_BYTE

        -
        public static int UNSIGNED_BYTE
        -
      • -
      - - - -
        -
      • -

        UNSIGNED_SHORT

        -
        public static int UNSIGNED_SHORT
        -
      • -
      - - - -
        -
      • -

        RGB

        -
        public static int RGB
        -
      • -
      - - - -
        -
      • -

        RGBA

        -
        public static int RGBA
        -
      • -
      - - - -
        -
      • -

        ALPHA

        -
        public static int ALPHA
        -
      • -
      - - - -
        -
      • -

        LUMINANCE

        -
        public static int LUMINANCE
        -
      • -
      - - - -
        -
      • -

        LUMINANCE_ALPHA

        -
        public static int LUMINANCE_ALPHA
        -
      • -
      - - - -
        -
      • -

        UNSIGNED_SHORT_5_6_5

        -
        public static int UNSIGNED_SHORT_5_6_5
        -
      • -
      - - - -
        -
      • -

        UNSIGNED_SHORT_4_4_4_4

        -
        public static int UNSIGNED_SHORT_4_4_4_4
        -
      • -
      - - - -
        -
      • -

        UNSIGNED_SHORT_5_5_5_1

        -
        public static int UNSIGNED_SHORT_5_5_5_1
        -
      • -
      - - - -
        -
      • -

        RGBA4

        -
        public static int RGBA4
        -
      • -
      - - - -
        -
      • -

        RGB5_A1

        -
        public static int RGB5_A1
        -
      • -
      - - - -
        -
      • -

        RGB565

        -
        public static int RGB565
        -
      • -
      - - - -
        -
      • -

        RGB8

        -
        public static int RGB8
        -
      • -
      - - - -
        -
      • -

        RGBA8

        -
        public static int RGBA8
        -
      • -
      - - - -
        -
      • -

        ALPHA8

        -
        public static int ALPHA8
        -
      • -
      - - - -
        -
      • -

        READ_ONLY

        -
        public static int READ_ONLY
        -
      • -
      - - - -
        -
      • -

        WRITE_ONLY

        -
        public static int WRITE_ONLY
        -
      • -
      - - - -
        -
      • -

        READ_WRITE

        -
        public static int READ_WRITE
        -
      • -
      - - - -
        -
      • -

        TESS_WINDING_NONZERO

        -
        public static int TESS_WINDING_NONZERO
        -
      • -
      - - - -
        -
      • -

        TESS_WINDING_ODD

        -
        public static int TESS_WINDING_ODD
        -
      • -
      - - - -
        -
      • -

        GENERATE_MIPMAP_HINT

        -
        public static int GENERATE_MIPMAP_HINT
        -
      • -
      - - - -
        -
      • -

        FASTEST

        -
        public static int FASTEST
        -
      • -
      - - - -
        -
      • -

        NICEST

        -
        public static int NICEST
        -
      • -
      - - - -
        -
      • -

        DONT_CARE

        -
        public static int DONT_CARE
        -
      • -
      - - - -
        -
      • -

        VENDOR

        -
        public static int VENDOR
        -
      • -
      - - - -
        -
      • -

        RENDERER

        -
        public static int RENDERER
        -
      • -
      - - - -
        -
      • -

        VERSION

        -
        public static int VERSION
        -
      • -
      - - - -
        -
      • -

        EXTENSIONS

        -
        public static int EXTENSIONS
        -
      • -
      - - - -
        -
      • -

        SHADING_LANGUAGE_VERSION

        -
        public static int SHADING_LANGUAGE_VERSION
        -
      • -
      - - - -
        -
      • -

        MAX_SAMPLES

        -
        public static int MAX_SAMPLES
        -
      • -
      - - - -
        -
      • -

        SAMPLES

        -
        public static int SAMPLES
        -
      • -
      - - - -
        -
      • -

        ALIASED_LINE_WIDTH_RANGE

        -
        public static int ALIASED_LINE_WIDTH_RANGE
        -
      • -
      - - - -
        -
      • -

        ALIASED_POINT_SIZE_RANGE

        -
        public static int ALIASED_POINT_SIZE_RANGE
        -
      • -
      - - - -
        -
      • -

        DEPTH_BITS

        -
        public static int DEPTH_BITS
        -
      • -
      - - - -
        -
      • -

        STENCIL_BITS

        -
        public static int STENCIL_BITS
        -
      • -
      - - - -
        -
      • -

        CCW

        -
        public static int CCW
        -
      • -
      - - - -
        -
      • -

        CW

        -
        public static int CW
        -
      • -
      - - - -
        -
      • -

        VIEWPORT

        -
        public static int VIEWPORT
        -
      • -
      - - - -
        -
      • -

        ARRAY_BUFFER

        -
        public static int ARRAY_BUFFER
        -
      • -
      - - - -
        -
      • -

        ELEMENT_ARRAY_BUFFER

        -
        public static int ELEMENT_ARRAY_BUFFER
        -
      • -
      - - - -
        -
      • -

        MAX_VERTEX_ATTRIBS

        -
        public static int MAX_VERTEX_ATTRIBS
        -
      • -
      - - - -
        -
      • -

        STATIC_DRAW

        -
        public static int STATIC_DRAW
        -
      • -
      - - - -
        -
      • -

        DYNAMIC_DRAW

        -
        public static int DYNAMIC_DRAW
        -
      • -
      - - - -
        -
      • -

        STREAM_DRAW

        -
        public static int STREAM_DRAW
        -
      • -
      - - - -
        -
      • -

        BUFFER_SIZE

        -
        public static int BUFFER_SIZE
        -
      • -
      - - - -
        -
      • -

        BUFFER_USAGE

        -
        public static int BUFFER_USAGE
        -
      • -
      - - - -
        -
      • -

        POINTS

        -
        public static int POINTS
        -
      • -
      - - - -
        -
      • -

        LINE_STRIP

        -
        public static int LINE_STRIP
        -
      • -
      - - - -
        -
      • -

        LINE_LOOP

        -
        public static int LINE_LOOP
        -
      • -
      - - - -
        -
      • -

        LINES

        -
        public static int LINES
        -
      • -
      - - - -
        -
      • -

        TRIANGLE_FAN

        -
        public static int TRIANGLE_FAN
        -
      • -
      - - - -
        -
      • -

        TRIANGLE_STRIP

        -
        public static int TRIANGLE_STRIP
        -
      • -
      - - - -
        -
      • -

        TRIANGLES

        -
        public static int TRIANGLES
        -
      • -
      - - - -
        -
      • -

        CULL_FACE

        -
        public static int CULL_FACE
        -
      • -
      - - - -
        -
      • -

        FRONT

        -
        public static int FRONT
        -
      • -
      - - - -
        -
      • -

        BACK

        -
        public static int BACK
        -
      • -
      - - - -
        -
      • -

        FRONT_AND_BACK

        -
        public static int FRONT_AND_BACK
        -
      • -
      - - - -
        -
      • -

        POLYGON_OFFSET_FILL

        -
        public static int POLYGON_OFFSET_FILL
        -
      • -
      - - - -
        -
      • -

        UNPACK_ALIGNMENT

        -
        public static int UNPACK_ALIGNMENT
        -
      • -
      - - - -
        -
      • -

        PACK_ALIGNMENT

        -
        public static int PACK_ALIGNMENT
        -
      • -
      - - - -
        -
      • -

        TEXTURE_2D

        -
        public static int TEXTURE_2D
        -
      • -
      - - - -
        -
      • -

        TEXTURE_RECTANGLE

        -
        public static int TEXTURE_RECTANGLE
        -
      • -
      - - - -
        -
      • -

        TEXTURE_BINDING_2D

        -
        public static int TEXTURE_BINDING_2D
        -
      • -
      - - - -
        -
      • -

        TEXTURE_BINDING_RECTANGLE

        -
        public static int TEXTURE_BINDING_RECTANGLE
        -
      • -
      - - - -
        -
      • -

        MAX_TEXTURE_SIZE

        -
        public static int MAX_TEXTURE_SIZE
        -
      • -
      - - - -
        -
      • -

        TEXTURE_MAX_ANISOTROPY

        -
        public static int TEXTURE_MAX_ANISOTROPY
        -
      • -
      - - - -
        -
      • -

        MAX_TEXTURE_MAX_ANISOTROPY

        -
        public static int MAX_TEXTURE_MAX_ANISOTROPY
        -
      • -
      - - - -
        -
      • -

        MAX_VERTEX_TEXTURE_IMAGE_UNITS

        -
        public static int MAX_VERTEX_TEXTURE_IMAGE_UNITS
        -
      • -
      - - - -
        -
      • -

        MAX_TEXTURE_IMAGE_UNITS

        -
        public static int MAX_TEXTURE_IMAGE_UNITS
        -
      • -
      - - - -
        -
      • -

        MAX_COMBINED_TEXTURE_IMAGE_UNITS

        -
        public static int MAX_COMBINED_TEXTURE_IMAGE_UNITS
        -
      • -
      - - - -
        -
      • -

        NUM_COMPRESSED_TEXTURE_FORMATS

        -
        public static int NUM_COMPRESSED_TEXTURE_FORMATS
        -
      • -
      - - - -
        -
      • -

        COMPRESSED_TEXTURE_FORMATS

        -
        public static int COMPRESSED_TEXTURE_FORMATS
        -
      • -
      - - - -
        -
      • -

        NEAREST

        -
        public static int NEAREST
        -
      • -
      - - - -
        -
      • -

        LINEAR

        -
        public static int LINEAR
        -
      • -
      - - - -
        -
      • -

        LINEAR_MIPMAP_NEAREST

        -
        public static int LINEAR_MIPMAP_NEAREST
        -
      • -
      - - - -
        -
      • -

        LINEAR_MIPMAP_LINEAR

        -
        public static int LINEAR_MIPMAP_LINEAR
        -
      • -
      - - - -
        -
      • -

        CLAMP_TO_EDGE

        -
        public static int CLAMP_TO_EDGE
        -
      • -
      - - - -
        -
      • -

        REPEAT

        -
        public static int REPEAT
        -
      • -
      - - - -
        -
      • -

        TEXTURE0

        -
        public static int TEXTURE0
        -
      • -
      - - - -
        -
      • -

        TEXTURE1

        -
        public static int TEXTURE1
        -
      • -
      - - - -
        -
      • -

        TEXTURE2

        -
        public static int TEXTURE2
        -
      • -
      - - - -
        -
      • -

        TEXTURE3

        -
        public static int TEXTURE3
        -
      • -
      - - - -
        -
      • -

        TEXTURE_MIN_FILTER

        -
        public static int TEXTURE_MIN_FILTER
        -
      • -
      - - - -
        -
      • -

        TEXTURE_MAG_FILTER

        -
        public static int TEXTURE_MAG_FILTER
        -
      • -
      - - - -
        -
      • -

        TEXTURE_WRAP_S

        -
        public static int TEXTURE_WRAP_S
        -
      • -
      - - - -
        -
      • -

        TEXTURE_WRAP_T

        -
        public static int TEXTURE_WRAP_T
        -
      • -
      - - - -
        -
      • -

        TEXTURE_WRAP_R

        -
        public static int TEXTURE_WRAP_R
        -
      • -
      - - - -
        -
      • -

        TEXTURE_CUBE_MAP

        -
        public static int TEXTURE_CUBE_MAP
        -
      • -
      - - - -
        -
      • -

        TEXTURE_CUBE_MAP_POSITIVE_X

        -
        public static int TEXTURE_CUBE_MAP_POSITIVE_X
        -
      • -
      - - - -
        -
      • -

        TEXTURE_CUBE_MAP_POSITIVE_Y

        -
        public static int TEXTURE_CUBE_MAP_POSITIVE_Y
        -
      • -
      - - - -
        -
      • -

        TEXTURE_CUBE_MAP_POSITIVE_Z

        -
        public static int TEXTURE_CUBE_MAP_POSITIVE_Z
        -
      • -
      - - - -
        -
      • -

        TEXTURE_CUBE_MAP_NEGATIVE_X

        -
        public static int TEXTURE_CUBE_MAP_NEGATIVE_X
        -
      • -
      - - - -
        -
      • -

        TEXTURE_CUBE_MAP_NEGATIVE_Y

        -
        public static int TEXTURE_CUBE_MAP_NEGATIVE_Y
        -
      • -
      - - - -
        -
      • -

        TEXTURE_CUBE_MAP_NEGATIVE_Z

        -
        public static int TEXTURE_CUBE_MAP_NEGATIVE_Z
        -
      • -
      - - - -
        -
      • -

        VERTEX_SHADER

        -
        public static int VERTEX_SHADER
        -
      • -
      - - - -
        -
      • -

        FRAGMENT_SHADER

        -
        public static int FRAGMENT_SHADER
        -
      • -
      - - - -
        -
      • -

        INFO_LOG_LENGTH

        -
        public static int INFO_LOG_LENGTH
        -
      • -
      - - - -
        -
      • -

        SHADER_SOURCE_LENGTH

        -
        public static int SHADER_SOURCE_LENGTH
        -
      • -
      - - - -
        -
      • -

        COMPILE_STATUS

        -
        public static int COMPILE_STATUS
        -
      • -
      - - - -
        -
      • -

        LINK_STATUS

        -
        public static int LINK_STATUS
        -
      • -
      - - - -
        -
      • -

        VALIDATE_STATUS

        -
        public static int VALIDATE_STATUS
        -
      • -
      - - - -
        -
      • -

        SHADER_TYPE

        -
        public static int SHADER_TYPE
        -
      • -
      - - - -
        -
      • -

        DELETE_STATUS

        -
        public static int DELETE_STATUS
        -
      • -
      - - - -
        -
      • -

        FLOAT_VEC2

        -
        public static int FLOAT_VEC2
        -
      • -
      - - - -
        -
      • -

        FLOAT_VEC3

        -
        public static int FLOAT_VEC3
        -
      • -
      - - - -
        -
      • -

        FLOAT_VEC4

        -
        public static int FLOAT_VEC4
        -
      • -
      - - - -
        -
      • -

        FLOAT_MAT2

        -
        public static int FLOAT_MAT2
        -
      • -
      - - - -
        -
      • -

        FLOAT_MAT3

        -
        public static int FLOAT_MAT3
        -
      • -
      - - - -
        -
      • -

        FLOAT_MAT4

        -
        public static int FLOAT_MAT4
        -
      • -
      - - - -
        -
      • -

        INT_VEC2

        -
        public static int INT_VEC2
        -
      • -
      - - - -
        -
      • -

        INT_VEC3

        -
        public static int INT_VEC3
        -
      • -
      - - - -
        -
      • -

        INT_VEC4

        -
        public static int INT_VEC4
        -
      • -
      - - - -
        -
      • -

        BOOL_VEC2

        -
        public static int BOOL_VEC2
        -
      • -
      - - - -
        -
      • -

        BOOL_VEC3

        -
        public static int BOOL_VEC3
        -
      • -
      - - - -
        -
      • -

        BOOL_VEC4

        -
        public static int BOOL_VEC4
        -
      • -
      - - - -
        -
      • -

        SAMPLER_2D

        -
        public static int SAMPLER_2D
        -
      • -
      - - - -
        -
      • -

        SAMPLER_CUBE

        -
        public static int SAMPLER_CUBE
        -
      • -
      - - - -
        -
      • -

        LOW_FLOAT

        -
        public static int LOW_FLOAT
        -
      • -
      - - - -
        -
      • -

        MEDIUM_FLOAT

        -
        public static int MEDIUM_FLOAT
        -
      • -
      - - - -
        -
      • -

        HIGH_FLOAT

        -
        public static int HIGH_FLOAT
        -
      • -
      - - - -
        -
      • -

        LOW_INT

        -
        public static int LOW_INT
        -
      • -
      - - - -
        -
      • -

        MEDIUM_INT

        -
        public static int MEDIUM_INT
        -
      • -
      - - - -
        -
      • -

        HIGH_INT

        -
        public static int HIGH_INT
        -
      • -
      - - - -
        -
      • -

        CURRENT_VERTEX_ATTRIB

        -
        public static int CURRENT_VERTEX_ATTRIB
        -
      • -
      - - - -
        -
      • -

        VERTEX_ATTRIB_ARRAY_BUFFER_BINDING

        -
        public static int VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
        -
      • -
      - - - -
        -
      • -

        VERTEX_ATTRIB_ARRAY_ENABLED

        -
        public static int VERTEX_ATTRIB_ARRAY_ENABLED
        -
      • -
      - - - -
        -
      • -

        VERTEX_ATTRIB_ARRAY_SIZE

        -
        public static int VERTEX_ATTRIB_ARRAY_SIZE
        -
      • -
      - - - -
        -
      • -

        VERTEX_ATTRIB_ARRAY_STRIDE

        -
        public static int VERTEX_ATTRIB_ARRAY_STRIDE
        -
      • -
      - - - -
        -
      • -

        VERTEX_ATTRIB_ARRAY_TYPE

        -
        public static int VERTEX_ATTRIB_ARRAY_TYPE
        -
      • -
      - - - -
        -
      • -

        VERTEX_ATTRIB_ARRAY_NORMALIZED

        -
        public static int VERTEX_ATTRIB_ARRAY_NORMALIZED
        -
      • -
      - - - -
        -
      • -

        VERTEX_ATTRIB_ARRAY_POINTER

        -
        public static int VERTEX_ATTRIB_ARRAY_POINTER
        -
      • -
      - - - -
        -
      • -

        BLEND

        -
        public static int BLEND
        -
      • -
      - - - -
        -
      • -

        ONE

        -
        public static int ONE
        -
      • -
      - - - -
        -
      • -

        ZERO

        -
        public static int ZERO
        -
      • -
      - - - -
        -
      • -

        SRC_ALPHA

        -
        public static int SRC_ALPHA
        -
      • -
      - - - -
        -
      • -

        DST_ALPHA

        -
        public static int DST_ALPHA
        -
      • -
      - - - -
        -
      • -

        ONE_MINUS_SRC_ALPHA

        -
        public static int ONE_MINUS_SRC_ALPHA
        -
      • -
      - - - -
        -
      • -

        ONE_MINUS_DST_COLOR

        -
        public static int ONE_MINUS_DST_COLOR
        -
      • -
      - - - -
        -
      • -

        ONE_MINUS_SRC_COLOR

        -
        public static int ONE_MINUS_SRC_COLOR
        -
      • -
      - - - -
        -
      • -

        DST_COLOR

        -
        public static int DST_COLOR
        -
      • -
      - - - -
        -
      • -

        SRC_COLOR

        -
        public static int SRC_COLOR
        -
      • -
      - - - -
        -
      • -

        SAMPLE_ALPHA_TO_COVERAGE

        -
        public static int SAMPLE_ALPHA_TO_COVERAGE
        -
      • -
      - - - -
        -
      • -

        SAMPLE_COVERAGE

        -
        public static int SAMPLE_COVERAGE
        -
      • -
      - - - -
        -
      • -

        KEEP

        -
        public static int KEEP
        -
      • -
      - - - -
        -
      • -

        REPLACE

        -
        public static int REPLACE
        -
      • -
      - - - -
        -
      • -

        INCR

        -
        public static int INCR
        -
      • -
      - - - -
        -
      • -

        DECR

        -
        public static int DECR
        -
      • -
      - - - -
        -
      • -

        INVERT

        -
        public static int INVERT
        -
      • -
      - - - -
        -
      • -

        INCR_WRAP

        -
        public static int INCR_WRAP
        -
      • -
      - - - -
        -
      • -

        DECR_WRAP

        -
        public static int DECR_WRAP
        -
      • -
      - - - -
        -
      • -

        NEVER

        -
        public static int NEVER
        -
      • -
      - - - -
        -
      • -

        ALWAYS

        -
        public static int ALWAYS
        -
      • -
      - - - -
        -
      • -

        EQUAL

        -
        public static int EQUAL
        -
      • -
      - - - -
        -
      • -

        LESS

        -
        public static int LESS
        -
      • -
      - - - -
        -
      • -

        LEQUAL

        -
        public static int LEQUAL
        -
      • -
      - - - -
        -
      • -

        GREATER

        -
        public static int GREATER
        -
      • -
      - - - -
        -
      • -

        GEQUAL

        -
        public static int GEQUAL
        -
      • -
      - - - -
        -
      • -

        NOTEQUAL

        -
        public static int NOTEQUAL
        -
      • -
      - - - -
        -
      • -

        FUNC_ADD

        -
        public static int FUNC_ADD
        -
      • -
      - - - -
        -
      • -

        FUNC_MIN

        -
        public static int FUNC_MIN
        -
      • -
      - - - -
        -
      • -

        FUNC_MAX

        -
        public static int FUNC_MAX
        -
      • -
      - - - -
        -
      • -

        FUNC_REVERSE_SUBTRACT

        -
        public static int FUNC_REVERSE_SUBTRACT
        -
      • -
      - - - -
        -
      • -

        FUNC_SUBTRACT

        -
        public static int FUNC_SUBTRACT
        -
      • -
      - - - -
        -
      • -

        DITHER

        -
        public static int DITHER
        -
      • -
      - - - -
        -
      • -

        CONSTANT_COLOR

        -
        public static int CONSTANT_COLOR
        -
      • -
      - - - -
        -
      • -

        CONSTANT_ALPHA

        -
        public static int CONSTANT_ALPHA
        -
      • -
      - - - -
        -
      • -

        ONE_MINUS_CONSTANT_COLOR

        -
        public static int ONE_MINUS_CONSTANT_COLOR
        -
      • -
      - - - -
        -
      • -

        ONE_MINUS_CONSTANT_ALPHA

        -
        public static int ONE_MINUS_CONSTANT_ALPHA
        -
      • -
      - - - -
        -
      • -

        SRC_ALPHA_SATURATE

        -
        public static int SRC_ALPHA_SATURATE
        -
      • -
      - - - -
        -
      • -

        SCISSOR_TEST

        -
        public static int SCISSOR_TEST
        -
      • -
      - - - -
        -
      • -

        STENCIL_TEST

        -
        public static int STENCIL_TEST
        -
      • -
      - - - -
        -
      • -

        DEPTH_TEST

        -
        public static int DEPTH_TEST
        -
      • -
      - - - -
        -
      • -

        DEPTH_WRITEMASK

        -
        public static int DEPTH_WRITEMASK
        -
      • -
      - - - -
        -
      • -

        ALPHA_TEST

        -
        public static int ALPHA_TEST
        -
      • -
      - - - -
        -
      • -

        COLOR_BUFFER_BIT

        -
        public static int COLOR_BUFFER_BIT
        -
      • -
      - - - -
        -
      • -

        DEPTH_BUFFER_BIT

        -
        public static int DEPTH_BUFFER_BIT
        -
      • -
      - - - -
        -
      • -

        STENCIL_BUFFER_BIT

        -
        public static int STENCIL_BUFFER_BIT
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER

        -
        public static int FRAMEBUFFER
        -
      • -
      - - - -
        -
      • -

        COLOR_ATTACHMENT0

        -
        public static int COLOR_ATTACHMENT0
        -
      • -
      - - - -
        -
      • -

        COLOR_ATTACHMENT1

        -
        public static int COLOR_ATTACHMENT1
        -
      • -
      - - - -
        -
      • -

        COLOR_ATTACHMENT2

        -
        public static int COLOR_ATTACHMENT2
        -
      • -
      - - - -
        -
      • -

        COLOR_ATTACHMENT3

        -
        public static int COLOR_ATTACHMENT3
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER

        -
        public static int RENDERBUFFER
        -
      • -
      - - - -
        -
      • -

        DEPTH_ATTACHMENT

        -
        public static int DEPTH_ATTACHMENT
        -
      • -
      - - - -
        -
      • -

        STENCIL_ATTACHMENT

        -
        public static int STENCIL_ATTACHMENT
        -
      • -
      - - - -
        -
      • -

        READ_FRAMEBUFFER

        -
        public static int READ_FRAMEBUFFER
        -
      • -
      - - - -
        -
      • -

        DRAW_FRAMEBUFFER

        -
        public static int DRAW_FRAMEBUFFER
        -
      • -
      - - - -
        -
      • -

        DEPTH24_STENCIL8

        -
        public static int DEPTH24_STENCIL8
        -
      • -
      - - - -
        -
      • -

        DEPTH_COMPONENT

        -
        public static int DEPTH_COMPONENT
        -
      • -
      - - - -
        -
      • -

        DEPTH_COMPONENT16

        -
        public static int DEPTH_COMPONENT16
        -
      • -
      - - - -
        -
      • -

        DEPTH_COMPONENT24

        -
        public static int DEPTH_COMPONENT24
        -
      • -
      - - - -
        -
      • -

        DEPTH_COMPONENT32

        -
        public static int DEPTH_COMPONENT32
        -
      • -
      - - - -
        -
      • -

        STENCIL_INDEX

        -
        public static int STENCIL_INDEX
        -
      • -
      - - - -
        -
      • -

        STENCIL_INDEX1

        -
        public static int STENCIL_INDEX1
        -
      • -
      - - - -
        -
      • -

        STENCIL_INDEX4

        -
        public static int STENCIL_INDEX4
        -
      • -
      - - - -
        -
      • -

        STENCIL_INDEX8

        -
        public static int STENCIL_INDEX8
        -
      • -
      - - - -
        -
      • -

        DEPTH_STENCIL

        -
        public static int DEPTH_STENCIL
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_COMPLETE

        -
        public static int FRAMEBUFFER_COMPLETE
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_INCOMPLETE_ATTACHMENT

        -
        public static int FRAMEBUFFER_INCOMPLETE_ATTACHMENT
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT

        -
        public static int FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_INCOMPLETE_DIMENSIONS

        -
        public static int FRAMEBUFFER_INCOMPLETE_DIMENSIONS
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_INCOMPLETE_FORMATS

        -
        public static int FRAMEBUFFER_INCOMPLETE_FORMATS
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER

        -
        public static int FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_INCOMPLETE_READ_BUFFER

        -
        public static int FRAMEBUFFER_INCOMPLETE_READ_BUFFER
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_UNSUPPORTED

        -
        public static int FRAMEBUFFER_UNSUPPORTED
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE

        -
        public static int FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_ATTACHMENT_OBJECT_NAME

        -
        public static int FRAMEBUFFER_ATTACHMENT_OBJECT_NAME
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL

        -
        public static int FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE

        -
        public static int FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_WIDTH

        -
        public static int RENDERBUFFER_WIDTH
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_HEIGHT

        -
        public static int RENDERBUFFER_HEIGHT
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_RED_SIZE

        -
        public static int RENDERBUFFER_RED_SIZE
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_GREEN_SIZE

        -
        public static int RENDERBUFFER_GREEN_SIZE
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_BLUE_SIZE

        -
        public static int RENDERBUFFER_BLUE_SIZE
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_ALPHA_SIZE

        -
        public static int RENDERBUFFER_ALPHA_SIZE
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_DEPTH_SIZE

        -
        public static int RENDERBUFFER_DEPTH_SIZE
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_STENCIL_SIZE

        -
        public static int RENDERBUFFER_STENCIL_SIZE
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_INTERNAL_FORMAT

        -
        public static int RENDERBUFFER_INTERNAL_FORMAT
        -
      • -
      - - - -
        -
      • -

        MULTISAMPLE

        -
        public static int MULTISAMPLE
        -
      • -
      - - - -
        -
      • -

        POINT_SMOOTH

        -
        public static int POINT_SMOOTH
        -
      • -
      - - - -
        -
      • -

        LINE_SMOOTH

        -
        public static int LINE_SMOOTH
        -
      • -
      - - - -
        -
      • -

        POLYGON_SMOOTH

        -
        public static int POLYGON_SMOOTH
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setPrimary

        -
        public void setPrimary(boolean primary)
        -
      • -
      - - - -
        -
      • -

        requestFBOLayer

        -
        public void requestFBOLayer()
        -
      • -
      - - - -
        -
      • -

        threadIsCurrent

        -
        public boolean threadIsCurrent()
        -
      • -
      - - - -
        -
      • -

        setThread

        -
        public void setThread(Thread thread)
        -
      • -
      - - - -
        -
      • -

        drawTexture

        -
        public void drawTexture(int target,
        -                        int id,
        -                        int width,
        -                        int height,
        -                        int X0,
        -                        int Y0,
        -                        int X1,
        -                        int Y1)
        -
        Not an approved function, this will change or be removed in the future.
        -
      • -
      - - - -
        -
      • -

        drawTexture

        -
        public void drawTexture(int target,
        -                        int id,
        -                        int texW,
        -                        int texH,
        -                        int viewX,
        -                        int viewY,
        -                        int scrW,
        -                        int scrH,
        -                        int texX0,
        -                        int texY0,
        -                        int texX1,
        -                        int texY1,
        -                        int scrX0,
        -                        int scrY0,
        -                        int scrX1,
        -                        int scrY1)
        -
        Not an approved function, this will change or be removed in the future.
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public abstract void flush()
        -
      • -
      - - - -
        -
      • -

        finish

        -
        public abstract void finish()
        -
      • -
      - - - -
        -
      • -

        hint

        -
        public abstract void hint(int target,
        -                          int hint)
        -
      • -
      - - - -
        -
      • -

        enable

        -
        public abstract void enable(int value)
        -
      • -
      - - - -
        -
      • -

        disable

        -
        public abstract void disable(int value)
        -
      • -
      - - - -
        -
      • -

        getBooleanv

        -
        public abstract void getBooleanv(int value,
        -                                 IntBuffer data)
        -
      • -
      - - - -
        -
      • -

        getIntegerv

        -
        public abstract void getIntegerv(int value,
        -                                 IntBuffer data)
        -
      • -
      - - - -
        -
      • -

        getFloatv

        -
        public abstract void getFloatv(int value,
        -                               FloatBuffer data)
        -
      • -
      - - - -
        -
      • -

        isEnabled

        -
        public abstract boolean isEnabled(int value)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public abstract String getString(int name)
        -
      • -
      - - - -
        -
      • -

        getError

        -
        public abstract int getError()
        -
      • -
      - - - -
        -
      • -

        errorString

        -
        public abstract String errorString(int err)
        -
      • -
      - - - -
        -
      • -

        genBuffers

        -
        public abstract void genBuffers(int n,
        -                                IntBuffer buffers)
        -
      • -
      - - - -
        -
      • -

        deleteBuffers

        -
        public abstract void deleteBuffers(int n,
        -                                   IntBuffer buffers)
        -
      • -
      - - - -
        -
      • -

        bindBuffer

        -
        public abstract void bindBuffer(int target,
        -                                int buffer)
        -
      • -
      - - - -
        -
      • -

        bufferData

        -
        public abstract void bufferData(int target,
        -                                int size,
        -                                Buffer data,
        -                                int usage)
        -
      • -
      - - - -
        -
      • -

        bufferSubData

        -
        public abstract void bufferSubData(int target,
        -                                   int offset,
        -                                   int size,
        -                                   Buffer data)
        -
      • -
      - - - -
        -
      • -

        isBuffer

        -
        public abstract void isBuffer(int buffer)
        -
      • -
      - - - -
        -
      • -

        getBufferParameteriv

        -
        public abstract void getBufferParameteriv(int target,
        -                                          int value,
        -                                          IntBuffer data)
        -
      • -
      - - - -
        -
      • -

        mapBuffer

        -
        public abstract ByteBuffer mapBuffer(int target,
        -                                     int access)
        -
      • -
      - - - -
        -
      • -

        mapBufferRange

        -
        public abstract ByteBuffer mapBufferRange(int target,
        -                                          int offset,
        -                                          int length,
        -                                          int access)
        -
      • -
      - - - -
        -
      • -

        unmapBuffer

        -
        public abstract void unmapBuffer(int target)
        -
      • -
      - - - -
        -
      • -

        depthRangef

        -
        public abstract void depthRangef(float n,
        -                                 float f)
        -
      • -
      - - - -
        -
      • -

        viewport

        -
        public abstract void viewport(int x,
        -                              int y,
        -                              int w,
        -                              int h)
        -
      • -
      - - - -
        -
      • -

        readPixels

        -
        public void readPixels(int x,
        -                       int y,
        -                       int width,
        -                       int height,
        -                       int format,
        -                       int type,
        -                       Buffer buffer)
        -
      • -
      - - - -
        -
      • -

        vertexAttrib1f

        -
        public abstract void vertexAttrib1f(int index,
        -                                    float value)
        -
      • -
      - - - -
        -
      • -

        vertexAttrib2f

        -
        public abstract void vertexAttrib2f(int index,
        -                                    float value0,
        -                                    float value1)
        -
      • -
      - - - -
        -
      • -

        vertexAttrib3f

        -
        public abstract void vertexAttrib3f(int index,
        -                                    float value0,
        -                                    float value1,
        -                                    float value2)
        -
      • -
      - - - -
        -
      • -

        vertexAttrib4f

        -
        public abstract void vertexAttrib4f(int index,
        -                                    float value0,
        -                                    float value1,
        -                                    float value2,
        -                                    float value3)
        -
      • -
      - - - -
        -
      • -

        vertexAttrib1fv

        -
        public abstract void vertexAttrib1fv(int index,
        -                                     FloatBuffer values)
        -
      • -
      - - - -
        -
      • -

        vertexAttrib2fv

        -
        public abstract void vertexAttrib2fv(int index,
        -                                     FloatBuffer values)
        -
      • -
      - - - -
        -
      • -

        vertexAttrib3fv

        -
        public abstract void vertexAttrib3fv(int index,
        -                                     FloatBuffer values)
        -
      • -
      - - - -
        -
      • -

        vertexAttri4fv

        -
        public abstract void vertexAttri4fv(int index,
        -                                    FloatBuffer values)
        -
      • -
      - - - -
        -
      • -

        vertexAttribPointer

        -
        public abstract void vertexAttribPointer(int index,
        -                                         int size,
        -                                         int type,
        -                                         boolean normalized,
        -                                         int stride,
        -                                         int offset)
        -
      • -
      - - - -
        -
      • -

        vertexAttribPointer

        -
        public abstract void vertexAttribPointer(int index,
        -                                         int size,
        -                                         int type,
        -                                         boolean normalized,
        -                                         int stride,
        -                                         Buffer data)
        -
      • -
      - - - -
        -
      • -

        enableVertexAttribArray

        -
        public abstract void enableVertexAttribArray(int index)
        -
      • -
      - - - -
        -
      • -

        disableVertexAttribArray

        -
        public abstract void disableVertexAttribArray(int index)
        -
      • -
      - - - -
        -
      • -

        drawArrays

        -
        public abstract void drawArrays(int mode,
        -                                int first,
        -                                int count)
        -
      • -
      - - - -
        -
      • -

        drawElements

        -
        public abstract void drawElements(int mode,
        -                                  int count,
        -                                  int type,
        -                                  int offset)
        -
      • -
      - - - -
        -
      • -

        drawElements

        -
        public abstract void drawElements(int mode,
        -                                  int count,
        -                                  int type,
        -                                  Buffer indices)
        -
      • -
      - - - -
        -
      • -

        lineWidth

        -
        public abstract void lineWidth(float width)
        -
      • -
      - - - -
        -
      • -

        frontFace

        -
        public abstract void frontFace(int dir)
        -
      • -
      - - - -
        -
      • -

        cullFace

        -
        public abstract void cullFace(int mode)
        -
      • -
      - - - -
        -
      • -

        polygonOffset

        -
        public abstract void polygonOffset(float factor,
        -                                   float units)
        -
      • -
      - - - -
        -
      • -

        pixelStorei

        -
        public abstract void pixelStorei(int pname,
        -                                 int param)
        -
      • -
      - - - -
        -
      • -

        texImage2D

        -
        public abstract void texImage2D(int target,
        -                                int level,
        -                                int internalFormat,
        -                                int width,
        -                                int height,
        -                                int border,
        -                                int format,
        -                                int type,
        -                                Buffer data)
        -
      • -
      - - - -
        -
      • -

        copyTexImage2D

        -
        public abstract void copyTexImage2D(int target,
        -                                    int level,
        -                                    int internalFormat,
        -                                    int x,
        -                                    int y,
        -                                    int width,
        -                                    int height,
        -                                    int border)
        -
      • -
      - - - -
        -
      • -

        texSubImage2D

        -
        public abstract void texSubImage2D(int target,
        -                                   int level,
        -                                   int xOffset,
        -                                   int yOffset,
        -                                   int width,
        -                                   int height,
        -                                   int format,
        -                                   int type,
        -                                   Buffer data)
        -
      • -
      - - - -
        -
      • -

        copyTexSubImage2D

        -
        public abstract void copyTexSubImage2D(int target,
        -                                       int level,
        -                                       int xOffset,
        -                                       int yOffset,
        -                                       int x,
        -                                       int y,
        -                                       int width,
        -                                       int height)
        -
      • -
      - - - -
        -
      • -

        compressedTexImage2D

        -
        public abstract void compressedTexImage2D(int target,
        -                                          int level,
        -                                          int internalFormat,
        -                                          int width,
        -                                          int height,
        -                                          int border,
        -                                          int imageSize,
        -                                          Buffer data)
        -
      • -
      - - - -
        -
      • -

        compressedTexSubImage2D

        -
        public abstract void compressedTexSubImage2D(int target,
        -                                             int level,
        -                                             int xOffset,
        -                                             int yOffset,
        -                                             int width,
        -                                             int height,
        -                                             int format,
        -                                             int imageSize,
        -                                             Buffer data)
        -
      • -
      - - - -
        -
      • -

        texParameteri

        -
        public abstract void texParameteri(int target,
        -                                   int pname,
        -                                   int param)
        -
      • -
      - - - -
        -
      • -

        texParameterf

        -
        public abstract void texParameterf(int target,
        -                                   int pname,
        -                                   float param)
        -
      • -
      - - - -
        -
      • -

        texParameteriv

        -
        public abstract void texParameteriv(int target,
        -                                    int pname,
        -                                    IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        texParameterfv

        -
        public abstract void texParameterfv(int target,
        -                                    int pname,
        -                                    FloatBuffer params)
        -
      • -
      - - - -
        -
      • -

        generateMipmap

        -
        public abstract void generateMipmap(int target)
        -
      • -
      - - - -
        -
      • -

        genTextures

        -
        public abstract void genTextures(int n,
        -                                 IntBuffer textures)
        -
      • -
      - - - -
        -
      • -

        deleteTextures

        -
        public abstract void deleteTextures(int n,
        -                                    IntBuffer textures)
        -
      • -
      - - - -
        -
      • -

        getTexParameteriv

        -
        public abstract void getTexParameteriv(int target,
        -                                       int pname,
        -                                       IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        getTexParameterfv

        -
        public abstract void getTexParameterfv(int target,
        -                                       int pname,
        -                                       FloatBuffer params)
        -
      • -
      - - - -
        -
      • -

        isTexture

        -
        public abstract boolean isTexture(int texture)
        -
      • -
      - - - -
        -
      • -

        activeTexture

        -
        public void activeTexture(int texture)
        -
      • -
      - - - -
        -
      • -

        bindTexture

        -
        public void bindTexture(int target,
        -                        int texture)
        -
      • -
      - - - -
        -
      • -

        createShader

        -
        public abstract int createShader(int type)
        -
      • -
      - - - -
        -
      • -

        shaderSource

        -
        public abstract void shaderSource(int shader,
        -                                  String source)
        -
      • -
      - - - -
        -
      • -

        compileShader

        -
        public abstract void compileShader(int shader)
        -
      • -
      - - - -
        -
      • -

        releaseShaderCompiler

        -
        public abstract void releaseShaderCompiler()
        -
      • -
      - - - -
        -
      • -

        deleteShader

        -
        public abstract void deleteShader(int shader)
        -
      • -
      - - - -
        -
      • -

        shaderBinary

        -
        public abstract void shaderBinary(int count,
        -                                  IntBuffer shaders,
        -                                  int binaryFormat,
        -                                  Buffer binary,
        -                                  int length)
        -
      • -
      - - - -
        -
      • -

        createProgram

        -
        public abstract int createProgram()
        -
      • -
      - - - -
        -
      • -

        attachShader

        -
        public abstract void attachShader(int program,
        -                                  int shader)
        -
      • -
      - - - -
        -
      • -

        detachShader

        -
        public abstract void detachShader(int program,
        -                                  int shader)
        -
      • -
      - - - -
        -
      • -

        linkProgram

        -
        public abstract void linkProgram(int program)
        -
      • -
      - - - -
        -
      • -

        useProgram

        -
        public abstract void useProgram(int program)
        -
      • -
      - - - -
        -
      • -

        deleteProgram

        -
        public abstract void deleteProgram(int program)
        -
      • -
      - - - -
        -
      • -

        getActiveAttrib

        -
        public abstract String getActiveAttrib(int program,
        -                                       int index,
        -                                       IntBuffer size,
        -                                       IntBuffer type)
        -
      • -
      - - - -
        -
      • -

        getAttribLocation

        -
        public abstract int getAttribLocation(int program,
        -                                      String name)
        -
      • -
      - - - -
        -
      • -

        bindAttribLocation

        -
        public abstract void bindAttribLocation(int program,
        -                                        int index,
        -                                        String name)
        -
      • -
      - - - -
        -
      • -

        getUniformLocation

        -
        public abstract int getUniformLocation(int program,
        -                                       String name)
        -
      • -
      - - - -
        -
      • -

        getActiveUniform

        -
        public abstract String getActiveUniform(int program,
        -                                        int index,
        -                                        IntBuffer size,
        -                                        IntBuffer type)
        -
      • -
      - - - -
        -
      • -

        uniform1i

        -
        public abstract void uniform1i(int location,
        -                               int value)
        -
      • -
      - - - -
        -
      • -

        uniform2i

        -
        public abstract void uniform2i(int location,
        -                               int value0,
        -                               int value1)
        -
      • -
      - - - -
        -
      • -

        uniform3i

        -
        public abstract void uniform3i(int location,
        -                               int value0,
        -                               int value1,
        -                               int value2)
        -
      • -
      - - - -
        -
      • -

        uniform4i

        -
        public abstract void uniform4i(int location,
        -                               int value0,
        -                               int value1,
        -                               int value2,
        -                               int value3)
        -
      • -
      - - - -
        -
      • -

        uniform1f

        -
        public abstract void uniform1f(int location,
        -                               float value)
        -
      • -
      - - - -
        -
      • -

        uniform2f

        -
        public abstract void uniform2f(int location,
        -                               float value0,
        -                               float value1)
        -
      • -
      - - - -
        -
      • -

        uniform3f

        -
        public abstract void uniform3f(int location,
        -                               float value0,
        -                               float value1,
        -                               float value2)
        -
      • -
      - - - -
        -
      • -

        uniform4f

        -
        public abstract void uniform4f(int location,
        -                               float value0,
        -                               float value1,
        -                               float value2,
        -                               float value3)
        -
      • -
      - - - -
        -
      • -

        uniform1iv

        -
        public abstract void uniform1iv(int location,
        -                                int count,
        -                                IntBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniform2iv

        -
        public abstract void uniform2iv(int location,
        -                                int count,
        -                                IntBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniform3iv

        -
        public abstract void uniform3iv(int location,
        -                                int count,
        -                                IntBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniform4iv

        -
        public abstract void uniform4iv(int location,
        -                                int count,
        -                                IntBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniform1fv

        -
        public abstract void uniform1fv(int location,
        -                                int count,
        -                                FloatBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniform2fv

        -
        public abstract void uniform2fv(int location,
        -                                int count,
        -                                FloatBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniform3fv

        -
        public abstract void uniform3fv(int location,
        -                                int count,
        -                                FloatBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniform4fv

        -
        public abstract void uniform4fv(int location,
        -                                int count,
        -                                FloatBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniformMatrix2fv

        -
        public abstract void uniformMatrix2fv(int location,
        -                                      int count,
        -                                      boolean transpose,
        -                                      FloatBuffer mat)
        -
      • -
      - - - -
        -
      • -

        uniformMatrix3fv

        -
        public abstract void uniformMatrix3fv(int location,
        -                                      int count,
        -                                      boolean transpose,
        -                                      FloatBuffer mat)
        -
      • -
      - - - -
        -
      • -

        uniformMatrix4fv

        -
        public abstract void uniformMatrix4fv(int location,
        -                                      int count,
        -                                      boolean transpose,
        -                                      FloatBuffer mat)
        -
      • -
      - - - -
        -
      • -

        validateProgram

        -
        public abstract void validateProgram(int program)
        -
      • -
      - - - -
        -
      • -

        isShader

        -
        public abstract boolean isShader(int shader)
        -
      • -
      - - - -
        -
      • -

        getShaderiv

        -
        public abstract void getShaderiv(int shader,
        -                                 int pname,
        -                                 IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        getAttachedShaders

        -
        public abstract void getAttachedShaders(int program,
        -                                        int maxCount,
        -                                        IntBuffer count,
        -                                        IntBuffer shaders)
        -
      • -
      - - - -
        -
      • -

        getShaderInfoLog

        -
        public abstract String getShaderInfoLog(int shader)
        -
      • -
      - - - -
        -
      • -

        getShaderSource

        -
        public abstract String getShaderSource(int shader)
        -
      • -
      - - - -
        -
      • -

        getShaderPrecisionFormat

        -
        public abstract void getShaderPrecisionFormat(int shaderType,
        -                                              int precisionType,
        -                                              IntBuffer range,
        -                                              IntBuffer precision)
        -
      • -
      - - - -
        -
      • -

        getVertexAttribfv

        -
        public abstract void getVertexAttribfv(int index,
        -                                       int pname,
        -                                       FloatBuffer params)
        -
      • -
      - - - -
        -
      • -

        getVertexAttribiv

        -
        public abstract void getVertexAttribiv(int index,
        -                                       int pname,
        -                                       IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        getVertexAttribPointerv

        -
        public abstract void getVertexAttribPointerv(int index,
        -                                             int pname,
        -                                             ByteBuffer data)
        -
      • -
      - - - -
        -
      • -

        getUniformfv

        -
        public abstract void getUniformfv(int program,
        -                                  int location,
        -                                  FloatBuffer params)
        -
      • -
      - - - -
        -
      • -

        getUniformiv

        -
        public abstract void getUniformiv(int program,
        -                                  int location,
        -                                  IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        isProgram

        -
        public abstract boolean isProgram(int program)
        -
      • -
      - - - -
        -
      • -

        getProgramiv

        -
        public abstract void getProgramiv(int program,
        -                                  int pname,
        -                                  IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        getProgramInfoLog

        -
        public abstract String getProgramInfoLog(int program)
        -
      • -
      - - - -
        -
      • -

        scissor

        -
        public abstract void scissor(int x,
        -                             int y,
        -                             int w,
        -                             int h)
        -
      • -
      - - - -
        -
      • -

        sampleCoverage

        -
        public abstract void sampleCoverage(float value,
        -                                    boolean invert)
        -
      • -
      - - - -
        -
      • -

        stencilFunc

        -
        public abstract void stencilFunc(int func,
        -                                 int ref,
        -                                 int mask)
        -
      • -
      - - - -
        -
      • -

        stencilFuncSeparate

        -
        public abstract void stencilFuncSeparate(int face,
        -                                         int func,
        -                                         int ref,
        -                                         int mask)
        -
      • -
      - - - -
        -
      • -

        stencilOp

        -
        public abstract void stencilOp(int sfail,
        -                               int dpfail,
        -                               int dppass)
        -
      • -
      - - - -
        -
      • -

        stencilOpSeparate

        -
        public abstract void stencilOpSeparate(int face,
        -                                       int sfail,
        -                                       int dpfail,
        -                                       int dppass)
        -
      • -
      - - - -
        -
      • -

        depthFunc

        -
        public abstract void depthFunc(int func)
        -
      • -
      - - - -
        -
      • -

        blendEquation

        -
        public abstract void blendEquation(int mode)
        -
      • -
      - - - -
        -
      • -

        blendEquationSeparate

        -
        public abstract void blendEquationSeparate(int modeRGB,
        -                                           int modeAlpha)
        -
      • -
      - - - -
        -
      • -

        blendFunc

        -
        public abstract void blendFunc(int src,
        -                               int dst)
        -
      • -
      - - - -
        -
      • -

        blendFuncSeparate

        -
        public abstract void blendFuncSeparate(int srcRGB,
        -                                       int dstRGB,
        -                                       int srcAlpha,
        -                                       int dstAlpha)
        -
      • -
      - - - -
        -
      • -

        blendColor

        -
        public abstract void blendColor(float red,
        -                                float green,
        -                                float blue,
        -                                float alpha)
        -
      • -
      - - - -
        -
      • -

        alphaFunc

        -
        public abstract void alphaFunc(int func,
        -                               float ref)
        -
      • -
      - - - -
        -
      • -

        colorMask

        -
        public abstract void colorMask(boolean r,
        -                               boolean g,
        -                               boolean b,
        -                               boolean a)
        -
      • -
      - - - -
        -
      • -

        depthMask

        -
        public abstract void depthMask(boolean mask)
        -
      • -
      - - - -
        -
      • -

        stencilMask

        -
        public abstract void stencilMask(int mask)
        -
      • -
      - - - -
        -
      • -

        stencilMaskSeparate

        -
        public abstract void stencilMaskSeparate(int face,
        -                                         int mask)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public abstract void clear(int buf)
        -
      • -
      - - - -
        -
      • -

        clearColor

        -
        public abstract void clearColor(float r,
        -                                float g,
        -                                float b,
        -                                float a)
        -
      • -
      - - - -
        -
      • -

        clearDepth

        -
        public abstract void clearDepth(float d)
        -
      • -
      - - - -
        -
      • -

        clearStencil

        -
        public abstract void clearStencil(int s)
        -
      • -
      - - - -
        -
      • -

        bindFramebuffer

        -
        public void bindFramebuffer(int target,
        -                            int framebuffer)
        -
      • -
      - - - -
        -
      • -

        deleteFramebuffers

        -
        public abstract void deleteFramebuffers(int n,
        -                                        IntBuffer framebuffers)
        -
      • -
      - - - -
        -
      • -

        genFramebuffers

        -
        public abstract void genFramebuffers(int n,
        -                                     IntBuffer framebuffers)
        -
      • -
      - - - -
        -
      • -

        bindRenderbuffer

        -
        public abstract void bindRenderbuffer(int target,
        -                                      int renderbuffer)
        -
      • -
      - - - -
        -
      • -

        deleteRenderbuffers

        -
        public abstract void deleteRenderbuffers(int n,
        -                                         IntBuffer renderbuffers)
        -
      • -
      - - - -
        -
      • -

        genRenderbuffers

        -
        public abstract void genRenderbuffers(int n,
        -                                      IntBuffer renderbuffers)
        -
      • -
      - - - -
        -
      • -

        renderbufferStorage

        -
        public abstract void renderbufferStorage(int target,
        -                                         int internalFormat,
        -                                         int width,
        -                                         int height)
        -
      • -
      - - - -
        -
      • -

        framebufferRenderbuffer

        -
        public abstract void framebufferRenderbuffer(int target,
        -                                             int attachment,
        -                                             int rendbuferfTarget,
        -                                             int renderbuffer)
        -
      • -
      - - - -
        -
      • -

        framebufferTexture2D

        -
        public abstract void framebufferTexture2D(int target,
        -                                          int attachment,
        -                                          int texTarget,
        -                                          int texture,
        -                                          int level)
        -
      • -
      - - - -
        -
      • -

        checkFramebufferStatus

        -
        public abstract int checkFramebufferStatus(int target)
        -
      • -
      - - - -
        -
      • -

        isFramebuffer

        -
        public abstract boolean isFramebuffer(int framebuffer)
        -
      • -
      - - - -
        -
      • -

        getFramebufferAttachmentParameteriv

        -
        public abstract void getFramebufferAttachmentParameteriv(int target,
        -                                                         int attachment,
        -                                                         int pname,
        -                                                         IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        isRenderbuffer

        -
        public abstract boolean isRenderbuffer(int renderbuffer)
        -
      • -
      - - - -
        -
      • -

        getRenderbufferParameteriv

        -
        public abstract void getRenderbufferParameteriv(int target,
        -                                                int pname,
        -                                                IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        blitFramebuffer

        -
        public abstract void blitFramebuffer(int srcX0,
        -                                     int srcY0,
        -                                     int srcX1,
        -                                     int srcY1,
        -                                     int dstX0,
        -                                     int dstY0,
        -                                     int dstX1,
        -                                     int dstY1,
        -                                     int mask,
        -                                     int filter)
        -
      • -
      - - - -
        -
      • -

        renderbufferStorageMultisample

        -
        public abstract void renderbufferStorageMultisample(int target,
        -                                                    int samples,
        -                                                    int format,
        -                                                    int width,
        -                                                    int height)
        -
      • -
      - - - -
        -
      • -

        readBuffer

        -
        public abstract void readBuffer(int buf)
        -
      • -
      - - - -
        -
      • -

        drawBuffer

        -
        public abstract void drawBuffer(int buf)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/opengl/PGraphics2D.html b/build/javadoc/core/processing/opengl/PGraphics2D.html deleted file mode 100644 index e7cd61814f..0000000000 --- a/build/javadoc/core/processing/opengl/PGraphics2D.html +++ /dev/null @@ -1,2238 +0,0 @@ - - - - - -PGraphics2D - - - - - - - - - - - -
-
processing.opengl
-

Class PGraphics2D

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PGraphics2D

        -
        public PGraphics2D()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        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 3D drawing. Defaults to false.
        -
        -
        Overrides:
        -
        is3D in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        hint

        -
        public void hint(int which)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from hint.xml ) - - Set various hints and hacks for the renderer. This is used to handle - obscure rendering features that cannot be implemented in a consistent - manner across renderers. Many options will often graduate to standard - features instead of hints over time. -

        - hint(ENABLE_OPENGL_4X_SMOOTH) - Enable 4x anti-aliasing for P3D. This - can help force anti-aliasing if it has not been enabled by the user. On - some graphics cards, this can also be set by the graphics driver's - control panel, however not all cards make this available. This hint must - be called immediately after the size() command because it resets the - renderer, obliterating any settings and anything drawn (and like size(), - re-running the code that came before it again). -

        - hint(DISABLE_OPENGL_2X_SMOOTH) - In Processing 1.0, Processing always - enables 2x smoothing when the P3D renderer is used. This hint disables - the default 2x smoothing and returns the smoothing behavior found in - earlier releases, where smooth() and noSmooth() could be used to enable - and disable smoothing, though the quality was inferior. -

        - hint(ENABLE_NATIVE_FONTS) - Use the native version fonts when they are - installed, rather than the bitmapped version from a .vlw file. This is - useful with the default (or JAVA2D) renderer setting, as it will improve - font rendering speed. This is not enabled by default, because it can be - misleading while testing because the type will look great on your - machine (because you have the font installed) but lousy on others' - machines if the identical font is unavailable. This option can only be - set per-sketch, and must be called before any use of textFont(). -

        - hint(DISABLE_DEPTH_TEST) - Disable the zbuffer, allowing you to draw on - top of everything at will. When depth testing is disabled, items will be - drawn to the screen sequentially, like a painting. This hint is most - often used to draw in 3D, then draw in 2D on top of it (for instance, to - draw GUI controls in 2D on top of a 3D interface). Starting in release - 0149, this will also clear the depth buffer. Restore the default with - hint(ENABLE_DEPTH_TEST), but note that with the depth buffer cleared, - any 3D drawing that happens later in draw() will ignore existing shapes - on the screen. -

        - hint(ENABLE_DEPTH_SORT) - Enable primitive z-sorting of triangles and - lines in P3D and OPENGL. This can slow performance considerably, and the - algorithm is not yet perfect. Restore the default with hint(DISABLE_DEPTH_SORT). -

        - hint(DISABLE_OPENGL_ERROR_REPORT) - Speeds up the P3D renderer setting - by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT). -

        - As of release 0149, unhint() has been removed in favor of adding - additional ENABLE/DISABLE constants to reset the default behavior. This - prevents the double negatives, and also reinforces which hints can be - enabled or disabled. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        hint in class PGraphicsOpenGL
        -
        Parameters:
        -
        which - name of the hint to be enabled or disabled
        -
        See Also:
        -
        PGraphics, -PApplet.createGraphics(int, int, String, String), -PApplet.size(int, int)
        -
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho()
        -
        Description copied from class: PGraphicsOpenGL
        -
        Calls ortho() with the proper parameters for Processing's standard - orthographic projection.
        -
        -
        Overrides:
        -
        ortho in class PGraphicsOpenGL
        -
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho(float left,
        -                  float right,
        -                  float bottom,
        -                  float top)
        -
        Description copied from class: PGraphicsOpenGL
        -
        Calls ortho() with the specified size of the viewing volume along - the X and Z directions.
        -
        -
        Overrides:
        -
        ortho in class PGraphicsOpenGL
        -
        Parameters:
        -
        left - left plane of the clipping volume
        -
        right - right plane of the clipping volume
        -
        bottom - bottom plane of the clipping volume
        -
        top - top plane of the clipping volume
        -
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho(float left,
        -                  float right,
        -                  float bottom,
        -                  float top,
        -                  float near,
        -                  float far)
        -
        Description copied from class: PGraphicsOpenGL
        -
        Sets an orthographic projection.
        -
        -
        Overrides:
        -
        ortho in class PGraphicsOpenGL
        -
        near - maximum distance from the origin to the viewer
        -
        far - maximum distance from the origin away from the viewer
        -
        -
      • -
      - - - -
        -
      • -

        perspective

        -
        public void perspective()
        -
        Description copied from class: PGraphicsOpenGL
        -
        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 PGraphicsOpenGL
        -
        -
      • -
      - - - -
        -
      • -

        perspective

        -
        public void perspective(float fov,
        -                        float aspect,
        -                        float zNear,
        -                        float zFar)
        -
        Description copied from class: PGraphicsOpenGL
        -
        Similar to gluPerspective(). Implementation based on Mesa's glu.c
        -
        -
        Overrides:
        -
        perspective in class PGraphicsOpenGL
        -
        Parameters:
        -
        fov - field-of-view angle (in radians) for vertical direction
        -
        aspect - ratio of width to height
        -
        zNear - z-position of nearest clipping plane
        -
        zFar - z-position of farthest clipping plane
        -
        -
      • -
      - - - -
        -
      • -

        frustum

        -
        public void frustum(float left,
        -                    float right,
        -                    float bottom,
        -                    float top,
        -                    float znear,
        -                    float zfar)
        -
        Description copied from class: PGraphicsOpenGL
        -
        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 PGraphicsOpenGL
        -
        Parameters:
        -
        left - left coordinate of the clipping plane
        -
        right - right coordinate of the clipping plane
        -
        bottom - bottom coordinate of the clipping plane
        -
        top - top coordinate of the clipping plane
        -
        znear - near component of the clipping plane; must be greater than zero
        -
        zfar - far component of the clipping plane; must be greater than the near value
        -
        See Also:
        -
        PGraphics.camera(float, float, float, float, float, float, float, float, float), -PGraphics.endCamera(), -PGraphics.perspective(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        beginCamera

        -
        public void beginCamera()
        -
        Description copied from class: PGraphicsOpenGL
        -
        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 contains - the values of the modelview matrix immediatly after the latter was - initialized with ortho() or camera(), or the modelview matrix as result of - the operations applied between beginCamera()/endCamera(). -

        - 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 in - 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 PGraphicsOpenGL
        -
        See Also:
        -
        PGraphics.camera(), -PGraphics.endCamera(), -PGraphics.applyMatrix(PMatrix), -PGraphics.resetMatrix(), -PGraphics.translate(float, float, float), -PGraphics.scale(float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        camera

        -
        public void camera()
        -
        Description copied from class: PGraphicsOpenGL
        -
        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. -

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

        -
        -
        Overrides:
        -
        camera in class PGraphicsOpenGL
        -
        See Also:
        -
        PGraphics.endCamera(), -PGraphics.frustum(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        camera

        -
        public void camera(float eyeX,
        -                   float eyeY,
        -                   float eyeZ,
        -                   float centerX,
        -                   float centerY,
        -                   float centerZ,
        -                   float upX,
        -                   float upY,
        -                   float upZ)
        -
        Description copied from class: PGraphicsOpenGL
        -
        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 PGraphicsOpenGL
        -
        Parameters:
        -
        eyeX - x-coordinate for the eye
        -
        eyeY - y-coordinate for the eye
        -
        eyeZ - z-coordinate for the eye
        -
        centerX - x-coordinate for the center of the scene
        -
        centerY - y-coordinate for the center of the scene
        -
        centerZ - z-coordinate for the center of the scene
        -
        upX - usually 0.0, 1.0, or -1.0
        -
        upY - usually 0.0, 1.0, or -1.0
        -
        upZ - usually 0.0, 1.0, or -1.0
        -
        -
      • -
      - - - - - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float x,
        -                  float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shape.xml ) - - Displays shapes to the screen. The shapes must be in the sketch's "data" - directory to load correctly. Select "Add file..." from the "Sketch" menu - to add the shape. Processing currently works with SVG shapes only. The - sh parameter specifies the shape to display and the x and - y parameters define the location of the shape from its upper-left - corner. The shape is displayed at its original size unless the - width and height parameters specify a different size. The - shapeMode() function changes the way the parameters work. A call - to shapeMode(CORNERS), for example, will change the width and - height parameters to define the x and y values of the opposite corner of - the shape. -

        - Note complex shapes may draw awkwardly with P3D. This renderer does not - yet support shapes that have holes or complicated breaks. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shape in class PGraphics
        -
        Parameters:
        -
        shape - the shape to display
        -
        x - x-coordinate of the shape
        -
        y - y-coordinate of the shape
        -
        See Also:
        -
        PShape, -PApplet.loadShape(String), -Convenience method to draw at a particular location.
        -
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float a,
        -                  float b,
        -                  float c,
        -                  float d)
        -
        -
        Overrides:
        -
        shape in class PGraphics
        -
        a - x-coordinate of the shape
        -
        b - y-coordinate of the shape
        -
        c - width to display the shape
        -
        d - height to display the shape
        -
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float x,
        -                  float y,
        -                  float z)
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float x,
        -                  float y,
        -                  float z,
        -                  float c,
        -                  float d,
        -                  float e)
        -
      • -
      - - - -
        -
      • -

        bezierVertex

        -
        public void bezierVertex(float x2,
        -                         float y2,
        -                         float z2,
        -                         float x3,
        -                         float y3,
        -                         float z3,
        -                         float x4,
        -                         float y4,
        -                         float z4)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves. Each call to - bezierVertex() defines the position of two control points and one - anchor point of a Bezier curve, adding a new segment to a line or shape. - The first time bezierVertex() is used within a - beginShape() call, it must be prefaced with a call to - vertex() to set the first anchor point. This function must be - used between beginShape() and endShape() and only when - there is no MODE parameter specified to beginShape(). Using the - 3D version requires rendering with P3D (see the Environment reference - for more information). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        bezierVertex in class PGraphicsOpenGL
        -
        Parameters:
        -
        x2 - the x-coordinate of the 1st control point
        -
        y2 - the y-coordinate of the 1st control point
        -
        z2 - the z-coordinate of the 1st control point
        -
        x3 - the x-coordinate of the 2nd control point
        -
        y3 - the y-coordinate of the 2nd control point
        -
        z3 - the z-coordinate of the 2nd control point
        -
        x4 - the x-coordinate of the anchor point
        -
        y4 - the y-coordinate of the anchor point
        -
        z4 - the z-coordinate of the anchor point
        -
        See Also:
        -
        PGraphics.curveVertex(float, float, float), -PGraphics.vertex(float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float x2,
        -                            float y2,
        -                            float z2,
        -                            float x4,
        -                            float y4,
        -                            float z4)
        -
        -
        Overrides:
        -
        quadraticVertex in class PGraphicsOpenGL
        -
        z2 - the z-coordinate of the control point
        -
        z4 - the z-coordinate of the anchor point
        -
        -
      • -
      - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
        -
        Overrides:
        -
        curveVertex in class PGraphicsOpenGL
        -
        z - the z-coordinate of the vertex
        -
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float w,
        -                float h,
        -                float d)
        -
        -
        Overrides:
        -
        box in class PGraphicsOpenGL
        -
        Parameters:
        -
        w - dimension of the box in the x-dimension
        -
        h - dimension of the box in the y-dimension
        -
        d - dimension of the box in the z-dimension
        -
        -
      • -
      - - - -
        -
      • -

        sphere

        -
        public void sphere(float r)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles. - - ( end auto-generated ) - -

        Advanced

        -

        - 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 PGraphicsOpenGL
        -
        Parameters:
        -
        r - the radius of the sphere
        -
        See Also:
        -
        PGraphics.sphereDetail(int)
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float z)
        -
        -
        Overrides:
        -
        vertex in class PGraphicsOpenGL
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float z,
        -                   float u,
        -                   float v)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices. - vertex() is used to specify the vertex coordinates for points, - lines, triangles, quads, and polygons and is used exclusively within the - beginShape() and endShape() function.
        -
        - Drawing a vertex in 3D using the z parameter requires the P3D - parameter in combination with size as shown in the above example.
        -
        - This function is also used to map a texture onto the geometry. The - texture() function declares the texture to apply to the geometry - and the u and v coordinates set define the mapping of this - texture to the form. By default, the coordinates used for u and - v are specified in relation to the image's size in pixels, but - this relation can be changed with textureMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        vertex in class PGraphicsOpenGL
        -
        Parameters:
        -
        x - x-coordinate of the vertex
        -
        y - y-coordinate of the vertex
        -
        z - z-coordinate of the vertex
        -
        u - horizontal coordinate for the texture mapping
        -
        v - vertical coordinate for the texture mapping
        -
        See Also:
        -
        PGraphics.beginShape(int), -PGraphics.endShape(int), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.texture(PImage)
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float tx,
        -                      float ty,
        -                      float tz)
        -
        -
        Overrides:
        -
        translate in class PGraphicsOpenGL
        -
        tz - forward/backward translation
        -
        -
      • -
      - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateX(PI/2) and then rotateX(PI/2) is the same - as rotateX(PI). If rotateX() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the example above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateX in class PGraphicsOpenGL
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateY(PI/2) and then rotateY(PI/2) is the same - as rotateY(PI). If rotateY() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateY in class PGraphicsOpenGL
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateZ(PI/2) and then rotateZ(PI/2) is the same - as rotateZ(PI). If rotateZ() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateZ in class PGraphicsOpenGL
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle,
        -                   float vx,
        -                   float vy,
        -                   float vz)
        -
        Description copied from class: PGraphicsOpenGL
        -
        Rotate around an arbitrary vector, similar to glRotate(), except that it - takes radians (instead of degrees).
        -
        -
        Overrides:
        -
        rotate in class PGraphicsOpenGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        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: PGraphicsOpenGL
        -
        Apply a 4x4 transformation matrix to the modelview stack.
        -
        -
        Overrides:
        -
        applyMatrix in class PGraphicsOpenGL
        -
        n03 - numbers which define the 4x4 matrix to be multiplied
        -
        n13 - numbers which define the 4x4 matrix to be multiplied
        -
        n20 - numbers which define the 4x4 matrix to be multiplied
        -
        n21 - numbers which define the 4x4 matrix to be multiplied
        -
        n22 - numbers which define the 4x4 matrix to be multiplied
        -
        n23 - numbers which define the 4x4 matrix to be multiplied
        -
        n30 - numbers which define the 4x4 matrix to be multiplied
        -
        n31 - numbers which define the 4x4 matrix to be multiplied
        -
        n32 - numbers which define the 4x4 matrix to be multiplied
        -
        n33 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float sx,
        -                  float sy,
        -                  float sz)
        -
        Description copied from class: PGraphicsOpenGL
        -
        Scale in three dimensions.
        -
        -
        Overrides:
        -
        scale in class PGraphicsOpenGL
        -
        sz - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenX in class PGraphicsOpenGL
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenY in class PGraphicsOpenGL
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenZ

        -
        public float screenZ(float x,
        -                     float y,
        -                     float z)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenZ in class PGraphicsOpenGL
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenY(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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 PGraphicsOpenGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        lights

        -
        public void lights()
        -
        Description copied from class: PGraphicsOpenGL
        -
        Sets up an ambient and directional light using OpenGL. API taken from - PGraphics3D. - -
        - 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 PGraphicsOpenGL
        -
        See Also:
        -
        PGraphics.ambientLight(float, float, float, float, float, float), -PGraphics.directionalLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float), -PGraphics.noLights()
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        ambientLight

        -
        public void ambientLight(float red,
        -                         float green,
        -                         float blue,
        -                         float x,
        -                         float y,
        -                         float z)
        -
        Description copied from class: PGraphicsOpenGL
        -
        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 PGraphicsOpenGL
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        -
      • -
      - - - -
        -
      • -

        directionalLight

        -
        public void directionalLight(float red,
        -                             float green,
        -                             float blue,
        -                             float nx,
        -                             float ny,
        -                             float nz)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from directionalLight.xml ) - - Adds a directional light. Directional light comes from one direction and - is stronger when hitting a surface squarely and weaker if it hits at a a - gentle angle. After hitting a surface, a directional lights scatters in - all directions. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The nx, ny, and nz parameters specify the - direction the light is facing. For example, setting ny to -1 will - cause the geometry to be lit from below (the light is facing directly upward). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        directionalLight in class PGraphicsOpenGL
        -
        Parameters:
        -
        red - red or hue value (depending on current color mode)
        -
        green - green or saturation value (depending on current color mode)
        -
        blue - blue or brightness value (depending on current color mode)
        -
        nx - direction along the x-axis
        -
        ny - direction along the y-axis
        -
        nz - direction along the z-axis
        -
        See Also:
        -
        PGraphics.lights(), -PGraphics.ambientLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        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)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from spotLight.xml ) - - Adds a spot light. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The x, y, and z parameters specify the - position of the light and nx, ny, nz specify the - direction or light. The angle parameter affects angle of the - spotlight cone. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        spotLight in class PGraphicsOpenGL
        -
        Parameters:
        -
        red - red or hue value (depending on current color mode)
        -
        green - green or saturation value (depending on current color mode)
        -
        blue - blue or brightness value (depending on current color mode)
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        nx - direction along the x axis
        -
        ny - direction along the y axis
        -
        nz - direction along the z axis
        -
        angle - angle of the spotlight cone
        -
        concentration - exponent determining the center bias of the cone
        -
        See Also:
        -
        PGraphics.lights(), -PGraphics.directionalLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.ambientLight(float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/opengl/PGraphics3D.html b/build/javadoc/core/processing/opengl/PGraphics3D.html deleted file mode 100644 index 9274bc2927..0000000000 --- a/build/javadoc/core/processing/opengl/PGraphics3D.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - -PGraphics3D - - - - - - - - - - - -
-
processing.opengl
-

Class PGraphics3D

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PGraphics3D

        -
        public PGraphics3D()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        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 3D drawing. Defaults to false.
        -
        -
        Overrides:
        -
        is3D in class PGraphics
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/opengl/PGraphicsOpenGL.html b/build/javadoc/core/processing/opengl/PGraphicsOpenGL.html deleted file mode 100644 index 37d840ea57..0000000000 --- a/build/javadoc/core/processing/opengl/PGraphicsOpenGL.html +++ /dev/null @@ -1,5795 +0,0 @@ - - - - - -PGraphicsOpenGL - - - - - - - - - - - -
-
processing.opengl
-

Class PGraphicsOpenGL

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        pgl

        -
        public PGL pgl
        -
        Interface between Processing and OpenGL
        -
      • -
      - - - -
        -
      • -

        initialized

        -
        public boolean initialized
        -
        Whether the PGraphics object is ready to render or not.
        -
      • -
      - - - -
        -
      • -

        glPolyVertex

        -
        public int glPolyVertex
        -
      • -
      - - - -
        -
      • -

        glPolyColor

        -
        public int glPolyColor
        -
      • -
      - - - -
        -
      • -

        glPolyNormal

        -
        public int glPolyNormal
        -
      • -
      - - - -
        -
      • -

        glPolyTexcoord

        -
        public int glPolyTexcoord
        -
      • -
      - - - -
        -
      • -

        glPolyAmbient

        -
        public int glPolyAmbient
        -
      • -
      - - - -
        -
      • -

        glPolySpecular

        -
        public int glPolySpecular
        -
      • -
      - - - -
        -
      • -

        glPolyEmissive

        -
        public int glPolyEmissive
        -
      • -
      - - - -
        -
      • -

        glPolyShininess

        -
        public int glPolyShininess
        -
      • -
      - - - -
        -
      • -

        glPolyIndex

        -
        public int glPolyIndex
        -
      • -
      - - - -
        -
      • -

        glLineVertex

        -
        public int glLineVertex
        -
      • -
      - - - -
        -
      • -

        glLineColor

        -
        public int glLineColor
        -
      • -
      - - - -
        -
      • -

        glLineAttrib

        -
        public int glLineAttrib
        -
      • -
      - - - -
        -
      • -

        glLineIndex

        -
        public int glLineIndex
        -
      • -
      - - - -
        -
      • -

        glPointVertex

        -
        public int glPointVertex
        -
      • -
      - - - -
        -
      • -

        glPointColor

        -
        public int glPointColor
        -
      • -
      - - - -
        -
      • -

        glPointAttrib

        -
        public int glPointAttrib
        -
      • -
      - - - -
        -
      • -

        glPointIndex

        -
        public int glPointIndex
        -
      • -
      - - - -
        -
      • -

        npotTexSupported

        -
        public static boolean npotTexSupported
        -
        Extensions used by Processing
        -
      • -
      - - - -
        -
      • -

        autoMipmapGenSupported

        -
        public static boolean autoMipmapGenSupported
        -
      • -
      - - - -
        -
      • -

        fboMultisampleSupported

        -
        public static boolean fboMultisampleSupported
        -
      • -
      - - - -
        -
      • -

        packedDepthStencilSupported

        -
        public static boolean packedDepthStencilSupported
        -
      • -
      - - - -
        -
      • -

        anisoSamplingSupported

        -
        public static boolean anisoSamplingSupported
        -
      • -
      - - - -
        -
      • -

        blendEqSupported

        -
        public static boolean blendEqSupported
        -
      • -
      - - - -
        -
      • -

        maxTextureSize

        -
        public static int maxTextureSize
        -
        Some hardware limits
        -
      • -
      - - - -
        -
      • -

        maxSamples

        -
        public static int maxSamples
        -
      • -
      - - - -
        -
      • -

        maxAnisoAmount

        -
        public static float maxAnisoAmount
        -
      • -
      - - - -
        -
      • -

        depthBits

        -
        public static int depthBits
        -
      • -
      - - - -
        -
      • -

        stencilBits

        -
        public static int stencilBits
        -
      • -
      - - - -
        -
      • -

        OPENGL_VENDOR

        -
        public static String OPENGL_VENDOR
        -
        OpenGL information strings
        -
      • -
      - - - -
        -
      • -

        OPENGL_RENDERER

        -
        public static String OPENGL_RENDERER
        -
      • -
      - - - -
        -
      • -

        OPENGL_VERSION

        -
        public static String OPENGL_VERSION
        -
      • -
      - - - -
        -
      • -

        OPENGL_EXTENSIONS

        -
        public static String OPENGL_EXTENSIONS
        -
      • -
      - - - -
        -
      • -

        GLSL_VERSION

        -
        public static String GLSL_VERSION
        -
      • -
      - - - -
        -
      • -

        cameraFOV

        -
        public float cameraFOV
        -
        Camera field of view.
        -
      • -
      - - - -
        -
      • -

        cameraX

        -
        public float cameraX
        -
        Default position of the camera.
        -
      • -
      - - - -
        -
      • -

        cameraY

        -
        public float cameraY
        -
        Default position of the camera.
        -
      • -
      - - - -
        -
      • -

        cameraZ

        -
        public float cameraZ
        -
        Default position of the camera.
        -
      • -
      - - - -
        -
      • -

        cameraNear

        -
        public float cameraNear
        -
        Distance of the near and far planes.
        -
      • -
      - - - -
        -
      • -

        cameraFar

        -
        public float cameraFar
        -
        Distance of the near and far planes.
        -
      • -
      - - - -
        -
      • -

        cameraAspect

        -
        public float cameraAspect
        -
        Aspect ratio of camera's view.
        -
      • -
      - - - -
        -
      • -

        projection

        -
        public PMatrix3D projection
        -
      • -
      - - - - - - - -
        -
      • -

        cameraInv

        -
        public PMatrix3D cameraInv
        -
      • -
      - - - -
        -
      • -

        modelview

        -
        public PMatrix3D modelview
        -
      • -
      - - - -
        -
      • -

        modelviewInv

        -
        public PMatrix3D modelviewInv
        -
      • -
      - - - -
        -
      • -

        projmodelview

        -
        public PMatrix3D projmodelview
        -
      • -
      - - - -
        -
      • -

        lights

        -
        public boolean lights
        -
      • -
      - - - -
        -
      • -

        lightCount

        -
        public int lightCount
        -
      • -
      - - - -
        -
      • -

        lightType

        -
        public int[] lightType
        -
        Light types
        -
      • -
      - - - -
        -
      • -

        lightPosition

        -
        public float[] lightPosition
        -
        Light positions
        -
      • -
      - - - -
        -
      • -

        lightNormal

        -
        public float[] lightNormal
        -
        Light direction (normalized vector)
        -
      • -
      - - - -
        -
      • -

        lightAmbient

        -
        public float[] lightAmbient
        -
        Ambient colors for lights.
        -
      • -
      - - - -
        -
      • -

        lightDiffuse

        -
        public float[] lightDiffuse
        -
        Diffuse colors for lights.
        -
      • -
      - - - -
        -
      • -

        lightSpecular

        -
        public float[] lightSpecular
        -
        Specular colors for lights. Internally these are stored as numbers between - 0 and 1.
        -
      • -
      - - - -
        -
      • -

        lightFalloffCoefficients

        -
        public float[] lightFalloffCoefficients
        -
        Light falloff
        -
      • -
      - - - -
        -
      • -

        lightSpotParameters

        -
        public float[] lightSpotParameters
        -
        Light spot parameters: Cosine of light spot angle - and concentration
        -
      • -
      - - - -
        -
      • -

        currentLightSpecular

        -
        public float[] currentLightSpecular
        -
        Current specular color for lighting
        -
      • -
      - - - -
        -
      • -

        currentLightFalloffConstant

        -
        public float currentLightFalloffConstant
        -
        Current light falloff
        -
      • -
      - - - -
        -
      • -

        currentLightFalloffLinear

        -
        public float currentLightFalloffLinear
        -
      • -
      - - - -
        -
      • -

        currentLightFalloffQuadratic

        -
        public float currentLightFalloffQuadratic
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PGraphicsOpenGL

        -
        public PGraphicsOpenGL()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setPrimary

        -
        public void setPrimary(boolean primary)
        -
        Description copied from class: PGraphics
        -
        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.
        -
        -
        Overrides:
        -
        setPrimary in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        setSize

        -
        public void setSize(int iwidth,
        -                    int iheight)
        -
        Description copied from class: PGraphics
        -
        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: this is ignored by the Methods task 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.
        -
        -
        Overrides:
        -
        setSize 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
        -
        -
      • -
      - - - - - - - -
        -
      • -

        setCache

        -
        public void setCache(PImage image,
        -                     Object storage)
        -
        Description copied from class: PGraphics
        -
        Store data of some kind for the 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.
        -
        -
        Overrides:
        -
        setCache in class PGraphics
        -
        storage - The metadata required by the renderer
        -
        -
      • -
      - - - -
        -
      • -

        getCache

        -
        public Object getCache(PImage image)
        -
        Description copied from class: PGraphics
        -
        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.
        -
        -
        Overrides:
        -
        getCache in class PGraphics
        -
        Returns:
        -
        metadata stored for the specified renderer
        -
        -
      • -
      - - - -
        -
      • -

        removeCache

        -
        public void removeCache(PImage image)
        -
        Description copied from class: PGraphics
        -
        Remove information associated with this renderer from the cache, if any.
        -
        -
        Overrides:
        -
        removeCache in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        getPixelScale

        -
        public float getPixelScale()
        -
      • -
      - - - -
        -
      • -

        beginDraw

        -
        public void beginDraw()
        -
        OpenGL cannot draw until a proper native peer is available, so this - returns the value of PApplet.isDisplayable() (inherited from Component).
        -
        -
        Overrides:
        -
        beginDraw in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        endDraw

        -
        public void endDraw()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from PGraphics_endDraw.xml ) - - Finalizes the rendering of a PGraphics object so that it can be shown on screen. - - ( end auto-generated ) -

        Advanced

        -

        - When creating your own PGraphics, you should call this when - you're finished drawing.

        -
        -
        Overrides:
        -
        endDraw in class PGraphics
        -
        -
      • -
      - - - - - - - -
        -
      • -

        endPGL

        -
        public void endPGL()
        -
        -
        Overrides:
        -
        endPGL in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        updateProjmodelview

        -
        public void updateProjmodelview()
        -
      • -
      - - - -
        -
      • -

        hint

        -
        public void hint(int which)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from hint.xml ) - - Set various hints and hacks for the renderer. This is used to handle - obscure rendering features that cannot be implemented in a consistent - manner across renderers. Many options will often graduate to standard - features instead of hints over time. -

        - hint(ENABLE_OPENGL_4X_SMOOTH) - Enable 4x anti-aliasing for P3D. This - can help force anti-aliasing if it has not been enabled by the user. On - some graphics cards, this can also be set by the graphics driver's - control panel, however not all cards make this available. This hint must - be called immediately after the size() command because it resets the - renderer, obliterating any settings and anything drawn (and like size(), - re-running the code that came before it again). -

        - hint(DISABLE_OPENGL_2X_SMOOTH) - In Processing 1.0, Processing always - enables 2x smoothing when the P3D renderer is used. This hint disables - the default 2x smoothing and returns the smoothing behavior found in - earlier releases, where smooth() and noSmooth() could be used to enable - and disable smoothing, though the quality was inferior. -

        - hint(ENABLE_NATIVE_FONTS) - Use the native version fonts when they are - installed, rather than the bitmapped version from a .vlw file. This is - useful with the default (or JAVA2D) renderer setting, as it will improve - font rendering speed. This is not enabled by default, because it can be - misleading while testing because the type will look great on your - machine (because you have the font installed) but lousy on others' - machines if the identical font is unavailable. This option can only be - set per-sketch, and must be called before any use of textFont(). -

        - hint(DISABLE_DEPTH_TEST) - Disable the zbuffer, allowing you to draw on - top of everything at will. When depth testing is disabled, items will be - drawn to the screen sequentially, like a painting. This hint is most - often used to draw in 3D, then draw in 2D on top of it (for instance, to - draw GUI controls in 2D on top of a 3D interface). Starting in release - 0149, this will also clear the depth buffer. Restore the default with - hint(ENABLE_DEPTH_TEST), but note that with the depth buffer cleared, - any 3D drawing that happens later in draw() will ignore existing shapes - on the screen. -

        - hint(ENABLE_DEPTH_SORT) - Enable primitive z-sorting of triangles and - lines in P3D and OPENGL. This can slow performance considerably, and the - algorithm is not yet perfect. Restore the default with hint(DISABLE_DEPTH_SORT). -

        - hint(DISABLE_OPENGL_ERROR_REPORT) - Speeds up the P3D renderer setting - by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT). -

        - As of release 0149, unhint() has been removed in favor of adding - additional ENABLE/DISABLE constants to reset the default behavior. This - prevents the double negatives, and also reinforces which hints can be - enabled or disabled. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        hint in class PGraphics
        -
        Parameters:
        -
        which - name of the hint to be enabled or disabled
        -
        See Also:
        -
        PGraphics, -PApplet.createGraphics(int, int, String, String), -PApplet.size(int, int)
        -
        -
      • -
      - - - -
        -
      • -

        beginShape

        -
        public void beginShape(int kind)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms. beginShape() begins recording - vertices for a shape and endShape() stops recording. The value of - the MODE parameter tells it which types of shapes to create from - the provided vertices. With no mode specified, the shape can be any - irregular polygon. The parameters available for beginShape() are POINTS, - LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, and QUAD_STRIP. - After calling the beginShape() function, a series of - vertex() commands must follow. To stop drawing the shape, call - endShape(). The vertex() function with two parameters - specifies a position in 2D and the vertex() function with three - parameters specifies a position in 3D. Each shape will be outlined with - the current stroke color and filled with the fill color. -

        - Transformations such as translate(), rotate(), and - scale() do not work within beginShape(). It is also not - possible to use other shapes, such as ellipse() or rect() - within beginShape(). -

        - The P3D renderer settings allow stroke() and fill() - settings to be altered per-vertex, however the default P2D renderer does - not. Settings such as strokeWeight(), strokeCap(), and - strokeJoin() cannot be changed while inside a - beginShape()/endShape() block with any renderer. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        beginShape in class PGraphics
        -
        Parameters:
        -
        kind - Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIP
        -
        See Also:
        -
        PShape, -PGraphics.endShape(), -PGraphics.vertex(float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape(int mode)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape(). When endshape() - is called, all of image data defined since the previous call to - beginShape() is written into the image buffer. The constant CLOSE - as the value for the MODE parameter to close the shape (to connect the - beginning and the end). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        endShape in class PGraphics
        -
        Parameters:
        -
        mode - use CLOSE to close the shape
        -
        See Also:
        -
        PShape, -PGraphics.beginShape(int)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textureSampling

        -
        public void textureSampling(int sampling)
        -
      • -
      - - - - - - - -
        -
      • -

        endContour

        -
        public void endContour()
        -
        -
        Overrides:
        -
        endContour in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

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

        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)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices. - vertex() is used to specify the vertex coordinates for points, - lines, triangles, quads, and polygons and is used exclusively within the - beginShape() and endShape() function.
        -
        - Drawing a vertex in 3D using the z parameter requires the P3D - parameter in combination with size as shown in the above example.
        -
        - This function is also used to map a texture onto the geometry. The - texture() function declares the texture to apply to the geometry - and the u and v coordinates set define the mapping of this - texture to the form. By default, the coordinates used for u and - v are specified in relation to the image's size in pixels, but - this relation can be changed with textureMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        vertex in class PGraphics
        -
        Parameters:
        -
        x - x-coordinate of the vertex
        -
        y - y-coordinate of the vertex
        -
        z - z-coordinate of the vertex
        -
        u - horizontal coordinate for the texture mapping
        -
        v - vertical coordinate for the texture mapping
        -
        See Also:
        -
        PGraphics.beginShape(int), -PGraphics.endShape(int), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.texture(PImage)
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   float... values)
        -
        -
        Overrides:
        -
        attrib in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   int... values)
        -
        -
        Overrides:
        -
        attrib in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   boolean... values)
        -
        -
        Overrides:
        -
        attrib in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        noClip

        -
        public void noClip()
        -
        -
        Overrides:
        -
        noClip in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public void flush()
        -
        -
        Overrides:
        -
        flush in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        bezierVertex

        -
        public void bezierVertex(float x2,
        -                         float y2,
        -                         float x3,
        -                         float y3,
        -                         float x4,
        -                         float y4)
        -
        -
        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)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves. Each call to - bezierVertex() defines the position of two control points and one - anchor point of a Bezier curve, adding a new segment to a line or shape. - The first time bezierVertex() is used within a - beginShape() call, it must be prefaced with a call to - vertex() to set the first anchor point. This function must be - used between beginShape() and endShape() and only when - there is no MODE parameter specified to beginShape(). Using the - 3D version requires rendering with P3D (see the Environment reference - for more information). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        bezierVertex in class PGraphics
        -
        Parameters:
        -
        x2 - the x-coordinate of the 1st control point
        -
        y2 - the y-coordinate of the 1st control point
        -
        z2 - the z-coordinate of the 1st control point
        -
        x3 - the x-coordinate of the 2nd control point
        -
        y3 - the y-coordinate of the 2nd control point
        -
        z3 - the z-coordinate of the 2nd control point
        -
        x4 - the x-coordinate of the anchor point
        -
        y4 - the y-coordinate of the anchor point
        -
        z4 - the z-coordinate of the anchor point
        -
        See Also:
        -
        PGraphics.curveVertex(float, float, float), -PGraphics.vertex(float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float cx,
        -                            float cy,
        -                            float cz,
        -                            float x3,
        -                            float y3,
        -                            float z3)
        -
        -
        Overrides:
        -
        quadraticVertex in class PGraphics
        -
        cz - the z-coordinate of the control point
        -
        z3 - the z-coordinate of the anchor point
        -
        -
      • -
      - - - - - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
        -
        Overrides:
        -
        curveVertex in class PGraphics
        -
        z - the z-coordinate of the vertex
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel. The - first parameter is the horizontal value for the point, the second value - is the vertical value for the point, and the optional third value is the - depth value. Drawing this shape in 3D with the z parameter - requires the P3D parameter in combination with size() as shown in - the above example. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        point in class PGraphics
        -
        Parameters:
        -
        x - x-coordinate of the point
        -
        y - y-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y,
        -                  float z)
        -
        -
        Overrides:
        -
        point in class PGraphics
        -
        z - z-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen. The - version of line() with four parameters draws the line in 2D. To - color a line, use the stroke() function. A line cannot be filled, - therefore the fill() function will not affect the color of a - line. 2D lines are drawn with a width of one pixel by default, but this - can be changed with the strokeWeight() function. The version with - six parameters allows the line to be placed anywhere within XYZ space. - Drawing this shape in 3D with the z parameter requires the P3D - parameter in combination with size() as shown in the above example. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        line in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        See Also:
        -
        PGraphics.strokeWeight(float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int), -PGraphics.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float z1,
        -                 float x2,
        -                 float y2,
        -                 float z2)
        -
        -
        Overrides:
        -
        line in class PGraphics
        -
        z1 - z-coordinate of the first point
        -
        z2 - z-coordinate of the second point
        -
        -
      • -
      - - - -
        -
      • -

        triangle

        -
        public void triangle(float x1,
        -                     float y1,
        -                     float x2,
        -                     float y2,
        -                     float x3,
        -                     float y3)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points. The first two - arguments specify the first point, the middle two arguments specify the - second point, and the last two arguments specify the third point. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        triangle in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        x3 - x-coordinate of the third point
        -
        y3 - y-coordinate of the third point
        -
        See Also:
        -
        PApplet.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        quad

        -
        public void quad(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2,
        -                 float x3,
        -                 float y3,
        -                 float x4,
        -                 float y4)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon. It is similar to a - rectangle, but the angles between its edges are not constrained to - ninety degrees. The first pair of parameters (x1,y1) sets the first - vertex and the subsequent pairs should proceed clockwise or - counter-clockwise around the defined shape. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        quad in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first corner
        -
        y1 - y-coordinate of the first corner
        -
        x2 - x-coordinate of the second corner
        -
        y2 - y-coordinate of the second corner
        -
        x3 - x-coordinate of the third corner
        -
        y3 - y-coordinate of the third corner
        -
        x4 - x-coordinate of the fourth corner
        -
        y4 - y-coordinate of the fourth corner
        -
        -
      • -
      - - - -
        -
      • -

        ellipseImpl

        -
        public void ellipseImpl(float a,
        -                        float b,
        -                        float c,
        -                        float d)
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float w,
        -                float h,
        -                float d)
        -
        -
        Overrides:
        -
        box in class PGraphics
        -
        Parameters:
        -
        w - dimension of the box in the x-dimension
        -
        h - dimension of the box in the y-dimension
        -
        d - dimension of the box in the z-dimension
        -
        -
      • -
      - - - -
        -
      • -

        sphere

        -
        public void sphere(float r)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles. - - ( end auto-generated ) - -

        Advanced

        -

        - 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
        -
        Parameters:
        -
        r - the radius of the sphere
        -
        See Also:
        -
        PGraphics.sphereDetail(int)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textAscent

        -
        public float textAscent()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size. This information - is useful for determining the height of the font above the baseline. For - example, adding the textAscent() and textDescent() values - will give you the total height of the line. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        textAscent in class PGraphics
        -
        See Also:
        -
        PGraphics.textDescent()
        -
        -
      • -
      - - - -
        -
      • -

        textDescent

        -
        public float textDescent()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size. This - information is useful for determining the height of the font below the - baseline. For example, adding the textAscent() and - textDescent() values will give you the total height of the line. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        textDescent in class PGraphics
        -
        See Also:
        -
        PGraphics.textAscent()
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        popMatrix

        -
        public void popMatrix()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack. - Understanding pushing and popping requires understanding the concept of - a matrix stack. The pushMatrix() function saves the current - coordinate system to the stack and popMatrix() restores the prior - coordinate system. pushMatrix() and popMatrix() are used - in conjuction with the other transformation functions and may be - embedded to control the scope of the transformations. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        popMatrix in class PGraphics
        -
        See Also:
        -
        PGraphics.pushMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float tx,
        -                      float ty)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window. The - x parameter specifies left/right translation, the y - parameter specifies up/down translation, and the z parameter - specifies translations toward/away from the screen. Using this function - with the z parameter requires using P3D as a parameter in - combination with size as shown in the above example. Transformations - apply to everything that happens after and subsequent calls to the - function accumulates the effect. For example, calling translate(50, - 0) and then translate(20, 0) is the same as translate(70, - 0). If translate() is called within draw(), the - transformation is reset when the loop begins again. This function can be - further controlled by the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        translate in class PGraphics
        -
        Parameters:
        -
        tx - left/right translation
        -
        ty - up/down translation
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float tx,
        -                      float ty,
        -                      float tz)
        -
        -
        Overrides:
        -
        translate in class PGraphics
        -
        tz - forward/backward translation
        -
        -
      • -
      - - - - - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateX(PI/2) and then rotateX(PI/2) is the same - as rotateX(PI). If rotateX() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the example above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateX in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateY(PI/2) and then rotateY(PI/2) is the same - as rotateY(PI). If rotateY() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateY in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateZ(PI/2) and then rotateZ(PI/2) is the same - as rotateZ(PI). If rotateZ() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateZ in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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 sx,
        -                  float sy)
        -
        Same as scale(sx, sy, 1).
        -
        -
        Overrides:
        -
        scale in class PGraphics
        -
        Parameters:
        -
        sx - percentage to scale the object in the x-axis
        -
        sy - percentage to scale the object in the y-axis
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float sx,
        -                  float sy,
        -                  float sz)
        -
        Scale in three dimensions.
        -
        -
        Overrides:
        -
        scale in class PGraphics
        -
        sz - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - -
        -
      • -

        shearX

        -
        public void shearX(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearX(PI/2) and then shearX(PI/2) is the same as - shearX(PI). If shearX() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearX() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shearX in class PGraphics
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        public void shearY(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearY(PI/2) and then shearY(PI/2) is the same as - shearY(PI). If shearY() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearY() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shearY in class PGraphics
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearX(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(float n00,
        -                        float n01,
        -                        float n02,
        -                        float n10,
        -                        float n11,
        -                        float n12)
        -
        -
        Overrides:
        -
        applyMatrix in class PGraphics
        -
        Parameters:
        -
        n00 - numbers which define the 4x4 matrix to be multiplied
        -
        n01 - numbers which define the 4x4 matrix to be multiplied
        -
        n02 - numbers which define the 4x4 matrix to be multiplied
        -
        n10 - numbers which define the 4x4 matrix to be multiplied
        -
        n11 - numbers which define the 4x4 matrix to be multiplied
        -
        n12 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - - - - - -
        -
      • -

        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 to the modelview stack.
        -
        -
        Overrides:
        -
        applyMatrix in class PGraphics
        -
        n03 - numbers which define the 4x4 matrix to be multiplied
        -
        n13 - numbers which define the 4x4 matrix to be multiplied
        -
        n20 - numbers which define the 4x4 matrix to be multiplied
        -
        n21 - numbers which define the 4x4 matrix to be multiplied
        -
        n22 - numbers which define the 4x4 matrix to be multiplied
        -
        n23 - numbers which define the 4x4 matrix to be multiplied
        -
        n30 - numbers which define the 4x4 matrix to be multiplied
        -
        n31 - numbers which define the 4x4 matrix to be multiplied
        -
        n32 - numbers which define the 4x4 matrix to be multiplied
        -
        n33 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - - - - - -
        -
      • -

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

        pushProjection

        -
        public void pushProjection()
        -
      • -
      - - - -
        -
      • -

        popProjection

        -
        public void popProjection()
        -
      • -
      - - - -
        -
      • -

        resetProjection

        -
        public void resetProjection()
        -
      • -
      - - - -
        -
      • -

        applyProjection

        -
        public void applyProjection(PMatrix3D mat)
        -
      • -
      - - - -
        -
      • -

        applyProjection

        -
        public void applyProjection(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)
        -
      • -
      - - - -
        -
      • -

        setProjection

        -
        public void setProjection(PMatrix3D mat)
        -
      • -
      - - - -
        -
      • -

        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 contains - the values of the modelview matrix immediatly after the latter was - initialized with ortho() or camera(), or the modelview matrix as result of - the operations applied between beginCamera()/endCamera(). -

        - 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 in - 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
        -
        See Also:
        -
        PGraphics.camera(), -PGraphics.endCamera(), -PGraphics.applyMatrix(PMatrix), -PGraphics.resetMatrix(), -PGraphics.translate(float, float, float), -PGraphics.scale(float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

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

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

        -
        -
        Overrides:
        -
        camera in class PGraphics
        -
        See Also:
        -
        PGraphics.endCamera(), -PGraphics.frustum(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        Parameters:
        -
        eyeX - x-coordinate for the eye
        -
        eyeY - y-coordinate for the eye
        -
        eyeZ - z-coordinate for the eye
        -
        centerX - x-coordinate for the center of the scene
        -
        centerY - y-coordinate for the center of the scene
        -
        centerZ - z-coordinate for the center of the scene
        -
        upX - usually 0.0, 1.0, or -1.0
        -
        upY - usually 0.0, 1.0, or -1.0
        -
        upZ - usually 0.0, 1.0, or -1.0
        -
        -
      • -
      - - - - - - - -
        -
      • -

        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)
        -
        Calls ortho() with the specified size of the viewing volume along - the X and Z directions.
        -
        -
        Overrides:
        -
        ortho in class PGraphics
        -
        Parameters:
        -
        left - left plane of the clipping volume
        -
        right - right plane of the clipping volume
        -
        bottom - bottom plane of the clipping volume
        -
        top - top plane of the clipping volume
        -
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho(float left,
        -                  float right,
        -                  float bottom,
        -                  float top,
        -                  float near,
        -                  float far)
        -
        Sets an orthographic projection.
        -
        -
        Overrides:
        -
        ortho in class PGraphics
        -
        near - maximum distance from the origin to the viewer
        -
        far - maximum distance from the origin away from the viewer
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        Parameters:
        -
        fov - field-of-view angle (in radians) for vertical direction
        -
        aspect - ratio of width to height
        -
        zNear - z-position of nearest clipping plane
        -
        zFar - z-position of farthest clipping plane
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        Parameters:
        -
        left - left coordinate of the clipping plane
        -
        right - right coordinate of the clipping plane
        -
        bottom - bottom coordinate of the clipping plane
        -
        top - top coordinate of the clipping plane
        -
        znear - near component of the clipping plane; must be greater than zero
        -
        zfar - far component of the clipping plane; must be greater than the near value
        -
        See Also:
        -
        PGraphics.camera(float, float, float, float, float, float, float, float, float), -PGraphics.endCamera(), -PGraphics.perspective(float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenX in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenY(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenY in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenX in class PGraphics
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenY in class PGraphics
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenZ

        -
        public float screenZ(float x,
        -                     float y,
        -                     float z)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenZ in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenY(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelX

        -
        public float modelX(float x,
        -                    float y,
        -                    float z)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from modelX.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the X value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The X value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use. -

        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        modelX in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.modelY(float, float, float), -PGraphics.modelZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelY

        -
        public float modelY(float x,
        -                    float y,
        -                    float z)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from modelY.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the Y value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The Y value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use.
        -
        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        modelY in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.modelX(float, float, float), -PGraphics.modelZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelZ

        -
        public float modelZ(float x,
        -                    float y,
        -                    float z)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from modelZ.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the Z value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The Z value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use.
        -
        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        modelZ in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.modelX(float, float, float), -PGraphics.modelY(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        popStyle

        -
        public void popStyle()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from popStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings; these functions are - always used together. They allow you to change the style settings and - later return to what you had. When a new style is started with - pushStyle(), it builds on the current style information. The - pushStyle() and popStyle() functions can be embedded to - provide more control (see the second example above for a demonstration.) - - ( end auto-generated )
        -
        -
        Overrides:
        -
        popStyle in class PGraphics
        -
        See Also:
        -
        PGraphics.pushStyle()
        -
        -
      • -
      - - - -
        -
      • -

        strokeWeight

        -
        public void strokeWeight(float weight)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes. All widths are set in units of pixels. -

        - When drawing with P3D, series of connected lines (such as the stroke - around a polygon, triangle, or ellipse) produce unattractive results - when a thick stroke weight is set (see - Issue 123). With P3D, the minimum and maximum values for - strokeWeight() are controlled by the graphics card and the - operating system's OpenGL implementation. For instance, the thickness - may not go higher than 10 pixels. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        strokeWeight in class PGraphics
        -
        Parameters:
        -
        weight - the weight (in pixels) of the stroke
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        strokeJoin

        -
        public void strokeJoin(int join)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments. These joints - are either mitered, beveled, or rounded and specified with the - corresponding parameters MITER, BEVEL, and ROUND. The default joint is - MITER. -

        - This function is not available with the P3D renderer, (see - Issue 123). More information about the renderers can be found in the - size() reference. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        strokeJoin in class PGraphics
        -
        Parameters:
        -
        join - either MITER, BEVEL, ROUND
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeWeight(float), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        lights

        -
        public void lights()
        -
        Sets up an ambient and directional light using OpenGL. API taken from - PGraphics3D. - -
        - 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
        -
        See Also:
        -
        PGraphics.ambientLight(float, float, float, float, float, float), -PGraphics.directionalLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float), -PGraphics.noLights()
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        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
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        -
      • -
      - - - -
        -
      • -

        directionalLight

        -
        public void directionalLight(float r,
        -                             float g,
        -                             float b,
        -                             float dx,
        -                             float dy,
        -                             float dz)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from directionalLight.xml ) - - Adds a directional light. Directional light comes from one direction and - is stronger when hitting a surface squarely and weaker if it hits at a a - gentle angle. After hitting a surface, a directional lights scatters in - all directions. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The nx, ny, and nz parameters specify the - direction the light is facing. For example, setting ny to -1 will - cause the geometry to be lit from below (the light is facing directly upward). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        directionalLight in class PGraphics
        -
        Parameters:
        -
        r - red or hue value (depending on current color mode)
        -
        g - green or saturation value (depending on current color mode)
        -
        b - blue or brightness value (depending on current color mode)
        -
        dx - direction along the x-axis
        -
        dy - direction along the y-axis
        -
        dz - direction along the z-axis
        -
        See Also:
        -
        PGraphics.lights(), -PGraphics.ambientLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        spotLight

        -
        public void spotLight(float r,
        -                      float g,
        -                      float b,
        -                      float x,
        -                      float y,
        -                      float z,
        -                      float dx,
        -                      float dy,
        -                      float dz,
        -                      float angle,
        -                      float concentration)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from spotLight.xml ) - - Adds a spot light. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The x, y, and z parameters specify the - position of the light and nx, ny, nz specify the - direction or light. The angle parameter affects angle of the - spotlight cone. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        spotLight in class PGraphics
        -
        Parameters:
        -
        r - red or hue value (depending on current color mode)
        -
        g - green or saturation value (depending on current color mode)
        -
        b - blue or brightness value (depending on current color mode)
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        dx - direction along the x axis
        -
        dy - direction along the y axis
        -
        dz - direction along the z axis
        -
        angle - angle of the spotlight cone
        -
        concentration - exponent determining the center bias of the cone
        -
        See Also:
        -
        PGraphics.lights(), -PGraphics.directionalLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.ambientLight(float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        isGL

        -
        public boolean isGL()
        -
        Description copied from class: PGraphics
        -
        Return true if this renderer does rendering through OpenGL. Defaults to false.
        -
        -
        Overrides:
        -
        isGL in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        loadPixels

        -
        public void loadPixels()
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_loadPixels.xml ) - - Loads the pixel data for the image into its pixels[] array. This - function must always be called before reading from or writing to pixels[]. -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. - - ( end auto-generated ) - -

        Advanced

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

        get

        -
        public int get(int x,
        -               int y)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image. If no - parameters are specified, the entire image is returned. Use the x - and y parameters to get the value of one pixel. Get a section of - the display window by specifying an additional width and - height parameter. When getting an image, the x and - y parameters define the coordinates for the upper-left corner of - the image, regardless of the current imageMode().
        -
        - If the pixel requested is outside of the image window, black is - returned. The numbers returned are scaled according to the current color - ranges, but only RGB values are returned by this function. For example, - even though you may have drawn a shape with colorMode(HSB), the - numbers returned will be in RGB format.
        -
        - Getting the color of a single pixel with get(x, y) is easy, but - not as fast as grabbing the data directly from pixels[]. The - equivalent statement to get(x, y) using pixels[] is - pixels[y*width+x]. See the reference for pixels[] for more information. - - ( end auto-generated ) - -

        Advanced

        - 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
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        See Also:
        -
        PApplet.set(int, int, int), -PApplet.pixels, -PApplet.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                int argb)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
        -
        - The x and y parameters specify the pixel to change and the - color parameter specifies the color value. The color parameter is - affected by the current color mode (the default is RGB values from 0 to - 255). When setting an image, the x and y parameters define - the coordinates for the upper-left corner of the image, regardless of - the current imageMode(). -

        - Setting the color of a single pixel with set(x, y) is easy, but - not as fast as putting the data directly into pixels[]. The - equivalent statement to set(x, y, #000000) using pixels[] - is pixels[y*width+x] = #000000. See the reference for - pixels[] for more information. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        set in class PImage
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        argb - any value of the color datatype
        -
        See Also:
        -
        PImage.get(int, int, int, int), -PImage.pixels, -PImage.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        save

        -
        public boolean save(String filename)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_save.xml ) - - Saves the image into a file. Images are saved in TIFF, TARGA, JPEG, and - PNG format depending on the extension within the filename - parameter. For example, "image.tif" will have a TIFF image and - "image.png" will save a PNG image. If no extension is included in the - filename, the image will save in TIFF format and .tif will be - added to the name. These files are saved to the sketch's folder, which - may be opened by selecting "Show sketch folder" from the "Sketch" menu. - It is not possible to use save() while running the program in a - web browser.

        To save an image created within the code, rather - than through loading, it's necessary to make the image with the - createImage() function so it is aware of the location of the - program and can therefore save the file to the right place. See the - createImage() reference for more information. - - ( end auto-generated ) -

        Advanced

        - 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
        -
        Parameters:
        -
        filename - a sequence of letters and numbers
        -
        -
      • -
      - - - -
        -
      • -

        loadTexture

        -
        public void loadTexture()
        -
      • -
      - - - -
        -
      • -

        updateTexture

        -
        public void updateTexture()
        -
      • -
      - - - -
        -
      • -

        updateTexture

        -
        public void updateTexture(int x,
        -                          int y,
        -                          int w,
        -                          int h)
        -
      • -
      - - - -
        -
      • -

        updateDisplay

        -
        public void updateDisplay()
        -
      • -
      - - - -
        -
      • -

        mask

        -
        public void mask(PImage alpha)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel. This mask image should only contain - grayscale data, but only the blue color channel is used. The mask image - needs to be the same size as the image to which it is applied.
        -
        - In addition to using a mask image, an integer array containing the alpha - channel data can be specified directly. This method is useful for - creating dynamically generated alpha masks. This array must be of the - same length as the target image's pixels array and should contain only - grayscale data of values between 0-255. - - ( end auto-generated ) - -

        Advanced

        - - 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" grayscale by - performing a proper luminance-based conversion.

        -
        -
        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
        -
        Parameters:
        -
        kind - Either THRESHOLD, GRAY, OPAQUE, INVERT, POSTERIZE, BLUR, ERODE, or DILATE
        -
        param - unique for each, see above
        -
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(PShader shader)
        -
        -
        Overrides:
        -
        filter in class PGraphics
        -
        Parameters:
        -
        shader - the fragment shader to apply
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        ( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another. If the source and - destination regions aren't the same size, it will automatically resize - source pixels to fit the specified target region. No alpha information - is used in the process, however if the source image has an alpha channel - set, it will be copied as well. -

        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        copy in class PImage
        -
        Parameters:
        -
        sx - X coordinate of the source's upper left corner
        -
        sy - Y coordinate of the source's upper left corner
        -
        sw - source image width
        -
        sh - source image height
        -
        dx - X coordinate of the destination's upper left corner
        -
        dy - Y coordinate of the destination's upper left corner
        -
        dw - destination image width
        -
        dh - destination image height
        -
        See Also:
        -
        PGraphics.alpha(int), -PImage.blend(PImage, int, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(PImage src,
        -                 int sx,
        -                 int sy,
        -                 int sw,
        -                 int sh,
        -                 int dx,
        -                 int dy,
        -                 int dw,
        -                 int dh)
        -
        -
        Overrides:
        -
        copy in class PImage
        -
        Parameters:
        -
        src - an image variable referring to the source image.
        -
        -
      • -
      - - - -
        -
      • -

        getTexture

        -
        public Texture getTexture()
        -
        Not an approved function, this will change or be removed in the future. - This utility method returns the texture associated to the renderer's. - drawing surface, making sure is updated to reflect the current contents - off the screen (or offscreen drawing surface).
        -
      • -
      - - - -
        -
      • -

        getTexture

        -
        public Texture getTexture(boolean load)
        -
        Not an approved function either, don't use it.
        -
      • -
      - - - -
        -
      • -

        getTexture

        -
        public Texture getTexture(PImage img)
        -
        Not an approved function, this will change or be removed in the future. - This utility method returns the texture associated to the image. - creating and/or updating it if needed.
        -
        -
        Parameters:
        -
        img - the image to have a texture metadata associated to it
        -
        -
      • -
      - - - -
        -
      • -

        getFrameBuffer

        -
        public FrameBuffer getFrameBuffer()
        -
        Not an approved function, test its use in libraries to grab the FB objects - for offscreen PGraphics.
        -
      • -
      - - - -
        -
      • -

        getFrameBuffer

        -
        public FrameBuffer getFrameBuffer(boolean multi)
        -
      • -
      - - - -
        -
      • -

        resize

        -
        public void resize(int wide,
        -                   int high)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_resize.xml ) - - Resize the image to a new width and height. To make the image scale - proportionally, use 0 as the value for the wide or high - parameter. For instance, to make the width of an image 150 pixels, and - change the height using the same proportion, use resize(150, 0).
        -
        - Even though a PGraphics is technically a PImage, it is not possible to - rescale the image data found in a PGraphics. (It's simply not possible - to do this consistently across renderers: technically infeasible with - P3D, or what would it even do with PDF?) If you want to resize PGraphics - content, first get a copy of its image data using the get() - method, and call resize() on the PImage that is returned. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        resize in class PImage
        -
        Parameters:
        -
        wide - the resized image width
        -
        high - the resized image height
        -
        See Also:
        -
        PImage.get(int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        loadShader

        -
        public PShader loadShader(String fragFilename)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from loadShader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        loadShader in class PGraphics
        -
        Parameters:
        -
        fragFilename - name of fragment shader file
        -
        -
      • -
      - - - - - - - -
        -
      • -

        shader

        -
        public void shader(PShader shader)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shader in class PGraphics
        -
        Parameters:
        -
        shader - name of shader file
        -
        -
      • -
      - - - -
        -
      • -

        shader

        -
        public void shader(PShader shader,
        -                   int kind)
        -
        -
        Overrides:
        -
        shader in class PGraphics
        -
        kind - type of shader, either POINTS, LINES, or TRIANGLES
        -
        -
      • -
      - - - -
        -
      • -

        resetShader

        -
        public void resetShader()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from resetShader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        resetShader in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        resetShader

        -
        public void resetShader(int kind)
        -
        -
        Overrides:
        -
        resetShader in class PGraphics
        -
        Parameters:
        -
        kind - type of shader, either POINTS, LINES, or TRIANGLES
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/opengl/PJOGL.html b/build/javadoc/core/processing/opengl/PJOGL.html deleted file mode 100644 index 1b0fa550ca..0000000000 --- a/build/javadoc/core/processing/opengl/PJOGL.html +++ /dev/null @@ -1,3492 +0,0 @@ - - - - - -PJOGL - - - - - - - - - - - -
-
processing.opengl
-

Class PJOGL

-
-
- -
-
    -
  • -
    -
    -
    public class PJOGL
    -extends PGL
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        PROFILE

        -
        public static int PROFILE
        -
      • -
      - - - -
        -
      • -

        RETINA

        -
        public static boolean RETINA
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        gl

        -
        public com.jogamp.opengl.GL gl
        -
        Basic GL functionality, common to all profiles
        -
      • -
      - - - -
        -
      • -

        glu

        -
        public com.jogamp.opengl.glu.GLU glu
        -
        GLU interface
        -
      • -
      - - - -
        -
      • -

        context

        -
        public com.jogamp.opengl.GLContext context
        -
        The rendering context (holds rendering state info)
        -
      • -
      - - - -
        -
      • -

        canvas

        -
        public Canvas canvas
        -
        The canvas where OpenGL rendering takes place
        -
      • -
      - - - -
        -
      • -

        profile

        -
        public static com.jogamp.opengl.GLProfile profile
        -
        Selected GL profile
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        flush

        -
        public void flush()
        -
        -
        Specified by:
        -
        flush in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        finish

        -
        public void finish()
        -
        -
        Specified by:
        -
        finish in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        hint

        -
        public void hint(int target,
        -                 int hint)
        -
        -
        Specified by:
        -
        hint in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        enable

        -
        public void enable(int value)
        -
        -
        Specified by:
        -
        enable in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        disable

        -
        public void disable(int value)
        -
        -
        Specified by:
        -
        disable in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getBooleanv

        -
        public void getBooleanv(int value,
        -                        IntBuffer data)
        -
        -
        Specified by:
        -
        getBooleanv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getIntegerv

        -
        public void getIntegerv(int value,
        -                        IntBuffer data)
        -
        -
        Specified by:
        -
        getIntegerv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getFloatv

        -
        public void getFloatv(int value,
        -                      FloatBuffer data)
        -
        -
        Specified by:
        -
        getFloatv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        isEnabled

        -
        public boolean isEnabled(int value)
        -
        -
        Specified by:
        -
        isEnabled in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public String getString(int name)
        -
        -
        Specified by:
        -
        getString in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getError

        -
        public int getError()
        -
        -
        Specified by:
        -
        getError in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        errorString

        -
        public String errorString(int err)
        -
        -
        Specified by:
        -
        errorString in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        genBuffers

        -
        public void genBuffers(int n,
        -                       IntBuffer buffers)
        -
        -
        Specified by:
        -
        genBuffers in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        deleteBuffers

        -
        public void deleteBuffers(int n,
        -                          IntBuffer buffers)
        -
        -
        Specified by:
        -
        deleteBuffers in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        bindBuffer

        -
        public void bindBuffer(int target,
        -                       int buffer)
        -
        -
        Specified by:
        -
        bindBuffer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        bufferData

        -
        public void bufferData(int target,
        -                       int size,
        -                       Buffer data,
        -                       int usage)
        -
        -
        Specified by:
        -
        bufferData in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        bufferSubData

        -
        public void bufferSubData(int target,
        -                          int offset,
        -                          int size,
        -                          Buffer data)
        -
        -
        Specified by:
        -
        bufferSubData in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        isBuffer

        -
        public void isBuffer(int buffer)
        -
        -
        Specified by:
        -
        isBuffer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getBufferParameteriv

        -
        public void getBufferParameteriv(int target,
        -                                 int value,
        -                                 IntBuffer data)
        -
        -
        Specified by:
        -
        getBufferParameteriv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        mapBuffer

        -
        public ByteBuffer mapBuffer(int target,
        -                            int access)
        -
        -
        Specified by:
        -
        mapBuffer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        mapBufferRange

        -
        public ByteBuffer mapBufferRange(int target,
        -                                 int offset,
        -                                 int length,
        -                                 int access)
        -
        -
        Specified by:
        -
        mapBufferRange in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        unmapBuffer

        -
        public void unmapBuffer(int target)
        -
        -
        Specified by:
        -
        unmapBuffer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        depthRangef

        -
        public void depthRangef(float n,
        -                        float f)
        -
        -
        Specified by:
        -
        depthRangef in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        viewport

        -
        public void viewport(int x,
        -                     int y,
        -                     int w,
        -                     int h)
        -
        -
        Specified by:
        -
        viewport in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        vertexAttrib1f

        -
        public void vertexAttrib1f(int index,
        -                           float value)
        -
        -
        Specified by:
        -
        vertexAttrib1f in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        vertexAttrib2f

        -
        public void vertexAttrib2f(int index,
        -                           float value0,
        -                           float value1)
        -
        -
        Specified by:
        -
        vertexAttrib2f in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        vertexAttrib3f

        -
        public void vertexAttrib3f(int index,
        -                           float value0,
        -                           float value1,
        -                           float value2)
        -
        -
        Specified by:
        -
        vertexAttrib3f in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        vertexAttrib4f

        -
        public void vertexAttrib4f(int index,
        -                           float value0,
        -                           float value1,
        -                           float value2,
        -                           float value3)
        -
        -
        Specified by:
        -
        vertexAttrib4f in class PGL
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        vertexAttribPointer

        -
        public void vertexAttribPointer(int index,
        -                                int size,
        -                                int type,
        -                                boolean normalized,
        -                                int stride,
        -                                int offset)
        -
        -
        Specified by:
        -
        vertexAttribPointer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        vertexAttribPointer

        -
        public void vertexAttribPointer(int index,
        -                                int size,
        -                                int type,
        -                                boolean normalized,
        -                                int stride,
        -                                Buffer data)
        -
        -
        Specified by:
        -
        vertexAttribPointer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        enableVertexAttribArray

        -
        public void enableVertexAttribArray(int index)
        -
        -
        Specified by:
        -
        enableVertexAttribArray in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        disableVertexAttribArray

        -
        public void disableVertexAttribArray(int index)
        -
        -
        Specified by:
        -
        disableVertexAttribArray in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        drawArrays

        -
        public void drawArrays(int mode,
        -                       int first,
        -                       int count)
        -
        -
        Specified by:
        -
        drawArrays in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        drawElements

        -
        public void drawElements(int mode,
        -                         int count,
        -                         int type,
        -                         int offset)
        -
        -
        Specified by:
        -
        drawElements in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        drawElements

        -
        public void drawElements(int mode,
        -                         int count,
        -                         int type,
        -                         Buffer indices)
        -
        -
        Specified by:
        -
        drawElements in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        lineWidth

        -
        public void lineWidth(float width)
        -
        -
        Specified by:
        -
        lineWidth in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        frontFace

        -
        public void frontFace(int dir)
        -
        -
        Specified by:
        -
        frontFace in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        cullFace

        -
        public void cullFace(int mode)
        -
        -
        Specified by:
        -
        cullFace in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        polygonOffset

        -
        public void polygonOffset(float factor,
        -                          float units)
        -
        -
        Specified by:
        -
        polygonOffset in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        pixelStorei

        -
        public void pixelStorei(int pname,
        -                        int param)
        -
        -
        Specified by:
        -
        pixelStorei in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        texImage2D

        -
        public void texImage2D(int target,
        -                       int level,
        -                       int internalFormat,
        -                       int width,
        -                       int height,
        -                       int border,
        -                       int format,
        -                       int type,
        -                       Buffer data)
        -
        -
        Specified by:
        -
        texImage2D in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        copyTexImage2D

        -
        public void copyTexImage2D(int target,
        -                           int level,
        -                           int internalFormat,
        -                           int x,
        -                           int y,
        -                           int width,
        -                           int height,
        -                           int border)
        -
        -
        Specified by:
        -
        copyTexImage2D in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        texSubImage2D

        -
        public void texSubImage2D(int target,
        -                          int level,
        -                          int xOffset,
        -                          int yOffset,
        -                          int width,
        -                          int height,
        -                          int format,
        -                          int type,
        -                          Buffer data)
        -
        -
        Specified by:
        -
        texSubImage2D in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        copyTexSubImage2D

        -
        public void copyTexSubImage2D(int target,
        -                              int level,
        -                              int xOffset,
        -                              int yOffset,
        -                              int x,
        -                              int y,
        -                              int width,
        -                              int height)
        -
        -
        Specified by:
        -
        copyTexSubImage2D in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        compressedTexImage2D

        -
        public void compressedTexImage2D(int target,
        -                                 int level,
        -                                 int internalFormat,
        -                                 int width,
        -                                 int height,
        -                                 int border,
        -                                 int imageSize,
        -                                 Buffer data)
        -
        -
        Specified by:
        -
        compressedTexImage2D in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        compressedTexSubImage2D

        -
        public void compressedTexSubImage2D(int target,
        -                                    int level,
        -                                    int xOffset,
        -                                    int yOffset,
        -                                    int width,
        -                                    int height,
        -                                    int format,
        -                                    int imageSize,
        -                                    Buffer data)
        -
        -
        Specified by:
        -
        compressedTexSubImage2D in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        texParameteri

        -
        public void texParameteri(int target,
        -                          int pname,
        -                          int param)
        -
        -
        Specified by:
        -
        texParameteri in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        texParameterf

        -
        public void texParameterf(int target,
        -                          int pname,
        -                          float param)
        -
        -
        Specified by:
        -
        texParameterf in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        texParameteriv

        -
        public void texParameteriv(int target,
        -                           int pname,
        -                           IntBuffer params)
        -
        -
        Specified by:
        -
        texParameteriv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        texParameterfv

        -
        public void texParameterfv(int target,
        -                           int pname,
        -                           FloatBuffer params)
        -
        -
        Specified by:
        -
        texParameterfv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        generateMipmap

        -
        public void generateMipmap(int target)
        -
        -
        Specified by:
        -
        generateMipmap in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        genTextures

        -
        public void genTextures(int n,
        -                        IntBuffer textures)
        -
        -
        Specified by:
        -
        genTextures in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        deleteTextures

        -
        public void deleteTextures(int n,
        -                           IntBuffer textures)
        -
        -
        Specified by:
        -
        deleteTextures in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getTexParameteriv

        -
        public void getTexParameteriv(int target,
        -                              int pname,
        -                              IntBuffer params)
        -
        -
        Specified by:
        -
        getTexParameteriv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getTexParameterfv

        -
        public void getTexParameterfv(int target,
        -                              int pname,
        -                              FloatBuffer params)
        -
        -
        Specified by:
        -
        getTexParameterfv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        isTexture

        -
        public boolean isTexture(int texture)
        -
        -
        Specified by:
        -
        isTexture in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        createShader

        -
        public int createShader(int type)
        -
        -
        Specified by:
        -
        createShader in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        shaderSource

        -
        public void shaderSource(int shader,
        -                         String source)
        -
        -
        Specified by:
        -
        shaderSource in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        compileShader

        -
        public void compileShader(int shader)
        -
        -
        Specified by:
        -
        compileShader in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        releaseShaderCompiler

        -
        public void releaseShaderCompiler()
        -
        -
        Specified by:
        -
        releaseShaderCompiler in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        deleteShader

        -
        public void deleteShader(int shader)
        -
        -
        Specified by:
        -
        deleteShader in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        shaderBinary

        -
        public void shaderBinary(int count,
        -                         IntBuffer shaders,
        -                         int binaryFormat,
        -                         Buffer binary,
        -                         int length)
        -
        -
        Specified by:
        -
        shaderBinary in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        createProgram

        -
        public int createProgram()
        -
        -
        Specified by:
        -
        createProgram in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        attachShader

        -
        public void attachShader(int program,
        -                         int shader)
        -
        -
        Specified by:
        -
        attachShader in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        detachShader

        -
        public void detachShader(int program,
        -                         int shader)
        -
        -
        Specified by:
        -
        detachShader in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        linkProgram

        -
        public void linkProgram(int program)
        -
        -
        Specified by:
        -
        linkProgram in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        useProgram

        -
        public void useProgram(int program)
        -
        -
        Specified by:
        -
        useProgram in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        deleteProgram

        -
        public void deleteProgram(int program)
        -
        -
        Specified by:
        -
        deleteProgram in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getAttribLocation

        -
        public int getAttribLocation(int program,
        -                             String name)
        -
        -
        Specified by:
        -
        getAttribLocation in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        bindAttribLocation

        -
        public void bindAttribLocation(int program,
        -                               int index,
        -                               String name)
        -
        -
        Specified by:
        -
        bindAttribLocation in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getUniformLocation

        -
        public int getUniformLocation(int program,
        -                              String name)
        -
        -
        Specified by:
        -
        getUniformLocation in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        uniform1i

        -
        public void uniform1i(int location,
        -                      int value)
        -
        -
        Specified by:
        -
        uniform1i in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform2i

        -
        public void uniform2i(int location,
        -                      int value0,
        -                      int value1)
        -
        -
        Specified by:
        -
        uniform2i in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform3i

        -
        public void uniform3i(int location,
        -                      int value0,
        -                      int value1,
        -                      int value2)
        -
        -
        Specified by:
        -
        uniform3i in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform4i

        -
        public void uniform4i(int location,
        -                      int value0,
        -                      int value1,
        -                      int value2,
        -                      int value3)
        -
        -
        Specified by:
        -
        uniform4i in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform1f

        -
        public void uniform1f(int location,
        -                      float value)
        -
        -
        Specified by:
        -
        uniform1f in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform2f

        -
        public void uniform2f(int location,
        -                      float value0,
        -                      float value1)
        -
        -
        Specified by:
        -
        uniform2f in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform3f

        -
        public void uniform3f(int location,
        -                      float value0,
        -                      float value1,
        -                      float value2)
        -
        -
        Specified by:
        -
        uniform3f in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform4f

        -
        public void uniform4f(int location,
        -                      float value0,
        -                      float value1,
        -                      float value2,
        -                      float value3)
        -
        -
        Specified by:
        -
        uniform4f in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform1iv

        -
        public void uniform1iv(int location,
        -                       int count,
        -                       IntBuffer v)
        -
        -
        Specified by:
        -
        uniform1iv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform2iv

        -
        public void uniform2iv(int location,
        -                       int count,
        -                       IntBuffer v)
        -
        -
        Specified by:
        -
        uniform2iv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform3iv

        -
        public void uniform3iv(int location,
        -                       int count,
        -                       IntBuffer v)
        -
        -
        Specified by:
        -
        uniform3iv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform4iv

        -
        public void uniform4iv(int location,
        -                       int count,
        -                       IntBuffer v)
        -
        -
        Specified by:
        -
        uniform4iv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform1fv

        -
        public void uniform1fv(int location,
        -                       int count,
        -                       FloatBuffer v)
        -
        -
        Specified by:
        -
        uniform1fv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform2fv

        -
        public void uniform2fv(int location,
        -                       int count,
        -                       FloatBuffer v)
        -
        -
        Specified by:
        -
        uniform2fv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform3fv

        -
        public void uniform3fv(int location,
        -                       int count,
        -                       FloatBuffer v)
        -
        -
        Specified by:
        -
        uniform3fv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform4fv

        -
        public void uniform4fv(int location,
        -                       int count,
        -                       FloatBuffer v)
        -
        -
        Specified by:
        -
        uniform4fv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniformMatrix2fv

        -
        public void uniformMatrix2fv(int location,
        -                             int count,
        -                             boolean transpose,
        -                             FloatBuffer mat)
        -
        -
        Specified by:
        -
        uniformMatrix2fv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniformMatrix3fv

        -
        public void uniformMatrix3fv(int location,
        -                             int count,
        -                             boolean transpose,
        -                             FloatBuffer mat)
        -
        -
        Specified by:
        -
        uniformMatrix3fv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniformMatrix4fv

        -
        public void uniformMatrix4fv(int location,
        -                             int count,
        -                             boolean transpose,
        -                             FloatBuffer mat)
        -
        -
        Specified by:
        -
        uniformMatrix4fv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        validateProgram

        -
        public void validateProgram(int program)
        -
        -
        Specified by:
        -
        validateProgram in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        isShader

        -
        public boolean isShader(int shader)
        -
        -
        Specified by:
        -
        isShader in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getShaderiv

        -
        public void getShaderiv(int shader,
        -                        int pname,
        -                        IntBuffer params)
        -
        -
        Specified by:
        -
        getShaderiv in class PGL
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getShaderSource

        -
        public String getShaderSource(int shader)
        -
        -
        Specified by:
        -
        getShaderSource in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getVertexAttribfv

        -
        public void getVertexAttribfv(int index,
        -                              int pname,
        -                              FloatBuffer params)
        -
        -
        Specified by:
        -
        getVertexAttribfv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getVertexAttribiv

        -
        public void getVertexAttribiv(int index,
        -                              int pname,
        -                              IntBuffer params)
        -
        -
        Specified by:
        -
        getVertexAttribiv in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getUniformfv

        -
        public void getUniformfv(int program,
        -                         int location,
        -                         FloatBuffer params)
        -
        -
        Specified by:
        -
        getUniformfv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getUniformiv

        -
        public void getUniformiv(int program,
        -                         int location,
        -                         IntBuffer params)
        -
        -
        Specified by:
        -
        getUniformiv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        isProgram

        -
        public boolean isProgram(int program)
        -
        -
        Specified by:
        -
        isProgram in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getProgramiv

        -
        public void getProgramiv(int program,
        -                         int pname,
        -                         IntBuffer params)
        -
        -
        Specified by:
        -
        getProgramiv in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        scissor

        -
        public void scissor(int x,
        -                    int y,
        -                    int w,
        -                    int h)
        -
        -
        Specified by:
        -
        scissor in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        sampleCoverage

        -
        public void sampleCoverage(float value,
        -                           boolean invert)
        -
        -
        Specified by:
        -
        sampleCoverage in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        stencilFunc

        -
        public void stencilFunc(int func,
        -                        int ref,
        -                        int mask)
        -
        -
        Specified by:
        -
        stencilFunc in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        stencilFuncSeparate

        -
        public void stencilFuncSeparate(int face,
        -                                int func,
        -                                int ref,
        -                                int mask)
        -
        -
        Specified by:
        -
        stencilFuncSeparate in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        stencilOp

        -
        public void stencilOp(int sfail,
        -                      int dpfail,
        -                      int dppass)
        -
        -
        Specified by:
        -
        stencilOp in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        stencilOpSeparate

        -
        public void stencilOpSeparate(int face,
        -                              int sfail,
        -                              int dpfail,
        -                              int dppass)
        -
        -
        Specified by:
        -
        stencilOpSeparate in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        depthFunc

        -
        public void depthFunc(int func)
        -
        -
        Specified by:
        -
        depthFunc in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        blendEquation

        -
        public void blendEquation(int mode)
        -
        -
        Specified by:
        -
        blendEquation in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        blendEquationSeparate

        -
        public void blendEquationSeparate(int modeRGB,
        -                                  int modeAlpha)
        -
        -
        Specified by:
        -
        blendEquationSeparate in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        blendFunc

        -
        public void blendFunc(int src,
        -                      int dst)
        -
        -
        Specified by:
        -
        blendFunc in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        blendFuncSeparate

        -
        public void blendFuncSeparate(int srcRGB,
        -                              int dstRGB,
        -                              int srcAlpha,
        -                              int dstAlpha)
        -
        -
        Specified by:
        -
        blendFuncSeparate in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        blendColor

        -
        public void blendColor(float red,
        -                       float green,
        -                       float blue,
        -                       float alpha)
        -
        -
        Specified by:
        -
        blendColor in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        alphaFunc

        -
        public void alphaFunc(int func,
        -                      float ref)
        -
        -
        Specified by:
        -
        alphaFunc in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        colorMask

        -
        public void colorMask(boolean r,
        -                      boolean g,
        -                      boolean b,
        -                      boolean a)
        -
        -
        Specified by:
        -
        colorMask in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        depthMask

        -
        public void depthMask(boolean mask)
        -
        -
        Specified by:
        -
        depthMask in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        stencilMask

        -
        public void stencilMask(int mask)
        -
        -
        Specified by:
        -
        stencilMask in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        stencilMaskSeparate

        -
        public void stencilMaskSeparate(int face,
        -                                int mask)
        -
        -
        Specified by:
        -
        stencilMaskSeparate in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear(int buf)
        -
        -
        Specified by:
        -
        clear in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        clearColor

        -
        public void clearColor(float r,
        -                       float g,
        -                       float b,
        -                       float a)
        -
        -
        Specified by:
        -
        clearColor in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        clearDepth

        -
        public void clearDepth(float d)
        -
        -
        Specified by:
        -
        clearDepth in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        clearStencil

        -
        public void clearStencil(int s)
        -
        -
        Specified by:
        -
        clearStencil in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        genFramebuffers

        -
        public void genFramebuffers(int n,
        -                            IntBuffer framebuffers)
        -
        -
        Specified by:
        -
        genFramebuffers in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        bindRenderbuffer

        -
        public void bindRenderbuffer(int target,
        -                             int renderbuffer)
        -
        -
        Specified by:
        -
        bindRenderbuffer in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        genRenderbuffers

        -
        public void genRenderbuffers(int n,
        -                             IntBuffer renderbuffers)
        -
        -
        Specified by:
        -
        genRenderbuffers in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        renderbufferStorage

        -
        public void renderbufferStorage(int target,
        -                                int internalFormat,
        -                                int width,
        -                                int height)
        -
        -
        Specified by:
        -
        renderbufferStorage in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        framebufferRenderbuffer

        -
        public void framebufferRenderbuffer(int target,
        -                                    int attachment,
        -                                    int rendbuferfTarget,
        -                                    int renderbuffer)
        -
        -
        Specified by:
        -
        framebufferRenderbuffer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        framebufferTexture2D

        -
        public void framebufferTexture2D(int target,
        -                                 int attachment,
        -                                 int texTarget,
        -                                 int texture,
        -                                 int level)
        -
        -
        Specified by:
        -
        framebufferTexture2D in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        checkFramebufferStatus

        -
        public int checkFramebufferStatus(int target)
        -
        -
        Specified by:
        -
        checkFramebufferStatus in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        isFramebuffer

        -
        public boolean isFramebuffer(int framebuffer)
        -
        -
        Specified by:
        -
        isFramebuffer in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        isRenderbuffer

        -
        public boolean isRenderbuffer(int renderbuffer)
        -
        -
        Specified by:
        -
        isRenderbuffer in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        blitFramebuffer

        -
        public void blitFramebuffer(int srcX0,
        -                            int srcY0,
        -                            int srcX1,
        -                            int srcY1,
        -                            int dstX0,
        -                            int dstY0,
        -                            int dstX1,
        -                            int dstY1,
        -                            int mask,
        -                            int filter)
        -
        -
        Specified by:
        -
        blitFramebuffer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        renderbufferStorageMultisample

        -
        public void renderbufferStorageMultisample(int target,
        -                                           int samples,
        -                                           int format,
        -                                           int width,
        -                                           int height)
        -
        -
        Specified by:
        -
        renderbufferStorageMultisample in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        readBuffer

        -
        public void readBuffer(int buf)
        -
        -
        Specified by:
        -
        readBuffer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        drawBuffer

        -
        public void drawBuffer(int buf)
        -
        -
        Specified by:
        -
        drawBuffer in class PGL
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/opengl/PShader.html b/build/javadoc/core/processing/opengl/PShader.html deleted file mode 100644 index 313459806c..0000000000 --- a/build/javadoc/core/processing/opengl/PShader.html +++ /dev/null @@ -1,974 +0,0 @@ - - - - - -PShader - - - - - - - - - - - -
-
processing.opengl
-

Class PShader

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    -
    public class PShader
    -extends Object
    -implements PConstants
    -
    This class encapsulates a GLSL shader program, including a vertex - and a fragment shader. Based on the GLSLShader class from GLGraphics, which - in turn was originally based in the code by JohnG: - http://processing.org/discourse/beta/num_1159494801.html
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        glProgram

        -
        public int glProgram
        -
      • -
      - - - -
        -
      • -

        glVertex

        -
        public int glVertex
        -
      • -
      - - - -
        -
      • -

        glFragment

        -
        public int glFragment
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PShader

        -
        public PShader()
        -
      • -
      - - - -
        -
      • -

        PShader

        -
        public PShader(PApplet parent)
        -
      • -
      - - - -
        -
      • -

        PShader

        -
        public PShader(PApplet parent,
        -               String vertFilename,
        -               String fragFilename)
        -
        Creates a shader program using the specified vertex and fragment - shaders.
        -
        -
        Parameters:
        -
        parent - the parent program
        -
        vertFilename - name of the vertex shader
        -
        fragFilename - name of the fragment shader
        -
        -
      • -
      - - - -
        -
      • -

        PShader

        -
        public PShader(PApplet parent,
        -               URL vertURL,
        -               URL fragURL)
        -
        -
        Parameters:
        -
        vertURL - network location of the vertex shader
        -
        fragURL - network location of the fragment shader
        -
        -
      • -
      - - - -
        -
      • -

        PShader

        -
        public PShader(PApplet parent,
        -               String[] vertSource,
        -               String[] fragSource)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setVertexShader

        -
        public void setVertexShader(String vertFilename)
        -
      • -
      - - - -
        -
      • -

        setVertexShader

        -
        public void setVertexShader(URL vertURL)
        -
      • -
      - - - -
        -
      • -

        setVertexShader

        -
        public void setVertexShader(String[] vertSource)
        -
      • -
      - - - -
        -
      • -

        setFragmentShader

        -
        public void setFragmentShader(String fragFilename)
        -
      • -
      - - - -
        -
      • -

        setFragmentShader

        -
        public void setFragmentShader(URL fragURL)
        -
      • -
      - - - -
        -
      • -

        setFragmentShader

        -
        public void setFragmentShader(String[] fragSource)
        -
      • -
      - - - -
        -
      • -

        bind

        -
        public void bind()
        -
        Initializes (if needed) and binds the shader program.
        -
      • -
      - - - -
        -
      • -

        unbind

        -
        public void unbind()
        -
        Unbinds the shader program.
        -
      • -
      - - - -
        -
      • -

        bound

        -
        public boolean bound()
        -
        Returns true if the shader is bound, false otherwise.
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                int x)
        -
        -
        Parameters:
        -
        name - the name of the uniform variable to modify
        -
        x - first component of the variable to modify
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                int x,
        -                int y)
        -
        -
        Parameters:
        -
        y - second component of the variable to modify. The variable has to be declared with an array/vector type in the shader (i.e.: int[2], vec2)
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                int x,
        -                int y,
        -                int z)
        -
        -
        Parameters:
        -
        z - third component of the variable to modify. The variable has to be declared with an array/vector type in the shader (i.e.: int[3], vec3)
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                int x,
        -                int y,
        -                int z,
        -                int w)
        -
        -
        Parameters:
        -
        w - fourth component of the variable to modify. The variable has to be declared with an array/vector type in the shader (i.e.: int[4], vec4)
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                float x)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                float x,
        -                float y)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                float x,
        -                float y,
        -                float z)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                float x,
        -                float y,
        -                float z,
        -                float w)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                PVector vec)
        -
        -
        Parameters:
        -
        vec - modifies all the components of an array/vector uniform variable. PVector can only be used if the type of the variable is vec3.
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                boolean x)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                boolean x,
        -                boolean y)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                boolean x,
        -                boolean y,
        -                boolean z)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                boolean x,
        -                boolean y,
        -                boolean z,
        -                boolean w)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                int[] vec)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                int[] vec,
        -                int ncoords)
        -
        -
        Parameters:
        -
        ncoords - number of coordinates per element, max 4
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                float[] vec)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                float[] vec,
        -                int ncoords)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                boolean[] vec)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                boolean[] boolvec,
        -                int ncoords)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                PMatrix2D mat)
        -
        -
        Parameters:
        -
        mat - matrix of values
        -
        -
      • -
      - - - - - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                PMatrix3D mat,
        -                boolean use3x3)
        -
        -
        Parameters:
        -
        use3x3 - enforces the matrix is 3 x 3
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                PImage tex)
        -
        -
        Parameters:
        -
        tex - sets the sampler uniform variable to read from this image texture
        -
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/opengl/PShapeOpenGL.html b/build/javadoc/core/processing/opengl/PShapeOpenGL.html deleted file mode 100644 index c1d28b7284..0000000000 --- a/build/javadoc/core/processing/opengl/PShapeOpenGL.html +++ /dev/null @@ -1,2899 +0,0 @@ - - - - - -PShapeOpenGL - - - - - - - - - - - -
-
processing.opengl
-

Class PShapeOpenGL

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    -
    public class PShapeOpenGL
    -extends PShape
    -
    This class holds a 3D model composed of vertices, normals, colors - (per vertex) and texture coordinates (also per vertex). All this data is - stored in Vertex Buffer Objects (VBO) in GPU memory for very fast access. - OBJ loading implemented using code from Saito's OBJLoader library: - http://code.google.com/p/saitoobjloader/ - and OBJReader from Ahmet Kizilay - http://www.openprocessing.org/visuals/?visualID=191 - By Andres Colubri - - - Other formats to consider: - AMF: http://en.wikipedia.org/wiki/Additive_Manufacturing_File_Format - STL: http://en.wikipedia.org/wiki/STL_(file_format) - OFF: http://people.sc.fsu.edu/~jburkardt/data/off/off.html(file_format) - DXF: http://en.wikipedia.org/wiki/AutoCAD_DXF
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        glPolyVertex

        -
        public int glPolyVertex
        -
      • -
      - - - -
        -
      • -

        glPolyColor

        -
        public int glPolyColor
        -
      • -
      - - - -
        -
      • -

        glPolyNormal

        -
        public int glPolyNormal
        -
      • -
      - - - -
        -
      • -

        glPolyTexcoord

        -
        public int glPolyTexcoord
        -
      • -
      - - - -
        -
      • -

        glPolyAmbient

        -
        public int glPolyAmbient
        -
      • -
      - - - -
        -
      • -

        glPolySpecular

        -
        public int glPolySpecular
        -
      • -
      - - - -
        -
      • -

        glPolyEmissive

        -
        public int glPolyEmissive
        -
      • -
      - - - -
        -
      • -

        glPolyShininess

        -
        public int glPolyShininess
        -
      • -
      - - - -
        -
      • -

        glPolyIndex

        -
        public int glPolyIndex
        -
      • -
      - - - -
        -
      • -

        glLineVertex

        -
        public int glLineVertex
        -
      • -
      - - - -
        -
      • -

        glLineColor

        -
        public int glLineColor
        -
      • -
      - - - -
        -
      • -

        glLineAttrib

        -
        public int glLineAttrib
        -
      • -
      - - - -
        -
      • -

        glLineIndex

        -
        public int glLineIndex
        -
      • -
      - - - -
        -
      • -

        glPointVertex

        -
        public int glPointVertex
        -
      • -
      - - - -
        -
      • -

        glPointColor

        -
        public int glPointColor
        -
      • -
      - - - -
        -
      • -

        glPointAttrib

        -
        public int glPointAttrib
        -
      • -
      - - - -
        -
      • -

        glPointIndex

        -
        public int glPointIndex
        -
      • -
      - - - -
        -
      • -

        glUsage

        -
        public int glUsage
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PShapeOpenGL

        -
        public PShapeOpenGL(PGraphicsOpenGL pg,
        -                    int family)
        -
      • -
      - - - -
        -
      • -

        PShapeOpenGL

        -
        public PShapeOpenGL(PGraphicsOpenGL pg,
        -                    int kind,
        -                    float... p)
        -
        Create a shape from the PRIMITIVE family, using this kind and these params
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        addChild

        -
        public void addChild(PShape who,
        -                     int idx)
        -
        -
        Overrides:
        -
        addChild in class PShape
        -
        idx - the layer position in which to insert the new child
        -
        -
      • -
      - - - -
        -
      • -

        removeChild

        -
        public void removeChild(int idx)
        -
        Description copied from class: PShape
        -
        Remove the child shape with index idx.
        -
        -
        Overrides:
        -
        removeChild in class PShape
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        getWidth

        -
        public float getWidth()
        -
        Description copied from class: PShape
        -
        Get the width of the drawing area (not necessarily the shape boundary).
        -
        -
        Overrides:
        -
        getWidth in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getHeight

        -
        public float getHeight()
        -
        Description copied from class: PShape
        -
        Get the height of the drawing area (not necessarily the shape boundary).
        -
        -
        Overrides:
        -
        getHeight in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getDepth

        -
        public float getDepth()
        -
        Description copied from class: PShape
        -
        Get the depth of the shape area (not necessarily the shape boundary). Only makes sense for 3D PShape subclasses, - such as PShape3D.
        -
        -
        Overrides:
        -
        getDepth in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setTextureMode

        -
        public void setTextureMode(int mode)
        -
        -
        Overrides:
        -
        setTextureMode in class PShape
        -
        -
      • -
      - - - - - - - -
        -
      • -

        solid

        -
        public void solid(boolean solid)
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y)
        -
        -
        Overrides:
        -
        vertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float u,
        -                   float v)
        -
        -
        Overrides:
        -
        vertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float z)
        -
        -
        Overrides:
        -
        vertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float z,
        -                   float u,
        -                   float v)
        -
        -
        Overrides:
        -
        vertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        normal

        -
        public void normal(float nx,
        -                   float ny,
        -                   float nz)
        -
        -
        Overrides:
        -
        normal in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   float... values)
        -
        -
        Overrides:
        -
        attrib in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   int... values)
        -
        -
        Overrides:
        -
        attrib in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   boolean... values)
        -
        -
        Overrides:
        -
        attrib in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape(int mode)
        -
        -
        Overrides:
        -
        endShape in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setParams

        -
        public void setParams(float[] source)
        -
      • -
      - - - -
        -
      • -

        setPath

        -
        public void setPath(int vcount,
        -                    float[][] verts,
        -                    int ccount,
        -                    int[] codes)
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float tx,
        -                      float ty)
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_translate.xml ) - - Specifies an amount to displace the shape. The x parameter - specifies left/right translation, the y parameter specifies - up/down translation, and the z parameter specifies translations - toward/away from the screen. Subsequent calls to the method accumulates - the effect. For example, calling translate(50, 0) and then - translate(20, 0) is the same as translate(70, 0). This - transformation is applied directly to the shape, it's not refreshed each - time draw() is run. -

        - Using this method with the z parameter requires using the P3D - parameter in combination with size. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        translate in class PShape
        -
        See Also:
        -
        PShape.rotate(float), -PShape.scale(float), -PShape.resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float tx,
        -                      float ty,
        -                      float tz)
        -
        -
        Overrides:
        -
        translate in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle)
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_rotate.xml ) - - Rotates a shape the amount specified by the angle parameter. - Angles should be specified in radians (values from 0 to TWO_PI) or - converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the method accumulates the effect. For example, calling - rotate(HALF_PI) and then rotate(HALF_PI) is the same as - rotate(PI). This transformation is applied directly to the shape, - it's not refreshed each time draw() is run. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotate in class PShape
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PShape.rotateX(float), -PShape.rotateY(float), -PShape.rotateZ(float), -PShape.scale(float), -PShape.translate(float, float), -PShape.resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to TWO_PI) or converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Subsequent calls to the method accumulates the effect. For example, - calling rotateX(HALF_PI) and then rotateX(HALF_PI) is the - same as rotateX(PI). This transformation is applied directly to - the shape, it's not refreshed each time draw() is run. -

        - This method requires a 3D renderer. You need to use P3D as a third - parameter for the size() function as shown in the example above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateX in class PShape
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PShape.rotate(float), -PShape.rotateY(float), -PShape.rotateZ(float), -PShape.scale(float), -PShape.translate(float, float), -PShape.resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to TWO_PI) or converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Subsequent calls to the method accumulates the effect. For example, - calling rotateY(HALF_PI) and then rotateY(HALF_PI) is the - same as rotateY(PI). This transformation is applied directly to - the shape, it's not refreshed each time draw() is run. -

        - This method requires a 3D renderer. You need to use P3D as a third - parameter for the size() function as shown in the example above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateY in class PShape
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PShape.rotate(float), -PShape.rotateX(float), -PShape.rotateZ(float), -PShape.scale(float), -PShape.translate(float, float), -PShape.resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to TWO_PI) or converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Subsequent calls to the method accumulates the effect. For example, - calling rotateZ(HALF_PI) and then rotateZ(HALF_PI) is the - same as rotateZ(PI). This transformation is applied directly to - the shape, it's not refreshed each time draw() is run. -

        - This method requires a 3D renderer. You need to use P3D as a third - parameter for the size() function as shown in the example above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateZ in class PShape
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PShape.rotate(float), -PShape.rotateX(float), -PShape.rotateY(float), -PShape.scale(float), -PShape.translate(float, float), -PShape.resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle,
        -                   float v0,
        -                   float v1,
        -                   float v2)
        -
        -
        Overrides:
        -
        rotate in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float s)
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices. Shapes always scale from the relative origin of their bounding - box. Scale values are specified as decimal percentages. For example, the - method call scale(2.0) increases the dimension of a shape by - 200%. Subsequent calls to the method multiply the effect. For example, - calling scale(2.0) and then scale(1.5) is the same as - scale(3.0). This transformation is applied directly to the shape, - it's not refreshed each time draw() is run. -

        - Using this method with the z parameter requires using the P3D - parameter in combination with size. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        scale in class PShape
        -
        Parameters:
        -
        s - percentate to scale the object
        -
        See Also:
        -
        PShape.rotate(float), -PShape.translate(float, float), -PShape.resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y)
        -
        -
        Overrides:
        -
        scale in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y,
        -                  float z)
        -
        -
        Overrides:
        -
        scale in class PShape
        -
        Parameters:
        -
        x - percentage to scale the object in the x-axis
        -
        y - percentage to scale the object in the y-axis
        -
        z - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - - - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(float n00,
        -                        float n01,
        -                        float n02,
        -                        float n10,
        -                        float n11,
        -                        float n12)
        -
        -
        Overrides:
        -
        applyMatrix in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Overrides:
        -
        applyMatrix in class PShape
        -
        -
      • -
      - - - - - - - -
        -
      • -

        bezierDetail

        -
        public void bezierDetail(int detail)
        -
        -
        Overrides:
        -
        bezierDetail in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        bezierVertex

        -
        public void bezierVertex(float x2,
        -                         float y2,
        -                         float x3,
        -                         float y3,
        -                         float x4,
        -                         float y4)
        -
        -
        Overrides:
        -
        bezierVertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        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 PShape
        -
        -
      • -
      - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float cx,
        -                            float cy,
        -                            float x3,
        -                            float y3)
        -
        -
        Overrides:
        -
        quadraticVertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float cx,
        -                            float cy,
        -                            float cz,
        -                            float x3,
        -                            float y3,
        -                            float z3)
        -
        -
        Overrides:
        -
        quadraticVertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        curveDetail

        -
        public void curveDetail(int detail)
        -
        -
        Overrides:
        -
        curveDetail in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        curveTightness

        -
        public void curveTightness(float tightness)
        -
        -
        Overrides:
        -
        curveTightness in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y)
        -
        -
        Overrides:
        -
        curveVertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
        -
        Overrides:
        -
        curveVertex in class PShape
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getVertex

        -
        public PVector getVertex(int index,
        -                         PVector vec)
        -
        -
        Overrides:
        -
        getVertex in class PShape
        -
        vec - PVector to assign the data to
        -
        -
      • -
      - - - -
        -
      • -

        getVertexX

        -
        public float getVertexX(int index)
        -
        -
        Overrides:
        -
        getVertexX in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getVertexY

        -
        public float getVertexY(int index)
        -
        -
        Overrides:
        -
        getVertexY in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getVertexZ

        -
        public float getVertexZ(int index)
        -
        -
        Overrides:
        -
        getVertexZ in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setVertex

        -
        public void setVertex(int index,
        -                      float x,
        -                      float y)
        -
        -
        Overrides:
        -
        setVertex in class PShape
        -
        Parameters:
        -
        index - the location of the vertex
        -
        x - the x value for the vertex
        -
        y - the y value for the vertex
        -
        See Also:
        -
        PShape.getVertex(int), -PShape.getVertexCount()
        -
        -
      • -
      - - - -
        -
      • -

        setVertex

        -
        public void setVertex(int index,
        -                      float x,
        -                      float y,
        -                      float z)
        -
        -
        Overrides:
        -
        setVertex in class PShape
        -
        z - the z value for the vertex
        -
        -
      • -
      - - - -
        -
      • -

        setVertex

        -
        public void setVertex(int index,
        -                      PVector vec)
        -
        -
        Overrides:
        -
        setVertex in class PShape
        -
        vec - the PVector to define the x, y, z coordinates
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getNormalX

        -
        public float getNormalX(int index)
        -
        -
        Overrides:
        -
        getNormalX in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getNormalY

        -
        public float getNormalY(int index)
        -
        -
        Overrides:
        -
        getNormalY in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getNormalZ

        -
        public float getNormalZ(int index)
        -
        -
        Overrides:
        -
        getNormalZ in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setNormal

        -
        public void setNormal(int index,
        -                      float nx,
        -                      float ny,
        -                      float nz)
        -
        -
        Overrides:
        -
        setNormal in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setAttrib

        -
        public void setAttrib(String name,
        -                      int index,
        -                      float... values)
        -
        -
        Overrides:
        -
        setAttrib in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setAttrib

        -
        public void setAttrib(String name,
        -                      int index,
        -                      int... values)
        -
        -
        Overrides:
        -
        setAttrib in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setAttrib

        -
        public void setAttrib(String name,
        -                      int index,
        -                      boolean... values)
        -
        -
        Overrides:
        -
        setAttrib in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getTextureU

        -
        public float getTextureU(int index)
        -
        -
        Overrides:
        -
        getTextureU in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getTextureV

        -
        public float getTextureV(int index)
        -
        -
        Overrides:
        -
        getTextureV in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setTextureUV

        -
        public void setTextureUV(int index,
        -                         float u,
        -                         float v)
        -
        -
        Overrides:
        -
        setTextureUV in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getFill

        -
        public int getFill(int index)
        -
        -
        Overrides:
        -
        getFill in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setFill

        -
        public void setFill(boolean fill)
        -
        -
        Overrides:
        -
        setFill in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setFill

        -
        public void setFill(int fill)
        -
        -
        Overrides:
        -
        setFill in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setFill

        -
        public void setFill(int index,
        -                    int fill)
        -
        -
        Overrides:
        -
        setFill in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getTint

        -
        public int getTint(int index)
        -
        -
        Overrides:
        -
        getTint in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setTint

        -
        public void setTint(boolean tint)
        -
        -
        Overrides:
        -
        setTint in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setTint

        -
        public void setTint(int tint)
        -
        -
        Overrides:
        -
        setTint in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setTint

        -
        public void setTint(int index,
        -                    int tint)
        -
        -
        Overrides:
        -
        setTint in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getStroke

        -
        public int getStroke(int index)
        -
        -
        Overrides:
        -
        getStroke in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setStroke

        -
        public void setStroke(boolean stroke)
        -
        -
        Overrides:
        -
        setStroke in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setStroke

        -
        public void setStroke(int stroke)
        -
        -
        Overrides:
        -
        setStroke in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setStroke

        -
        public void setStroke(int index,
        -                      int stroke)
        -
        -
        Overrides:
        -
        setStroke in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getStrokeWeight

        -
        public float getStrokeWeight(int index)
        -
        -
        Overrides:
        -
        getStrokeWeight in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setStrokeWeight

        -
        public void setStrokeWeight(float weight)
        -
        -
        Overrides:
        -
        setStrokeWeight in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setStrokeWeight

        -
        public void setStrokeWeight(int index,
        -                            float weight)
        -
        -
        Overrides:
        -
        setStrokeWeight in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setStrokeJoin

        -
        public void setStrokeJoin(int join)
        -
        -
        Overrides:
        -
        setStrokeJoin in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setStrokeCap

        -
        public void setStrokeCap(int cap)
        -
        -
        Overrides:
        -
        setStrokeCap in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getAmbient

        -
        public int getAmbient(int index)
        -
        -
        Overrides:
        -
        getAmbient in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setAmbient

        -
        public void setAmbient(int ambient)
        -
        -
        Overrides:
        -
        setAmbient in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setAmbient

        -
        public void setAmbient(int index,
        -                       int ambient)
        -
        -
        Overrides:
        -
        setAmbient in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getSpecular

        -
        public int getSpecular(int index)
        -
        -
        Overrides:
        -
        getSpecular in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setSpecular

        -
        public void setSpecular(int specular)
        -
        -
        Overrides:
        -
        setSpecular in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setSpecular

        -
        public void setSpecular(int index,
        -                        int specular)
        -
        -
        Overrides:
        -
        setSpecular in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getEmissive

        -
        public int getEmissive(int index)
        -
        -
        Overrides:
        -
        getEmissive in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setEmissive

        -
        public void setEmissive(int emissive)
        -
        -
        Overrides:
        -
        setEmissive in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setEmissive

        -
        public void setEmissive(int index,
        -                        int emissive)
        -
        -
        Overrides:
        -
        setEmissive in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getShininess

        -
        public float getShininess(int index)
        -
        -
        Overrides:
        -
        getShininess in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setShininess

        -
        public void setShininess(float shininess)
        -
        -
        Overrides:
        -
        setShininess in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setShininess

        -
        public void setShininess(int index,
        -                         float shine)
        -
        -
        Overrides:
        -
        setShininess in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getVertexCodes

        -
        public int[] getVertexCodes()
        -
        -
        Overrides:
        -
        getVertexCodes in class PShape
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getVertexCode

        -
        public int getVertexCode(int index)
        -
        One of VERTEX, BEZIER_VERTEX, CURVE_VERTEX, or BREAK.
        -
        -
        Overrides:
        -
        getVertexCode in class PShape
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getTessellation

        -
        public float[] getTessellation(int kind,
        -                               int data)
        -
      • -
      - - - -
        -
      • -

        contains

        -
        public boolean contains(float x,
        -                        float y)
        -
        -
        Overrides:
        -
        contains in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        disableStyle

        -
        public void disableStyle()
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_disableStyle.xml ) - - Disables the shape's style data and uses Processing's current styles. - Styles include attributes such as colors, stroke weight, and stroke - joints. - - ( end auto-generated ) -

        Advanced

        - Overrides this shape's style information and uses PGraphics styles and - colors. Identical to ignoreStyles(true). Also disables styles for all - child shapes.
        -
        -
        Overrides:
        -
        disableStyle in class PShape
        -
        See Also:
        -
        PShape.enableStyle()
        -
        -
      • -
      - - - -
        -
      • -

        enableStyle

        -
        public void enableStyle()
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_enableStyle.xml ) - - Enables the shape's style data and ignores Processing's current styles. - Styles include attributes such as colors, stroke weight, and stroke - joints. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        enableStyle in class PShape
        -
        See Also:
        -
        PShape.disableStyle()
        -
        -
      • -
      - - - -
        -
      • -

        draw

        -
        public void draw()
        -
      • -
      - - - -
        -
      • -

        draw

        -
        public void draw(PGraphics g)
        -
        Description copied from class: PShape
        -
        Called by the following (the shape() command adds the g) - PShape s = loadShape("blah.svg"); - shape(s);
        -
        -
        Overrides:
        -
        draw in class PShape
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/opengl/PSurfaceJOGL.html b/build/javadoc/core/processing/opengl/PSurfaceJOGL.html deleted file mode 100644 index 3a87eac07d..0000000000 --- a/build/javadoc/core/processing/opengl/PSurfaceJOGL.html +++ /dev/null @@ -1,727 +0,0 @@ - - - - - -PSurfaceJOGL - - - - - - - - - - - -
-
processing.opengl
-

Class PSurfaceJOGL

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PSurface
    -
    -
    -
    -
    public class PSurfaceJOGL
    -extends Object
    -implements PSurface
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        profile

        -
        public static com.jogamp.opengl.GLProfile profile
        -
        Selected GL profile
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PSurfaceJOGL

        -
        public PSurfaceJOGL(PGraphics graphics)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - - - - - -
        -
      • -

        setTitle

        -
        public void setTitle(String title)
        -
        Description copied from interface: PSurface
        -
        Set the window (and dock, or whatever necessary) title.
        -
        -
        Specified by:
        -
        setTitle in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setVisible

        -
        public void setVisible(boolean visible)
        -
        Description copied from interface: PSurface
        -
        Show or hide the window.
        -
        -
        Specified by:
        -
        setVisible in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setResizable

        -
        public void setResizable(boolean resizable)
        -
        Description copied from interface: PSurface
        -
        Set true if we want to resize things (default is not resizable)
        -
        -
        Specified by:
        -
        setResizable in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        placeWindow

        -
        public void placeWindow(int[] location,
        -                        int[] editorLocation)
        -
        -
        Specified by:
        -
        placeWindow in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        placePresent

        -
        public void placePresent(int stopColor)
        -
        -
        Specified by:
        -
        placePresent in interface PSurface
        -
        -
      • -
      - - - - - - - -
        -
      • -

        startThread

        -
        public void startThread()
        -
        Description copied from interface: PSurface
        -
        Start the animation thread
        -
        -
        Specified by:
        -
        startThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        pauseThread

        -
        public void pauseThread()
        -
        Description copied from interface: PSurface
        -
        On the next trip through the animation thread, things should go sleepy-bye. - Does not pause the thread immediately because that needs to happen on the - animation thread itself, so fires on the next trip through draw().
        -
        -
        Specified by:
        -
        pauseThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        resumeThread

        -
        public void resumeThread()
        -
        -
        Specified by:
        -
        resumeThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        stopThread

        -
        public boolean stopThread()
        -
        Description copied from interface: PSurface
        -
        Stop the animation thread (set it null)
        -
        -
        Specified by:
        -
        stopThread in interface PSurface
        -
        Returns:
        -
        false if already stopped
        -
        -
      • -
      - - - -
        -
      • -

        isStopped

        -
        public boolean isStopped()
        -
        -
        Specified by:
        -
        isStopped in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setSize

        -
        public void setSize(int width,
        -                    int height)
        -
        -
        Specified by:
        -
        setSize in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        getPixelScale

        -
        public float getPixelScale()
        -
      • -
      - - - -
        -
      • -

        getComponent

        -
        public Component getComponent()
        -
      • -
      - - - -
        -
      • -

        setSmooth

        -
        public void setSmooth(int level)
        -
        Description copied from interface: PSurface
        -
        Sometimes smoothing must be set at the drawing surface level - not just inside the renderer itself.
        -
        -
        Specified by:
        -
        setSmooth in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setFrameRate

        -
        public void setFrameRate(float fps)
        -
        -
        Specified by:
        -
        setFrameRate in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        requestFocus

        -
        public void requestFocus()
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        public void setCursor(int kind)
        -
        -
        Specified by:
        -
        setCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        public void setCursor(PImage image,
        -                      int hotspotX,
        -                      int hotspotY)
        -
        -
        Specified by:
        -
        setCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        showCursor

        -
        public void showCursor()
        -
        -
        Specified by:
        -
        showCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        hideCursor

        -
        public void hideCursor()
        -
        -
        Specified by:
        -
        hideCursor in interface PSurface
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/opengl/Texture.Parameters.html b/build/javadoc/core/processing/opengl/Texture.Parameters.html deleted file mode 100644 index 7b26984d8a..0000000000 --- a/build/javadoc/core/processing/opengl/Texture.Parameters.html +++ /dev/null @@ -1,513 +0,0 @@ - - - - - -Texture.Parameters - - - - - - - - - - - -
-
processing.opengl
-

Class Texture.Parameters

-
-
- -
-
    -
  • -
    -
    Enclosing class:
    -
    Texture
    -
    -
    -
    -
    public static class Texture.Parameters
    -extends Object
    -
    This class stores the parameters for a texture: target, internal format, - minimization filter and magnification filter.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        target

        -
        public int target
        -
        Texture target.
        -
      • -
      - - - -
        -
      • -

        format

        -
        public int format
        -
        Texture internal format.
        -
      • -
      - - - -
        -
      • -

        sampling

        -
        public int sampling
        -
        Texture filtering (POINT, LINEAR, BILINEAR or TRILINEAR).
        -
      • -
      - - - -
        -
      • -

        mipmaps

        -
        public boolean mipmaps
        -
        Use mipmaps or not.
        -
      • -
      - - - -
        -
      • -

        wrapU

        -
        public int wrapU
        -
        Wrapping mode along U.
        -
      • -
      - - - -
        -
      • -

        wrapV

        -
        public int wrapV
        -
        Wrapping mode along V.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Parameters

        -
        public Parameters()
        -
        Sets all the parameters to default values.
        -
      • -
      - - - -
        -
      • -

        Parameters

        -
        public Parameters(int format)
        -
      • -
      - - - -
        -
      • -

        Parameters

        -
        public Parameters(int format,
        -                  int sampling)
        -
      • -
      - - - -
        -
      • -

        Parameters

        -
        public Parameters(int format,
        -                  int sampling,
        -                  boolean mipmaps)
        -
      • -
      - - - -
        -
      • -

        Parameters

        -
        public Parameters(int format,
        -                  int sampling,
        -                  boolean mipmaps,
        -                  int wrap)
        -
      • -
      - - - - -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        set

        -
        public void set(int format)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int format,
        -                int sampling)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int format,
        -                int sampling,
        -                boolean mipmaps)
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/opengl/Texture.html b/build/javadoc/core/processing/opengl/Texture.html deleted file mode 100644 index 145cc6159b..0000000000 --- a/build/javadoc/core/processing/opengl/Texture.html +++ /dev/null @@ -1,1463 +0,0 @@ - - - - - -Texture - - - - - - - - - - - -
-
processing.opengl
-

Class Texture

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    -
    public class Texture
    -extends Object
    -implements PConstants
    -
    This class wraps an OpenGL texture. - By Andres Colubri
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        width

        -
        public int width
        -
      • -
      - - - -
        -
      • -

        height

        -
        public int height
        -
      • -
      - - - -
        -
      • -

        glName

        -
        public int glName
        -
      • -
      - - - -
        -
      • -

        glTarget

        -
        public int glTarget
        -
      • -
      - - - -
        -
      • -

        glFormat

        -
        public int glFormat
        -
      • -
      - - - -
        -
      • -

        glMinFilter

        -
        public int glMinFilter
        -
      • -
      - - - -
        -
      • -

        glMagFilter

        -
        public int glMagFilter
        -
      • -
      - - - -
        -
      • -

        glWrapS

        -
        public int glWrapS
        -
      • -
      - - - -
        -
      • -

        glWrapT

        -
        public int glWrapT
        -
      • -
      - - - -
        -
      • -

        glWidth

        -
        public int glWidth
        -
      • -
      - - - -
        -
      • -

        glHeight

        -
        public int glHeight
        -
      • -
      - - - -
        -
      • -

        MAX_BUFFER_CACHE_SIZE

        -
        public static final int MAX_BUFFER_CACHE_SIZE
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - - - - - -
        -
      • -

        Texture

        -
        public Texture(PGraphicsOpenGL pg,
        -               int width,
        -               int height)
        -
        Creates an instance of PTexture with size width x height. The texture is - initialized (empty) to that size.
        -
        -
        Parameters:
        -
        width - int
        -
        height - int
        -
        -
      • -
      - - - -
        -
      • -

        Texture

        -
        public Texture(PGraphicsOpenGL pg,
        -               int width,
        -               int height,
        -               Object params)
        -
        Creates an instance of PTexture with size width x height and with the - specified parameters. The texture is initialized (empty) to that size.
        -
        -
        Parameters:
        -
        width - int
        -
        height - int
        -
        params - Parameters
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        init

        -
        public void init(int width,
        -                 int height)
        -
        Sets the size of the image and texture to width x height. If the texture is - already initialized, it first destroys the current OpenGL texture object - and then creates a new one with the specified size.
        -
        -
        Parameters:
        -
        width - int
        -
        height - int
        -
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init(int width,
        -                 int height,
        -                 Texture.Parameters params)
        -
        Sets the size of the image and texture to width x height, and the - parameters of the texture to params. If the texture is already initialized, - it first destroys the current OpenGL texture object and then creates a new - one with the specified size.
        -
        -
        Parameters:
        -
        width - int
        -
        height - int
        -
        params - GLTextureParameters
        -
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init(int width,
        -                 int height,
        -                 int glName,
        -                 int glTarget,
        -                 int glFormat,
        -                 int glWidth,
        -                 int glHeight,
        -                 int glMinFilter,
        -                 int glMagFilter,
        -                 int glWrapS,
        -                 int glWrapT)
        -
        Initializes the texture using GL parameters
        -
      • -
      - - - -
        -
      • -

        resize

        -
        public void resize(int wide,
        -                   int high)
        -
      • -
      - - - -
        -
      • -

        available

        -
        public boolean available()
        -
        Returns true if the texture has been initialized.
        -
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(Texture tex)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(Texture tex,
        -                int x,
        -                int y,
        -                int w,
        -                int h)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int texTarget,
        -                int texName,
        -                int texWidth,
        -                int texHeight,
        -                int w,
        -                int h)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int texTarget,
        -                int texName,
        -                int texWidth,
        -                int texHeight,
        -                int target,
        -                int tex,
        -                int x,
        -                int y,
        -                int w,
        -                int h)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int[] pixels)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int[] pixels,
        -                int format)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int[] pixels,
        -                int x,
        -                int y,
        -                int w,
        -                int h)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int[] pixels,
        -                int x,
        -                int y,
        -                int w,
        -                int h,
        -                int format)
        -
      • -
      - - - -
        -
      • -

        setNative

        -
        public void setNative(int[] pixels)
        -
      • -
      - - - -
        -
      • -

        setNative

        -
        public void setNative(int[] pixels,
        -                      int x,
        -                      int y,
        -                      int w,
        -                      int h)
        -
      • -
      - - - -
        -
      • -

        setNative

        -
        public void setNative(IntBuffer pixBuf,
        -                      int x,
        -                      int y,
        -                      int w,
        -                      int h)
        -
      • -
      - - - -
        -
      • -

        get

        -
        public void get(int[] pixels)
        -
        Copy texture to pixels. Involves video memory to main memory transfer (slow).
        -
      • -
      - - - -
        -
      • -

        put

        -
        public void put(Texture tex)
        -
      • -
      - - - -
        -
      • -

        put

        -
        public void put(Texture tex,
        -                int x,
        -                int y,
        -                int w,
        -                int h)
        -
      • -
      - - - -
        -
      • -

        put

        -
        public void put(int texTarget,
        -                int texName,
        -                int texWidth,
        -                int texHeight,
        -                int w,
        -                int h)
        -
      • -
      - - - -
        -
      • -

        put

        -
        public void put(int texTarget,
        -                int texName,
        -                int texWidth,
        -                int texHeight,
        -                int target,
        -                int tex,
        -                int x,
        -                int y,
        -                int w,
        -                int h)
        -
      • -
      - - - -
        -
      • -

        usingMipmaps

        -
        public boolean usingMipmaps()
        -
        Returns true or false whether or not the texture is using mipmaps.
        -
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        usingMipmaps

        -
        public void usingMipmaps(boolean mipmaps,
        -                         int sampling)
        -
      • -
      - - - -
        -
      • -

        usingRepeat

        -
        public boolean usingRepeat()
        -
        Returns true or false whether or not the texture is using repeat wrap mode - along either U or V directions.
        -
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        usingRepeat

        -
        public void usingRepeat(boolean repeat)
        -
      • -
      - - - -
        -
      • -

        maxTexcoordU

        -
        public float maxTexcoordU()
        -
        Returns the maximum possible value for the texture coordinate U - (horizontal).
        -
        -
        Returns:
        -
        float
        -
        -
      • -
      - - - -
        -
      • -

        maxTexcoordV

        -
        public float maxTexcoordV()
        -
        Returns the maximum possible value for the texture coordinate V (vertical).
        -
        -
        Returns:
        -
        float
        -
        -
      • -
      - - - -
        -
      • -

        invertedX

        -
        public boolean invertedX()
        -
        Returns true if the texture is inverted along the horizontal direction.
        -
        -
        Returns:
        -
        boolean;
        -
        -
      • -
      - - - -
        -
      • -

        invertedX

        -
        public void invertedX(boolean v)
        -
        Sets the texture as inverted or not along the horizontal direction.
        -
        -
        Parameters:
        -
        v - boolean;
        -
        -
      • -
      - - - -
        -
      • -

        invertedY

        -
        public boolean invertedY()
        -
        Returns true if the texture is inverted along the vertical direction.
        -
        -
        Returns:
        -
        boolean;
        -
        -
      • -
      - - - -
        -
      • -

        invertedY

        -
        public void invertedY(boolean v)
        -
        Sets the texture as inverted or not along the vertical direction.
        -
        -
        Parameters:
        -
        v - boolean;
        -
        -
      • -
      - - - -
        -
      • -

        currentSampling

        -
        public int currentSampling()
        -
      • -
      - - - -
        -
      • -

        bind

        -
        public void bind()
        -
      • -
      - - - -
        -
      • -

        unbind

        -
        public void unbind()
        -
      • -
      - - - -
        -
      • -

        bound

        -
        public boolean bound()
        -
      • -
      - - - -
        -
      • -

        isModified

        -
        public boolean isModified()
        -
      • -
      - - - -
        -
      • -

        setModified

        -
        public void setModified()
        -
      • -
      - - - -
        -
      • -

        setModified

        -
        public void setModified(boolean m)
        -
      • -
      - - - -
        -
      • -

        getModifiedX1

        -
        public int getModifiedX1()
        -
      • -
      - - - -
        -
      • -

        getModifiedX2

        -
        public int getModifiedX2()
        -
      • -
      - - - -
        -
      • -

        getModifiedY1

        -
        public int getModifiedY1()
        -
      • -
      - - - -
        -
      • -

        getModifiedY2

        -
        public int getModifiedY2()
        -
      • -
      - - - -
        -
      • -

        updateTexels

        -
        public void updateTexels()
        -
      • -
      - - - -
        -
      • -

        updateTexels

        -
        public void updateTexels(int x,
        -                         int y,
        -                         int w,
        -                         int h)
        -
      • -
      - - - -
        -
      • -

        setBufferSource

        -
        public void setBufferSource(Object source)
        -
      • -
      - - - -
        -
      • -

        copyBufferFromSource

        -
        public void copyBufferFromSource(Object natRef,
        -                                 ByteBuffer byteBuf,
        -                                 int w,
        -                                 int h)
        -
      • -
      - - - -
        -
      • -

        disposeSourceBuffer

        -
        public void disposeSourceBuffer()
        -
      • -
      - - - -
        -
      • -

        getBufferPixels

        -
        public void getBufferPixels(int[] pixels)
        -
      • -
      - - - -
        -
      • -

        hasBufferSource

        -
        public boolean hasBufferSource()
        -
      • -
      - - - -
        -
      • -

        hasBuffers

        -
        public boolean hasBuffers()
        -
      • -
      - - - -
        -
      • -

        colorBuffer

        -
        public void colorBuffer(boolean value)
        -
      • -
      - - - -
        -
      • -

        colorBuffer

        -
        public boolean colorBuffer()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/core/processing/opengl/package-frame.html b/build/javadoc/core/processing/opengl/package-frame.html deleted file mode 100644 index ae081f9501..0000000000 --- a/build/javadoc/core/processing/opengl/package-frame.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - -processing.opengl - - - - -

processing.opengl

- - - diff --git a/build/javadoc/core/processing/opengl/package-summary.html b/build/javadoc/core/processing/opengl/package-summary.html deleted file mode 100644 index b798a91ac4..0000000000 --- a/build/javadoc/core/processing/opengl/package-summary.html +++ /dev/null @@ -1,211 +0,0 @@ - - - - - -processing.opengl - - - - - - - - - - -
-

Package processing.opengl

-
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    FrameBuffer -
    Encapsulates a Frame Buffer Object for offscreen rendering.
    -
    LinePath -
    The LinePath class allows to represent polygonal paths, - potentially composed by several disjoint polygonal segments.
    -
    LinePath.PathIterator 
    LineStroker 
    PGL -
    Processing-OpenGL abstraction layer.
    -
    PGraphics2D 
    PGraphics3D 
    PGraphicsOpenGL -
    OpenGL renderer.
    -
    PJOGL 
    PShader -
    This class encapsulates a GLSL shader program, including a vertex - and a fragment shader.
    -
    PShapeOpenGL -
    This class holds a 3D model composed of vertices, normals, colors - (per vertex) and texture coordinates (also per vertex).
    -
    PSurfaceJOGL 
    Texture -
    This class wraps an OpenGL texture.
    -
    Texture.Parameters -
    This class stores the parameters for a texture: target, internal format, - minimization filter and magnification filter.
    -
    -
  • -
-
- - - - - - diff --git a/build/javadoc/core/processing/opengl/package-tree.html b/build/javadoc/core/processing/opengl/package-tree.html deleted file mode 100644 index 2fd6de3ae1..0000000000 --- a/build/javadoc/core/processing/opengl/package-tree.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - -processing.opengl Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.opengl

-Package Hierarchies: - -
-
-

Class Hierarchy

- -
- - - - - - diff --git a/build/javadoc/core/script.js b/build/javadoc/core/script.js deleted file mode 100644 index b346356931..0000000000 --- a/build/javadoc/core/script.js +++ /dev/null @@ -1,30 +0,0 @@ -function show(type) -{ - count = 0; - for (var key in methods) { - var row = document.getElementById(key); - if ((methods[key] & type) != 0) { - row.style.display = ''; - row.className = (count++ % 2) ? rowColor : altColor; - } - else - row.style.display = 'none'; - } - updateTabs(type); -} - -function updateTabs(type) -{ - for (var value in tabs) { - var sNode = document.getElementById(tabs[value][0]); - var spanNode = sNode.firstChild; - if (value == type) { - sNode.className = activeTableTab; - spanNode.innerHTML = tabs[value][1]; - } - else { - sNode.className = tableTab; - spanNode.innerHTML = "" + tabs[value][1] + ""; - } - } -} diff --git a/build/javadoc/core/serialized-form.html b/build/javadoc/core/serialized-form.html deleted file mode 100644 index 312b49cef7..0000000000 --- a/build/javadoc/core/serialized-form.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - - -Serialized Form - - - - - - - - - - -
-

Serialized Form

-
-
-
    -
  • -

    Package processing.core

    -
      -
    • - - -

      Class processing.core.PVector extends Object implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          x

          -
          float x
          -
          ( begin auto-generated from PVector_x.xml ) - - The x component of the vector. This field (variable) can be used to both - get and set the value (see above example.) - - ( end auto-generated )
          -
        • -
        • -

          y

          -
          float y
          -
          ( begin auto-generated from PVector_y.xml ) - - The y component of the vector. This field (variable) can be used to both - get and set the value (see above example.) - - ( end auto-generated )
          -
        • -
        • -

          z

          -
          float z
          -
          ( begin auto-generated from PVector_z.xml ) - - The z component of the vector. This field (variable) can be used to both - get and set the value (see above example.) - - ( end auto-generated )
          -
        • -
        -
      • -
      -
    • -
    -
  • -
  • -

    Package processing.data

    -
      -
    • - - -

      Class processing.data.XML extends Object implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          node

          -
          Node node
          -
          The internal representation, a DOM node.
          -
        • -
        • -

          parent

          -
          XML parent
          -
          The parent element.
          -
        • -
        • -

          children

          -
          XML[] children
          -
          Child elements, once loaded.
          -
        • -
        -
      • -
      -
    • -
    -
  • -
  • -

    Package processing.opengl

    -
      -
    • - - -

      Class processing.opengl.PGraphicsOpenGL.AttributeMap extends HashMap<String,processing.opengl.PGraphicsOpenGL.VertexAttribute> implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          names

          -
          ArrayList<E> names
          -
        • -
        • -

          numComp

          -
          int numComp
          -
        • -
        -
      • -
      -
    • -
    -
  • -
-
- - - - - - diff --git a/build/javadoc/core/stylesheet.css b/build/javadoc/core/stylesheet.css deleted file mode 100644 index cebb4fd8d5..0000000000 --- a/build/javadoc/core/stylesheet.css +++ /dev/null @@ -1,574 +0,0 @@ -/* Javadoc style sheet */ -/* -Overall document style -*/ - -@import url('resources/fonts/dejavu.css'); - -body { - background-color:#ffffff; - color:#353833; - font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; - font-size:14px; - margin:0; -} -a:link, a:visited { - text-decoration:none; - color:#4A6782; -} -a:hover, a:focus { - text-decoration:none; - color:#bb7a2a; -} -a:active { - text-decoration:none; - color:#4A6782; -} -a[name] { - color:#353833; -} -a[name]:hover { - text-decoration:none; - color:#353833; -} -pre { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; -} -h1 { - font-size:20px; -} -h2 { - font-size:18px; -} -h3 { - font-size:16px; - font-style:italic; -} -h4 { - font-size:13px; -} -h5 { - font-size:12px; -} -h6 { - font-size:11px; -} -ul { - list-style-type:disc; -} -code, tt { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - padding-top:4px; - margin-top:8px; - line-height:1.4em; -} -dt code { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - padding-top:4px; -} -table tr td dt code { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - vertical-align:top; - padding-top:4px; -} -sup { - font-size:8px; -} -/* -Document title and Copyright styles -*/ -.clear { - clear:both; - height:0px; - overflow:hidden; -} -.aboutLanguage { - float:right; - padding:0px 21px; - font-size:11px; - z-index:200; - margin-top:-9px; -} -.legalCopy { - margin-left:.5em; -} -.bar a, .bar a:link, .bar a:visited, .bar a:active { - color:#FFFFFF; - text-decoration:none; -} -.bar a:hover, .bar a:focus { - color:#bb7a2a; -} -.tab { - background-color:#0066FF; - color:#ffffff; - padding:8px; - width:5em; - font-weight:bold; -} -/* -Navigation bar styles -*/ -.bar { - background-color:#4D7A97; - color:#FFFFFF; - padding:.8em .5em .4em .8em; - height:auto;/*height:1.8em;*/ - font-size:11px; - margin:0; -} -.topNav { - background-color:#4D7A97; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; - font-size:12px; -} -.bottomNav { - margin-top:10px; - background-color:#4D7A97; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; - font-size:12px; -} -.subNav { - background-color:#dee3e9; - float:left; - width:100%; - overflow:hidden; - font-size:12px; -} -.subNav div { - clear:left; - float:left; - padding:0 0 5px 6px; - text-transform:uppercase; -} -ul.navList, ul.subNavList { - float:left; - margin:0 25px 0 0; - padding:0; -} -ul.navList li{ - list-style:none; - float:left; - padding: 5px 6px; - text-transform:uppercase; -} -ul.subNavList li{ - list-style:none; - float:left; -} -.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { - color:#FFFFFF; - text-decoration:none; - text-transform:uppercase; -} -.topNav a:hover, .bottomNav a:hover { - text-decoration:none; - color:#bb7a2a; - text-transform:uppercase; -} -.navBarCell1Rev { - background-color:#F8981D; - color:#253441; - margin: auto 5px; -} -.skipNav { - position:absolute; - top:auto; - left:-9999px; - overflow:hidden; -} -/* -Page header and footer styles -*/ -.header, .footer { - clear:both; - margin:0 20px; - padding:5px 0 0 0; -} -.indexHeader { - margin:10px; - position:relative; -} -.indexHeader span{ - margin-right:15px; -} -.indexHeader h1 { - font-size:13px; -} -.title { - color:#2c4557; - margin:10px 0; -} -.subTitle { - margin:5px 0 0 0; -} -.header ul { - margin:0 0 15px 0; - padding:0; -} -.footer ul { - margin:20px 0 5px 0; -} -.header ul li, .footer ul li { - list-style:none; - font-size:13px; -} -/* -Heading styles -*/ -div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { - background-color:#dee3e9; - border:1px solid #d0d9e0; - margin:0 0 6px -8px; - padding:7px 5px; -} -ul.blockList ul.blockList ul.blockList li.blockList h3 { - background-color:#dee3e9; - border:1px solid #d0d9e0; - margin:0 0 6px -8px; - padding:7px 5px; -} -ul.blockList ul.blockList li.blockList h3 { - padding:0; - margin:15px 0; -} -ul.blockList li.blockList h2 { - padding:0px 0 20px 0; -} -/* -Page layout container styles -*/ -.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { - clear:both; - padding:10px 20px; - position:relative; -} -.indexContainer { - margin:10px; - position:relative; - font-size:12px; -} -.indexContainer h2 { - font-size:13px; - padding:0 0 3px 0; -} -.indexContainer ul { - margin:0; - padding:0; -} -.indexContainer ul li { - list-style:none; - padding-top:2px; -} -.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { - font-size:12px; - font-weight:bold; - margin:10px 0 0 0; - color:#4E4E4E; -} -.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { - margin:5px 0 10px 0px; - font-size:14px; - font-family:'DejaVu Sans Mono',monospace; -} -.serializedFormContainer dl.nameValue dt { - margin-left:1px; - font-size:1.1em; - display:inline; - font-weight:bold; -} -.serializedFormContainer dl.nameValue dd { - margin:0 0 0 1px; - font-size:1.1em; - display:inline; -} -/* -List styles -*/ -ul.horizontal li { - display:inline; - font-size:0.9em; -} -ul.inheritance { - margin:0; - padding:0; -} -ul.inheritance li { - display:inline; - list-style:none; -} -ul.inheritance li ul.inheritance { - margin-left:15px; - padding-left:15px; - padding-top:1px; -} -ul.blockList, ul.blockListLast { - margin:10px 0 10px 0; - padding:0; -} -ul.blockList li.blockList, ul.blockListLast li.blockList { - list-style:none; - margin-bottom:15px; - line-height:1.4; -} -ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { - padding:0px 20px 5px 10px; - border:1px solid #ededed; - background-color:#f8f8f8; -} -ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { - padding:0 0 5px 8px; - background-color:#ffffff; - border:none; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { - margin-left:0; - padding-left:0; - padding-bottom:15px; - border:none; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { - list-style:none; - border-bottom:none; - padding-bottom:0; -} -table tr td dl, table tr td dl dt, table tr td dl dd { - margin-top:0; - margin-bottom:1px; -} -/* -Table styles -*/ -.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { - width:100%; - border-left:1px solid #EEE; - border-right:1px solid #EEE; - border-bottom:1px solid #EEE; -} -.overviewSummary, .memberSummary { - padding:0px; -} -.overviewSummary caption, .memberSummary caption, .typeSummary caption, -.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { - position:relative; - text-align:left; - background-repeat:no-repeat; - color:#253441; - font-weight:bold; - clear:none; - overflow:hidden; - padding:0px; - padding-top:10px; - padding-left:1px; - margin:0px; - white-space:pre; -} -.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, -.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, -.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, -.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, -.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, -.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, -.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, -.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { - color:#FFFFFF; -} -.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, -.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - padding-bottom:7px; - display:inline-block; - float:left; - background-color:#F8981D; - border: none; - height:16px; -} -.memberSummary caption span.activeTableTab span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - margin-right:3px; - display:inline-block; - float:left; - background-color:#F8981D; - height:16px; -} -.memberSummary caption span.tableTab span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - margin-right:3px; - display:inline-block; - float:left; - background-color:#4D7A97; - height:16px; -} -.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { - padding-top:0px; - padding-left:0px; - padding-right:0px; - background-image:none; - float:none; - display:inline; -} -.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, -.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { - display:none; - width:5px; - position:relative; - float:left; - background-color:#F8981D; -} -.memberSummary .activeTableTab .tabEnd { - display:none; - width:5px; - margin-right:3px; - position:relative; - float:left; - background-color:#F8981D; -} -.memberSummary .tableTab .tabEnd { - display:none; - width:5px; - margin-right:3px; - position:relative; - background-color:#4D7A97; - float:left; - -} -.overviewSummary td, .memberSummary td, .typeSummary td, -.useSummary td, .constantsSummary td, .deprecatedSummary td { - text-align:left; - padding:0px 0px 12px 10px; - width:100%; -} -th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, -td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ - vertical-align:top; - padding-right:0px; - padding-top:8px; - padding-bottom:3px; -} -th.colFirst, th.colLast, th.colOne, .constantsSummary th { - background:#dee3e9; - text-align:left; - padding:8px 3px 3px 7px; -} -td.colFirst, th.colFirst { - white-space:nowrap; - font-size:13px; -} -td.colLast, th.colLast { - font-size:13px; -} -td.colOne, th.colOne { - font-size:13px; -} -.overviewSummary td.colFirst, .overviewSummary th.colFirst, -.overviewSummary td.colOne, .overviewSummary th.colOne, -.memberSummary td.colFirst, .memberSummary th.colFirst, -.memberSummary td.colOne, .memberSummary th.colOne, -.typeSummary td.colFirst{ - width:25%; - vertical-align:top; -} -td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { - font-weight:bold; -} -.tableSubHeadingColor { - background-color:#EEEEFF; -} -.altColor { - background-color:#FFFFFF; -} -.rowColor { - background-color:#EEEEEF; -} -/* -Content styles -*/ -.description pre { - margin-top:0; -} -.deprecatedContent { - margin:0; - padding:10px 0; -} -.docSummary { - padding:0; -} - -ul.blockList ul.blockList ul.blockList li.blockList h3 { - font-style:normal; -} - -div.block { - font-size:14px; - font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; -} - -td.colLast div { - padding-top:0px; -} - - -td.colLast a { - padding-bottom:3px; -} -/* -Formatting effect styles -*/ -.sourceLineNo { - color:green; - padding:0 30px 0 0; -} -h1.hidden { - visibility:hidden; - overflow:hidden; - font-size:10px; -} -.block { - display:block; - margin:3px 10px 2px 0px; - color:#474747; -} -.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, -.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, -.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { - font-weight:bold; -} -.deprecationComment, .emphasizedPhrase, .interfaceName { - font-style:italic; -} - -div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, -div.block div.block span.interfaceName { - font-style:normal; -} - -div.contentContainer ul.blockList li.blockList h2{ - padding-bottom:0px; -} diff --git a/build/javadoc/everything/allclasses-frame.html b/build/javadoc/everything/allclasses-frame.html deleted file mode 100644 index dc9b3274ac..0000000000 --- a/build/javadoc/everything/allclasses-frame.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - - -All Classes - - - - -

All Classes

-
- -
- - diff --git a/build/javadoc/everything/allclasses-noframe.html b/build/javadoc/everything/allclasses-noframe.html deleted file mode 100644 index 16001d3dba..0000000000 --- a/build/javadoc/everything/allclasses-noframe.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - - -All Classes - - - - -

All Classes

-
- -
- - diff --git a/build/javadoc/everything/constant-values.html b/build/javadoc/everything/constant-values.html deleted file mode 100644 index d502c7e052..0000000000 --- a/build/javadoc/everything/constant-values.html +++ /dev/null @@ -1,6668 +0,0 @@ - - - - - -Constant Field Values - - - - - - - - - - - -
- - -

processing.app.*

-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.app.Editor 
    Modifier and TypeConstant FieldValue
    - -public static final intGUTTER_MARGIN3
    - -public static final intLEFT_GUTTER44
    - -public static final intRIGHT_GUTTER20
    -
  • -
  • - - - - - - - - - - - - - - -
    processing.app.EditorButton 
    Modifier and TypeConstant FieldValue
    - -public static final intDIM30
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.app.EditorStatus 
    Modifier and TypeConstant FieldValue
    - -public static final intEDIT2
    - -public static final intERR1
    - -public static final intNOTICE0
    -
  • -
  • - - - - - - - - - - - - - - -
    processing.app.Library 
    Modifier and TypeConstant FieldValue
    - -public static final StringpropertiesFileName"library.properties"
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.app.WebServer 
    Modifier and TypeConstant FieldValue
    - -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.core.*

- - - - -

processing.data.*

-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.data.Table 
    Modifier and TypeConstant FieldValue
    - -public static final intCATEGORY5
    - -public static final intDOUBLE4
    - -public static final intFLOAT3
    - -public static final intINT1
    - -public static final intLONG2
    - -public static final intSTRING0
    -
  • -
- - - -

processing.event.*

-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.event.Event 
    Modifier and TypeConstant FieldValue
    - -public static final intALT8
    - -public static final intCTRL2
    - -public static final intKEY1
    - -public static final intMETA4
    - -public static final intMOUSE2
    - -public static final intSHIFT1
    - -public static final intTOUCH3
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.event.KeyEvent 
    Modifier and TypeConstant FieldValue
    - -public static final intPRESS1
    - -public static final intRELEASE2
    - -public static final intTYPE3
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.event.MouseEvent 
    Modifier and TypeConstant FieldValue
    - -public static final intCLICK3
    - -public static final intDRAG4
    - -public static final intENTER6
    - -public static final intEXIT7
    - -public static final intMOVE5
    - -public static final intPRESS1
    - -public static final intRELEASE2
    - -public static final intWHEEL8
    -
  • -
- - - -

processing.mode.*

- - - - -

processing.opengl.*

-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.opengl.LinePath 
    Modifier and TypeConstant FieldValue
    - -public static final intCAP_BUTT0
    - -public static final intCAP_ROUND1
    - -public static final intCAP_SQUARE2
    - -public static final intJOIN_BEVEL2
    - -public static final intJOIN_MITER0
    - -public static final intJOIN_ROUND1
    - -public static final byteSEG_CLOSE2
    - -public static final byteSEG_LINETO1
    - -public static final byteSEG_MOVETO0
    - -public static final intWIND_EVEN_ODD0
    - -public static final intWIND_NON_ZERO1
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.opengl.PGL 
    Modifier and TypeConstant FieldValue
    - -public static final StringFRAMEBUFFER_ERROR"Framebuffer error (%1$s), rendering will probably not work as expected Read http://wiki.processing.org/w/OpenGL_Issues for help."
    - -public static final StringMISSING_FBO_ERROR"Framebuffer objects are not supported by this hardware (or driver) Read http://wiki.processing.org/w/OpenGL_Issues for help."
    - -public static final StringMISSING_GLFUNC_ERROR"GL function %1$s is not available on this hardware (or driver) Read http://wiki.processing.org/w/OpenGL_Issues for help."
    - -public static final StringMISSING_GLSL_ERROR"GLSL shaders are not supported by this hardware (or driver) Read http://wiki.processing.org/w/OpenGL_Issues for help."
    - -public static final StringNONPRIMARY_ERROR"The renderer is trying to call a PGL function that can only be called on a primary PGL. This is most likely due to a bug in the renderer\'s code, please report it with an issue on Processing\'s github page https://github.com/processing/processing/issues?state=open if using any of the built-in OpenGL renderers. If you are using a contributed library, contact the library\'s developers."
    - -public static final StringTEXUNIT_ERROR"Number of texture units not supported by this hardware (or driver) Read http://wiki.processing.org/w/OpenGL_Issues for help."
    - -public static final StringUNSUPPORTED_GLPROF_ERROR"Unsupported OpenGL profile."
    - -public static final StringWIKI" Read http://wiki.processing.org/w/OpenGL_Issues for help."
    -
  • -
  • - - - - - - - - - - - - - - - - - - - -
    processing.opengl.PJOGL 
    Modifier and TypeConstant FieldValue
    - -public static final intAWT0
    - -public static final intNEWT1
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    processing.opengl.PShapeOpenGL 
    Modifier and TypeConstant FieldValue
    - -public static final intDIRECTION3
    - -public static final intNORMAL1
    - -public static final intOFFSET4
    - -public static final intPOSITION0
    - -public static final intTEXCOORD2
    -
  • -
  • - - - - - - - - - - - - - - -
    processing.opengl.Texture 
    Modifier and TypeConstant FieldValue
    - -public static final intMAX_BUFFER_CACHE_SIZE3
    -
  • -
-
- - - - - - diff --git a/build/javadoc/everything/deprecated-list.html b/build/javadoc/everything/deprecated-list.html deleted file mode 100644 index 4e03e05588..0000000000 --- a/build/javadoc/everything/deprecated-list.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - - -Deprecated List - - - - - - - -
- - - - - - - -
- - -
-

Deprecated API

-

Contents

- -
-
- - - - - - - -
- -
- - - - - - - -
- - - - diff --git a/build/javadoc/everything/help-doc.html b/build/javadoc/everything/help-doc.html deleted file mode 100644 index d4b59da43b..0000000000 --- a/build/javadoc/everything/help-doc.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - -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 six 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.

    -
  • -
  • -

    All Classes

    -

    The All Classes link shows all classes and interfaces except non-static nested types.

    -
  • -
  • -

    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 deleted file mode 100644 index 15936c4442..0000000000 --- a/build/javadoc/everything/index-all.html +++ /dev/null @@ -1,17127 +0,0 @@ - - - - - -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 class PGraphics
-
 
-
AB - Static variable in class PGraphics
-
 
-
About - Class in processing.app
-
 
-
About(Frame) - Constructor for class About
-
 
-
abs(float) - Static method in class PApplet
-
-
( begin auto-generated from abs.xml ) - - Calculates the absolute value (magnitude) of a number.
-
-
abs(int) - Static method in class PApplet
-
 
-
ABSTRACT - Static variable in interface JavaTokenTypes
-
 
-
ABSTRACT - Static variable in interface PdePartialTokenTypes
-
 
-
ABSTRACT - Static variable in interface PdeTokenTypes
-
 
-
aCase() - Method in class JavaRecognizer
-
 
-
aCase() - Method in class PdeRecognizer
-
 
-
acos(float) - Static method in class PApplet
-
-
( begin auto-generated from acos.xml ) - - The inverse of cos(), returns the arc cosine of a value.
-
-
actionPerformed(ActionEvent) - Method in class EditorButton
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.backspace
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.backspace_word
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.clipboard_copy
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.clipboard_cut
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.clipboard_paste
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.delete
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.delete_word
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.document_end
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.document_home
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.end
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.home
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.insert_break
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.insert_char
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.insert_tab
-
 
-
actionPerformed(ActionListener, String) - Method in interface InputHandler.MacroRecorder
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.next_char
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.next_line
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.next_page
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.next_word
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.overwrite
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.prev_char
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.prev_line
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.prev_page
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.prev_word
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.repeat
-
 
-
actionPerformed(ActionEvent) - Method in class InputHandler.toggle_rect
-
 
-
activateRun() - Method in class EditorToolbar
-
 
-
activateStop() - Method in class EditorToolbar
-
 
-
activeProgram() - Method in class PdeRecognizer
-
 
-
activeTexture(int) - Method in class PGL
-
 
-
add(String, byte, boolean) - Method in class KeywordMap
-
-
Adds a key-value mapping.
-
-
ADD - Static variable in interface PConstants
-
 
-
add(PVector) - Method in class PVector
-
-
( begin auto-generated from PVector_add.xml ) - - Adds x, y, and z components to a vector, adds one vector to another, or - adds two independent vectors together.
-
-
add(float, float, float) - Method in class PVector
-
 
-
add(PVector, PVector) - Static method in class PVector
-
-
Add two vectors
-
-
add(PVector, PVector, PVector) - Static method in class PVector
-
-
Add two vectors into a target vector
-
-
add(String, float) - Method in class FloatDict
-
 
-
add(int, float) - Method in class FloatList
-
 
-
add(String, int) - Method in class IntDict
-
 
-
add(int, int) - Method in class IntList
-
 
-
addCaretListener(CaretListener) - Method in class JEditTextArea
-
-
Adds a caret change listener to this text area.
-
-
addChild(PShape) - Method in class PShape
-
 
-
addChild(PShape, int) - Method in class PShape
-
 
-
addChild(String) - Method in class XML
-
 
-
addChild(XML) - Method in class XML
-
 
-
addChild(PShape) - Method in class PShapeOpenGL
-
 
-
addChild(PShape, int) - Method in class PShapeOpenGL
-
 
-
addColoring(String, String) - Method in class PdeKeywords
-
-
Add a keyword, and the associated coloring.
-
-
addColoring(String, String) - Method in class TokenMarker
-
 
-
addColumn() - Method in class Table
-
 
-
addColumn(String) - Method in class Table
-
 
-
addColumn(String, int) - Method in class Table
-
 
-
addDefaultKeyBindings() - Method in class DefaultInputHandler
-
-
Sets up the default key bindings.
-
-
addDefaultKeyBindings() - Method in class InputHandler
-
-
Adds the default key bindings to this input handler.
-
-
addDisabledItem(JMenu, String) - Static method in class Toolkit
-
 
-
addFile(File) - Method in class Sketch
-
-
Add a file to the sketch.
-
-
addGap(Box) - Method in class EditorToolbar
-
 
-
additiveExpression() - Method in class JavaRecognizer
-
 
-
additiveExpression() - Method in class PdeRecognizer
-
 
-
addKeyBinding(String, ActionListener) - Method in class DefaultInputHandler
-
-
Adds a key binding to this input handler.
-
-
addKeyBinding(String, ActionListener) - Method in class InputHandler
-
-
Adds a key binding to this input handler.
-
-
addModeButtons(Box) - Method in class EditorToolbar
-
 
-
addName(String, PShape) - Method in class PShape
-
-
Add a shape to the name lookup table.
-
-
addPackageList(HashMap<String, ArrayList<Library>>) - Method in class Library
-
-
Add the packages provided by this library to the master list that maps - imports to specific libraries.
-
-
addPanel(String, Component) - Method in class EditorFooter
-
 
-
addPreprocOffset(int) - Method in class SketchCode
-
 
-
addRecent() - Method in class Editor
-
 
-
addRow() - Method in class Table
-
 
-
addRow(TableRow) - Method in class Table
-
 
-
addRow(Object[]) - Method in class Table
-
 
-
addRows(Table) - Method in class Table
-
 
-
addTarget(OutputStream) - Method in class StreamPump
-
 
-
addTarget(Writer) - Method in class StreamPump
-
 
-
addTarget(LineProcessor) - Method in class StreamPump
-
 
-
addUndoableEdit(UndoableEdit) - Method in class SyntaxDocument
-
-
Adds an undoable edit to this document's undo list.
-
-
AG - Static variable in class PGraphics
-
 
-
ALIASED_LINE_WIDTH_RANGE - Static variable in class PGL
-
 
-
ALIASED_POINT_SIZE_RANGE - Static variable in class PGL
-
 
-
alpha(int) - Method in class PApplet
-
-
( begin auto-generated from alpha.xml ) - - Extracts the alpha value from a color.
-
-
ALPHA - Static variable in interface PConstants
-
 
-
alpha(int) - Method in class PGraphics
-
-
( begin auto-generated from alpha.xml ) - - Extracts the alpha value from a color.
-
-
ALPHA - Static variable in class PGL
-
 
-
ALPHA8 - Static variable in class PGL
-
 
-
ALPHA_MASK - Static variable in class PImage
-
 
-
ALPHA_TEST - Static variable in class PGL
-
 
-
alphaFunc(int, float) - Method in class PGL
-
 
-
alphaFunc(int, float) - Method in class PJOGL
-
 
-
ALT - Static variable in interface PConstants
-
 
-
ALT - Static variable in class Event
-
 
-
ALWAYS - Static variable in class PGL
-
 
-
ambient(int) - Method in class PApplet
-
-
( begin auto-generated from ambient.xml ) - - Sets the ambient reflectance for shapes drawn to the screen.
-
-
ambient(float) - Method in class PApplet
-
 
-
ambient(float, float, float) - Method in class PApplet
-
 
-
AMBIENT - Static variable in interface PConstants
-
 
-
ambient(int) - Method in class PGraphics
-
-
( begin auto-generated from ambient.xml ) - - Sets the ambient reflectance for shapes drawn to the screen.
-
-
ambient(float) - Method in class PGraphics
-
 
-
ambient(float, float, float) - Method in class PGraphics
-
 
-
ambient(int) - Method in class PShape
-
 
-
ambient(float) - Method in class PShape
-
 
-
ambient(float, float, float) - Method in class PShape
-
 
-
ambientB - Variable in class PGraphics
-
 
-
ambientB - Variable in class PStyle
-
 
-
ambientColor - Variable in class PGraphics
-
 
-
ambientG - Variable in class PGraphics
-
 
-
ambientG - Variable in class PStyle
-
 
-
ambientLight(float, float, float) - Method in class PApplet
-
-
( begin auto-generated from ambientLight.xml ) - - Adds an ambient light.
-
-
ambientLight(float, float, float, float, float, float) - Method in class PApplet
-
 
-
ambientLight(float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from ambientLight.xml ) - - Adds an ambient light.
-
-
ambientLight(float, float, float, float, float, float) - Method in class PGraphics
-
 
-
ambientLight(float, float, float) - Method in class PGraphics2D
-
 
-
ambientLight(float, float, float, float, float, float) - Method in class PGraphics2D
-
 
-
ambientLight(float, float, float) - Method in class PGraphicsOpenGL
-
-
Add an ambient light based on the current color mode.
-
-
ambientLight(float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
-
Add an ambient light based on the current color mode.
-
-
ambientR - Variable in class PGraphics
-
 
-
ambientR - Variable in class PStyle
-
 
-
andExpression() - Method in class JavaRecognizer
-
 
-
andExpression() - Method in class PdeRecognizer
-
 
-
angleBetween(PVector, PVector) - Static method in class PVector
-
-
( begin auto-generated from PVector_angleBetween.xml ) - - Calculates and returns the angle (in radians) between two vectors.
-
-
anisoSamplingSupported - Static variable in class PGraphicsOpenGL
-
 
-
annotation() - Method in class JavaRecognizer
-
 
-
ANNOTATION - Static variable in interface JavaTokenTypes
-
 
-
ANNOTATION - Static variable in interface PdePartialTokenTypes
-
 
-
annotation() - Method in class PdeRecognizer
-
 
-
ANNOTATION - Static variable in interface PdeTokenTypes
-
 
-
ANNOTATION_ARRAY_INIT - Static variable in interface JavaTokenTypes
-
 
-
ANNOTATION_ARRAY_INIT - Static variable in interface PdePartialTokenTypes
-
 
-
ANNOTATION_ARRAY_INIT - Static variable in interface PdeTokenTypes
-
 
-
ANNOTATION_DEF - Static variable in interface JavaTokenTypes
-
 
-
ANNOTATION_DEF - Static variable in interface PdePartialTokenTypes
-
 
-
ANNOTATION_DEF - Static variable in interface PdeTokenTypes
-
 
-
ANNOTATION_FIELD_DEF - Static variable in interface JavaTokenTypes
-
 
-
ANNOTATION_FIELD_DEF - Static variable in interface PdePartialTokenTypes
-
 
-
ANNOTATION_FIELD_DEF - Static variable in interface PdeTokenTypes
-
 
-
ANNOTATION_MEMBER_VALUE_PAIR - Static variable in interface JavaTokenTypes
-
 
-
ANNOTATION_MEMBER_VALUE_PAIR - Static variable in interface PdePartialTokenTypes
-
 
-
ANNOTATION_MEMBER_VALUE_PAIR - Static variable in interface PdeTokenTypes
-
 
-
annotationArguments() - Method in class JavaRecognizer
-
 
-
annotationArguments() - Method in class PdeRecognizer
-
 
-
annotationBlock() - Method in class JavaRecognizer
-
 
-
annotationBlock() - Method in class PdeRecognizer
-
 
-
annotationDefinition(AST) - Method in class JavaRecognizer
-
 
-
annotationDefinition(AST) - Method in class PdeRecognizer
-
 
-
annotationField() - Method in class JavaRecognizer
-
 
-
annotationField() - Method in class PdeRecognizer
-
 
-
annotationMemberArrayInitializer() - Method in class JavaRecognizer
-
 
-
annotationMemberArrayInitializer() - Method in class PdeRecognizer
-
 
-
annotationMemberArrayValueInitializer() - Method in class JavaRecognizer
-
 
-
annotationMemberArrayValueInitializer() - Method in class PdeRecognizer
-
 
-
annotationMemberValueInitializer() - Method in class JavaRecognizer
-
 
-
annotationMemberValueInitializer() - Method in class PdeRecognizer
-
 
-
annotationMemberValuePair() - Method in class JavaRecognizer
-
 
-
annotationMemberValuePair() - Method in class PdeRecognizer
-
 
-
annotations() - Method in class JavaRecognizer
-
 
-
ANNOTATIONS - Static variable in interface JavaTokenTypes
-
 
-
ANNOTATIONS - Static variable in interface PdePartialTokenTypes
-
 
-
annotations() - Method in class PdeRecognizer
-
 
-
ANNOTATIONS - Static variable in interface PdeTokenTypes
-
 
-
anntotationMemberValuePairs() - Method in class JavaRecognizer
-
 
-
anntotationMemberValuePairs() - Method in class PdeRecognizer
-
 
-
append(byte[], byte) - Static method in class PApplet
-
-
( begin auto-generated from append.xml ) - - Expands an array by one element and adds data to the new position.
-
-
append(char[], char) - Static method in class PApplet
-
 
-
append(int[], int) - Static method in class PApplet
-
 
-
append(float[], float) - Static method in class PApplet
-
 
-
append(String[], String) - Static method in class PApplet
-
 
-
append(Object, Object) - Static method in class PApplet
-
 
-
append(float) - Method in class FloatList
-
-
Add a new entry to the list.
-
-
append(float[]) - Method in class FloatList
-
 
-
append(FloatList) - Method in class FloatList
-
 
-
append(int) - Method in class IntList
-
-
Add a new entry to the list.
-
-
append(int[]) - Method in class IntList
-
 
-
append(IntList) - Method in class IntList
-
 
-
append(String) - Method in class JSONArray
-
-
Append an String value.
-
-
append(int) - Method in class JSONArray
-
-
Append an int value.
-
-
append(long) - Method in class JSONArray
-
-
Append an long value.
-
-
append(float) - Method in class JSONArray
-
-
Append a float value.
-
-
append(double) - Method in class JSONArray
-
-
Append a double value.
-
-
append(boolean) - Method in class JSONArray
-
-
Append a boolean value.
-
-
append(JSONArray) - Method in class JSONArray
-
 
-
append(JSONObject) - Method in class JSONArray
-
 
-
append(String) - Method in class StringList
-
-
Add a new entry to the list.
-
-
append(String[]) - Method in class StringList
-
 
-
append(StringList) - Method in class StringList
-
 
-
appendUnique(float) - Method in class FloatList
-
-
Add this value, but only if it's not already in the list.
-
-
appendUnique(int) - Method in class IntList
-
-
Add this value, but only if it's not already in the list.
-
-
appendUnique(String) - Method in class StringList
-
-
Add this value, but only if it's not already in the list.
-
-
apply(PMatrix) - Method in interface PMatrix
-
-
Multiply this matrix by another.
-
-
apply(PMatrix2D) - Method in interface PMatrix
-
 
-
apply(PMatrix3D) - Method in interface PMatrix
-
 
-
apply(float, float, float, float, float, float) - Method in interface PMatrix
-
 
-
apply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in interface PMatrix
-
 
-
apply(PMatrix) - Method in class PMatrix2D
-
 
-
apply(PMatrix2D) - Method in class PMatrix2D
-
 
-
apply(PMatrix3D) - Method in class PMatrix2D
-
 
-
apply(float, float, float, float, float, float) - Method in class PMatrix2D
-
 
-
apply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PMatrix2D
-
 
-
apply(PMatrix) - Method in class PMatrix3D
-
 
-
apply(PMatrix2D) - Method in class PMatrix3D
-
 
-
apply(PMatrix3D) - Method in class PMatrix3D
-
 
-
apply(float, float, float, float, float, float) - Method in class PMatrix3D
-
 
-
apply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PMatrix3D
-
 
-
applyMatrix(PMatrix) - Method in class PApplet
-
-
( begin auto-generated from applyMatrix.xml ) - - Multiplies the current matrix by the one specified through the - parameters.
-
-
applyMatrix(PMatrix2D) - Method in class PApplet
-
 
-
applyMatrix(float, float, float, float, float, float) - Method in class PApplet
-
 
-
applyMatrix(PMatrix3D) - Method in class PApplet
-
 
-
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PApplet
-
 
-
applyMatrix(PMatrix) - Method in class PGraphics
-
-
( begin auto-generated from applyMatrix.xml ) - - Multiplies the current matrix by the one specified through the - parameters.
-
-
applyMatrix(PMatrix2D) - Method in class PGraphics
-
 
-
applyMatrix(float, float, float, float, float, float) - Method in class PGraphics
-
 
-
applyMatrix(PMatrix3D) - Method in class PGraphics
-
 
-
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PGraphics
-
 
-
applyMatrix(float, float, float, float, float, float) - Method in class PGraphicsFX2D
-
 
-
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PGraphicsFX2D
-
 
-
applyMatrix(float, float, float, float, float, float) - Method in class PGraphicsJava2D
-
 
-
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PGraphicsJava2D
-
 
-
applyMatrix(PMatrix) - Method in class PShape
-
 
-
applyMatrix(PMatrix2D) - Method in class PShape
-
 
-
applyMatrix(float, float, float, float, float, float) - Method in class PShape
-
 
-
applyMatrix(PMatrix3D) - Method in class PShape
-
 
-
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PShape
-
 
-
applyMatrix(PMatrix3D) - Method in class PGraphics2D
-
 
-
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PGraphics2D
-
 
-
applyMatrix(PMatrix2D) - Method in class PGraphicsOpenGL
-
 
-
applyMatrix(float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
applyMatrix(PMatrix3D) - Method in class PGraphicsOpenGL
-
 
-
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
-
Apply a 4x4 transformation matrix to the modelview stack.
-
-
applyMatrix(PMatrix2D) - Method in class PShapeOpenGL
-
 
-
applyMatrix(float, float, float, float, float, float) - Method in class PShapeOpenGL
-
 
-
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PShapeOpenGL
-
 
-
applyProjection(PMatrix3D) - Method in class PGraphicsOpenGL
-
 
-
applyProjection(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
AR - Static variable in class PGraphics
-
 
-
arc(float, float, float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from arc.xml ) - - Draws an arc in the display window.
-
-
arc(float, float, float, float, float, float, int) - Method in class PApplet
-
 
-
ARC - Static variable in interface PConstants
-
 
-
arc(float, float, float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from arc.xml ) - - Draws an arc in the display window.
-
-
arc(float, float, float, float, float, float, int) - Method in class PGraphics
-
 
-
Archiver - Class in processing.app.tools
-
 
-
Archiver() - Constructor for class Archiver
-
 
-
ARGB - Static variable in interface PConstants
-
 
-
argList() - Method in class JavaRecognizer
-
 
-
argList() - Method in class PdeRecognizer
-
 
-
args - Variable in class PApplet
-
-
Command line options passed in from main().
-
-
ARGS_DISPLAY - Static variable in class PApplet
-
-
Used by the PDE to suggest a display (set in prefs, passed on Run)
-
-
ARGS_EDITOR_LOCATION - Static variable in class PApplet
-
-
Position of the upper-lefthand corner of the editor window - that launched this applet.
-
-
ARGS_EXTERNAL - Static variable in class PApplet
-
 
-
ARGS_HIDE_STOP - Static variable in class PApplet
-
 
-
ARGS_LOCATION - Static variable in class PApplet
-
-
Location for where to position the applet window on screen.
-
-
ARGS_PRESENT - Static variable in class PApplet
-
 
-
ARGS_SKETCH_FOLDER - Static variable in class PApplet
-
-
Allows the user or PdeEditor to set a specific sketch folder path.
-
-
ARGS_STOP_COLOR - Static variable in class PApplet
-
 
-
ARGS_WINDOW_COLOR - Static variable in class PApplet
-
 
-
array() - Method in class PVector
-
-
( begin auto-generated from PVector_array.xml ) - - Return a representation of this vector as a float array.
-
-
array() - Method in class FloatList
-
-
Create a new array with a copy of all the values.
-
-
array(float[]) - Method in class FloatList
-
-
Copy values into the specified array.
-
-
array() - Method in class IntList
-
-
Create a new array with a copy of all the values.
-
-
array(int[]) - Method in class IntList
-
-
Copy values into the specified array.
-
-
array() - Method in class StringList
-
-
Create a new array with a copy of all the values.
-
-
array(String[]) - Method in class StringList
-
-
Copy values into the specified array.
-
-
ARRAY_BUFFER - Static variable in class PGL
-
 
-
ARRAY_DECLARATOR - Static variable in interface JavaTokenTypes
-
 
-
ARRAY_DECLARATOR - Static variable in interface PdePartialTokenTypes
-
 
-
ARRAY_DECLARATOR - Static variable in interface PdeTokenTypes
-
 
-
ARRAY_INIT - Static variable in interface JavaTokenTypes
-
 
-
ARRAY_INIT - Static variable in interface PdePartialTokenTypes
-
 
-
ARRAY_INIT - Static variable in interface PdeTokenTypes
-
 
-
arrayCopy(Object, int, Object, int, int) - Static method in class PApplet
-
-
( begin auto-generated from arrayCopy.xml ) - - Copies an array (or part of an array) to another array.
-
-
arrayCopy(Object, Object, int) - Static method in class PApplet
-
-
Convenience method for arraycopy().
-
-
arrayCopy(Object, Object) - Static method in class PApplet
-
-
Shortcut to copy the entire contents of - the source into the destination array.
-
-
arraycopy(Object, int, Object, int, int) - Static method in class PApplet
-
-
Deprecated. -
Use arrayCopy() instead.
-
-
-
arraycopy(Object, Object, int) - Static method in class PApplet
-
-
Deprecated. -
Use arrayCopy() instead.
-
-
-
arraycopy(Object, Object) - Static method in class PApplet
-
-
Deprecated. -
Use arrayCopy() instead.
-
-
-
arrayInitializer() - Method in class JavaRecognizer
-
 
-
arrayInitializer() - Method in class PdeRecognizer
-
 
-
ARROW - Static variable in interface PConstants
-
 
-
ascent() - Method in class PFont
-
-
Returns the ascent of this font from the baseline.
-
-
asin(float) - Static method in class PApplet
-
-
( begin auto-generated from asin.xml ) - - The inverse of sin(), returns the arc sine of a value.
-
-
ASSIGN - Static variable in interface JavaTokenTypes
-
 
-
ASSIGN - Static variable in interface PdePartialTokenTypes
-
 
-
ASSIGN - Static variable in interface PdeTokenTypes
-
 
-
assignmentExpression() - Method in class JavaRecognizer
-
 
-
assignmentExpression() - Method in class PdeRecognizer
-
 
-
AT - Static variable in interface JavaTokenTypes
-
 
-
AT - Static variable in interface PdePartialTokenTypes
-
 
-
AT - Static variable in interface PdeTokenTypes
-
 
-
atan(float) - Static method in class PApplet
-
-
( begin auto-generated from atan.xml ) - - The inverse of tan(), returns the arc tangent of a value.
-
-
atan2(float, float) - Static method in class PApplet
-
-
( begin auto-generated from atan2.xml ) - - Calculates the angle (in radians) from a specified point to the - coordinate origin as measured from the positive x-axis.
-
-
attachShader(int, int) - Method in class PGL
-
 
-
attachShader(int, int) - Method in class PJOGL
-
 
-
attrib(String, float...) - Method in class PApplet
-
 
-
attrib(String, int...) - Method in class PApplet
-
 
-
attrib(String, boolean...) - Method in class PApplet
-
 
-
attrib(String, float...) - Method in class PGraphics
-
 
-
attrib(String, int...) - Method in class PGraphics
-
 
-
attrib(String, boolean...) - Method in class PGraphics
-
 
-
attrib(String, float...) - Method in class PShape
-
 
-
attrib(String, int...) - Method in class PShape
-
 
-
attrib(String, boolean...) - Method in class PShape
-
 
-
attrib(String, float...) - Method in class PGraphicsOpenGL
-
 
-
attrib(String, int...) - Method in class PGraphicsOpenGL
-
 
-
attrib(String, boolean...) - Method in class PGraphicsOpenGL
-
 
-
attrib(String, float...) - Method in class PShapeOpenGL
-
 
-
attrib(String, int...) - Method in class PShapeOpenGL
-
 
-
attrib(String, boolean...) - Method in class PShapeOpenGL
-
 
-
autoMipmapGenSupported - Static variable in class PGraphicsOpenGL
-
 
-
available() - Method in class Texture
-
-
Returns true if the texture has been initialized.
-
-
AvailableContribution - Class in processing.app.contrib
-
-
A class to hold information about a Contribution that can be downloaded.
-
-
AvailableContribution(ContributionType, Map<String, String>) - Constructor for class AvailableContribution
-
 
-
AWT - Static variable in class PJOGL
-
 
-
- - - -

B

-
-
B - Static variable in class PGraphics
-
 
-
BACK - Static variable in class PGL
-
 
-
background(int) - Method in class PApplet
-
-
( begin auto-generated from background.xml ) - - The background() function sets the color used for the background - of the Processing window.
-
-
background(int, float) - Method in class PApplet
-
 
-
background(float) - Method in class PApplet
-
 
-
background(float, float) - Method in class PApplet
-
 
-
background(float, float, float) - Method in class PApplet
-
 
-
background(float, float, float, float) - Method in class PApplet
-
 
-
background(PImage) - Method in class PApplet
-
-
Takes an RGB or ARGB image and sets it as the background.
-
-
background(int) - Method in class PGraphics
-
-
( begin auto-generated from background.xml ) - - The background() function sets the color used for the background - of the Processing window.
-
-
background(int, float) - Method in class PGraphics
-
 
-
background(float) - Method in class PGraphics
-
 
-
background(float, float) - Method in class PGraphics
-
 
-
background(float, float, float) - Method in class PGraphics
-
 
-
background(float, float, float, float) - Method in class PGraphics
-
 
-
background(PImage) - Method in class PGraphics
-
-
Takes an RGB or ARGB image and sets it as the background.
-
-
backgroundColor - Variable in class PGraphics
-
-
Last background color that was set, zero if an image
-
-
backgroundImpl() - Method in class PGraphicsFX2D
-
 
-
backgroundImpl() - Method in class PGraphicsJava2D
-
 
-
BACKSPACE - Static variable in class InputHandler
-
 
-
backspace() - Constructor for class InputHandler.backspace
-
 
-
BACKSPACE - Static variable in interface PConstants
-
 
-
BACKSPACE_WORD - Static variable in class InputHandler
-
 
-
backspace_word() - Constructor for class InputHandler.backspace_word
-
 
-
BAND - Static variable in interface JavaTokenTypes
-
 
-
BAND - Static variable in interface PdePartialTokenTypes
-
 
-
BAND - Static variable in interface PdeTokenTypes
-
 
-
BAND_ASSIGN - Static variable in interface JavaTokenTypes
-
 
-
BAND_ASSIGN - Static variable in interface PdePartialTokenTypes
-
 
-
BAND_ASSIGN - Static variable in interface PdeTokenTypes
-
 
-
Base - Class in processing.app
-
-
The base class for the main processing application.
-
-
Base(String[]) - Constructor for class Base
-
 
-
BASELINE - Static variable in interface PConstants
-
-
Default vertical alignment for text placement
-
-
BEEN_LIT - Static variable in class PGraphics
-
 
-
beep() - Static method in class Toolkit
-
 
-
beginCamera() - Method in class PApplet
-
-
( begin auto-generated from beginCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
-
-
beginCamera() - Method in class PGraphics
-
-
( begin auto-generated from beginCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
-
-
beginCamera() - Method in class PGraphics2D
-
 
-
beginCamera() - Method in class PGraphicsOpenGL
-
-
Set matrix mode to the camera matrix (instead of the current transformation - matrix).
-
-
beginCompositionText(AttributedCharacterIterator, int) - Method in class CompositionTextManager
-
-
Called when a user begins input from input method.
-
-
beginCompoundEdit() - Method in class SyntaxDocument
-
-
Starts a compound edit that can be undone in one operation.
-
-
beginContour() - Method in class PApplet
-
 
-
beginContour() - Method in class PGraphics
-
 
-
beginContour() - Method in class PGraphicsFX2D
-
 
-
beginContour() - Method in class PGraphicsJava2D
-
 
-
beginContour() - Method in class PShape
-
 
-
beginContour() - Method in class PGraphicsOpenGL
-
 
-
beginDraw() - Method in class PGraphics
-
-
( begin auto-generated from PGraphics_beginDraw.xml ) - - Sets the default properties for a PGraphics object.
-
-
beginDraw() - Method in class PGraphicsDanger2D
-
 
-
beginDraw() - Method in class PGraphicsFX2D
-
 
-
beginDraw() - Method in class PGraphicsJava2D
-
 
-
beginDraw() - Method in class PGraphicsOpenGL
-
-
OpenGL cannot draw until a proper native peer is available, so this - returns the value of PApplet.isDisplayable() (inherited from Component).
-
-
beginPGL() - Method in class PApplet
-
 
-
beginPGL() - Method in class PGraphics
-
 
-
beginPGL() - Method in class PGraphicsOpenGL
-
 
-
beginRaw(String, String) - Method in class PApplet
-
-
( begin auto-generated from beginRaw.xml ) - - To create vectors from 3D data, use the beginRaw() and - endRaw() commands.
-
-
beginRaw(PGraphics) - Method in class PApplet
-
 
-
beginRaw(PGraphics) - Method in class PGraphics
-
-
Record individual lines and triangles by echoing them to another renderer.
-
-
beginRaw(PGraphics) - Method in class PGraphicsJava2D
-
 
-
beginRecord(String, String) - Method in class PApplet
-
-
( begin auto-generated from beginRecord.xml ) - - Opens a new file and all subsequent drawing functions are echoed to this - file as well as the display window.
-
-
beginRecord(PGraphics) - Method in class PApplet
-
 
-
beginShape() - Method in class PApplet
-
-
Start a new shape of type POLYGON
-
-
beginShape(int) - Method in class PApplet
-
-
( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms.
-
-
beginShape() - Method in class PGraphics
-
-
Start a new shape of type POLYGON
-
-
beginShape(int) - Method in class PGraphics
-
-
( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms.
-
-
beginShape(int) - Method in class PGraphicsFX2D
-
 
-
beginShape(int) - Method in class PGraphicsJava2D
-
 
-
beginShape() - Method in class PShape
-
 
-
beginShape(int) - Method in class PShape
-
 
-
beginShape(int) - Method in class PGraphicsOpenGL
-
 
-
BEVEL - Static variable in interface PConstants
-
 
-
bezier(float, float, float, float, float, float, float, float) - Method in class PApplet
-
 
-
bezier(float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from bezier.xml ) - - Draws a Bezier curve on the screen.
-
-
bezier(float, float, float, float, float, float, float, float) - Method in class PGraphics
-
 
-
bezier(float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from bezier.xml ) - - Draws a Bezier curve on the screen.
-
-
BEZIER_VERTEX - Static variable in interface PConstants
-
 
-
bezierDetail(int) - Method in class PApplet
-
-
( begin auto-generated from bezierDetail.xml ) - - Sets the resolution at which Beziers display.
-
-
bezierDetail - Variable in class PGraphics
-
 
-
bezierDetail(int) - Method in class PGraphics
-
-
( begin auto-generated from bezierDetail.xml ) - - Sets the resolution at which Beziers display.
-
-
bezierDetail(int) - Method in class PGraphicsFX2D
-
-
Ignored (not needed) by this renderer.
-
-
bezierDetail(int) - Method in class PGraphicsJava2D
-
-
Ignored (not needed) in Java 2D.
-
-
bezierDetail(int) - Method in class PShape
-
 
-
bezierDetail(int) - Method in class PShapeOpenGL
-
 
-
bezierPoint(float, float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from bezierPoint.xml ) - - Evaluates the Bezier at point t for points a, b, c, d.
-
-
bezierPoint(float, float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from bezierPoint.xml ) - - Evaluates the Bezier at point t for points a, b, c, d.
-
-
bezierTangent(float, float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from bezierTangent.xml ) - - Calculates the tangent of a point on a Bezier curve.
-
-
bezierTangent(float, float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from bezierTangent.xml ) - - Calculates the tangent of a point on a Bezier curve.
-
-
bezierVertex(float, float, float, float, float, float) - Method in class PApplet
-
 
-
bezierVertex(float, float, float, float, float, float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves.
-
-
bezierVertex(float, float, float, float, float, float) - Method in class PGraphics
-
 
-
bezierVertex(float, float, float, float, float, float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves.
-
-
bezierVertex(float, float, float, float, float, float) - Method in class PGraphicsFX2D
-
 
-
bezierVertex(float, float, float, float, float, float, float, float, float) - Method in class PGraphicsFX2D
-
 
-
bezierVertex(float, float, float, float, float, float) - Method in class PGraphicsJava2D
-
 
-
bezierVertex(float, float, float, float, float, float, float, float, float) - Method in class PGraphicsJava2D
-
 
-
bezierVertex(float, float, float, float, float, float) - Method in class PShape
-
 
-
bezierVertex(float, float, float, float, float, float, float, float, float) - Method in class PShape
-
 
-
bezierVertex(float, float, float, float, float, float, float, float, float) - Method in class PGraphics2D
-
 
-
bezierVertex(float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
bezierVertex(float, float, float, float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
bezierVertex(float, float, float, float, float, float) - Method in class PShapeOpenGL
-
 
-
bezierVertex(float, float, float, float, float, float, float, float, float) - Method in class PShapeOpenGL
-
 
-
bgcolor - Variable in class TextAreaDefaults
-
 
-
binary(byte) - Static method in class PApplet
-
-
Returns a String that contains the binary value of a byte.
-
-
binary(char) - Static method in class PApplet
-
-
Returns a String that contains the binary value of a char.
-
-
binary(int) - Static method in class PApplet
-
-
Returns a String that contains the binary value of an int.
-
-
binary(int, int) - Static method in class PApplet
-
-
( begin auto-generated from binary.xml ) - - Converts a byte, char, int, or color to a String containing the - equivalent binary notation.
-
-
bind() - Method in class FrameBuffer
-
 
-
bind() - Method in class PShader
-
-
Initializes (if needed) and binds the shader program.
-
-
bind() - Method in class Texture
-
 
-
bindAttribLocation(int, int, String) - Method in class PGL
-
 
-
bindAttribLocation(int, int, String) - Method in class PJOGL
-
 
-
bindBuffer(int, int) - Method in class PGL
-
 
-
bindBuffer(int, int) - Method in class PJOGL
-
 
-
bindFramebuffer(int, int) - Method in class PGL
-
 
-
bindRenderbuffer(int, int) - Method in class PGL
-
 
-
bindRenderbuffer(int, int) - Method in class PJOGL
-
 
-
bindTexture(int, int) - Method in class PGL
-
 
-
blend(int, int, int, int, int, int, int, int, int) - Method in class PApplet
-
 
-
blend(PImage, int, int, int, int, int, int, int, int, int) - Method in class PApplet
-
-
( begin auto-generated from PImage_blend.xml ) - - Blends a region of pixels into the image specified by the img - parameter.
-
-
BLEND - Static variable in interface PConstants
-
 
-
blend(int, int, int, int, int) - Method in class PGraphicsDanger2D
-
 
-
blend(PImage, int, int, int, int, int) - Method in class PGraphicsDanger2D
-
 
-
blend(int, int, int, int, int, int, int, int, int) - Method in class PGraphicsDanger2D
-
 
-
blend(PImage, int, int, int, int, int, int, int, int, int) - Method in class PGraphicsDanger2D
-
 
-
blend(int, int, int, int, int, int, int, int, int) - Method in class PImage
-
 
-
blend(PImage, int, int, int, int, int, int, int, int, int) - Method in class PImage
-
-
( begin auto-generated from PImage_blend.xml ) - - Blends a region of pixels into the image specified by the img - parameter.
-
-
BLEND - Static variable in class PGL
-
 
-
blendColor(int, int, int) - Static method in class PApplet
-
 
-
blendColor(int, int, int) - Static method in class PImage
-
-
( begin auto-generated from blendColor.xml ) - - Blends two color values together based on the blending mode given as the - MODE parameter.
-
-
blendColor(float, float, float, float) - Method in class PGL
-
 
-
blendColor(float, float, float, float) - Method in class PJOGL
-
 
-
blendEqSupported - Static variable in class PGraphicsOpenGL
-
 
-
blendEquation(int) - Method in class PGL
-
 
-
blendEquation(int) - Method in class PJOGL
-
 
-
blendEquationSeparate(int, int) - Method in class PGL
-
 
-
blendEquationSeparate(int, int) - Method in class PJOGL
-
 
-
blendFunc(int, int) - Method in class PGL
-
 
-
blendFunc(int, int) - Method in class PJOGL
-
 
-
blendFuncSeparate(int, int, int, int) - Method in class PGL
-
 
-
blendFuncSeparate(int, int, int, int) - Method in class PJOGL
-
 
-
blendMode(int) - Method in class PApplet
-
-
( begin auto-generated from blendMode.xml ) - - This is a new reference entry for Processing 2.0.
-
-
blendMode(int) - Method in class PGraphics
-
-
( begin auto-generated from blendMode.xml ) - - This is a new reference entry for Processing 2.0.
-
-
blendMode - Variable in class PStyle
-
 
-
blinkCaret() - Method in class JEditTextArea
-
-
Blinks the caret.
-
-
blitFramebuffer(int, int, int, int, int, int, int, int, int, int) - Method in class PGL
-
 
-
blitFramebuffer(int, int, int, int, int, int, int, int, int, int) - Method in class PJOGL
-
 
-
BLOCK - Static variable in interface JavaTokenTypes
-
 
-
BLOCK - Static variable in interface PdePartialTokenTypes
-
 
-
BLOCK - Static variable in interface PdeTokenTypes
-
 
-
blockCaret - Variable in class TextAreaDefaults
-
 
-
blue(int) - Method in class PApplet
-
-
( begin auto-generated from blue.xml ) - - Extracts the blue value from a color, scaled to match current - colorMode().
-
-
blue(int) - Method in class PGraphics
-
-
( begin auto-generated from blue.xml ) - - Extracts the blue value from a color, scaled to match current - colorMode().
-
-
BLUE_MASK - Static variable in class PImage
-
 
-
BLUR - Static variable in interface PConstants
-
 
-
BNOT - Static variable in interface JavaTokenTypes
-
 
-
BNOT - Static variable in interface PdePartialTokenTypes
-
 
-
BNOT - Static variable in interface PdeTokenTypes
-
 
-
BOOL - Static variable in class PGL
-
 
-
BOOL_VEC2 - Static variable in class PGL
-
 
-
BOOL_VEC3 - Static variable in class PGL
-
 
-
BOOL_VEC4 - Static variable in class PGL
-
 
-
BOR - Static variable in interface JavaTokenTypes
-
 
-
BOR - Static variable in interface PdePartialTokenTypes
-
 
-
BOR - Static variable in interface PdeTokenTypes
-
 
-
BOR_ASSIGN - Static variable in interface JavaTokenTypes
-
 
-
BOR_ASSIGN - Static variable in interface PdePartialTokenTypes
-
 
-
BOR_ASSIGN - Static variable in interface PdeTokenTypes
-
 
-
BOTTOM - Static variable in interface PConstants
-
-
Align text from the bottom, using the baseline.
-
-
bound() - Method in class PShader
-
-
Returns true if the shader is bound, false otherwise.
-
-
bound() - Method in class Texture
-
 
-
box(float) - Method in class PApplet
-
-
( begin auto-generated from box.xml ) - - A box is an extruded rectangle.
-
-
box(float, float, float) - Method in class PApplet
-
 
-
BOX - Static variable in interface PConstants
-
 
-
box(float) - Method in class PGraphics
-
-
( begin auto-generated from box.xml ) - - A box is an extruded rectangle.
-
-
box(float, float, float) - Method in class PGraphics
-
 
-
box(float, float, float) - Method in class PGraphicsFX2D
-
 
-
box(float, float, float) - Method in class PGraphicsJava2D
-
 
-
box(float, float, float) - Method in class PGraphics2D
-
 
-
box(float, float, float) - Method in class PGraphicsOpenGL
-
 
-
bracketHighlight - Variable in class TextAreaDefaults
-
 
-
bracketHighlightColor - Variable in class TextAreaDefaults
-
 
-
Brackets - Class in processing.app.syntax
-
 
-
Brackets() - Constructor for class Brackets
-
 
-
BREAK - Static variable in interface PConstants
-
 
-
brightness(int) - Method in class PApplet
-
-
( begin auto-generated from brightness.xml ) - - Extracts the brightness value from a color.
-
-
brightness(int) - Method in class PGraphics
-
-
( begin auto-generated from brightness.xml ) - - Extracts the brightness value from a color.
-
-
BSR - Static variable in interface JavaTokenTypes
-
 
-
BSR - Static variable in interface PdePartialTokenTypes
-
 
-
BSR - Static variable in interface PdeTokenTypes
-
 
-
BSR_ASSIGN - Static variable in interface JavaTokenTypes
-
 
-
BSR_ASSIGN - Static variable in interface PdePartialTokenTypes
-
 
-
BSR_ASSIGN - Static variable in interface PdeTokenTypes
-
 
-
BUFFER_SIZE - Static variable in class PGL
-
 
-
BUFFER_USAGE - Static variable in class PGL
-
 
-
bufferData(int, int, Buffer, int) - Method in class PGL
-
 
-
bufferData(int, int, Buffer, int) - Method in class PJOGL
-
 
-
bufferSubData(int, int, int, Buffer) - Method in class PGL
-
 
-
bufferSubData(int, int, int, Buffer) - Method in class PJOGL
-
 
-
build() - Method in class CreateFont
-
 
-
buildExamplesTree() - Method in class Mode
-
 
-
buildFileMenu() - Method in class Editor
-
 
-
buildHelpMenu() - Method in class Editor
-
 
-
buildModeMenu() - Method in class Editor
-
-
Override this if you want a special menu for your particular 'mode'.
-
-
buildSketchbookTree() - Method in class Mode
-
 
-
buildSketchMenu() - Method in class Editor
-
 
-
buildZip(File, String, ZipOutputStream) - Method in class Archiver
-
 
-
builtInConsCastType() - Method in class PdeRecognizer
-
 
-
builtInConsCastTypeSpec(boolean) - Method in class PdeRecognizer
-
 
-
builtInType() - Method in class JavaRecognizer
-
 
-
builtInType() - Method in class PdeRecognizer
-
 
-
builtInTypeArraySpec(boolean) - Method in class JavaRecognizer
-
 
-
builtInTypeArraySpec(boolean) - Method in class PdeRecognizer
-
 
-
builtInTypeSpec(boolean) - Method in class JavaRecognizer
-
 
-
builtInTypeSpec(boolean) - Method in class PdeRecognizer
-
 
-
BURN - Static variable in interface PConstants
-
 
-
BUTTON_WIDTH - Static variable in class Preferences
-
-
Standardized width for buttons.
-
-
BXOR - Static variable in interface JavaTokenTypes
-
 
-
BXOR - Static variable in interface PdePartialTokenTypes
-
 
-
BXOR - Static variable in interface PdeTokenTypes
-
 
-
BXOR_ASSIGN - Static variable in interface JavaTokenTypes
-
 
-
BXOR_ASSIGN - Static variable in interface PdePartialTokenTypes
-
 
-
BXOR_ASSIGN - Static variable in interface PdeTokenTypes
-
 
-
BYTE - Static variable in class PGL
-
 
-
- - - -

C

-
-
calcFolderSize(File) - Static method in class Base
-
-
Calculate the size of the contents of a folder.
-
-
camera() - Method in class PApplet
-
-
( begin auto-generated from camera.xml ) - - Sets the position of the camera through setting the eye position, the - center of the scene, and which axis is facing upward.
-
-
camera(float, float, float, float, float, float, float, float, float) - Method in class PApplet
-
 
-
camera() - Method in class PGraphics
-
-
( begin auto-generated from camera.xml ) - - Sets the position of the camera through setting the eye position, the - center of the scene, and which axis is facing upward.
-
-
camera(float, float, float, float, float, float, float, float, float) - Method in class PGraphics
-
 
-
camera() - Method in class PGraphics2D
-
 
-
camera(float, float, float, float, float, float, float, float, float) - Method in class PGraphics2D
-
 
-
camera - Variable in class PGraphicsOpenGL
-
 
-
camera() - Method in class PGraphicsOpenGL
-
-
Set camera to the default settings.
-
-
camera(float, float, float, float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
-
More flexible method for dealing with camera().
-
-
cameraAspect - Variable in class PGraphicsOpenGL
-
-
Aspect ratio of camera's view.
-
-
cameraFar - Variable in class PGraphicsOpenGL
-
-
Distance of the near and far planes.
-
-
cameraFOV - Variable in class PGraphicsOpenGL
-
-
Camera field of view.
-
-
cameraInv - Variable in class PGraphicsOpenGL
-
 
-
cameraNear - Variable in class PGraphicsOpenGL
-
-
Distance of the near and far planes.
-
-
cameraX - Variable in class PGraphicsOpenGL
-
-
Default position of the camera.
-
-
cameraY - Variable in class PGraphicsOpenGL
-
-
Default position of the camera.
-
-
cameraZ - Variable in class PGraphicsOpenGL
-
-
Default position of the camera.
-
-
cancelLatestCommittedText(AttributedCharacterIterator.Attribute[]) - Method in class InputMethodSupport
-
 
-
canDraw() - Method in class PApplet
-
-
Not official API, not guaranteed to work in the future.
-
-
canDraw() - Method in class PGraphics
-
-
Some renderers have requirements re: when they are ready to draw.
-
-
canDraw() - Method in class PGraphicsFX2D
-
 
-
canDraw() - Method in class PGraphicsJava2D
-
 
-
canEdit(File) - Method in class Mode
-
 
-
canvas - Variable in class PJOGL
-
-
The canvas where OpenGL rendering takes place
-
-
CAP_BUTT - Static variable in class LinePath
-
-
Ends unclosed subpaths and dash segments with no added decoration.
-
-
CAP_ROUND - Static variable in class LinePath
-
-
Ends unclosed subpaths and dash segments with a round decoration that has a - radius equal to half of the width of the pen.
-
-
CAP_SQUARE - Static variable in class LinePath
-
-
Ends unclosed subpaths and dash segments with a square projection that - extends beyond the end of the segment to a distance equal to half of the - line width.
-
-
caretBlinks - Variable in class TextAreaDefaults
-
 
-
caretColor - Variable in class TextAreaDefaults
-
 
-
caretPositionChanged(InputMethodEvent) - Method in class InputMethodSupport
-
 
-
caretVisible - Variable in class TextAreaDefaults
-
 
-
CASE_GROUP - Static variable in interface JavaTokenTypes
-
 
-
CASE_GROUP - Static variable in interface PdePartialTokenTypes
-
 
-
CASE_GROUP - Static variable in interface PdeTokenTypes
-
 
-
casesGroup() - Method in class JavaRecognizer
-
 
-
casesGroup() - Method in class PdeRecognizer
-
 
-
caseSList() - Method in class JavaRecognizer
-
 
-
caseSList() - Method in class PdeRecognizer
-
 
-
CATEGORY - Static variable in class Table
-
 
-
CCW - Static variable in class PGL
-
 
-
ceil(float) - Static method in class PApplet
-
-
( begin auto-generated from ceil.xml ) - - Calculates the closest int value that is greater than or equal to the - value of the parameter.
-
-
CENTER - Static variable in interface PConstants
-
-
Draw from the center, using second pair of values as the diameter.
-
-
ChangeDetector - Class in processing.app
-
 
-
ChangeDetector(Editor) - Constructor for class ChangeDetector
-
 
-
changedUpdate(DocumentEvent) - Method in class ColorChooser.ColorListener
-
 
-
CHAR_LITERAL - Static variable in interface JavaTokenTypes
-
 
-
CHAR_LITERAL - Static variable in interface PdePartialTokenTypes
-
 
-
CHAR_LITERAL - Static variable in interface PdeTokenTypes
-
 
-
CHARSET - Static variable in class PFont
-
-
The default Processing character set.
-
-
CHATTER - Static variable in interface PConstants
-
 
-
checkColumnIndex(String) - Method in class Table
-
-
Same as getColumnIndex(), but creates the column if it doesn't exist.
-
-
checkExtension(String) - Static method in class PApplet
-
-
Get the compression-free extension for this filename.
-
-
checkFramebufferStatus(int) - Method in class PGL
-
 
-
checkFramebufferStatus(int) - Method in class PJOGL
-
 
-
checkImage() - Method in class PGraphicsJava2D
-
 
-
checkName(String) - Static method in class Sketch
-
-
Convert to sanitized name and alert the user - if changes were made.
-
-
checkParen(char[], int, int) - Static method in class Editor
-
 
-
CHORD - Static variable in interface PConstants
-
 
-
CLAMP - Static variable in interface PConstants
-
-
textures are clamped to their edges
-
-
CLAMP_TO_EDGE - Static variable in class PGL
-
 
-
CLASS_DEF - Static variable in interface JavaTokenTypes
-
 
-
CLASS_DEF - Static variable in interface PdePartialTokenTypes
-
 
-
CLASS_DEF - Static variable in interface PdeTokenTypes
-
 
-
classBlock() - Method in class JavaRecognizer
-
 
-
classBlock() - Method in class PdeRecognizer
-
 
-
classDefinition(AST) - Method in class JavaRecognizer
-
 
-
classDefinition(AST) - Method in class PdeRecognizer
-
 
-
classField() - Method in class JavaRecognizer
-
 
-
classField() - Method in class PdeRecognizer
-
 
-
classOrInterfaceType(boolean) - Method in class JavaRecognizer
-
 
-
classOrInterfaceType(boolean) - Method in class PdeRecognizer
-
 
-
classTypeSpec(boolean) - Method in class JavaRecognizer
-
 
-
classTypeSpec(boolean) - Method in class PdeRecognizer
-
 
-
cleanup(Base) - Static method in class ContributionManager
-
-
Called by Base to clean up entries previously marked for deletion - and remove any "requires restart" flags.
-
-
clear() - Method in class EditorConsole
-
 
-
clear() - Method in class PApplet
-
 
-
clear() - Method in class PGraphics
-
 
-
clear() - Method in class FloatDict
-
-
Remove all entries.
-
-
clear() - Method in class FloatList
-
-
Remove all entries from the list.
-
-
clear() - Method in class IntDict
-
-
Remove all entries.
-
-
clear() - Method in class IntList
-
-
Remove all entries from the list.
-
-
clear() - Method in class StringDict
-
-
Remove all entries.
-
-
clear() - Method in class StringList
-
-
Remove all entries from the list.
-
-
clear() - Method in class FrameBuffer
-
 
-
clear(int) - Method in class PGL
-
 
-
clear(int) - Method in class PJOGL
-
 
-
clearClassLoader(Base) - Method in class ModeContribution
-
-
Method to close the ClassLoader so that the archives are no longer "locked" - and a mode can be removed without restart.
-
-
clearClassLoader(Base) - Method in class ToolContribution
-
-
Method to close the ClassLoader so that the archives are no longer "locked" and - a tool can be removed without restart.
-
-
clearColor(float, float, float, float) - Method in class PGL
-
 
-
clearColor(float, float, float, float) - Method in class PJOGL
-
 
-
clearDepth(float) - Method in class PGL
-
 
-
clearDepth(float) - Method in class PJOGL
-
 
-
clearNotice(String) - Method in class Editor
-
 
-
clearRows() - Method in class Table
-
 
-
clearStencil(int) - Method in class PGL
-
 
-
clearStencil(int) - Method in class PJOGL
-
 
-
clearToolMenu() - Method in class Editor
-
 
-
CLICK - Static variable in class MouseEvent
-
 
-
clip(float, float, float, float) - Method in class PApplet
-
 
-
clip(float, float, float, float) - Method in class PGraphics
-
 
-
CLIPBOARD_COPY - Static variable in class InputHandler
-
 
-
clipboard_copy() - Constructor for class InputHandler.clipboard_copy
-
 
-
CLIPBOARD_CUT - Static variable in class InputHandler
-
 
-
clipboard_cut() - Constructor for class InputHandler.clipboard_cut
-
 
-
CLIPBOARD_PASTE - Static variable in class InputHandler
-
 
-
clipboard_paste() - Constructor for class InputHandler.clipboard_paste
-
 
-
clone() - Method in class PImage
-
-
Duplicate an image, returns new PImage object.
-
-
CLOSE - Static variable in interface PConstants
-
 
-
close() - Method in class LineStroker
-
 
-
closePath() - Method in class LinePath
-
-
Closes the current subpath by drawing a straight line back to the - coordinates of the last moveTo.
-
-
CODED - Static variable in interface PConstants
-
 
-
COLON - Static variable in interface JavaTokenTypes
-
 
-
COLON - Static variable in interface PdePartialTokenTypes
-
 
-
COLON - Static variable in interface PdeTokenTypes
-
 
-
color(int) - Method in class PApplet
-
-
( begin auto-generated from color.xml ) - - Creates colors for storing in variables of the color datatype.
-
-
color(float) - Method in class PApplet
-
 
-
color(int, int) - Method in class PApplet
-
-
As of 0116 this also takes color(#FF8800, alpha)
-
-
color(float, float) - Method in class PApplet
-
 
-
color(int, int, int) - Method in class PApplet
-
 
-
color(int, int, int, int) - Method in class PApplet
-
 
-
color(float, float, float) - Method in class PApplet
-
 
-
color(float, float, float, float) - Method in class PApplet
-
 
-
color(int) - Method in class PGraphics
-
 
-
color(float) - Method in class PGraphics
-
 
-
color(int, int) - Method in class PGraphics
-
 
-
color(int, float) - Method in class PGraphics
-
 
-
color(float, float) - Method in class PGraphics
-
 
-
color(int, int, int) - Method in class PGraphics
-
 
-
color(float, float, float) - Method in class PGraphics
-
 
-
color(int, int, int, int) - Method in class PGraphics
-
 
-
color(float, float, float, float) - Method in class PGraphics
-
 
-
COLOR_ATTACHMENT0 - Static variable in class PGL
-
 
-
COLOR_ATTACHMENT1 - Static variable in class PGL
-
 
-
COLOR_ATTACHMENT2 - Static variable in class PGL
-
 
-
COLOR_ATTACHMENT3 - Static variable in class PGL
-
 
-
COLOR_BUFFER_BIT - Static variable in class PGL
-
 
-
colorBuffer(boolean) - Method in class Texture
-
 
-
colorBuffer() - Method in class Texture
-
 
-
ColorChooser - Class in processing.app
-
-
Generic color selector frame, pulled from the Tool object.
-
-
ColorChooser(Frame, boolean, Color, String, ActionListener) - Constructor for class ColorChooser
-
 
-
ColorChooser.ColorListener - Class in processing.app
-
 
-
ColorChooser.ColorRange - Class in processing.app
-
 
-
ColorChooser.ColorSlider - Class in processing.app
-
 
-
ColorListener() - Constructor for class ColorChooser.ColorListener
-
 
-
colorMask(boolean, boolean, boolean, boolean) - Method in class PGL
-
 
-
colorMask(boolean, boolean, boolean, boolean) - Method in class PJOGL
-
 
-
colorMethodCall() - Method in class PdeRecognizer
-
 
-
colorMode(int) - Method in class PApplet
-
-
( begin auto-generated from colorMode.xml ) - - Changes the way Processing interprets color data.
-
-
colorMode(int, float) - Method in class PApplet
-
 
-
colorMode(int, float, float, float) - Method in class PApplet
-
 
-
colorMode(int, float, float, float, float) - Method in class PApplet
-
 
-
colorMode - Variable in class PGraphics
-
-
The current colorMode
-
-
colorMode(int) - Method in class PGraphics
-
-
( begin auto-generated from colorMode.xml ) - - Changes the way Processing interprets color data.
-
-
colorMode(int, float) - Method in class PGraphics
-
 
-
colorMode(int, float, float, float) - Method in class PGraphics
-
 
-
colorMode(int, float, float, float, float) - Method in class PGraphics
-
 
-
colorMode - Variable in class PShape
-
-
The current colorMode
-
-
colorMode(int) - Method in class PShape
-
-
Set the pivot point for all transformations.
-
-
colorMode(int, float) - Method in class PShape
-
 
-
colorMode(int, float, float, float) - Method in class PShape
-
 
-
colorMode(int, float, float, float, float) - Method in class PShape
-
 
-
colorMode - Variable in class PStyle
-
 
-
colorModeA - Variable in class PGraphics
-
-
Max value for alpha set by colorMode
-
-
colorModeA - Variable in class PShape
-
-
Max value for alpha set by colorMode
-
-
colorModeA - Variable in class PStyle
-
 
-
colorModeX - Variable in class PGraphics
-
-
Max value for red (or hue) set by colorMode
-
-
colorModeX - Variable in class PShape
-
-
Max value for red (or hue) set by colorMode
-
-
colorModeX - Variable in class PStyle
-
 
-
colorModeY - Variable in class PGraphics
-
-
Max value for green (or saturation) set by colorMode
-
-
colorModeY - Variable in class PShape
-
-
Max value for green (or saturation) set by colorMode
-
-
colorModeY - Variable in class PStyle
-
 
-
colorModeZ - Variable in class PGraphics
-
-
Max value for blue (or value) set by colorMode
-
-
colorModeZ - Variable in class PShape
-
-
Max value for blue (or value) set by colorMode
-
-
colorModeZ - Variable in class PStyle
-
 
-
ColorRange() - Constructor for class ColorChooser.ColorRange
-
 
-
ColorSelector - Class in processing.app.tools
-
-
Color selector tool for the Tools menu.
-
-
ColorSelector() - Constructor for class ColorSelector
-
 
-
ColorSlider() - Constructor for class ColorChooser.ColorSlider
-
 
-
cols - Variable in class TextAreaDefaults
-
 
-
COMMA - Static variable in interface JavaTokenTypes
-
 
-
COMMA - Static variable in interface PdePartialTokenTypes
-
 
-
COMMA - Static variable in interface PdeTokenTypes
-
 
-
COMMENT1 - Static variable in class Token
-
-
This can be used to mark a comment.
-
-
COMMENT2 - Static variable in class Token
-
-
This can be used to mark a comment.
-
-
compare(int, int) - Method in class Sort
-
 
-
compilationUnit() - Method in class JavaRecognizer
-
 
-
compilationUnit() - Method in class PdeRecognizer
-
 
-
COMPILE_STATUS - Static variable in class PGL
-
 
-
compileShader(int) - Method in class PGL
-
 
-
compileShader(int) - Method in class PJOGL
-
 
-
COMPLAINT - Static variable in interface PConstants
-
 
-
COMPOSING_UNDERBAR_HEIGHT - Static variable in class CompositionTextManager
-
 
-
CompositionTextManager - Class in processing.app.syntax.im
-
-
This class Manage texts from input method - by begin-process-end steps.
-
-
CompositionTextManager(JEditTextArea) - Constructor for class CompositionTextManager
-
-
Create text manager class with a textarea.
-
-
CompositionTextPainter - Class in processing.app.syntax.im
-
-
Paint texts from input method.
-
-
CompositionTextPainter(JEditTextArea) - Constructor for class CompositionTextPainter
-
-
Constructor for painter.
-
-
compoundStatement() - Method in class JavaRecognizer
-
 
-
compoundStatement() - Method in class PdeRecognizer
-
 
-
COMPRESSED_TEXTURE_FORMATS - Static variable in class PGL
-
 
-
compressedTexImage2D(int, int, int, int, int, int, int, Buffer) - Method in class PGL
-
 
-
compressedTexImage2D(int, int, int, int, int, int, int, Buffer) - Method in class PJOGL
-
 
-
compressedTexSubImage2D(int, int, int, int, int, int, int, int, Buffer) - Method in class PGL
-
 
-
compressedTexSubImage2D(int, int, int, int, int, int, int, int, Buffer) - Method in class PJOGL
-
 
-
concat(boolean[], boolean[]) - Static method in class PApplet
-
-
( begin auto-generated from concat.xml ) - - Concatenates two arrays.
-
-
concat(byte[], byte[]) - Static method in class PApplet
-
 
-
concat(char[], char[]) - Static method in class PApplet
-
 
-
concat(int[], int[]) - Static method in class PApplet
-
 
-
concat(float[], float[]) - Static method in class PApplet
-
 
-
concat(String[], String[]) - Static method in class PApplet
-
 
-
concat(Object, Object) - Static method in class PApplet
-
 
-
conditionalExpression() - Method in class JavaRecognizer
-
 
-
conditionalExpression() - Method in class PdeRecognizer
-
 
-
consCastTypeSpec(boolean) - Method in class PdeRecognizer
-
 
-
constant() - Method in class JavaRecognizer
-
 
-
constant() - Method in class PdeRecognizer
-
 
-
CONSTANT_ALPHA - Static variable in class PGL
-
 
-
CONSTANT_COLOR - Static variable in class PGL
-
 
-
constrain(int, int, int) - Static method in class PApplet
-
 
-
constrain(float, float, float) - Static method in class PApplet
-
-
( begin auto-generated from constrain.xml ) - - Constrains a value to not exceed a maximum and minimum value.
-
-
CONSTRUCTOR_CAST - Static variable in interface PdePartialTokenTypes
-
 
-
CONSTRUCTOR_CAST - Static variable in interface PdeTokenTypes
-
 
-
constructorBody() - Method in class JavaRecognizer
-
 
-
constructorBody() - Method in class PdeRecognizer
-
 
-
constructorCast() - Method in class PdeRecognizer
-
 
-
contains(float, float) - Method in class PShape
-
 
-
contains(float, float) - Method in class PShapeOpenGL
-
 
-
contentsToClassPath(File) - Static method in class Base
-
-
Given a folder, return a list of absolute paths to all jar or zip files - inside that folder, separated by pathSeparatorChar.
-
-
context - Variable in class PJOGL
-
-
The rendering context (holds rendering state info)
-
-
CONTEXT_AWARE_HOME_END - Static variable in class InputHandler
-
-
If this PDE property is set to Boolean.TRUE, the home/end keys will - go to the first/last non-whitespace character of the line.
-
-
contribLibraries - Variable in class Mode
-
 
-
contribListing - Static variable in class ContributionManager
-
 
-
Contribution - Class in processing.app.contrib
-
 
-
Contribution() - Constructor for class Contribution
-
 
-
contributionAdded(Contribution) - Method in interface ContributionChangeListener
-
 
-
contributionAdded(Contribution) - Method in class ContributionListPanel
-
 
-
contributionChanged(Contribution, Contribution) - Method in interface ContributionChangeListener
-
 
-
contributionChanged(Contribution, Contribution) - Method in class ContributionListPanel
-
 
-
ContributionChangeListener - Interface in processing.app.contrib
-
 
-
ContributionListing - Class in processing.app.contrib
-
 
-
ContributionListPanel - Class in processing.app.contrib
-
 
-
ContributionListPanel(ContributionManagerDialog, ContributionFilter) - Constructor for class ContributionListPanel
-
 
-
ContributionManager - Class in processing.app.contrib
-
 
-
ContributionManager() - Constructor for class ContributionManager
-
 
-
ContributionManagerDialog - Class in processing.app.contrib
-
 
-
ContributionManagerDialog(ContributionType) - Constructor for class ContributionManagerDialog
-
 
-
contributionRemoved(Contribution) - Method in interface ContributionChangeListener
-
 
-
contributionRemoved(Contribution) - Method in class ContributionListPanel
-
 
-
ContributionType - Enum in processing.app.contrib
-
 
-
CONTROL - Static variable in interface PConstants
-
 
-
copy() - Method in class DefaultInputHandler
-
-
Returns a copy of this input handler that shares the same - key bindings.
-
-
copy() - Method in class InputHandler
-
-
Returns a copy of this input handler that shares the same - key bindings.
-
-
copy() - Method in class JEditTextArea
-
-
Places the selected text into the clipboard.
-
-
copy() - Method in class PApplet
-
 
-
copy(int, int, int, int, int, int, int, int) - Method in class PApplet
-
-
( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another.
-
-
copy(PImage, int, int, int, int, int, int, int, int) - Method in class PApplet
-
 
-
copy(int, int, int, int, int, int, int, int) - Method in class PGraphicsDanger2D
-
 
-
copy(PImage, int, int, int, int, int, int, int, int) - Method in class PGraphicsDanger2D
-
 
-
copy(int, int, int, int, int, int, int, int) - Method in class PGraphicsJava2D
-
 
-
copy(PImage, int, int, int, int, int, int, int, int) - Method in class PGraphicsJava2D
-
 
-
copy() - Method in class PImage
-
 
-
copy(int, int, int, int, int, int, int, int) - Method in class PImage
-
-
( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another.
-
-
copy(PImage, int, int, int, int, int, int, int, int) - Method in class PImage
-
 
-
copy() - Method in class PVector
-
 
-
copy() - Method in class FloatDict
-
-
Returns a duplicate copy of this object.
-
-
copy() - Method in class FloatList
-
 
-
copy() - Method in class IntDict
-
-
Returns a duplicate copy of this object.
-
-
copy() - Method in class IntList
-
 
-
copy() - Method in class StringDict
-
-
Returns a duplicate copy of this object.
-
-
copy() - Method in class StringList
-
 
-
copy() - Method in class Table
-
-
Make a copy of the current table
-
-
copy(FrameBuffer, int) - Method in class FrameBuffer
-
 
-
copy(int, int, int, int, int, int, int, int) - Method in class PGraphicsOpenGL
-
 
-
copy(PImage, int, int, int, int, int, int, int, int) - Method in class PGraphicsOpenGL
-
 
-
copyAsHTML() - Method in class JEditTextArea
-
-
Copy the current selection as HTML, formerly "Format for Discourse".
-
-
copyBufferFromSource(Object, ByteBuffer, int, int) - Method in class Texture
-
 
-
copyColor(FrameBuffer) - Method in class FrameBuffer
-
 
-
copyDepth(FrameBuffer) - Method in class FrameBuffer
-
 
-
copyDir(File, File) - Static method in class Base
-
-
Copy a folder from one place to another.
-
-
copyDirNative(File, File) - Static method in class Base
-
 
-
copyFile(File, File) - Static method in class Base
-
 
-
copyGroup2D(PGraphicsOpenGL, PShape, PShape) - Static method in class PShapeOpenGL
-
 
-
copyGroup3D(PGraphicsOpenGL, PShape, PShape) - Static method in class PShapeOpenGL
-
 
-
copyOf(float[], int) - Static method in class LinePath
-
 
-
copyOf(byte[], int) - Static method in class LinePath
-
 
-
copyOf(int[], int) - Static method in class LinePath
-
 
-
copyStencil(FrameBuffer) - Method in class FrameBuffer
-
 
-
copyTexImage2D(int, int, int, int, int, int, int, int) - Method in class PGL
-
 
-
copyTexImage2D(int, int, int, int, int, int, int, int) - Method in class PJOGL
-
 
-
copyTexSubImage2D(int, int, int, int, int, int, int, int) - Method in class PGL
-
 
-
copyTexSubImage2D(int, int, int, int, int, int, int, int) - Method in class PJOGL
-
 
-
copyTo(File) - Method in class SketchCode
-
 
-
coreLibraries - Variable in class Mode
-
 
-
CORNER - Static variable in interface PConstants
-
-
Draw mode convention to use (x, y) to (width, height)
-
-
CORNERS - Static variable in interface PConstants
-
-
Draw mode convention to use (x1, y1) to (x2, y2) coordinates
-
-
cos(float) - Static method in class PApplet
-
-
( begin auto-generated from cos.xml ) - - Calculates the cosine of an angle.
-
-
countLines(String) - Static method in class Base
-
-
Get the number of lines in a file by counting the number of newline - characters inside a String (and adding 1).
-
-
createButtons() - Method in class EditorToolbar
-
 
-
createEditor(Base, String, EditorState) - Method in class Mode
-
-
Create a new editor associated with this mode.
-
-
CreateFont - Class in processing.app.tools
-
-
GUI tool for font creation heaven/hell.
-
-
CreateFont() - Constructor for class CreateFont
-
 
-
createFont(String, float) - Method in class PApplet
-
 
-
createFont(String, float, boolean) - Method in class PApplet
-
 
-
createFont(String, float, boolean, char[]) - Method in class PApplet
-
-
( begin auto-generated from createFont.xml ) - - Dynamically converts a font to the format used by Processing from either - a font name that's installed on the computer, or from a .ttf or .otf - file inside the sketches "data" folder.
-
-
createFooter() - Method in class Editor
-
 
-
createFormatter() - Method in class Editor
-
 
-
createGraphics(int, int) - Method in class PApplet
-
 
-
createGraphics(int, int, String) - Method in class PApplet
-
-
( begin auto-generated from createGraphics.xml ) - - Creates and returns a new PGraphics object of the types P2D or - P3D.
-
-
createGraphics(int, int, String, String) - Method in class PApplet
-
-
Create an offscreen graphics surface for drawing, in this case - for a renderer that writes to a file (such as PDF or DXF).
-
-
createHeader() - Method in class Editor
-
 
-
createImage(int, int, int) - Method in class PApplet
-
-
( begin auto-generated from createImage.xml ) - - Creates a new PImage (the datatype for storing images).
-
-
createInput(String) - Method in class PApplet
-
-
( begin auto-generated from createInput.xml ) - - This is a function for advanced programmers to open a Java InputStream.
-
-
createInput(File) - Static method in class PApplet
-
 
-
createInputRaw(String) - Method in class PApplet
-
-
Call openStream() without automatic gzip decompression.
-
-
createKey(WindowsRegistry.REGISTRY_ROOT_KEY, String, String) - Static method in class WindowsRegistry
-
-
Create a new key.
-
-
createOutput(String) - Method in class PApplet
-
-
( begin auto-generated from createOutput.xml ) - - Similar to createInput(), this creates a Java OutputStream - for a given filename or path.
-
-
createOutput(File) - Static method in class PApplet
-
 
-
createPath(String) - Static method in class PApplet
-
-
Takes a path and creates any in-between folders if they don't - already exist.
-
-
createPath(File) - Static method in class PApplet
-
 
-
createProgram() - Method in class PGL
-
 
-
createProgram() - Method in class PJOGL
-
 
-
createReader(String) - Method in class PApplet
-
-
( begin auto-generated from createReader.xml ) - - Creates a BufferedReader object that can be used to read files - line-by-line as individual String objects.
-
-
createReader(File) - Static method in class PApplet
-
 
-
createReader(InputStream) - Static method in class PApplet
-
 
-
createRoundRect(float, float, float, float, float, float, float, float) - Static method in class Toolkit
-
 
-
createShader(int) - Method in class PGL
-
 
-
createShader(int) - Method in class PJOGL
-
 
-
createShape() - Method in class PApplet
-
 
-
createShape(int) - Method in class PApplet
-
 
-
createShape(int, float...) - Method in class PApplet
-
 
-
createShape() - Method in class PGraphics
-
 
-
createShape(int) - Method in class PGraphics
-
 
-
createShape(int, float...) - Method in class PGraphics
-
 
-
createShape2D(PGraphicsOpenGL, PShape) - Static method in class PShapeOpenGL
-
 
-
createShape3D(PGraphicsOpenGL, PShape) - Static method in class PShapeOpenGL
-
 
-
createStrokedPath(LinePath, float, int, int) - Static method in class LinePath
-
 
-
createStrokedPath(LinePath, float, int, int, float) - Static method in class LinePath
-
 
-
createStrokedPath(LinePath, float, int, int, float, PMatrix2D) - Static method in class LinePath
-
-
Constructs a solid LinePath with the specified attributes.
-
-
createSurface() - Method in class PGraphics
-
 
-
createSurface() - Method in class PGraphicsDanger2D
-
 
-
createSurface() - Method in class PGraphicsFX2D
-
 
-
createSurface() - Method in class PGraphicsJava2D
-
 
-
createSurface() - Method in class PGraphicsOpenGL
-
 
-
createTempFolder(String, String, File) - Static method in class Base
-
-
Create a temporary folder by using the createTempFile() mechanism, - deleting the file it creates, and making a folder using the location - that was provided.
-
-
createTempFolder() - Method in enum ContributionType
-
 
-
createThread() - Method in class PSurfaceAWT
-
 
-
createThread() - Method in class PSurfaceDanger
-
 
-
createThread() - Method in class PSurfaceNone
-
 
-
createToolbar() - Method in class Editor
-
 
-
createWriter(String) - Method in class PApplet
-
-
( begin auto-generated from createWriter.xml ) - - Creates a new file in the sketch folder, and a PrintWriter object - to write to it.
-
-
createWriter(File) - Static method in class PApplet
-
 
-
createWriter(OutputStream) - Static method in class PApplet
-
 
-
CROSS - Static variable in interface PConstants
-
 
-
cross(PVector) - Method in class PVector
-
-
( begin auto-generated from PVector_cross.xml ) - - Calculates and returns a vector composed of the cross product between - two vectors.
-
-
cross(PVector, PVector) - Method in class PVector
-
 
-
cross(PVector, PVector, PVector) - Static method in class PVector
-
 
-
CTOR_CALL - Static variable in interface JavaTokenTypes
-
 
-
CTOR_CALL - Static variable in interface PdePartialTokenTypes
-
 
-
CTOR_CALL - Static variable in interface PdeTokenTypes
-
 
-
CTOR_DEF - Static variable in interface JavaTokenTypes
-
 
-
CTOR_DEF - Static variable in interface PdePartialTokenTypes
-
 
-
CTOR_DEF - Static variable in interface PdeTokenTypes
-
 
-
ctorHead() - Method in class JavaRecognizer
-
 
-
ctorHead() - Method in class PdeRecognizer
-
 
-
CTRL - Static variable in class Event
-
 
-
CULL_FACE - Static variable in class PGL
-
 
-
cullFace(int) - Method in class PGL
-
 
-
cullFace(int) - Method in class PJOGL
-
 
-
CURRENT_VERTEX_ATTRIB - Static variable in class PGL
-
 
-
currentLightFalloffConstant - Variable in class PGraphicsOpenGL
-
-
Current light falloff
-
-
currentLightFalloffLinear - Variable in class PGraphicsOpenGL
-
 
-
currentLightFalloffQuadratic - Variable in class PGraphicsOpenGL
-
 
-
currentLightSpecular - Variable in class PGraphicsOpenGL
-
-
Current specular color for lighting
-
-
currentSampling() - Method in class Texture
-
 
-
currentSegment(float[]) - Method in class LinePath.PathIterator
-
 
-
currentSegment(double[]) - Method in class LinePath.PathIterator
-
 
-
cursor(int) - Method in class PApplet
-
-
Set the cursor type
-
-
cursor(PImage) - Method in class PApplet
-
-
Replace the cursor with the specified PImage.
-
-
cursor(PImage, int, int) - Method in class PApplet
-
-
( begin auto-generated from cursor.xml ) - - Sets the cursor to a predefined symbol, an image, or makes it visible if - already hidden.
-
-
cursor() - Method in class PApplet
-
-
Show the cursor after noCursor() was called.
-
-
curve(float, float, float, float, float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from curve.xml ) - - Draws a curved line on the screen.
-
-
curve(float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PApplet
-
 
-
curve(float, float, float, float, float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from curve.xml ) - - Draws a curved line on the screen.
-
-
curve(float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PGraphics
-
 
-
CURVE_VERTEX - Static variable in interface PConstants
-
 
-
curveDetail(int) - Method in class PApplet
-
-
( begin auto-generated from curveDetail.xml ) - - Sets the resolution at which curves display.
-
-
curveDetail - Variable in class PGraphics
-
 
-
curveDetail(int) - Method in class PGraphics
-
-
( begin auto-generated from curveDetail.xml ) - - Sets the resolution at which curves display.
-
-
curveDetail(int) - Method in class PGraphicsFX2D
-
-
Ignored (not needed) by this renderer.
-
-
curveDetail(int) - Method in class PGraphicsJava2D
-
-
Ignored (not needed) in Java 2D.
-
-
curveDetail(int) - Method in class PShape
-
 
-
curveDetail(int) - Method in class PShapeOpenGL
-
 
-
curvePoint(float, float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from curvePoint.xml ) - - Evalutes the curve at point t for points a, b, c, d.
-
-
curvePoint(float, float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from curvePoint.xml ) - - Evalutes the curve at point t for points a, b, c, d.
-
-
curveTangent(float, float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from curveTangent.xml ) - - Calculates the tangent of a point on a curve.
-
-
curveTangent(float, float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from curveTangent.xml ) - - Calculates the tangent of a point on a curve.
-
-
curveTightness(float) - Method in class PApplet
-
-
( begin auto-generated from curveTightness.xml ) - - Modifies the quality of forms created with curve() and - curveVertex().
-
-
curveTightness - Variable in class PGraphics
-
 
-
curveTightness(float) - Method in class PGraphics
-
-
( begin auto-generated from curveTightness.xml ) - - Modifies the quality of forms created with curve() and - curveVertex().
-
-
curveTightness(float) - Method in class PShape
-
 
-
curveTightness(float) - Method in class PShapeOpenGL
-
 
-
curveVertex(float, float) - Method in class PApplet
-
-
( begin auto-generated from curveVertex.xml ) - - Specifies vertex coordinates for curves.
-
-
curveVertex(float, float, float) - Method in class PApplet
-
 
-
curveVertex(float, float) - Method in class PGraphics
-
-
( begin auto-generated from curveVertex.xml ) - - Specifies vertex coordinates for curves.
-
-
curveVertex(float, float, float) - Method in class PGraphics
-
 
-
curveVertex(float, float, float) - Method in class PGraphicsFX2D
-
 
-
curveVertex(float, float, float) - Method in class PGraphicsJava2D
-
 
-
curveVertex(float, float) - Method in class PShape
-
 
-
curveVertex(float, float, float) - Method in class PShape
-
 
-
curveVertex(float, float, float) - Method in class PGraphics2D
-
 
-
curveVertex(float, float) - Method in class PGraphicsOpenGL
-
 
-
curveVertex(float, float, float) - Method in class PGraphicsOpenGL
-
 
-
curveVertex(float, float) - Method in class PShapeOpenGL
-
 
-
curveVertex(float, float, float) - Method in class PShapeOpenGL
-
 
-
CUSTOM - Static variable in interface PConstants
-
 
-
cut() - Method in class JEditTextArea
-
-
Deletes the selected text from the text area and places it - into the clipboard.
-
-
CW - Static variable in class PGL
-
 
-
- - - -

D

-
-
DA - Static variable in class PGraphics
-
 
-
DARKEST - Static variable in interface PConstants
-
 
-
dataFile(String) - Method in class PApplet
-
-
Return a full path to an item in the data folder as a File object.
-
-
dataPath(String) - Method in class PApplet
-
-
Return a full path to an item in the data folder.
-
-
day() - Static method in class PApplet
-
-
( begin auto-generated from day.xml ) - - Processing communicates with the clock on your computer.
-
-
DB - Static variable in class PGraphics
-
 
-
deactivateRun() - Method in class Editor
-
 
-
deactivateRun() - Method in class EditorToolbar
-
 
-
deactivateStop() - Method in class EditorToolbar
-
 
-
DEBUG - Static variable in class Base
-
-
True if heavy debugging error/log messages are enabled
-
-
debug(String) - Static method in class PApplet
-
 
-
debugOpacity(Component) - Static method in class Toolkit
-
-
Do not use or rely upon presence of this method: not approved as final API.
-
-
DEC - Static variable in interface JavaTokenTypes
-
 
-
DEC - Static variable in interface PdePartialTokenTypes
-
 
-
DEC - Static variable in interface PdeTokenTypes
-
 
-
declaration() - Method in class JavaRecognizer
-
 
-
declaration() - Method in class PdeRecognizer
-
 
-
declaratorBrackets(AST) - Method in class JavaRecognizer
-
 
-
declaratorBrackets(AST) - Method in class PdeRecognizer
-
 
-
DECR - Static variable in class PGL
-
 
-
DECR_WRAP - Static variable in class PGL
-
 
-
DEFAULT_HEIGHT - Static variable in class PApplet
-
 
-
DEFAULT_VERTICES - Static variable in class PGraphics
-
 
-
DEFAULT_WIDTH - Static variable in class PApplet
-
-
Default width and height for sketch when not specified
-
-
defaultFileMenu - Static variable in class Base
-
-
A lone file menu to be used when all sketch windows are closed.
-
-
DefaultInputHandler - Class in processing.app.syntax
-
-
The default input handler.
-
-
DefaultInputHandler() - Constructor for class DefaultInputHandler
-
-
Creates a new input handler with no key bindings defined.
-
-
defaultSize - Variable in class PApplet
-
-
true if no size() command has been executed.
-
-
DEG_TO_RAD - Static variable in interface PConstants
-
 
-
degrees(float) - Static method in class PApplet
-
-
( begin auto-generated from degrees.xml ) - - Converts a radian measurement to its corresponding value in degrees.
-
-
delay(int) - Method in class PApplet
-
-
The delay() function causes the program to halt for a specified time.
-
-
DELETE - Static variable in class InputHandler
-
 
-
delete() - Constructor for class InputHandler.delete
-
 
-
DELETE - Static variable in interface PConstants
-
 
-
DELETE_STATUS - Static variable in class PGL
-
 
-
DELETE_WORD - Static variable in class InputHandler
-
 
-
delete_word() - Constructor for class InputHandler.delete_word
-
 
-
deleteBuffers(int, IntBuffer) - Method in class PGL
-
 
-
deleteBuffers(int, IntBuffer) - Method in class PJOGL
-
 
-
deleteFile(File) - Method in class Platform
-
-
Attempts to move to the Trash on OS X, or the Recycle Bin on Windows.
-
-
deleteFramebuffers(int, IntBuffer) - Method in class PGL
-
 
-
deleteFramebuffers(int, IntBuffer) - Method in class PJOGL
-
 
-
deleteKey(WindowsRegistry.REGISTRY_ROOT_KEY, String, String) - Static method in class WindowsRegistry
-
-
Delete a key.
-
-
deleteLines(int, int) - Method in class TokenMarker
-
-
Informs the token marker that line have been deleted from - the document.
-
-
deleteProgram(int) - Method in class PGL
-
 
-
deleteProgram(int) - Method in class PJOGL
-
 
-
deleteRenderbuffers(int, IntBuffer) - Method in class PGL
-
 
-
deleteRenderbuffers(int, IntBuffer) - Method in class PJOGL
-
 
-
deleteShader(int) - Method in class PGL
-
 
-
deleteShader(int) - Method in class PJOGL
-
 
-
deleteTextures(int, IntBuffer) - Method in class PGL
-
 
-
deleteTextures(int, IntBuffer) - Method in class PJOGL
-
 
-
deleteValue(WindowsRegistry.REGISTRY_ROOT_KEY, String, String) - Static method in class WindowsRegistry
-
-
Delete a value.
-
-
DELETION_FLAG - Static variable in class LocalContribution
-
 
-
depth - Variable in class PShape
-
 
-
DEPTH24_STENCIL8 - Static variable in class PGL
-
 
-
DEPTH_ATTACHMENT - Static variable in class PGL
-
 
-
DEPTH_BITS - Static variable in class PGL
-
 
-
DEPTH_BUFFER_BIT - Static variable in class PGL
-
 
-
DEPTH_COMPONENT - Static variable in class PGL
-
 
-
DEPTH_COMPONENT16 - Static variable in class PGL
-
 
-
DEPTH_COMPONENT24 - Static variable in class PGL
-
 
-
DEPTH_COMPONENT32 - Static variable in class PGL
-
 
-
DEPTH_STENCIL - Static variable in class PGL
-
 
-
DEPTH_TEST - Static variable in class PGL
-
 
-
DEPTH_WRITEMASK - Static variable in class PGL
-
 
-
depthBits - Static variable in class PGraphicsOpenGL
-
 
-
depthFunc(int) - Method in class PGL
-
 
-
depthFunc(int) - Method in class PJOGL
-
 
-
depthMask(boolean) - Method in class PGL
-
 
-
depthMask(boolean) - Method in class PJOGL
-
 
-
depthRangef(float, float) - Method in class PGL
-
 
-
depthRangef(float, float) - Method in class PJOGL
-
 
-
descent() - Method in class PFont
-
-
Returns how far this font descends from the baseline.
-
-
deselectMenu() - Method in class EditorHeader
-
 
-
desktopFile(String) - Static method in class PApplet
-
-
Not a supported function.
-
-
desktopPath(String) - Static method in class PApplet
-
-
Not a supported function.
-
-
detachShader(int, int) - Method in class PGL
-
 
-
detachShader(int, int) - Method in class PJOGL
-
 
-
determinant() - Method in interface PMatrix
-
 
-
determinant() - Method in class PMatrix2D
-
 
-
determinant() - Method in class PMatrix3D
-
 
-
DG - Static variable in class PGraphics
-
 
-
DIAMETER - Static variable in interface PConstants
-
-
Synonym for the CENTER constant.
-
-
die(String) - Method in class PApplet
-
-
Function for an applet/application to kill itself and - display an error.
-
-
die(String, Exception) - Method in class PApplet
-
-
Same as above but with an exception.
-
-
DIFFERENCE - Static variable in interface PConstants
-
 
-
DILATE - Static variable in interface PConstants
-
 
-
DIM - Static variable in class EditorButton
-
 
-
DIRECTION - Static variable in class PShapeOpenGL
-
 
-
DIRECTIONAL - Static variable in interface PConstants
-
 
-
directionalLight(float, float, float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from directionalLight.xml ) - - Adds a directional light.
-
-
directionalLight(float, float, float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from directionalLight.xml ) - - Adds a directional light.
-
-
directionalLight(float, float, float, float, float, float) - Method in class PGraphics2D
-
 
-
directionalLight(float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
disable(int) - Method in class PGL
-
 
-
disable(int) - Method in class PJOGL
-
 
-
DISABLE_DEPTH_MASK - Static variable in interface PConstants
-
 
-
DISABLE_DEPTH_SORT - Static variable in interface PConstants
-
 
-
DISABLE_DEPTH_TEST - Static variable in interface PConstants
-
 
-
DISABLE_NATIVE_FONTS - Static variable in interface PConstants
-
-
Deprecated.
-
-
DISABLE_OPENGL_ERRORS - Static variable in interface PConstants
-
 
-
DISABLE_OPTIMIZED_STROKE - Static variable in interface PConstants
-
 
-
DISABLE_STROKE_PERSPECTIVE - Static variable in interface PConstants
-
 
-
DISABLE_STROKE_PURE - Static variable in interface PConstants
-
 
-
DISABLE_TEXTURE_MIPMAPS - Static variable in interface PConstants
-
 
-
disableDepthTest() - Method in class FrameBuffer
-
 
-
disableStyle() - Method in class PShape
-
-
( begin auto-generated from PShape_disableStyle.xml ) - - Disables the shape's style data and uses Processing's current styles.
-
-
disableStyle() - Method in class PShapeOpenGL
-
 
-
disableVertexAttribArray(int) - Method in class PGL
-
 
-
disableVertexAttribArray(int) - Method in class PJOGL
-
 
-
discover(File) - Static method in class Library
-
 
-
discover(File, ArrayList<File>) - Static method in class Library
-
 
-
displayable() - Method in class PGraphics
-
-
Return true if this renderer should be drawn to the screen.
-
-
displayDensity() - Method in class PApplet
-
 
-
displayDensity(int) - Static method in class PApplet
-
 
-
displayHeight - Variable in class PApplet
-
-
( begin auto-generated from displayHeight.xml ) - - System variable that stores the height of the computer screen.
-
-
displayWidth - Variable in class PApplet
-
-
( begin auto-generated from displayWidth.xml ) - - System variable which stores the width of the computer screen.
-
-
dispose() - Method in class PApplet
-
-
Called to dispose of resources and shut down the sketch.
-
-
dispose() - Method in class PGraphics
-
-
Handle any takedown for this graphics context.
-
-
dispose() - Method in class PGraphicsOpenGL
-
 
-
disposeSourceBuffer() - Method in class Texture
-
 
-
dist(float, float, float, float) - Static method in class PApplet
-
 
-
dist(float, float, float, float, float, float) - Static method in class PApplet
-
-
( begin auto-generated from dist.xml ) - - Calculates the distance between two points.
-
-
dist(PVector) - Method in class PVector
-
-
( begin auto-generated from PVector_dist.xml ) - - Calculates the Euclidean distance between two points (considering a - point as a vector object).
-
-
dist(PVector, PVector) - Static method in class PVector
-
 
-
DITHER - Static variable in class PGL
-
 
-
div(float) - Method in class PVector
-
-
( begin auto-generated from PVector_div.xml ) - - Divides a vector by a scalar or divides one vector by another.
-
-
div(PVector, float) - Static method in class PVector
-
-
Divide a vector by a scalar and return the result in a new vector.
-
-
div(PVector, float, PVector) - Static method in class PVector
-
-
Divide a vector by a scalar and store the result in another vector.
-
-
div(String, float) - Method in class FloatDict
-
 
-
div(int, float) - Method in class FloatList
-
 
-
div(String, int) - Method in class IntDict
-
 
-
div(int, int) - Method in class IntList
-
 
-
DIV - Static variable in interface JavaTokenTypes
-
 
-
DIV - Static variable in interface PdePartialTokenTypes
-
 
-
DIV - Static variable in interface PdeTokenTypes
-
 
-
DIV_ASSIGN - Static variable in interface JavaTokenTypes
-
 
-
DIV_ASSIGN - Static variable in interface PdePartialTokenTypes
-
 
-
DIV_ASSIGN - Static variable in interface PdeTokenTypes
-
 
-
document - Variable in class TextAreaDefaults
-
 
-
DOCUMENT_END - Static variable in class InputHandler
-
 
-
document_end(boolean) - Constructor for class InputHandler.document_end
-
 
-
DOCUMENT_HOME - Static variable in class InputHandler
-
 
-
document_home(boolean) - Constructor for class InputHandler.document_home
-
 
-
DODGE - Static variable in interface PConstants
-
 
-
done() - Method in class ProgressFrame.TaskAddFile
-
 
-
done() - Method in class ProgressFrame.TaskSaveAs
-
 
-
DONT_CARE - Static variable in class PGL
-
 
-
dot(PVector) - Method in class PVector
-
-
( begin auto-generated from PVector_dot.xml ) - - Calculates the dot product of two vectors.
-
-
dot(float, float, float) - Method in class PVector
-
 
-
dot(PVector, PVector) - Static method in class PVector
-
 
-
DOT - Static variable in interface JavaTokenTypes
-
 
-
DOT - Static variable in interface PdePartialTokenTypes
-
 
-
DOT - Static variable in interface PdeTokenTypes
-
 
-
DOUBLE - Static variable in class Table
-
 
-
DOWN - Static variable in interface PConstants
-
 
-
downloadAndInstallOnImport(Base, List<AvailableContribution>) - Static method in class ContributionManager
-
-
Blocking call to download and install a set of libraries.
-
-
DR - Static variable in class PGraphics
-
 
-
DRAG - Static variable in class MouseEvent
-
 
-
draw(Graphics, Color) - Method in class CompositionTextPainter
-
-
Draw text via input method with composed text information.
-
-
draw() - Method in class PApplet
-
-
( begin auto-generated from draw.xml ) - - Called directly after setup() and continuously executes the lines - of code contained inside its block until the program is stopped or - noLoop() is called.
-
-
draw(PGraphics) - Method in class PShape
-
-
Called by the following (the shape() command adds the g) - PShape s = loadShape("blah.svg"); - shape(s);
-
-
draw() - Method in class PShapeOpenGL
-
 
-
draw(PGraphics) - Method in class PShapeOpenGL
-
 
-
DRAW_FRAMEBUFFER - Static variable in class PGL
-
 
-
drawArrays(int, int, int) - Method in class PGL
-
 
-
drawArrays(int, int, int) - Method in class PJOGL
-
 
-
drawBuffer(int) - Method in class PGL
-
 
-
drawBuffer(int) - Method in class PJOGL
-
 
-
drawChar(PGraphics, char, float, float, float) - Method in class PShapeSVG.Font
-
 
-
drawElements(int, int, int, int) - Method in class PGL
-
 
-
drawElements(int, int, int, Buffer) - Method in class PGL
-
 
-
drawElements(int, int, int, int) - Method in class PJOGL
-
 
-
drawElements(int, int, int, Buffer) - Method in class PJOGL
-
 
-
drawString(PGraphics, String, float, float, float) - Method in class PShapeSVG.Font
-
 
-
drawTexture(int, int, int, int, int, int, int, int) - Method in class PGL
-
-
Not an approved function, this will change or be removed in the future.
-
-
drawTexture(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) - Method in class PGL
-
-
Not an approved function, this will change or be removed in the future.
-
-
DST_ALPHA - Static variable in class PGL
-
 
-
DST_COLOR - Static variable in class PGL
-
 
-
DXF - Static variable in interface PConstants
-
 
-
DYNAMIC_DRAW - Static variable in class PGL
-
 
-
- - - -

E

-
-
E2D - Static variable in interface PConstants
-
 
-
EB - Static variable in class PGraphics
-
 
-
edge(boolean) - Method in class PApplet
-
-
Sets whether the upcoming vertex is part of an edge.
-
-
EDGE - Static variable in class PGraphics
-
 
-
edge - Variable in class PGraphics
-
 
-
edge(boolean) - Method in class PGraphics
-
-
Sets whether the upcoming vertex is part of an edge.
-
-
EDIT - Static variable in class EditorStatus
-
 
-
Editor - Class in processing.app
-
-
Main editor panel for the Processing Development Environment.
-
-
EditorButton - Class in processing.app
-
 
-
EditorButton(Mode, String, String) - Constructor for class EditorButton
-
 
-
EditorButton(Mode, String, String, String) - Constructor for class EditorButton
-
 
-
EditorButton(Mode, String, String, String, String) - Constructor for class EditorButton
-
 
-
EditorConsole - Class in processing.app
-
-
Message console that sits below the editing area.
-
-
EditorConsole(Editor) - Constructor for class EditorConsole
-
 
-
EditorFooter - Class in processing.app
-
-
Console/error/whatever tabs at the bottom of the editor window.
-
-
EditorFooter(Editor) - Constructor for class EditorFooter
-
 
-
EditorHeader - Class in processing.app
-
-
Sketch tabs at the top of the editor window.
-
-
EditorHeader(Editor) - Constructor for class EditorHeader
-
 
-
EditorState - Class in processing.app
-
 
-
EditorStatus - Class in processing.app
-
-
Panel just below the editing area that contains status messages.
-
-
EditorStatus(BasicSplitPaneUI, Editor) - Constructor for class EditorStatus
-
 
-
EditorToolbar - Class in processing.app
-
-
Run/Stop button plus Mode selection
-
-
EditorToolbar(Editor) - Constructor for class EditorToolbar
-
 
-
EG - Static variable in class PGraphics
-
 
-
electricScroll - Variable in class TextAreaDefaults
-
 
-
ELEMENT_ARRAY_BUFFER - Static variable in class PGL
-
 
-
ELIST - Static variable in interface JavaTokenTypes
-
 
-
ELIST - Static variable in interface PdePartialTokenTypes
-
 
-
ELIST - Static variable in interface PdeTokenTypes
-
 
-
ellipse(float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from ellipse.xml ) - - Draws an ellipse (oval) in the display window.
-
-
ELLIPSE - Static variable in interface PConstants
-
 
-
ellipse(float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from ellipse.xml ) - - Draws an ellipse (oval) in the display window.
-
-
ellipseImpl(float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
ellipseMode(int) - Method in class PApplet
-
-
( begin auto-generated from ellipseMode.xml ) - - The origin of the ellipse is modified by the ellipseMode() - function.
-
-
ellipseMode - Variable in class PGraphics
-
-
The current ellipse mode (read-only)
-
-
ellipseMode(int) - Method in class PGraphics
-
-
( begin auto-generated from ellipseMode.xml ) - - The origin of the ellipse is modified by the ellipseMode() - function.
-
-
ellipseMode - Variable in class PStyle
-
 
-
emissive(int) - Method in class PApplet
-
-
( begin auto-generated from emissive.xml ) - - Sets the emissive color of the material used for drawing shapes drawn to - the screen.
-
-
emissive(float) - Method in class PApplet
-
-
gray number specifying value between white and black
-
-
emissive(float, float, float) - Method in class PApplet
-
 
-
emissive(int) - Method in class PGraphics
-
-
( begin auto-generated from emissive.xml ) - - Sets the emissive color of the material used for drawing shapes drawn to - the screen.
-
-
emissive(float) - Method in class PGraphics
-
-
gray number specifying value between white and black
-
-
emissive(float, float, float) - Method in class PGraphics
-
 
-
emissive(int) - Method in class PShape
-
 
-
emissive(float) - Method in class PShape
-
 
-
emissive(float, float, float) - Method in class PShape
-
 
-
emissiveB - Variable in class PGraphics
-
 
-
emissiveB - Variable in class PStyle
-
 
-
emissiveColor - Variable in class PGraphics
-
 
-
emissiveG - Variable in class PGraphics
-
 
-
emissiveG - Variable in class PStyle
-
 
-
emissiveR - Variable in class PGraphics
-
 
-
emissiveR - Variable in class PStyle
-
 
-
empty() - Method in class EditorStatus
-
 
-
EMPTY_FIELD - Static variable in interface PdePartialTokenTypes
-
 
-
EMPTY_FIELD - Static variable in interface PdeTokenTypes
-
 
-
EMPTY_STAT - Static variable in interface JavaTokenTypes
-
 
-
EMPTY_STAT - Static variable in interface PdePartialTokenTypes
-
 
-
EMPTY_STAT - Static variable in interface PdeTokenTypes
-
 
-
enable(int) - Method in class PGL
-
 
-
enable(int) - Method in class PJOGL
-
 
-
ENABLE_DEPTH_MASK - Static variable in interface PConstants
-
 
-
ENABLE_DEPTH_SORT - Static variable in interface PConstants
-
 
-
ENABLE_DEPTH_TEST - Static variable in interface PConstants
-
 
-
ENABLE_NATIVE_FONTS - Static variable in interface PConstants
-
-
Deprecated.
-
-
ENABLE_OPENGL_ERRORS - Static variable in interface PConstants
-
 
-
ENABLE_OPTIMIZED_STROKE - Static variable in interface PConstants
-
 
-
ENABLE_STROKE_PERSPECTIVE - Static variable in interface PConstants
-
 
-
ENABLE_STROKE_PURE - Static variable in interface PConstants
-
 
-
ENABLE_TEXTURE_MIPMAPS - Static variable in interface PConstants
-
 
-
enableAssert(boolean) - Method in class JavaLexer
-
-
Enable the "assert" keyword
-
-
enableAssert(boolean) - Method in class PdeLexer
-
-
Enable the "assert" keyword
-
-
enableEnum(boolean) - Method in class JavaLexer
-
-
Enable the "enum" keyword
-
-
enableEnum(boolean) - Method in class PdeLexer
-
-
Enable the "enum" keyword
-
-
enableStyle() - Method in class PShape
-
-
( begin auto-generated from PShape_enableStyle.xml ) - - Enables the shape's style data and ignores Processing's current styles.
-
-
enableStyle() - Method in class PShapeOpenGL
-
 
-
enableVertexAttribArray(int) - Method in class PGL
-
 
-
enableVertexAttribArray(int) - Method in class PJOGL
-
 
-
END - Static variable in class InputHandler
-
 
-
end(boolean) - Constructor for class InputHandler.end
-
 
-
END - Static variable in class Token
-
-
The token type, that along with a length of 0 - marks the end of the token list.
-
-
end() - Method in class LineStroker
-
 
-
endCamera() - Method in class PApplet
-
-
( begin auto-generated from endCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
-
-
endCamera() - Method in class PGraphics
-
-
( begin auto-generated from endCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
-
-
endCamera() - Method in class PGraphics2D
-
 
-
endCamera() - Method in class PGraphicsOpenGL
-
-
Record the current settings into the camera matrix, and set the matrix mode - back to the current transformation matrix.
-
-
endCompositionText(AttributedCharacterIterator, int) - Method in class CompositionTextManager
-
-
Called when a user fixed text from input method or delete all - composition text.
-
-
endCompoundEdit() - Method in class SyntaxDocument
-
-
Ends a compound edit that can be undone in one operation.
-
-
endContour() - Method in class PApplet
-
 
-
endContour() - Method in class PGraphics
-
 
-
endContour() - Method in class PGraphicsFX2D
-
 
-
endContour() - Method in class PGraphicsJava2D
-
 
-
endContour() - Method in class PShape
-
 
-
endContour() - Method in class PGraphicsOpenGL
-
 
-
endDraw() - Method in class PGraphics
-
-
( begin auto-generated from PGraphics_endDraw.xml ) - - Finalizes the rendering of a PGraphics object so that it can be shown on screen.
-
-
endDraw() - Method in class PGraphicsFX2D
-
 
-
endDraw() - Method in class PGraphicsJava2D
-
 
-
endDraw() - Method in class PGraphicsOpenGL
-
 
-
endPGL() - Method in class PApplet
-
 
-
endPGL() - Method in class PGraphics
-
 
-
endPGL() - Method in class PGraphicsOpenGL
-
 
-
endRaw() - Method in class PApplet
-
-
( begin auto-generated from endRaw.xml ) - - Complement to beginRaw(); they must always be used together.
-
-
endRaw() - Method in class PGraphics
-
 
-
endRaw() - Method in class PGraphicsJava2D
-
 
-
endRecord() - Method in class PApplet
-
-
( begin auto-generated from endRecord.xml ) - - Stops the recording process started by beginRecord() and closes - the file.
-
-
endShape() - Method in class PApplet
-
 
-
endShape(int) - Method in class PApplet
-
-
( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape().
-
-
endShape() - Method in class PGraphics
-
 
-
endShape(int) - Method in class PGraphics
-
-
( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape().
-
-
endShape(int) - Method in class PGraphicsFX2D
-
 
-
endShape(int) - Method in class PGraphicsJava2D
-
 
-
endShape() - Method in class PShape
-
 
-
endShape(int) - Method in class PShape
-
 
-
endShape(int) - Method in class PGraphicsOpenGL
-
 
-
endShape(int) - Method in class PShapeOpenGL
-
 
-
ensureExistence() - Method in class Sketch
-
-
Make sure the sketch hasn't been moved or deleted by some - nefarious user.
-
-
ENTER - Static variable in interface PConstants
-
 
-
ENTER - Static variable in class MouseEvent
-
 
-
ENUM_CONSTANT_DEF - Static variable in interface JavaTokenTypes
-
 
-
ENUM_CONSTANT_DEF - Static variable in interface PdePartialTokenTypes
-
 
-
ENUM_CONSTANT_DEF - Static variable in interface PdeTokenTypes
-
 
-
ENUM_DEF - Static variable in interface JavaTokenTypes
-
 
-
ENUM_DEF - Static variable in interface PdePartialTokenTypes
-
 
-
ENUM_DEF - Static variable in interface PdeTokenTypes
-
 
-
enumBlock() - Method in class JavaRecognizer
-
 
-
enumBlock() - Method in class PdeRecognizer
-
 
-
enumConstant() - Method in class JavaRecognizer
-
 
-
enumConstant() - Method in class PdeRecognizer
-
 
-
enumConstantBlock() - Method in class JavaRecognizer
-
 
-
enumConstantBlock() - Method in class PdeRecognizer
-
 
-
enumConstantField() - Method in class JavaRecognizer
-
 
-
enumConstantField() - Method in class PdeRecognizer
-
 
-
enumDefinition(AST) - Method in class JavaRecognizer
-
 
-
enumDefinition(AST) - Method in class PdeRecognizer
-
 
-
EOF - Static variable in interface JavaTokenTypes
-
 
-
EOF - Static variable in interface PdePartialTokenTypes
-
 
-
EOF - Static variable in interface PdeTokenTypes
-
 
-
eolMarkerColor - Variable in class TextAreaDefaults
-
 
-
eolMarkers - Variable in class TextAreaDefaults
-
 
-
EPSILON - Static variable in interface PConstants
-
 
-
EQUAL - Static variable in interface JavaTokenTypes
-
 
-
EQUAL - Static variable in interface PdePartialTokenTypes
-
 
-
EQUAL - Static variable in interface PdeTokenTypes
-
 
-
EQUAL - Static variable in class PGL
-
 
-
equalityExpression() - Method in class JavaRecognizer
-
 
-
equalityExpression() - Method in class PdeRecognizer
-
 
-
equals(Object) - Method in class ModeContribution
-
 
-
equals(Object) - Method in class PVector
-
 
-
ER - Static variable in class PGraphics
-
 
-
ERODE - Static variable in interface PConstants
-
 
-
ERR - Static variable in class EditorStatus
-
 
-
error(String) - Method in class EditorStatus
-
 
-
ERROR_BACKGROUND_IMAGE_FORMAT - Static variable in interface PConstants
-
 
-
ERROR_BACKGROUND_IMAGE_SIZE - Static variable in interface PConstants
-
 
-
ERROR_PUSHMATRIX_OVERFLOW - Static variable in interface PConstants
-
 
-
ERROR_PUSHMATRIX_UNDERFLOW - Static variable in interface PConstants
-
 
-
ERROR_TEXTFONT_NULL_PFONT - Static variable in interface PConstants
-
 
-
errorString(int) - Method in class PGL
-
 
-
errorString(int) - Method in class PJOGL
-
 
-
ESC - Static variable in interface PConstants
-
 
-
ESC - Static variable in interface JavaTokenTypes
-
 
-
ESC - Static variable in interface PdePartialTokenTypes
-
 
-
ESC - Static variable in interface PdeTokenTypes
-
 
-
Event - Class in processing.event
-
 
-
Event(Object, long, int, int) - Constructor for class Event
-
 
-
ExamplesContribution - Class in processing.app.contrib
-
 
-
EXCLUSION - Static variable in interface PConstants
-
 
-
exclusiveOrExpression() - Method in class JavaRecognizer
-
 
-
exclusiveOrExpression() - Method in class PdeRecognizer
-
 
-
exec(String...) - Static method in class PApplet
-
 
-
execute() - Method in class ProcessHelper
-
-
Blocking execution.
-
-
execute(String) - Method in class ProcessHelper
-
-
Blocks execution, also passes a single line to the command's input stream.
-
-
executeAction(ActionListener, Object, String) - Method in class InputHandler
-
-
Executes the specified action, repeating and recording it as - necessary.
-
-
exit() - Method in class PApplet
-
-
( begin auto-generated from exit.xml ) - - Quits/stops/exits the program.
-
-
EXIT - Static variable in class MouseEvent
-
 
-
exitActual() - Method in class PApplet
-
-
Some subclasses (I'm looking at you, processing.py) might wish to do something - other than actually terminate the JVM.
-
-
exitCalled() - Method in class PApplet
-
 
-
exp(float) - Static method in class PApplet
-
-
( begin auto-generated from exp.xml ) - - Returns Euler's number e (2.71828...) raised to the power of the - value parameter.
-
-
expand(boolean[]) - Static method in class PApplet
-
-
( begin auto-generated from expand.xml ) - - Increases the size of an array.
-
-
expand(boolean[], int) - Static method in class PApplet
-
 
-
expand(byte[]) - Static method in class PApplet
-
 
-
expand(byte[], int) - Static method in class PApplet
-
 
-
expand(char[]) - Static method in class PApplet
-
 
-
expand(char[], int) - Static method in class PApplet
-
 
-
expand(int[]) - Static method in class PApplet
-
 
-
expand(int[], int) - Static method in class PApplet
-
 
-
expand(long[]) - Static method in class PApplet
-
 
-
expand(long[], int) - Static method in class PApplet
-
 
-
expand(float[]) - Static method in class PApplet
-
 
-
expand(float[], int) - Static method in class PApplet
-
 
-
expand(double[]) - Static method in class PApplet
-
 
-
expand(double[], int) - Static method in class PApplet
-
 
-
expand(String[]) - Static method in class PApplet
-
 
-
expand(String[], int) - Static method in class PApplet
-
 
-
expand(Object) - Static method in class PApplet
-
 
-
expand(Object, int) - Static method in class PApplet
-
 
-
explicitConstructorInvocation() - Method in class JavaRecognizer
-
-
Catch obvious constructor calls, but not the expr.super(...) calls
-
-
explicitConstructorInvocation() - Method in class PdeRecognizer
-
 
-
EXPONENT - Static variable in interface JavaTokenTypes
-
 
-
EXPONENT - Static variable in interface PdePartialTokenTypes
-
 
-
EXPONENT - Static variable in interface PdeTokenTypes
-
 
-
EXPR - Static variable in interface JavaTokenTypes
-
 
-
EXPR - Static variable in interface PdePartialTokenTypes
-
 
-
EXPR - Static variable in interface PdeTokenTypes
-
 
-
expression() - Method in class JavaRecognizer
-
 
-
expression() - Method in class PdeRecognizer
-
 
-
expressionList() - Method in class JavaRecognizer
-
 
-
expressionList() - Method in class PdeRecognizer
-
 
-
EXTENDS_CLAUSE - Static variable in interface JavaTokenTypes
-
 
-
EXTENDS_CLAUSE - Static variable in interface PdePartialTokenTypes
-
 
-
EXTENDS_CLAUSE - Static variable in interface PdeTokenTypes
-
 
-
extensionOptions(boolean, String, String) - Static method in class Table
-
 
-
EXTENSIONS - Static variable in class PGL
-
 
-
EXTERNAL_MOVE - Static variable in class 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 PApplet
-
-
When run externally to a PdeEditor, - this is sent by the sketch when it quits.
-
-
- - - -

F

-
-
face - Variable in class PShapeSVG.Font
-
 
-
FALSE - Static variable in class PGL
-
 
-
FASTEST - Static variable in class PGL
-
 
-
fboMultisampleSupported - Static variable in class PGraphicsOpenGL
-
 
-
ffs(String...) - Static method in class ProcessHelper
-
 
-
fgcolor - Variable in class TextAreaDefaults
-
 
-
fileSelected(File) - Method in class Archiver
-
 
-
fill(int) - Method in class PApplet
-
-
( begin auto-generated from fill.xml ) - - Sets the color used to fill shapes.
-
-
fill(int, float) - Method in class PApplet
-
 
-
fill(float) - Method in class PApplet
-
 
-
fill(float, float) - Method in class PApplet
-
 
-
fill(float, float, float) - Method in class PApplet
-
 
-
fill(float, float, float, float) - Method in class PApplet
-
 
-
fill - Variable in class PGraphics
-
-
true if fill() is enabled, (read-only)
-
-
fill(int) - Method in class PGraphics
-
-
( begin auto-generated from fill.xml ) - - Sets the color used to fill shapes.
-
-
fill(int, float) - Method in class PGraphics
-
 
-
fill(float) - Method in class PGraphics
-
 
-
fill(float, float) - Method in class PGraphics
-
 
-
fill(float, float, float) - Method in class PGraphics
-
 
-
fill(float, float, float, float) - Method in class PGraphics
-
 
-
fill(int) - Method in class PShape
-
 
-
fill(int, float) - Method in class PShape
-
 
-
fill(float) - Method in class PShape
-
 
-
fill(float, float) - Method in class PShape
-
 
-
fill(float, float, float) - Method in class PShape
-
 
-
fill(float, float, float, float) - Method in class PShape
-
 
-
fill - Variable in class PStyle
-
 
-
fillColor - Variable in class PGraphics
-
-
fill that was last set (read-only)
-
-
fillColor - Variable in class PStyle
-
 
-
fillGradient - Variable in class PGraphicsJava2D
-
 
-
fillGradientObject - Variable in class PGraphicsJava2D
-
 
-
filter(PShader) - Method in class PApplet
-
 
-
filter(int) - Method in class PApplet
-
 
-
filter(int, float) - Method in class PApplet
-
-
( begin auto-generated from PImage_filter.xml ) - - Filters an image as defined by one of the following modes:

THRESHOLD - converts the image to black and white pixels depending if - they are above or below the threshold defined by the level parameter.
-
-
filter(PShader) - Method in class PGraphics
-
 
-
filter(int) - Method in class PGraphicsDanger2D
-
 
-
filter(int, float) - Method in class PGraphicsDanger2D
-
 
-
filter(int) - Method in class PImage
-
 
-
filter(int, float) - Method in class PImage
-
-
( begin auto-generated from PImage_filter.xml ) - - Filters an image as defined by one of the following modes:

THRESHOLD - converts the image to black and white pixels depending if - they are above or below the threshold defined by the level parameter.
-
-
filter(int) - Method in class PGraphicsOpenGL
-
-
This is really inefficient and not a good idea in OpenGL.
-
-
filter(int, float) - Method in class PGraphicsOpenGL
-
-
This is really inefficient and not a good idea in OpenGL.
-
-
filter(PShader) - Method in class PGraphicsOpenGL
-
 
-
filterLibraries(List<Contribution>) - Method in class ContributionListPanel
-
 
-
FINAL - Static variable in interface JavaTokenTypes
-
 
-
FINAL - Static variable in interface PdePartialTokenTypes
-
 
-
FINAL - Static variable in interface PdeTokenTypes
-
 
-
finallyClause() - Method in class JavaRecognizer
-
 
-
finallyClause() - Method in class PdeRecognizer
-
 
-
findChild(String) - Method in class PShape
-
-
Same as getChild(name), except that it first walks all the way up the - hierarchy to the eldest grandparent, so that children can be found anywhere.
-
-
findFont(String) - Static method in class PFont
-
-
Starting with Java 1.5, Apple broke the ability to specify most fonts.
-
-
findLibraryByName(String) - Method in class Mode
-
-
Checks coreLibraries and contribLibraries for a library with the specified name
-
-
findMatchingBracket(String, int) - Method in class Brackets
-
 
-
findNative() - Method in class PFont
-
-
Attempt to find the native version of this font.
-
-
findNext() - Method in class FindReplace
-
 
-
findPrevious() - Method in class FindReplace
-
 
-
FindReplace - Class in processing.app
-
-
Find & Replace window for the Processing editor.
-
-
FindReplace(Editor) - Constructor for class FindReplace
-
 
-
findRow(String, int) - Method in class Table
-
 
-
findRow(String, String) - Method in class Table
-
 
-
findRowIndex(String, int) - Method in class Table
-
-
Return the row that contains the first String that matches.
-
-
findRowIndex(String, String) - Method in class Table
-
-
Return the row that contains the first String that matches.
-
-
findRowIndices(String, int) - Method in class Table
-
-
Return a list of rows that contain the String passed in.
-
-
findRowIndices(String, String) - Method in class Table
-
-
Return a list of rows that contain the String passed in.
-
-
findRowIterator(String, int) - Method in class Table
-
 
-
findRowIterator(String, String) - Method in class Table
-
 
-
findRows(String, int) - Method in class Table
-
 
-
findRows(String, String) - Method in class Table
-
 
-
findWordEnd(String, int, String) - Static method in class InputHandler
-
-
Locates the end of the word at the specified position.
-
-
findWordStart(String, int, String) - Static method in class InputHandler
-
-
Locates the start of the word at the specified position.
-
-
finish() - Method in class FrameBuffer
-
 
-
finish() - Method in class PGL
-
 
-
finish() - Method in class PJOGL
-
 
-
finished - Variable in class PApplet
-
-
true if the sketch has stopped permanently.
-
-
firstMouse - Variable in class PApplet
-
-
Deprecated. -
Please refrain from using this variable, it will be removed - from future releases of Processing because it cannot be used consistently - across platforms and input methods.
-
-
-
FLOAT - Static variable in class Table
-
 
-
FLOAT - Static variable in class PGL
-
 
-
FLOAT_MAT2 - Static variable in class PGL
-
 
-
FLOAT_MAT3 - Static variable in class PGL
-
 
-
FLOAT_MAT4 - Static variable in class PGL
-
 
-
FLOAT_SUFFIX - Static variable in interface JavaTokenTypes
-
 
-
FLOAT_SUFFIX - Static variable in interface PdePartialTokenTypes
-
 
-
FLOAT_SUFFIX - Static variable in interface PdeTokenTypes
-
 
-
FLOAT_VEC2 - Static variable in class PGL
-
 
-
FLOAT_VEC3 - Static variable in class PGL
-
 
-
FLOAT_VEC4 - Static variable in class PGL
-
 
-
FloatDict - Class in processing.data
-
-
A simple table class to use a String as a lookup for an float value.
-
-
FloatDict() - Constructor for class FloatDict
-
 
-
FloatDict(int) - Constructor for class FloatDict
-
-
Create a new lookup with a specific size.
-
-
FloatDict(BufferedReader) - Constructor for class FloatDict
-
-
Read a set of entries from a Reader that has each key/value pair on - a single line, separated by a tab.
-
-
FloatDict(Object[][]) - Constructor for class FloatDict
-
-
Constructor to allow (more intuitive) inline initialization, e.g.:
-
-
FloatDict(String[], float[]) - Constructor for class FloatDict
-
 
-
FloatList - Class in processing.data
-
-
Helper class for a list of floats.
-
-
FloatList() - Constructor for class FloatList
-
 
-
FloatList(int) - Constructor for class FloatList
-
 
-
FloatList(float[]) - Constructor for class FloatList
-
 
-
FloatList(Iterable<Object>) - Constructor for class FloatList
-
-
Construct an FloatList from an iterable pile of objects.
-
-
FloatList(Object...) - Constructor for class FloatList
-
-
Construct an FloatList from a random pile of objects.
-
-
floor(float) - Static method in class PApplet
-
-
( begin auto-generated from floor.xml ) - - Calculates the closest int value that is less than or equal to the value - of the parameter.
-
-
flush() - Method in class PApplet
-
 
-
flush() - Method in class PGraphics
-
 
-
flush() - Method in class PGL
-
 
-
flush() - Method in class PGraphicsOpenGL
-
 
-
flush() - Method in class PJOGL
-
 
-
focused - Variable in class PApplet
-
-
( begin auto-generated from focused.xml ) - - Confirms if a Processing program is "focused", meaning that it is active - and will accept input from mouse or keyboard.
-
-
focusGained() - Method in class PApplet
-
 
-
focusLost() - Method in class PApplet
-
 
-
Font(PShapeSVG, XML) - Constructor for class PShapeSVG.Font
-
 
-
FontGlyph(PShapeSVG, XML, PShapeSVG.Font) - Constructor for class PShapeSVG.FontGlyph
-
 
-
FOR_CONDITION - Static variable in interface JavaTokenTypes
-
 
-
FOR_CONDITION - Static variable in interface PdePartialTokenTypes
-
 
-
FOR_CONDITION - Static variable in interface PdeTokenTypes
-
 
-
FOR_EACH_CLAUSE - Static variable in interface JavaTokenTypes
-
 
-
FOR_EACH_CLAUSE - Static variable in interface PdePartialTokenTypes
-
 
-
FOR_EACH_CLAUSE - Static variable in interface PdeTokenTypes
-
 
-
FOR_INIT - Static variable in interface JavaTokenTypes
-
 
-
FOR_INIT - Static variable in interface PdePartialTokenTypes
-
 
-
FOR_INIT - Static variable in interface PdeTokenTypes
-
 
-
FOR_ITERATOR - Static variable in interface JavaTokenTypes
-
 
-
FOR_ITERATOR - Static variable in interface PdePartialTokenTypes
-
 
-
FOR_ITERATOR - Static variable in interface PdeTokenTypes
-
 
-
forCond() - Method in class JavaRecognizer
-
 
-
forCond() - Method in class PdeRecognizer
-
 
-
forEachClause() - Method in class JavaRecognizer
-
 
-
forEachClause() - Method in class PdeRecognizer
-
 
-
forInit() - Method in class JavaRecognizer
-
 
-
forInit() - Method in class PdeRecognizer
-
 
-
forIter() - Method in class JavaRecognizer
-
 
-
forIter() - Method in class PdeRecognizer
-
 
-
format(String) - Method in interface Formatter
-
 
-
format - Variable in class PImage
-
-
Format for this image, one of RGB, ARGB or ALPHA.
-
-
format(int) - Method in class JSONArray
-
-
Make a pretty-printed JSON text of this JSONArray.
-
-
format(int) - Method in class JSONObject
-
-
Make a prettyprinted JSON text of this JSONObject.
-
-
format(int) - Method in class XML
-
-
Format this XML data as a String.
-
-
format - Variable in class Texture.Parameters
-
-
Texture internal format.
-
-
Formatter - Interface in processing.app
-
-
This may change to a more generic String manipulating interface/class, since - it probably affects other code as well.
-
-
forStatement() - Method in class JavaRecognizer
-
 
-
forStatement() - Method in class PdeRecognizer
-
 
-
FRAGMENT_SHADER - Static variable in class PGL
-
 
-
frame - Variable in class PApplet
-
-
The frame containing this sketch (if any)
-
-
FrameBuffer - Class in processing.opengl
-
-
Encapsulates a Frame Buffer Object for offscreen rendering.
-
-
FRAMEBUFFER - Static variable in class PGL
-
 
-
FRAMEBUFFER_ATTACHMENT_OBJECT_NAME - Static variable in class PGL
-
 
-
FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE - Static variable in class PGL
-
 
-
FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE - Static variable in class PGL
-
 
-
FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL - Static variable in class PGL
-
 
-
FRAMEBUFFER_COMPLETE - Static variable in class PGL
-
 
-
FRAMEBUFFER_ERROR - Static variable in class PGL
-
 
-
FRAMEBUFFER_INCOMPLETE_ATTACHMENT - Static variable in class PGL
-
 
-
FRAMEBUFFER_INCOMPLETE_DIMENSIONS - Static variable in class PGL
-
 
-
FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER - Static variable in class PGL
-
 
-
FRAMEBUFFER_INCOMPLETE_FORMATS - Static variable in class PGL
-
 
-
FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT - Static variable in class PGL
-
 
-
FRAMEBUFFER_INCOMPLETE_READ_BUFFER - Static variable in class PGL
-
 
-
FRAMEBUFFER_UNSUPPORTED - Static variable in class PGL
-
 
-
framebufferRenderbuffer(int, int, int, int) - Method in class PGL
-
 
-
framebufferRenderbuffer(int, int, int, int) - Method in class PJOGL
-
 
-
framebufferTexture2D(int, int, int, int, int) - Method in class PGL
-
 
-
framebufferTexture2D(int, int, int, int, int) - Method in class PJOGL
-
 
-
frameCount - Variable in class PApplet
-
-
( begin auto-generated from frameCount.xml ) - - The system variable frameCount contains the number of frames - displayed since the program started.
-
-
frameRate - Variable in class PApplet
-
-
( begin auto-generated from frameRate_var.xml ) - - The system variable frameRate contains the approximate frame rate - of the software as it executes.
-
-
frameRate(float) - Method in class PApplet
-
-
( begin auto-generated from frameRate.xml ) - - Specifies the number of frames to be displayed every second.
-
-
fromAngle(float) - Static method in class PVector
-
-
( begin auto-generated from PVector_sub.xml ) - - Make a new 2D unit vector from an angle.
-
-
fromAngle(float, PVector) - Static method in class PVector
-
-
Make a new 2D unit vector from an angle
-
-
fromName(String) - Static method in enum ContributionType
-
 
-
fromRange(int) - Static method in class IntList
-
 
-
fromRange(int, int) - Static method in class IntList
-
 
-
FRONT - Static variable in class PGL
-
 
-
FRONT_AND_BACK - Static variable in class PGL
-
 
-
frontFace(int) - Method in class PGL
-
 
-
frontFace(int) - Method in class PJOGL
-
 
-
frustum(float, float, float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from frustum.xml ) - - Sets a perspective matrix defined through the parameters.
-
-
frustum(float, float, float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from frustum.xml ) - - Sets a perspective matrix defined through the parameters.
-
-
frustum(float, float, float, float, float, float) - Method in class PGraphics2D
-
 
-
frustum(float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
-
Same as glFrustum(), except that it wipes out (rather than multiplies - against) the current perspective matrix.
-
-
fullScreen() - Method in class PApplet
-
-
Create a full-screen sketch using the default renderer.
-
-
fullScreen(int) - Method in class PApplet
-
 
-
fullScreen(String) - Method in class PApplet
-
-
( begin auto-generated from fullScreen.xml ) - - Description to come...
-
-
fullScreen(String, int) - Method in class PApplet
-
 
-
FUNC_ADD - Static variable in class PGL
-
 
-
FUNC_MAX - Static variable in class PGL
-
 
-
FUNC_MIN - Static variable in class PGL
-
 
-
FUNC_REVERSE_SUBTRACT - Static variable in class PGL
-
 
-
FUNC_SUBTRACT - Static variable in class PGL
-
 
-
FUNCTION1 - Static variable in class Token
-
-
Functions
-
-
FUNCTION2 - Static variable in class Token
-
-
Methods (functions inside a class)
-
-
FUNCTION3 - Static variable in class Token
-
-
Loop/function-like blocks (for, while, etc.)
-
-
FUNCTION4 - Static variable in class Token
-
-
Built-in Processing functions (setup, draw, mouseDragged).
-
-
FX2D - Static variable in interface PConstants
-
 
-
- - - -

G

-
-
g - Variable in class PApplet
-
-
The PGraphics renderer associated with this PApplet
-
-
G - Static variable in class PGraphics
-
 
-
g2 - Variable in class PGraphicsJava2D
-
 
-
GE - Static variable in interface JavaTokenTypes
-
 
-
GE - Static variable in interface PdePartialTokenTypes
-
 
-
GE - Static variable in interface PdeTokenTypes
-
 
-
genBuffers(int, IntBuffer) - Method in class PGL
-
 
-
genBuffers(int, IntBuffer) - Method in class PJOGL
-
 
-
GENERATE_MIPMAP_HINT - Static variable in class PGL
-
 
-
generateMipmap(int) - Method in class PGL
-
 
-
generateMipmap(int) - Method in class PJOGL
-
 
-
genFramebuffers(int, IntBuffer) - Method in class PGL
-
 
-
genFramebuffers(int, IntBuffer) - Method in class PJOGL
-
 
-
genRenderbuffers(int, IntBuffer) - Method in class PGL
-
 
-
genRenderbuffers(int, IntBuffer) - Method in class PJOGL
-
 
-
genTextures(int, IntBuffer) - Method in class PGL
-
 
-
genTextures(int, IntBuffer) - Method in class PJOGL
-
 
-
GEOMETRY - Static variable in class PShape
-
-
Collections of vertices created with beginShape().
-
-
GEQUAL - Static variable in class PGL
-
 
-
get(String) - Static method in class Preferences
-
 
-
get(String) - Method in class Settings
-
 
-
get(int, int) - Method in class PApplet
-
-
( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image.
-
-
get(int, int, int, int) - Method in class PApplet
-
 
-
get() - Method in class PApplet
-
-
Returns a copy of this PImage.
-
-
get(int, int) - Method in class PGraphicsDanger2D
-
 
-
get(int, int, int, int) - Method in class PGraphicsDanger2D
-
 
-
get() - Method in class PGraphicsDanger2D
-
 
-
get(int, int) - Method in class PGraphicsJava2D
-
 
-
get() - Method in class PGraphicsJava2D
-
 
-
get(int, int) - Method in class PImage
-
-
( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image.
-
-
get(int, int, int, int) - Method in class PImage
-
 
-
get() - Method in class PImage
-
-
Returns a copy of this PImage.
-
-
get() - Method in interface PMatrix
-
-
Returns a copy of this PMatrix.
-
-
get(float[]) - Method in interface PMatrix
-
-
Copies the matrix contents into a float array.
-
-
get() - Method in class PMatrix2D
-
-
Returns a copy of this PMatrix.
-
-
get(float[]) - Method in class PMatrix2D
-
-
Copies the matrix contents into a 6 entry float array.
-
-
get() - Method in class PMatrix3D
-
-
Returns a copy of this PMatrix.
-
-
get(float[]) - Method in class PMatrix3D
-
-
Copies the matrix contents into a 16 entry float array.
-
-
get() - Method in class PVector
-
-
Deprecated.
-
-
get(float[]) - Method in class PVector
-
 
-
get(String) - Method in class FloatDict
-
-
Return a value for the specified key.
-
-
get(String, float) - Method in class FloatDict
-
 
-
get(int) - Method in class FloatList
-
-
Get an entry at a particular index.
-
-
get(String) - Method in class IntDict
-
-
Return a value for the specified key.
-
-
get(String, int) - Method in class IntDict
-
 
-
get(int) - Method in class IntList
-
-
Get an entry at a particular index.
-
-
get(String) - Method in class StringDict
-
-
Return a value for the specified key.
-
-
get(String, String) - Method in class StringDict
-
 
-
get(int) - Method in class StringList
-
-
Get an entry at a particular index.
-
-
get(int, int) - Method in class PGraphicsOpenGL
-
 
-
get(int[]) - Method in class Texture
-
-
Copy texture to pixels.
-
-
getAction(String) - Static method in class InputHandler
-
-
Returns a named text area action.
-
-
getAction() - Method in class Event
-
 
-
getActionName(ActionListener) - Static method in class InputHandler
-
-
Returns the name of the specified text area action.
-
-
getActions() - Static method in class InputHandler
-
-
Returns an enumeration of all available actions.
-
-
getActiveAttrib(int, int, IntBuffer, IntBuffer) - Method in class PGL
-
 
-
getActiveAttrib(int, int, IntBuffer, IntBuffer) - Method in class PJOGL
-
 
-
getActiveEditor() - Method in class Base
-
-
Returns the front most, active editor window.
-
-
getActiveUniform(int, int, IntBuffer, IntBuffer) - Method in class PGL
-
 
-
getActiveUniform(int, int, IntBuffer, IntBuffer) - Method in class PJOGL
-
 
-
getAmbient(int) - Method in class PShape
-
 
-
getAmbient(int) - Method in class PShapeOpenGL
-
 
-
getAmount() - Method in class MouseEvent
-
-
Deprecated.
-
-
getAndroidExports() - Method in class Library
-
 
-
getAppletExports() - Method in class Library
-
-
Applet exports don't go by platform, since by their nature applets are - meant to be cross-platform.
-
-
getApplicationExportList(int, int) - Method in class Library
-
-
Returns the necessary exports for the specified platform.
-
-
getApplicationExports(int, int) - Method in class Library
-
 
-
getAttachedShaders(int, int, IntBuffer, IntBuffer) - Method in class PGL
-
 
-
getAttachedShaders(int, int, IntBuffer, IntBuffer) - Method in class PJOGL
-
 
-
getAttribLocation(int, String) - Method in class PGL
-
 
-
getAttribLocation(int, String) - Method in class PJOGL
-
 
-
getAttributeCount() - Method in class XML
-
-
Returns the number of attributes.
-
-
getAuthorList() - Method in class Contribution
-
 
-
getBase() - Method in class Editor
-
 
-
getBoolean(String) - Method in class Mode
-
 
-
getBoolean(String) - Static method in class Preferences
-
 
-
getBoolean(String) - Method in class Settings
-
 
-
getBoolean(int) - Method in class JSONArray
-
-
Get the boolean value associated with an index.
-
-
getBoolean(int, boolean) - Method in class JSONArray
-
-
Get the optional boolean value associated with an index.
-
-
getBoolean(String) - Method in class JSONObject
-
-
Get the boolean value associated with a key.
-
-
getBoolean(String, boolean) - Method in class JSONObject
-
-
Get an optional boolean associated with a key.
-
-
getBooleanArray() - Method in class JSONArray
-
-
Get this entire array as a boolean array.
-
-
getBooleanv(int, IntBuffer) - Method in class PGL
-
 
-
getBooleanv(int, IntBuffer) - Method in class PJOGL
-
 
-
getBracketLine() - Method in class JEditTextArea
-
-
Returns the line of the highlighted bracket (the bracket - matching the one before the caret)
-
-
getBracketPosition() - Method in class JEditTextArea
-
-
Returns the position of the highlighted bracket (the bracket - matching the one before the caret)
-
-
getBufferParameteriv(int, int, IntBuffer) - Method in class PGL
-
 
-
getBufferParameteriv(int, int, IntBuffer) - Method in class PJOGL
-
 
-
getBufferPixels(int[]) - Method in class Texture
-
 
-
getButton() - Method in class MouseEvent
-
-
Which button was pressed, either LEFT, CENTER, or RIGHT.
-
-
getCache(PImage) - Method in class PGraphics
-
-
Get cache storage data for the specified renderer.
-
-
getCache(PImage) - Method in class PGraphicsOpenGL
-
 
-
getCaretLine() - Method in class JEditTextArea
-
-
Returns the caret line.
-
-
getCaretOffset() - Method in class Editor
-
-
Get the position (character offset) of the caret.
-
-
getCaretPosition() - Method in class JEditTextArea
-
-
Returns the caret position.
-
-
getChild(int) - Method in class PShape
-
-
( begin auto-generated from PShape_getChild.xml ) - - Extracts a child shape from a parent shape.
-
-
getChild(String) - Method in class PShape
-
 
-
getChild(String) - Method in class PShapeSVG
-
-
Get a particular element based on its SVG ID.
-
-
getChild(int) - Method in class XML
-
-
Quick accessor for an element at a particular index.
-
-
getChild(String) - Method in class XML
-
-
Get a child by its name or path.
-
-
getChildCount() - Method in class PShape
-
 
-
getChildCount() - Method in class XML
-
-
Returns the number of children.
-
-
getChildIndex(PShape) - Method in class PShape
-
-
Returns the index of child who.
-
-
getChildren() - Method in class PShape
-
 
-
getChildren() - Method in class XML
-
-
Returns an array containing all the child elements.
-
-
getChildren(String) - Method in class XML
-
-
Get any children that match this name or path.
-
-
getClassLoader() - Method in class Mode
-
 
-
getClassPath() - Method in class Library
-
 
-
getClickCount() - Method in class MouseEvent
-
-
Deprecated.
-
-
getCmd() - Method in class ProcessResult
-
 
-
getCode() - Method in class Sketch
-
 
-
getCode(int) - Method in class Sketch
-
 
-
getCodeColumn() - Method in exception SketchException
-
 
-
getCodeCount() - Method in class Sketch
-
 
-
getCodeFolder() - Method in class Sketch
-
-
Returns the location of the sketch's code folder.
-
-
getCodeIndex(SketchCode) - Method in class Sketch
-
 
-
getCodeIndex() - Method in exception SketchException
-
 
-
getCodeLine() - Method in exception SketchException
-
 
-
getColor() - Method in class ColorChooser
-
 
-
getColor(String) - Method in class Mode
-
 
-
getColor(String) - Static method in class Preferences
-
 
-
getColor(String) - Method in class Settings
-
 
-
getColor() - Method in class SyntaxStyle
-
-
Returns the color specified in this style.
-
-
getColumnCount() - Method in class Table
-
 
-
getColumnCount() - Method in interface TableRow
-
 
-
getColumnIndex(String) - Method in class Table
-
 
-
getColumnTitle(int) - Method in class Table
-
 
-
getColumnTitle(int) - Method in interface TableRow
-
 
-
getColumnTitles() - Method in class Table
-
 
-
getColumnTitles() - Method in interface TableRow
-
 
-
getColumnType(String) - Method in class Table
-
 
-
getColumnType(int) - Method in class Table
-
-
Returns one of Table.STRING, Table.INT, etc...
-
-
getColumnType(String) - Method in interface TableRow
-
 
-
getColumnType(int) - Method in interface TableRow
-
 
-
getColumnTypes() - Method in class Table
-
 
-
getColumnTypes() - Method in interface TableRow
-
 
-
getCommentPrefix() - Method in class Editor
-
 
-
getCommittedText(int, int) - Method in class CompositionTextManager
-
 
-
getCommittedText(int, int, AttributedCharacterIterator.Attribute[]) - Method in class InputMethodSupport
-
 
-
getCommittedTextLength() - Method in class InputMethodSupport
-
 
-
getComparator() - Method in class ContributionListing
-
 
-
getCompatibleModesList() - Method in class ExamplesContribution
-
 
-
getComponent() - Method in class PSurfaceJOGL
-
 
-
getCompositionTextpainter() - Method in class TextAreaPainter
-
-
Get CompositionTextPainter, creating one if it doesn't exist.
-
-
getConsole() - Method in class Editor
-
 
-
getContent() - Method in class XML
-
-
Return the #PCDATA content of the element.
-
-
getContent(String) - Method in class XML
-
 
-
getContentFile(String) - Static method in class Base
-
-
Get reference to a file adjacent to the executable on Windows and Linux, - or inside Contents/Resources/Java on Mac OS X.
-
-
getContentFile(String) - Method in class Mode
-
 
-
getContentStream(String) - Method in class Mode
-
 
-
getCoreLibrary() - Method in class Mode
-
 
-
getCount() - Method in class MouseEvent
-
-
Number of clicks for mouse button events, or the number of steps (positive - or negative depending on direction) for a mouse wheel event.
-
-
getCurrentCode() - Method in class Sketch
-
 
-
getCurrentCodeIndex() - Method in class Sketch
-
 
-
getCurrentLine() - Method in class TextAreaPainter
-
-
Accessor used by tools that want to hook in and grab the formatting.
-
-
getCurrentLineIndex() - Method in class TextAreaPainter
-
-
Accessor used by tools that want to hook in and grab the formatting.
-
-
getCurrentLineTokens() - Method in class TextAreaPainter
-
-
Accessor used by tools that want to hook in and grab the formatting.
-
-
getDataFolder() - Method in class Sketch
-
-
Returns the location of the sketch's data folder.
-
-
getDefault(String) - Static method in class Preferences
-
 
-
getDefault(String) - Method in class Settings
-
 
-
getDefaultDrawBuffer() - Method in class FrameBuffer
-
 
-
getDefaultExtension() - Method in class Mode
-
-
Returns the default extension for this editor setup.
-
-
getDefaultMode() - Method in class Base
-
 
-
getDefaultReadBuffer() - Method in class FrameBuffer
-
 
-
getDefaultSketchbookFolder() - Method in class Platform
-
 
-
getDefaultSketchbookFolder() - Method in class MacPlatform
-
 
-
getDefaultSketchbookFolder() - Method in class WindowsPlatform
-
 
-
getDepth() - Method in class PShape
-
-
Get the depth of the shape area (not necessarily the shape boundary).
-
-
getDepth() - Method in class PShapeOpenGL
-
 
-
getDocument() - Method in class SketchCode
-
 
-
getDocument() - Method in class JEditTextArea
-
-
Returns the document this text area is editing.
-
-
getDocumentLength() - Method in class JEditTextArea
-
-
Returns the length of the document.
-
-
getDouble(int) - Method in class JSONArray
-
-
Get the double value associated with an index.
-
-
getDouble(int, double) - Method in class JSONArray
-
-
Get the optional double value associated with an index.
-
-
getDouble(String) - Method in class JSONObject
-
-
Get the double value associated with a key.
-
-
getDouble(String, double) - Method in class JSONObject
-
-
Get an optional double associated with a key, or the - defaultValue if there is no such key or if its value is not a number.
-
-
getDouble(int, int) - Method in class Table
-
 
-
getDouble(int, String) - Method in class Table
-
 
-
getDouble(int) - Method in interface TableRow
-
 
-
getDouble(String) - Method in interface TableRow
-
 
-
getDouble(String) - Method in class XML
-
 
-
getDouble(String, double) - Method in class XML
-
-
Returns the value of an attribute.
-
-
getDoubleArray() - Method in class JSONArray
-
-
Get this entire array as a double array.
-
-
getDoubleColumn(String) - Method in class Table
-
 
-
getDoubleColumn(int) - Method in class Table
-
 
-
getDoubleContent() - Method in class XML
-
 
-
getDoubleContent(double) - Method in class XML
-
 
-
getDoubleRow(int) - Method in class Table
-
 
-
getEditors() - Method in class Base
-
-
Get the list of currently active editor windows.
-
-
getEditorState() - Method in class Editor
-
 
-
getElectricScroll() - Method in class JEditTextArea
-
-
Returns the number of lines from the top and button of the - text area that are always visible.
-
-
getEmissive(int) - Method in class PShape
-
 
-
getEmissive(int) - Method in class PShapeOpenGL
-
 
-
getenv(String) - Method in interface Platform.CLibrary
-
 
-
getenv(String) - Method in class Platform
-
 
-
getenv(String) - Method in class WindowsPlatform
-
 
-
getErr() - Method in class EditorConsole
-
 
-
getError() - Method in class PGL
-
 
-
getError() - Method in class PJOGL
-
 
-
getExampleCategoryFolders() - Method in class Mode
-
-
Override this to control the order of the first set of example folders - and how they appear in the examples window.
-
-
getExampleContribs() - Method in class Base
-
 
-
getExamplesFolder() - Method in class Library
-
 
-
getExamplesFolder() - Method in class Mode
-
 
-
getExtension() - Method in class SketchCode
-
 
-
getExtension(String) - Static method in class PApplet
-
 
-
getExtensions() - Method in class Mode
-
-
Returns a String[] array of proper extensions.
-
-
getFamily() - Method in class PShape
-
-
The shape type, one of GROUP, PRIMITIVE, PATH, or GEOMETRY.
-
-
getFile() - Method in class SketchCode
-
 
-
getFileName(File) - Static method in class ContributionManager
-
-
Returns the name of a file without its path or extension.
-
-
getFileName() - Method in class SketchCode
-
 
-
getFill(int) - Method in class PShape
-
 
-
getFill(int) - Method in class PShapeOpenGL
-
 
-
getFirstLine() - Method in class JEditTextArea
-
-
Returns the line displayed at the text area's origin.
-
-
getFlavor() - Method in class Event
-
 
-
getFloat(int) - Method in class JSONArray
-
-
Get a value from an index as a float.
-
-
getFloat(int, float) - Method in class JSONArray
-
 
-
getFloat(String) - Method in class JSONObject
-
 
-
getFloat(String, float) - Method in class JSONObject
-
 
-
getFloat(int, int) - Method in class Table
-
-
Get a float value from the specified row and column.
-
-
getFloat(int, String) - Method in class Table
-
 
-
getFloat(int) - Method in interface TableRow
-
 
-
getFloat(String) - Method in interface TableRow
-
 
-
getFloat(String) - Method in class XML
-
-
Returns the value of an attribute, or zero if not present.
-
-
getFloat(String, float) - Method in class XML
-
-
Returns the value of an attribute.
-
-
getFloatArray() - Method in class JSONArray
-
-
Get this entire array as a float array.
-
-
getFloatColumn(String) - Method in class Table
-
 
-
getFloatColumn(int) - Method in class Table
-
 
-
getFloatContent() - Method in class XML
-
 
-
getFloatContent(float) - Method in class XML
-
 
-
getFloatDict(String, String) - Method in class Table
-
 
-
getFloatDict(int, int) - Method in class Table
-
 
-
getFloatList(String) - Method in class Table
-
 
-
getFloatList(int) - Method in class Table
-
 
-
getFloatRow(int) - Method in class Table
-
 
-
getFloatv(int, FloatBuffer) - Method in class PGL
-
 
-
getFloatv(int, FloatBuffer) - Method in class PJOGL
-
 
-
getFolder() - Method in class LocalContribution
-
 
-
getFolder() - Method in class Mode
-
-
Get the folder where this mode is stored.
-
-
getFolder() - Method in class Sketch
-
-
Returns the sketch folder.
-
-
getFolderName() - Method in enum ContributionType
-
 
-
getFont(String) - Method in class Mode
-
 
-
getFont(String) - Static method in class Preferences
-
 
-
getFont(String) - Method in class Settings
-
 
-
getFont() - Method in class PFont
-
-
Deprecated.
-
-
getFontMetrics() - Method in class TextAreaPainter
-
-
Returns the font metrics used by this component.
-
-
getFontMetrics(SyntaxStyle) - Method in class TextAreaPainter
-
 
-
getFontMetrics(Font) - Method in class PGraphics
-
-
Convenience method to get a legit FontMetrics object.
-
-
getFontMetrics(Font) - Method in class PGraphicsJava2D
-
 
-
getFontRenderContext(Font) - Method in class PGraphics
-
-
Convenience method to jump through some Java2D hoops and get an FRC.
-
-
getFrame() - Method in class PApplet
-
 
-
getFrameBuffer() - Method in class PGraphicsOpenGL
-
-
Not an approved function, test its use in libraries to grab the FB objects - for offscreen PGraphics.
-
-
getFrameBuffer(boolean) - Method in class PGraphicsOpenGL
-
 
-
getFramebufferAttachmentParameteriv(int, int, int, IntBuffer) - Method in class PGL
-
 
-
getFramebufferAttachmentParameteriv(int, int, int, IntBuffer) - Method in class PJOGL
-
 
-
getGlyph(char) - Method in class PFont
-
 
-
getGlyph(int) - Method in class PFont
-
 
-
getGlyphCount() - Method in class PFont
-
 
-
getGraphics() - Method in class PApplet
-
 
-
getGroup() - Method in class Library
-
 
-
getHeight() - Method in class PShape
-
-
Get the height of the drawing area (not necessarily the shape boundary).
-
-
getHeight() - Method in class PShapeOpenGL
-
 
-
getHexColor() - Method in class ColorChooser
-
 
-
getHorizontalOffset() - Method in class JEditTextArea
-
-
Returns the horizontal offset of drawn lines.
-
-
getHorizontalScrollPosition() - Method in class JEditTextArea
-
-
Get current position of the horizontal scroll bar.
-
-
getId() - Method in class LocalContribution
-
 
-
getIdentifier() - Method in class Mode
-
-
Get an identifier that can be used to resurrect this mode and connect it - to a sketch.
-
-
getIgnorable() - Method in class Mode
-
-
Get array of file/directory names that needn't be copied during "Save As".
-
-
getIgnoreCase() - Method in class KeywordMap
-
-
Returns true if the keyword map is set to be case insensitive, - false otherwise.
-
-
getImage() - Method in class PImage
-
-
Deprecated.
-
-
getImportMenu() - Method in class Mode
-
 
-
getInputHandler() - Method in class JEditTextArea
-
-
Returns the input handler.
-
-
getInputMethodRequests() - Method in class JEditTextArea
-
-
Inline Input Method Support for Japanese.
-
-
getInsertPositionOffset() - Method in class CompositionTextManager
-
 
-
getInsertPositionOffset() - Method in class InputMethodSupport
-
 
-
getInstance() - Static method in class ContributionListing
-
 
-
getInt(int) - Method in class JSONArray
-
-
Get the int value associated with an index.
-
-
getInt(int, int) - Method in class JSONArray
-
-
Get the optional int value associated with an index.
-
-
getInt(String) - Method in class JSONObject
-
-
Gets the int value associated with a key
-
-
getInt(String, int) - Method in class JSONObject
-
-
Get an optional int value associated with a key, - or the default if there is no such key or if the value is not a number.
-
-
getInt(int, int) - Method in class Table
-
 
-
getInt(int, String) - Method in class Table
-
 
-
getInt(int) - Method in interface TableRow
-
 
-
getInt(String) - Method in interface TableRow
-
 
-
getInt(String) - Method in class XML
-
 
-
getInt(String, int) - Method in class XML
-
-
Returns the value of an attribute.
-
-
getIntArray() - Method in class JSONArray
-
-
Get this entire array as an int array.
-
-
getIntColumn(String) - Method in class Table
-
 
-
getIntColumn(int) - Method in class Table
-
 
-
getIntContent() - Method in class XML
-
 
-
getIntContent(int) - Method in class XML
-
 
-
getIntDict(String, String) - Method in class Table
-
 
-
getIntDict(int, int) - Method in class Table
-
 
-
getInteger(String) - Method in class Mode
-
 
-
getInteger(String) - Static method in class Preferences
-
 
-
getInteger(String) - Method in class Settings
-
 
-
getIntegerv(int, IntBuffer) - Method in class PGL
-
 
-
getIntegerv(int, IntBuffer) - Method in class PJOGL
-
 
-
getIntList(String) - Method in class Table
-
 
-
getIntList(int) - Method in class Table
-
 
-
getIntRow(int) - Method in class Table
-
 
-
getIntValue(WindowsRegistry.REGISTRY_ROOT_KEY, String, String) - Static method in class WindowsRegistry
-
-
Read an int value.
-
-
getIsInputProcess() - Method in class CompositionTextManager
-
-
Get this text manager is whether in input process or not.
-
-
getJarPath() - Method in class Library
-
 
-
getJavaHome() - Static method in class Base
-
 
-
getJavaPath() - Static method in class Base
-
-
Get the path to the embedded Java executable.
-
-
getJSONArray(int) - Method in class JSONArray
-
-
Get the JSONArray associated with an index.
-
-
getJSONArray(int, JSONArray) - Method in class JSONArray
-
 
-
getJSONArray(String) - Method in class JSONObject
-
-
Get the JSONArray value associated with a key.
-
-
getJSONObject(int) - Method in class JSONArray
-
-
Get the JSONObject associated with an index.
-
-
getJSONObject(int, JSONObject) - Method in class JSONArray
-
 
-
getJSONObject(String) - Method in class JSONObject
-
-
Get the JSONObject value associated with a key.
-
-
getKey() - Method in class KeyEvent
-
 
-
getKeyCode() - Method in class KeyEvent
-
 
-
getKeywordFiles() - Method in class Mode
-
-
To add additional keywords, or to grab them from another mode, override - this function.
-
-
getKind() - Method in class PShape
-
 
-
getLanguage() - Static method in class Language
-
-
Get the current language.
-
-
getLanguages() - Static method in class Language
-
-
Get all available languages
-
-
getLastLine() - Method in class JEditTextArea
-
-
Convenience for checking what's on-screen.
-
-
getLastUpdated() - Method in class Contribution
-
 
-
getLatestVersion() - Method in class LocalContribution
-
 
-
getLibFile(String) - Static method in class Base
-
-
Return a File from inside the Processing 'lib' folder.
-
-
getLibIcon(String) - Static method in class Toolkit
-
-
Get an ImageIcon from the Processing 'lib' folder.
-
-
getLibImage(String) - Static method in class Toolkit
-
-
Return an Image object from inside the Processing 'lib' folder.
-
-
getLibrariesFolder() - Method in class Mode
-
 
-
getLibrary(String) - Method in class Mode
-
 
-
getLibraryPath() - Method in class Library
-
 
-
getLibStream(String) - Static method in class Base
-
-
Return an InputStream for a file inside the Processing lib folder.
-
-
getLineCount() - Method in class Editor
-
-
Get the number of lines in the currently displayed buffer.
-
-
getLineCount() - Method in class SketchCode
-
 
-
getLineCount() - Method in class JEditTextArea
-
-
Returns the number of lines in the document.
-
-
getLineCount() - Method in class TokenMarker
-
-
Returns the number of lines in this token marker.
-
-
getLineLength(int) - Method in class JEditTextArea
-
-
Returns the length of the specified line.
-
-
getLineOfOffset(int) - Method in class JEditTextArea
-
-
Returns the line containing the specified offset.
-
-
getLineSelectionStopOffset(int) - Method in class JEditTextArea
-
-
Returns the start offset of the line after this line, or the end of - this line if there is no next line.
-
-
getLineStartNonWhiteSpaceOffset(int) - Method in class JEditTextArea
-
 
-
getLineStartOffset(int) - Method in class Editor
-
-
Get character offset for the start of a given line of text.
-
-
getLineStartOffset(int) - Method in class JEditTextArea
-
-
Returns the start offset of the specified line.
-
-
getLineStopNonWhiteSpaceOffset(int) - Method in class JEditTextArea
-
 
-
getLineStopOffset(int) - Method in class Editor
-
-
Get character offset for end of a given line of text.
-
-
getLineStopOffset(int) - Method in class JEditTextArea
-
-
Returns the end offset of the specified line.
-
-
getLineText(int) - Method in class Editor
-
-
Get text for a specified line.
-
-
getLineText(int) - Method in class JEditTextArea
-
-
Returns the text on the specified line.
-
-
getLineText(int, Segment) - Method in class JEditTextArea
-
-
Copies the text on the specified line into a segment.
-
-
getLocalName() - Method in class XML
-
-
Returns the name of the element (without namespace prefix).
-
-
getLocationOffset(int, int) - Method in class InputMethodSupport
-
 
-
getLong(int) - Method in class JSONArray
-
-
Get the long value associated with an index.
-
-
getLong(int, long) - Method in class JSONArray
-
-
Get the optional long value associated with an index.
-
-
getLong(String) - Method in class JSONObject
-
-
Get the long value associated with a key.
-
-
getLong(String, long) - Method in class JSONObject
-
-
Get an optional long value associated with a key, - or the default if there is no such key or if the value is not a number.
-
-
getLong(int, int) - Method in class Table
-
 
-
getLong(int, String) - Method in class Table
-
 
-
getLong(int) - Method in interface TableRow
-
 
-
getLong(String) - Method in interface TableRow
-
 
-
getLong(String, long) - Method in class XML
-
-
Returns the value of an attribute.
-
-
getLongArray() - Method in class JSONArray
-
-
Get this entire array as a long array.
-
-
getLongColumn(String) - Method in class Table
-
 
-
getLongColumn(int) - Method in class Table
-
 
-
getLongContent() - Method in class XML
-
 
-
getLongContent(long) - Method in class XML
-
 
-
getLongRow(int) - Method in class Table
-
 
-
getMacroRecorder() - Method in class InputHandler
-
-
Returns the macro recorder.
-
-
getMagicCaretPosition() - Method in class JEditTextArea
-
-
Returns the 'magic' caret position.
-
-
getMainFile() - Method in class Sketch
-
-
Returns a File object for the main .pde file for this sketch.
-
-
getMainFilePath() - Method in class Sketch
-
-
Returns path to the main .pde file for this sketch.
-
-
getMainProgram() - Method in class Sketch
-
 
-
getMarkLine() - Method in class JEditTextArea
-
-
Returns the mark line.
-
-
getMarkPosition() - Method in class JEditTextArea
-
-
Returns the mark position.
-
-
getMatrix() - Method in class PApplet
-
 
-
getMatrix(PMatrix2D) - Method in class PApplet
-
-
Copy the current transformation matrix into the specified target.
-
-
getMatrix(PMatrix3D) - Method in class PApplet
-
-
Copy the current transformation matrix into the specified target.
-
-
getMatrix() - Method in class PGraphics
-
 
-
getMatrix(PMatrix2D) - Method in class PGraphics
-
-
Copy the current transformation matrix into the specified target.
-
-
getMatrix(PMatrix3D) - Method in class PGraphics
-
-
Copy the current transformation matrix into the specified target.
-
-
getMatrix() - Method in class PGraphicsFX2D
-
 
-
getMatrix(PMatrix2D) - Method in class PGraphicsFX2D
-
 
-
getMatrix(PMatrix3D) - Method in class PGraphicsFX2D
-
 
-
getMatrix() - Method in class PGraphicsJava2D
-
 
-
getMatrix(PMatrix2D) - Method in class PGraphicsJava2D
-
 
-
getMatrix(PMatrix3D) - Method in class PGraphicsJava2D
-
 
-
getMatrix(PMatrix3D) - Method in class PGraphics2D
-
 
-
getMatrix() - Method in class PGraphicsOpenGL
-
 
-
getMatrix(PMatrix3D) - Method in class PGraphicsOpenGL
-
 
-
getMaximumSize() - Method in class ColorChooser.ColorRange
-
 
-
getMaximumSize() - Method in class ColorChooser.ColorSlider
-
 
-
getMaximumSize() - Method in class EditorButton
-
 
-
getMaximumSize() - Method in class EditorHeader
-
 
-
getMaximumSize() - Method in class EditorStatus
-
 
-
getMaximumSize() - Method in class EditorToolbar
-
 
-
getMaxRevision() - Method in class Contribution
-
 
-
getMenu() - Method in class Recent
-
 
-
getMenuItemIndex(JMenu, JMenuItem) - Static method in class Toolkit
-
 
-
getMenuTitle() - Method in class ToolContribution
-
 
-
getMenuTitle() - Method in class Archiver
-
 
-
getMenuTitle() - Method in class ColorSelector
-
 
-
getMenuTitle() - Method in class CreateFont
-
 
-
getMenuTitle() - Method in class InstallCommander
-
 
-
getMenuTitle() - Method in interface Tool
-
 
-
getMessage() - Method in exception SketchException
-
-
Override getMessage() in Throwable, so that I can set - the message text outside the constructor.
-
-
getMillis() - Method in class Event
-
 
-
getMinimumSize() - Method in class ColorChooser.ColorRange
-
 
-
getMinimumSize() - Method in class ColorChooser.ColorSlider
-
 
-
getMinimumSize() - Method in class EditorButton
-
 
-
getMinimumSize() - Method in class EditorHeader
-
 
-
getMinimumSize() - Method in class EditorStatus
-
 
-
getMinimumSize() - Method in class EditorToolbar
-
 
-
getMinimumSize() - Method in class TextAreaPainter
-
 
-
getMinRevision() - Method in class Contribution
-
 
-
getMode() - Method in class ModeContribution
-
 
-
getMode() - Method in class Editor
-
 
-
getMode() - Method in class Sketch
-
 
-
getModeContribs() - Method in class Base
-
 
-
getModeList() - Method in class Base
-
 
-
getModeMenu() - Method in class Editor
-
 
-
getModifiedX1() - Method in class PImage
-
 
-
getModifiedX1() - Method in class Texture
-
 
-
getModifiedX2() - Method in class PImage
-
 
-
getModifiedX2() - Method in class Texture
-
 
-
getModifiedY1() - Method in class PImage
-
 
-
getModifiedY1() - Method in class Texture
-
 
-
getModifiedY2() - Method in class PImage
-
 
-
getModifiedY2() - Method in class Texture
-
 
-
getModifiers() - Method in class Event
-
 
-
getModuleExtension() - Method in class Mode
-
-
Returns the appropriate file extension to use for auxilliary source files in a sketch.
-
-
getMonoFont(int, int) - Static method in class Toolkit
-
 
-
getMonoFontFamilies() - Static method in class Toolkit
-
 
-
getMonoFontName() - Static method in class Toolkit
-
 
-
getName() - Method in class Contribution
-
 
-
getName() - Method in class Sketch
-
-
Returns the name of this sketch.
-
-
getName() - Method in class PFont
-
 
-
getName() - Method in class PShape
-
 
-
getName() - Method in class XML
-
-
Returns the full name (i.e.
-
-
getNative() - Method in class PFont
-
-
Return the native java.awt.Font associated with this PFont (if any).
-
-
getNative() - Method in class PImage
-
-
Returns a native BufferedImage from this PImage.
-
-
getNative() - Method in class Event
-
-
Get the platform-native event object.
-
-
getNativeBits() - Static method in class Base
-
-
Return whether sketches will run as 32- or 64-bits based - on the JVM that's in use.
-
-
getNativePath() - Method in class Library
-
 
-
getNextMode() - Method in class Base
-
-
Used by ThinkDifferent so that it can have a Sketchbook menu.
-
-
getNormal(int) - Method in class PShape
-
 
-
getNormal(int, PVector) - Method in class PShape
-
 
-
getNormal(int, PVector) - Method in class PShapeOpenGL
-
 
-
getNormalX(int) - Method in class PShape
-
 
-
getNormalX(int) - Method in class PShapeOpenGL
-
 
-
getNormalY(int) - Method in class PShape
-
 
-
getNormalY(int) - Method in class PShapeOpenGL
-
 
-
getNormalZ(int) - Method in class PShape
-
 
-
getNormalZ(int) - Method in class PShapeOpenGL
-
 
-
getOrder() - Method in class StringList
-
-
Create a dictionary associating each entry in this list to its index.
-
-
getOrder(String) - Method in class Table
-
 
-
getOrder(int) - Method in class Table
-
 
-
getOut() - Method in class EditorConsole
-
 
-
getPainter() - Method in class JEditTextArea
-
-
Returns the object responsible for painting this text area.
-
-
getParagraph() - Method in class Contribution
-
 
-
getParam(int) - Method in class PShape
-
 
-
getParameters() - Method in class Texture
-
 
-
getParams() - Method in class PShape
-
 
-
getParams(float[]) - Method in class PShape
-
 
-
getParent() - Method in class PShape
-
 
-
getParent() - Method in class XML
-
-
Returns the parent element.
-
-
getPath() - Method in class Library
-
 
-
getPath() - Method in class SketchReference
-
 
-
getPathIterator() - Method in class LinePath
-
-
The iterator for this class is not multi-threaded safe, which means that - the LinePath class does not guarantee that modifications to the - geometry of this LinePath object do not affect any iterations of that - geometry that are already in process.
-
-
getPercent() - Method in class FloatDict
-
-
Sum all of the values in this dictionary, then return a new FloatDict of - each key, divided by the total sum.
-
-
getPercent() - Method in class FloatList
-
-
Returns a normalized version of this array.
-
-
getPercent() - Method in class IntDict
-
-
Sum all of the values in this dictionary, then return a new FloatDict of - each key, divided by the total sum.
-
-
getPercent() - Method in class IntList
-
-
Returns a normalized version of this array.
-
-
getPixelBuffer() - Method in class FrameBuffer
-
 
-
getPixels(int[]) - Method in class FrameBuffer
-
 
-
getPixelScale() - Method in class PGraphicsOpenGL
-
 
-
getPixelScale() - Method in class PSurfaceJOGL
-
 
-
getPlatform() - Static method in class Base
-
 
-
getPlatformIndex(String) - Static method in class Base
-
 
-
getPlatformName() - Static method in class Base
-
 
-
getPlatformName(int) - Static method in class Base
-
-
Map a platform constant to its name.
-
-
getPostScriptName() - Method in class PFont
-
 
-
getPreferredScrollableViewportSize() - Method in class ContributionListPanel
-
 
-
getPreferredSize() - Method in class ColorChooser.ColorRange
-
 
-
getPreferredSize() - Method in class ColorChooser.ColorSlider
-
 
-
getPreferredSize() - Method in class EditorButton
-
 
-
getPreferredSize() - Method in class EditorHeader
-
 
-
getPreferredSize() - Method in class EditorStatus
-
 
-
getPreferredSize() - Method in class EditorToolbar
-
 
-
getPreferredSize() - Method in class TextAreaPainter
-
 
-
getPreprocOffset() - Method in class SketchCode
-
 
-
getPrettyName() - Method in class SketchCode
-
 
-
getPrettyVersion() - Method in class Contribution
-
 
-
getPrintable() - Method in class JEditTextArea
-
 
-
getPrintable() - Method in class TextAreaPainter
-
 
-
getProgram() - Method in class SketchCode
-
-
get the current text for this tab
-
-
getProgramInfoLog(int) - Method in class PGL
-
 
-
getProgramInfoLog(int) - Method in class PJOGL
-
 
-
getProgramiv(int, int, IntBuffer) - Method in class PGL
-
 
-
getProgramiv(int, int, IntBuffer) - Method in class PJOGL
-
 
-
getRaw() - Method in class PGraphics
-
 
-
getRecentMenu() - Method in class Base
-
 
-
getReferenceFolder() - Method in class Mode
-
 
-
getReferenceIndexFile() - Method in class ToolContribution
-
-
Returns the object stored in the referenceFile field, which contains an - instance of the file object representing the index file of the reference
-
-
getReferenceIndexFile() - Method in class Library
-
-
Returns the object stored in the referenceFile field, which contains an - instance of the file object representing the index file of the reference
-
-
getRenderbufferParameteriv(int, int, IntBuffer) - Method in class PGL
-
 
-
getRenderbufferParameteriv(int, int, IntBuffer) - Method in class PJOGL
-
 
-
getRepeatCount() - Method in class InputHandler
-
-
Returns the number of times the next action will be repeated.
-
-
getResult() - Method in class ProcessResult
-
 
-
getRevision() - Static method in class Base
-
 
-
getRightClickPopup() - Method in class JEditTextArea
-
-
Returns the right click popup menu.
-
-
getRow(int) - Method in class Table
-
 
-
getRowCount() - Method in class Table
-
 
-
getSansFont(int, int) - Static method in class Toolkit
-
 
-
getSavedProgram() - Method in class SketchCode
-
-
get the last version saved of this tab
-
-
getScreenSize() - Static method in class Toolkit
-
 
-
getScrollableBlockIncrement(Rectangle, int, int) - Method in class ContributionListPanel
-
-
Amount to scroll to reveal a new page of items
-
-
getScrollableTracksViewportHeight() - Method in class ContributionListPanel
-
 
-
getScrollableTracksViewportWidth() - Method in class ContributionListPanel
-
 
-
getScrollableUnitIncrement(Rectangle, int, int) - Method in class ContributionListPanel
-
-
Amount to scroll to reveal the rest of something we are on or a new item
-
-
getScrollPosition() - Method in class Editor
-
 
-
getScrollPosition() - Method in class SketchCode
-
 
-
getScrollPosition() - Method in class JEditTextArea
-
- -
-
getSelectedText() - Method in class Editor
-
-
Called to update the text but not switch to a different set of code - (which would affect the undo manager).
-
-
getSelectedText(AttributedCharacterIterator.Attribute[]) - Method in class InputMethodSupport
-
 
-
getSelectedText() - Method in class JEditTextArea
-
-
Returns the selected text, or null if no selection is active.
-
-
getSelectionStart() - Method in class Editor
-
-
Get the beginning point of the current selection.
-
-
getSelectionStart() - Method in class SketchCode
-
 
-
getSelectionStart() - Method in class JEditTextArea
-
-
Returns the selection start offset.
-
-
getSelectionStart(int) - Method in class JEditTextArea
-
-
Returns the offset where the selection starts on the specified - line.
-
-
getSelectionStartLine() - Method in class JEditTextArea
-
-
Returns the selection start line.
-
-
getSelectionStop() - Method in class Editor
-
-
Get the end point of the current selection.
-
-
getSelectionStop() - Method in class SketchCode
-
 
-
getSelectionStop() - Method in class JEditTextArea
-
-
Returns the selection end offset.
-
-
getSelectionStop(int) - Method in class JEditTextArea
-
-
Returns the offset where the selection ends on the specified - line.
-
-
getSelectionStopLine() - Method in class JEditTextArea
-
-
Returns the selection end line.
-
-
getSentence() - Method in class Contribution
-
 
-
getSettingsFile(String) - Static method in class Base
-
-
Convenience method to get a File object for the specified filename inside - the settings folder.
-
-
getSettingsFolder() - Static method in class Base
-
-
Get the directory that can store settings.
-
-
getSettingsFolder() - Method in class Platform
-
-
This function should throw an exception or return a value.
-
-
getSettingsFolder() - Method in class MacPlatform
-
 
-
getSettingsFolder() - Method in class WindowsPlatform
-
 
-
getShaderInfoLog(int) - Method in class PGL
-
 
-
getShaderInfoLog(int) - Method in class PJOGL
-
 
-
getShaderiv(int, int, IntBuffer) - Method in class PGL
-
 
-
getShaderiv(int, int, IntBuffer) - Method in class PJOGL
-
 
-
getShaderPrecisionFormat(int, int, IntBuffer, IntBuffer) - Method in class PGL
-
 
-
getShaderPrecisionFormat(int, int, IntBuffer, IntBuffer) - Method in class PJOGL
-
 
-
getShaderSource(int) - Method in class PGL
-
 
-
getShaderSource(int) - Method in class PJOGL
-
 
-
getShape(char) - Method in class PFont
-
 
-
getShape(char, float) - Method in class PFont
-
 
-
getShininess(int) - Method in class PShape
-
 
-
getShininess(int) - Method in class PShapeOpenGL
-
 
-
getSize() - Method in class PFont
-
-
Return size of this font.
-
-
getSketch() - Method in class Editor
-
-
Gets the current sketch object.
-
-
getSketchbookExamplesFolder() - Static method in class Base
-
 
-
getSketchbookFolder() - Static method in class Base
-
 
-
getSketchbookFolder() - Method in enum ContributionType
-
 
-
getSketchbookLibrariesFolder() - Static method in class Base
-
 
-
getSketchbookModesFolder() - Static method in class Base
-
 
-
getSketchbookToolsFolder() - Static method in class Base
-
 
-
getSketchLocation() - Method in class Editor
-
-
Get the last location of the sketch's run window.
-
-
getSpecifiedImports() - Method in class LocalContribution
-
-
Returns the imports (package-names) for a library, as specified in its library.properties - (e.g., imports=libname.*,libname.support.*)
-
-
getSpecular(int) - Method in class PShape
-
 
-
getSpecular(int) - Method in class PShapeOpenGL
-
 
-
getStatusMessage() - Method in class Editor
-
-
Returns the current notice message in the editor status bar.
-
-
getStatusMode() - Method in class Editor
-
-
Returns the current mode of the editor status bar: NOTICE, ERR or EDIT.
-
-
getStderr() - Method in class ProcessResult
-
 
-
getStdout() - Method in class ProcessResult
-
 
-
getString(String) - Method in class Mode
-
 
-
getString(int) - Method in class JSONArray
-
-
Get the string associated with an index.
-
-
getString(int, String) - Method in class JSONArray
-
-
Get the optional string associated with an index.
-
-
getString(String) - Method in class JSONObject
-
-
Gets the String associated with a key
-
-
getString(String, String) - Method in class JSONObject
-
-
Get an optional string associated with a key.
-
-
getString(int, int) - Method in class Table
-
-
Get a String value from the table.
-
-
getString(int, String) - Method in class Table
-
 
-
getString(int) - Method in interface TableRow
-
 
-
getString(String) - Method in interface TableRow
-
 
-
getString(String) - Method in class XML
-
 
-
getString(String, String) - Method in class XML
-
 
-
getString(int) - Method in class PGL
-
 
-
getString(int) - Method in class PJOGL
-
 
-
getStringArray() - Method in class JSONArray
-
-
Get this entire array as a String array.
-
-
getStringColumn(String) - Method in class Table
-
 
-
getStringColumn(int) - Method in class Table
-
 
-
getStringDict(String, String) - Method in class Table
-
 
-
getStringDict(int, int) - Method in class Table
-
 
-
getStringList(String) - Method in class Table
-
 
-
getStringList(int) - Method in class Table
-
 
-
getStringRow(int) - Method in class Table
-
 
-
getStringValue(WindowsRegistry.REGISTRY_ROOT_KEY, String, String) - Static method in class WindowsRegistry
-
-
Read a String value.
-
-
getStroke(int) - Method in class PShape
-
 
-
getStroke(int) - Method in class PShapeOpenGL
-
 
-
getStrokeWeight(int) - Method in class PShape
-
 
-
getStrokeWeight(int) - Method in class PShapeOpenGL
-
 
-
getStyle(String) - Method in class Mode
-
 
-
getStyle() - Method in class PGraphics
-
 
-
getStyle(PStyle) - Method in class PGraphics
-
 
-
getStyles() - Method in class TextAreaPainter
-
-
Returns the syntax styles used to paint colorized text.
-
-
getSubKeys(WindowsRegistry.REGISTRY_ROOT_KEY, String) - Static method in class WindowsRegistry
-
-
Get all sub keys of a key.
-
-
getSubset(int) - Method in class FloatList
-
 
-
getSubset(int, int) - Method in class FloatList
-
 
-
getSubset(int) - Method in class IntList
-
 
-
getSubset(int, int) - Method in class IntList
-
 
-
getSubset(int) - Method in class StringList
-
 
-
getSubset(int, int) - Method in class StringList
-
 
-
getSystemClipboard() - Static method in class Toolkit
-
 
-
getTally() - Method in class StringList
-
-
Count the number of times each String entry is found in this list.
-
-
getTally(String) - Method in class Table
-
 
-
getTally(int) - Method in class Table
-
 
-
getTessellation() - Method in class PShape
-
 
-
getTessellation() - Method in class PShapeOpenGL
-
 
-
getTessellation(int, int) - Method in class PShapeOpenGL
-
 
-
getTexParameterfv(int, int, FloatBuffer) - Method in class PGL
-
 
-
getTexParameterfv(int, int, FloatBuffer) - Method in class PJOGL
-
 
-
getTexParameteriv(int, int, IntBuffer) - Method in class PGL
-
 
-
getTexParameteriv(int, int, IntBuffer) - Method in class PJOGL
-
 
-
getText() - Method in class Editor
-
-
Get the contents of the current buffer.
-
-
getText(int, int) - Method in class Editor
-
-
Get a range of text from the current buffer.
-
-
getText() - Method in class JEditTextArea
-
-
Returns the entire text of this text area.
-
-
getText(int, int) - Method in class JEditTextArea
-
-
Returns the specified substring of the document.
-
-
getText(int, int, Segment) - Method in class JEditTextArea
-
-
Copies the specified substring of the document into a segment.
-
-
getTextArea() - Method in class Editor
-
-
Get the JEditTextArea object for use (not recommended).
-
-
getTextArea(EventObject) - Static method in class InputHandler
-
-
Returns the text area that fired the specified event.
-
-
getTextLocation() - Method in class CompositionTextManager
-
 
-
getTextLocation(TextHitInfo) - Method in class InputMethodSupport
-
 
-
getTexture() - Method in class PGraphicsOpenGL
-
-
Not an approved function, this will change or be removed in the future.
-
-
getTexture(boolean) - Method in class PGraphicsOpenGL
-
-
Not an approved function either, don't use it.
-
-
getTexture(PImage) - Method in class PGraphicsOpenGL
-
-
Not an approved function, this will change or be removed in the future.
-
-
getTextureU(int) - Method in class PShape
-
 
-
getTextureU(int) - Method in class PShapeOpenGL
-
 
-
getTextureV(int) - Method in class PShape
-
 
-
getTextureV(int) - Method in class PShapeOpenGL
-
 
-
getTime() - Method in class ProcessResult
-
 
-
getTint(int) - Method in class PShape
-
 
-
getTint(int) - Method in class PShapeOpenGL
-
 
-
getTitle() - Method in enum ContributionType
-
-
Get this type name as a purtied up, capitalized version.
-
-
getTitle() - Method in class Mode
-
-
Return the pretty/printable/menu name for this mode.
-
-
getTokenMarker() - Method in class Mode
-
 
-
getTokenMarker() - Method in class JEditTextArea
-
-
Returns the document's token marker.
-
-
getTokenMarker() - Method in class SyntaxDocument
-
-
Returns the token marker that is to be used to split lines - of this document up into tokens.
-
-
getToolbarMenu() - Method in class Mode
-
 
-
getToolbarMenu() - Method in class Recent
-
 
-
getToolbarRecentMenu() - Method in class Base
-
 
-
getToolContribs() - Method in class Editor
-
 
-
getToolMenu() - Method in class Editor
-
 
-
getToolsFolder() - Static method in class Base
-
 
-
getToolTipText(MouseEvent) - Method in interface TextAreaPainter.Highlight
-
-
Returns the tool tip to display at the specified - location.
-
-
getTransferData(DataFlavor) - Method in class HtmlSelection
-
 
-
getTransferDataFlavors() - Method in class HtmlSelection
-
 
-
getType() - Method in class AvailableContribution
-
 
-
getType() - Method in class Contribution
-
 
-
getType() - Method in class ExamplesContribution
-
 
-
getType() - Method in class ModeContribution
-
 
-
getType() - Method in class ToolContribution
-
 
-
getType() - Method in class Library
-
 
-
getTypeName() - Method in class Contribution
-
 
-
getUndo() - Method in class SketchCode
-
 
-
getUniformfv(int, int, FloatBuffer) - Method in class PGL
-
 
-
getUniformfv(int, int, FloatBuffer) - Method in class PJOGL
-
 
-
getUniformiv(int, int, IntBuffer) - Method in class PGL
-
 
-
getUniformiv(int, int, IntBuffer) - Method in class PJOGL
-
 
-
getUniformLocation(int, String) - Method in class PGL
-
 
-
getUniformLocation(int, String) - Method in class PJOGL
-
 
-
getUnique() - Method in class StringList
-
-
Get a list of all unique entries.
-
-
getUnique(String) - Method in class Table
-
 
-
getUnique(int) - Method in class Table
-
 
-
getUniqueName(File, String) - Static method in class ContributionManager
-
-
Returns a file in the parent folder that does not exist yet.
-
-
getUrl() - Method in class Contribution
-
 
-
getValues(WindowsRegistry.REGISTRY_ROOT_KEY, String) - Static method in class WindowsRegistry
-
-
Get all values under a key.
-
-
getVersion() - Method in class Contribution
-
 
-
getVersionName() - Static method in class Base
-
-
Return the version name, something like 1.5 or 2.0b8 or 0213 if it's not - a release version.
-
-
getVertex(int) - Method in class PShape
-
 
-
getVertex(int, PVector) - Method in class PShape
-
 
-
getVertex(int, PVector) - Method in class PShapeOpenGL
-
 
-
getVertexAttribfv(int, int, FloatBuffer) - Method in class PGL
-
 
-
getVertexAttribfv(int, int, FloatBuffer) - Method in class PJOGL
-
 
-
getVertexAttribiv(int, int, IntBuffer) - Method in class PGL
-
 
-
getVertexAttribiv(int, int, IntBuffer) - Method in class PJOGL
-
 
-
getVertexAttribPointerv(int, int, ByteBuffer) - Method in class PGL
-
 
-
getVertexAttribPointerv(int, int, ByteBuffer) - Method in class PJOGL
-
 
-
getVertexCode(int) - Method in class PShape
-
-
One of VERTEX, BEZIER_VERTEX, CURVE_VERTEX, or BREAK.
-
-
getVertexCode(int) - Method in class PShapeOpenGL
-
-
One of VERTEX, BEZIER_VERTEX, CURVE_VERTEX, or BREAK.
-
-
getVertexCodeCount() - Method in class PShape
-
 
-
getVertexCodeCount() - Method in class PShapeOpenGL
-
 
-
getVertexCodes() - Method in class PShape
-
 
-
getVertexCodes() - Method in class PShapeOpenGL
-
 
-
getVertexCount() - Method in class PShape
-
 
-
getVertexCount() - Method in class PShapeOpenGL
-
 
-
getVertexX(int) - Method in class PShape
-
 
-
getVertexX(int) - Method in class PShapeOpenGL
-
 
-
getVertexY(int) - Method in class PShape
-
 
-
getVertexY(int) - Method in class PShapeOpenGL
-
 
-
getVertexZ(int) - Method in class PShape
-
 
-
getVertexZ(int) - Method in class PShapeOpenGL
-
 
-
getVerticalScrollPosition() - Method in class JEditTextArea
-
-
Get current position of the vertical scroll bar.
-
-
getVisibleLines() - Method in class JEditTextArea
-
-
Returns the number of lines visible in this text area.
-
-
getWidth() - Method in class PShape
-
-
Get the width of the drawing area (not necessarily the shape boundary).
-
-
getWidth() - Method in class PShapeOpenGL
-
 
-
getWindingRule() - Method in class LinePath
-
-
Returns the fill style winding rule.
-
-
getWindingRule() - Method in class LinePath.PathIterator
-
 
-
getX() - Method in class MouseEvent
-
 
-
getY() - Method in class MouseEvent
-
 
-
GIF - Static variable in interface PConstants
-
 
-
gl - Variable in class PJOGL
-
-
Basic GL functionality, common to all profiles
-
-
glDepth - Variable in class FrameBuffer
-
 
-
glDepthStencil - Variable in class FrameBuffer
-
 
-
glFbo - Variable in class FrameBuffer
-
 
-
glFormat - Variable in class Texture
-
 
-
glFragment - Variable in class PShader
-
 
-
glHeight - Variable in class Texture
-
 
-
glLineAttrib - Variable in class PGraphicsOpenGL
-
 
-
glLineAttrib - Variable in class PShapeOpenGL
-
 
-
glLineColor - Variable in class PGraphicsOpenGL
-
 
-
glLineColor - Variable in class PShapeOpenGL
-
 
-
glLineIndex - Variable in class PGraphicsOpenGL
-
 
-
glLineIndex - Variable in class PShapeOpenGL
-
 
-
glLineVertex - Variable in class PGraphicsOpenGL
-
 
-
glLineVertex - Variable in class PShapeOpenGL
-
 
-
glMagFilter - Variable in class Texture
-
 
-
glMinFilter - Variable in class Texture
-
 
-
glMultisample - Variable in class FrameBuffer
-
 
-
glName - Variable in class Texture
-
 
-
glPointAttrib - Variable in class PGraphicsOpenGL
-
 
-
glPointAttrib - Variable in class PShapeOpenGL
-
 
-
glPointColor - Variable in class PGraphicsOpenGL
-
 
-
glPointColor - Variable in class PShapeOpenGL
-
 
-
glPointIndex - Variable in class PGraphicsOpenGL
-
 
-
glPointIndex - Variable in class PShapeOpenGL
-
 
-
glPointVertex - Variable in class PGraphicsOpenGL
-
 
-
glPointVertex - Variable in class PShapeOpenGL
-
 
-
glPolyAmbient - Variable in class PGraphicsOpenGL
-
 
-
glPolyAmbient - Variable in class PShapeOpenGL
-
 
-
glPolyColor - Variable in class PGraphicsOpenGL
-
 
-
glPolyColor - Variable in class PShapeOpenGL
-
 
-
glPolyEmissive - Variable in class PGraphicsOpenGL
-
 
-
glPolyEmissive - Variable in class PShapeOpenGL
-
 
-
glPolyIndex - Variable in class PGraphicsOpenGL
-
 
-
glPolyIndex - Variable in class PShapeOpenGL
-
 
-
glPolyNormal - Variable in class PGraphicsOpenGL
-
 
-
glPolyNormal - Variable in class PShapeOpenGL
-
 
-
glPolyShininess - Variable in class PGraphicsOpenGL
-
 
-
glPolyShininess - Variable in class PShapeOpenGL
-
 
-
glPolySpecular - Variable in class PGraphicsOpenGL
-
 
-
glPolySpecular - Variable in class PShapeOpenGL
-
 
-
glPolyTexcoord - Variable in class PGraphicsOpenGL
-
 
-
glPolyTexcoord - Variable in class PShapeOpenGL
-
 
-
glPolyVertex - Variable in class PGraphicsOpenGL
-
 
-
glPolyVertex - Variable in class PShapeOpenGL
-
 
-
glProgram - Variable in class PShader
-
 
-
GLSL_VERSION - Static variable in class PGraphicsOpenGL
-
 
-
glStencil - Variable in class FrameBuffer
-
 
-
glTarget - Variable in class Texture
-
 
-
glu - Variable in class PJOGL
-
-
GLU interface
-
-
glUsage - Variable in class PShapeOpenGL
-
 
-
glVertex - Variable in class PShader
-
 
-
glWidth - Variable in class Texture
-
 
-
glWrapS - Variable in class Texture
-
 
-
glWrapT - Variable in class Texture
-
 
-
Glyph() - Constructor for class PFont.Glyph
-
 
-
Glyph(DataInputStream) - Constructor for class PFont.Glyph
-
 
-
glyphCount - Variable in class PShapeSVG.Font
-
 
-
glyphs - Variable in class PShapeSVG.Font
-
 
-
grabNextKeyStroke(ActionListener) - Method in class InputHandler
-
-
Grabs the next key typed event and invokes the specified - action with the key as a the action command.
-
-
GRAY - Static variable in interface PConstants
-
 
-
GREATER - Static variable in class PGL
-
 
-
green(int) - Method in class PApplet
-
-
( begin auto-generated from green.xml ) - - Extracts the green value from a color, scaled to match current - colorMode().
-
-
green(int) - Method in class PGraphics
-
-
( begin auto-generated from green.xml ) - - Extracts the green value from a color, scaled to match current - colorMode().
-
-
GREEN_MASK - Static variable in class PImage
-
 
-
GROUP - Static variable in interface PConstants
-
 
-
GT - Static variable in interface JavaTokenTypes
-
 
-
GT - Static variable in interface PdePartialTokenTypes
-
 
-
GT - Static variable in interface PdeTokenTypes
-
 
-
GUTTER_MARGIN - Static variable in class Editor
-
 
-
- - - -

H

-
-
HALF_PI - Static variable in interface PConstants
-
-
( begin auto-generated from HALF_PI.xml ) - - HALF_PI is a mathematical constant with the value - 1.57079632679489661923.
-
-
HAND - Static variable in interface PConstants
-
 
-
handleAddFile() - Method in class Sketch
-
-
Prompt the user for a new file to the sketch, then call the - other addFile() function to actually add it.
-
-
handleAutoFormat() - Method in class Editor
-
 
-
handleClose(Editor, boolean) - Method in class Base
-
-
Close a sketch as specified by its editor window.
-
-
handleClose() - Method in class FindReplace
-
 
-
handleCopy() - Method in class Editor
-
-
Implements Edit → Copy.
-
-
handleCopyAsHTML() - Method in class Editor
-
 
-
handleCut() - Method in class Editor
-
-
Implements Edit → Cut.
-
-
handleDeleteCode() - Method in class Sketch
-
-
Remove a piece of code from the sketch and from the disk.
-
-
handleDraw() - Method in class PApplet
-
 
-
handleImportLibrary(String) - Method in class Editor
-
 
-
handleIndent() - Method in class Editor
-
 
-
handleIndentOutdent(boolean) - Method in class Editor
-
 
-
handleNew() - Method in class Base
-
-
Create a new untitled document in a new sketch window.
-
-
handleNewCode() - Method in class Sketch
-
-
Handler for the New Code menu option.
-
-
handleNextCode() - Method in class Sketch
-
-
Move to the next tab.
-
-
handleOpen(String) - Method in class Base
-
-
Open a sketch from the path specified.
-
-
handleOpen(String, boolean) - Method in class Base
-
-
Open a sketch in a new window.
-
-
handleOpenExampleManager() - Method in class Base
-
-
Show the examples installer window.
-
-
handleOpenLibraryManager() - Method in class Base
-
-
Show the library installer window.
-
-
handleOpenModeManager() - Method in class Base
-
-
Show the mode installer window.
-
-
handleOpenPrompt() - Method in class Base
-
-
Prompt for a sketch to open, and open it in a new window.
-
-
handleOpenToolManager() - Method in class Base
-
-
Show the tool installer window.
-
-
handleOutdent() - Method in class Editor
-
 
-
handlePageSetup() - Method in class Editor
-
-
Handler for File → Page Setup.
-
-
handlePaste() - Method in class Editor
-
-
Implements Edit → Paste.
-
-
handlePrefs() - Method in class Base
-
-
Show the Preferences window.
-
-
handlePressed(KeyEvent) - Method in class PdeInputHandler
-
-
Override this function in your InputHandler to do any gymnastics.
-
-
handlePrevCode() - Method in class Sketch
-
-
Move to the previous tab.
-
-
handlePrint() - Method in class Editor
-
-
Handler for File → Print.
-
-
handleQuit() - Method in class Base
-
-
Handler for File → Quit.
-
-
handleQuit() - Static method in class EditorConsole
-
-
Close the streams so that the temporary files can be deleted.
-
-
handler() - Method in class JavaRecognizer
-
 
-
handler() - Method in class PdeRecognizer
-
 
-
handleRecent(Editor) - Method in class Base
-
 
-
handleRecentRename(Editor, String) - Method in class Base
-
 
-
handleRenameCode() - Method in class Sketch
-
-
Handler for the Rename Code menu option.
-
-
handleRun(int) - Method in class EditorToolbar
-
 
-
handleSave(boolean) - Method in class Editor
-
-
Actually handle the save command.
-
-
handleSaveAs() - Method in class Editor
-
 
-
handleSelectAll() - Method in class Editor
-
-
Implements Edit → Select All.
-
-
handleShowUpdates() - Method in class Base
-
 
-
handleStop() - Method in class EditorToolbar
-
 
-
handleTyped(KeyEvent) - Method in class PdeInputHandler
-
-
Override this instead of keyPressed/keyTyped
-
-
HARD_LIGHT - Static variable in interface PConstants
-
 
-
HAS_NORMAL - Static variable in class PGraphics
-
 
-
hasAlreadyBeenOpened() - Method in class ContributionManagerDialog
-
 
-
hasAttribute(String) - Method in class XML
-
-
Returns whether an attribute exists.
-
-
hasBuffers() - Method in class Texture
-
 
-
hasBufferSource() - Method in class Texture
-
 
-
hasChildren() - Method in class XML
-
-
Returns a boolean of whether or not there are children.
-
-
hasCodeFolder() - Method in class Sketch
-
 
-
hasCodeIndex() - Method in exception SketchException
-
 
-
hasCodeLine() - Method in exception SketchException
-
 
-
hasColumnTitles() - Method in class Table
-
 
-
hasComposedTextLayout() - Method in class CompositionTextPainter
-
-
Check the painter has TextLayout.
-
-
hasDataFolder() - Method in class Sketch
-
 
-
hasDepthBuffer() - Method in class FrameBuffer
-
 
-
hasExamples() - Method in class Library
-
 
-
hashCode() - Method in class PVector
-
 
-
hasKey(String) - Method in class FloatDict
-
 
-
hasKey(String) - Method in class IntDict
-
 
-
hasKey(String) - Method in class JSONObject
-
-
Determine if the JSONObject contains a specific key.
-
-
hasKey(String) - Method in class StringDict
-
 
-
hasMultipleArch(int) - Method in class Library
-
 
-
hasMultipleArch(int, ArrayList<Library>) - Static method in class Library
-
 
-
hasReference() - Method in class ToolContribution
-
-
Tests whether the reference's index file indicated by referenceFile exists.
-
-
hasReference() - Method in class Library
-
-
Tests whether the reference's index file indicated by referenceFile exists.
-
-
hasStencilBuffer() - Method in class FrameBuffer
-
 
-
hasUpdates() - Method in class ContributionManagerDialog
-
 
-
hasUpdates(Base) - Method in class ContributionManagerDialog
-
 
-
hasValue(float) - Method in class FloatList
-
 
-
hasValue(int) - Method in class IntList
-
 
-
hasValue(String) - Method in class StringList
-
 
-
haveRaw() - Method in class PGraphics
-
 
-
heading() - Method in class PVector
-
-
( begin auto-generated from PVector_setMag.xml ) - - Calculate the angle of rotation for this vector (only 2D vectors) - - ( end auto-generated )
-
-
heading2D() - Method in class PVector
-
-
Deprecated.
-
-
height - Variable in class PApplet
-
-
( begin auto-generated from height.xml ) - - System variable which stores the height of the display window.
-
-
height - Variable in class PFont.Glyph
-
 
-
height - Variable in class PImage
-
-
( begin auto-generated from PImage_height.xml ) - - The height of the image in units of pixels.
-
-
height - Variable in class PShape
-
-
( begin auto-generated from PShape_height.xml ) - - The height of the PShape document.
-
-
height - Variable in class FrameBuffer
-
 
-
height - Variable in class Texture
-
 
-
hex(byte) - Static method in class PApplet
-
-
( begin auto-generated from hex.xml ) - - Converts a byte, char, int, or color to a String containing the - equivalent hexadecimal notation.
-
-
hex(char) - Static method in class PApplet
-
 
-
hex(int) - Static method in class PApplet
-
 
-
hex(int, int) - Static method in class PApplet
-
 
-
HEX_DIGIT - Static variable in interface JavaTokenTypes
-
 
-
HEX_DIGIT - Static variable in interface PdePartialTokenTypes
-
 
-
HEX_DIGIT - Static variable in interface PdeTokenTypes
-
 
-
hide() - Method in class ColorChooser
-
 
-
hideCursor() - Method in interface PSurface
-
 
-
hideCursor() - Method in class PSurfaceAWT
-
 
-
hideCursor() - Method in class PSurfaceFX
-
 
-
hideCursor() - Method in class PSurfaceNone
-
 
-
hideCursor() - Method in class PSurfaceJOGL
-
 
-
hideExtension(String) - Method in class Mode
-
-
True if the specified extension should be hidden when shown on a tab.
-
-
hideMenuBar() - Static method in class PApplet
-
-
Convenience method, should only be called by PSurface subclasses.
-
-
hideStackTrace() - Method in exception SketchException
-
 
-
HIGH_FLOAT - Static variable in class PGL
-
 
-
HIGH_INT - Static variable in class PGL
-
 
-
highResDisplay() - Static method in class Toolkit
-
 
-
hint(int) - Method in class PApplet
-
 
-
hint(int) - Method in class PGraphics
-
-
( begin auto-generated from hint.xml ) - - Set various hints and hacks for the renderer.
-
-
hint(int) - Method in class PGraphicsJava2D
-
 
-
hint(int, int) - Method in class PGL
-
 
-
hint(int) - Method in class PGraphics2D
-
 
-
hint(int) - Method in class PGraphicsOpenGL
-
 
-
hint(int, int) - Method in class PJOGL
-
 
-
HINT_COUNT - Static variable in interface PConstants
-
 
-
HOME - Static variable in class InputHandler
-
 
-
home(boolean) - Constructor for class InputHandler.home
-
 
-
hour() - Static method in class PApplet
-
-
( begin auto-generated from hour.xml ) - - Processing communicates with the clock on your computer.
-
-
HSB - Static variable in interface PConstants
-
 
-
HtmlSelection - Class in processing.app.syntax
-
 
-
HtmlSelection(String) - Constructor for class HtmlSelection
-
 
-
hue(int) - Method in class PApplet
-
-
( begin auto-generated from hue.xml ) - - Extracts the hue value from a color.
-
-
hue(int) - Method in class PGraphics
-
-
( begin auto-generated from hue.xml ) - - Extracts the hue value from a color.
-
-
hypot(double, double) - Static method in class LinePath
-
 
-
hypot(int, int) - Static method in class LinePath
-
 
-
hypot(long, long) - Static method in class LinePath
-
 
-
- - - -

I

-
-
id - Variable in class Token
-
-
The id of this token.
-
-
ID_COUNT - Static variable in class Token
-
-
The total number of defined token ids.
-
-
IDENT - Static variable in interface JavaTokenTypes
-
 
-
IDENT - Static variable in interface PdePartialTokenTypes
-
 
-
IDENT - Static variable in interface PdeTokenTypes
-
 
-
identifier() - Method in class JavaRecognizer
-
 
-
identifier() - Method in class PdeRecognizer
-
 
-
identifierStar() - Method in class JavaRecognizer
-
 
-
identifierStar() - Method in class PdeRecognizer
-
 
-
identPrimary() - Method in class 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 PdeRecognizer
-
 
-
image(PImage, float, float) - Method in class PApplet
-
-
( begin auto-generated from image.xml ) - - Displays images to the screen.
-
-
image(PImage, float, float, float, float) - Method in class PApplet
-
 
-
image(PImage, float, float, float, float, int, int, int, int) - Method in class PApplet
-
-
Draw an image(), also specifying u/v coordinates.
-
-
IMAGE - Static variable in interface PConstants
-
-
texture coordinates based on image width/height
-
-
image - Variable in class PFont.Glyph
-
 
-
image - Variable in class PGraphics
-
-
Java AWT Image object associated with this renderer.
-
-
image(PImage, float, float) - Method in class PGraphics
-
-
( begin auto-generated from image.xml ) - - Displays images to the screen.
-
-
image(PImage, float, float, float, float) - Method in class PGraphics
-
 
-
image(PImage, float, float, float, float, int, int, int, int) - Method in class PGraphics
-
-
Draw an image(), also specifying u/v coordinates.
-
-
imageMode(int) - Method in class PApplet
-
-
( begin auto-generated from imageMode.xml ) - - Modifies the location from which images draw.
-
-
imageMode - Variable in class PGraphics
-
-
The current image alignment (read-only)
-
-
imageMode(int) - Method in class PGraphics
-
-
( begin auto-generated from imageMode.xml ) - - Modifies the location from which images draw.
-
-
imageMode - Variable in class PStyle
-
 
-
IMPLEMENTS_CLAUSE - Static variable in interface JavaTokenTypes
-
 
-
IMPLEMENTS_CLAUSE - Static variable in interface PdePartialTokenTypes
-
 
-
IMPLEMENTS_CLAUSE - Static variable in interface PdeTokenTypes
-
 
-
implementsClause() - Method in class JavaRecognizer
-
 
-
implementsClause() - Method in class PdeRecognizer
-
 
-
IMPORT - Static variable in interface JavaTokenTypes
-
 
-
IMPORT - Static variable in interface PdePartialTokenTypes
-
 
-
IMPORT - Static variable in interface PdeTokenTypes
-
 
-
importDefinition() - Method in class JavaRecognizer
-
 
-
importDefinition() - Method in class PdeRecognizer
-
 
-
INC - Static variable in interface JavaTokenTypes
-
 
-
INC - Static variable in interface PdePartialTokenTypes
-
 
-
INC - Static variable in interface PdeTokenTypes
-
 
-
inclusiveOrExpression() - Method in class JavaRecognizer
-
 
-
inclusiveOrExpression() - Method in class PdeRecognizer
-
 
-
INCR - Static variable in class PGL
-
 
-
INCR_WRAP - Static variable in class PGL
-
 
-
increment(String) - Method in class IntDict
-
-
Increase the value associated with a specific key by 1.
-
-
increment(int) - Method in class IntList
-
 
-
index - Variable in class PFont.Glyph
-
 
-
index(String) - Method in class FloatDict
-
 
-
index(float) - Method in class FloatList
-
-
Return the first index of a particular value.
-
-
index(String) - Method in class IntDict
-
 
-
index(int) - Method in class IntList
-
-
Return the first index of a particular value.
-
-
index(String) - Method in class StringDict
-
 
-
index(String) - Method in class StringList
-
-
Return the first index of a particular value.
-
-
INDEX_OP - Static variable in interface JavaTokenTypes
-
 
-
INDEX_OP - Static variable in interface PdePartialTokenTypes
-
 
-
INDEX_OP - Static variable in interface PdeTokenTypes
-
 
-
INFO_LOG_LENGTH - Static variable in class PGL
-
 
-
init(Editor) - Method in class ToolContribution
-
 
-
init() - Static method in class Language
-
-
Singleton constructor
-
-
init(Base) - Method in class Platform
-
 
-
init(Base) - Method in class LinuxPlatform
-
 
-
init(Base) - Method in class MacPlatform
-
 
-
init(Base) - Method in class WindowsPlatform
-
 
-
init() - Static method in class Preferences
-
 
-
init(JEditTextArea, TextAreaPainter.Highlight) - Method in interface TextAreaPainter.Highlight
-
-
Called after the highlight painter has been added.
-
-
init(Editor) - Method in class Archiver
-
 
-
init(Editor) - Method in class ColorSelector
-
 
-
init(Editor) - Method in class CreateFont
-
 
-
init(Editor) - Method in class InstallCommander
-
 
-
init(Editor) - Method in interface Tool
-
 
-
init() - Method in class PApplet
-
-
Applet initialization.
-
-
init(int, int, int) - Method in class PImage
-
-
Do not remove, see notes in the other variant.
-
-
init(int, int, int, int) - Method in class 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) - Static method in class ThinkDifferent
-
 
-
init() - Method in class PShader
-
 
-
init(int, int) - Method in class Texture
-
-
Sets the size of the image and texture to width x height.
-
-
init(int, int, Texture.Parameters) - Method in class Texture
-
-
Sets the size of the image and texture to width x height, and the - parameters of the texture to params.
-
-
init(int, int, int, int, int, int, int, int, int, int, int) - Method in class Texture
-
-
Initializes the texture using GL parameters
-
-
initFrame(PApplet) - Method in interface PSurface
-
 
-
initFrame(PApplet) - Method in class PSurfaceAWT
-
 
-
initFrame(PApplet) - Method in class PSurfaceFX
-
 
-
initFrame(PApplet) - Method in class PSurfaceNone
-
 
-
initFrame(PApplet) - Method in class PSurfaceJOGL
-
 
-
initialized - Variable in class PGraphicsOpenGL
-
-
Whether the PGraphics object is ready to render or not.
-
-
initializer() - Method in class JavaRecognizer
-
 
-
initializer() - Method in class PdeRecognizer
-
 
-
initLoader(String) - Method in class LocalContribution
-
 
-
initOffscreen(PApplet) - Method in interface PSurface
-
 
-
initOffscreen(PApplet) - Method in class PSurfaceAWT
-
 
-
initOffscreen(PApplet) - Method in class PSurfaceFX
-
 
-
initOffscreen(PApplet) - Method in class PSurfaceNone
-
 
-
initOffscreen(PApplet) - Method in class PSurfaceJOGL
-
 
-
initPlatform() - Static method in class Base
-
 
-
InputHandler - Class in processing.app.syntax
-
-
An input handler converts the user's key strokes into concrete actions.
-
-
InputHandler() - Constructor for class InputHandler
-
 
-
InputHandler.backspace - Class in processing.app.syntax
-
 
-
InputHandler.backspace_word - Class in processing.app.syntax
-
 
-
InputHandler.clipboard_copy - Class in processing.app.syntax
-
 
-
InputHandler.clipboard_cut - Class in processing.app.syntax
-
 
-
InputHandler.clipboard_paste - Class in processing.app.syntax
-
 
-
InputHandler.delete - Class in processing.app.syntax
-
 
-
InputHandler.delete_word - Class in processing.app.syntax
-
 
-
InputHandler.document_end - Class in processing.app.syntax
-
 
-
InputHandler.document_home - Class in processing.app.syntax
-
 
-
InputHandler.end - Class in processing.app.syntax
-
 
-
InputHandler.home - Class in processing.app.syntax
-
 
-
InputHandler.insert_break - Class in processing.app.syntax
-
 
-
InputHandler.insert_char - Class in processing.app.syntax
-
 
-
InputHandler.insert_tab - Class in processing.app.syntax
-
 
-
InputHandler.MacroRecorder - Interface in processing.app.syntax
-
-
Macro recorder.
-
-
InputHandler.next_char - Class in processing.app.syntax
-
 
-
InputHandler.next_line - Class in processing.app.syntax
-
 
-
InputHandler.next_page - Class in processing.app.syntax
-
 
-
InputHandler.next_word - Class in processing.app.syntax
-
 
-
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.prev_char - Class in processing.app.syntax
-
 
-
InputHandler.prev_line - Class in processing.app.syntax
-
 
-
InputHandler.prev_page - Class in processing.app.syntax
-
 
-
InputHandler.prev_word - Class in processing.app.syntax
-
 
-
InputHandler.repeat - Class in processing.app.syntax
-
 
-
InputHandler.toggle_rect - Class in processing.app.syntax
-
 
-
InputHandler.Wrapper - Interface in processing.app.syntax
-
-
For use by EditAction.Wrapper only.
-
-
InputMethodSupport - Class in processing.app.syntax.im
-
-
Support in-line Japanese input for PDE.
-
-
InputMethodSupport(JEditTextArea) - Constructor for class InputMethodSupport
-
 
-
inputMethodTextChanged(InputMethodEvent) - Method in class InputMethodSupport
-
-
Handles events from InputMethod.
-
-
insert(int, float) - Method in class FloatList
-
 
-
insert(int, float[]) - Method in class FloatList
-
 
-
insert(int, FloatList) - Method in class FloatList
-
 
-
insert(int, int) - Method in class IntList
-
 
-
insert(int, int[]) - Method in class IntList
-
 
-
insert(int, IntList) - Method in class IntList
-
 
-
insert(int, String) - Method in class StringList
-
 
-
insert(int, String[]) - Method in class StringList
-
 
-
insert(int, StringList) - Method in class StringList
-
 
-
INSERT_BREAK - Static variable in class InputHandler
-
 
-
insert_break() - Constructor for class InputHandler.insert_break
-
 
-
INSERT_CHAR - Static variable in class InputHandler
-
 
-
insert_char() - Constructor for class InputHandler.insert_char
-
 
-
INSERT_TAB - Static variable in class InputHandler
-
 
-
insert_tab() - Constructor for class InputHandler.insert_tab
-
 
-
insertColumn(int) - Method in class Table
-
 
-
insertColumn(int, String) - Method in class Table
-
 
-
insertColumn(int, String, int) - Method in class Table
-
 
-
insertFrame(String) - Method in class PApplet
-
-
Check a string for #### signs to see if the frame number should be - inserted.
-
-
insertFullWidthSpace() - Method in class CompositionTextManager
-
-
Insert full width space
-
-
insertImportMenu(JMenu) - Method in class Mode
-
-
Re-insert the Import Library menu.
-
-
insertLines(int, int) - Method in class TokenMarker
-
-
Informs the token marker that lines have been inserted into - the document.
-
-
insertRow(int, Object[]) - Method in class Table
-
 
-
insertText(String) - Method in class Editor
-
 
-
insertToolbarRecentMenu() - Method in class Mode
-
 
-
insertUpdate(DocumentEvent) - Method in class ColorChooser.ColorListener
-
 
-
INSIDE_BEGIN_END_ERROR - Static variable in class PShape
-
 
-
install(Base, File, boolean, StatusPanel) - Method in class AvailableContribution
-
 
-
InstallCommander - Class in processing.app.tools
-
 
-
InstallCommander() - Constructor for class InstallCommander
-
 
-
INSTANCE - Static variable in interface Platform.CLibrary
-
 
-
INSTANCE_INIT - Static variable in interface JavaTokenTypes
-
 
-
INSTANCE_INIT - Static variable in interface PdePartialTokenTypes
-
 
-
INSTANCE_INIT - Static variable in interface PdeTokenTypes
-
 
-
INT - Static variable in class Table
-
 
-
INT - Static variable in class PGL
-
 
-
INT_VEC2 - Static variable in class PGL
-
 
-
INT_VEC3 - Static variable in class PGL
-
 
-
INT_VEC4 - Static variable in class PGL
-
 
-
IntDict - Class in processing.data
-
-
A simple class to use a String as a lookup for an int value.
-
-
IntDict() - Constructor for class IntDict
-
 
-
IntDict(int) - Constructor for class IntDict
-
-
Create a new lookup with a specific size.
-
-
IntDict(BufferedReader) - Constructor for class IntDict
-
-
Read a set of entries from a Reader that has each key/value pair on - a single line, separated by a tab.
-
-
IntDict(String[], int[]) - Constructor for class IntDict
-
 
-
IntDict(Object[][]) - Constructor for class IntDict
-
-
Constructor to allow (more intuitive) inline initialization, e.g.:
-
-
INTERFACE_DEF - Static variable in interface JavaTokenTypes
-
 
-
INTERFACE_DEF - Static variable in interface PdePartialTokenTypes
-
 
-
INTERFACE_DEF - Static variable in interface PdeTokenTypes
-
 
-
interfaceBlock() - Method in class JavaRecognizer
-
 
-
interfaceBlock() - Method in class PdeRecognizer
-
 
-
interfaceDefinition(AST) - Method in class JavaRecognizer
-
 
-
interfaceDefinition(AST) - Method in class PdeRecognizer
-
 
-
interfaceExtends() - Method in class JavaRecognizer
-
 
-
interfaceExtends() - Method in class PdeRecognizer
-
 
-
interfaceField() - Method in class JavaRecognizer
-
 
-
interfaceField() - Method in class PdeRecognizer
-
 
-
INTERNAL_FIRST - Static variable in class Token
-
-
The first id that can be used for internal state - in a token marker.
-
-
INTERNAL_LAST - Static variable in class Token
-
-
The last id that can be used for internal state - in a token marker.
-
-
internalCloseRunner() - Method in class Editor
-
-
Halt the current runner for whatever reason.
-
-
interpolate(String, Object...) - Static method in class Language
-
 
-
IntList - Class in processing.data
-
-
Helper class for a list of ints.
-
-
IntList() - Constructor for class IntList
-
 
-
IntList(int) - Constructor for class IntList
-
 
-
IntList(int[]) - Constructor for class IntList
-
 
-
IntList(Iterable<Object>) - Constructor for class IntList
-
-
Construct an IntList from an iterable pile of objects.
-
-
IntList(Object...) - Constructor for class IntList
-
-
Construct an IntList from a random pile of objects.
-
-
INVALID - Static variable in class Token
-
-
Invalid token id.
-
-
invalidate() - Method in class Brackets
-
 
-
invalidateComposedTextLayout(int) - Method in class CompositionTextPainter
-
-
Invalidate this TextLayout to set null.
-
-
invalidateLine(int) - Method in class TextAreaPainter
-
-
Marks a line as needing a repaint.
-
-
INVERT - Static variable in interface PConstants
-
 
-
invert() - Method in interface PMatrix
-
-
Invert this matrix.
-
-
invert() - Method in class PMatrix2D
-
-
Invert this matrix.
-
-
invert() - Method in class PMatrix3D
-
-
Invert this matrix.
-
-
INVERT - Static variable in class PGL
-
 
-
invertedX() - Method in class Texture
-
-
Returns true if the texture is inverted along the horizontal direction.
-
-
invertedX(boolean) - Method in class Texture
-
-
Sets the texture as inverted or not along the horizontal direction.
-
-
invertedY() - Method in class Texture
-
-
Returns true if the texture is inverted along the vertical direction.
-
-
invertedY(boolean) - Method in class Texture
-
-
Sets the texture as inverted or not along the vertical direction.
-
-
is2D() - Method in class PGraphics
-
-
Return true if this renderer supports 2D drawing.
-
-
is2D() - Method in class PShape
-
-
Return true if this shape is 2D.
-
-
is2D() - Method in class PGraphics2D
-
 
-
is2D() - Method in class PGraphics3D
-
 
-
is2X() - Method in class PGraphics
-
 
-
is3D() - Method in class PGraphics
-
-
Return true if this renderer supports 3D drawing.
-
-
is3D() - Method in class PShape
-
-
Return true if this shape is 3D.
-
-
is3D() - Method in class PGraphics2D
-
 
-
is3D() - Method in class PGraphics3D
-
 
-
isAltDown() - Method in class Event
-
 
-
isAssertEnabled() - Method in class JavaLexer
-
-
Query the "assert" keyword state
-
-
isAssertEnabled() - Method in class PdeLexer
-
-
Query the "assert" keyword state
-
-
isBlockCaretEnabled() - Method in class TextAreaPainter
-
-
Returns true if the caret should be drawn as a block, false otherwise.
-
-
isBold() - Method in class SyntaxStyle
-
-
Returns true if boldface is enabled for this style.
-
-
isBracketHighlightEnabled() - Method in class TextAreaPainter
-
-
Returns true if bracket highlighting is enabled, false otherwise.
-
-
isBuffer(int) - Method in class PGL
-
 
-
isBuffer(int) - Method in class PJOGL
-
 
-
isCaretBlinkEnabled() - Method in class JEditTextArea
-
-
Returns true if the caret is blinking, false otherwise.
-
-
isCaretVisible() - Method in class JEditTextArea
-
-
Returns true if the caret is visible, false otherwise.
-
-
isClosed() - Method in class PShape
-
 
-
isCompatible(int) - Method in class Contribution
-
 
-
isControlDown() - Method in class Event
-
 
-
isDataFlavorSupported(DataFlavor) - Method in class HtmlSelection
-
 
-
isDefaultExtension(SketchCode) - Method in class Mode
-
-
True if the specified code has the default file extension.
-
-
isDefaultExtension(String) - Method in class Mode
-
-
True if the specified extension is the default file extension.
-
-
isDone() - Method in class LinePath.PathIterator
-
 
-
isEditable() - Method in class JEditTextArea
-
-
Returns true if this text area is editable, false otherwise.
-
-
isEnabled(int) - Method in class PGL
-
 
-
isEnabled(int) - Method in class PJOGL
-
 
-
isEnumEnabled() - Method in class JavaLexer
-
-
Query the "enum" keyword state
-
-
isEnumEnabled() - Method in class PdeLexer
-
-
Query the "enum" keyword state
-
-
isExamplesCompatible(Base, File) - Static method in class ExamplesContribution
-
-
Function to determine whether or not the example present in the - exampleLocation directory is compatible with the present mode.
-
-
isExtension(String) - Method in class SketchCode
-
 
-
isFramebuffer(int) - Method in class PGL
-
 
-
isFramebuffer(int) - Method in class PJOGL
-
 
-
isGL() - Method in class PGraphics
-
-
Return true if this renderer does rendering through OpenGL.
-
-
isGL() - Method in class PGraphicsOpenGL
-
 
-
isHalted() - Method in class Editor
-
 
-
isHalted() - Method in interface RunnerListener
-
 
-
isInstalled() - Method in class AvailableContribution
-
 
-
isInstalled() - Method in class Contribution
-
 
-
isInstalled() - Method in class LocalContribution
-
 
-
isLinux() - Static method in class Base
-
-
true if running on linux.
-
-
isLoaded() - Method in class PImage
-
 
-
isMacOS() - Static method in class Base
-
-
returns true if Processing is running on a Mac OS X machine.
-
-
isMetaDown() - Method in class Event
-
 
-
isModified() - Method in class Sketch
-
 
-
isModified() - Method in class SketchCode
-
 
-
isModified() - Method in class PImage
-
 
-
isModified() - Method in class Texture
-
 
-
isNextLineRequested() - Method in class TokenMarker
-
-
Returns true if the next line should be repainted.
-
-
isNull(int) - Method in class JSONArray
-
-
Determine if the value is null.
-
-
isNull(String) - Method in class JSONObject
-
-
Determine if the value associated with the key is null or if there is - no value.
-
-
isOverwriteEnabled() - Method in class JEditTextArea
-
-
Returns true if overwrite mode is enabled, false otherwise.
-
-
isProgram(int) - Method in class PGL
-
 
-
isProgram(int) - Method in class PJOGL
-
 
-
isqrt(int) - Static method in class LinePath
-
 
-
isReadOnly() - Method in class Sketch
-
-
Returns true if this is a read-only sketch.
-
-
isRenderbuffer(int) - Method in class PGL
-
 
-
isRenderbuffer(int) - Method in class PJOGL
-
 
-
isRepeatEnabled() - Method in class InputHandler
-
-
Returns if repeating is enabled.
-
-
isSanitaryName(String) - Static method in class Sketch
-
-
Return true if the name is valid for a Processing sketch.
-
-
isSelectionActive() - Method in class Editor
-
-
True if some text is currently selected.
-
-
isSelectionActive() - Method in class JEditTextArea
-
 
-
isSelectionRectangular() - Method in class JEditTextArea
-
-
Returns true if the selection is rectangular, false otherwise.
-
-
isShader(int) - Method in class PGL
-
 
-
isShader(int) - Method in class PJOGL
-
 
-
isShiftDown() - Method in class EditorButton
-
 
-
isShiftDown() - Method in class Event
-
 
-
isStopped() - Method in interface PSurface
-
 
-
isStopped() - Method in class PSurfaceFX
-
 
-
isStopped() - Method in class PSurfaceNone
-
 
-
isStopped() - Method in class PSurfaceJOGL
-
 
-
isStream() - Method in class PFont
-
 
-
isTempFolderName(String) - Method in enum ContributionType
-
 
-
isTexture(int) - Method in class PGL
-
 
-
isTexture(int) - Method in class PJOGL
-
 
-
isUntitled() - Method in class Sketch
-
 
-
isVisible() - Method in class PShape
-
-
( begin auto-generated from PShape_isVisible.xml ) - - Returns a boolean value "true" if the image is set to be visible, - "false" if not.
-
-
isWindows() - Static method in class Base
-
-
returns true if running on windows.
-
-
iterator() - Method in class ProcessResult
-
 
-
iterator() - Method in class FloatList
-
-
Implemented this way so that we can use a FloatList in a for loop.
-
-
iterator() - Method in class IntList
-
 
-
iterator() - Method in class StringList
-
 
-
- - - -

J

-
-
JAVA2D - Static variable in interface PConstants
-
 
-
JavaLexer - Class in processing.mode.java.preproc
-
 
-
JavaLexer(InputStream) - Constructor for class JavaLexer
-
 
-
JavaLexer(Reader) - Constructor for class JavaLexer
-
 
-
JavaLexer(InputBuffer) - Constructor for class JavaLexer
-
 
-
JavaLexer(LexerSharedInputState) - Constructor for class JavaLexer
-
 
-
javaProgram() - Method in class PdeRecognizer
-
 
-
JavaRecognizer - Class in processing.mode.java.preproc
-
-
Java 1.5 Recognizer -/** Java 1.5 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.
-
-
JavaRecognizer(TokenBuffer) - Constructor for class JavaRecognizer
-
 
-
JavaRecognizer(TokenStream) - Constructor for class JavaRecognizer
-
 
-
JavaRecognizer(ParserSharedInputState) - Constructor for class JavaRecognizer
-
 
-
JavaTokenTypes - Interface in processing.mode.java.preproc
-
 
-
javaVersion - Static variable in class 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 PApplet
-
-
Full name of the Java version (i.e.
-
-
JEditTextArea - Class in processing.app.syntax
-
-
The text area component from the JEdit Syntax (syntax.jedit.org) project.
-
-
JEditTextArea(TextAreaDefaults, InputHandler) - Constructor for class JEditTextArea
-
-
Creates a new JEditTextArea with the specified settings.
-
-
join(String[], char) - Static method in class PApplet
-
-
( begin auto-generated from join.xml ) - - Combines an array of Strings into one String, each separated by the - character(s) used for the separator parameter.
-
-
join(String[], String) - Static method in class PApplet
-
 
-
join(String) - Method in class FloatList
-
 
-
join(String) - Method in class IntList
-
 
-
join(String) - Method in class JSONArray
-
-
Make a string from the contents of this JSONArray.
-
-
join(String) - Method in class StringList
-
 
-
JOIN_BEVEL - Static variable in class LinePath
-
-
Joins path segments by connecting the outer corners of their wide outlines - with a straight segment.
-
-
JOIN_MITER - Static variable in class LinePath
-
-
Joins path segments by extending their outside edges until they meet.
-
-
JOIN_ROUND - Static variable in class LinePath
-
-
Joins path segments by rounding off the corner at a radius of half the line - width.
-
-
JPEG - Static variable in interface PConstants
-
 
-
JSONArray - Class in processing.data
-
-
A JSONArray is an ordered sequence of values.
-
-
JSONArray() - Constructor for class JSONArray
-
-
Construct an empty JSONArray.
-
-
JSONArray(Reader) - Constructor for class JSONArray
-
 
-
JSONArray(IntList) - Constructor for class JSONArray
-
 
-
JSONArray(FloatList) - Constructor for class JSONArray
-
 
-
JSONArray(StringList) - Constructor for class JSONArray
-
 
-
JSONObject - Class in processing.data
-
-
A JSONObject is an unordered collection of name/value pairs.
-
-
JSONObject() - Constructor for class JSONObject
-
-
Construct an empty JSONObject.
-
-
JSONObject(Reader) - Constructor for class JSONObject
-
 
-
JSONObject(IntDict) - Constructor for class JSONObject
-
 
-
JSONObject(FloatDict) - Constructor for class JSONObject
-
 
-
JSONObject(StringDict) - Constructor for class JSONObject
-
 
-
- - - -

K

-
-
KEEP - Static variable in class PGL
-
 
-
kern(char, char) - Method in class PFont
-
-
Currently un-implemented for .vlw fonts, - but honored for layout in case subclasses use it.
-
-
key - Variable in class PApplet
-
-
( begin auto-generated from key.xml ) - - The system variable key always contains the value of the most - recent key on the keyboard that was used (either pressed or released).
-
-
key(int) - Method in class FloatDict
-
 
-
key(int) - Method in class IntDict
-
 
-
key(int) - Method in class StringDict
-
 
-
KEY - Static variable in class Event
-
 
-
keyArray() - Method in class FloatDict
-
-
Return a copy of the internal keys array.
-
-
keyArray(String[]) - Method in class FloatDict
-
 
-
keyArray() - Method in class IntDict
-
-
Return a copy of the internal keys array.
-
-
keyArray(String[]) - Method in class IntDict
-
 
-
keyArray() - Method in class StringDict
-
-
Return a copy of the internal keys array.
-
-
keyArray(String[]) - Method in class StringDict
-
 
-
keyCode - Variable in class PApplet
-
-
( begin auto-generated from keyCode.xml ) - - The variable keyCode is used to detect special keys such as the - UP, DOWN, LEFT, RIGHT arrow keys and ALT, CONTROL, SHIFT.
-
-
keyEvent - Variable in class PApplet
-
-
Deprecated. -
Use a key event handler that passes an event instead.
-
-
-
KeyEvent - Class in processing.event
-
 
-
KeyEvent(Object, long, int, int, char, int) - Constructor for class KeyEvent
-
 
-
keyIterator() - Method in class IntDict
-
 
-
keyIterator() - Method in class JSONObject
-
-
Get an enumeration of the keys of the JSONObject.
-
-
keyPressed(KeyEvent) - Method in class DefaultInputHandler
-
-
Handle a key pressed event.
-
-
keyPressed(KeyEvent) - Method in class PdeInputHandler
-
 
-
keyPressed - Variable in class PApplet
-
-
( begin auto-generated from keyPressed_var.xml ) - - The boolean system variable keyPressed is true if any key - is pressed and false if no keys are pressed.
-
-
keyPressed() - Method in class PApplet
-
-
( begin auto-generated from keyPressed.xml ) - - The keyPressed() function is called once every time a key is - pressed.
-
-
keyPressed(KeyEvent) - Method in class PApplet
-
 
-
keyReleased() - Method in class PApplet
-
-
( begin auto-generated from keyReleased.xml ) - - The keyReleased() function is called once every time a key is - released.
-
-
keyReleased(KeyEvent) - Method in class PApplet
-
 
-
keys() - Method in class FloatDict
-
 
-
keys() - Method in class IntDict
-
-
Return the internal array being used to store the keys.
-
-
keys() - Method in class JSONObject
-
-
Get a set of keys of the JSONObject.
-
-
keys() - Method in class StringDict
-
 
-
keyTyped(KeyEvent) - Method in class DefaultInputHandler
-
-
Handle a key typed event.
-
-
keyTyped(KeyEvent) - Method in class PdeInputHandler
-
 
-
keyTyped() - Method in class PApplet
-
-
( begin auto-generated from keyTyped.xml ) - - The keyTyped() function is called once every time a key is - pressed, but action keys such as Ctrl, Shift, and Alt are ignored.
-
-
keyTyped(KeyEvent) - Method in class PApplet
-
 
-
KEYWORD1 - Static variable in class Token
-
-
Keywords (void, int, boolean, etc.)
-
-
KEYWORD2 - Static variable in class Token
-
-
Fields [variables within a class]
-
-
KEYWORD3 - Static variable in class Token
-
-
Loop/function-like blocks (for, while, etc.)
-
-
KEYWORD4 - Static variable in class Token
-
-
Processing variables (width, height, focused, etc.)
-
-
KEYWORD5 - Static variable in class Token
-
-
Datatypes (int, boolean, etc.)
-
-
KEYWORD6 - Static variable in class Token
-
-
Keywords which can be followed by parenthesis
-
-
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 KeywordMap
-
-
Creates a new KeywordMap.
-
-
- - - -

L

-
-
LABEL - Static variable in class Token
-
-
Label token id.
-
-
LABELED_STAT - Static variable in interface JavaTokenTypes
-
 
-
LABELED_STAT - Static variable in interface PdePartialTokenTypes
-
 
-
LABELED_STAT - Static variable in interface PdeTokenTypes
-
 
-
LAND - Static variable in interface JavaTokenTypes
-
 
-
LAND - Static variable in interface PdePartialTokenTypes
-
 
-
LAND - Static variable in interface PdeTokenTypes
-
 
-
LANDSCAPE - Static variable in interface PConstants
-
-
Screen orientation constant for landscape (the hot dog way).
-
-
Language - Class in processing.app
-
-
Internationalization (i18n)
-
-
lastModified() - Method in class SketchCode
-
-
Used to determine whether this file was modified externally
-
-
lastRowIndex() - Method in class Table
-
 
-
lastVisited() - Method in class SketchCode
-
 
-
launch(String) - Static method in class WebServer
-
 
-
launch(String) - Static method in class PApplet
-
-
( begin auto-generated from launch.xml ) - - Attempts to open an application or file using your platform's launcher.
-
-
launch(String...) - Static method in class PApplet
-
-
Launch a process using the platform's shell.
-
-
LBRACK - Static variable in interface JavaTokenTypes
-
 
-
LBRACK - Static variable in interface PdePartialTokenTypes
-
 
-
LBRACK - Static variable in interface PdeTokenTypes
-
 
-
LCURLY - Static variable in interface JavaTokenTypes
-
 
-
LCURLY - Static variable in interface PdePartialTokenTypes
-
 
-
LCURLY - Static variable in interface PdeTokenTypes
-
 
-
LE - Static variable in interface JavaTokenTypes
-
 
-
LE - Static variable in interface PdePartialTokenTypes
-
 
-
LE - Static variable in interface PdeTokenTypes
-
 
-
LEFT - Static variable in interface PConstants
-
 
-
LEFT_GUTTER - Static variable in class Editor
-
 
-
LEFT_OF_SCROLLBAR - Static variable in class JEditTextArea
-
-
Adding components with this name to the text area will place - them left of the horizontal scroll bar.
-
-
leftExtent - Variable in class PFont.Glyph
-
 
-
leftHandGutter - Static variable in class JEditTextArea
-
-
The size of the offset between the leftmost padding and the code
-
-
length - Variable in class Token
-
-
The length of this token.
-
-
LEQUAL - Static variable in class PGL
-
 
-
lerp(float, float, float) - Static method in class PApplet
-
-
( begin auto-generated from lerp.xml ) - - Calculates a number between two numbers at a specific increment.
-
-
lerp(PVector, float) - Method in class PVector
-
-
( begin auto-generated from PVector_rotate.xml ) - - Linear interpolate the vector to another vector - - ( end auto-generated )
-
-
lerp(PVector, PVector, float) - Static method in class PVector
-
-
Linear interpolate between two vectors (returns a new PVector object)
-
-
lerp(float, float, float, float) - Method in class PVector
-
-
Linear interpolate the vector to x,y,z values
-
-
lerpColor(int, int, float) - Method in class PApplet
-
-
( begin auto-generated from lerpColor.xml ) - - Calculates a color or colors between two color at a specific increment.
-
-
lerpColor(int, int, float, int) - Static method in class PApplet
-
 
-
lerpColor(int, int, float) - Method in class PGraphics
-
-
( begin auto-generated from lerpColor.xml ) - - Calculates a color or colors between two color at a specific increment.
-
-
lerpColor(int, int, float, int) - Static method in class PGraphics
-
 
-
LESS - Static variable in class PGL
-
 
-
librariesByImportHeader - Variable in class ContributionListing
-
 
-
Library - Class in processing.app
-
 
-
Library(File) - Constructor for class Library
-
 
-
lightAmbient - Variable in class PGraphicsOpenGL
-
-
Ambient colors for lights.
-
-
lightCount - Variable in class PGraphicsOpenGL
-
 
-
lightDiffuse - Variable in class PGraphicsOpenGL
-
-
Diffuse colors for lights.
-
-
LIGHTEST - Static variable in interface PConstants
-
 
-
lightFalloff(float, float, float) - Method in class PApplet
-
-
( begin auto-generated from lightFalloff.xml ) - - Sets the falloff rates for point lights, spot lights, and ambient - lights.
-
-
lightFalloff(float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from lightFalloff.xml ) - - Sets the falloff rates for point lights, spot lights, and ambient - lights.
-
-
lightFalloff(float, float, float) - Method in class PGraphics2D
-
 
-
lightFalloff(float, float, float) - Method in class PGraphicsOpenGL
-
-
Set the light falloff rates for the last light that was created.
-
-
lightFalloffCoefficients - Variable in class PGraphicsOpenGL
-
-
Light falloff
-
-
lightNormal - Variable in class PGraphicsOpenGL
-
-
Light direction (normalized vector)
-
-
lightPosition - Variable in class PGraphicsOpenGL
-
-
Light positions
-
-
lights() - Method in class PApplet
-
-
( begin auto-generated from lights.xml ) - - Sets the default ambient light, directional light, falloff, and specular - values.
-
-
lights() - Method in class PGraphics
-
-
( begin auto-generated from lights.xml ) - - Sets the default ambient light, directional light, falloff, and specular - values.
-
-
lights() - Method in class PGraphics2D
-
 
-
lights - Variable in class PGraphicsOpenGL
-
 
-
lights() - Method in class PGraphicsOpenGL
-
-
Sets up an ambient and directional light using OpenGL.
-
-
lightSpecular(float, float, float) - Method in class PApplet
-
-
( begin auto-generated from lightSpecular.xml ) - - Sets the specular color for lights.
-
-
lightSpecular(float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from lightSpecular.xml ) - - Sets the specular color for lights.
-
-
lightSpecular(float, float, float) - Method in class PGraphics2D
-
 
-
lightSpecular - Variable in class PGraphicsOpenGL
-
-
Specular colors for lights.
-
-
lightSpecular(float, float, float) - Method in class PGraphicsOpenGL
-
-
Set the specular color of the last light created.
-
-
lightSpotParameters - Variable in class PGraphicsOpenGL
-
-
Light spot parameters: Cosine of light spot angle - and concentration
-
-
lightType - Variable in class PGraphicsOpenGL
-
-
Light types
-
-
limit(float) - Method in class PVector
-
-
( begin auto-generated from PVector_limit.xml ) - - Limit the magnitude of this vector to the value used for the max parameter.
-
-
line(float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen.
-
-
line(float, float, float, float, float, float) - Method in class PApplet
-
 
-
LINE - Static variable in interface PConstants
-
 
-
line(float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen.
-
-
line(float, float, float, float, float, float) - Method in class PGraphics
-
 
-
line(float, float, float, float) - Method in class PGraphicsFX2D
-
 
-
line(float, float, float, float) - Method in class PGraphicsJava2D
-
 
-
line(float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
line(float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
LINE_LOOP - Static variable in interface PConstants
-
 
-
LINE_LOOP - Static variable in class PGL
-
 
-
LINE_SMOOTH - Static variable in class PGL
-
 
-
LINE_STRIP - Static variable in interface PConstants
-
 
-
LINE_STRIP - Static variable in class PGL
-
 
-
LINEAR - Static variable in class PGL
-
 
-
LINEAR_MIPMAP_LINEAR - Static variable in class PGL
-
 
-
LINEAR_MIPMAP_NEAREST - Static variable in class PGL
-
 
-
lineHighlight - Variable in class TextAreaDefaults
-
 
-
lineHighlightColor - Variable in class TextAreaDefaults
-
 
-
lineJoin() - Method in class LineStroker
-
 
-
LinePath - Class in processing.opengl
-
-
The LinePath class allows to represent polygonal paths, - potentially composed by several disjoint polygonal segments.
-
-
LinePath() - Constructor for class LinePath
-
-
Constructs a new empty single precision LinePath object with a - default winding rule of LinePath.WIND_NON_ZERO.
-
-
LinePath(int) - Constructor for class LinePath
-
-
Constructs a new empty single precision LinePath object with the - specified winding rule to control operations that require the interior of - the path to be defined.
-
-
LinePath(int, int) - Constructor for class LinePath
-
-
Constructs a new LinePath object from the given specified initial - values.
-
-
LinePath.PathIterator - Class in processing.opengl
-
 
-
LineProcessor - Interface in processing.app.exec
-
 
-
LINES - Static variable in interface PConstants
-
 
-
LINES - Static variable in class PGL
-
 
-
LineStroker - Class in processing.opengl
-
 
-
LineStroker() - Constructor for class LineStroker
-
-
Empty constructor.
-
-
LineStroker(LineStroker, int, int, int, int, PMatrix2D) - Constructor for class LineStroker
-
-
Constructs a LineStroker.
-
-
lineTo(float, float, int) - Method in class LinePath
-
-
Adds a point to the path by drawing a straight line from the current - coordinates to the new specified coordinates specified in float precision.
-
-
lineTo(int, int, int) - Method in class LineStroker
-
 
-
lineToY(int) - Method in class JEditTextArea
-
-
Converts a line index to a y co-ordinate.
-
-
lineWidth(float) - Method in class PGL
-
 
-
lineWidth(float) - Method in class PJOGL
-
 
-
link(String) - Method in class PApplet
-
-
Links to a webpage either in the same window or in a new window.
-
-
LINK_STATUS - Static variable in class PGL
-
 
-
linkProgram(int) - Method in class PGL
-
 
-
linkProgram(int) - Method in class PJOGL
-
 
-
LINUX - Static variable in interface PConstants
-
 
-
LinuxPlatform - Class in processing.app.platform
-
 
-
LinuxPlatform() - Constructor for class LinuxPlatform
-
 
-
list() - Static method in class PFont
-
-
( begin auto-generated from PFont_list.xml ) - - Gets a list of the fonts installed on the system.
-
-
listAttributes() - Method in class XML
-
-
Get a list of the names for all of the attributes for this node.
-
-
listCandidates(File) - Method in enum ContributionType
-
-
Return a list of directories that have the necessary subfolder for this - contribution type.
-
-
listChildren() - Method in class XML
-
-
Put the names of all children into an array.
-
-
listFiles(File, boolean) - Static method in class Base
-
-
Recursively creates a list of all files within the specified folder, - and returns a list of their relative paths.
-
-
listFiles(File, boolean, String) - Static method in class Base
-
 
-
listJarFiles(File) - Static method in class Base
-
 
-
LITERAL1 - Static variable in class Token
-
-
Strings in quotes
-
-
LITERAL2 - Static variable in class Token
-
-
Constants (QUARTER_PI, CORNERS, etc.)
-
-
LITERAL_assert - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_assert - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_assert - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_boolean - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_boolean - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_boolean - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_break - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_break - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_break - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_byte - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_byte - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_byte - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_case - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_case - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_case - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_catch - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_catch - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_catch - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_char - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_char - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_char - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_class - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_class - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_class - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_color - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_color - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_continue - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_continue - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_continue - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_default - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_default - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_default - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_do - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_do - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_do - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_double - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_double - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_double - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_else - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_else - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_else - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_enum - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_enum - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_enum - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_extends - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_extends - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_extends - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_false - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_false - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_false - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_finally - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_finally - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_finally - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_float - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_float - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_float - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_for - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_for - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_for - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_if - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_if - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_if - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_implements - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_implements - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_implements - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_import - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_import - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_import - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_instanceof - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_instanceof - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_instanceof - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_int - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_int - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_int - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_interface - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_interface - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_interface - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_long - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_long - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_long - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_native - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_native - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_native - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_new - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_new - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_new - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_null - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_null - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_null - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_package - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_package - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_package - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_private - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_private - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_private - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_protected - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_protected - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_protected - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_public - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_public - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_public - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_return - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_return - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_return - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_short - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_short - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_short - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_static - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_static - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_static - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_super - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_super - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_super - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_switch - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_switch - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_switch - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_synchronized - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_synchronized - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_synchronized - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_this - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_this - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_this - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_threadsafe - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_threadsafe - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_threadsafe - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_throw - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_throw - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_throw - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_throws - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_throws - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_throws - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_transient - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_transient - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_transient - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_true - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_true - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_true - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_try - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_try - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_try - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_void - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_void - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_void - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_volatile - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_volatile - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_volatile - Static variable in interface PdeTokenTypes
-
 
-
LITERAL_while - Static variable in interface JavaTokenTypes
-
 
-
LITERAL_while - Static variable in interface PdePartialTokenTypes
-
 
-
LITERAL_while - Static variable in interface PdeTokenTypes
-
 
-
LNOT - Static variable in interface JavaTokenTypes
-
 
-
LNOT - Static variable in interface PdePartialTokenTypes
-
 
-
LNOT - Static variable in interface PdeTokenTypes
-
 
-
load(File) - Static method in class ExamplesContribution
-
 
-
load(Base, File) - Static method in class ModeContribution
-
 
-
load(Base, File, String) - Static method in class ModeContribution
-
 
-
load(File) - Static method in class ToolContribution
-
 
-
load(File) - Static method in class Library
-
 
-
load(InputStream) - Static method in class Preferences
-
-
Load a set of key/value pairs from a UTF-8 encoded file into 'table'.
-
-
load() - Method in class Settings
-
 
-
load(File) - Method in class Settings
-
 
-
load() - Method in class SketchCode
-
-
Load this piece of code from a file.
-
-
loadAll(File) - Static method in class ToolContribution
-
 
-
loadBytes(String) - Method in class PApplet
-
-
( begin auto-generated from loadBytes.xml ) - - Reads the contents of a file or url and places it in a byte array.
-
-
loadBytes(InputStream) - Static method in class PApplet
-
 
-
loadBytes(File) - Static method in class PApplet
-
 
-
loadBytesRaw(File) - Static method in class Base
-
-
Same as PApplet.loadBytes(), however never does gzip decoding.
-
-
loaded - Variable in class PImage
-
-
Loaded pixels flag
-
-
loadFile(File) - Static method in class Base
-
-
Grab the contents of a file as a string.
-
-
loadFont(String) - Method in class PApplet
-
-
( begin auto-generated from loadFont.xml ) - - Loads a font into a variable of type PFont.
-
-
loadFonts() - Static method in class PFont
-
 
-
loadIcon(String) - Method in class Mode
-
-
Get an ImageIcon object from the Mode folder.
-
-
loadImage(String) - Method in class Mode
-
-
Get an image object from the mode folder.
-
-
loadImage(String) - Method in class PApplet
-
-
( begin auto-generated from loadImage.xml ) - - Loads an image into a variable of type PImage.
-
-
loadImage(String, String) - Method in class PApplet
-
 
-
loadJSONArray(String) - Method in class PApplet
-
 
-
loadJSONArray(File) - Static method in class PApplet
-
 
-
loadJSONObject(String) - Method in class PApplet
-
 
-
loadJSONObject(File) - Static method in class PApplet
-
 
-
loadMissing(Base) - Static method in class ExamplesContribution
-
 
-
loadMissing(Base) - Static method in class ModeContribution
-
 
-
loadPixels() - Method in class PApplet
-
-
( begin auto-generated from loadPixels.xml ) - - Loads the pixel data for the display window into the pixels[] - array.
-
-
loadPixels() - Method in class PGraphicsDanger2D
-
 
-
loadPixels() - Method in class PGraphicsFX2D
-
 
-
loadPixels() - Method in class PGraphicsJava2D
-
 
-
loadPixels() - Method in class PImage
-
-
( begin auto-generated from PImage_loadPixels.xml ) - - Loads the pixel data for the image into its pixels[] array.
-
-
loadPixels() - Method in class PGraphicsOpenGL
-
 
-
loadShader(String) - Method in class PApplet
-
-
( begin auto-generated from loadShader.xml ) - - This is a new reference entry for Processing 2.0.
-
-
loadShader(String, String) - Method in class PApplet
-
 
-
loadShader(String) - Method in class PGraphics
-
-
( begin auto-generated from loadShader.xml ) - - This is a new reference entry for Processing 2.0.
-
-
loadShader(String, String) - Method in class PGraphics
-
 
-
loadShader(String) - Method in class PGraphicsOpenGL
-
 
-
loadShader(String, String) - Method in class PGraphicsOpenGL
-
 
-
loadShape(String) - Method in class PApplet
-
 
-
loadShape(String, String) - Method in class PApplet
-
 
-
loadShape(String) - Method in class PGraphics
-
 
-
loadShape(String, String) - Method in class PGraphics
-
 
-
loadShape(String) - Method in class PGraphicsFX2D
-
 
-
loadShape(String, String) - Method in class PGraphicsFX2D
-
 
-
loadShape(String, String) - Method in class PGraphicsJava2D
-
 
-
loadShape(String) - Method in class PGraphicsOpenGL
-
 
-
loadStrings(File) - Static method in class PApplet
-
 
-
loadStrings(String) - Method in class PApplet
-
-
( begin auto-generated from loadStrings.xml ) - - Reads the contents of a file or url and creates a String array of its - individual lines.
-
-
loadStrings(InputStream) - Static method in class PApplet
-
 
-
loadStrings(BufferedReader) - Static method in class PApplet
-
 
-
loadTable(String) - Method in class PApplet
-
 
-
loadTable(String, String) - Method in class PApplet
-
-
Options may contain "header", "tsv", "csv", or "bin" separated by commas.
-
-
loadTexture() - Method in class PGraphicsOpenGL
-
 
-
loadXML(String) - Method in class PApplet
-
 
-
loadXML(String, String) - Method in class PApplet
-
 
-
LocalContribution - Class in processing.app.contrib
-
-
A contribution that has been downloaded to the disk, and may or may not - be installed.
-
-
LocalContribution(File) - Constructor for class LocalContribution
-
 
-
locateSketchbookFolder() - Static method in class Base
-
 
-
log(Object, String) - Static method in class Base
-
 
-
log(String) - Static method in class Base
-
 
-
log(float) - Static method in class PApplet
-
-
( begin auto-generated from log.xml ) - - Calculates the natural logarithm (the base-e logarithm) of a - number.
-
-
loge(String, Throwable) - Static method in class Base
-
 
-
loge(String) - Static method in class Base
-
 
-
logf(String, Object...) - Static method in class Base
-
 
-
logicalAndExpression() - Method in class JavaRecognizer
-
 
-
logicalAndExpression() - Method in class PdeRecognizer
-
 
-
logicalOrExpression() - Method in class JavaRecognizer
-
 
-
logicalOrExpression() - Method in class PdeRecognizer
-
 
-
LONG - Static variable in class Table
-
 
-
lookup(Segment, int, int, boolean) - Method in class KeywordMap
-
-
Looks up a key.
-
-
lookupReference(String) - Method in class Mode
-
-
Returns the HTML filename (including path prefix if necessary) - for this keyword, or null if it doesn't exist.
-
-
loop() - Method in class PApplet
-
-
( begin auto-generated from loop.xml ) - - Causes Processing to continuously execute the code within draw().
-
-
LOR - Static variable in interface JavaTokenTypes
-
 
-
LOR - Static variable in interface PdePartialTokenTypes
-
 
-
LOR - Static variable in interface PdeTokenTypes
-
 
-
LOW_FLOAT - Static variable in class PGL
-
 
-
LOW_INT - Static variable in class PGL
-
 
-
lower() - Method in class StringList
-
-
Make the entire list lower case.
-
-
LPAREN - Static variable in interface JavaTokenTypes
-
 
-
LPAREN - Static variable in interface PdePartialTokenTypes
-
 
-
LPAREN - Static variable in interface PdeTokenTypes
-
 
-
lsqrt(long) - Static method in class LinePath
-
 
-
LT - Static variable in interface JavaTokenTypes
-
 
-
LT - Static variable in interface PdePartialTokenTypes
-
 
-
LT - Static variable in interface PdeTokenTypes
-
 
-
LUMINANCE - Static variable in class PGL
-
 
-
LUMINANCE_ALPHA - Static variable in class PGL
-
 
-
- - - -

M

-
-
m00 - Variable in class PMatrix2D
-
 
-
m00 - Variable in class PMatrix3D
-
 
-
m01 - Variable in class PMatrix2D
-
 
-
m01 - Variable in class PMatrix3D
-
 
-
m02 - Variable in class PMatrix2D
-
 
-
m02 - Variable in class PMatrix3D
-
 
-
m03 - Variable in class PMatrix3D
-
 
-
m10 - Variable in class PMatrix2D
-
 
-
m10 - Variable in class PMatrix3D
-
 
-
m11 - Variable in class PMatrix2D
-
 
-
m11 - Variable in class PMatrix3D
-
 
-
m12 - Variable in class PMatrix2D
-
 
-
m12 - Variable in class PMatrix3D
-
 
-
m13 - Variable in class PMatrix3D
-
 
-
m20 - Variable in class PMatrix3D
-
 
-
m21 - Variable in class PMatrix3D
-
 
-
m22 - Variable in class PMatrix3D
-
 
-
m23 - Variable in class PMatrix3D
-
 
-
m30 - Variable in class PMatrix3D
-
 
-
m31 - Variable in class PMatrix3D
-
 
-
m32 - Variable in class PMatrix3D
-
 
-
m33 - Variable in class PMatrix3D
-
 
-
MACOSX - Static variable in interface PConstants
-
 
-
MacPlatform - Class in processing.app.platform
-
-
Platform handler for Mac OS X.
-
-
MacPlatform() - Constructor for class MacPlatform
-
 
-
mag(float, float) - Static method in class PApplet
-
 
-
mag(float, float, float) - Static method in class PApplet
-
-
( begin auto-generated from mag.xml ) - - Calculates the magnitude (or length) of a vector.
-
-
mag() - Method in class PVector
-
-
( begin auto-generated from PVector_mag.xml ) - - Calculates the magnitude (length) of the vector and returns the result - as a float (this is simply the equation sqrt(x*x + y*y + z*z).) - - ( end auto-generated )
-
-
magSq() - Method in class PVector
-
-
( begin auto-generated from PVector_mag.xml ) - - Calculates the squared magnitude of the vector and returns the result - as a float (this is simply the equation (x*x + y*y + z*z).) - Faster if the real length is not required in the - case of comparing vectors, etc.
-
-
main(String[]) - Static method in class Base
-
 
-
main(String[]) - Static method in class PApplet
-
-
main() method for running this class from the command line.
-
-
main(String) - Static method in class PApplet
-
-
Convenience method so that PApplet.main("YourSketch") launches a sketch, - rather than having to wrap it into a single element String array.
-
-
main(String, String[]) - Static method in class PApplet
-
-
Convenience method so that PApplet.main("YourSketch", args) launches a - sketch, rather than having to wrap it into a String array, and appending - the 'args' array when not null.
-
-
makeGradient(String, int, int) - Method in class Mode
-
 
-
makeTempFolder() - Method in class Sketch
-
-
Create a temporary folder that includes the sketch's name in its title.
-
-
map(float, float, float, float, float) - Static method in class PApplet
-
-
( begin auto-generated from map.xml ) - - Re-maps a number from one range to another.
-
-
mapBuffer(int, int) - Method in class PGL
-
 
-
mapBuffer(int, int) - Method in class PJOGL
-
 
-
mapBufferRange(int, int, int, int) - Method in class PGL
-
 
-
mapBufferRange(int, int, int, int) - Method in class PJOGL
-
 
-
markTokens(Segment, int) - Method in class 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 PdeKeywords
-
 
-
mask(PImage) - Method in class PApplet
-
-
( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel.
-
-
mask(int[]) - Method in class PGraphicsDanger2D
-
 
-
mask(PImage) - Method in class PGraphicsDanger2D
-
 
-
mask(PImage) - Method in class PGraphicsFX2D
-
 
-
mask(int[]) - Method in class PGraphicsJava2D
-
 
-
mask(PImage) - Method in class PGraphicsJava2D
-
 
-
mask(int[]) - Method in class PImage
-
-
Deprecated.
-
-
mask(PImage) - Method in class PImage
-
-
( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel.
-
-
mask(PImage) - Method in class PGraphicsOpenGL
-
 
-
mASSIGN(boolean) - Method in class JavaLexer
-
 
-
mASSIGN(boolean) - Method in class PdeLexer
-
 
-
mAT(boolean) - Method in class JavaLexer
-
 
-
mAT(boolean) - Method in class PdeLexer
-
 
-
match(String, String) - Static method in class PApplet
-
-
( begin auto-generated from match.xml ) - - The match() function is used to apply a regular expression to a piece of - text, and return matching groups (elements found inside parentheses) as - a String array.
-
-
matchAll(String, String) - Static method in class PApplet
-
-
( begin auto-generated from matchAll.xml ) - - This function is used to apply a regular expression to a piece of text, - and return a list of matching groups (elements found inside parentheses) - as a two-dimensional String array.
-
-
matchRow(String, int) - Method in class Table
-
 
-
matchRow(String, String) - Method in class Table
-
 
-
matchRowIndex(String, int) - Method in class Table
-
-
Return the row that contains the first String that matches.
-
-
matchRowIndex(String, String) - Method in class Table
-
-
Return the row that contains the first String that matches.
-
-
matchRowIndices(String, int) - Method in class Table
-
-
Return a list of rows that contain the String passed in.
-
-
matchRowIndices(String, String) - Method in class Table
-
-
Return a list of rows that match the regex passed in.
-
-
matchRowIterator(String, int) - Method in class Table
-
 
-
matchRowIterator(String, String) - Method in class Table
-
 
-
matchRows(String, int) - Method in class Table
-
 
-
matchRows(String, String) - Method in class Table
-
 
-
max(int, int) - Static method in class PApplet
-
-
( begin auto-generated from max.xml ) - - Determines the largest value in a sequence of numbers.
-
-
max(float, float) - Static method in class PApplet
-
 
-
max(int, int, int) - Static method in class PApplet
-
 
-
max(float, float, float) - Static method in class PApplet
-
 
-
max(int[]) - Static method in class PApplet
-
 
-
max(float[]) - Static method in class PApplet
-
 
-
max() - Method in class FloatList
-
 
-
max() - Method in class IntList
-
 
-
MAX_BUFFER_CACHE_SIZE - Static variable in class Texture
-
 
-
MAX_COMBINED_TEXTURE_IMAGE_UNITS - Static variable in class PGL
-
 
-
MAX_FLOAT - Static variable in interface 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 PConstants
-
-
Largest possible (positive) integer value
-
-
MAX_SAMPLES - Static variable in class PGL
-
 
-
MAX_TEXTURE_IMAGE_UNITS - Static variable in class PGL
-
 
-
MAX_TEXTURE_MAX_ANISOTROPY - Static variable in class PGL
-
 
-
MAX_TEXTURE_SIZE - Static variable in class PGL
-
 
-
MAX_VERTEX_ATTRIBS - Static variable in class PGL
-
 
-
MAX_VERTEX_TEXTURE_IMAGE_UNITS - Static variable in class PGL
-
 
-
maxAnisoAmount - Static variable in class PGraphicsOpenGL
-
 
-
maxIndex() - Method in class FloatDict
-
 
-
maxIndex() - Method in class FloatList
-
 
-
maxIndex() - Method in class IntDict
-
 
-
maxIndex() - Method in class IntList
-
 
-
maxKey() - Method in class FloatDict
-
-
The key for a max value, or null if everything is NaN (no max).
-
-
maxKey() - Method in class IntDict
-
 
-
maxSamples - Static variable in class PGraphicsOpenGL
-
 
-
maxTexcoordU() - Method in class Texture
-
-
Returns the maximum possible value for the texture coordinate U - (horizontal).
-
-
maxTexcoordV() - Method in class Texture
-
-
Returns the maximum possible value for the texture coordinate V (vertical).
-
-
maxTextureSize - Static variable in class PGraphicsOpenGL
-
-
Some hardware limits
-
-
maxValue() - Method in class FloatDict
-
-
The max value.
-
-
maxValue() - Method in class IntDict
-
 
-
mBAND(boolean) - Method in class JavaLexer
-
 
-
mBAND(boolean) - Method in class PdeLexer
-
 
-
mBAND_ASSIGN(boolean) - Method in class JavaLexer
-
 
-
mBAND_ASSIGN(boolean) - Method in class PdeLexer
-
 
-
mBNOT(boolean) - Method in class JavaLexer
-
 
-
mBNOT(boolean) - Method in class PdeLexer
-
 
-
mBOR(boolean) - Method in class JavaLexer
-
 
-
mBOR(boolean) - Method in class PdeLexer
-
 
-
mBOR_ASSIGN(boolean) - Method in class JavaLexer
-
 
-
mBOR_ASSIGN(boolean) - Method in class PdeLexer
-
 
-
mBSR(boolean) - Method in class JavaLexer
-
 
-
mBSR(boolean) - Method in class PdeLexer
-
 
-
mBSR_ASSIGN(boolean) - Method in class JavaLexer
-
 
-
mBSR_ASSIGN(boolean) - Method in class PdeLexer
-
 
-
mBXOR(boolean) - Method in class JavaLexer
-
 
-
mBXOR(boolean) - Method in class PdeLexer
-
 
-
mBXOR_ASSIGN(boolean) - Method in class JavaLexer
-
 
-
mBXOR_ASSIGN(boolean) - Method in class PdeLexer
-
 
-
mCHAR_LITERAL(boolean) - Method in class JavaLexer
-
 
-
mCHAR_LITERAL(boolean) - Method in class PdeLexer
-
 
-
mCOLON(boolean) - Method in class JavaLexer
-
 
-
mCOLON(boolean) - Method in class PdeLexer
-
 
-
mCOMMA(boolean) - Method in class JavaLexer
-
 
-
mCOMMA(boolean) - Method in class PdeLexer
-
 
-
mDEC(boolean) - Method in class JavaLexer
-
 
-
mDEC(boolean) - Method in class PdeLexer
-
 
-
mDIV(boolean) - Method in class JavaLexer
-
 
-
mDIV(boolean) - Method in class PdeLexer
-
 
-
mDIV_ASSIGN(boolean) - Method in class JavaLexer
-
 
-
mDIV_ASSIGN(boolean) - Method in class PdeLexer
-
 
-
MEDIUM_FLOAT - Static variable in class PGL
-
 
-
MEDIUM_INT - Static variable in class PGL
-
 
-
mEQUAL(boolean) - Method in class JavaLexer
-
 
-
mEQUAL(boolean) - Method in class PdeLexer
-
 
-
message(String, boolean) - Method in class EditorConsole
-
 
-
META - Static variable in class Event
-
 
-
method(String) - Method in class PApplet
-
-
Call a method in the current class based on its name.
-
-
METHOD_CALL - Static variable in interface JavaTokenTypes
-
 
-
METHOD_CALL - Static variable in interface PdePartialTokenTypes
-
 
-
METHOD_CALL - Static variable in interface PdeTokenTypes
-
 
-
METHOD_DEF - Static variable in interface JavaTokenTypes
-
 
-
METHOD_DEF - Static variable in interface PdePartialTokenTypes
-
 
-
METHOD_DEF - Static variable in interface PdeTokenTypes
-
 
-
mGE(boolean) - Method in class JavaLexer
-
 
-
mGE(boolean) - Method in class PdeLexer
-
 
-
mGT(boolean) - Method in class JavaLexer
-
 
-
mGT(boolean) - Method in class PdeLexer
-
 
-
mIDENT(boolean) - Method in class JavaLexer
-
 
-
mIDENT(boolean) - Method in class PdeLexer
-
 
-
millis() - Method in class PApplet
-
-
( begin auto-generated from millis.xml ) - - Returns the number of milliseconds (thousandths of a second) since - starting an applet.
-
-
min(int, int) - Static method in class PApplet
-
-
Find the maximum value in an array.
-
-
min(float, float) - Static method in class PApplet
-
 
-
min(int, int, int) - Static method in class PApplet
-
 
-
min(float, float, float) - Static method in class PApplet
-
-
( begin auto-generated from min.xml ) - - Determines the smallest value in a sequence of numbers.
-
-
min(int[]) - Static method in class PApplet
-
 
-
min(float[]) - Static method in class PApplet
-
 
-
min() - Method in class FloatList
-
 
-
min() - Method in class IntList
-
 
-
MIN_FLOAT - Static variable in interface 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 PConstants
-
-
Smallest possible (negative) integer value
-
-
MIN_WINDOW_HEIGHT - Static variable in interface PSurface
-
 
-
MIN_WINDOW_WIDTH - Static variable in interface PSurface
-
-
Minimum dimensions for the window holding an applet.
-
-
mINC(boolean) - Method in class JavaLexer
-
 
-
mINC(boolean) - Method in class PdeLexer
-
 
-
minIndex() - Method in class FloatDict
-
 
-
minIndex() - Method in class FloatList
-
 
-
minIndex() - Method in class IntDict
-
 
-
minIndex() - Method in class IntList
-
 
-
minKey() - Method in class FloatDict
-
 
-
minKey() - Method in class IntDict
-
 
-
MINUS - Static variable in interface JavaTokenTypes
-
 
-
MINUS - Static variable in interface PdePartialTokenTypes
-
 
-
MINUS - Static variable in interface PdeTokenTypes
-
 
-
MINUS_ASSIGN - Static variable in interface JavaTokenTypes
-
 
-
MINUS_ASSIGN - Static variable in interface PdePartialTokenTypes
-
 
-
MINUS_ASSIGN - Static variable in interface PdeTokenTypes
-
 
-
minute() - Static method in class PApplet
-
-
( begin auto-generated from minute.xml ) - - Processing communicates with the clock on your computer.
-
-
minValue() - Method in class FloatDict
-
 
-
minValue() - Method in class IntDict
-
 
-
mipmaps - Variable in class Texture.Parameters
-
-
Use mipmaps or not.
-
-
MISSING_FBO_ERROR - Static variable in class PGL
-
 
-
MISSING_GLFUNC_ERROR - Static variable in class PGL
-
 
-
MISSING_GLSL_ERROR - Static variable in class PGL
-
 
-
missingGlyph - Variable in class PShapeSVG.Font
-
 
-
MITER - Static variable in interface PConstants
-
 
-
ML_COMMENT - Static variable in interface JavaTokenTypes
-
 
-
ML_COMMENT - Static variable in interface PdePartialTokenTypes
-
 
-
ML_COMMENT - Static variable in interface PdeTokenTypes
-
 
-
mLAND(boolean) - Method in class JavaLexer
-
 
-
mLAND(boolean) - Method in class PdeLexer
-
 
-
mLBRACK(boolean) - Method in class JavaLexer
-
 
-
mLBRACK(boolean) - Method in class PdeLexer
-
 
-
mLCURLY(boolean) - Method in class JavaLexer
-
 
-
mLCURLY(boolean) - Method in class PdeLexer
-
 
-
mLE(boolean) - Method in class JavaLexer
-
 
-
mLE(boolean) - Method in class PdeLexer
-
 
-
mLNOT(boolean) - Method in class JavaLexer
-
 
-
mLNOT(boolean) - Method in class PdeLexer
-
 
-
mLOR(boolean) - Method in class JavaLexer
-
 
-
mLOR(boolean) - Method in class PdeLexer
-
 
-
mLPAREN(boolean) - Method in class JavaLexer
-
 
-
mLPAREN(boolean) - Method in class PdeLexer
-
 
-
mLT(boolean) - Method in class JavaLexer
-
 
-
mLT(boolean) - Method in class PdeLexer
-
 
-
mMINUS(boolean) - Method in class JavaLexer
-
 
-
mMINUS(boolean) - Method in class PdeLexer
-
 
-
mMINUS_ASSIGN(boolean) - Method in class JavaLexer
-
 
-
mMINUS_ASSIGN(boolean) - Method in class PdeLexer
-
 
-
mML_COMMENT(boolean) - Method in class JavaLexer
-
 
-
mML_COMMENT(boolean) - Method in class PdeLexer
-
 
-
mMOD(boolean) - Method in class JavaLexer
-
 
-
mMOD(boolean) - Method in class PdeLexer
-
 
-
mMOD_ASSIGN(boolean) - Method in class JavaLexer
-
 
-
mMOD_ASSIGN(boolean) - Method in class PdeLexer
-
 
-
mNOT_EQUAL(boolean) - Method in class JavaLexer
-
 
-
mNOT_EQUAL(boolean) - Method in class PdeLexer
-
 
-
mNUM_INT(boolean) - Method in class JavaLexer
-
 
-
mNUM_INT(boolean) - Method in class PdeLexer
-
 
-
MOD - Static variable in interface JavaTokenTypes
-
 
-
MOD - Static variable in interface PdePartialTokenTypes
-
 
-
MOD - Static variable in interface PdeTokenTypes
-
 
-
MOD_ASSIGN - Static variable in interface JavaTokenTypes
-
 
-
MOD_ASSIGN - Static variable in interface PdePartialTokenTypes
-
 
-
MOD_ASSIGN - Static variable in interface PdeTokenTypes
-
 
-
Mode - Class in processing.app
-
 
-
Mode(Base, File) - Constructor for class Mode
-
 
-
ModeContribution - Class in processing.app.contrib
-
 
-
MODEL - Static variable in interface PConstants
-
-
textMode(MODEL) is the default, meaning that characters - will be affected by transformations like any other shapes.
-
-
MODELVIEW - Static variable in interface PConstants
-
 
-
modelview - Variable in class PGraphicsOpenGL
-
 
-
modelviewInv - Variable in class PGraphicsOpenGL
-
 
-
modelX(float, float, float) - Method in class PApplet
-
-
( begin auto-generated from modelX.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
-
-
modelX(float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from modelX.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
-
-
modelX(float, float, float) - Method in class PGraphicsOpenGL
-
 
-
modelY(float, float, float) - Method in class PApplet
-
-
( begin auto-generated from modelY.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
-
-
modelY(float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from modelY.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
-
-
modelY(float, float, float) - Method in class PGraphicsOpenGL
-
 
-
modelZ(float, float, float) - Method in class PApplet
-
-
( begin auto-generated from modelZ.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
-
-
modelZ(float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from modelZ.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
-
-
modelZ(float, float, float) - Method in class PGraphicsOpenGL
-
 
-
modifier() - Method in class JavaRecognizer
-
 
-
modifier() - Method in class PdeRecognizer
-
 
-
modifiers() - Method in class JavaRecognizer
-
 
-
MODIFIERS - Static variable in interface JavaTokenTypes
-
 
-
MODIFIERS - Static variable in interface PdePartialTokenTypes
-
 
-
modifiers() - Method in class PdeRecognizer
-
 
-
MODIFIERS - Static variable in interface PdeTokenTypes
-
 
-
month() - Static method in class PApplet
-
-
( begin auto-generated from month.xml ) - - Processing communicates with the clock on your computer.
-
-
MOUSE - Static variable in class Event
-
 
-
mouseButton - Variable in class PApplet
-
-
( begin auto-generated from mouseButton.xml ) - - Processing automatically tracks if the mouse button is pressed and which - button is pressed.
-
-
mouseClicked(MouseEvent) - Method in class EditorButton
-
 
-
mouseClicked() - Method in class PApplet
-
-
( begin auto-generated from mouseClicked.xml ) - - The mouseClicked() function is called once after a mouse button - has been pressed and then released.
-
-
mouseClicked(MouseEvent) - Method in class PApplet
-
 
-
mouseDragged(MouseEvent) - Method in class EditorButton
-
 
-
mouseDragged() - Method in class PApplet
-
-
( begin auto-generated from mouseDragged.xml ) - - The mouseDragged() function is called once every time the mouse - moves and a mouse button is pressed.
-
-
mouseDragged(MouseEvent) - Method in class PApplet
-
 
-
mouseEntered(MouseEvent) - Method in class EditorButton
-
 
-
mouseEntered() - Method in class PApplet
-
 
-
mouseEntered(MouseEvent) - Method in class PApplet
-
 
-
mouseEvent - Variable in class PApplet
-
-
Deprecated. -
Use a mouse event handler that passes an event instead.
-
-
-
MouseEvent - Class in processing.event
-
 
-
MouseEvent(Object, long, int, int, int, int, int, int) - Constructor for class MouseEvent
-
 
-
mouseExited(MouseEvent) - Method in class EditorButton
-
 
-
mouseExited() - Method in class PApplet
-
 
-
mouseExited(MouseEvent) - Method in class PApplet
-
 
-
mouseMoved(MouseEvent) - Method in class EditorButton
-
 
-
mouseMoved() - Method in class PApplet
-
-
( begin auto-generated from mouseMoved.xml ) - - The mouseMoved() function is called every time the mouse moves - and a mouse button is not pressed.
-
-
mouseMoved(MouseEvent) - Method in class PApplet
-
 
-
mousePressed(MouseEvent) - Method in class EditorButton
-
 
-
mousePressed - Variable in class PApplet
-
-
( begin auto-generated from mousePressed_var.xml ) - - Variable storing if a mouse button is pressed.
-
-
mousePressed() - Method in class PApplet
-
-
( begin auto-generated from mousePressed.xml ) - - The mousePressed() function is called once after every time a - mouse button is pressed.
-
-
mousePressed(MouseEvent) - Method in class PApplet
-
 
-
mouseReleased(MouseEvent) - Method in class EditorButton
-
 
-
mouseReleased() - Method in class PApplet
-
-
( begin auto-generated from mouseReleased.xml ) - - The mouseReleased() function is called every time a mouse button - is released.
-
-
mouseReleased(MouseEvent) - Method in class PApplet
-
 
-
mouseWheel() - Method in class PApplet
-
 
-
mouseWheel(MouseEvent) - Method in class PApplet
-
-
The event.getAmount() method returns negative values if the mouse wheel - if rotated up or away from the user and positive in the other direction.
-
-
mouseX - Variable in class PApplet
-
-
( begin auto-generated from mouseX.xml ) - - The system variable mouseX always contains the current horizontal - coordinate of the mouse.
-
-
mouseY - Variable in class PApplet
-
-
( begin auto-generated from mouseY.xml ) - - The system variable mouseY always contains the current vertical - coordinate of the mouse.
-
-
MOVE - Static variable in interface PConstants
-
 
-
MOVE - Static variable in class MouseEvent
-
 
-
moveTo(float, float, int) - Method in class LinePath
-
-
Adds a point to the path by moving to the specified coordinates specified - in float precision.
-
-
moveTo(int, int, int) - Method in class LineStroker
-
 
-
mPLUS(boolean) - Method in class JavaLexer
-
 
-
mPLUS(boolean) - Method in class PdeLexer
-
 
-
mPLUS_ASSIGN(boolean) - Method in class JavaLexer
-
 
-
mPLUS_ASSIGN(boolean) - Method in class PdeLexer
-
 
-
mQUESTION(boolean) - Method in class JavaLexer
-
 
-
mQUESTION(boolean) - Method in class PdeLexer
-
 
-
mRBRACK(boolean) - Method in class JavaLexer
-
 
-
mRBRACK(boolean) - Method in class PdeLexer
-
 
-
mRCURLY(boolean) - Method in class JavaLexer
-
 
-
mRCURLY(boolean) - Method in class PdeLexer
-
 
-
mRPAREN(boolean) - Method in class JavaLexer
-
 
-
mRPAREN(boolean) - Method in class PdeLexer
-
 
-
mSEMI(boolean) - Method in class JavaLexer
-
 
-
mSEMI(boolean) - Method in class PdeLexer
-
 
-
mSL(boolean) - Method in class JavaLexer
-
 
-
mSL(boolean) - Method in class PdeLexer
-
 
-
mSL_ASSIGN(boolean) - Method in class JavaLexer
-
 
-
mSL_ASSIGN(boolean) - Method in class PdeLexer
-
 
-
mSL_COMMENT(boolean) - Method in class JavaLexer
-
 
-
mSL_COMMENT(boolean) - Method in class PdeLexer
-
 
-
mSR(boolean) - Method in class JavaLexer
-
 
-
mSR(boolean) - Method in class PdeLexer
-
 
-
mSR_ASSIGN(boolean) - Method in class JavaLexer
-
 
-
mSR_ASSIGN(boolean) - Method in class PdeLexer
-
 
-
mSTAR(boolean) - Method in class JavaLexer
-
 
-
mSTAR(boolean) - Method in class PdeLexer
-
 
-
mSTAR_ASSIGN(boolean) - Method in class JavaLexer
-
 
-
mSTAR_ASSIGN(boolean) - Method in class PdeLexer
-
 
-
mSTRING_LITERAL(boolean) - Method in class JavaLexer
-
 
-
mSTRING_LITERAL(boolean) - Method in class PdeLexer
-
 
-
mult(PVector, PVector) - Method in interface PMatrix
-
-
Multiply a PVector by this matrix.
-
-
mult(float[], float[]) - Method in interface PMatrix
-
-
Multiply a multi-element vector against this matrix.
-
-
mult(PVector, PVector) - Method in class PMatrix2D
-
-
Multiply the x and y coordinates of a PVector against this matrix.
-
-
mult(float[], float[]) - Method in class PMatrix2D
-
-
Multiply a two element vector against this matrix.
-
-
mult(PVector, PVector) - Method in class PMatrix3D
-
 
-
mult(float[], float[]) - Method in class PMatrix3D
-
-
Multiply a three or four element vector against this matrix.
-
-
mult(float) - Method in class PVector
-
-
( begin auto-generated from PVector_mult.xml ) - - Multiplies a vector by a scalar or multiplies one vector by another.
-
-
mult(PVector, float) - Static method in class PVector
-
 
-
mult(PVector, float, PVector) - Static method in class PVector
-
-
Multiply a vector by a scalar, and write the result into a target PVector.
-
-
mult(String, float) - Method in class FloatDict
-
 
-
mult(int, float) - Method in class FloatList
-
 
-
mult(String, int) - Method in class IntDict
-
 
-
mult(int, int) - Method in class IntList
-
 
-
multiplicativeExpression() - Method in class JavaRecognizer
-
 
-
multiplicativeExpression() - Method in class PdeRecognizer
-
 
-
MULTIPLY - Static variable in interface PConstants
-
 
-
MULTISAMPLE - Static variable in class PGL
-
 
-
multW(float, float, float) - Method in class PMatrix3D
-
 
-
multW(float, float, float, float) - Method in class PMatrix3D
-
 
-
multX(float, float) - Method in class PMatrix2D
-
 
-
multX(float, float) - Method in class PMatrix3D
-
 
-
multX(float, float, float) - Method in class PMatrix3D
-
 
-
multX(float, float, float, float) - Method in class PMatrix3D
-
 
-
multY(float, float) - Method in class PMatrix2D
-
 
-
multY(float, float) - Method in class PMatrix3D
-
 
-
multY(float, float, float) - Method in class PMatrix3D
-
 
-
multY(float, float, float, float) - Method in class PMatrix3D
-
 
-
multZ(float, float, float) - Method in class PMatrix3D
-
 
-
multZ(float, float, float, float) - Method in class PMatrix3D
-
 
-
mWEBCOLOR_LITERAL(boolean) - Method in class PdeLexer
-
 
-
mWS(boolean) - Method in class JavaLexer
-
 
-
mWS(boolean) - Method in class PdeLexer
-
 
-
- - - -

N

-
-
name - Variable in class PShapeSVG.FontGlyph
-
 
-
namedGlyphs - Variable in class PShapeSVG.Font
-
 
-
NEAREST - Static variable in class PGL
-
 
-
NEVER - Static variable in class PGL
-
 
-
newArrayDeclarator() - Method in class JavaRecognizer
-
 
-
newArrayDeclarator() - Method in class PdeRecognizer
-
 
-
newExpression() - Method in class JavaRecognizer
-
-
object instantiation.
-
-
newExpression() - Method in class PdeRecognizer
-
 
-
newJCheckBoxMenuItem(String, int) - Static method in class Toolkit
-
 
-
newJMenuItem(String, int) - Static method in class Toolkit
-
-
A software engineer, somewhere, needs to have his abstraction - taken away.
-
-
newJMenuItemAlt(String, int) - Static method in class Toolkit
-
-
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 Toolkit
-
-
Like newJMenuItem() but adds shift as a modifier for the shortcut.
-
-
NEWT - Static variable in class PJOGL
-
 
-
next - Variable in class Token
-
-
The next token in the linked list.
-
-
next() - Method in class LinePath.PathIterator
-
 
-
NEXT_CHAR - Static variable in class InputHandler
-
 
-
next_char(boolean) - Constructor for class InputHandler.next_char
-
 
-
NEXT_LINE - Static variable in class InputHandler
-
 
-
next_line(boolean) - Constructor for class InputHandler.next_line
-
 
-
NEXT_PAGE - Static variable in class InputHandler
-
 
-
next_page(boolean) - Constructor for class InputHandler.next_page
-
 
-
NEXT_WORD - Static variable in class InputHandler
-
 
-
next_word(boolean) - Constructor for class InputHandler.next_word
-
 
-
nextTabStop(float, int) - Method in class TextAreaPainter
-
-
Returns next tab stop after a specified point.
-
-
nextToken() - Method in class JavaLexer
-
 
-
nextToken() - Method in class PdeLexer
-
 
-
nf(int[], int) - Static method in class PApplet
-
 
-
nf(int, int) - Static method in class PApplet
-
-
( begin auto-generated from nf.xml ) - - Utility function for formatting numbers into strings.
-
-
nf(float[], int, int) - Static method in class PApplet
-
 
-
nf(float, int, int) - Static method in class PApplet
-
 
-
nfc(int[]) - Static method in class PApplet
-
-
( begin auto-generated from nfc.xml ) - - Utility function for formatting numbers into strings and placing - appropriate commas to mark units of 1000.
-
-
nfc(int) - Static method in class PApplet
-
-
nfc() or "number format with commas".
-
-
nfc(float[], int) - Static method in class PApplet
-
 
-
nfc(float, int) - Static method in class PApplet
-
 
-
nfp(int, int) - Static method in class PApplet
-
-
( begin auto-generated from nfp.xml ) - - Utility function for formatting numbers into strings.
-
-
nfp(int[], int) - Static method in class PApplet
-
 
-
nfp(float[], int, int) - Static method in class PApplet
-
 
-
nfp(float, int, int) - Static method in class PApplet
-
 
-
nfs(int, int) - Static method in class PApplet
-
-
( begin auto-generated from nfs.xml ) - - Utility function for formatting numbers into strings.
-
-
nfs(int[], int) - Static method in class PApplet
-
 
-
nfs(float[], int, int) - Static method in class PApplet
-
 
-
nfs(float, int, int) - Static method in class PApplet
-
 
-
NICEST - Static variable in class PGL
-
 
-
NO_SUCH_VERTEX_ERROR - Static variable in class PShape
-
 
-
NO_VERTICES_ERROR - Static variable in class PShape
-
 
-
noClip() - Method in class PApplet
-
 
-
noClip() - Method in class PGraphics
-
 
-
noClip() - Method in class PGraphicsFX2D
-
 
-
noClip() - Method in class PGraphicsJava2D
-
 
-
noClip() - Method in class PGraphicsOpenGL
-
 
-
noCursor() - Method in class PApplet
-
-
( begin auto-generated from noCursor.xml ) - - Hides the cursor from view.
-
-
noFill() - Method in class PApplet
-
-
( begin auto-generated from noFill.xml ) - - Disables filling geometry.
-
-
noFill() - Method in class PGraphics
-
-
( begin auto-generated from noFill.xml ) - - Disables filling geometry.
-
-
noFill() - Method in class PShape
-
 
-
noise(float) - Method in class PApplet
-
 
-
noise(float, float) - Method in class PApplet
-
 
-
noise(float, float, float) - Method in class PApplet
-
-
( begin auto-generated from noise.xml ) - - Returns the Perlin noise value at specified coordinates.
-
-
noiseDetail(int) - Method in class PApplet
-
-
( begin auto-generated from noiseDetail.xml ) - - Adjusts the character and level of detail produced by the Perlin noise - function.
-
-
noiseDetail(int, float) - Method in class PApplet
-
 
-
noiseSeed(long) - Method in class PApplet
-
-
( begin auto-generated from noiseSeed.xml ) - - Sets the seed value for noise().
-
-
noLights() - Method in class PApplet
-
-
( begin auto-generated from noLights.xml ) - - Disable all lighting.
-
-
noLights() - Method in class PGraphics
-
-
( begin auto-generated from noLights.xml ) - - Disable all lighting.
-
-
noLights() - Method in class PGraphics2D
-
 
-
noLights() - Method in class PGraphicsOpenGL
-
-
Disables lighting.
-
-
noLoop() - Method in class PApplet
-
-
( begin auto-generated from noLoop.xml ) - - Stops Processing from continuously executing the code within - draw().
-
-
NONPRIMARY_ERROR - Static variable in class PGL
-
 
-
norm(float, float, float) - Static method in class PApplet
-
-
( begin auto-generated from norm.xml ) - - Normalizes a number from another range into a value between 0 and 1.
-
-
normal(float, float, float) - Method in class PApplet
-
-
( begin auto-generated from normal.xml ) - - Sets the current normal vector.
-
-
NORMAL - Static variable in interface PConstants
-
-
texture coordinates in 0..1 range
-
-
normal(float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from normal.xml ) - - Sets the current normal vector.
-
-
normal(float, float, float) - Method in class PShape
-
 
-
NORMAL - Static variable in class PShapeOpenGL
-
 
-
normal(float, float, float) - Method in class PShapeOpenGL
-
 
-
normalize() - Method in class PVector
-
-
( begin auto-generated from PVector_normalize.xml ) - - Normalize the vector to length 1 (make it a unit vector).
-
-
normalize(PVector) - Method in class PVector
-
 
-
normalX - Variable in class PGraphics
-
-
Current normal vector.
-
-
normalY - Variable in class PGraphics
-
-
Current normal vector.
-
-
normalZ - Variable in class PGraphics
-
-
Current normal vector.
-
-
noSmooth() - Method in class PApplet
-
 
-
noSmooth() - Method in class PGraphics
-
 
-
noStroke() - Method in class PApplet
-
-
( begin auto-generated from noStroke.xml ) - - Disables drawing the stroke (outline).
-
-
noStroke() - Method in class PGraphics
-
-
( begin auto-generated from noStroke.xml ) - - Disables drawing the stroke (outline).
-
-
noStroke() - Method in class PShape
-
 
-
NOT_EQUAL - Static variable in interface JavaTokenTypes
-
 
-
NOT_EQUAL - Static variable in interface PdePartialTokenTypes
-
 
-
NOT_EQUAL - Static variable in interface PdeTokenTypes
-
 
-
NOTEQUAL - Static variable in class PGL
-
 
-
noTexture() - Method in class PApplet
-
-
Removes texture image for current shape.
-
-
noTexture() - Method in class PGraphics
-
-
Removes texture image for current shape.
-
-
noTexture() - Method in class PShape
-
 
-
NOTICE - Static variable in class EditorStatus
-
 
-
notice(String) - Method in class EditorStatus
-
 
-
noTint() - Method in class PApplet
-
-
( begin auto-generated from noTint.xml ) - - Removes the current fill value for displaying images and reverts to - displaying images with their original hues.
-
-
noTint() - Method in class PGraphics
-
-
( begin auto-generated from noTint.xml ) - - Removes the current fill value for displaying images and reverts to - displaying images with their original hues.
-
-
noTint() - Method in class PShape
-
 
-
npotTexSupported - Static variable in class PGraphicsOpenGL
-
-
Extensions used by Processing
-
-
NULL - Static variable in class Token
-
-
Normal text token id.
-
-
NULL - Static variable in class JSONObject
-
-
It is sometimes more convenient and less ambiguous to have a - NULL object than to use Java's null value.
-
-
NULL_TREE_LOOKAHEAD - Static variable in interface JavaTokenTypes
-
 
-
NULL_TREE_LOOKAHEAD - Static variable in interface PdePartialTokenTypes
-
 
-
NULL_TREE_LOOKAHEAD - Static variable in interface PdeTokenTypes
-
 
-
NUM_COMPRESSED_TEXTURE_FORMATS - Static variable in class PGL
-
 
-
NUM_DOUBLE - Static variable in interface JavaTokenTypes
-
 
-
NUM_DOUBLE - Static variable in interface PdePartialTokenTypes
-
 
-
NUM_DOUBLE - Static variable in interface PdeTokenTypes
-
 
-
NUM_FLOAT - Static variable in interface JavaTokenTypes
-
 
-
NUM_FLOAT - Static variable in interface PdePartialTokenTypes
-
 
-
NUM_FLOAT - Static variable in interface PdeTokenTypes
-
 
-
NUM_INT - Static variable in interface JavaTokenTypes
-
 
-
NUM_INT - Static variable in interface PdePartialTokenTypes
-
 
-
NUM_INT - Static variable in interface PdeTokenTypes
-
 
-
NUM_LONG - Static variable in interface JavaTokenTypes
-
 
-
NUM_LONG - Static variable in interface PdePartialTokenTypes
-
 
-
NUM_LONG - Static variable in interface PdeTokenTypes
-
 
-
NX - Static variable in class PGraphics
-
 
-
NY - Static variable in class PGraphics
-
 
-
NZ - Static variable in class PGraphics
-
 
-
- - - -

O

-
-
OBJBLOCK - Static variable in interface JavaTokenTypes
-
 
-
OBJBLOCK - Static variable in interface PdePartialTokenTypes
-
 
-
OBJBLOCK - Static variable in interface PdeTokenTypes
-
 
-
OFFSET - Static variable in class PShapeOpenGL
-
 
-
offsetToX(int, int) - Method in class JEditTextArea
-
-
Converts an offset in a line into an x co-ordinate.
-
-
offsetX - Variable in class PGL
-
 
-
offsetY - Variable in class PGL
-
 
-
ONE - Static variable in class PGL
-
 
-
ONE_MINUS_CONSTANT_ALPHA - Static variable in class PGL
-
 
-
ONE_MINUS_CONSTANT_COLOR - Static variable in class PGL
-
 
-
ONE_MINUS_DST_COLOR - Static variable in class PGL
-
 
-
ONE_MINUS_SRC_ALPHA - Static variable in class PGL
-
 
-
ONE_MINUS_SRC_COLOR - Static variable in class PGL
-
 
-
OPAQUE - Static variable in interface PConstants
-
 
-
OPEN - Static variable in interface PConstants
-
 
-
openFolder(File) - Static method in class Base
-
-
Implements the other cross-platform headache of opening - a folder in the machine's native file browser.
-
-
openFolder(File) - Method in class LinuxPlatform
-
 
-
openFolder(File) - Method in class Platform
-
 
-
openFolderAvailable() - Method in class LinuxPlatform
-
 
-
openFolderAvailable() - Method in class Platform
-
 
-
OPENGL - Static variable in interface PConstants
-
-
Deprecated.
-
-
OPENGL_EXTENSIONS - Static variable in class PGraphicsOpenGL
-
 
-
OPENGL_RENDERER - Static variable in class PGraphicsOpenGL
-
 
-
OPENGL_VENDOR - Static variable in class PGraphicsOpenGL
-
-
OpenGL information strings
-
-
OPENGL_VERSION - Static variable in class PGraphicsOpenGL
-
 
-
openURL(String) - Static method in class Base
-
-
Implements the cross-platform headache of opening URLs.
-
-
openURL(String) - Method in class LinuxPlatform
-
 
-
openURL(String) - Method in class Platform
-
 
-
OPERATOR - Static variable in class Token
-
-
Operator token id.
-
-
orientation(int) - Method in class PApplet
-
 
-
ortho() - Method in class PApplet
-
-
( begin auto-generated from ortho.xml ) - - Sets an orthographic projection and defines a parallel clipping volume.
-
-
ortho(float, float, float, float) - Method in class PApplet
-
 
-
ortho(float, float, float, float, float, float) - Method in class PApplet
-
 
-
ortho() - Method in class PGraphics
-
-
( begin auto-generated from ortho.xml ) - - Sets an orthographic projection and defines a parallel clipping volume.
-
-
ortho(float, float, float, float) - Method in class PGraphics
-
 
-
ortho(float, float, float, float, float, float) - Method in class PGraphics
-
 
-
ortho() - Method in class PGraphics2D
-
 
-
ortho(float, float, float, float) - Method in class PGraphics2D
-
 
-
ortho(float, float, float, float, float, float) - Method in class PGraphics2D
-
 
-
ortho() - Method in class PGraphicsOpenGL
-
-
Calls ortho() with the proper parameters for Processing's standard - orthographic projection.
-
-
ortho(float, float, float, float) - Method in class PGraphicsOpenGL
-
-
Calls ortho() with the specified size of the viewing volume along - the X and Z directions.
-
-
ortho(float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
-
Sets an orthographic projection.
-
-
ORTHOGRAPHIC - Static variable in interface PConstants
-
 
-
OTHER - Static variable in interface PConstants
-
 
-
OUTSIDE_BEGIN_END_ERROR - Static variable in class PShape
-
 
-
OVERLAY - Static variable in interface PConstants
-
 
-
OVERWRITE - Static variable in class InputHandler
-
 
-
overwrite() - Constructor for class InputHandler.overwrite
-
 
-
overwriteSetSelectedText(String) - Method in class JEditTextArea
-
-
Similar to setSelectedText(), but overstrikes the - appropriate number of characters if overwrite mode is enabled.
-
-
- - - -

P

-
-
P2D - Static variable in interface PConstants
-
 
-
P3D - Static variable in interface PConstants
-
 
-
PACK_ALIGNMENT - Static variable in class PGL
-
 
-
PACKAGE_DEF - Static variable in interface JavaTokenTypes
-
 
-
PACKAGE_DEF - Static variable in interface PdePartialTokenTypes
-
 
-
PACKAGE_DEF - Static variable in interface PdeTokenTypes
-
 
-
packageDefinition() - Method in class JavaRecognizer
-
 
-
packageDefinition() - Method in class PdeRecognizer
-
 
-
packageListFromClassPath(String) - Static method in class Base
-
-
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.
-
-
packedDepthStencilSupported - Static variable in class PGraphicsOpenGL
-
 
-
paint(Graphics) - Method in class About
-
 
-
paint(Graphics) - Method in class EditorStatus
-
 
-
paint(Graphics) - Method in class TextAreaPainter
-
-
Repaints the text.
-
-
paintComponent(Graphics) - Method in class ColorChooser.ColorRange
-
 
-
paintComponent(Graphics) - Method in class ColorChooser.ColorSlider
-
 
-
paintComponent(Graphics) - Method in class EditorButton
-
 
-
paintComponent(Graphics) - Method in class EditorHeader
-
 
-
paintComponent(Graphics) - Method in class EditorToolbar
-
 
-
paintHighlight(Graphics, int, int) - Method in interface TextAreaPainter.Highlight
-
-
This should paint the highlight and delgate to the - next highlight painter.
-
-
paintInvalid - Variable in class TextAreaDefaults
-
 
-
PApplet - Class in processing.core
-
-
Base class for all sketches that use processing.core.
-
-
PApplet() - Constructor for class PApplet
-
 
-
PApplicationFX() - Constructor for class PSurfaceFX.PApplicationFX
-
 
-
PARAMETER_DEF - Static variable in interface JavaTokenTypes
-
 
-
PARAMETER_DEF - Static variable in interface PdePartialTokenTypes
-
 
-
PARAMETER_DEF - Static variable in interface PdeTokenTypes
-
 
-
parameterDeclaration() - Method in class JavaRecognizer
-
 
-
parameterDeclaration() - Method in class PdeRecognizer
-
 
-
parameterDeclarationList() - Method in class JavaRecognizer
-
 
-
parameterDeclarationList() - Method in class PdeRecognizer
-
 
-
parameterModifier() - Method in class JavaRecognizer
-
 
-
parameterModifier() - Method in class PdeRecognizer
-
 
-
PARAMETERS - Static variable in interface JavaTokenTypes
-
 
-
PARAMETERS - Static variable in interface PdePartialTokenTypes
-
 
-
PARAMETERS - Static variable in interface PdeTokenTypes
-
 
-
Parameters() - Constructor for class Texture.Parameters
-
-
Sets all the parameters to default values.
-
-
Parameters(int) - Constructor for class Texture.Parameters
-
 
-
Parameters(int, int) - Constructor for class Texture.Parameters
-
 
-
Parameters(int, int, boolean) - Constructor for class Texture.Parameters
-
 
-
Parameters(int, int, boolean, int) - Constructor for class Texture.Parameters
-
 
-
Parameters(Texture.Parameters) - Constructor for class Texture.Parameters
-
 
-
parent - Variable in class PImage
-
-
Path to parent object that will be used with save().
-
-
parse(String) - Static method in class JSONArray
-
-
Construct a JSONArray from a source JSON text.
-
-
parse(String) - Static method in class JSONObject
-
-
Construct a JSONObject from a source JSON text string.
-
-
parse(String) - Static method in class XML
-
 
-
parse(String, String) - Static method in class XML
-
 
-
parseBoolean(int) - Static method in class PApplet
-
-
Convert an integer to a boolean.
-
-
parseBoolean(String) - Static method in class PApplet
-
-
Convert the string "true" or "false" to a boolean.
-
-
parseBoolean(int[]) - Static method in class PApplet
-
-
Convert an int array to a boolean array.
-
-
parseBoolean(String[]) - Static method in class PApplet
-
 
-
parseByte(boolean) - Static method in class PApplet
-
 
-
parseByte(char) - Static method in class PApplet
-
 
-
parseByte(int) - Static method in class PApplet
-
 
-
parseByte(float) - Static method in class PApplet
-
 
-
parseByte(boolean[]) - Static method in class PApplet
-
 
-
parseByte(char[]) - Static method in class PApplet
-
 
-
parseByte(int[]) - Static method in class PApplet
-
 
-
parseByte(float[]) - Static method in class PApplet
-
 
-
parseChar(byte) - Static method in class PApplet
-
 
-
parseChar(int) - Static method in class PApplet
-
 
-
parseChar(byte[]) - Static method in class PApplet
-
 
-
parseChar(int[]) - Static method in class PApplet
-
 
-
parseFloat(int) - Static method in class PApplet
-
-
Convert an int to a float value.
-
-
parseFloat(String) - Static method in class PApplet
-
 
-
parseFloat(String, float) - Static method in class PApplet
-
 
-
parseFloat(byte[]) - Static method in class PApplet
-
 
-
parseFloat(int[]) - Static method in class PApplet
-
 
-
parseFloat(String[]) - Static method in class PApplet
-
 
-
parseFloat(String[], float) - Static method in class PApplet
-
 
-
parseInt(boolean) - Static method in class PApplet
-
 
-
parseInt(byte) - Static method in class PApplet
-
-
Note that parseInt() will un-sign a signed byte value.
-
-
parseInt(char) - Static method in class 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 PApplet
-
-
Same as floor(), or an (int) cast.
-
-
parseInt(String) - Static method in class PApplet
-
-
Parse a String into an int value.
-
-
parseInt(String, int) - Static method in class 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 PApplet
-
 
-
parseInt(byte[]) - Static method in class PApplet
-
 
-
parseInt(char[]) - Static method in class PApplet
-
 
-
parseInt(float[]) - Static method in class PApplet
-
 
-
parseInt(String[]) - Static method in class PApplet
-
-
Make an array of int elements from an array of String objects.
-
-
parseInt(String[], int) - Static method in class PApplet
-
-
Make an array of int elements from an array of String objects.
-
-
parseInto(Object, String) - Method in class Table
-
-
incomplete, do not use
-
-
parseJSONArray(String) - Method in class PApplet
-
 
-
parseJSONObject(String) - Method in class PApplet
-
 
-
parseKeyStroke(String) - Static method in class DefaultInputHandler
-
-
Converts a string to a keystroke.
-
-
parseXML(String) - Method in class PApplet
-
 
-
parseXML(String, String) - Method in class PApplet
-
 
-
paste() - Method in class JEditTextArea
-
-
Inserts the clipboard contents into the text.
-
-
PATH - Static variable in interface PConstants
-
 
-
PATH - Static variable in class PShape
-
-
A series of vertex, curveVertex, and bezierVertex calls.
-
-
pause() - Method in class PApplet
-
-
Sketch has been paused.
-
-
pauseThread() - Method in interface PSurface
-
-
On the next trip through the animation thread, things should go sleepy-bye.
-
-
pauseThread() - Method in class PSurfaceFX
-
 
-
pauseThread() - Method in class PSurfaceNone
-
 
-
pauseThread() - Method in class PSurfaceJOGL
-
 
-
PConstants - Interface in processing.core
-
-
Numbers shared throughout processing.core.
-
-
PdeInputHandler - Class in processing.app.syntax
-
-
Sets key bindings used by the PDE, except for those that are Mode-specific.
-
-
PdeInputHandler() - Constructor for class PdeInputHandler
-
 
-
PdeKeywords - Class in processing.app.syntax
-
 
-
PdeKeywords() - Constructor for class PdeKeywords
-
 
-
PdeLexer - Class in processing.mode.java.preproc
-
 
-
PdeLexer(InputStream) - Constructor for class PdeLexer
-
 
-
PdeLexer(Reader) - Constructor for class PdeLexer
-
 
-
PdeLexer(InputBuffer) - Constructor for class PdeLexer
-
 
-
PdeLexer(LexerSharedInputState) - Constructor for class PdeLexer
-
 
-
PdePartialTokenTypes - Interface in processing.mode.java.preproc
-
 
-
pdeProgram() - Method in class PdeRecognizer
-
 
-
PdeRecognizer - Class in processing.mode.java.preproc
-
 
-
PdeRecognizer(PdePreprocessor, TokenStream) - Constructor for class PdeRecognizer
-
 
-
PdeRecognizer(TokenBuffer) - Constructor for class PdeRecognizer
-
 
-
PdeRecognizer(TokenStream) - Constructor for class PdeRecognizer
-
 
-
PdeRecognizer(ParserSharedInputState) - Constructor for class PdeRecognizer
-
 
-
PdeTextAreaDefaults - Class in processing.app.syntax
-
-
Defaults that are PDE (but not Mode) specific.
-
-
PdeTextAreaDefaults(Mode) - Constructor for class PdeTextAreaDefaults
-
 
-
PdeTokenTypes - Interface in processing.mode.java.preproc
-
 
-
PDF - Static variable in interface PConstants
-
 
-
perspective() - Method in class PApplet
-
-
( begin auto-generated from perspective.xml ) - - Sets a perspective projection applying foreshortening, making distant - objects appear smaller than closer ones.
-
-
perspective(float, float, float, float) - Method in class PApplet
-
 
-
PERSPECTIVE - Static variable in interface PConstants
-
 
-
perspective() - Method in class PGraphics
-
-
( begin auto-generated from perspective.xml ) - - Sets a perspective projection applying foreshortening, making distant - objects appear smaller than closer ones.
-
-
perspective(float, float, float, float) - Method in class PGraphics
-
 
-
perspective() - Method in class PGraphics2D
-
 
-
perspective(float, float, float, float) - Method in class PGraphics2D
-
 
-
perspective() - Method in class PGraphicsOpenGL
-
-
Calls perspective() with Processing's standard coordinate projection.
-
-
perspective(float, float, float, float) - Method in class PGraphicsOpenGL
-
-
Similar to gluPerspective().
-
-
PFont - Class in processing.core
-
-
Grayscale bitmap font class used by Processing.
-
-
PFont() - Constructor for class PFont
-
 
-
PFont(Font, boolean) - Constructor for class PFont
-
-
( begin auto-generated from PFont.xml ) - - PFont is the font class for Processing.
-
-
PFont(Font, boolean, char[]) - Constructor for class PFont
-
-
Create a new image-based font on the fly.
-
-
PFont(Font, boolean, char[], boolean) - Constructor for class PFont
-
-
Adds an additional parameter that indicates the font came from a file, - not a built-in OS font.
-
-
PFont(InputStream) - Constructor for class PFont
-
 
-
PFont.Glyph - Class in processing.core
-
-
A single character, and its visage.
-
-
PGL - Class in processing.opengl
-
-
Processing-OpenGL abstraction layer.
-
-
PGL() - Constructor for class PGL
-
 
-
PGL(PGraphicsOpenGL) - Constructor for class PGL
-
 
-
pgl - Variable in class PGraphicsOpenGL
-
-
Interface between Processing and OpenGL
-
-
PGraphics - Class in processing.core
-
-
( begin auto-generated from PGraphics.xml ) - - Main graphics and rendering context, as well as the base API - implementation for processing "core".
-
-
PGraphics() - Constructor for class PGraphics
-
 
-
PGraphics2D - Class in processing.opengl
-
 
-
PGraphics2D() - Constructor for class PGraphics2D
-
 
-
PGraphics3D - Class in processing.opengl
-
 
-
PGraphics3D() - Constructor for class PGraphics3D
-
 
-
PGraphicsDanger2D - Class in processing.core
-
-
Experimental/enhanced renderer that draws directly to the Graphics context - without an intermediate image.
-
-
PGraphicsDanger2D() - Constructor for class PGraphicsDanger2D
-
 
-
PGraphicsFX2D - Class in processing.core
-
 
-
PGraphicsFX2D() - Constructor for class PGraphicsFX2D
-
 
-
PGraphicsJava2D - Class in processing.core
-
-
Subclass for PGraphics that implements the graphics API using Java2D.
-
-
PGraphicsJava2D() - Constructor for class PGraphicsJava2D
-
 
-
PGraphicsOpenGL - Class in processing.opengl
-
-
OpenGL renderer.
-
-
PGraphicsOpenGL() - Constructor for class PGraphicsOpenGL
-
 
-
PI - Static variable in interface PConstants
-
-
( begin auto-generated from PI.xml ) - - PI is a mathematical constant with the value 3.14159265358979323846.
-
-
PIE - Static variable in interface PConstants
-
 
-
PImage - Class in processing.core
-
-
( begin auto-generated from PImage.xml ) - - Datatype for storing images.
-
-
PImage() - Constructor for class PImage
-
-
( begin auto-generated from PImage.xml ) - - Datatype for storing images.
-
-
PImage(int, int) - Constructor for class PImage
-
 
-
PImage(int, int, int) - Constructor for class PImage
-
 
-
PImage(int, int, int, int) - Constructor for class PImage
-
 
-
PImage(Image) - Constructor for class PImage
-
-
Construct a new PImage from a java.awt.Image.
-
-
pixelCount - Variable in class PGraphics
-
 
-
pixelDensity(int) - Method in class PApplet
-
 
-
pixelDensity - Variable in class PImage
-
-
1 for most images, 2 for hi-dpi/retina
-
-
pixelHeight - Variable in class PImage
-
 
-
pixels - Variable in class PApplet
-
-
( begin auto-generated from pixels.xml ) - - Array containing the values for all the pixels in the display window.
-
-
pixels - Variable in class PImage
-
-
( begin auto-generated from pixels.xml ) - - Array containing the values for all the pixels in the display window.
-
-
pixelStorei(int, int) - Method in class PGL
-
 
-
pixelStorei(int, int) - Method in class PJOGL
-
 
-
pixelWidth - Variable in class PImage
-
-
Actual dimensions of pixels array, taking into account the 2x setting.
-
-
PJOGL - Class in processing.opengl
-
 
-
PJOGL(PGraphicsOpenGL) - Constructor for class PJOGL
-
 
-
placePresent(int) - Method in interface PSurface
-
 
-
placePresent(int) - Method in class PSurfaceAWT
-
 
-
placePresent(int) - Method in class PSurfaceFX
-
 
-
placePresent(int) - Method in class PSurfaceNone
-
 
-
placePresent(int) - Method in class PSurfaceJOGL
-
 
-
placeWindow(int[], int[]) - Method in interface PSurface
-
 
-
placeWindow(int[], int[]) - Method in class PSurfaceAWT
-
 
-
placeWindow(int[], int[]) - Method in class PSurfaceFX
-
 
-
placeWindow(int[], int[]) - Method in class PSurfaceNone
-
 
-
placeWindow(int[], int[]) - Method in class PSurfaceJOGL
-
 
-
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 Platform
-
 
-
platform - Static variable in class PApplet
-
-
Current platform in use, one of the - PConstants WINDOWS, MACOSX, MACOS9, LINUX or OTHER.
-
-
Platform.CLibrary - Interface in processing.app
-
 
-
platformDelete(File) - Static method in class Base
-
-
Delete a file or directory in a platform-specific manner.
-
-
platformNames - Static variable in interface PConstants
-
 
-
pluralize(String, int) - Static method in class Language
-
 
-
PLUS - Static variable in interface JavaTokenTypes
-
 
-
PLUS - Static variable in interface PdePartialTokenTypes
-
 
-
PLUS - Static variable in interface PdeTokenTypes
-
 
-
PLUS_ASSIGN - Static variable in interface JavaTokenTypes
-
 
-
PLUS_ASSIGN - Static variable in interface PdePartialTokenTypes
-
 
-
PLUS_ASSIGN - Static variable in interface PdeTokenTypes
-
 
-
PMatrix - Interface in processing.core
-
 
-
PMatrix2D - Class in processing.core
-
-
3x2 affine matrix implementation.
-
-
PMatrix2D() - Constructor for class PMatrix2D
-
 
-
PMatrix2D(float, float, float, float, float, float) - Constructor for class PMatrix2D
-
 
-
PMatrix2D(PMatrix) - Constructor for class PMatrix2D
-
 
-
PMatrix3D - Class in processing.core
-
-
4x4 matrix implementation.
-
-
PMatrix3D() - Constructor for class PMatrix3D
-
 
-
PMatrix3D(float, float, float, float, float, float) - Constructor for class PMatrix3D
-
 
-
PMatrix3D(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Constructor for class PMatrix3D
-
 
-
PMatrix3D(PMatrix) - Constructor for class PMatrix3D
-
 
-
pmouseX - Variable in class PApplet
-
-
( begin auto-generated from pmouseX.xml ) - - The system variable pmouseX always contains the horizontal - position of the mouse in the frame previous to the current frame.
-
- You may find that pmouseX and pmouseY have different - values inside draw() and inside events like mousePressed() - and mouseMoved().
-
-
pmouseY - Variable in class PApplet
-
-
( begin auto-generated from pmouseY.xml ) - - The system variable pmouseY always contains the vertical position - of the mouse in the frame previous to the current frame.
-
-
point(float, float) - Method in class PApplet
-
-
( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel.
-
-
point(float, float, float) - Method in class PApplet
-
 
-
POINT - Static variable in interface PConstants
-
 
-
point(float, float) - Method in class PGraphics
-
-
( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel.
-
-
point(float, float, float) - Method in class PGraphics
-
 
-
point(float, float) - Method in class PGraphicsFX2D
-
 
-
point(float, float) - Method in class PGraphicsJava2D
-
 
-
point(float, float) - Method in class PGraphicsOpenGL
-
 
-
point(float, float, float) - Method in class PGraphicsOpenGL
-
 
-
POINT_SMOOTH - Static variable in class PGL
-
 
-
pointLight(float, float, float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from pointLight.xml ) - - Adds a point light.
-
-
pointLight(float, float, float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from pointLight.xml ) - - Adds a point light.
-
-
pointLight(float, float, float, float, float, float) - Method in class PGraphics2D
-
 
-
pointLight(float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
POINTS - Static variable in interface PConstants
-
 
-
POINTS - Static variable in class PGL
-
 
-
POLYGON - Static variable in interface PConstants
-
 
-
POLYGON_OFFSET_FILL - Static variable in class PGL
-
 
-
POLYGON_SMOOTH - Static variable in class PGL
-
 
-
polygonOffset(float, float) - Method in class PGL
-
 
-
polygonOffset(float, float) - Method in class PJOGL
-
 
-
pop() - Method in class FloatList
-
 
-
pop() - Method in class IntList
-
 
-
pop() - Method in class StringList
-
 
-
popMatrix() - Method in class PApplet
-
-
( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack.
-
-
popMatrix() - Method in class PGraphics
-
-
( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack.
-
-
popMatrix() - Method in class PGraphicsFX2D
-
 
-
popMatrix() - Method in class PGraphicsJava2D
-
 
-
popMatrix() - Method in class PGraphicsOpenGL
-
 
-
popProjection() - Method in class PGraphicsOpenGL
-
 
-
popStyle() - Method in class PApplet
-
-
( begin auto-generated from popStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings; these functions are - always used together.
-
-
popStyle() - Method in class PGraphics
-
-
( begin auto-generated from popStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings; these functions are - always used together.
-
-
popStyle() - Method in class PGraphicsOpenGL
-
 
-
populateSketchbookMenu(JMenu) - Method in class Base
-
 
-
PORTRAIT - Static variable in interface PConstants
-
-
Screen orientation constant for portrait (the hamburger way).
-
-
POSITION - Static variable in class PShapeOpenGL
-
 
-
possiblyEmptyField() - Method in class PdeRecognizer
-
 
-
POST_DEC - Static variable in interface JavaTokenTypes
-
 
-
POST_DEC - Static variable in interface PdePartialTokenTypes
-
 
-
POST_DEC - Static variable in interface PdeTokenTypes
-
 
-
POST_INC - Static variable in interface JavaTokenTypes
-
 
-
POST_INC - Static variable in interface PdePartialTokenTypes
-
 
-
POST_INC - Static variable in interface PdeTokenTypes
-
 
-
POSTERIZE - Static variable in interface PConstants
-
 
-
postEvent(Event) - Method in class PApplet
-
-
Add an event to the internal event queue, or process it immediately if - the sketch is not currently looping.
-
-
postfixExpression() - Method in class JavaRecognizer
-
 
-
postfixExpression() - Method in class PdeRecognizer
-
 
-
pow(float, float) - Static method in class PApplet
-
-
( begin auto-generated from pow.xml ) - - Facilitates exponential expressions.
-
-
preApply(PMatrix) - Method in interface PMatrix
-
-
Apply another matrix to the left of this one.
-
-
preApply(PMatrix2D) - Method in interface PMatrix
-
 
-
preApply(PMatrix3D) - Method in interface PMatrix
-
 
-
preApply(float, float, float, float, float, float) - Method in interface PMatrix
-
 
-
preApply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in interface PMatrix
-
 
-
preApply(PMatrix) - Method in class PMatrix2D
-
-
Apply another matrix to the left of this one.
-
-
preApply(PMatrix2D) - Method in class PMatrix2D
-
 
-
preApply(PMatrix3D) - Method in class PMatrix2D
-
 
-
preApply(float, float, float, float, float, float) - Method in class PMatrix2D
-
 
-
preApply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PMatrix2D
-
 
-
preApply(PMatrix2D) - Method in class PMatrix3D
-
 
-
preApply(PMatrix) - Method in class PMatrix3D
-
-
Apply another matrix to the left of this one.
-
-
preApply(PMatrix3D) - Method in class PMatrix3D
-
 
-
preApply(float, float, float, float, float, float) - Method in class PMatrix3D
-
 
-
preApply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PMatrix3D
-
 
-
Preferences - Class in processing.app
-
-
Storage class for user preferences and environment settings.
-
-
Preferences() - Constructor for class Preferences
-
 
-
PreferencesFrame - Class in processing.app
-
-
Creates the window for modifying preferences.
-
-
PreferencesFrame(Base) - Constructor for class PreferencesFrame
-
 
-
prepareCodeFolder() - Method in class Sketch
-
-
Create the code folder if it does not exist already.
-
-
prepareDataFolder() - Method in class Sketch
-
-
Create the data folder if it does not exist already.
-
-
prepareExportFolder(File) - Method in class Mode
-
-
Create a fresh applet/application folder if the 'delete target folder' - pref has been set in the preferences.
-
-
prepareGraphics(Graphics) - Static method in class Toolkit
-
-
Handles scaling for high-res displays, also sets text anti-aliasing - options to be far less ugly than the defaults.
-
-
prepareRun() - Method in class Editor
-
-
Grab current contents of the sketch window, advance the console, - stop any other running sketches...
-
-
presentMode - Variable in class PGL
-
 
-
PRESS - Static variable in class KeyEvent
-
 
-
PRESS - Static variable in class MouseEvent
-
 
-
PREV_CHAR - Static variable in class InputHandler
-
 
-
prev_char(boolean) - Constructor for class InputHandler.prev_char
-
 
-
PREV_LINE - Static variable in class InputHandler
-
 
-
prev_line(boolean) - Constructor for class InputHandler.prev_line
-
 
-
PREV_PAGE - Static variable in class InputHandler
-
 
-
prev_page(boolean) - Constructor for class InputHandler.prev_page
-
 
-
PREV_WORD - Static variable in class InputHandler
-
 
-
prev_word(boolean) - Constructor for class InputHandler.prev_word
-
 
-
primaryExpression() - Method in class JavaRecognizer
-
 
-
primaryExpression() - Method in class PdeRecognizer
-
 
-
primaryPGL - Variable in class PGL
-
-
true if this is the GL interface for a primary surface PGraphics
-
-
PRIMITIVE - Static variable in class PShape
-
-
A line, ellipse, arc, image, etc.
-
-
print(byte) - Static method in class PApplet
-
-
( begin auto-generated from print.xml ) - - Writes to the console area of the Processing environment.
-
-
print(boolean) - Static method in class PApplet
-
 
-
print(char) - Static method in class PApplet
-
 
-
print(int) - Static method in class PApplet
-
 
-
print(long) - Static method in class PApplet
-
 
-
print(float) - Static method in class PApplet
-
 
-
print(double) - Static method in class PApplet
-
 
-
print(String) - Static method in class PApplet
-
 
-
print(Object...) - Static method in class PApplet
-
 
-
print() - Method in class PMatrix2D
-
 
-
print() - Method in class PMatrix3D
-
 
-
print() - Method in class PShapeSVG
-
-
Prints out the SVG document.
-
-
print() - Method in class FloatDict
-
 
-
print() - Method in class FloatList
-
 
-
print() - Method in class IntDict
-
 
-
print() - Method in class IntList
-
 
-
print() - Method in class StringDict
-
 
-
print() - Method in class StringList
-
 
-
printArray(Object) - Static method in class PApplet
-
-
( begin auto-generated from printArray.xml ) - - To come...
-
-
printCamera() - Method in class PApplet
-
-
( begin auto-generated from printCamera.xml ) - - Prints the current camera matrix to the Console (the text window at the - bottom of Processing).
-
-
printCamera() - Method in class PGraphics
-
-
( begin auto-generated from printCamera.xml ) - - Prints the current camera matrix to the Console (the text window at the - bottom of Processing).
-
-
printCamera() - Method in class PGraphicsOpenGL
-
-
Print the current camera matrix.
-
-
println() - Static method in class PApplet
-
-
( begin auto-generated from println.xml ) - - Writes to the text area of the Processing environment's console.
-
-
println(byte) - Static method in class PApplet
-
 
-
println(boolean) - Static method in class PApplet
-
 
-
println(char) - Static method in class PApplet
-
 
-
println(int) - Static method in class PApplet
-
 
-
println(long) - Static method in class PApplet
-
 
-
println(float) - Static method in class PApplet
-
 
-
println(double) - Static method in class PApplet
-
 
-
println(String) - Static method in class PApplet
-
 
-
println(Object...) - Static method in class PApplet
-
 
-
println(Object) - Static method in class PApplet
-
-
For arrays, use printArray() instead.
-
-
printMatrix() - Method in class PApplet
-
-
( begin auto-generated from printMatrix.xml ) - - Prints the current matrix to the Console (the text window at the bottom - of Processing).
-
-
printMatrix() - Method in class PGraphics
-
-
( begin auto-generated from printMatrix.xml ) - - Prints the current matrix to the Console (the text window at the bottom - of Processing).
-
-
printMatrix() - Method in class PGraphicsFX2D
-
 
-
printMatrix() - Method in class PGraphicsJava2D
-
 
-
printMatrix() - Method in class PGraphicsOpenGL
-
-
Print the current model (or "transformation") matrix.
-
-
printProjection() - Method in class PApplet
-
-
( begin auto-generated from printProjection.xml ) - - Prints the current projection matrix to the Console (the text window at - the bottom of Processing).
-
-
printProjection() - Method in class PGraphics
-
-
( begin auto-generated from printProjection.xml ) - - Prints the current projection matrix to the Console (the text window at - the bottom of Processing).
-
-
printProjection() - Method in class PGraphicsOpenGL
-
-
Print the current projection matrix.
-
-
printStackTrace() - Method in exception SketchException
-
-
Nix the java.lang crap out of an exception message - because it scares the children.
-
-
PROBLEM - Static variable in interface PConstants
-
 
-
processCompositionText(AttributedCharacterIterator, int) - Method in class CompositionTextManager
-
-
Called when a user processing input characters and - select candidates from input method.
-
-
ProcessHelper - Class in processing.app.exec
-
-
Class to handle calling Runtime.exec() and stuffing output and error streams - into Strings that can be dealt with more easily.
-
-
ProcessHelper(String...) - Constructor for class ProcessHelper
-
 
-
ProcessHelper(File, String...) - Constructor for class ProcessHelper
-
 
-
processing.app - package processing.app
-
 
-
processing.app.contrib - package processing.app.contrib
-
 
-
processing.app.exec - package processing.app.exec
-
 
-
processing.app.platform - package processing.app.platform
-
 
-
processing.app.syntax - package processing.app.syntax
-
 
-
processing.app.syntax.im - package processing.app.syntax.im
-
 
-
processing.app.tools - package processing.app.tools
-
 
-
processing.core - package processing.core
-
 
-
processing.data - package processing.data
-
 
-
processing.event - package processing.event
-
 
-
processing.mode.java.preproc - package processing.mode.java.preproc
-
 
-
processing.opengl - package processing.opengl
-
 
-
processKeyEvent(KeyEvent) - Method in class JEditTextArea
-
 
-
processLine(String) - Method in interface LineProcessor
-
 
-
ProcessRegistry - Class in processing.app.exec
-
 
-
ProcessRegistry() - Constructor for class ProcessRegistry
-
 
-
ProcessResult - Class in processing.app.exec
-
 
-
ProcessResult(String, int, String, String, long) - Constructor for class ProcessResult
-
 
-
PROFILE - Static variable in class PJOGL
-
 
-
profile - Static variable in class PJOGL
-
-
Selected GL profile
-
-
profile - Static variable in class PSurfaceJOGL
-
-
Selected GL profile
-
-
ProgressFrame - Class in processing.app
-
-
Class used to handle progress bar, and run Save As or Add File in - background so that progress bar can update without freezing.
-
-
ProgressFrame(File[], File, String, String, Editor) - Constructor for class ProgressFrame
-
-
Use for Save As
-
-
ProgressFrame(File, File, Editor) - Constructor for class ProgressFrame
-
-
Used for Add File
-
-
ProgressFrame.TaskAddFile - Class in processing.app
-
-
Create a new background thread to add a file.
-
-
ProgressFrame.TaskSaveAs - Class in processing.app
-
-
Create a new background thread to Save As
-
-
PROJECT - Static variable in interface PConstants
-
 
-
PROJECTION - Static variable in interface PConstants
-
 
-
projection - Variable in class PGraphicsOpenGL
-
 
-
projmodelview - Variable in class PGraphicsOpenGL
-
 
-
propertiesFileName - Static variable in class Library
-
 
-
propertyChange(PropertyChangeEvent) - Method in class ProgressFrame
-
-
Detects a change in the property of the background task, - i.e., is called when the size of files already copied changes.
-
-
PShader - Class in processing.opengl
-
-
This class encapsulates a GLSL shader program, including a vertex - and a fragment shader.
-
-
PShader() - Constructor for class PShader
-
 
-
PShader(PApplet) - Constructor for class PShader
-
 
-
PShader(PApplet, String, String) - Constructor for class PShader
-
-
Creates a shader program using the specified vertex and fragment - shaders.
-
-
PShader(PApplet, URL, URL) - Constructor for class PShader
-
 
-
PShader(PApplet, String[], String[]) - Constructor for class PShader
-
 
-
PShape - Class in processing.core
-
-
( begin auto-generated from PShape.xml ) - - Datatype for storing shapes.
-
-
PShape() - Constructor for class PShape
-
 
-
PShape(int) - Constructor for class PShape
-
 
-
PShape(PGraphics, int) - Constructor for class PShape
-
 
-
PShape(PGraphics, int, float...) - Constructor for class PShape
-
 
-
PShapeOBJ - Class in processing.core
-
-
This class is not part of the Processing API and should not be used - directly.
-
-
PShapeOBJ(PApplet, String) - Constructor for class PShapeOBJ
-
-
Initializes a new OBJ Object with the given filename.
-
-
PShapeOBJ(PApplet, BufferedReader) - Constructor for class PShapeOBJ
-
 
-
PShapeOBJ(PApplet, BufferedReader, String) - Constructor for class PShapeOBJ
-
 
-
PShapeOpenGL - Class in processing.opengl
-
-
This class holds a 3D model composed of vertices, normals, colors - (per vertex) and texture coordinates (also per vertex).
-
-
PShapeOpenGL(PGraphicsOpenGL, int) - Constructor for class PShapeOpenGL
-
 
-
PShapeOpenGL(PGraphicsOpenGL, int, float...) - Constructor for class PShapeOpenGL
-
-
Create a shape from the PRIMITIVE family, using this kind and these params
-
-
PShapeSVG - Class in processing.core
-
-
This class is not part of the Processing API and should not be used - directly.
-
-
PShapeSVG(XML) - Constructor for class PShapeSVG
-
-
Initializes a new SVG Object from the given XML.
-
-
PShapeSVG.Font - Class in processing.core
-
 
-
PShapeSVG.FontGlyph - Class in processing.core
-
 
-
PStyle - Class in processing.core
-
 
-
PStyle() - Constructor for class PStyle
-
 
-
PSurface - Interface in processing.core
-
 
-
PSurfaceAWT - Class in processing.core
-
 
-
PSurfaceAWT(PGraphics) - Constructor for class PSurfaceAWT
-
 
-
PSurfaceDanger - Class in processing.core
-
 
-
PSurfaceDanger(PGraphics) - Constructor for class PSurfaceDanger
-
 
-
PSurfaceFX - Class in processing.core
-
 
-
PSurfaceFX(PGraphicsFX2D) - Constructor for class PSurfaceFX
-
 
-
PSurfaceFX.PApplicationFX - Class in processing.core
-
 
-
PSurfaceJOGL - Class in processing.opengl
-
 
-
PSurfaceJOGL(PGraphics) - Constructor for class PSurfaceJOGL
-
 
-
PSurfaceNone - Class in processing.core
-
-
Surface that's not really visible.
-
-
PSurfaceNone(PGraphics) - Constructor for class PSurfaceNone
-
 
-
push(float) - Method in class FloatList
-
-
Just an alias for append(), but matches pop()
-
-
push(int) - Method in class IntList
-
-
Just an alias for append(), but matches pop()
-
-
push(String) - Method in class StringList
-
-
Just an alias for append(), but matches pop()
-
-
pushMatrix() - Method in class PApplet
-
-
( begin auto-generated from pushMatrix.xml ) - - Pushes the current transformation matrix onto the matrix stack.
-
-
pushMatrix() - Method in class PGraphics
-
-
( begin auto-generated from pushMatrix.xml ) - - Pushes the current transformation matrix onto the matrix stack.
-
-
pushMatrix() - Method in class PGraphicsFX2D
-
 
-
pushMatrix() - Method in class PGraphicsJava2D
-
 
-
pushMatrix() - Method in class PGraphicsOpenGL
-
 
-
pushProjection() - Method in class PGraphicsOpenGL
-
 
-
pushStyle() - Method in class PApplet
-
-
( begin auto-generated from pushStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings.
-
-
pushStyle() - Method in class PGraphics
-
-
( begin auto-generated from pushStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings.
-
-
put(Texture) - Method in class Texture
-
 
-
put(Texture, int, int, int, int) - Method in class Texture
-
 
-
put(int, int, int, int, int, int) - Method in class Texture
-
 
-
put(int, int, int, int, int, int, int, int, int, int) - Method in class Texture
-
 
-
putenv(String) - Method in interface Platform.CLibrary
-
 
-
PVector - Class in processing.core
-
-
( begin auto-generated from PVector.xml ) - - A class to describe a two or three dimensional vector.
-
-
PVector() - Constructor for class PVector
-
-
Constructor for an empty vector: x, y, and z are set to 0.
-
-
PVector(float, float, float) - Constructor for class PVector
-
-
Constructor for a 3D vector.
-
-
PVector(float, float) - Constructor for class 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 PApplet
-
-
( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon.
-
-
QUAD - Static variable in interface PConstants
-
 
-
quad(float, float, float, float, float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon.
-
-
quad(float, float, float, float, float, float, float, float) - Method in class PGraphicsFX2D
-
 
-
quad(float, float, float, float, float, float, float, float) - Method in class PGraphicsJava2D
-
 
-
quad(float, float, float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
QUAD_BEZIER_VERTEX - Static variable in interface PConstants
-
-
Deprecated.
-
-
QUAD_STRIP - Static variable in interface PConstants
-
 
-
QUADRATIC_VERTEX - Static variable in interface PConstants
-
 
-
quadraticVertex(float, float, float, float) - Method in class PApplet
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class PApplet
-
 
-
quadraticVertex(float, float, float, float) - Method in class PGraphics
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class PGraphics
-
 
-
quadraticVertex(float, float, float, float) - Method in class PGraphicsFX2D
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class PGraphicsFX2D
-
 
-
quadraticVertex(float, float, float, float) - Method in class PGraphicsJava2D
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class PGraphicsJava2D
-
 
-
quadraticVertex(float, float, float, float) - Method in class PShape
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class PShape
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class PGraphics2D
-
 
-
quadraticVertex(float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
quadraticVertex(float, float, float, float) - Method in class PShapeOpenGL
-
 
-
quadraticVertex(float, float, float, float, float, float) - Method in class PShapeOpenGL
-
 
-
QUADS - Static variable in interface PConstants
-
 
-
QUARTER_PI - Static variable in interface PConstants
-
-
( begin auto-generated from QUARTER_PI.xml ) - - QUARTER_PI is a mathematical constant with the value 0.7853982.
-
-
QUESTION - Static variable in interface JavaTokenTypes
-
 
-
QUESTION - Static variable in interface PdePartialTokenTypes
-
 
-
QUESTION - Static variable in interface PdeTokenTypes
-
 
-
- - - -

R

-
-
R - Static variable in class PGraphics
-
 
-
RAD_TO_DEG - Static variable in interface PConstants
-
 
-
radians(float) - Static method in class PApplet
-
-
( begin auto-generated from radians.xml ) - - Converts a degree measurement to its corresponding value in radians.
-
-
RADIUS - Static variable in interface PConstants
-
-
Draw mode from the center, and using the radius
-
-
random(float) - Method in class PApplet
-
 
-
random(float, float) - Method in class PApplet
-
-
( begin auto-generated from random.xml ) - - Generates random numbers.
-
-
random2D() - Static method in class PVector
-
-
( begin auto-generated from PVector_random2D.xml ) - - Make a new 2D unit vector with a random direction.
-
-
random2D(PApplet) - Static method in class PVector
-
-
Make a new 2D unit vector with a random direction - using Processing's current random number generator
-
-
random2D(PVector) - Static method in class PVector
-
-
Set a 2D vector to a random unit vector with a random direction
-
-
random2D(PVector, PApplet) - Static method in class PVector
-
-
Make a new 2D unit vector with a random direction.
-
-
random3D() - Static method in class PVector
-
-
( begin auto-generated from PVector_random3D.xml ) - - Make a new 3D unit vector with a random direction.
-
-
random3D(PApplet) - Static method in class PVector
-
-
Make a new 3D unit vector with a random direction - using Processing's current random number generator
-
-
random3D(PVector) - Static method in class PVector
-
-
Set a 3D vector to a random unit vector with a random direction
-
-
random3D(PVector, PApplet) - Static method in class PVector
-
-
Make a new 3D unit vector with a random direction
-
-
randomGaussian() - Method in class PApplet
-
-
( begin auto-generated from randomGaussian.xml ) - - Returns a float from a random series of numbers having a mean of 0 - and standard deviation of 1.
-
-
randomSeed(long) - Method in class PApplet
-
-
( begin auto-generated from randomSeed.xml ) - - Sets the seed value for random().
-
-
RBRACK - Static variable in interface JavaTokenTypes
-
 
-
RBRACK - Static variable in interface PdePartialTokenTypes
-
 
-
RBRACK - Static variable in interface PdeTokenTypes
-
 
-
RCURLY - Static variable in interface JavaTokenTypes
-
 
-
RCURLY - Static variable in interface PdePartialTokenTypes
-
 
-
RCURLY - Static variable in interface PdeTokenTypes
-
 
-
READ_FRAMEBUFFER - Static variable in class PGL
-
 
-
READ_ONLY - Static variable in class PGL
-
 
-
READ_WRITE - Static variable in class PGL
-
 
-
readBuffer(int) - Method in class PGL
-
 
-
readBuffer(int) - Method in class PJOGL
-
 
-
readPixels() - Method in class FrameBuffer
-
 
-
readPixels(int, int, int, int, int, int, Buffer) - Method in class PGL
-
 
-
readSettings(File) - Static method in class Base
-
-
Read from a file with a bunch of attribute/value pairs - that are separated by = and ignore comments with #.
-
-
readSettings(String, String[]) - Static method in class Base
-
-
Parse a String array that contains attribute/value pairs separated - by = (the equals sign).
-
-
rebuild() - Method in class EditorHeader
-
-
Called when a new sketch is opened.
-
-
rebuild() - Method in class EditorToolbar
-
 
-
rebuildExamplesFrame() - Method in class Mode
-
 
-
rebuildImportMenu() - Method in class Mode
-
 
-
rebuildLibraryList() - Method in class Mode
-
 
-
rebuildMenu() - Method in class EditorHeader
-
 
-
rebuildModeMenu() - Method in class Editor
-
 
-
rebuildSketchbookFrame() - Method in class Mode
-
-
Sketchbook has changed, update it on next viewing.
-
-
rebuildToolbar() - Method in class Editor
-
 
-
rebuildToolMenu() - Method in class Editor
-
 
-
recalculateVisibleLines() - Method in class JEditTextArea
-
-
Recalculates the number of visible lines.
-
-
Recent - Class in processing.app
-
 
-
Recent(Base) - Constructor for class Recent
-
 
-
recorder - Variable in class PApplet
-
-
A leech graphics object that is echoing all events.
-
-
rect(float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from rect.xml ) - - Draws a rectangle to the screen.
-
-
rect(float, float, float, float, float) - Method in class PApplet
-
 
-
rect(float, float, float, float, float, float, float, float) - Method in class PApplet
-
 
-
RECT - Static variable in interface PConstants
-
 
-
rect(float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from rect.xml ) - - Draws a rectangle to the screen.
-
-
rect(float, float, float, float, float) - Method in class PGraphics
-
 
-
rect(float, float, float, float, float, float, float, float) - Method in class PGraphics
-
 
-
rectMode(int) - Method in class PApplet
-
-
( begin auto-generated from rectMode.xml ) - - Modifies the location from which rectangles draw.
-
-
rectMode - Variable in class PGraphics
-
-
The current rect mode (read-only)
-
-
rectMode(int) - Method in class PGraphics
-
-
( begin auto-generated from rectMode.xml ) - - Modifies the location from which rectangles draw.
-
-
rectMode - Variable in class PStyle
-
 
-
red(int) - Method in class PApplet
-
-
( begin auto-generated from red.xml ) - - Extracts the red value from a color, scaled to match current - colorMode().
-
-
red(int) - Method in class PGraphics
-
-
( begin auto-generated from red.xml ) - - Extracts the red value from a color, scaled to match current - colorMode().
-
-
RED_MASK - Static variable in class PImage
-
 
-
redraw() - Method in class PApplet
-
-
( begin auto-generated from redraw.xml ) - - Executes the code within draw() one time.
-
-
refreshInstalled(Editor) - Static method in class ContributionManager
-
 
-
regionMatches(boolean, Segment, int, char[]) - Static method in class KeywordMap
-
-
Checks if a subregion of a Segment is equal to a - character array.
-
-
registerMethod(String, Object) - Method in class PApplet
-
-
Register a built-in event so that it can be fired for libraries, etc.
-
-
registerWindowCloseKeys(JRootPane, ActionListener) - Static method in class Toolkit
-
-
Registers key events for a Ctrl-W and ESC with an ActionListener - that will take care of disposing the window.
-
-
relationalExpression() - Method in class JavaRecognizer
-
 
-
relationalExpression() - Method in class PdeRecognizer
-
 
-
RELEASE - Static variable in class KeyEvent
-
 
-
RELEASE - Static variable in class MouseEvent
-
 
-
releaseShaderCompiler() - Method in class PGL
-
 
-
releaseShaderCompiler() - Method in class PJOGL
-
 
-
reload() - Method in class Sketch
-
-
Reload the current sketch.
-
-
remove(String) - Method in class FloatDict
-
 
-
remove(int) - Method in class FloatList
-
-
Remove an element from the specified index.
-
-
remove(String) - Method in class IntDict
-
 
-
remove(int) - Method in class IntList
-
-
Remove an element from the specified index
-
-
remove(int) - Method in class JSONArray
-
-
Remove an index and close the hole.
-
-
remove(String) - Method in class JSONObject
-
-
Remove a name and its value, if present.
-
-
remove(String) - Method in class StringDict
-
 
-
remove(int) - Method in class StringList
-
-
Remove an element from the specified index.
-
-
removeAllKeyBindings() - Method in class DefaultInputHandler
-
-
Removes all key bindings from this input handler.
-
-
removeAllKeyBindings() - Method in class InputHandler
-
-
Removes all key bindings from this input handler.
-
-
removeCache(PImage) - Method in class PGraphics
-
-
Remove information associated with this renderer from the cache, if any.
-
-
removeCache(PImage) - Method in class PGraphicsOpenGL
-
 
-
removeCaretListener(CaretListener) - Method in class JEditTextArea
-
-
Removes a caret change listener from this text area.
-
-
removeChild(int) - Method in class PShape
-
-
Remove the child shape with index idx.
-
-
removeChild(XML) - Method in class XML
-
 
-
removeChild(int) - Method in class PShapeOpenGL
-
 
-
removeColumn(String) - Method in class Table
-
 
-
removeColumn(int) - Method in class Table
-
 
-
removeDescendants(File) - Static method in class 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 Base
-
-
Remove all files in a directory and the directory itself.
-
-
removeImportMenu(JMenu) - Method in class Mode
-
-
Rather than re-building the library menu for every open sketch (very slow - and prone to bugs when updating libs, particularly with the contribs mgr), - share a single instance across all windows.
-
-
removeIndex(int) - Method in class FloatDict
-
 
-
removeIndex(int) - Method in class IntDict
-
 
-
removeIndex(int) - Method in class StringDict
-
 
-
removeKeyBinding(String) - Method in class DefaultInputHandler
-
-
Removes a key binding from this input handler.
-
-
removeKeyBinding(String) - Method in class InputHandler
-
-
Removes a key binding from this input handler.
-
-
removeNotify() - Method in class JEditTextArea
-
-
Called by the AWT when this component is removed from it's parent.
-
-
removeRecent(Editor) - Method in class Base
-
-
Called before a sketch is renamed so that its old name is - no longer in the menu.
-
-
removeRecent() - Method in class Editor
-
 
-
removeRow(int) - Method in class Table
-
 
-
removeTitleRow() - Method in class Table
-
-
Deprecated.
-
-
removeTokens(String) - Method in class Table
-
-
Remove any of the specified characters from the entire table.
-
-
removeTokens(String, int) - Method in class Table
-
-
Removed any of the specified characters from a column.
-
-
removeTokens(String, String) - Method in class Table
-
 
-
removeTool() - Method in class Editor
-
 
-
removeToolbarRecentMenu() - Method in class Mode
-
 
-
removeToolContrib(ToolContribution) - Method in class Editor
-
 
-
removeUpdate(DocumentEvent) - Method in class ColorChooser.ColorListener
-
 
-
removeValue(int) - Method in class FloatList
-
 
-
removeValue(int) - Method in class IntList
-
 
-
removeValue(String) - Method in class StringList
-
 
-
removeValues(int) - Method in class FloatList
-
 
-
removeValues(int) - Method in class IntList
-
 
-
removeValues(String) - Method in class StringList
-
 
-
RENDERBUFFER - Static variable in class PGL
-
 
-
RENDERBUFFER_ALPHA_SIZE - Static variable in class PGL
-
 
-
RENDERBUFFER_BLUE_SIZE - Static variable in class PGL
-
 
-
RENDERBUFFER_DEPTH_SIZE - Static variable in class PGL
-
 
-
RENDERBUFFER_GREEN_SIZE - Static variable in class PGL
-
 
-
RENDERBUFFER_HEIGHT - Static variable in class PGL
-
 
-
RENDERBUFFER_INTERNAL_FORMAT - Static variable in class PGL
-
 
-
RENDERBUFFER_RED_SIZE - Static variable in class PGL
-
 
-
RENDERBUFFER_STENCIL_SIZE - Static variable in class PGL
-
 
-
RENDERBUFFER_WIDTH - Static variable in class PGL
-
 
-
renderbufferStorage(int, int, int, int) - Method in class PGL
-
 
-
renderbufferStorage(int, int, int, int) - Method in class PJOGL
-
 
-
renderbufferStorageMultisample(int, int, int, int, int) - Method in class PGL
-
 
-
renderbufferStorageMultisample(int, int, int, int, int) - Method in class PJOGL
-
 
-
RENDERER - Static variable in class PGL
-
 
-
REPEAT - Static variable in class InputHandler
-
 
-
repeat() - Constructor for class InputHandler.repeat
-
 
-
REPEAT - Static variable in interface PConstants
-
-
textures wrap around when uv values go outside 0..1 range
-
-
REPEAT - Static variable in class PGL
-
 
-
replace() - Method in class FindReplace
-
-
Replace the current selection with whatever's in the - replacement text field.
-
-
REPLACE - Static variable in interface PConstants
-
 
-
replace(String, String) - Method in class Table
-
-
Replace a String with another.
-
-
replace(String, String, int) - Method in class Table
-
 
-
replace(String, String, String) - Method in class Table
-
 
-
REPLACE - Static variable in class PGL
-
 
-
replaceAll() - Method in class FindReplace
-
-
Replace everything that matches by doing find and replace - alternately until nothing more found.
-
-
replaceAll(String, String) - Method in class Table
-
 
-
replaceAll(String, String, int) - Method in class Table
-
 
-
replaceAll(String, String, String) - Method in class Table
-
-
Run String.replaceAll() on all entries in a column.
-
-
replaceAndFindNext() - Method in class FindReplace
-
-
Replace the current selection with whatever's in the - replacement text field, and then find the next match
-
-
replaceValue(float, float) - Method in class FloatList
-
-
Replace the first instance of a particular value
-
-
replaceValue(String, String) - Method in class StringList
-
 
-
replaceValues(float, float) - Method in class FloatList
-
-
Replace all instances of a particular value
-
-
replaceValues(String, String) - Method in class StringList
-
 
-
reqNumSamples - Variable in class PGL
-
 
-
REQUESTED_ALPHA_BITS - Static variable in class PGL
-
 
-
REQUESTED_DEPTH_BITS - Static variable in class PGL
-
 
-
REQUESTED_STENCIL_BITS - Static variable in class PGL
-
 
-
requestFBOLayer() - Method in class PGL
-
 
-
requestFocus() - Method in class PSurfaceJOGL
-
 
-
requestImage(String) - Method in class PApplet
-
 
-
requestImage(String, String) - Method in class PApplet
-
-
( begin auto-generated from requestImage.xml ) - - This function load images on a separate thread so that your sketch does - not freeze while images load during setup().
-
-
requestImageMax - Variable in class PApplet
-
-
By trial and error, four image loading threads seem to work best when - loading images from online.
-
-
reset() - Method in interface PMatrix
-
 
-
reset() - Method in class PMatrix2D
-
 
-
reset() - Method in class PMatrix3D
-
 
-
reset() - Method in class LinePath
-
-
Resets the path to empty.
-
-
resetMatrix() - Method in class PApplet
-
-
( begin auto-generated from resetMatrix.xml ) - - Replaces the current matrix with the identity matrix.
-
-
resetMatrix() - Method in class PGraphics
-
-
( begin auto-generated from resetMatrix.xml ) - - Replaces the current matrix with the identity matrix.
-
-
resetMatrix() - Method in class PGraphicsFX2D
-
 
-
resetMatrix() - Method in class PGraphicsJava2D
-
 
-
resetMatrix() - Method in class PShape
-
-
( begin auto-generated from PShape_resetMatrix.xml ) - - Replaces the current matrix of a shape with the identity matrix.
-
-
resetMatrix() - Method in class PGraphicsOpenGL
-
 
-
resetMatrix() - Method in class PShapeOpenGL
-
 
-
resetProjection() - Method in class PGraphicsOpenGL
-
 
-
resetShader() - Method in class PApplet
-
-
( begin auto-generated from resetShader.xml ) - - This is a new reference entry for Processing 2.0.
-
-
resetShader(int) - Method in class PApplet
-
 
-
resetShader() - Method in class PGraphics
-
-
( begin auto-generated from resetShader.xml ) - - This is a new reference entry for Processing 2.0.
-
-
resetShader(int) - Method in class PGraphics
-
 
-
resetShader() - Method in class PGraphicsOpenGL
-
 
-
resetShader(int) - Method in class PGraphicsOpenGL
-
 
-
resize(int, int) - Method in class PImage
-
-
( begin auto-generated from PImage_resize.xml ) - - Resize the image to a new width and height.
-
-
resize(int) - Method in class FloatList
-
 
-
resize(int) - Method in class IntList
-
 
-
resize(int) - Method in class StringList
-
 
-
resize(int, int) - Method in class PGraphicsOpenGL
-
 
-
resize(int, int) - Method in class Texture
-
 
-
RESTART_FLAG - Static variable in class LocalContribution
-
 
-
resume() - Method in class PApplet
-
-
Sketch has resumed.
-
-
resumeThread() - Method in interface PSurface
-
 
-
resumeThread() - Method in class PSurfaceFX
-
 
-
resumeThread() - Method in class PSurfaceNone
-
 
-
resumeThread() - Method in class PSurfaceJOGL
-
 
-
RETINA - Static variable in class PJOGL
-
 
-
RETURN - Static variable in interface PConstants
-
 
-
reverse(boolean[]) - Static method in class PApplet
-
-
( begin auto-generated from reverse.xml ) - - Reverses the order of an array.
-
-
reverse(byte[]) - Static method in class PApplet
-
 
-
reverse(char[]) - Static method in class PApplet
-
 
-
reverse(int[]) - Static method in class PApplet
-
 
-
reverse(float[]) - Static method in class PApplet
-
 
-
reverse(String[]) - Static method in class PApplet
-
 
-
reverse(Object) - Static method in class PApplet
-
 
-
reverse() - Method in class FloatList
-
 
-
reverse() - Method in class IntList
-
 
-
reverse() - Method in class StringList
-
 
-
RGB - Static variable in interface PConstants
-
 
-
RGB - Static variable in class PGL
-
 
-
RGB565 - Static variable in class PGL
-
 
-
RGB5_A1 - Static variable in class PGL
-
 
-
RGB8 - Static variable in class PGL
-
 
-
RGBA - Static variable in class PGL
-
 
-
RGBA4 - Static variable in class PGL
-
 
-
RGBA8 - Static variable in class PGL
-
 
-
RIGHT - Static variable in interface PConstants
-
 
-
RIGHT_GUTTER - Static variable in class Editor
-
 
-
rotate(float) - Method in class PApplet
-
-
( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter.
-
-
rotate(float, float, float, float) - Method in class PApplet
-
-
Advanced
-
-
rotate(float) - Method in class PGraphics
-
-
( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter.
-
-
rotate(float, float, float, float) - Method in class PGraphics
-
-
Advanced
-
-
rotate(float) - Method in class PGraphicsFX2D
-
 
-
rotate(float, float, float, float) - Method in class PGraphicsFX2D
-
 
-
rotate(float) - Method in class PGraphicsJava2D
-
 
-
rotate(float, float, float, float) - Method in class PGraphicsJava2D
-
 
-
rotate(float) - Method in interface PMatrix
-
 
-
rotate(float, float, float, float) - Method in interface PMatrix
-
 
-
rotate(float) - Method in class PMatrix2D
-
 
-
rotate(float, float, float, float) - Method in class PMatrix2D
-
 
-
rotate(float) - Method in class PMatrix3D
-
 
-
rotate(float, float, float, float) - Method in class PMatrix3D
-
 
-
rotate(float) - Method in class PShape
-
-
( begin auto-generated from PShape_rotate.xml ) - - Rotates a shape the amount specified by the angle parameter.
-
-
rotate(float, float, float, float) - Method in class PShape
-
 
-
rotate(float) - Method in class PVector
-
-
( begin auto-generated from PVector_rotate.xml ) - - Rotate the vector by an angle (only 2D vectors), magnitude remains the same - - ( end auto-generated )
-
-
rotate(float, float, float, float) - Method in class PGraphics2D
-
 
-
rotate(float) - Method in class PGraphicsOpenGL
-
-
Two dimensional rotation.
-
-
rotate(float, float, float, float) - Method in class PGraphicsOpenGL
-
-
Rotate around an arbitrary vector, similar to glRotate(), except that it - takes radians (instead of degrees).
-
-
rotate(float) - Method in class PShapeOpenGL
-
 
-
rotate(float, float, float, float) - Method in class PShapeOpenGL
-
 
-
rotateX(float) - Method in class PApplet
-
-
( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter.
-
-
rotateX(float) - Method in class PGraphics
-
-
( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter.
-
-
rotateX(float) - Method in class PGraphicsFX2D
-
 
-
rotateX(float) - Method in class PGraphicsJava2D
-
 
-
rotateX(float) - Method in interface PMatrix
-
 
-
rotateX(float) - Method in class PMatrix2D
-
 
-
rotateX(float) - Method in class PMatrix3D
-
 
-
rotateX(float) - Method in class PShape
-
-
( begin auto-generated from PShape_rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter.
-
-
rotateX(float) - Method in class PGraphics2D
-
 
-
rotateX(float) - Method in class PGraphicsOpenGL
-
 
-
rotateX(float) - Method in class PShapeOpenGL
-
 
-
rotateY(float) - Method in class PApplet
-
-
( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter.
-
-
rotateY(float) - Method in class PGraphics
-
-
( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter.
-
-
rotateY(float) - Method in class PGraphicsFX2D
-
 
-
rotateY(float) - Method in class PGraphicsJava2D
-
 
-
rotateY(float) - Method in interface PMatrix
-
 
-
rotateY(float) - Method in class PMatrix2D
-
 
-
rotateY(float) - Method in class PMatrix3D
-
 
-
rotateY(float) - Method in class PShape
-
-
( begin auto-generated from PShape_rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter.
-
-
rotateY(float) - Method in class PGraphics2D
-
 
-
rotateY(float) - Method in class PGraphicsOpenGL
-
 
-
rotateY(float) - Method in class PShapeOpenGL
-
 
-
rotateZ(float) - Method in class PApplet
-
-
( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter.
-
-
rotateZ(float) - Method in class PGraphics
-
-
( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter.
-
-
rotateZ(float) - Method in class PGraphicsFX2D
-
 
-
rotateZ(float) - Method in class PGraphicsJava2D
-
 
-
rotateZ(float) - Method in interface PMatrix
-
 
-
rotateZ(float) - Method in class PMatrix2D
-
 
-
rotateZ(float) - Method in class PMatrix3D
-
 
-
rotateZ(float) - Method in class PShape
-
-
( begin auto-generated from PShape_rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter.
-
-
rotateZ(float) - Method in class PGraphics2D
-
 
-
rotateZ(float) - Method in class PGraphicsOpenGL
-
 
-
rotateZ(float) - Method in class PShapeOpenGL
-
 
-
round(float) - Static method in class PApplet
-
-
( begin auto-generated from round.xml ) - - Calculates the integer closest to the value parameter.
-
-
ROUND - Static variable in interface PConstants
-
 
-
rows - Variable in class TextAreaDefaults
-
 
-
rows() - Method in class Table
-
-
Note that this one iterator instance is shared by any calls to iterate - the rows of this table.
-
-
rows(int[]) - Method in class Table
-
 
-
RPAREN - Static variable in interface JavaTokenTypes
-
 
-
RPAREN - Static variable in interface PdePartialTokenTypes
-
 
-
RPAREN - Static variable in interface PdeTokenTypes
-
 
-
run() - Method in class ToolContribution
-
 
-
run() - Method in class StreamPump
-
 
-
run() - Method in class StreamRedirectThread
-
-
Copy.
-
-
run() - Method in class SystemOutSiphon
-
 
-
run() - Method in class Archiver
-
 
-
run() - Method in class ColorSelector
-
 
-
run() - Method in class CreateFont
-
 
-
run() - Method in class InstallCommander
-
 
-
run() - Method in interface Tool
-
 
-
run() - Method in class Sort
-
 
-
RunnerListener - Interface in processing.app
-
 
-
runSketch(String[], PApplet) - Static method in class PApplet
-
 
-
- - - -

S

-
-
SA - Static variable in class PGraphics
-
 
-
SAMPLE_ALPHA_TO_COVERAGE - Static variable in class PGL
-
 
-
SAMPLE_COVERAGE - Static variable in class PGL
-
 
-
sampleCoverage(float, boolean) - Method in class PGL
-
 
-
sampleCoverage(float, boolean) - Method in class PJOGL
-
 
-
SAMPLER_2D - Static variable in class PGL
-
 
-
SAMPLER_CUBE - Static variable in class PGL
-
 
-
SAMPLES - Static variable in class PGL
-
 
-
sampling - Variable in class Texture.Parameters
-
-
Texture filtering (POINT, LINEAR, BILINEAR or TRILINEAR).
-
-
sanitizeName(String) - Static method in class Sketch
-
-
Produce a sanitized name that fits our standards for likely to work.
-
-
saturation(int) - Method in class PApplet
-
-
( begin auto-generated from saturation.xml ) - - Extracts the saturation value from a color.
-
-
saturation(int) - Method in class PGraphics
-
-
( begin auto-generated from saturation.xml ) - - Extracts the saturation value from a color.
-
-
save() - Method in class Settings
-
 
-
save() - Method in class Sketch
-
-
Save all code in the current sketch.
-
-
save() - Method in class SketchCode
-
-
Save this piece of code, regardless of whether the modified - flag is set or not.
-
-
save(String) - Method in class PApplet
-
-
( begin auto-generated from save.xml ) - - Saves an image from the display window.
-
-
save(OutputStream) - Method in class PFont
-
-
Write this PFont to an OutputStream.
-
-
save(String) - Method in class PGraphicsDanger2D
-
 
-
save(String) - Method in class PImage
-
-
( begin auto-generated from PImage_save.xml ) - - Saves the image into a file.
-
-
save(File, String) - Method in class JSONArray
-
 
-
save(File, String) - Method in class JSONObject
-
 
-
save(File, String) - Method in class Table
-
 
-
save(OutputStream, String) - Method in class Table
-
 
-
save(File) - Method in class XML
-
 
-
save(File, String) - Method in class XML
-
 
-
save(String) - Method in class PGraphicsOpenGL
-
 
-
saveAs(File) - Method in class SketchCode
-
-
Save this file to another location, used by Sketch.saveAs()
-
-
saveBytes(String, byte[]) - Method in class PApplet
-
-
( begin auto-generated from saveBytes.xml ) - - Opposite of loadBytes(), will write an entire array of bytes to a - file.
-
-
saveBytes(File, byte[]) - Static method in class PApplet
-
 
-
saveBytes(OutputStream, byte[]) - Static method in class PApplet
-
 
-
saveFile(String, File) - Static method in class Base
-
-
Spew the contents of a String object out to a file.
-
-
saveFile(String) - Method in class PApplet
-
-
Identical to savePath(), but returns a File object.
-
-
saveFrame() - Method in class PApplet
-
 
-
saveFrame(String) - Method in class PApplet
-
-
( begin auto-generated from saveFrame.xml ) - - Saves a numbered sequence of images, one image each time the function is - run.
-
-
saveJSONArray(JSONArray, String) - Method in class PApplet
-
 
-
saveJSONArray(JSONArray, String, String) - Method in class PApplet
-
 
-
saveJSONObject(JSONObject, String) - Method in class PApplet
-
 
-
saveJSONObject(JSONObject, String, String) - Method in class PApplet
-
 
-
saveLanguage(String) - Static method in class Language
-
-
Save the language directly to a settings file.
-
-
saveLanguage(String) - Method in class MacPlatform
-
 
-
saveLanguage(String) - Method in class Platform
-
-
Handle any platform-specific languages saving.
-
-
savePath(String) - Method in class PApplet
-
-
Returns a path inside the applet folder to save to.
-
-
saveStream(String, String) - Method in class PApplet
-
-
( begin auto-generated from saveStream.xml ) - - Save the contents of a stream to a file in the sketch folder.
-
-
saveStream(File, String) - Method in class PApplet
-
-
Identical to the other saveStream(), but writes to a File - object, for greater control over the file location.
-
-
saveStream(String, InputStream) - Method in class PApplet
-
 
-
saveStream(File, InputStream) - Static method in class PApplet
-
 
-
saveStream(OutputStream, InputStream) - Static method in class PApplet
-
 
-
saveStrings(String, String[]) - Method in class PApplet
-
-
( begin auto-generated from saveStrings.xml ) - - Writes an array of strings to a file, one line per string.
-
-
saveStrings(File, String[]) - Static method in class PApplet
-
 
-
saveStrings(OutputStream, String[]) - Static method in class PApplet
-
 
-
saveTable(Table, String) - Method in class PApplet
-
 
-
saveTable(Table, String, String) - Method in class PApplet
-
 
-
saveXML(XML, String) - Method in class PApplet
-
 
-
saveXML(XML, String, String) - Method in class PApplet
-
 
-
SB - Static variable in class PGraphics
-
 
-
scale(float) - Method in class PApplet
-
-
( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices.
-
-
scale(float, float) - Method in class PApplet
-
-
Advanced
-
-
scale(float, float, float) - Method in class PApplet
-
 
-
scale(float) - Method in class PGraphics
-
-
( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices.
-
-
scale(float, float) - Method in class PGraphics
-
-
Advanced
-
-
scale(float, float, float) - Method in class PGraphics
-
 
-
scale(float) - Method in class PGraphicsFX2D
-
 
-
scale(float, float) - Method in class PGraphicsFX2D
-
 
-
scale(float, float, float) - Method in class PGraphicsFX2D
-
 
-
scale(float) - Method in class PGraphicsJava2D
-
 
-
scale(float, float) - Method in class PGraphicsJava2D
-
 
-
scale(float, float, float) - Method in class PGraphicsJava2D
-
 
-
scale(float) - Method in interface PMatrix
-
 
-
scale(float, float) - Method in interface PMatrix
-
 
-
scale(float, float, float) - Method in interface PMatrix
-
 
-
scale(float) - Method in class PMatrix2D
-
 
-
scale(float, float) - Method in class PMatrix2D
-
 
-
scale(float, float, float) - Method in class PMatrix2D
-
 
-
scale(float) - Method in class PMatrix3D
-
 
-
scale(float, float) - Method in class PMatrix3D
-
 
-
scale(float, float, float) - Method in class PMatrix3D
-
 
-
scale(float) - Method in class PShape
-
-
( begin auto-generated from PShape_scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices.
-
-
scale(float, float) - Method in class PShape
-
 
-
scale(float, float, float) - Method in class PShape
-
 
-
scale(float, float, float) - Method in class PGraphics2D
-
 
-
scale(float) - Method in class PGraphicsOpenGL
-
-
Same as scale(s, s, s).
-
-
scale(float, float) - Method in class PGraphicsOpenGL
-
-
Same as scale(sx, sy, 1).
-
-
scale(float, float, float) - Method in class PGraphicsOpenGL
-
-
Scale in three dimensions.
-
-
scale(float) - Method in class PShapeOpenGL
-
 
-
scale(float, float) - Method in class PShapeOpenGL
-
 
-
scale(float, float, float) - Method in class PShapeOpenGL
-
 
-
scissor(int, int, int, int) - Method in class PGL
-
 
-
scissor(int, int, int, int) - Method in class PJOGL
-
 
-
SCISSOR_TEST - Static variable in class PGL
-
 
-
SCREEN - Static variable in interface PConstants
-
 
-
screenX(float, float) - Method in class PApplet
-
-
( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen.
-
-
screenX(float, float, float) - Method in class PApplet
-
 
-
screenX(float, float) - Method in class PGraphics
-
-
( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen.
-
-
screenX(float, float, float) - Method in class PGraphics
-
 
-
screenX(float, float) - Method in class PGraphicsFX2D
-
 
-
screenX(float, float, float) - Method in class PGraphicsFX2D
-
 
-
screenX(float, float) - Method in class PGraphicsJava2D
-
 
-
screenX(float, float, float) - Method in class PGraphicsJava2D
-
 
-
screenX(float, float, float) - Method in class PGraphics2D
-
 
-
screenX(float, float) - Method in class PGraphicsOpenGL
-
 
-
screenX(float, float, float) - Method in class PGraphicsOpenGL
-
 
-
screenY(float, float) - Method in class PApplet
-
-
( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen.
-
-
screenY(float, float, float) - Method in class PApplet
-
 
-
screenY(float, float) - Method in class PGraphics
-
-
( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen.
-
-
screenY(float, float, float) - Method in class PGraphics
-
 
-
screenY(float, float) - Method in class PGraphicsFX2D
-
 
-
screenY(float, float, float) - Method in class PGraphicsFX2D
-
 
-
screenY(float, float) - Method in class PGraphicsJava2D
-
 
-
screenY(float, float, float) - Method in class PGraphicsJava2D
-
 
-
screenY(float, float, float) - Method in class PGraphics2D
-
 
-
screenY(float, float) - Method in class PGraphicsOpenGL
-
 
-
screenY(float, float, float) - Method in class PGraphicsOpenGL
-
 
-
screenZ(float, float, float) - Method in class PApplet
-
-
( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen.
-
-
screenZ(float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen.
-
-
screenZ(float, float, float) - Method in class PGraphicsFX2D
-
 
-
screenZ(float, float, float) - Method in class PGraphicsJava2D
-
 
-
screenZ(float, float, float) - Method in class PGraphics2D
-
 
-
screenZ(float, float, float) - Method in class PGraphicsOpenGL
-
 
-
scrollTo(int, int) - Method in class JEditTextArea
-
-
Ensures that the specified line and offset is visible by scrolling - the text area if necessary.
-
-
scrollToCaret() - Method in class JEditTextArea
-
-
Ensures that the caret is visible by scrolling the text area if - necessary.
-
-
second() - Static method in class PApplet
-
-
( begin auto-generated from second.xml ) - - Processing communicates with the clock on your computer.
-
-
SEG_CLOSE - Static variable in class LinePath
-
-
Closes segment at current position.
-
-
SEG_LINETO - Static variable in class LinePath
-
-
Extends segment by adding a line to a given position.
-
-
SEG_MOVETO - Static variable in class LinePath
-
-
Starts segment at a given position.
-
-
select(int, int) - Method in class JEditTextArea
-
-
Selects from the start offset to the end offset.
-
-
SELECT_DOC_END - Static variable in class InputHandler
-
 
-
SELECT_DOC_HOME - Static variable in class InputHandler
-
 
-
SELECT_END - Static variable in class InputHandler
-
 
-
SELECT_HOME - Static variable in class InputHandler
-
 
-
SELECT_NEXT_CHAR - Static variable in class InputHandler
-
 
-
SELECT_NEXT_LINE - Static variable in class InputHandler
-
 
-
SELECT_NEXT_PAGE - Static variable in class InputHandler
-
 
-
SELECT_NEXT_WORD - Static variable in class InputHandler
-
 
-
SELECT_PREV_CHAR - Static variable in class InputHandler
-
 
-
SELECT_PREV_LINE - Static variable in class InputHandler
-
 
-
SELECT_PREV_PAGE - Static variable in class InputHandler
-
 
-
SELECT_PREV_WORD - Static variable in class InputHandler
-
 
-
selectAll() - Method in class JEditTextArea
-
-
Selects all text in the document.
-
-
selectFolder(String, String) - Method in class PApplet
-
-
See selectInput() for details.
-
-
selectFolder(String, String, File) - Method in class PApplet
-
 
-
selectFolder(String, String, File, Object) - Method in class PApplet
-
 
-
selectFolder(String, String, File, Object, Frame) - Static method in class PApplet
-
 
-
selectInput(String, String) - Method in class PApplet
-
-
Open a platform-specific file chooser dialog to select a file for input.
-
-
selectInput(String, String, File) - Method in class PApplet
-
 
-
selectInput(String, String, File, Object) - Method in class PApplet
-
 
-
selectInput(String, String, File, Object, Frame) - Static method in class PApplet
-
 
-
selectionColor - Variable in class TextAreaDefaults
-
 
-
selectNone() - Method in class JEditTextArea
-
-
Moves the mark to the caret position.
-
-
selectOutput(String, String) - Method in class PApplet
-
-
See selectInput() for details.
-
-
selectOutput(String, String, File) - Method in class PApplet
-
 
-
selectOutput(String, String, File, Object) - Method in class PApplet
-
 
-
selectOutput(String, String, File, Object, Frame) - Static method in class PApplet
-
 
-
SEMI - Static variable in interface JavaTokenTypes
-
 
-
SEMI - Static variable in interface PdePartialTokenTypes
-
 
-
SEMI - Static variable in interface PdeTokenTypes
-
 
-
set(String, String) - Static method in class Preferences
-
 
-
set(String, String) - Method in class Settings
-
 
-
set(int, int, int) - Method in class PApplet
-
-
( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
-
- The x and y parameters specify the pixel to change and the - color parameter specifies the color value.
-
-
set(int, int, PImage) - Method in class PApplet
-
-
Advanced
-
-
set(int, int, int) - Method in class PGraphicsDanger2D
-
 
-
set(int, int, PImage) - Method in class PGraphicsDanger2D
-
 
-
set(int, int, int) - Method in class PGraphicsJava2D
-
 
-
set(int, int, int) - Method in class PImage
-
-
( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
-
- The x and y parameters specify the pixel to change and the - color parameter specifies the color value.
-
-
set(int, int, PImage) - Method in class PImage
-
-
Advanced
-
-
set(PMatrix) - Method in interface PMatrix
-
 
-
set(float[]) - Method in interface PMatrix
-
 
-
set(float, float, float, float, float, float) - Method in interface PMatrix
-
 
-
set(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in interface PMatrix
-
 
-
set(PMatrix) - Method in class PMatrix2D
-
 
-
set(PMatrix3D) - Method in class PMatrix2D
-
 
-
set(float[]) - Method in class PMatrix2D
-
 
-
set(float, float, float, float, float, float) - Method in class PMatrix2D
-
 
-
set(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PMatrix2D
-
 
-
set(PMatrix) - Method in class PMatrix3D
-
 
-
set(float[]) - Method in class PMatrix3D
-
 
-
set(float, float, float, float, float, float) - Method in class PMatrix3D
-
 
-
set(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - Method in class PMatrix3D
-
 
-
set(float, float, float) - Method in class PVector
-
-
( begin auto-generated from PVector_set.xml ) - - Sets the x, y, and z component of the vector using two or three separate - variables, the data from a PVector, or the values from a float array.
-
-
set(float, float) - Method in class PVector
-
 
-
set(PVector) - Method in class PVector
-
 
-
set(float[]) - Method in class PVector
-
-
Set the x, y (and maybe z) coordinates using a float[] array as the source.
-
-
set(String, float) - Method in class FloatDict
-
 
-
set(int, float) - Method in class FloatList
-
-
Set the entry at a particular index.
-
-
set(String, int) - Method in class IntDict
-
-
Create a new key/value pair or change the value of one.
-
-
set(int, int) - Method in class IntList
-
-
Set the entry at a particular index.
-
-
set(String, String) - Method in class StringDict
-
 
-
set(int, String) - Method in class StringList
-
-
Set the entry at a particular index.
-
-
set(int, int, int) - Method in class PGraphicsOpenGL
-
 
-
set(String, int) - Method in class PShader
-
 
-
set(String, int, int) - Method in class PShader
-
 
-
set(String, int, int, int) - Method in class PShader
-
 
-
set(String, int, int, int, int) - Method in class PShader
-
 
-
set(String, float) - Method in class PShader
-
 
-
set(String, float, float) - Method in class PShader
-
 
-
set(String, float, float, float) - Method in class PShader
-
 
-
set(String, float, float, float, float) - Method in class PShader
-
 
-
set(String, PVector) - Method in class PShader
-
 
-
set(String, boolean) - Method in class PShader
-
 
-
set(String, boolean, boolean) - Method in class PShader
-
 
-
set(String, boolean, boolean, boolean) - Method in class PShader
-
 
-
set(String, boolean, boolean, boolean, boolean) - Method in class PShader
-
 
-
set(String, int[]) - Method in class PShader
-
 
-
set(String, int[], int) - Method in class PShader
-
 
-
set(String, float[]) - Method in class PShader
-
 
-
set(String, float[], int) - Method in class PShader
-
 
-
set(String, boolean[]) - Method in class PShader
-
 
-
set(String, boolean[], int) - Method in class PShader
-
 
-
set(String, PMatrix2D) - Method in class PShader
-
 
-
set(String, PMatrix3D) - Method in class PShader
-
 
-
set(String, PMatrix3D, boolean) - Method in class PShader
-
 
-
set(String, PImage) - Method in class PShader
-
 
-
set(int) - Method in class Texture.Parameters
-
 
-
set(int, int) - Method in class Texture.Parameters
-
 
-
set(int, int, boolean) - Method in class Texture.Parameters
-
 
-
set(Texture.Parameters) - Method in class Texture.Parameters
-
 
-
set(Texture) - Method in class Texture
-
 
-
set(Texture, int, int, int, int) - Method in class Texture
-
 
-
set(int, int, int, int, int, int) - Method in class Texture
-
 
-
set(int, int, int, int, int, int, int, int, int, int) - Method in class Texture
-
 
-
set(int[]) - Method in class Texture
-
 
-
set(int[], int) - Method in class Texture
-
 
-
set(int[], int, int, int, int) - Method in class Texture
-
 
-
set(int[], int, int, int, int, int) - Method in class Texture
-
 
-
set3D(boolean) - Method in class PShape
-
 
-
setAmbient - Variable in class PGraphics
-
 
-
setAmbient(int) - Method in class PShape
-
 
-
setAmbient(int, int) - Method in class PShape
-
 
-
setAmbient(int) - Method in class PShapeOpenGL
-
 
-
setAmbient(int, int) - Method in class PShapeOpenGL
-
 
-
setAttrib(String, int, float...) - Method in class PShape
-
 
-
setAttrib(String, int, int...) - Method in class PShape
-
 
-
setAttrib(String, int, boolean...) - Method in class PShape
-
 
-
setAttrib(String, int, float...) - Method in class PShapeOpenGL
-
 
-
setAttrib(String, int, int...) - Method in class PShapeOpenGL
-
 
-
setAttrib(String, int, boolean...) - Method in class PShapeOpenGL
-
 
-
setBoolean(String, boolean) - Static method in class Preferences
-
 
-
setBoolean(String, boolean) - Method in class Settings
-
 
-
setBoolean(int, boolean) - Method in class JSONArray
-
-
Put or replace a boolean value in the JSONArray.
-
-
setBoolean(String, boolean) - Method in class JSONObject
-
-
Put a key/boolean pair in the JSONObject.
-
-
setBufferSource(Object) - Method in class Texture
-
 
-
setCache(PImage, Object) - Method in class PGraphics
-
-
Store data of some kind for the renderer that requires extra metadata of - some kind.
-
-
setCache(PImage, Object) - Method in class PGraphicsOpenGL
-
 
-
setCaretBlinkEnabled(boolean) - Method in class JEditTextArea
-
-
Toggles caret blinking.
-
-
setCaretPosition(int) - Method in class JEditTextArea
-
-
Sets the caret position.
-
-
setCaretVisible(boolean) - Method in class JEditTextArea
-
-
Sets if the caret should be visible.
-
-
setClassLoader(ClassLoader) - Method in class Mode
-
 
-
setCodeColumn(int) - Method in exception SketchException
-
 
-
setCodeIndex(int) - Method in exception SketchException
-
 
-
setCodeLine(int) - Method in exception SketchException
-
 
-
setColor(Color) - Method in class ColorChooser
-
 
-
setColor(String, Color) - Static method in class Preferences
-
 
-
setColor(String, Color) - Method in class Settings
-
 
-
setColorBuffer(Texture) - Method in class FrameBuffer
-
 
-
setColorBuffers(Texture[]) - Method in class FrameBuffer
-
 
-
setColorBuffers(Texture[], int) - Method in class FrameBuffer
-
 
-
setColumnCount(int) - Method in class Table
-
-
Change the number of columns in this table.
-
-
setColumnTitle(int, String) - Method in class Table
-
 
-
setColumnTitles(String[]) - Method in class Table
-
 
-
setColumnType(String, String) - Method in class Table
-
 
-
setColumnType(int, String) - Method in class Table
-
-
Set the data type for a column so that using it is more efficient.
-
-
setColumnType(String, int) - Method in class Table
-
 
-
setColumnType(int, int) - Method in class Table
-
-
Sets the column type.
-
-
setColumnTypes(int[]) - Method in class Table
-
 
-
setColumnTypes(Table) - Method in class Table
-
-
Set the titles (and if a second column is present) the data types for - this table based on a file loaded separately.
-
-
setCommandLine() - Static method in class Base
-
 
-
setComposedTextLayout(TextLayout, int) - Method in class CompositionTextPainter
-
-
Set TextLayout to the painter.
-
-
setContent(String) - Method in class XML
-
 
-
setCurrentCode(int) - Method in class Sketch
-
-
Change what file is currently being edited.
-
-
setCurrentLineIndex(int) - Method in class TextAreaPainter
-
-
Accessor used by tools that want to hook in and grab the formatting.
-
-
setCurrentLineTokens(Token) - Method in class TextAreaPainter
-
-
Accessor used by tools that want to hook in and grab the formatting.
-
-
setCursor(int) - Method in interface PSurface
-
 
-
setCursor(PImage, int, int) - Method in interface PSurface
-
 
-
setCursor(int) - Method in class PSurfaceAWT
-
 
-
setCursor(PImage, int, int) - Method in class PSurfaceAWT
-
 
-
setCursor(int) - Method in class PSurfaceFX
-
 
-
setCursor(PImage, int, int) - Method in class PSurfaceFX
-
 
-
setCursor(int) - Method in class PSurfaceNone
-
 
-
setCursor(PImage, int, int) - Method in class PSurfaceNone
-
 
-
setCursor(int) - Method in class PSurfaceJOGL
-
 
-
setCursor(PImage, int, int) - Method in class PSurfaceJOGL
-
 
-
setDocument(Document) - Method in class SketchCode
-
 
-
setDocument(SyntaxDocument) - Method in class JEditTextArea
-
-
Sets the document this text area is editing.
-
-
setDocument(SyntaxDocument, int, int, int) - Method in class JEditTextArea
-
-
Set document with a twist, includes the old caret - and scroll positions, added for p5.
-
-
setDouble(int, double) - Method in class JSONArray
-
-
Put or replace a double value.
-
-
setDouble(String, double) - Method in class JSONObject
-
-
Put a key/double pair in the JSONObject.
-
-
setDouble(int, int, double) - Method in class Table
-
 
-
setDouble(int, String, double) - Method in class Table
-
 
-
setDouble(int, double) - Method in interface TableRow
-
 
-
setDouble(String, double) - Method in interface TableRow
-
 
-
setDouble(String, double) - Method in class XML
-
 
-
setDoubleContent(double) - Method in class XML
-
 
-
setEditable(boolean) - Method in class JEditTextArea
-
-
Sets if this component is editable.
-
-
setEditor(Editor) - Static method in class EditorConsole
-
 
-
setElectricScroll(int) - Method in class JEditTextArea
-
-
Sets the number of lines from the top and bottom of the text - area that are always visible
-
-
setEmissive(int) - Method in class PShape
-
 
-
setEmissive(int, int) - Method in class PShape
-
 
-
setEmissive(int) - Method in class PShapeOpenGL
-
 
-
setEmissive(int, int) - Method in class PShapeOpenGL
-
 
-
setenv(String, String, int) - Method in interface Platform.CLibrary
-
 
-
setenv(String, String) - Method in class Platform
-
 
-
setenv(String, String) - Method in class WindowsPlatform
-
 
-
setFamily(int) - Method in class PShape
-
 
-
setFBO(int) - Method in class FrameBuffer
-
 
-
setFill(boolean) - Method in class PShape
-
 
-
setFill(int) - Method in class PShape
-
 
-
setFill(int, int) - Method in class PShape
-
 
-
setFill(boolean) - Method in class PShapeOpenGL
-
 
-
setFill(int) - Method in class PShapeOpenGL
-
 
-
setFill(int, int) - Method in class PShapeOpenGL
-
 
-
setFindText(String) - Method in class FindReplace
-
 
-
setFirstLine(int) - Method in class JEditTextArea
-
-
Sets the line displayed at the text area's origin without - updating the scroll bars.
-
-
setFloat(int, float) - Method in class JSONArray
-
-
Put or replace a float value.
-
-
setFloat(String, float) - Method in class JSONObject
-
 
-
setFloat(int, int, float) - Method in class Table
-
 
-
setFloat(int, String, float) - Method in class Table
-
 
-
setFloat(int, float) - Method in interface TableRow
-
 
-
setFloat(String, float) - Method in interface TableRow
-
 
-
setFloat(String, float) - Method in class XML
-
 
-
setFloatContent(float) - Method in class XML
-
 
-
setFolder(File) - Method in class SketchCode
-
-
Called when the sketch folder name/location has changed.
-
-
setFragmentShader(String) - Method in class PShader
-
 
-
setFragmentShader(URL) - Method in class PShader
-
 
-
setFragmentShader(String[]) - Method in class PShader
-
 
-
setFrame(Frame) - Method in class PApplet
-
 
-
setFrameRate(float) - Method in interface PSurface
-
 
-
setFrameRate(float) - Method in class PSurfaceFX
-
 
-
setFrameRate(float) - Method in class PSurfaceNone
-
 
-
setFrameRate(float) - Method in class PSurfaceJOGL
-
 
-
setHorizontalOffset(int) - Method in class JEditTextArea
-
-
Sets the horizontal offset of drawn lines.
-
-
setHorizontalScrollPosition(int) - Method in class JEditTextArea
-
-
Set position of the horizontal scroll bar.
-
-
setIcon(Frame) - Static method in class Toolkit
-
 
-
setIcon(Window) - Static method in class Toolkit
-
-
Give this Frame the Processing icon set.
-
-
setIgnoreCase(boolean) - Method in class KeywordMap
-
-
Sets if the keyword map should be case insensitive.
-
-
setInputHandler(InputHandler) - Method in class JEditTextArea
-
-
Sets the input handler.
-
-
setInt(int, int) - Method in class JSONArray
-
-
Put or replace an int value.
-
-
setInt(String, int) - Method in class JSONObject
-
-
Put a key/int pair in the JSONObject.
-
-
setInt(int, int, int) - Method in class Table
-
 
-
setInt(int, String, int) - Method in class Table
-
 
-
setInt(int, int) - Method in interface TableRow
-
 
-
setInt(String, int) - Method in interface TableRow
-
 
-
setInt(String, int) - Method in class XML
-
 
-
setIntContent(int) - Method in class XML
-
 
-
setInteger(String, int) - Static method in class Preferences
-
 
-
setInteger(String, int) - Method in class Settings
-
 
-
setIntValue(WindowsRegistry.REGISTRY_ROOT_KEY, String, String, int) - Static method in class WindowsRegistry
-
-
Writes an int value.
-
-
setJSONArray(int, JSONArray) - Method in class JSONArray
-
 
-
setJSONArray(String, JSONArray) - Method in class JSONObject
-
 
-
setJSONObject(int, JSONObject) - Method in class JSONArray
-
 
-
setJSONObject(String, JSONObject) - Method in class JSONObject
-
 
-
setKind(int) - Method in class PShape
-
 
-
setLineHighlightEnabled(boolean) - Method in class TextAreaPainter
-
-
Enables or disables current line highlighting.
-
-
setLineText(int, String) - Method in class Editor
-
-
Replace the text on a specified line.
-
-
setLoaded() - Method in class PImage
-
 
-
setLoaded(boolean) - Method in class PImage
-
 
-
setLong(int, long) - Method in class JSONArray
-
-
Put or replace a long value.
-
-
setLong(String, long) - Method in class JSONObject
-
-
Put a key/long pair in the JSONObject.
-
-
setLong(int, int, long) - Method in class Table
-
 
-
setLong(int, String, long) - Method in class Table
-
 
-
setLong(int, long) - Method in interface TableRow
-
 
-
setLong(String, long) - Method in interface TableRow
-
 
-
setLong(String, long) - Method in class XML
-
 
-
setLongContent(long) - Method in class XML
-
 
-
setLookAndFeel() - Method in class Platform
-
-
Set the default L & F.
-
-
setMacroRecorder(InputHandler.MacroRecorder) - Method in class InputHandler
-
-
Sets the macro recorder.
-
-
setMag(float) - Method in class PVector
-
-
( begin auto-generated from PVector_setMag.xml ) - - Set the magnitude of this vector to the value used for the len parameter.
-
-
setMag(PVector, float) - Method in class PVector
-
-
Sets the magnitude of this vector, storing the result in another vector.
-
-
setMagicCaretPosition(int) - Method in class JEditTextArea
-
-
Sets the 'magic' caret position.
-
-
setMatrix(PMatrix) - Method in class PApplet
-
-
Set the current transformation matrix to the contents of another.
-
-
setMatrix(PMatrix2D) - Method in class PApplet
-
-
Set the current transformation to the contents of the specified source.
-
-
setMatrix(PMatrix3D) - Method in class PApplet
-
-
Set the current transformation to the contents of the specified source.
-
-
setMatrix(PMatrix) - Method in class PGraphics
-
-
Set the current transformation matrix to the contents of another.
-
-
setMatrix(PMatrix2D) - Method in class PGraphics
-
-
Set the current transformation to the contents of the specified source.
-
-
setMatrix(PMatrix3D) - Method in class PGraphics
-
-
Set the current transformation to the contents of the specified source.
-
-
setMatrix(PMatrix2D) - Method in class PGraphicsFX2D
-
 
-
setMatrix(PMatrix3D) - Method in class PGraphicsFX2D
-
 
-
setMatrix(PMatrix2D) - Method in class PGraphicsJava2D
-
 
-
setMatrix(PMatrix3D) - Method in class PGraphicsJava2D
-
 
-
setMatrix(PMatrix3D) - Method in class PGraphics2D
-
 
-
setMatrix(PMatrix2D) - Method in class PGraphicsOpenGL
-
 
-
setMatrix(PMatrix3D) - Method in class PGraphicsOpenGL
-
-
Set the current transformation to the contents of the specified source.
-
-
setMenuMnemonics(JMenuItem...) - Static method in class Toolkit
-
-
Removes all mnemonics, then sets a mnemonic for each menu and menu item - recursively by these rules: - - It tries to assign one of - KDE's defaults. - Failing that, it loops through the first letter of each word, where a word - is a block of Unicode "alphabetical" chars, looking for an upper-case ASCII mnemonic - that is not taken.
-
-
setMenuMnemonics(JMenuBar) - Static method in class Toolkit
-
-
As setMenuMnemonics(JMenuItem...).
-
-
setMenuMnemonics(JPopupMenu) - Static method in class Toolkit
-
-
As setMenuMnemonics(JMenuItem...).
-
-
setMenuMnemsInside(JMenu) - Static method in class Toolkit
-
-
Calls setMenuMnemonics(JMenuItem...) on the sub-elements only.
-
-
setMessage(String) - Method in exception SketchException
-
 
-
setMissingDouble(double) - Method in class Table
-
 
-
setMissingFloat(float) - Method in class Table
-
 
-
setMissingInt(int) - Method in class Table
-
 
-
setMissingLong(long) - Method in class Table
-
 
-
setMissingString(String) - Method in class Table
-
-
Treat entries with this string as "missing".
-
-
setModified(boolean) - Method in class Sketch
-
-
Sets the modified value for the code in the frontmost tab.
-
-
setModified(boolean) - Method in class SketchCode
-
 
-
setModified() - Method in class PImage
-
 
-
setModified(boolean) - Method in class PImage
-
 
-
setModified() - Method in class Texture
-
 
-
setModified(boolean) - Method in class Texture
-
 
-
setName(String) - Method in class PShape
-
 
-
setName(String) - Method in class XML
-
 
-
setNative(Object) - Method in class PFont
-
-
Set the native complement of this font.
-
-
setNative(int[]) - Method in class Texture
-
 
-
setNative(int[], int, int, int, int) - Method in class Texture
-
 
-
setNative(IntBuffer, int, int, int, int) - Method in class Texture
-
 
-
setNormal(int, float, float, float) - Method in class PShape
-
 
-
setNormal(int, float, float, float) - Method in class PShapeOpenGL
-
 
-
setNotification(Component, boolean) - Method in class EditorFooter
-
 
-
setOrigin(int, int) - Method in class JEditTextArea
-
-
A fast way of changing both the first line and horizontal - offset.
-
-
setOutput(LineStroker) - Method in class LineStroker
-
-
Sets the output LineStroker of this LineStroker.
-
-
setOverwriteEnabled(boolean) - Method in class JEditTextArea
-
-
Sets if overwrite mode should be enabled.
-
-
setPanel(Component) - Method in class EditorFooter
-
 
-
setParameters(int, int, int, int, PMatrix2D) - Method in class LineStroker
-
-
Sets the parameters of this LineStroker.
-
-
setParams(float[]) - Method in class PShapeOpenGL
-
 
-
setParent(PApplet) - Method in class PGraphics
-
 
-
setPath(String) - Method in class PGraphics
-
 
-
setPath(int, float[][]) - Method in class PShape
-
 
-
setPath(int, float[][], int, int[]) - Method in class PShapeOpenGL
-
 
-
setPreprocOffset(int) - Method in class SketchCode
-
 
-
setPressed(boolean) - Method in class EditorButton
-
 
-
setPrimary(boolean) - Method in class PGraphics
-
-
Set (or unset) this as the main drawing surface.
-
-
setPrimary(boolean) - Method in class PGL
-
 
-
setPrimary(boolean) - Method in class PGraphicsOpenGL
-
 
-
setProgram(String) - Method in class SketchCode
-
-
set the current text for this tab
-
-
setProgressBarStatus(int) - Method in class ProgressFrame.TaskAddFile
-
 
-
setProgressBarStatus(int) - Method in class ProgressFrame.TaskSaveAs
-
 
-
setProjection(PMatrix3D) - Method in class PGraphicsOpenGL
-
 
-
setRepeatCount(int) - Method in class InputHandler
-
-
Sets the number of times the next action will be repeated.
-
-
setRepeatEnabled(boolean) - Method in class InputHandler
-
-
Enables repeating.
-
-
setResizable(boolean) - Method in interface PSurface
-
-
Set true if we want to resize things (default is not resizable)
-
-
setResizable(boolean) - Method in class PSurfaceAWT
-
-
Set true if we want to resize things (default is not resizable)
-
-
setResizable(boolean) - Method in class PSurfaceFX
-
-
Set true if we want to resize things (default is not resizable)
-
-
setResizable(boolean) - Method in class PSurfaceNone
-
-
Set true if we want to resize things (default is not resizable)
-
-
setResizable(boolean) - Method in class PSurfaceJOGL
-
 
-
setReverse() - Method in class EditorButton
-
 
-
setRightClickPopup(JPopupMenu) - Method in class JEditTextArea
-
-
Sets the right click popup menu.
-
-
setRolloverLabel(JLabel) - Method in class EditorButton
-
 
-
setRow(int, TableRow) - Method in class Table
-
 
-
setRow(int, Object[]) - Method in class Table
-
 
-
setRowCount(int) - Method in class Table
-
 
-
setScrollPosition(int) - Method in class JEditTextArea
-
- -
-
setSelected(boolean) - Method in class EditorButton
-
 
-
setSelectedText(String) - Method in class Editor
-
 
-
setSelectedText(String) - Method in class JEditTextArea
-
-
Replaces the selection with the specified text.
-
-
setSelection(int, int) - Method in class Editor
-
 
-
setSelectionEnd(int) - Method in class JEditTextArea
-
-
Sets the selection end.
-
-
setSelectionRectangular(boolean) - Method in class JEditTextArea
-
-
Sets if the selection should be rectangular.
-
-
setSelectionStart(int) - Method in class JEditTextArea
-
-
Sets the selection start.
-
-
setShininess(float) - Method in class PShape
-
 
-
setShininess(int, float) - Method in class PShape
-
 
-
setShininess(float) - Method in class PShapeOpenGL
-
 
-
setShininess(int, float) - Method in class PShapeOpenGL
-
 
-
setSize(int, int) - Method in class PGraphics
-
-
The final step in setting up a renderer, set its size of this renderer.
-
-
setSize(int, int) - Method in interface PSurface
-
 
-
setSize(int, int) - Method in class PSurfaceAWT
-
 
-
setSize(int, int) - Method in class PSurfaceFX
-
 
-
setSize(int, int) - Method in class PSurfaceNone
-
 
-
setSize(int, int) - Method in class PGraphicsOpenGL
-
 
-
setSize(int, int) - Method in class PSurfaceJOGL
-
 
-
setSketchbookFolder(File) - Method in class Base
-
 
-
setSketchLocation(Point) - Method in class Editor
-
-
Set the location of the sketch run window.
-
-
setSmooth(int) - Method in interface PSurface
-
-
Sometimes smoothing must be set at the drawing surface level - not just inside the renderer itself.
-
-
setSmooth(int) - Method in class PSurfaceAWT
-
 
-
setSmooth(int) - Method in class PSurfaceFX
-
 
-
setSmooth(int) - Method in class PSurfaceNone
-
 
-
setSmooth(int) - Method in class PSurfaceJOGL
-
 
-
setSpecular(int) - Method in class PShape
-
 
-
setSpecular(int, int) - Method in class PShape
-
 
-
setSpecular(int) - Method in class PShapeOpenGL
-
 
-
setSpecular(int, int) - Method in class PShapeOpenGL
-
 
-
setString(int, String) - Method in class JSONArray
-
-
Put or replace a String value.
-
-
setString(String, String) - Method in class JSONObject
-
 
-
setString(int, int, String) - Method in class Table
-
 
-
setString(int, String, String) - Method in class Table
-
 
-
setString(int, String) - Method in interface TableRow
-
 
-
setString(String, String) - Method in interface TableRow
-
 
-
setString(String, String) - Method in class XML
-
 
-
setStringValue(WindowsRegistry.REGISTRY_ROOT_KEY, String, String, String) - Static method in class WindowsRegistry
-
-
Writes a String value.
-
-
setStroke(boolean) - Method in class PShape
-
 
-
setStroke(int) - Method in class PShape
-
 
-
setStroke(int, int) - Method in class PShape
-
 
-
setStroke(boolean) - Method in class PShapeOpenGL
-
 
-
setStroke(int) - Method in class PShapeOpenGL
-
 
-
setStroke(int, int) - Method in class PShapeOpenGL
-
 
-
setStrokeCap(int) - Method in class PShape
-
 
-
setStrokeCap(int) - Method in class PShapeOpenGL
-
 
-
setStrokeJoin(int) - Method in class PShape
-
 
-
setStrokeJoin(int) - Method in class PShapeOpenGL
-
 
-
setStrokeWeight(float) - Method in class PShape
-
 
-
setStrokeWeight(int, float) - Method in class PShape
-
 
-
setStrokeWeight(float) - Method in class PShapeOpenGL
-
 
-
setStrokeWeight(int, float) - Method in class PShapeOpenGL
-
 
-
setSubsetting() - Method in class PFont
-
 
-
setTableType(String) - Method in class Table
-
-
Set the entire table to a specific data type.
-
-
setText(String) - Method in class Editor
-
-
Replace the entire contents of the front-most tab.
-
-
setText(String) - Method in class JEditTextArea
-
-
Sets the entire text of this text area.
-
-
setTexture(PImage) - Method in class PShape
-
 
-
setTexture(PImage) - Method in class PShapeOpenGL
-
 
-
setTextureMode(int) - Method in class PShape
-
 
-
setTextureMode(int) - Method in class PShapeOpenGL
-
 
-
setTextureUV(int, float, float) - Method in class PShape
-
 
-
setTextureUV(int, float, float) - Method in class PShapeOpenGL
-
 
-
setThread(Thread) - Method in class PGL
-
 
-
Settings - Class in processing.app
-
-
Storage class for theme settings.
-
-
Settings(File) - Constructor for class Settings
-
 
-
settings() - Method in class PApplet
-
-
( begin auto-generated from settings.xml ) - - Description to come...
-
-
setTint(boolean) - Method in class PShape
-
 
-
setTint(int) - Method in class PShape
-
 
-
setTint(int, int) - Method in class PShape
-
 
-
setTint(boolean) - Method in class PShapeOpenGL
-
 
-
setTint(int) - Method in class PShapeOpenGL
-
 
-
setTint(int, int) - Method in class PShapeOpenGL
-
 
-
setTitle(String) - Method in interface PSurface
-
-
Set the window (and dock, or whatever necessary) title.
-
-
setTitle(String) - Method in class PSurfaceAWT
-
-
Set the window (and dock, or whatever necessary) title.
-
-
setTitle(String) - Method in class PSurfaceFX
-
-
Set the window (and dock, or whatever necessary) title.
-
-
setTitle(String) - Method in class PSurfaceNone
-
-
Set the window (and dock, or whatever necessary) title.
-
-
setTitle(String) - Method in class PSurfaceJOGL
-
 
-
setTokenMarker(TokenMarker) - Method in class JEditTextArea
-
-
Sets the document's token marker.
-
-
setTokenMarker(TokenMarker) - Method in class SyntaxDocument
-
-
Sets the token marker that is to be used to split lines of - this document up into tokens.
-
-
setUntitled(boolean) - Method in class Sketch
-
 
-
setup() - Method in class PApplet
-
-
( begin auto-generated from setup.xml ) - - The setup() function is called once when the program starts.
-
-
setupExternalMessages() - Method in interface PSurface
-
 
-
setupExternalMessages() - Method in class PSurfaceAWT
-
-
Set this sketch to communicate its state back to the PDE.
-
-
setupExternalMessages() - Method in class PSurfaceFX
-
 
-
setupExternalMessages() - Method in class PSurfaceNone
-
 
-
setupExternalMessages() - Method in class PSurfaceJOGL
-
 
-
setupFrameResizeListener() - Method in class PSurfaceAWT
-
-
Set up a listener that will fire proper component resize events - in cases where frame.setResizable(true) is called.
-
-
setupGUI() - Method in class Mode
-
-
Setup additional elements that are only required when running with a GUI, - rather than from the command-line.
-
-
setVertex(int, float, float) - Method in class PShape
-
 
-
setVertex(int, float, float, float) - Method in class PShape
-
 
-
setVertex(int, PVector) - Method in class PShape
-
 
-
setVertex(int, float, float) - Method in class PShapeOpenGL
-
 
-
setVertex(int, float, float, float) - Method in class PShapeOpenGL
-
 
-
setVertex(int, PVector) - Method in class PShapeOpenGL
-
 
-
setVertexShader(String) - Method in class PShader
-
 
-
setVertexShader(URL) - Method in class PShader
-
 
-
setVertexShader(String[]) - Method in class PShader
-
 
-
setVerticalScrollPosition(int) - Method in class JEditTextArea
-
-
Set position of the vertical scroll bar.
-
-
setVisible(boolean) - Method in class PShape
-
-
( begin auto-generated from PShape_setVisible.xml ) - - Sets the shape to be visible or invisible.
-
-
setVisible(boolean) - Method in interface PSurface
-
-
Show or hide the window.
-
-
setVisible(boolean) - Method in class PSurfaceAWT
-
 
-
setVisible(boolean) - Method in class PSurfaceFX
-
-
Show or hide the window.
-
-
setVisible(boolean) - Method in class PSurfaceNone
-
-
Show or hide the window.
-
-
setVisible(boolean) - Method in class PSurfaceJOGL
-
 
-
setWidth - Variable in class PFont.Glyph
-
 
-
setWindingRule(int) - Method in class LinePath
-
-
Sets the winding rule for this path to the specified value.
-
-
SG - Static variable in class PGraphics
-
 
-
shader(PShader) - Method in class PApplet
-
-
( begin auto-generated from shader.xml ) - - This is a new reference entry for Processing 2.0.
-
-
shader(PShader, int) - Method in class PApplet
-
 
-
shader(PShader) - Method in class PGraphics
-
-
( begin auto-generated from shader.xml ) - - This is a new reference entry for Processing 2.0.
-
-
shader(PShader, int) - Method in class PGraphics
-
 
-
shader(PShader) - Method in class PGraphicsOpenGL
-
 
-
shader(PShader, int) - Method in class PGraphicsOpenGL
-
 
-
SHADER_SOURCE_LENGTH - Static variable in class PGL
-
 
-
SHADER_TYPE - Static variable in class PGL
-
 
-
shaderBinary(int, IntBuffer, int, Buffer, int) - Method in class PGL
-
 
-
shaderBinary(int, IntBuffer, int, Buffer, int) - Method in class PJOGL
-
 
-
shaderSource(int, String) - Method in class PGL
-
 
-
shaderSource(int, String) - Method in class PJOGL
-
 
-
SHADING_LANGUAGE_VERSION - Static variable in class PGL
-
 
-
shape(PShape) - Method in class PApplet
-
 
-
shape(PShape, float, float) - Method in class PApplet
-
-
( begin auto-generated from shape.xml ) - - Displays shapes to the screen.
-
-
shape(PShape, float, float, float, float) - Method in class PApplet
-
 
-
SHAPE - Static variable in interface PConstants
-
-
textMode(SHAPE) draws text using the the glyph outlines of - individual characters rather than as textures.
-
-
shape(PShape) - Method in class PGraphics
-
 
-
shape(PShape, float, float) - Method in class PGraphics
-
-
( begin auto-generated from shape.xml ) - - Displays shapes to the screen.
-
-
shape(PShape, float, float, float, float) - Method in class PGraphics
-
 
-
shape(PShape) - Method in class PGraphics2D
-
 
-
shape(PShape, float, float) - Method in class PGraphics2D
-
 
-
shape(PShape, float, float, float, float) - Method in class PGraphics2D
-
 
-
shape(PShape, float, float, float) - Method in class PGraphics2D
-
 
-
shape(PShape, float, float, float, float, float, float) - Method in class PGraphics2D
-
 
-
shapeMode(int) - Method in class PApplet
-
-
( begin auto-generated from shapeMode.xml ) - - Modifies the location from which shapes draw.
-
-
shapeMode - Variable in class PGraphics
-
-
The current shape alignment mode (read-only)
-
-
shapeMode(int) - Method in class PGraphics
-
-
( begin auto-generated from shapeMode.xml ) - - Modifies the location from which shapes draw.
-
-
shapeMode - Variable in class PStyle
-
 
-
shearX(float) - Method in class PApplet
-
-
( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter.
-
-
shearX(float) - Method in class PGraphics
-
-
( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter.
-
-
shearX(float) - Method in class PGraphicsFX2D
-
 
-
shearX(float) - Method in class PGraphicsJava2D
-
 
-
shearX(float) - Method in interface PMatrix
-
 
-
shearX(float) - Method in class PMatrix2D
-
 
-
shearX(float) - Method in class PMatrix3D
-
 
-
shearX(float) - Method in class PGraphicsOpenGL
-
 
-
shearY(float) - Method in class PApplet
-
-
( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter.
-
-
shearY(float) - Method in class PGraphics
-
-
( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter.
-
-
shearY(float) - Method in class PGraphicsFX2D
-
 
-
shearY(float) - Method in class PGraphicsJava2D
-
 
-
shearY(float) - Method in interface PMatrix
-
 
-
shearY(float) - Method in class PMatrix2D
-
 
-
shearY(float) - Method in class PMatrix3D
-
 
-
shearY(float) - Method in class PGraphicsOpenGL
-
 
-
SHIFT - Static variable in interface PConstants
-
 
-
SHIFT - Static variable in class Event
-
 
-
shiftExpression() - Method in class JavaRecognizer
-
 
-
shiftExpression() - Method in class PdeRecognizer
-
 
-
SHINE - Static variable in class PGraphics
-
 
-
shininess(float) - Method in class PApplet
-
-
( begin auto-generated from shininess.xml ) - - Sets the amount of gloss in the surface of shapes.
-
-
shininess - Variable in class PGraphics
-
 
-
shininess(float) - Method in class PGraphics
-
-
( begin auto-generated from shininess.xml ) - - Sets the amount of gloss in the surface of shapes.
-
-
shininess(float) - Method in class PShape
-
 
-
shininess - Variable in class PStyle
-
 
-
SHORT - Static variable in class PGL
-
 
-
shorten(boolean[]) - Static method in class PApplet
-
-
( begin auto-generated from shorten.xml ) - - Decreases an array by one element and returns the shortened array.
-
-
shorten(byte[]) - Static method in class PApplet
-
 
-
shorten(char[]) - Static method in class PApplet
-
 
-
shorten(int[]) - Static method in class PApplet
-
 
-
shorten(float[]) - Static method in class PApplet
-
 
-
shorten(String[]) - Static method in class PApplet
-
 
-
shorten(Object) - Static method in class PApplet
-
 
-
show() - Method in class ColorChooser
-
 
-
showChanges() - Static method in class Editor
-
 
-
showCursor() - Method in interface PSurface
-
 
-
showCursor() - Method in class PSurfaceAWT
-
 
-
showCursor() - Method in class PSurfaceFX
-
 
-
showCursor() - Method in class PSurfaceNone
-
 
-
showCursor() - Method in class PSurfaceJOGL
-
 
-
showDepthWarning(String) - Static method in class PApplet
-
-
Display a warning that the specified method is only available with 3D.
-
-
showDepthWarning(String) - Static method in class PGraphics
-
-
Display a warning that the specified method is only available with 3D.
-
-
showDepthWarningXYZ(String) - Static method in class PApplet
-
-
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.
-
-
showDepthWarningXYZ(String) - Static method in class PGraphics
-
-
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.
-
-
showError(String, String, Throwable) - Static method in class Base
-
-
Show an error message that's actually fatal to the program.
-
-
showExamplesFrame() - Method in class Mode
-
 
-
showException(String) - Static method in class PGraphics
-
-
Show an renderer-related exception that halts the program.
-
-
showFrame(Editor) - Method in class ContributionManagerDialog
-
 
-
showMessage(String, String) - Static method in class Base
-
-
"No cookie for you" type messages.
-
-
showMethodWarning(String) - Static method in class PApplet
-
-
Display a warning that the specified method is simply unavailable.
-
-
showMethodWarning(String) - Static method in class PGraphics
-
-
Display a warning that the specified method is simply unavailable.
-
-
showMissingWarning(String) - Static method in class PApplet
-
-
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.
-
-
showMissingWarning(String) - Static method in class PGraphics
-
-
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.
-
-
showReference(String) - Method in class Editor
-
 
-
showReferenceFile(File) - Method in class Editor
-
-
Given the .html file, displays it in the default browser.
-
-
showSketchbookFrame() - Method in class Mode
-
 
-
showStackTrace() - Method in exception SketchException
-
 
-
showTodoWarning(String, int) - Static method in class PGraphicsFX2D
-
-
Display a warning that the specified method is simply unavailable.
-
-
showVariationWarning(String) - Static method in class PApplet
-
-
Error that a particular variation of a method is unavailable (even though - other variations are).
-
-
showVariationWarning(String) - Static method in class PGraphics
-
-
Error that a particular variation of a method is unavailable (even though - other variations are).
-
-
showWarning(String, String) - Static method in class Base
-
-
Non-fatal error message.
-
-
showWarning(String, String, Throwable) - Static method in class Base
-
-
Non-fatal error message with optional stack trace side dish.
-
-
showWarning(String) - Static method in class PGraphics
-
-
Show a renderer error, and keep track of it so that it's only shown once.
-
-
showWarning(String, Object...) - Static method in class PGraphics
-
-
Version of showWarning() that takes a parsed String.
-
-
showWarningTiered(String, String, String, Throwable) - Static method in class Base
-
-
Non-fatal error message with optional stack trace side dish.
-
-
showYesNoCancelQuestion(Editor, String, String, String) - Static method in class Base
-
 
-
showYesNoQuestion(Frame, String, String, String) - Static method in class Base
-
 
-
shuffle() - Method in class FloatList
-
-
Randomize the order of the list elements.
-
-
shuffle(PApplet) - Method in class FloatList
-
-
Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
-
-
shuffle() - Method in class IntList
-
-
Randomize the order of the list elements.
-
-
shuffle(PApplet) - Method in class IntList
-
-
Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
-
-
shuffle() - Method in class StringList
-
-
Randomize the order of the list elements.
-
-
shuffle(PApplet) - Method in class StringList
-
-
Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
-
-
sin(float) - Static method in class PApplet
-
-
( begin auto-generated from sin.xml ) - - Calculates the sine of an angle.
-
-
SingleInstance - Class in processing.app
-
-
Class that handles a small server that prevents multiple instances of - Processing from running simultaneously.
-
-
SingleInstance() - Constructor for class SingleInstance
-
 
-
size(int, int) - Method in class PApplet
-
-
( begin auto-generated from size.xml ) - - Defines the dimension of the display window in units of pixels.
-
-
size(int, int, String) - Method in class PApplet
-
 
-
size(int, int, String, String) - Method in class PApplet
-
 
-
size() - Method in class FloatDict
-
 
-
size() - Method in class FloatList
-
-
Get the length of the list.
-
-
size() - Method in class IntDict
-
-
Returns the number of key/value pairs
-
-
size() - Method in class IntList
-
-
Get the length of the list.
-
-
size() - Method in class JSONArray
-
-
Get the number of elements in the JSONArray, included nulls.
-
-
size() - Method in class JSONObject
-
-
Get the number of keys stored in the JSONObject.
-
-
size() - Method in class Sort
-
 
-
size() - Method in class StringDict
-
 
-
size() - Method in class StringList
-
-
Get the length of the list.
-
-
Sketch - Class in processing.app
-
-
Stores information about files in the current sketch.
-
-
Sketch(String, Mode) - Constructor for class Sketch
-
-
Used by the command-line version to create a sketch object.
-
-
Sketch(String, Editor) - Constructor for class Sketch
-
-
path is location of the main .pde file, because this is also - simplest to use when opening the file from the finder/explorer.
-
-
sketchbookCallback(File) - Method in class PreferencesFrame
-
-
Callback for the folder selector.
-
-
SketchCode - Class in processing.app
-
-
Represents a single tab of a sketch.
-
-
SketchCode(File, String) - Constructor for class SketchCode
-
 
-
sketchDisplay() - Method in class PApplet
-
 
-
SketchException - Exception in processing.app
-
-
An exception with a line number attached that occurs - during either pre-processing, compile, or run time.
-
-
SketchException(String) - Constructor for exception SketchException
-
 
-
SketchException(String, boolean) - Constructor for exception SketchException
-
 
-
SketchException(String, int, int) - Constructor for exception SketchException
-
 
-
SketchException(String, int, int, int) - Constructor for exception SketchException
-
 
-
SketchException(String, int, int, int, boolean) - Constructor for exception SketchException
-
 
-
sketchFile(String) - Method in class PApplet
-
 
-
sketchFullScreen() - Method in class PApplet
-
 
-
sketchHeight() - Method in class PApplet
-
 
-
sketchOutputPath() - Method in class PApplet
-
 
-
sketchOutputStream() - Method in class PApplet
-
 
-
sketchPath() - Method in class PApplet
-
 
-
sketchPath(String) - Method in class PApplet
-
-
Prepend the sketch folder path to the filename (or path) that is - passed in.
-
-
sketchPixelDensity() - Method in class PApplet
-
 
-
SketchReference - Class in processing.app
-
 
-
SketchReference(String, File) - Constructor for class SketchReference
-
 
-
sketchRenderer() - Method in class PApplet
-
 
-
sketchSmooth() - Method in class PApplet
-
 
-
sketchWidth() - Method in class PApplet
-
 
-
sketchWindowColor() - Method in class PApplet
-
 
-
SL - Static variable in interface JavaTokenTypes
-
 
-
SL - Static variable in interface PdePartialTokenTypes
-
 
-
SL - Static variable in interface PdeTokenTypes
-
 
-
SL_ASSIGN - Static variable in interface JavaTokenTypes
-
 
-
SL_ASSIGN - Static variable in interface PdePartialTokenTypes
-
 
-
SL_ASSIGN - Static variable in interface PdeTokenTypes
-
 
-
SL_COMMENT - Static variable in interface JavaTokenTypes
-
 
-
SL_COMMENT - Static variable in interface PdePartialTokenTypes
-
 
-
SL_COMMENT - Static variable in interface PdeTokenTypes
-
 
-
SLIST - Static variable in interface JavaTokenTypes
-
 
-
SLIST - Static variable in interface PdePartialTokenTypes
-
 
-
SLIST - Static variable in interface PdeTokenTypes
-
 
-
SMART_HOME_END_PROPERTY - Static variable in class 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 PApplet
-
 
-
smooth(int) - Method in class PApplet
-
 
-
smooth - Variable in class PGraphics
-
 
-
smooth() - Method in class PGraphics
-
 
-
smooth(int) - Method in class PGraphics
-
 
-
SOFT_LIGHT - Static variable in interface PConstants
-
 
-
solid(boolean) - Method in class PShapeOpenGL
-
 
-
sort(byte[]) - Static method in class PApplet
-
-
( begin auto-generated from sort.xml ) - - Sorts an array of numbers from smallest to largest and puts an array of - words in alphabetical order.
-
-
sort(byte[], int) - Static method in class PApplet
-
 
-
sort(char[]) - Static method in class PApplet
-
 
-
sort(char[], int) - Static method in class PApplet
-
 
-
sort(int[]) - Static method in class PApplet
-
 
-
sort(int[], int) - Static method in class PApplet
-
 
-
sort(float[]) - Static method in class PApplet
-
 
-
sort(float[], int) - Static method in class PApplet
-
 
-
sort(String[]) - Static method in class PApplet
-
 
-
sort(String[], int) - Static method in class PApplet
-
 
-
sort() - Method in class FloatList
-
-
Sorts the array in place.
-
-
sort() - Method in class IntList
-
-
Sorts the array in place.
-
-
Sort - Class in processing.data
-
-
Internal sorter used by several data classes.
-
-
Sort() - Constructor for class Sort
-
 
-
sort() - Method in class StringList
-
-
Sorts the array in place.
-
-
sort(String) - Method in class Table
-
 
-
sort(int) - Method in class Table
-
 
-
sortKeys() - Method in class FloatDict
-
-
Sort the keys alphabetically (ignoring case).
-
-
sortKeys() - Method in class IntDict
-
-
Sort the keys alphabetically (ignoring case).
-
-
sortKeys() - Method in class StringDict
-
-
Sort the keys alphabetically (ignoring case).
-
-
sortKeysReverse() - Method in class FloatDict
-
 
-
sortKeysReverse() - Method in class IntDict
-
-
Sort the keys alphabetically in reverse (ignoring case).
-
-
sortKeysReverse() - Method in class StringDict
-
 
-
sortReverse() - Method in class FloatList
-
-
Reverse sort, orders values from highest to lowest
-
-
sortReverse() - Method in class IntList
-
-
Reverse sort, orders values from highest to lowest.
-
-
sortReverse() - Method in class StringList
-
-
Reverse sort, orders values from highest to lowest.
-
-
sortReverse(String) - Method in class Table
-
 
-
sortReverse(int) - Method in class Table
-
 
-
sortValues() - Method in class FloatDict
-
-
Sort by values in descending order (largest value will be at [0]).
-
-
sortValues() - Method in class IntDict
-
-
Sort by values in ascending order.
-
-
sortValues() - Method in class StringDict
-
-
Sort by values in descending order (largest value will be at [0]).
-
-
sortValuesReverse() - Method in class FloatDict
-
 
-
sortValuesReverse() - Method in class IntDict
-
-
Sort by values in descending order.
-
-
sortValuesReverse() - Method in class StringDict
-
 
-
SPAN - Static variable in interface PConstants
-
-
Use with fullScreen() to indicate all available displays.
-
-
SPB - Static variable in class PGraphics
-
 
-
specular(int) - Method in class PApplet
-
-
( begin auto-generated from specular.xml ) - - Sets the specular color of the materials used for shapes drawn to the - screen, which sets the color of hightlights.
-
-
specular(float) - Method in class PApplet
-
-
gray number specifying value between white and black
-
-
specular(float, float, float) - Method in class PApplet
-
 
-
specular(int) - Method in class PGraphics
-
-
( begin auto-generated from specular.xml ) - - Sets the specular color of the materials used for shapes drawn to the - screen, which sets the color of hightlights.
-
-
specular(float) - Method in class PGraphics
-
-
gray number specifying value between white and black
-
-
specular(float, float, float) - Method in class PGraphics
-
 
-
specular(int) - Method in class PShape
-
 
-
specular(float) - Method in class PShape
-
 
-
specular(float, float, float) - Method in class PShape
-
 
-
specularB - Variable in class PGraphics
-
 
-
specularB - Variable in class PStyle
-
 
-
specularColor - Variable in class PGraphics
-
 
-
specularG - Variable in class PGraphics
-
 
-
specularG - Variable in class PStyle
-
 
-
specularR - Variable in class PGraphics
-
 
-
specularR - Variable in class PStyle
-
 
-
SPG - Static variable in class PGraphics
-
 
-
sphere(float) - Method in class PApplet
-
-
( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles.
-
-
SPHERE - Static variable in interface PConstants
-
 
-
sphere(float) - Method in class PGraphics
-
-
( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles.
-
-
sphere(float) - Method in class PGraphicsFX2D
-
 
-
sphere(float) - Method in class PGraphicsJava2D
-
 
-
sphere(float) - Method in class PGraphics2D
-
 
-
sphere(float) - Method in class PGraphicsOpenGL
-
 
-
sphereDetail(int) - Method in class PApplet
-
-
( begin auto-generated from sphereDetail.xml ) - - Controls the detail used to render a sphere by adjusting the number of - vertices of the sphere mesh.
-
-
sphereDetail(int, int) - Method in class PApplet
-
 
-
sphereDetail(int) - Method in class PGraphics
-
-
( begin auto-generated from sphereDetail.xml ) - - Controls the detail used to render a sphere by adjusting the number of - vertices of the sphere mesh.
-
-
sphereDetail(int, int) - Method in class PGraphics
-
 
-
sphereDetailU - Variable in class PGraphics
-
 
-
sphereDetailV - Variable in class PGraphics
-
 
-
splice(boolean[], boolean, int) - Static method in class PApplet
-
-
( begin auto-generated from splice.xml ) - - Inserts a value or array of values into an existing array.
-
-
splice(boolean[], boolean[], int) - Static method in class PApplet
-
 
-
splice(byte[], byte, int) - Static method in class PApplet
-
 
-
splice(byte[], byte[], int) - Static method in class PApplet
-
 
-
splice(char[], char, int) - Static method in class PApplet
-
 
-
splice(char[], char[], int) - Static method in class PApplet
-
 
-
splice(int[], int, int) - Static method in class PApplet
-
 
-
splice(int[], int[], int) - Static method in class PApplet
-
 
-
splice(float[], float, int) - Static method in class PApplet
-
 
-
splice(float[], float[], int) - Static method in class PApplet
-
 
-
splice(String[], String, int) - Static method in class PApplet
-
 
-
splice(String[], String[], int) - Static method in class PApplet
-
 
-
splice(Object, Object, int) - Static method in class PApplet
-
 
-
split(String, char) - Static method in class PApplet
-
-
( begin auto-generated from split.xml ) - - The split() function breaks a string into pieces using a character or - string as the divider.
-
-
split(String, String) - Static method in class PApplet
-
 
-
splitTokens(String) - Static method in class PApplet
-
 
-
splitTokens(String, String) - Static method in class PApplet
-
-
( begin auto-generated from splitTokens.xml ) - - The splitTokens() function splits a String at one or many character - "tokens." The tokens parameter specifies the character or - characters to be used as a boundary.
-
-
SPOT - Static variable in interface PConstants
-
 
-
spotLight(float, float, float, float, float, float, float, float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from spotLight.xml ) - - Adds a spot light.
-
-
spotLight(float, float, float, float, float, float, float, float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from spotLight.xml ) - - Adds a spot light.
-
-
spotLight(float, float, float, float, float, float, float, float, float, float, float) - Method in class PGraphics2D
-
 
-
spotLight(float, float, float, float, float, float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
SPR - Static variable in class PGraphics
-
 
-
sq(float) - Static method in class PApplet
-
-
( begin auto-generated from sq.xml ) - - Squares a number (multiplies a number by itself).
-
-
sqrt(float) - Static method in class PApplet
-
-
( begin auto-generated from sqrt.xml ) - - Calculates the square root of a number.
-
-
SQUARE - Static variable in interface PConstants
-
 
-
SR - Static variable in class PGraphics
-
-
stroke argb values
-
-
SR - Static variable in interface JavaTokenTypes
-
 
-
SR - Static variable in interface PdePartialTokenTypes
-
 
-
SR - Static variable in interface PdeTokenTypes
-
 
-
SR_ASSIGN - Static variable in interface JavaTokenTypes
-
 
-
SR_ASSIGN - Static variable in interface PdePartialTokenTypes
-
 
-
SR_ASSIGN - Static variable in interface PdeTokenTypes
-
 
-
SRC_ALPHA - Static variable in class PGL
-
 
-
SRC_ALPHA_SATURATE - Static variable in class PGL
-
 
-
SRC_COLOR - Static variable in class PGL
-
 
-
STAR - Static variable in interface JavaTokenTypes
-
 
-
STAR - Static variable in interface PdePartialTokenTypes
-
 
-
STAR - Static variable in interface PdeTokenTypes
-
 
-
STAR_ASSIGN - Static variable in interface JavaTokenTypes
-
 
-
STAR_ASSIGN - Static variable in interface PdePartialTokenTypes
-
 
-
STAR_ASSIGN - Static variable in interface PdeTokenTypes
-
 
-
start() - Method in class StreamPump
-
 
-
start() - Method in class PApplet
-
-
Called by the browser or applet viewer to inform this applet that it - should start its execution.
-
-
start(Stage) - Method in class PSurfaceFX.PApplicationFX
-
 
-
startCompoundEdit() - Method in class Editor
-
-
Use before a manipulating text to group editing operations together as a - single undo.
-
-
startIndeterminate() - Method in class Editor
-
 
-
startIndeterminate() - Method in class EditorStatus
-
 
-
startIndeterminate() - Method in interface RunnerListener
-
 
-
startThread() - Method in interface PSurface
-
-
Start the animation thread
-
-
startThread() - Method in class PSurfaceFX
-
 
-
startThread() - Method in class PSurfaceNone
-
 
-
startThread() - Method in class PSurfaceJOGL
-
 
-
statement() - Method in class JavaRecognizer
-
 
-
statement() - Method in class PdeRecognizer
-
 
-
STATIC_DRAW - Static variable in class PGL
-
 
-
STATIC_IMPORT - Static variable in interface JavaTokenTypes
-
 
-
STATIC_IMPORT - Static variable in interface PdePartialTokenTypes
-
 
-
STATIC_IMPORT - Static variable in interface PdeTokenTypes
-
 
-
STATIC_INIT - Static variable in interface JavaTokenTypes
-
 
-
STATIC_INIT - Static variable in interface PdePartialTokenTypes
-
 
-
STATIC_INIT - Static variable in interface PdeTokenTypes
-
 
-
staticProgram() - Method in class PdeRecognizer
-
 
-
statusEmpty() - Method in class Editor
-
-
Clear the status area.
-
-
statusError(String) - Method in class Editor
-
-
Show an error in the status bar.
-
-
statusError(Exception) - Method in class Editor
-
-
Show an exception in the editor status bar.
-
-
statusError(String) - Method in interface RunnerListener
-
 
-
statusError(Exception) - Method in interface RunnerListener
-
 
-
statusHalt() - Method in class Editor
-
 
-
statusHalt() - Method in interface RunnerListener
-
 
-
statusNotice(String) - Method in class Editor
-
-
Show a notice message in the editor status bar.
-
-
statusNotice(String) - Method in interface RunnerListener
-
 
-
STENCIL_ATTACHMENT - Static variable in class PGL
-
 
-
STENCIL_BITS - Static variable in class PGL
-
 
-
STENCIL_BUFFER_BIT - Static variable in class PGL
-
 
-
STENCIL_INDEX - Static variable in class PGL
-
 
-
STENCIL_INDEX1 - Static variable in class PGL
-
 
-
STENCIL_INDEX4 - Static variable in class PGL
-
 
-
STENCIL_INDEX8 - Static variable in class PGL
-
 
-
STENCIL_TEST - Static variable in class PGL
-
 
-
stencilBits - Static variable in class PGraphicsOpenGL
-
 
-
stencilFunc(int, int, int) - Method in class PGL
-
 
-
stencilFunc(int, int, int) - Method in class PJOGL
-
 
-
stencilFuncSeparate(int, int, int, int) - Method in class PGL
-
 
-
stencilFuncSeparate(int, int, int, int) - Method in class PJOGL
-
 
-
stencilMask(int) - Method in class PGL
-
 
-
stencilMask(int) - Method in class PJOGL
-
 
-
stencilMaskSeparate(int, int) - Method in class PGL
-
 
-
stencilMaskSeparate(int, int) - Method in class PJOGL
-
 
-
stencilOp(int, int, int) - Method in class PGL
-
 
-
stencilOp(int, int, int) - Method in class PJOGL
-
 
-
stencilOpSeparate(int, int, int, int) - Method in class PGL
-
 
-
stencilOpSeparate(int, int, int, int) - Method in class PJOGL
-
 
-
stop() - Method in class PApplet
-
-
Called by the browser or applet viewer to inform - this applet that it should stop its execution.
-
-
stopCompoundEdit() - Method in class Editor
-
-
Use with startCompoundEdit() to group edit operations in a single undo.
-
-
stopIndeterminate() - Method in class Editor
-
 
-
stopIndeterminate() - Method in class EditorStatus
-
 
-
stopIndeterminate() - Method in interface RunnerListener
-
 
-
stopThread() - Method in interface PSurface
-
-
Stop the animation thread (set it null)
-
-
stopThread() - Method in class PSurfaceFX
-
 
-
stopThread() - Method in class PSurfaceNone
-
 
-
stopThread() - Method in class PSurfaceJOGL
-
 
-
str(boolean) - Static method in class PApplet
-
 
-
str(byte) - Static method in class PApplet
-
 
-
str(char) - Static method in class PApplet
-
 
-
str(int) - Static method in class PApplet
-
 
-
str(float) - Static method in class PApplet
-
 
-
str(boolean[]) - Static method in class PApplet
-
 
-
str(byte[]) - Static method in class PApplet
-
 
-
str(char[]) - Static method in class PApplet
-
 
-
str(int[]) - Static method in class PApplet
-
 
-
str(float[]) - Static method in class PApplet
-
 
-
STREAM_DRAW - Static variable in class PGL
-
 
-
StreamPump - Class in processing.app.exec
-
-
A StreamPump reads lines of text from its given InputStream - and informs its LineProcessors until the InputStream is exhausted.
-
-
StreamPump(InputStream, String) - Constructor for class StreamPump
-
 
-
StreamRedirectThread - Class in processing.app.exec
-
-
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 StreamRedirectThread
-
-
Set up for copy.
-
-
StreamRedirectThread(String, Reader, Writer) - Constructor for class StreamRedirectThread
-
 
-
STRICTFP - Static variable in interface JavaTokenTypes
-
 
-
STRICTFP - Static variable in interface PdePartialTokenTypes
-
 
-
STRICTFP - Static variable in interface PdeTokenTypes
-
 
-
STRING - Static variable in class Table
-
 
-
STRING_LITERAL - Static variable in interface JavaTokenTypes
-
 
-
STRING_LITERAL - Static variable in interface PdePartialTokenTypes
-
 
-
STRING_LITERAL - Static variable in interface PdeTokenTypes
-
 
-
StringDict - Class in processing.data
-
-
A simple table class to use a String as a lookup for another String value.
-
-
StringDict() - Constructor for class StringDict
-
 
-
StringDict(int) - Constructor for class StringDict
-
-
Create a new lookup pre-allocated to a specific length.
-
-
StringDict(BufferedReader) - Constructor for class StringDict
-
-
Read a set of entries from a Reader that has each key/value pair on - a single line, separated by a tab.
-
-
StringDict(String[], String[]) - Constructor for class StringDict
-
 
-
StringDict(String[][]) - Constructor for class StringDict
-
-
Constructor to allow (more intuitive) inline initialization, e.g.:
-
-
StringList - Class in processing.data
-
-
Helper class for a list of Strings.
-
-
StringList() - Constructor for class StringList
-
 
-
StringList(int) - Constructor for class StringList
-
 
-
StringList(String[]) - Constructor for class StringList
-
 
-
StringList(Object...) - Constructor for class StringList
-
-
Construct a StringList from a random pile of objects.
-
-
StringList(Iterable<String>) - Constructor for class StringList
-
-
Create from something iterable, for instance: - StringList list = new StringList(hashMap.keySet());
-
-
stroke(int) - Method in class PApplet
-
-
( begin auto-generated from stroke.xml ) - - Sets the color used to draw lines and borders around shapes.
-
-
stroke(int, float) - Method in class PApplet
-
 
-
stroke(float) - Method in class PApplet
-
 
-
stroke(float, float) - Method in class PApplet
-
 
-
stroke(float, float, float) - Method in class PApplet
-
 
-
stroke(float, float, float, float) - Method in class PApplet
-
 
-
stroke - Variable in class PGraphics
-
-
true if stroke() is enabled, (read-only)
-
-
stroke(int) - Method in class PGraphics
-
-
( begin auto-generated from stroke.xml ) - - Sets the color used to draw lines and borders around shapes.
-
-
stroke(int, float) - Method in class PGraphics
-
 
-
stroke(float) - Method in class PGraphics
-
 
-
stroke(float, float) - Method in class PGraphics
-
 
-
stroke(float, float, float) - Method in class PGraphics
-
 
-
stroke(float, float, float, float) - Method in class PGraphics
-
 
-
stroke(int) - Method in class PShape
-
 
-
stroke(int, float) - Method in class PShape
-
 
-
stroke(float) - Method in class PShape
-
 
-
stroke(float, float) - Method in class PShape
-
 
-
stroke(float, float, float) - Method in class PShape
-
 
-
stroke(float, float, float, float) - Method in class PShape
-
 
-
stroke - Variable in class PStyle
-
 
-
strokeCap(int) - Method in class PApplet
-
-
( begin auto-generated from strokeCap.xml ) - - Sets the style for rendering line endings.
-
-
strokeCap - Variable in class PGraphics
-
-
Set by strokeCap() (read-only).
-
-
strokeCap(int) - Method in class PGraphics
-
-
( begin auto-generated from strokeCap.xml ) - - Sets the style for rendering line endings.
-
-
strokeCap(int) - Method in class PGraphicsFX2D
-
 
-
strokeCap(int) - Method in class PGraphicsJava2D
-
 
-
strokeCap(int) - Method in class PShape
-
 
-
strokeCap - Variable in class PStyle
-
 
-
strokeCap(int) - Method in class PGraphicsOpenGL
-
 
-
strokeColor - Variable in class PGraphics
-
-
stroke that was last set (read-only)
-
-
strokeColor - Variable in class PStyle
-
 
-
strokeGradient - Variable in class PGraphicsJava2D
-
 
-
strokeGradientObject - Variable in class PGraphicsJava2D
-
 
-
strokeJoin(int) - Method in class PApplet
-
-
( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments.
-
-
strokeJoin - Variable in class PGraphics
-
-
Set by strokeJoin() (read-only).
-
-
strokeJoin(int) - Method in class PGraphics
-
-
( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments.
-
-
strokeJoin(int) - Method in class PGraphicsFX2D
-
 
-
strokeJoin(int) - Method in class PGraphicsJava2D
-
 
-
strokeJoin(int) - Method in class PShape
-
 
-
strokeJoin - Variable in class PStyle
-
 
-
strokeJoin(int) - Method in class PGraphicsOpenGL
-
 
-
strokeWeight(float) - Method in class PApplet
-
-
( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes.
-
-
strokeWeight - Variable in class PGraphics
-
-
Last value set by strokeWeight() (read-only).
-
-
strokeWeight(float) - Method in class PGraphics
-
-
( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes.
-
-
strokeWeight(float) - Method in class PGraphicsFX2D
-
 
-
strokeWeight(float) - Method in class PGraphicsJava2D
-
 
-
strokeWeight(float) - Method in class PShape
-
 
-
strokeWeight - Variable in class PStyle
-
 
-
strokeWeight(float) - Method in class PGraphicsOpenGL
-
 
-
style(PStyle) - Method in class PApplet
-
 
-
style(PStyle) - Method in class PGraphics
-
 
-
styles - Variable in class TextAreaDefaults
-
 
-
sub(PVector) - Method in class PVector
-
-
( begin auto-generated from PVector_sub.xml ) - - Subtracts x, y, and z components from a vector, subtracts one vector - from another, or subtracts two independent vectors.
-
-
sub(float, float, float) - Method in class PVector
-
 
-
sub(PVector, PVector) - Static method in class PVector
-
-
Subtract one vector from another
-
-
sub(PVector, PVector, PVector) - Static method in class PVector
-
-
Subtract one vector from another and store in another vector
-
-
sub(String, float) - Method in class FloatDict
-
 
-
sub(int, float) - Method in class FloatList
-
 
-
sub(String, int) - Method in class IntDict
-
 
-
sub(int, int) - Method in class IntList
-
 
-
subset(boolean[], int) - Static method in class PApplet
-
 
-
subset(boolean[], int, int) - Static method in class PApplet
-
-
( begin auto-generated from subset.xml ) - - Extracts an array of elements from an existing array.
-
-
subset(byte[], int) - Static method in class PApplet
-
 
-
subset(byte[], int, int) - Static method in class PApplet
-
 
-
subset(char[], int) - Static method in class PApplet
-
 
-
subset(char[], int, int) - Static method in class PApplet
-
 
-
subset(int[], int) - Static method in class PApplet
-
 
-
subset(int[], int, int) - Static method in class PApplet
-
 
-
subset(float[], int) - Static method in class PApplet
-
 
-
subset(float[], int, int) - Static method in class PApplet
-
 
-
subset(String[], int) - Static method in class PApplet
-
 
-
subset(String[], int, int) - Static method in class PApplet
-
 
-
subset(Object, int) - Static method in class PApplet
-
 
-
subset(Object, int, int) - Static method in class PApplet
-
 
-
SUBTRACT - Static variable in interface PConstants
-
 
-
succeeded() - Method in class ProcessResult
-
 
-
sum() - Method in class FloatList
-
 
-
sum() - Method in class IntList
-
 
-
SUPER_CTOR_CALL - Static variable in interface JavaTokenTypes
-
 
-
SUPER_CTOR_CALL - Static variable in interface PdePartialTokenTypes
-
 
-
SUPER_CTOR_CALL - Static variable in interface PdeTokenTypes
-
 
-
superClassClause() - Method in class JavaRecognizer
-
 
-
superClassClause() - Method in class PdeRecognizer
-
 
-
supportsArch(int, int) - Method in class Library
-
 
-
supportsMultilineTokens() - Method in class TokenMarker
-
-
Returns if the token marker supports tokens that span multiple - lines.
-
-
surface - Static variable in class PSurfaceFX.PApplicationFX
-
 
-
SVG - Static variable in interface PConstants
-
 
-
SW - Static variable in class PGraphics
-
-
stroke weight
-
-
swap(int, int) - Method in class FloatDict
-
 
-
swap(int, int) - Method in class IntDict
-
 
-
swap(int, int) - Method in class Sort
-
 
-
swap(int, int) - Method in class StringDict
-
 
-
swapColorBuffers() - Method in class FrameBuffer
-
 
-
SyntaxDocument - Class in processing.app.syntax
-
-
A document implementation that can be tokenized by the syntax highlighting - system.
-
-
SyntaxDocument() - Constructor for class SyntaxDocument
-
 
-
SyntaxStyle - Class in processing.app.syntax
-
-
A simple text style class.
-
-
SyntaxStyle(Color, boolean) - Constructor for class SyntaxStyle
-
-
Creates a new SyntaxStyle.
-
-
SystemOutSiphon - Class in processing.app.exec
-
-
Siphons from an InputStream of System.out (from a Process) - and sends it to the real System.out.
-
-
SystemOutSiphon(InputStream) - Constructor for class SystemOutSiphon
-
 
-
- - - -

T

-
-
TAB - Static variable in interface PConstants
-
 
-
Table - Class in processing.data
-
-
Generic class for handling tabular data, typically from a CSV, TSV, or - other sort of spreadsheet file.
-
-
Table() - Constructor for class Table
-
-
Creates a new, empty table.
-
-
Table(File) - Constructor for class Table
-
 
-
Table(File, String) - Constructor for class Table
-
-
version that uses a File object; future releases (or data types) - may include additional optimizations here
-
-
Table(InputStream) - Constructor for class Table
-
 
-
Table(InputStream, String) - Constructor for class Table
-
-
Read the table from a stream.
-
-
Table(Iterable<TableRow>) - Constructor for class Table
-
 
-
Table(ResultSet) - Constructor for class Table
-
 
-
TableRow - Interface in processing.data
-
 
-
tan(float) - Static method in class PApplet
-
-
( begin auto-generated from tan.xml ) - - Calculates the ratio of the sine and cosine of an angle.
-
-
TARGA - Static variable in interface PConstants
-
 
-
target - Variable in class Texture.Parameters
-
-
Texture target.
-
-
TaskAddFile() - Constructor for class ProgressFrame.TaskAddFile
-
 
-
TaskSaveAs() - Constructor for class ProgressFrame.TaskSaveAs
-
 
-
TAU - Static variable in interface PConstants
-
-
( begin auto-generated from TAU.xml ) - - TAU is an alias for TWO_PI, a mathematical constant with the value - 6.28318530717958647693.
-
-
TESS_WINDING_NONZERO - Static variable in class PGL
-
 
-
TESS_WINDING_ODD - Static variable in class PGL
-
 
-
TEXCOORD - Static variable in class PShapeOpenGL
-
 
-
texImage2D(int, int, int, int, int, int, int, int, Buffer) - Method in class PGL
-
 
-
texImage2D(int, int, int, int, int, int, int, int, Buffer) - Method in class PJOGL
-
 
-
texParameterf(int, int, float) - Method in class PGL
-
 
-
texParameterf(int, int, float) - Method in class PJOGL
-
 
-
texParameterfv(int, int, FloatBuffer) - Method in class PGL
-
 
-
texParameterfv(int, int, FloatBuffer) - Method in class PJOGL
-
 
-
texParameteri(int, int, int) - Method in class PGL
-
 
-
texParameteri(int, int, int) - Method in class PJOGL
-
 
-
texParameteriv(int, int, IntBuffer) - Method in class PGL
-
 
-
texParameteriv(int, int, IntBuffer) - Method in class PJOGL
-
 
-
texSubImage2D(int, int, int, int, int, int, int, int, Buffer) - Method in class PGL
-
 
-
texSubImage2D(int, int, int, int, int, int, int, int, Buffer) - Method in class PJOGL
-
 
-
text(String) - Static method in class Language
-
-
Get translation from bundles.
-
-
text(char, float, float) - Method in class PApplet
-
-
( begin auto-generated from text.xml ) - - Draws text to the screen.
-
-
text(char, float, float, float) - Method in class PApplet
-
 
-
text(String, float, float) - Method in class PApplet
-
-
Advanced
-
-
text(char[], int, int, float, float) - Method in class PApplet
-
-
Advanced
-
-
text(String, float, float, float) - Method in class PApplet
-
-
Same as above but with a z coordinate.
-
-
text(char[], int, int, float, float, float) - Method in class PApplet
-
 
-
text(String, float, float, float, float) - Method in class PApplet
-
-
Advanced
-
-
text(int, float, float) - Method in class PApplet
-
 
-
text(int, float, float, float) - Method in class PApplet
-
 
-
text(float, float, float) - Method in class PApplet
-
-
This does a basic number formatting, to avoid the - generally ugly appearance of printing floats.
-
-
text(float, float, float, float) - Method in class PApplet
-
 
-
TEXT - Static variable in interface PConstants
-
 
-
text(char, float, float) - Method in class PGraphics
-
-
( begin auto-generated from text.xml ) - - Draws text to the screen.
-
-
text(char, float, float, float) - Method in class PGraphics
-
 
-
text(String, float, float) - Method in class PGraphics
-
-
Advanced
-
-
text(char[], int, int, float, float) - Method in class PGraphics
-
-
Advanced
-
-
text(String, float, float, float) - Method in class PGraphics
-
-
Same as above but with a z coordinate.
-
-
text(char[], int, int, float, float, float) - Method in class PGraphics
-
 
-
text(String, float, float, float, float) - Method in class PGraphics
-
-
Advanced
-
-
text(int, float, float) - Method in class PGraphics
-
 
-
text(int, float, float, float) - Method in class PGraphics
-
 
-
text(float, float, float) - Method in class PGraphics
-
-
This does a basic number formatting, to avoid the - generally ugly appearance of printing floats.
-
-
text(float, float, float, float) - Method in class PGraphics
-
 
-
textAlign(int) - Method in class PApplet
-
 
-
textAlign(int, int) - Method in class PApplet
-
-
( begin auto-generated from textAlign.xml ) - - Sets the current alignment for drawing text.
-
-
textAlign - Variable in class PGraphics
-
-
The current text align (read-only)
-
-
textAlign(int) - Method in class PGraphics
-
 
-
textAlign(int, int) - Method in class PGraphics
-
-
( begin auto-generated from textAlign.xml ) - - Sets the current alignment for drawing text.
-
-
textAlign - Variable in class PStyle
-
 
-
textAlignY - Variable in class PGraphics
-
-
The current vertical text alignment (read-only)
-
-
textAlignY - Variable in class PStyle
-
 
-
TextAreaDefaults - Class in processing.app.syntax
-
-
Encapsulates default settings for a text area.
-
-
TextAreaDefaults() - Constructor for class TextAreaDefaults
-
 
-
TextAreaPainter - Class in processing.app.syntax
-
-
The text area repaint manager.
-
-
TextAreaPainter(JEditTextArea, TextAreaDefaults) - Constructor for class TextAreaPainter
-
-
Creates a new repaint manager.
-
-
TextAreaPainter.Highlight - Interface in processing.app.syntax
-
-
Highlight interface.
-
-
textAscent() - Method in class PApplet
-
-
( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size.
-
-
textAscent() - Method in class PGraphics
-
-
( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size.
-
-
textAscent() - Method in class PGraphicsJava2D
-
 
-
textAscent() - Method in class PGraphicsOpenGL
-
 
-
textDescent() - Method in class PApplet
-
-
( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size.
-
-
textDescent() - Method in class PGraphics
-
-
( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size.
-
-
textDescent() - Method in class PGraphicsJava2D
-
 
-
textDescent() - Method in class PGraphicsOpenGL
-
 
-
textFont(PFont) - Method in class PApplet
-
-
( begin auto-generated from textFont.xml ) - - Sets the current font that will be drawn with the text() - function.
-
-
textFont(PFont, float) - Method in class PApplet
-
 
-
textFont - Variable in class PGraphics
-
-
The current text font (read-only)
-
-
textFont(PFont) - Method in class PGraphics
-
-
( begin auto-generated from textFont.xml ) - - Sets the current font that will be drawn with the text() - function.
-
-
textFont(PFont, float) - Method in class PGraphics
-
 
-
textFont - Variable in class PStyle
-
 
-
textLeading(float) - Method in class PApplet
-
-
( begin auto-generated from textLeading.xml ) - - Sets the spacing between lines of text in units of pixels.
-
-
textLeading - Variable in class PGraphics
-
-
The current text leading (read-only)
-
-
textLeading(float) - Method in class PGraphics
-
-
( begin auto-generated from textLeading.xml ) - - Sets the spacing between lines of text in units of pixels.
-
-
textLeading - Variable in class PStyle
-
 
-
textMode(int) - Method in class PApplet
-
-
( begin auto-generated from textMode.xml ) - - Sets the way text draws to the screen.
-
-
textMode - Variable in class PGraphics
-
-
The current text mode (read-only)
-
-
textMode(int) - Method in class PGraphics
-
-
( begin auto-generated from textMode.xml ) - - Sets the way text draws to the screen.
-
-
textMode - Variable in class PStyle
-
 
-
textSize(float) - Method in class PApplet
-
-
( begin auto-generated from textSize.xml ) - - Sets the current font size.
-
-
textSize - Variable in class PGraphics
-
-
The current text size (read-only)
-
-
textSize(float) - Method in class PGraphics
-
-
( begin auto-generated from textSize.xml ) - - Sets the current font size.
-
-
textSize(float) - Method in class PGraphicsJava2D
-
-
Same as parent, but override for native version of the font.
-
-
textSize - Variable in class PStyle
-
 
-
textSize(float) - Method in class PGraphicsOpenGL
-
 
-
texture(PImage) - Method in class PApplet
-
-
( begin auto-generated from texture.xml ) - - Sets a texture to be applied to vertex points.
-
-
texture(PImage) - Method in class PGraphics
-
-
( begin auto-generated from texture.xml ) - - Sets a texture to be applied to vertex points.
-
-
texture(PImage) - Method in class PGraphicsFX2D
-
 
-
texture(PImage) - Method in class PGraphicsJava2D
-
 
-
texture(PImage) - Method in class PShape
-
 
-
Texture - Class in processing.opengl
-
-
This class wraps an OpenGL texture.
-
-
Texture(PGraphicsOpenGL) - Constructor for class Texture
-
 
-
Texture(PGraphicsOpenGL, int, int) - Constructor for class Texture
-
-
Creates an instance of PTexture with size width x height.
-
-
Texture(PGraphicsOpenGL, int, int, Object) - Constructor for class Texture
-
-
Creates an instance of PTexture with size width x height and with the - specified parameters.
-
-
Texture.Parameters - Class in processing.opengl
-
-
This class stores the parameters for a texture: target, internal format, - minimization filter and magnification filter.
-
-
TEXTURE0 - Static variable in class PGL
-
 
-
TEXTURE1 - Static variable in class PGL
-
 
-
TEXTURE2 - Static variable in class PGL
-
 
-
TEXTURE3 - Static variable in class PGL
-
 
-
TEXTURE_2D - Static variable in class PGL
-
 
-
TEXTURE_BINDING_2D - Static variable in class PGL
-
 
-
TEXTURE_BINDING_RECTANGLE - Static variable in class PGL
-
 
-
TEXTURE_CUBE_MAP - Static variable in class PGL
-
 
-
TEXTURE_CUBE_MAP_NEGATIVE_X - Static variable in class PGL
-
 
-
TEXTURE_CUBE_MAP_NEGATIVE_Y - Static variable in class PGL
-
 
-
TEXTURE_CUBE_MAP_NEGATIVE_Z - Static variable in class PGL
-
 
-
TEXTURE_CUBE_MAP_POSITIVE_X - Static variable in class PGL
-
 
-
TEXTURE_CUBE_MAP_POSITIVE_Y - Static variable in class PGL
-
 
-
TEXTURE_CUBE_MAP_POSITIVE_Z - Static variable in class PGL
-
 
-
TEXTURE_MAG_FILTER - Static variable in class PGL
-
 
-
TEXTURE_MAX_ANISOTROPY - Static variable in class PGL
-
 
-
TEXTURE_MIN_FILTER - Static variable in class PGL
-
 
-
TEXTURE_RECTANGLE - Static variable in class PGL
-
 
-
TEXTURE_WRAP_R - Static variable in class PGL
-
 
-
TEXTURE_WRAP_S - Static variable in class PGL
-
 
-
TEXTURE_WRAP_T - Static variable in class PGL
-
 
-
textureImage - Variable in class PGraphics
-
-
Current image being used as a texture
-
-
textureMode(int) - Method in class PApplet
-
-
( begin auto-generated from textureMode.xml ) - - Sets the coordinate space for texture mapping.
-
-
textureMode - Variable in class 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 PGraphics
-
-
( begin auto-generated from textureMode.xml ) - - Sets the coordinate space for texture mapping.
-
-
textureMode(int) - Method in class PShape
-
 
-
textureSampling(int) - Method in class PGraphicsOpenGL
-
 
-
textureU - Variable in class PGraphics
-
-
Current horizontal coordinate for texture, will always - be between 0 and 1, even if using textureMode(IMAGE).
-
-
textureV - Variable in class PGraphics
-
-
Current vertical coordinate for texture, see above.
-
-
textureWrap(int) - Method in class PApplet
-
-
( begin auto-generated from textureWrap.xml ) - - Description to come...
-
-
textureWrap(int) - Method in class PGraphics
-
-
( begin auto-generated from textureWrap.xml ) - - Description to come...
-
-
textureWrap(int) - Method in class PGraphicsOpenGL
-
 
-
textWidth(char) - Method in class PApplet
-
 
-
textWidth(String) - Method in class PApplet
-
-
( begin auto-generated from textWidth.xml ) - - Calculates and returns the width of any character or text string.
-
-
textWidth(char[], int, int) - Method in class PApplet
-
 
-
textWidth(char) - Method in class PGraphics
-
 
-
textWidth(String) - Method in class PGraphics
-
-
( begin auto-generated from textWidth.xml ) - - Calculates and returns the width of any character or text string.
-
-
textWidth(char[], int, int) - Method in class PGraphics
-
 
-
textWidth(String, float) - Method in class PShapeSVG.Font
-
 
-
TEXUNIT_ERROR - Static variable in class PGL
-
 
-
ThinkDifferent - Class in processing.app.platform
-
-
Deal with issues related to thinking differently.
-
-
ThinkDifferent() - Constructor for class ThinkDifferent
-
 
-
ThinkDifferent - Class in processing.core
-
-
Deal with issues related to thinking differently.
-
-
ThinkDifferent() - Constructor for class ThinkDifferent
-
 
-
thinkDifferentExamples() - Method in class Base
-
 
-
THIRD_PI - Static variable in interface PConstants
-
 
-
thread(String) - Method in class PApplet
-
-
Launch a new thread and call the specified function from that new thread.
-
-
threadIsCurrent() - Method in class PGL
-
 
-
THRESHOLD - Static variable in interface PConstants
-
 
-
throwsClause() - Method in class JavaRecognizer
-
 
-
throwsClause() - Method in class PdeRecognizer
-
 
-
TIFF - Static variable in interface PConstants
-
 
-
tint(int) - Method in class PApplet
-
-
( begin auto-generated from tint.xml ) - - Sets the fill value for displaying images.
-
-
tint(int, float) - Method in class PApplet
-
 
-
tint(float) - Method in class PApplet
-
 
-
tint(float, float) - Method in class PApplet
-
 
-
tint(float, float, float) - Method in class PApplet
-
 
-
tint(float, float, float, float) - Method in class PApplet
-
 
-
tint - Variable in class PGraphics
-
-
True if tint() is enabled (read-only).
-
-
tint(int) - Method in class PGraphics
-
-
( begin auto-generated from tint.xml ) - - Sets the fill value for displaying images.
-
-
tint(int, float) - Method in class PGraphics
-
 
-
tint(float) - Method in class PGraphics
-
 
-
tint(float, float) - Method in class PGraphics
-
 
-
tint(float, float, float) - Method in class PGraphics
-
 
-
tint(float, float, float, float) - Method in class PGraphics
-
 
-
tint(int) - Method in class PShape
-
 
-
tint(int, float) - Method in class PShape
-
 
-
tint(float) - Method in class PShape
-
 
-
tint(float, float) - Method in class PShape
-
 
-
tint(float, float, float) - Method in class PShape
-
 
-
tint(float, float, float, float) - Method in class PShape
-
 
-
tint - Variable in class PStyle
-
 
-
tintColor - Variable in class PGraphics
-
-
tint that was last set (read-only)
-
-
tintColor - Variable in class PStyle
-
 
-
TOGGLE_RECT - Static variable in class InputHandler
-
 
-
toggle_rect() - Constructor for class InputHandler.toggle_rect
-
 
-
Token - Class in processing.app.syntax
-
-
A linked list of tokens.
-
-
Token(int, byte) - Constructor for class Token
-
-
Creates a new token.
-
-
tokenizeLines() - Method in class SyntaxDocument
-
-
Reparses the document, by passing all lines to the token - marker.
-
-
tokenizeLines(int, int) - Method in class 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.
-
-
Tool - Interface in processing.app.tools
-
-
Interface for items to be shown in the Tools menu.
-
-
ToolContribution - Class in processing.app.contrib
-
 
-
Toolkit - Class in processing.app
-
-
Utility functions for base that require a java.awt.Toolkit object.
-
-
Toolkit() - Constructor for class Toolkit
-
 
-
TOP - Static variable in interface PConstants
-
-
Align text to the top
-
-
topExtent - Variable in class PFont.Glyph
-
 
-
toString() - Method in enum ContributionType
-
 
-
toString() - Method in class EditorState
-
 
-
toString() - Method in class ProcessHelper
-
 
-
toString() - Method in class ProcessResult
-
 
-
toString() - Method in class Mode
-
 
-
toString() - Method in class SketchReference
-
 
-
toString() - Method in class SyntaxStyle
-
-
Returns a string representation of this object.
-
-
toString() - Method in class Token
-
-
Returns a string representation of this token.
-
-
toString() - Method in class PVector
-
 
-
toString() - Method in class FloatDict
-
 
-
toString() - Method in class FloatList
-
 
-
toString() - Method in class IntDict
-
 
-
toString() - Method in class IntList
-
 
-
toString() - Method in class JSONArray
-
-
Return the JSON data formatted with two spaces for indents.
-
-
toString() - Method in class JSONObject
-
-
Return the JSON data formatted with two spaces for indents.
-
-
toString() - Method in class StringDict
-
 
-
toString() - Method in class StringList
-
 
-
toString() - Method in class XML
-
-
Return the XML document formatted with two spaces for indents.
-
-
toString() - Method in class MouseEvent
-
 
-
TOUCH - Static variable in class Event
-
 
-
TouchEvent - Class in processing.event
-
 
-
TouchEvent(Object, long, int, int) - Constructor for class TouchEvent
-
 
-
traditionalForClause() - Method in class JavaRecognizer
-
 
-
traditionalForClause() - Method in class PdeRecognizer
-
 
-
translate(float, float) - Method in class PApplet
-
-
( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window.
-
-
translate(float, float, float) - Method in class PApplet
-
 
-
translate(float, float) - Method in class PGraphics
-
-
( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window.
-
-
translate(float, float, float) - Method in class PGraphics
-
 
-
translate(float, float) - Method in class PGraphicsFX2D
-
 
-
translate(float, float) - Method in class PGraphicsJava2D
-
 
-
translate(float, float) - Method in interface PMatrix
-
 
-
translate(float, float, float) - Method in interface PMatrix
-
 
-
translate(float, float) - Method in class PMatrix2D
-
 
-
translate(float, float, float) - Method in class PMatrix2D
-
 
-
translate(float, float) - Method in class PMatrix3D
-
 
-
translate(float, float, float) - Method in class PMatrix3D
-
 
-
translate(float, float) - Method in class PShape
-
-
( begin auto-generated from PShape_translate.xml ) - - Specifies an amount to displace the shape.
-
-
translate(float, float, float) - Method in class PShape
-
 
-
translate(float, float, float) - Method in class PGraphics2D
-
 
-
translate(float, float) - Method in class PGraphicsOpenGL
-
 
-
translate(float, float, float) - Method in class PGraphicsOpenGL
-
 
-
translate(float, float) - Method in class PShapeOpenGL
-
 
-
translate(float, float, float) - Method in class PShapeOpenGL
-
 
-
transpose() - Method in interface PMatrix
-
-
Transpose this matrix.
-
-
transpose() - Method in class PMatrix2D
-
-
Transpose this matrix.
-
-
transpose() - Method in class PMatrix3D
-
-
Transpose this matrix.
-
-
triangle(float, float, float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points.
-
-
TRIANGLE - Static variable in interface PConstants
-
 
-
triangle(float, float, float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points.
-
-
triangle(float, float, float, float, float, float) - Method in class PGraphicsFX2D
-
 
-
triangle(float, float, float, float, float, float) - Method in class PGraphicsJava2D
-
 
-
triangle(float, float, float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
TRIANGLE_FAN - Static variable in interface PConstants
-
 
-
TRIANGLE_FAN - Static variable in class PGL
-
 
-
TRIANGLE_STRIP - Static variable in interface PConstants
-
 
-
TRIANGLE_STRIP - Static variable in class PGL
-
 
-
TRIANGLES - Static variable in interface PConstants
-
 
-
TRIANGLES - Static variable in class PGL
-
 
-
trim(String) - Static method in class PApplet
-
-
( begin auto-generated from trim.xml ) - - Removes whitespace characters from the beginning and end of a String.
-
-
trim(String[]) - Static method in class PApplet
-
 
-
trim() - Method in class Table
-
 
-
trim(int) - Method in class Table
-
 
-
trim(String) - Method in class Table
-
 
-
trim() - Method in class XML
-
 
-
TRIPLE_DOT - Static variable in interface JavaTokenTypes
-
 
-
TRIPLE_DOT - Static variable in interface PdePartialTokenTypes
-
 
-
TRIPLE_DOT - Static variable in interface PdeTokenTypes
-
 
-
TRUE - Static variable in class PGL
-
 
-
tryBlock() - Method in class JavaRecognizer
-
 
-
tryBlock() - Method in class PdeRecognizer
-
 
-
TWO_PI - Static variable in interface PConstants
-
-
( begin auto-generated from TWO_PI.xml ) - - TWO_PI is a mathematical constant with the value 6.28318530717958647693.
-
-
TX - Static variable in class PGraphics
-
 
-
TY - Static variable in class PGraphics
-
 
-
TYPE - Static variable in class KeyEvent
-
 
-
type() - Method in class JavaRecognizer
-
 
-
TYPE - Static variable in interface JavaTokenTypes
-
 
-
TYPE - Static variable in interface PdePartialTokenTypes
-
 
-
type() - Method in class PdeRecognizer
-
 
-
TYPE - Static variable in interface PdeTokenTypes
-
 
-
TYPE_ARGUMENT - Static variable in interface JavaTokenTypes
-
 
-
TYPE_ARGUMENT - Static variable in interface PdePartialTokenTypes
-
 
-
TYPE_ARGUMENT - Static variable in interface PdeTokenTypes
-
 
-
TYPE_ARGUMENTS - Static variable in interface JavaTokenTypes
-
 
-
TYPE_ARGUMENTS - Static variable in interface PdePartialTokenTypes
-
 
-
TYPE_ARGUMENTS - Static variable in interface PdeTokenTypes
-
 
-
TYPE_LOWER_BOUNDS - Static variable in interface JavaTokenTypes
-
 
-
TYPE_LOWER_BOUNDS - Static variable in interface PdePartialTokenTypes
-
 
-
TYPE_LOWER_BOUNDS - Static variable in interface PdeTokenTypes
-
 
-
TYPE_PARAMETER - Static variable in interface JavaTokenTypes
-
 
-
TYPE_PARAMETER - Static variable in interface PdePartialTokenTypes
-
 
-
TYPE_PARAMETER - Static variable in interface PdeTokenTypes
-
 
-
TYPE_PARAMETERS - Static variable in interface JavaTokenTypes
-
 
-
TYPE_PARAMETERS - Static variable in interface PdePartialTokenTypes
-
 
-
TYPE_PARAMETERS - Static variable in interface PdeTokenTypes
-
 
-
TYPE_UPPER_BOUNDS - Static variable in interface JavaTokenTypes
-
 
-
TYPE_UPPER_BOUNDS - Static variable in interface PdePartialTokenTypes
-
 
-
TYPE_UPPER_BOUNDS - Static variable in interface PdeTokenTypes
-
 
-
typeArgument() - Method in class JavaRecognizer
-
 
-
typeArgument() - Method in class PdeRecognizer
-
 
-
typeArgumentBounds() - Method in class JavaRecognizer
-
 
-
typeArgumentBounds() - Method in class PdeRecognizer
-
 
-
typeArguments() - Method in class JavaRecognizer
-
 
-
typeArguments() - Method in class PdeRecognizer
-
 
-
typeArgumentSpec() - Method in class JavaRecognizer
-
 
-
typeArgumentSpec() - Method in class PdeRecognizer
-
 
-
TYPECAST - Static variable in interface JavaTokenTypes
-
 
-
TYPECAST - Static variable in interface PdePartialTokenTypes
-
 
-
TYPECAST - Static variable in interface PdeTokenTypes
-
 
-
typeDefinition() - Method in class JavaRecognizer
-
 
-
typeDefinition() - Method in class PdeRecognizer
-
 
-
typedParse(InputStream, String) - Method in class Table
-
 
-
typeParameter() - Method in class JavaRecognizer
-
 
-
typeParameter() - Method in class PdeRecognizer
-
 
-
typeParameterBounds() - Method in class JavaRecognizer
-
 
-
typeParameterBounds() - Method in class PdeRecognizer
-
 
-
typeParameters() - Method in class JavaRecognizer
-
 
-
typeParameters() - Method in class PdeRecognizer
-
 
-
typeSpec(boolean) - Method in class JavaRecognizer
-
 
-
typeSpec(boolean) - Method in class PdeRecognizer
-
 
-
TZ - Static variable in class PGraphics
-
 
-
- - - -

U

-
-
U - Static variable in class PGraphics
-
 
-
UNARY_MINUS - Static variable in interface JavaTokenTypes
-
 
-
UNARY_MINUS - Static variable in interface PdePartialTokenTypes
-
 
-
UNARY_MINUS - Static variable in interface PdeTokenTypes
-
 
-
UNARY_PLUS - Static variable in interface JavaTokenTypes
-
 
-
UNARY_PLUS - Static variable in interface PdePartialTokenTypes
-
 
-
UNARY_PLUS - Static variable in interface PdeTokenTypes
-
 
-
unaryExpression() - Method in class JavaRecognizer
-
 
-
unaryExpression() - Method in class PdeRecognizer
-
 
-
unaryExpressionNotPlusMinus() - Method in class JavaRecognizer
-
 
-
unaryExpressionNotPlusMinus() - Method in class PdeRecognizer
-
 
-
unbinary(String) - Static method in class PApplet
-
-
( begin auto-generated from unbinary.xml ) - - Converts a String representation of a binary number to its equivalent - integer value.
-
-
unbind() - Method in class PShader
-
-
Unbinds the shader program.
-
-
unbind() - Method in class Texture
-
 
-
unhex(String) - Static method in class PApplet
-
-
( begin auto-generated from unhex.xml ) - - Converts a String representation of a hexadecimal number to its - equivalent integer value.
-
-
unicodeGlyphs - Variable in class PShapeSVG.Font
-
 
-
uniform1f(int, float) - Method in class PGL
-
 
-
uniform1f(int, float) - Method in class PJOGL
-
 
-
uniform1fv(int, int, FloatBuffer) - Method in class PGL
-
 
-
uniform1fv(int, int, FloatBuffer) - Method in class PJOGL
-
 
-
uniform1i(int, int) - Method in class PGL
-
 
-
uniform1i(int, int) - Method in class PJOGL
-
 
-
uniform1iv(int, int, IntBuffer) - Method in class PGL
-
 
-
uniform1iv(int, int, IntBuffer) - Method in class PJOGL
-
 
-
uniform2f(int, float, float) - Method in class PGL
-
 
-
uniform2f(int, float, float) - Method in class PJOGL
-
 
-
uniform2fv(int, int, FloatBuffer) - Method in class PGL
-
 
-
uniform2fv(int, int, FloatBuffer) - Method in class PJOGL
-
 
-
uniform2i(int, int, int) - Method in class PGL
-
 
-
uniform2i(int, int, int) - Method in class PJOGL
-
 
-
uniform2iv(int, int, IntBuffer) - Method in class PGL
-
 
-
uniform2iv(int, int, IntBuffer) - Method in class PJOGL
-
 
-
uniform3f(int, float, float, float) - Method in class PGL
-
 
-
uniform3f(int, float, float, float) - Method in class PJOGL
-
 
-
uniform3fv(int, int, FloatBuffer) - Method in class PGL
-
 
-
uniform3fv(int, int, FloatBuffer) - Method in class PJOGL
-
 
-
uniform3i(int, int, int, int) - Method in class PGL
-
 
-
uniform3i(int, int, int, int) - Method in class PJOGL
-
 
-
uniform3iv(int, int, IntBuffer) - Method in class PGL
-
 
-
uniform3iv(int, int, IntBuffer) - Method in class PJOGL
-
 
-
uniform4f(int, float, float, float, float) - Method in class PGL
-
 
-
uniform4f(int, float, float, float, float) - Method in class PJOGL
-
 
-
uniform4fv(int, int, FloatBuffer) - Method in class PGL
-
 
-
uniform4fv(int, int, FloatBuffer) - Method in class PJOGL
-
 
-
uniform4i(int, int, int, int, int) - Method in class PGL
-
 
-
uniform4i(int, int, int, int, int) - Method in class PJOGL
-
 
-
uniform4iv(int, int, IntBuffer) - Method in class PGL
-
 
-
uniform4iv(int, int, IntBuffer) - Method in class PJOGL
-
 
-
uniformMatrix2fv(int, int, boolean, FloatBuffer) - Method in class PGL
-
 
-
uniformMatrix2fv(int, int, boolean, FloatBuffer) - Method in class PJOGL
-
 
-
uniformMatrix3fv(int, int, boolean, FloatBuffer) - Method in class PGL
-
 
-
uniformMatrix3fv(int, int, boolean, FloatBuffer) - Method in class PJOGL
-
 
-
uniformMatrix4fv(int, int, boolean, FloatBuffer) - Method in class PGL
-
 
-
uniformMatrix4fv(int, int, boolean, FloatBuffer) - Method in class PJOGL
-
 
-
unmapBuffer(int) - Method in class PGL
-
 
-
unmapBuffer(int) - Method in class PJOGL
-
 
-
unnotice(String) - Method in class EditorStatus
-
 
-
UNPACK_ALIGNMENT - Static variable in class PGL
-
 
-
unregisterMethod(String, Object) - Method in class PApplet
-
 
-
unset(String) - Static method in class Preferences
-
 
-
unsetenv(String) - Method in interface Platform.CLibrary
-
 
-
unsetenv(String) - Method in class Platform
-
 
-
unsetenv(String) - Method in class WindowsPlatform
-
 
-
UNSIGNED_BYTE - Static variable in class PGL
-
 
-
UNSIGNED_INT - Static variable in class PGL
-
 
-
UNSIGNED_SHORT - Static variable in class PGL
-
 
-
UNSIGNED_SHORT_4_4_4_4 - Static variable in class PGL
-
 
-
UNSIGNED_SHORT_5_5_5_1 - Static variable in class PGL
-
 
-
UNSIGNED_SHORT_5_6_5 - Static variable in class PGL
-
 
-
UNSUPPORTED_GLPROF_ERROR - Static variable in class PGL
-
 
-
unwatch(Process) - Static method in class ProcessRegistry
-
 
-
unzip(File, File) - Static method in class Base
-
 
-
UP - Static variable in interface PConstants
-
 
-
update() - Method in class CreateFont
-
 
-
UPDATE_FLAGGED - Static variable in class LocalContribution
-
 
-
updateAppearance() - Method in class TextAreaPainter
-
 
-
UpdateCheck - Class in processing.app
-
-
Threaded class to check for updates in the background.
-
-
UpdateCheck(Base) - Constructor for class UpdateCheck
-
 
-
updateCheck() - Method in class UpdateCheck
-
 
-
updateDisplay() - Method in class PGraphicsOpenGL
-
 
-
updateMode() - Method in class EditorFooter
-
 
-
updateMode() - Method in class EditorHeader
-
 
-
updateMode() - Method in class EditorStatus
-
 
-
updatePixels() - Method in class PApplet
-
-
( begin auto-generated from updatePixels.xml ) - - Updates the display window with the data in the pixels[] array.
-
-
updatePixels(int, int, int, int) - Method in class PApplet
-
 
-
updatePixels() - Method in class PGraphicsDanger2D
-
 
-
updatePixels(int, int, int, int) - Method in class PGraphicsDanger2D
-
 
-
updatePixels(int, int, int, int) - Method in class PGraphicsJava2D
-
-
Update the pixels[] buffer to the PGraphics image.
-
-
updatePixels() - Method in class PImage
-
 
-
updatePixels(int, int, int, int) - Method in class PImage
-
-
( begin auto-generated from PImage_updatePixels.xml ) - - Updates the image with the data in its pixels[] array.
-
-
updateProjmodelview() - Method in class PGraphicsOpenGL
-
 
-
updateScrollBars() - Method in class JEditTextArea
-
-
Updates the state of the scroll bars.
-
-
updateTexels() - Method in class Texture
-
 
-
updateTexels(int, int, int, int) - Method in class Texture
-
 
-
updateTexture() - Method in class PGraphicsOpenGL
-
 
-
updateTexture(int, int, int, int) - Method in class PGraphicsOpenGL
-
 
-
updateTitle() - Method in class Editor
-
-
Set the title of the PDE window based on the current sketch, i.e.
-
-
upper() - Method in class StringList
-
-
Make the entire list upper case.
-
-
urlDecode(String) - Static method in class PApplet
-
 
-
urlEncode(String) - Static method in class PApplet
-
 
-
useNativeSelect - Static variable in class PApplet
-
-
Whether to use native (AWT) dialogs for selectInput and selectOutput.
-
-
useProgram(int) - Method in class PGL
-
 
-
useProgram(int) - Method in class PJOGL
-
 
-
usingMipmaps() - Method in class Texture
-
-
Returns true or false whether or not the texture is using mipmaps.
-
-
usingMipmaps(boolean, int) - Method in class Texture
-
 
-
usingRepeat() - Method in class Texture
-
-
Returns true or false whether or not the texture is using repeat wrap mode - along either U or V directions.
-
-
usingRepeat(boolean) - Method in class Texture
-
 
-
- - - -

V

-
-
V - Static variable in class PGraphics
-
 
-
VALIDATE_STATUS - Static variable in class PGL
-
 
-
validateProgram(int) - Method in class PGL
-
 
-
validateProgram(int) - Method in class PJOGL
-
 
-
validExtension(String) - Method in class Mode
-
-
Check this extension (no dots, please) against the list of valid - extensions.
-
-
value - Variable in class PFont.Glyph
-
 
-
value(int) - Method in class FloatDict
-
 
-
value(int) - Method in class IntDict
-
 
-
value(int) - Method in class StringDict
-
 
-
valueArray() - Method in class FloatDict
-
-
Create a new array and copy each of the values into it.
-
-
valueArray(float[]) - Method in class FloatDict
-
-
Fill an already-allocated array with the values (more efficient than - creating a new array each time).
-
-
valueArray() - Method in class IntDict
-
-
Create a new array and copy each of the values into it.
-
-
valueArray(int[]) - Method in class IntDict
-
-
Fill an already-allocated array with the values (more efficient than - creating a new array each time).
-
-
valueArray() - Method in class StringDict
-
-
Create a new array and copy each of the values into it.
-
-
valueArray(String[]) - Method in class StringDict
-
-
Fill an already-allocated array with the values (more efficient than - creating a new array each time).
-
-
valueExists(WindowsRegistry.REGISTRY_ROOT_KEY, String, String) - Static method in class WindowsRegistry
-
-
Check for existence of a value.
-
-
valueIterator() - Method in class IntDict
-
 
-
valueOf(String) - Static method in enum ContributionType
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in enum WindowsRegistry.REGISTRY_ROOT_KEY
-
-
Returns the enum constant of this type with the specified name.
-
-
values() - Static method in enum ContributionType
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum WindowsRegistry.REGISTRY_ROOT_KEY
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Method in class FloatDict
-
 
-
values() - Method in class FloatList
-
-
Returns the actual array being used to store the data.
-
-
values() - Method in class IntDict
-
 
-
values() - Method in class IntList
-
-
Returns the actual array being used to store the data.
-
-
values() - Method in class StringDict
-
 
-
values() - Method in class StringList
-
-
Returns the actual array being used to store the data.
-
-
VARIABLE_DEF - Static variable in interface JavaTokenTypes
-
 
-
VARIABLE_DEF - Static variable in interface PdePartialTokenTypes
-
 
-
VARIABLE_DEF - Static variable in interface PdeTokenTypes
-
 
-
VARIABLE_PARAMETER_DEF - Static variable in interface JavaTokenTypes
-
 
-
VARIABLE_PARAMETER_DEF - Static variable in interface PdePartialTokenTypes
-
 
-
VARIABLE_PARAMETER_DEF - Static variable in interface PdeTokenTypes
-
 
-
variableDeclarator(AST, AST) - Method in class JavaRecognizer
-
-
Declaration of a variable.
-
-
variableDeclarator(AST, AST) - Method in class PdeRecognizer
-
 
-
variableDefinitions(AST, AST) - Method in class JavaRecognizer
-
 
-
variableDefinitions(AST, AST) - Method in class PdeRecognizer
-
 
-
variableLengthParameterDeclaration() - Method in class JavaRecognizer
-
 
-
variableLengthParameterDeclaration() - Method in class PdeRecognizer
-
 
-
varInitializer() - Method in class JavaRecognizer
-
 
-
varInitializer() - Method in class PdeRecognizer
-
 
-
VENDOR - Static variable in class PGL
-
 
-
VERSION - Static variable in class PGL
-
 
-
vertex(float, float) - Method in class PApplet
-
 
-
vertex(float, float, float) - Method in class PApplet
-
 
-
vertex(float[]) - Method in class PApplet
-
-
Used by renderer subclasses or PShape to efficiently pass in already - formatted vertex information.
-
-
vertex(float, float, float, float) - Method in class PApplet
-
 
-
vertex(float, float, float, float, float) - Method in class PApplet
-
-
( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices.
-
-
VERTEX - Static variable in interface PConstants
-
 
-
vertex(float, float) - Method in class PGraphics
-
 
-
vertex(float, float, float) - Method in class PGraphics
-
 
-
vertex(float[]) - Method in class PGraphics
-
-
Used by renderer subclasses or PShape to efficiently pass in already - formatted vertex information.
-
-
vertex(float, float, float, float) - Method in class PGraphics
-
 
-
vertex(float, float, float, float, float) - Method in class PGraphics
-
-
( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices.
-
-
vertex(float, float) - Method in class PGraphicsFX2D
-
 
-
vertex(float, float, float) - Method in class PGraphicsFX2D
-
 
-
vertex(float[]) - Method in class PGraphicsFX2D
-
 
-
vertex(float, float, float, float) - Method in class PGraphicsFX2D
-
 
-
vertex(float, float, float, float, float) - Method in class PGraphicsFX2D
-
 
-
vertex(float, float) - Method in class PGraphicsJava2D
-
 
-
vertex(float, float, float) - Method in class PGraphicsJava2D
-
 
-
vertex(float[]) - Method in class PGraphicsJava2D
-
 
-
vertex(float, float, float, float) - Method in class PGraphicsJava2D
-
 
-
vertex(float, float, float, float, float) - Method in class PGraphicsJava2D
-
 
-
vertex(float, float) - Method in class PShape
-
 
-
vertex(float, float, float, float) - Method in class PShape
-
 
-
vertex(float, float, float) - Method in class PShape
-
 
-
vertex(float, float, float, float, float) - Method in class PShape
-
 
-
vertex(float, float, float) - Method in class PGraphics2D
-
 
-
vertex(float, float, float, float, float) - Method in class PGraphics2D
-
 
-
vertex(float, float) - Method in class PGraphicsOpenGL
-
 
-
vertex(float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
vertex(float, float, float) - Method in class PGraphicsOpenGL
-
 
-
vertex(float, float, float, float, float) - Method in class PGraphicsOpenGL
-
 
-
vertex(float, float) - Method in class PShapeOpenGL
-
 
-
vertex(float, float, float, float) - Method in class PShapeOpenGL
-
 
-
vertex(float, float, float) - Method in class PShapeOpenGL
-
 
-
vertex(float, float, float, float, float) - Method in class PShapeOpenGL
-
 
-
VERTEX_ATTRIB_ARRAY_BUFFER_BINDING - Static variable in class PGL
-
 
-
VERTEX_ATTRIB_ARRAY_ENABLED - Static variable in class PGL
-
 
-
VERTEX_ATTRIB_ARRAY_NORMALIZED - Static variable in class PGL
-
 
-
VERTEX_ATTRIB_ARRAY_POINTER - Static variable in class PGL
-
 
-
VERTEX_ATTRIB_ARRAY_SIZE - Static variable in class PGL
-
 
-
VERTEX_ATTRIB_ARRAY_STRIDE - Static variable in class PGL
-
 
-
VERTEX_ATTRIB_ARRAY_TYPE - Static variable in class PGL
-
 
-
VERTEX_FIELD_COUNT - Static variable in class PGraphics
-
 
-
VERTEX_SHADER - Static variable in class PGL
-
 
-
vertexAttri4fv(int, FloatBuffer) - Method in class PGL
-
 
-
vertexAttri4fv(int, FloatBuffer) - Method in class PJOGL
-
 
-
vertexAttrib1f(int, float) - Method in class PGL
-
 
-
vertexAttrib1f(int, float) - Method in class PJOGL
-
 
-
vertexAttrib1fv(int, FloatBuffer) - Method in class PGL
-
 
-
vertexAttrib1fv(int, FloatBuffer) - Method in class PJOGL
-
 
-
vertexAttrib2f(int, float, float) - Method in class PGL
-
 
-
vertexAttrib2f(int, float, float) - Method in class PJOGL
-
 
-
vertexAttrib2fv(int, FloatBuffer) - Method in class PGL
-
 
-
vertexAttrib2fv(int, FloatBuffer) - Method in class PJOGL
-
 
-
vertexAttrib3f(int, float, float, float) - Method in class PGL
-
 
-
vertexAttrib3f(int, float, float, float) - Method in class PJOGL
-
 
-
vertexAttrib3fv(int, FloatBuffer) - Method in class PGL
-
 
-
vertexAttrib3fv(int, FloatBuffer) - Method in class PJOGL
-
 
-
vertexAttrib4f(int, float, float, float, float) - Method in class PGL
-
 
-
vertexAttrib4f(int, float, float, float, float) - Method in class PJOGL
-
 
-
vertexAttribPointer(int, int, int, boolean, int, int) - Method in class PGL
-
 
-
vertexAttribPointer(int, int, int, boolean, int, Buffer) - Method in class PGL
-
 
-
vertexAttribPointer(int, int, int, boolean, int, int) - Method in class PJOGL
-
 
-
vertexAttribPointer(int, int, int, boolean, int, Buffer) - Method in class PJOGL
-
 
-
VIEWPORT - Static variable in class PGL
-
 
-
viewport(int, int, int, int) - Method in class PGL
-
 
-
viewport(int, int, int, int) - Method in class PJOGL
-
 
-
VOCAB - Static variable in interface JavaTokenTypes
-
 
-
VOCAB - Static variable in interface PdePartialTokenTypes
-
 
-
VOCAB - Static variable in interface PdeTokenTypes
-
 
-
VW - Static variable in class PGraphics
-
 
-
VX - Static variable in class PGraphics
-
 
-
VY - Static variable in class PGraphics
-
 
-
VZ - Static variable in class PGraphics
-
 
-
- - - -

W

-
-
WAIT - Static variable in interface PConstants
-
 
-
watch(Process) - Static method in class ProcessRegistry
-
-
When starting up a process
-
-
WEBCOLOR_LITERAL - Static variable in interface PdePartialTokenTypes
-
 
-
webcolor_literal() - Method in class PdeRecognizer
-
 
-
WEBCOLOR_LITERAL - Static variable in interface PdeTokenTypes
-
 
-
WebServer - Class in processing.app
-
-
This code is placed here in anticipation of running the reference from an - internal web server that reads the docs from a zip file, instead of using - thousands of .html files on the disk, which is really inefficient.
-
-
WebServer() - Constructor for class WebServer
-
 
-
WHEEL - Static variable in class MouseEvent
-
 
-
WHITESPACE - Static variable in interface PConstants
-
 
-
width - Variable in class PApplet
-
-
( begin auto-generated from width.xml ) - - System variable which stores the width of the display window.
-
-
width - Variable in class PFont.Glyph
-
 
-
width(char) - Method in class PFont
-
-
Width of this character for a font of size 1.
-
-
width - Variable in class PImage
-
-
( begin auto-generated from PImage_width.xml ) - - The width of the image in units of pixels.
-
-
width - Variable in class PShape
-
-
( begin auto-generated from PShape_width.xml ) - - The width of the PShape document.
-
-
width - Variable in class FrameBuffer
-
 
-
width - Variable in class Texture
-
 
-
WIKI - Static variable in class PGL
-
 
-
WILDCARD_TYPE - Static variable in interface JavaTokenTypes
-
 
-
WILDCARD_TYPE - Static variable in interface PdePartialTokenTypes
-
 
-
WILDCARD_TYPE - Static variable in interface PdeTokenTypes
-
 
-
wildcardType() - Method in class JavaRecognizer
-
 
-
wildcardType() - Method in class PdeRecognizer
-
 
-
WIND_EVEN_ODD - Static variable in class LinePath
-
-
The winding rule constant for specifying an even-odd rule - for determining the interior of a path.
-
-
WIND_NON_ZERO - Static variable in class LinePath
-
-
The winding rule constant for specifying a non-zero rule - for determining the interior of a path.
-
-
WINDOW_CLOSE_KEYSTROKE - Static variable in class Toolkit
-
-
Command-W on Mac OS X, Ctrl-W on Windows and Linux
-
-
windowGainedFocus(WindowEvent) - Method in class ChangeDetector
-
 
-
windowLostFocus(WindowEvent) - Method in class ChangeDetector
-
 
-
WINDOWS - Static variable in interface PConstants
-
 
-
WindowsPlatform - Class in processing.app.platform
-
-
Platform-specific glue for Windows.
-
-
WindowsPlatform() - Constructor for class WindowsPlatform
-
 
-
WindowsPlatform.WinLibC - Interface in processing.app.platform
-
 
-
WindowsRegistry - Class in processing.app.platform
-
-
Methods for accessing the Windows Registry.
-
-
WindowsRegistry() - Constructor for class WindowsRegistry
-
 
-
WindowsRegistry.REGISTRY_ROOT_KEY - Enum in processing.app.platform
-
 
-
wrapU - Variable in class Texture.Parameters
-
-
Wrapping mode along U.
-
-
wrapV - Variable in class Texture.Parameters
-
-
Wrapping mode along V.
-
-
write(PrintWriter) - Method in class FloatDict
-
-
Write tab-delimited entries out to
-
-
write(PrintWriter) - Method in class IntDict
-
-
Write tab-delimited entries out to
-
-
write(PrintWriter) - Method in class JSONArray
-
 
-
write(PrintWriter, String) - Method in class JSONArray
-
 
-
write(PrintWriter) - Method in class JSONObject
-
 
-
write(PrintWriter, String) - Method in class JSONObject
-
 
-
write(PrintWriter) - Method in class StringDict
-
-
Write tab-delimited entries out to
-
-
write(PrintWriter) - Method in class XML
-
 
-
WRITE_ONLY - Static variable in class PGL
-
 
-
writePropertiesFile(File) - Method in class AvailableContribution
-
-
We overwrite those fields that aren't proper in the properties file with - the curated version from the Processing site.
-
-
WS - Static variable in interface JavaTokenTypes
-
 
-
WS - Static variable in interface PdePartialTokenTypes
-
 
-
WS - Static variable in interface PdeTokenTypes
-
 
-
- - - -

X

-
-
X - Static variable in interface PConstants
-
 
-
x - Variable in class PVector
-
-
( begin auto-generated from PVector_x.xml ) - - The x component of the vector.
-
-
XML - Class in processing.data
-
-
This is the base class used for the Processing XML library, - representing a single node of an XML tree.
-
-
XML(File) - Constructor for class XML
-
-
Advanced users only; use loadXML() in PApplet.
-
-
XML(File, String) - Constructor for class XML
-
-
Advanced users only; use loadXML() in PApplet.
-
-
XML(InputStream) - Constructor for class XML
-
 
-
XML(InputStream, String) - Constructor for class XML
-
-
Unlike the loadXML() method in PApplet, this version works with files - that are not in UTF-8 format.
-
-
XML(Reader) - Constructor for class XML
-
-
Advanced users only; use loadXML() in PApplet.
-
-
XML(Reader, String) - Constructor for class XML
-
-
Advanced users only; use loadXML() in PApplet.
-
-
XML(String) - Constructor for class XML
-
 
-
xToOffset(int, int) - Method in class JEditTextArea
-
-
Converts an x co-ordinate to an offset within a line.
-
-
xyToOffset(int, int) - Method in class JEditTextArea
-
-
Converts a point to an offset, from the start of the text.
-
-
- - - -

Y

-
-
Y - Static variable in interface PConstants
-
 
-
y - Variable in class PVector
-
-
( begin auto-generated from PVector_y.xml ) - - The y component of the vector.
-
-
year() - Static method in class PApplet
-
-
( begin auto-generated from year.xml ) - - Processing communicates with the clock on your computer.
-
-
yToLine(int) - Method in class JEditTextArea
-
-
Converts a y co-ordinate to a line index.
-
-
- - - -

Z

-
-
Z - Static variable in interface PConstants
-
 
-
z - Variable in class PVector
-
-
( begin auto-generated from PVector_z.xml ) - - The z component of the vector.
-
-
ZERO - Static variable in class PGL
-
 
-
- - - -

_

-
-
_offsetToX(int, int) - Method in class JEditTextArea
-
-
Converts an offset in a line into an x coordinate.
-
-
_putenv(String) - Method in interface WindowsPlatform.WinLibC
-
 
-
_tokenNames - Static variable in class JavaRecognizer
-
 
-
_tokenNames - Static variable in class PdeRecognizer
-
 
-
_tokenSet_0 - Static variable in class JavaLexer
-
 
-
_tokenSet_0 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_0 - Static variable in class PdeLexer
-
 
-
_tokenSet_0 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_1 - Static variable in class JavaLexer
-
 
-
_tokenSet_1 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_1 - Static variable in class PdeLexer
-
 
-
_tokenSet_1 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_10 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_10 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_11 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_11 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_12 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_12 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_13 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_13 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_14 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_14 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_15 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_15 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_16 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_16 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_17 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_17 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_18 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_18 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_19 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_19 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_2 - Static variable in class JavaLexer
-
 
-
_tokenSet_2 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_2 - Static variable in class PdeLexer
-
 
-
_tokenSet_2 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_20 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_20 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_21 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_21 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_22 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_22 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_23 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_23 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_24 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_24 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_25 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_25 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_26 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_26 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_27 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_27 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_28 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_28 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_29 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_29 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_3 - Static variable in class JavaLexer
-
 
-
_tokenSet_3 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_3 - Static variable in class PdeLexer
-
 
-
_tokenSet_3 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_30 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_30 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_31 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_31 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_32 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_32 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_33 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_33 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_34 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_34 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_35 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_35 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_36 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_36 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_37 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_37 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_38 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_38 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_39 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_39 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_4 - Static variable in class JavaLexer
-
 
-
_tokenSet_4 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_4 - Static variable in class PdeLexer
-
 
-
_tokenSet_4 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_40 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_40 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_41 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_41 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_42 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_42 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_43 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_43 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_44 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_44 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_45 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_45 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_46 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_46 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_47 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_47 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_48 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_48 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_49 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_5 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_5 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_50 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_51 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_52 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_53 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_6 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_6 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_7 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_7 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_8 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_8 - Static variable in class PdeRecognizer
-
 
-
_tokenSet_9 - Static variable in class JavaRecognizer
-
 
-
_tokenSet_9 - Static variable in class 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 deleted file mode 100644 index fe32431936..0000000000 --- a/build/javadoc/everything/index.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - -Generated Documentation (Untitled) - - - - - - - - - -<noscript> -<div>JavaScript is disabled on your browser.</div> -</noscript> -<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. Link to <a href="overview-summary.html">Non-frame version</a>.</p> - - - diff --git a/build/javadoc/everything/overview-frame.html b/build/javadoc/everything/overview-frame.html deleted file mode 100644 index 3f9aa2cf0c..0000000000 --- a/build/javadoc/everything/overview-frame.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - -Overview List - - - - - - -

 

- - diff --git a/build/javadoc/everything/overview-summary.html b/build/javadoc/everything/overview-summary.html deleted file mode 100644 index ac391cfd89..0000000000 --- a/build/javadoc/everything/overview-summary.html +++ /dev/null @@ -1,176 +0,0 @@ - - - - - -Overview - - - - - - - -
- - - - - - - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Packages 
PackageDescription
processing.app 
processing.app.contrib 
processing.app.exec 
processing.app.platform 
processing.app.syntax 
processing.app.syntax.im 
processing.app.tools 
processing.core 
processing.data 
processing.event 
processing.mode.java.preproc 
processing.opengl 
-
- -
- - - - - - - -
- - - - diff --git a/build/javadoc/everything/overview-tree.html b/build/javadoc/everything/overview-tree.html deleted file mode 100644 index efcff5e533..0000000000 --- a/build/javadoc/everything/overview-tree.html +++ /dev/null @@ -1,485 +0,0 @@ - - - - - -Class Hierarchy - - - - - - - -
- - - - - - - -
- - - -
-

Class Hierarchy

- -

Interface Hierarchy

- -

Enum Hierarchy

- -
- -
- - - - - - - -
- - - - diff --git a/build/javadoc/everything/package-list b/build/javadoc/everything/package-list deleted file mode 100644 index bdf5da2c7f..0000000000 --- a/build/javadoc/everything/package-list +++ /dev/null @@ -1,12 +0,0 @@ -processing.app -processing.app.contrib -processing.app.exec -processing.app.platform -processing.app.syntax -processing.app.syntax.im -processing.app.tools -processing.core -processing.data -processing.event -processing.mode.java.preproc -processing.opengl diff --git a/build/javadoc/everything/processing/app/About.html b/build/javadoc/everything/processing/app/About.html deleted file mode 100644 index a3d590f9b1..0000000000 --- a/build/javadoc/everything/processing/app/About.html +++ /dev/null @@ -1,360 +0,0 @@ - - - - - -About - - - - - - - - - - - -
-
processing.app
-

Class About

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        About

        -
        public About(Frame frame)
        -
      • -
      -
    • -
    - - -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/Base.html b/build/javadoc/everything/processing/app/Base.html deleted file mode 100644 index 76652f452b..0000000000 --- a/build/javadoc/everything/processing/app/Base.html +++ /dev/null @@ -1,1849 +0,0 @@ - - - - - -Base - - - - - - - - - - - -
-
processing.app
-

Class Base

-
-
- -
-
    -
  • -
    -
    -
    public class Base
    -extends 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 Detail

      - - - -
        -
      • -

        DEBUG

        -
        public static boolean DEBUG
        -
        True if heavy debugging error/log messages are enabled
        -
      • -
      - - - -
        -
      • -

        defaultFileMenu

        -
        public static JMenu defaultFileMenu
        -
        A lone file menu to be used when all sketch windows are closed.
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main(String[] args)
        -
      • -
      - - - -
        -
      • -

        setCommandLine

        -
        public static void setCommandLine()
        -
      • -
      - - - -
        -
      • -

        initPlatform

        -
        public static void initPlatform()
        -
      • -
      - - - -
        -
      • -

        getActiveEditor

        -
        public Editor getActiveEditor()
        -
        Returns the front most, active editor window.
        -
      • -
      - - - -
        -
      • -

        getEditors

        -
        public List<Editor> getEditors()
        -
        Get the list of currently active editor windows.
        -
      • -
      - - - - - - - -
        -
      • -

        getModeList

        -
        public List<Mode> getModeList()
        -
      • -
      - - - - - - - -
        -
      • -

        handleNew

        -
        public void handleNew()
        -
        Create a new untitled document in a new sketch window.
        -
      • -
      - - - -
        -
      • -

        getDefaultMode

        -
        public Mode getDefaultMode()
        -
      • -
      - - - -
        -
      • -

        getNextMode

        -
        public Mode getNextMode()
        -
        Used by ThinkDifferent so that it can have a Sketchbook menu.
        -
      • -
      - - - -
        -
      • -

        handleOpenPrompt

        -
        public void handleOpenPrompt()
        -
        Prompt for a sketch to open, and open it in a new window.
        -
      • -
      - - - -
        -
      • -

        handleOpen

        -
        public Editor handleOpen(String path)
        -
        Open a sketch from the path specified. Do not use for untitled sketches.
        -
      • -
      - - - -
        -
      • -

        handleOpen

        -
        public Editor handleOpen(String path,
        -                         boolean untitled)
        -
        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,
        -                           boolean modeSwitch)
        -
        Close a sketch as specified by its editor window.
        -
        -
        Parameters:
        -
        editor - Editor object of the sketch to be closed.
        -
        modeSwitch - Whether this close is being done in the context of a - mode switch.
        -
        Returns:
        -
        true if succeeded in closing, false if canceled.
        -
        -
      • -
      - - - -
        -
      • -

        handleQuit

        -
        public boolean handleQuit()
        -
        Handler for File → Quit.
        -
        -
        Returns:
        -
        false if canceled, true otherwise.
        -
        -
      • -
      - - - -
        -
      • -

        thinkDifferentExamples

        -
        public void thinkDifferentExamples()
        -
      • -
      - - - -
        -
      • -

        populateSketchbookMenu

        -
        public void populateSketchbookMenu(JMenu menu)
        -
      • -
      - - - -
        -
      • -

        getRecentMenu

        -
        public JMenu getRecentMenu()
        -
      • -
      - - - -
        -
      • -

        getToolbarRecentMenu

        -
        public JMenu getToolbarRecentMenu()
        -
      • -
      - - - -
        -
      • -

        handleRecent

        -
        public void handleRecent(Editor editor)
        -
      • -
      - - - -
        -
      • -

        handleRecentRename

        -
        public void handleRecentRename(Editor editor,
        -                               String oldPath)
        -
      • -
      - - - -
        -
      • -

        removeRecent

        -
        public void removeRecent(Editor editor)
        -
        Called before a sketch is renamed so that its old name is - no longer in the menu.
        -
      • -
      - - - -
        -
      • -

        handlePrefs

        -
        public void handlePrefs()
        -
        Show the Preferences window.
        -
      • -
      - - - -
        -
      • -

        handleOpenLibraryManager

        -
        public void handleOpenLibraryManager()
        -
        Show the library installer window.
        -
      • -
      - - - -
        -
      • -

        handleOpenToolManager

        -
        public void handleOpenToolManager()
        -
        Show the tool installer window.
        -
      • -
      - - - -
        -
      • -

        handleOpenModeManager

        -
        public void handleOpenModeManager()
        -
        Show the mode installer window.
        -
      • -
      - - - -
        -
      • -

        handleOpenExampleManager

        -
        public void handleOpenExampleManager()
        -
        Show the examples installer window.
        -
      • -
      - - - -
        -
      • -

        handleShowUpdates

        -
        public void handleShowUpdates()
        -
      • -
      - - - -
        -
      • -

        getRevision

        -
        public static int getRevision()
        -
      • -
      - - - -
        -
      • -

        getVersionName

        -
        public static String getVersionName()
        -
        Return the version name, something like 1.5 or 2.0b8 or 0213 if it's not - a release version.
        -
      • -
      - - - -
        -
      • -

        getPlatform

        -
        public static Platform getPlatform()
        -
      • -
      - - - -
        -
      • -

        getPlatformName

        -
        public static String getPlatformName()
        -
      • -
      - - - -
        -
      • -

        getNativeBits

        -
        public static int getNativeBits()
        -
        Return whether sketches will run as 32- or 64-bits based - on the JVM that's in use.
        -
      • -
      - - - -
        -
      • -

        getPlatformName

        -
        public static 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(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 File getSettingsFolder()
        -
        Get the directory that can store settings. (Library on OS X, App Data or - something similar on Windows, a dot folder on Linux.) Removed this as a - preference for 3.0a3 because we need this to be stable.
        -
      • -
      - - - -
        -
      • -

        getSettingsFile

        -
        public static File getSettingsFile(String filename)
        -
        Convenience method to get a File object for the specified filename inside - the settings folder. Used to get preferences and recent sketch files.
        -
        -
        Parameters:
        -
        filename - A file inside the settings folder.
        -
        Returns:
        -
        filename wrapped as a File object inside the settings folder
        -
        -
      • -
      - - - -
        -
      • -

        createTempFolder

        -
        public static File createTempFolder(String prefix,
        -                                    String suffix,
        -                                    File directory)
        -                             throws IOException
        -
        Create a temporary folder by using the createTempFile() mechanism, - deleting the file it creates, and making a folder using the location - that was provided. - - Unlike createTempFile(), there is no minimum size for prefix. If - prefix is less than 3 characters, the remaining characters will be - filled with underscores
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        getToolsFolder

        -
        public static File getToolsFolder()
        -
      • -
      - - - -
        -
      • -

        locateSketchbookFolder

        -
        public static void locateSketchbookFolder()
        -
      • -
      - - - -
        -
      • -

        setSketchbookFolder

        -
        public void setSketchbookFolder(File folder)
        -
      • -
      - - - -
        -
      • -

        getSketchbookFolder

        -
        public static File getSketchbookFolder()
        -
      • -
      - - - -
        -
      • -

        getSketchbookLibrariesFolder

        -
        public static File getSketchbookLibrariesFolder()
        -
      • -
      - - - -
        -
      • -

        getSketchbookToolsFolder

        -
        public static File getSketchbookToolsFolder()
        -
      • -
      - - - -
        -
      • -

        getSketchbookModesFolder

        -
        public static File getSketchbookModesFolder()
        -
      • -
      - - - -
        -
      • -

        getSketchbookExamplesFolder

        -
        public static File getSketchbookExamplesFolder()
        -
      • -
      - - - -
        -
      • -

        openURL

        -
        public static void openURL(String url)
        -
        Implements the cross-platform headache of opening URLs. - - For 2.0a8 and later, this requires the parameter to be an actual URL, - meaning that you can't send it a file:// path without a prefix. It also - just calls into Platform, which now uses java.awt.Desktop (where - possible, meaning not on Linux) now that we're requiring Java 6. - As it happens the URL must also be properly URL-encoded.
        -
      • -
      - - - -
        -
      • -

        openFolder

        -
        public static void openFolder(File file)
        -
        Implements the other cross-platform headache of opening - a folder in the machine's native file browser.
        -
      • -
      - - - -
        -
      • -

        showMessage

        -
        public static void showMessage(String title,
        -                               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(String title,
        -                               String message)
        -
        Non-fatal error message.
        -
      • -
      - - - -
        -
      • -

        showWarning

        -
        public static void showWarning(String title,
        -                               String message,
        -                               Throwable e)
        -
        Non-fatal error message with optional stack trace side dish.
        -
      • -
      - - - -
        -
      • -

        showWarningTiered

        -
        public static void showWarningTiered(String title,
        -                                     String primary,
        -                                     String secondary,
        -                                     Throwable e)
        -
        Non-fatal error message with optional stack trace side dish.
        -
      • -
      - - - -
        -
      • -

        showError

        -
        public static void showError(String title,
        -                             String message,
        -                             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.
        -
      • -
      - - - -
        -
      • -

        showYesNoCancelQuestion

        -
        public static int showYesNoCancelQuestion(Editor editor,
        -                                          String title,
        -                                          String primary,
        -                                          String secondary)
        -
      • -
      - - - -
        -
      • -

        showYesNoQuestion

        -
        public static int showYesNoQuestion(Frame editor,
        -                                    String title,
        -                                    String primary,
        -                                    String secondary)
        -
      • -
      - - - -
        -
      • -

        getContentFile

        -
        public static File getContentFile(String name)
        -
        Get reference to a file adjacent to the executable on Windows and Linux, - or inside Contents/Resources/Java on Mac OS X.
        -
      • -
      - - - -
        -
      • -

        getJavaHome

        -
        public static File getJavaHome()
        -
      • -
      - - - -
        -
      • -

        getJavaPath

        -
        public static String getJavaPath()
        -
        Get the path to the embedded Java executable.
        -
      • -
      - - - -
        -
      • -

        getLibFile

        -
        public static File getLibFile(String filename)
        -                       throws IOException
        -
        Return a File from inside the Processing 'lib' folder.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        getLibStream

        -
        public static InputStream getLibStream(String filename)
        -                                throws IOException
        -
        Return an InputStream for a file inside the Processing lib folder.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        countLines

        -
        public static int countLines(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(File file)
        -                           throws IOException
        -
        Same as PApplet.loadBytes(), however never does gzip decoding.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        readSettings

        -
        public static Map<String,String> readSettings(File inputFile)
        -
        Read from a file with a bunch of attribute/value pairs - that are separated by = and ignore comments with #. - Changed in 3.0a6 to return null (rather than empty hash) if no file, - and changed return type to Map instead of HashMap.
        -
      • -
      - - - -
        -
      • -

        readSettings

        -
        public static Map<String,String> readSettings(String filename,
        -                                              String[] lines)
        -
        Parse a String array that contains attribute/value pairs separated - by = (the equals sign). The # (hash) symbol is used to denote comments. - Comments can be anywhere on a line. Blank lines are ignored. - In 3.0a6, no longer taking a blank HahMap as param; no cases in the main - PDE code of adding to a (Hash)Map. Also returning the Map instead of void. - Both changes modify the method signature, but this was only used by the - contrib classes.
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        saveFile

        -
        public static void saveFile(String str,
        -                            File file)
        -                     throws IOException
        -
        Spew the contents of a String object out to a file.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        copyDir

        -
        public static void copyDir(File sourceDir,
        -                           File targetDir)
        -                    throws 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:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        platformDelete

        -
        public static boolean platformDelete(File file)
        -                              throws IOException
        -
        Delete a file or directory in a platform-specific manner. Removes a File - object (a file or directory) from the system by placing it in the Trash - or Recycle Bin (if available) or simply deleting it (if not). - - When the file/folder is on another file system, it may simply be removed - immediately, without additional warning. So only use this if you want to, - you know, "delete" the subject in question. - - NOTE: Not yet tested nor ready for prime-time.
        -
        -
        Parameters:
        -
        file - the victim (a directory or individual file)
        -
        Returns:
        -
        true if all ends well
        -
        Throws:
        -
        IOException - what went wrong
        -
        -
      • -
      - - - -
        -
      • -

        removeDir

        -
        public static void removeDir(File dir)
        -
        Remove all files in a directory and the directory itself.
        -
      • -
      - - - -
        -
      • -

        removeDescendants

        -
        public static void removeDescendants(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(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 String[] listFiles(File folder,
        -                                 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 String[] listFiles(File folder,
        -                                 boolean relative,
        -                                 String extension)
        -
      • -
      - - - -
        -
      • -

        listJarFiles

        -
        public static File[] listJarFiles(File folder)
        -
        -
        Parameters:
        -
        folder - source folder to search
        -
        Returns:
        -
        a list of .jar and .zip files in that folder
        -
        -
      • -
      - - - -
        -
      • -

        contentsToClassPath

        -
        public static String contentsToClassPath(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 String[] packageListFromClassPath(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
        -
        -
      • -
      - - - -
        -
      • -

        unzip

        -
        public static void unzip(File zipFile,
        -                         File dest)
        -
      • -
      - - - -
        -
      • -

        log

        -
        public static void log(Object from,
        -                       String message)
        -
      • -
      - - - -
        -
      • -

        log

        -
        public static void log(String message)
        -
      • -
      - - - -
        -
      • -

        logf

        -
        public static void logf(String message,
        -                        Object... args)
        -
      • -
      - - - - - - - -
        -
      • -

        loge

        -
        public static void loge(String message)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/ChangeDetector.html b/build/javadoc/everything/processing/app/ChangeDetector.html deleted file mode 100644 index 2bcab415ee..0000000000 --- a/build/javadoc/everything/processing/app/ChangeDetector.html +++ /dev/null @@ -1,294 +0,0 @@ - - - - - -ChangeDetector - - - - - - - - - - - -
-
processing.app
-

Class ChangeDetector

-
-
-
    -
  • Object
  • -
  • -
      -
    • ChangeDetector
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/ColorChooser.ColorListener.html b/build/javadoc/everything/processing/app/ColorChooser.ColorListener.html deleted file mode 100644 index cd6426fff9..0000000000 --- a/build/javadoc/everything/processing/app/ColorChooser.ColorListener.html +++ /dev/null @@ -1,315 +0,0 @@ - - - - - -ColorChooser.ColorListener - - - - - - - - - - - -
-
processing.app
-

Class ColorChooser.ColorListener

-
-
-
    -
  • Object
  • -
  • -
      -
    • ColorChooser.ColorListener
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/ColorChooser.ColorRange.html b/build/javadoc/everything/processing/app/ColorChooser.ColorRange.html deleted file mode 100644 index c62296a599..0000000000 --- a/build/javadoc/everything/processing/app/ColorChooser.ColorRange.html +++ /dev/null @@ -1,422 +0,0 @@ - - - - - -ColorChooser.ColorRange - - - - - - - - - - - -
-
processing.app
-

Class ColorChooser.ColorRange

-
-
- -
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/ColorChooser.ColorSlider.html b/build/javadoc/everything/processing/app/ColorChooser.ColorSlider.html deleted file mode 100644 index 2a613806c1..0000000000 --- a/build/javadoc/everything/processing/app/ColorChooser.ColorSlider.html +++ /dev/null @@ -1,422 +0,0 @@ - - - - - -ColorChooser.ColorSlider - - - - - - - - - - - -
-
processing.app
-

Class ColorChooser.ColorSlider

-
-
- -
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/ColorChooser.html b/build/javadoc/everything/processing/app/ColorChooser.html deleted file mode 100644 index 1168c3ad62..0000000000 --- a/build/javadoc/everything/processing/app/ColorChooser.html +++ /dev/null @@ -1,358 +0,0 @@ - - - - - -ColorChooser - - - - - - - - - - - -
-
processing.app
-

Class ColorChooser

-
-
-
    -
  • Object
  • -
  • -
      -
    • ColorChooser
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class ColorChooser
    -extends Object
    -
    Generic color selector frame, pulled from the Tool object. API not really - worked out here (what should the constructor be? how flexible?) So use with - caution and be ready for it to break in future releases.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ColorChooser

        -
        public ColorChooser(Frame owner,
        -                    boolean modal,
        -                    Color initialColor,
        -                    String buttonName,
        -                    ActionListener buttonListener)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        show

        -
        public void show()
        -
      • -
      - - - -
        -
      • -

        hide

        -
        public void hide()
        -
      • -
      - - - -
        -
      • -

        getColor

        -
        public Color getColor()
        -
      • -
      - - - -
        -
      • -

        setColor

        -
        public void setColor(Color color)
        -
      • -
      - - - -
        -
      • -

        getHexColor

        -
        public String getHexColor()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/Editor.html b/build/javadoc/everything/processing/app/Editor.html deleted file mode 100644 index f45f216187..0000000000 --- a/build/javadoc/everything/processing/app/Editor.html +++ /dev/null @@ -1,1645 +0,0 @@ - - - - - -Editor - - - - - - - - - - - -
-
processing.app
-

Class Editor

-
-
- -
- -
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        removeToolContrib

        -
        public void removeToolContrib(ToolContribution tc)
        -
      • -
      - - - - - - - -
        -
      • -

        getEditorState

        -
        public EditorState getEditorState()
        -
      • -
      - - - -
        -
      • -

        removeRecent

        -
        public void removeRecent()
        -
      • -
      - - - -
        -
      • -

        addRecent

        -
        public void addRecent()
        -
      • -
      - - - -
        -
      • -

        getBase

        -
        public Base getBase()
        -
      • -
      - - - -
        -
      • -

        getMode

        -
        public Mode getMode()
        -
      • -
      - - - -
        -
      • -

        rebuildModeMenu

        -
        public void rebuildModeMenu()
        -
      • -
      - - - -
        -
      • -

        getModeMenu

        -
        public JMenu getModeMenu()
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        createToolbar

        -
        public abstract EditorToolbar createToolbar()
        -
      • -
      - - - -
        -
      • -

        rebuildToolbar

        -
        public void rebuildToolbar()
        -
      • -
      - - - -
        -
      • -

        createFormatter

        -
        public abstract Formatter createFormatter()
        -
      • -
      - - - -
        -
      • -

        buildFileMenu

        -
        public abstract JMenu buildFileMenu()
        -
      • -
      - - - -
        -
      • -

        buildSketchMenu

        -
        public abstract JMenu buildSketchMenu()
        -
      • -
      - - - -
        -
      • -

        handleImportLibrary

        -
        public abstract void handleImportLibrary(String name)
        -
      • -
      - - - -
        -
      • -

        getToolMenu

        -
        public JMenu getToolMenu()
        -
      • -
      - - - -
        -
      • -

        rebuildToolMenu

        -
        public void rebuildToolMenu()
        -
      • -
      - - - -
        -
      • -

        clearToolMenu

        -
        public void clearToolMenu()
        -
      • -
      - - - -
        -
      • -

        removeTool

        -
        public void removeTool()
        -
      • -
      - - - -
        -
      • -

        buildModeMenu

        -
        public JMenu buildModeMenu()
        -
        Override this if you want a special menu for your particular 'mode'.
        -
      • -
      - - - -
        -
      • -

        buildHelpMenu

        -
        public abstract JMenu buildHelpMenu()
        -
      • -
      - - - -
        -
      • -

        showReference

        -
        public void showReference(String filename)
        -
      • -
      - - - -
        -
      • -

        showReferenceFile

        -
        public void showReferenceFile(File file)
        -
        Given the .html file, displays it in the default browser.
        -
        -
        Parameters:
        -
        file -
        -
        -
      • -
      - - - -
        -
      • -

        showChanges

        -
        public static void showChanges()
        -
      • -
      - - - -
        -
      • -

        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 String getText()
        -
        Get the contents of the current buffer. Used by the Sketch class.
        -
      • -
      - - - -
        -
      • -

        getText

        -
        public String getText(int start,
        -                      int stop)
        -
        Get a range of text from the current buffer.
        -
      • -
      - - - -
        -
      • -

        setText

        -
        public void setText(String what)
        -
        Replace the entire contents of the front-most tab.
        -
      • -
      - - - -
        -
      • -

        insertText

        -
        public void insertText(String what)
        -
      • -
      - - - -
        -
      • -

        getSelectedText

        -
        public 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(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 String getLineText(int line)
        -
        Get text for a specified line.
        -
      • -
      - - - -
        -
      • -

        setLineText

        -
        public void setLineText(int line,
        -                        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.
        -
      • -
      - - - -
        -
      • -

        handleCopyAsHTML

        -
        public void handleCopyAsHTML()
        -
      • -
      - - - -
        -
      • -

        handlePaste

        -
        public void handlePaste()
        -
        Implements Edit → Paste.
        -
      • -
      - - - -
        -
      • -

        handleSelectAll

        -
        public void handleSelectAll()
        -
        Implements Edit → Select All.
        -
      • -
      - - - -
        -
      • -

        handleAutoFormat

        -
        public void handleAutoFormat()
        -
      • -
      - - - -
        -
      • -

        getCommentPrefix

        -
        public abstract String getCommentPrefix()
        -
      • -
      - - - -
        -
      • -

        handleIndent

        -
        public void handleIndent()
        -
      • -
      - - - -
        -
      • -

        handleOutdent

        -
        public void handleOutdent()
        -
      • -
      - - - -
        -
      • -

        handleIndentOutdent

        -
        public void handleIndentOutdent(boolean indent)
        -
      • -
      - - - -
        -
      • -

        checkParen

        -
        public static boolean checkParen(char[] array,
        -                                 int index,
        -                                 int stop)
        -
      • -
      - - - -
        -
      • -

        setSketchLocation

        -
        public void setSketchLocation(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 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.
        -
      • -
      - - - -
        -
      • -

        updateTitle

        -
        public void updateTitle()
        -
        Set the title of the PDE window based on the current sketch, i.e. - something like "sketch_070752a - Processing 0126"
        -
      • -
      - - - -
        -
      • -

        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()
        -
      • -
      - - - -
        -
      • -

        handlePageSetup

        -
        public void handlePageSetup()
        -
        Handler for File → Page Setup.
        -
      • -
      - - - -
        -
      • -

        handlePrint

        -
        public void handlePrint()
        -
        Handler for File → Print.
        -
      • -
      - - - -
        -
      • -

        prepareRun

        -
        public void prepareRun()
        -
        Grab current contents of the sketch window, advance the console, - stop any other running sketches... not in that order.
        -
      • -
      - - - -
        -
      • -

        internalCloseRunner

        -
        public abstract void internalCloseRunner()
        -
        Halt the current runner for whatever reason. Might be the VM dying, - the window closing, an error...
        -
      • -
      - - - -
        -
      • -

        deactivateRun

        -
        public abstract void deactivateRun()
        -
      • -
      - - - -
        -
      • -

        statusError

        -
        public void statusError(String what)
        -
        Show an error in the status bar.
        -
        -
        Specified by:
        -
        statusError in interface RunnerListener
        -
        -
      • -
      - - - - - - - -
        -
      • -

        statusNotice

        -
        public void statusNotice(String msg)
        -
        Show a notice message in the editor status bar.
        -
        -
        Specified by:
        -
        statusNotice in interface RunnerListener
        -
        -
      • -
      - - - -
        -
      • -

        clearNotice

        -
        public void clearNotice(String msg)
        -
      • -
      - - - -
        -
      • -

        getStatusMessage

        -
        public String getStatusMessage()
        -
        Returns the current notice message in the editor status bar.
        -
      • -
      - - - -
        -
      • -

        getStatusMode

        -
        public int getStatusMode()
        -
        Returns the current mode of the editor status bar: NOTICE, ERR or EDIT.
        -
      • -
      - - - -
        -
      • -

        statusEmpty

        -
        public void statusEmpty()
        -
        Clear the status area.
        -
      • -
      - - - - - - - - - - - - - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/EditorButton.html b/build/javadoc/everything/processing/app/EditorButton.html deleted file mode 100644 index c13b19ef76..0000000000 --- a/build/javadoc/everything/processing/app/EditorButton.html +++ /dev/null @@ -1,694 +0,0 @@ - - - - - -EditorButton - - - - - - - - - - - -
-
processing.app
-

Class EditorButton

-
-
- -
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/EditorConsole.html b/build/javadoc/everything/processing/app/EditorConsole.html deleted file mode 100644 index 8fa047808b..0000000000 --- a/build/javadoc/everything/processing/app/EditorConsole.html +++ /dev/null @@ -1,468 +0,0 @@ - - - - - -EditorConsole - - - - - - - - - - - -
-
processing.app
-

Class EditorConsole

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    ImageObserver, MenuContainer, Serializable, Accessible, ScrollPaneConstants
    -
    -
    -
    -
    public class EditorConsole
    -extends JScrollPane
    -
    Message console that sits below the editing area. -

    - Be careful when debugging this class, because if it's throwing exceptions, - don't take over System.err, and debug while watching just System.out - or just call println() or whatever directly to systemOut or systemErr. -

    - Also note that encodings will not work properly when run from Eclipse. This - means that if you use non-ASCII characters in a println() or some such, - the characters won't print properly in the Processing and/or Eclipse console. - It seems that Eclipse's console-grabbing and that of Processing don't - get along with one another. Use 'ant run' to work on encoding-related issues.

    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        EditorConsole

        -
        public EditorConsole(Editor editor)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - - - - - -
        -
      • -

        setEditor

        -
        public static void setEditor(Editor editor)
        -
      • -
      - - - -
        -
      • -

        handleQuit

        -
        public static 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.

        -
      • -
      - - - -
        -
      • -

        message

        -
        public void message(String what,
        -                    boolean err)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/EditorFooter.html b/build/javadoc/everything/processing/app/EditorFooter.html deleted file mode 100644 index 6cd8152030..0000000000 --- a/build/javadoc/everything/processing/app/EditorFooter.html +++ /dev/null @@ -1,426 +0,0 @@ - - - - - -EditorFooter - - - - - - - - - - - -
-
processing.app
-

Class EditorFooter

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        EditorFooter

        -
        public EditorFooter(Editor eddie)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        setPanel

        -
        public void setPanel(Component comp)
        -
      • -
      - - - -
        -
      • -

        setNotification

        -
        public void setNotification(Component comp,
        -                            boolean note)
        -
      • -
      - - - -
        -
      • -

        updateMode

        -
        public void updateMode()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/EditorHeader.html b/build/javadoc/everything/processing/app/EditorHeader.html deleted file mode 100644 index 96a5975c3f..0000000000 --- a/build/javadoc/everything/processing/app/EditorHeader.html +++ /dev/null @@ -1,474 +0,0 @@ - - - - - -EditorHeader - - - - - - - - - - - -
-
processing.app
-

Class EditorHeader

-
-
- -
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/EditorState.html b/build/javadoc/everything/processing/app/EditorState.html deleted file mode 100644 index bda26c82c8..0000000000 --- a/build/javadoc/everything/processing/app/EditorState.html +++ /dev/null @@ -1,238 +0,0 @@ - - - - - -EditorState - - - - - - - - - - - -
-
processing.app
-

Class EditorState

-
-
-
    -
  • Object
  • -
  • -
      -
    • EditorState
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class EditorState
    -extends Object
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/EditorStatus.html b/build/javadoc/everything/processing/app/EditorStatus.html deleted file mode 100644 index c277403717..0000000000 --- a/build/javadoc/everything/processing/app/EditorStatus.html +++ /dev/null @@ -1,564 +0,0 @@ - - - - - -EditorStatus - - - - - - - - - - - -
-
processing.app
-

Class EditorStatus

-
-
- -
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/EditorToolbar.html b/build/javadoc/everything/processing/app/EditorToolbar.html deleted file mode 100644 index a9727e7a9f..0000000000 --- a/build/javadoc/everything/processing/app/EditorToolbar.html +++ /dev/null @@ -1,561 +0,0 @@ - - - - - -EditorToolbar - - - - - - - - - - - -
-
processing.app
-

Class EditorToolbar

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        EditorToolbar

        -
        public EditorToolbar(Editor editor)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        rebuild

        -
        public void rebuild()
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        addModeButtons

        -
        public void addModeButtons(Box box)
        -
      • -
      - - - -
        -
      • -

        addGap

        -
        public void addGap(Box box)
        -
      • -
      - - - -
        -
      • -

        activateRun

        -
        public void activateRun()
        -
      • -
      - - - -
        -
      • -

        deactivateRun

        -
        public void deactivateRun()
        -
      • -
      - - - -
        -
      • -

        activateStop

        -
        public void activateStop()
        -
      • -
      - - - -
        -
      • -

        deactivateStop

        -
        public void deactivateStop()
        -
      • -
      - - - -
        -
      • -

        handleRun

        -
        public abstract void handleRun(int modifiers)
        -
      • -
      - - - -
        -
      • -

        handleStop

        -
        public abstract void handleStop()
        -
      • -
      - - - - - - - - - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/FindReplace.html b/build/javadoc/everything/processing/app/FindReplace.html deleted file mode 100644 index d857ce87fa..0000000000 --- a/build/javadoc/everything/processing/app/FindReplace.html +++ /dev/null @@ -1,502 +0,0 @@ - - - - - -FindReplace - - - - - - - - - - - -
-
processing.app
-

Class FindReplace

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        FindReplace

        -
        public FindReplace(Editor editor)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        handleClose

        -
        public void handleClose()
        -
      • -
      - - - -
        -
      • -

        replace

        -
        public void replace()
        -
        Replace the current selection with whatever's in the - replacement text field.
        -
      • -
      - - - -
        -
      • -

        replaceAndFindNext

        -
        public void replaceAndFindNext()
        -
        Replace the current selection with whatever's in the - replacement text field, and then find the next match
        -
      • -
      - - - -
        -
      • -

        replaceAll

        -
        public void replaceAll()
        -
        Replace everything that matches by doing find and replace - alternately until nothing more found.
        -
      • -
      - - - -
        -
      • -

        setFindText

        -
        public void setFindText(String t)
        -
      • -
      - - - -
        -
      • -

        findNext

        -
        public void findNext()
        -
      • -
      - - - -
        -
      • -

        findPrevious

        -
        public void findPrevious()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/Formatter.html b/build/javadoc/everything/processing/app/Formatter.html deleted file mode 100644 index d792816e9e..0000000000 --- a/build/javadoc/everything/processing/app/Formatter.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - - -Formatter - - - - - - - - - - - -
-
processing.app
-

Interface Formatter

-
-
-
-
    -
  • -
    -
    -
    public interface Formatter
    -
    This may change to a more generic String manipulating interface/class, since - it probably affects other code as well. But for now, we'll stick with this.
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/Language.html b/build/javadoc/everything/processing/app/Language.html deleted file mode 100644 index a4ed502a8b..0000000000 --- a/build/javadoc/everything/processing/app/Language.html +++ /dev/null @@ -1,337 +0,0 @@ - - - - - -Language - - - - - - - - - - - -
-
processing.app
-

Class Language

-
-
- -
-
    -
  • -
    -
    -
    public class Language
    -extends Object
    -
    Internationalization (i18n)
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        saveLanguage

        -
        public static void saveLanguage(String language)
        -
        Save the language directly to a settings file. This is 'save' and not - 'set' because a language change requires a restart of Processing.
        -
      • -
      - - - -
        -
      • -

        init

        -
        public static Language init()
        -
        Singleton constructor
        -
      • -
      - - - -
        -
      • -

        text

        -
        public static String text(String key)
        -
        Get translation from bundles.
        -
      • -
      - - - -
        -
      • -

        interpolate

        -
        public static String interpolate(String key,
        -                                 Object... arguments)
        -
      • -
      - - - -
        -
      • -

        pluralize

        -
        public static String pluralize(String key,
        -                               int count)
        -
      • -
      - - - -
        -
      • -

        getLanguages

        -
        public static Map<String,String> getLanguages()
        -
        Get all available languages
        -
      • -
      - - - -
        -
      • -

        getLanguage

        -
        public static String getLanguage()
        -
        Get the current language.
        -
        -
        Returns:
        -
        two digit ISO code (lowercase)
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/Library.html b/build/javadoc/everything/processing/app/Library.html deleted file mode 100644 index 70797c71b6..0000000000 --- a/build/javadoc/everything/processing/app/Library.html +++ /dev/null @@ -1,664 +0,0 @@ - - - - - -Library - - - - - - - - - - - -
-
processing.app
-

Class Library

-
-
- -
- -
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Library

        -
        public Library(File folder)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        load

        -
        public static Library load(File folder)
        -
      • -
      - - - -
        -
      • -

        addPackageList

        -
        public void addPackageList(HashMap<String,ArrayList<Library>> importToLibraryTable)
        -
        Add the packages provided by this library to the master list that maps - imports to specific libraries.
        -
        -
        Parameters:
        -
        importToLibraryTable - mapping from package names to Library objects
        -
        -
      • -
      - - - -
        -
      • -

        hasExamples

        -
        public boolean hasExamples()
        -
      • -
      - - - -
        -
      • -

        getExamplesFolder

        -
        public File getExamplesFolder()
        -
      • -
      - - - -
        -
      • -

        getGroup

        -
        public String getGroup()
        -
      • -
      - - - -
        -
      • -

        getPath

        -
        public String getPath()
        -
      • -
      - - - -
        -
      • -

        getLibraryPath

        -
        public String getLibraryPath()
        -
      • -
      - - - -
        -
      • -

        getJarPath

        -
        public String getJarPath()
        -
      • -
      - - - -
        -
      • -

        getClassPath

        -
        public String getClassPath()
        -
      • -
      - - - -
        -
      • -

        getNativePath

        -
        public String getNativePath()
        -
      • -
      - - - -
        -
      • -

        getAppletExports

        -
        public File[] getAppletExports()
        -
        Applet exports don't go by platform, since by their nature applets are - meant to be cross-platform. Technically, you could have a situation where - you want to export applet code for different platforms, but it's too - obscure a case that we're not interested in supporting it.
        -
      • -
      - - - -
        -
      • -

        getApplicationExports

        -
        public File[] getApplicationExports(int platform,
        -                                    int bits)
        -
      • -
      - - - -
        -
      • -

        getApplicationExportList

        -
        public String[] getApplicationExportList(int platform,
        -                                         int bits)
        -
        Returns the necessary exports for the specified platform. - If no 32 or 64-bit version of the exports exists, it returns the version - that doesn't specify bit depth.
        -
      • -
      - - - -
        -
      • -

        getAndroidExports

        -
        public File[] getAndroidExports()
        -
      • -
      - - - -
        -
      • -

        hasMultipleArch

        -
        public boolean hasMultipleArch(int platform)
        -
      • -
      - - - -
        -
      • -

        supportsArch

        -
        public boolean supportsArch(int platform,
        -                            int bits)
        -
      • -
      - - - -
        -
      • -

        hasMultipleArch

        -
        public static boolean hasMultipleArch(int platform,
        -                                      ArrayList<Library> libraries)
        -
      • -
      - - - - - - - -
        -
      • -

        discover

        -
        public static void discover(File folder,
        -                            ArrayList<File> libraries)
        -
      • -
      - - - - - - - -
        -
      • -

        getReferenceIndexFile

        -
        public File getReferenceIndexFile()
        -
        Returns the object stored in the referenceFile field, which contains an - instance of the file object representing the index file of the reference
        -
        -
        Returns:
        -
        referenceFile
        -
        -
      • -
      - - - -
        -
      • -

        hasReference

        -
        public boolean hasReference()
        -
        Tests whether the reference's index file indicated by referenceFile exists.
        -
        -
        Returns:
        -
        true if and only if the file denoted by referenceFile exists; false - otherwise.
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/Mode.html b/build/javadoc/everything/processing/app/Mode.html deleted file mode 100644 index ef8321b1a2..0000000000 --- a/build/javadoc/everything/processing/app/Mode.html +++ /dev/null @@ -1,1159 +0,0 @@ - - - - - -Mode - - - - - - - - - - - -
-
processing.app
-

Class Mode

-
-
- -
-
    -
  • -
    -
    -
    public abstract class Mode
    -extends Object
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Mode

        -
        public Mode(Base base,
        -            File folder)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getKeywordFiles

        -
        public File[] getKeywordFiles()
        -
        To add additional keywords, or to grab them from another mode, override - this function. If your mode has no keywords, return a zero length array.
        -
      • -
      - - - -
        -
      • -

        setClassLoader

        -
        public void setClassLoader(ClassLoader loader)
        -
      • -
      - - - -
        -
      • -

        getClassLoader

        -
        public ClassLoader getClassLoader()
        -
      • -
      - - - -
        -
      • -

        setupGUI

        -
        public void setupGUI()
        -
        Setup additional elements that are only required when running with a GUI, - rather than from the command-line. Note that this will not be called when - the Mode is used from the command line (because Base will be null).
        -
      • -
      - - - -
        -
      • -

        getContentFile

        -
        public File getContentFile(String path)
        -
      • -
      - - - - - - - -
        -
      • -

        getTitle

        -
        public abstract String getTitle()
        -
        Return the pretty/printable/menu name for this mode. This is separate from - the single word name of the folder that contains this mode. It could even - have spaces, though that might result in sheer madness or total mayhem.
        -
      • -
      - - - -
        -
      • -

        getIdentifier

        -
        public String getIdentifier()
        -
        Get an identifier that can be used to resurrect this mode and connect it - to a sketch. Using this instead of getTitle() because there might be name - clashes with the titles, but there should not be once the actual package, - et al. is included.
        -
        -
        Returns:
        -
        full name (package + class name) for this mode.
        -
        -
      • -
      - - - -
        -
      • -

        createEditor

        -
        public abstract Editor createEditor(Base base,
        -                                    String path,
        -                                    EditorState state)
        -
        Create a new editor associated with this mode.
        -
      • -
      - - - -
        -
      • -

        getFolder

        -
        public File getFolder()
        -
        Get the folder where this mode is stored.
        -
        -
        Since:
        -
        3.0a3
        -
        -
      • -
      - - - -
        -
      • -

        getExamplesFolder

        -
        public File getExamplesFolder()
        -
      • -
      - - - -
        -
      • -

        getLibrariesFolder

        -
        public File getLibrariesFolder()
        -
      • -
      - - - -
        -
      • -

        getReferenceFolder

        -
        public File getReferenceFolder()
        -
      • -
      - - - -
        -
      • -

        rebuildLibraryList

        -
        public void rebuildLibraryList()
        -
      • -
      - - - -
        -
      • -

        getCoreLibrary

        -
        public Library getCoreLibrary()
        -
      • -
      - - - - - - - -
        -
      • -

        getToolbarMenu

        -
        public JMenu getToolbarMenu()
        -
      • -
      - - - -
        -
      • -

        insertToolbarRecentMenu

        -
        public void insertToolbarRecentMenu()
        -
      • -
      - - - -
        -
      • -

        removeToolbarRecentMenu

        -
        public void removeToolbarRecentMenu()
        -
      • -
      - - - -
        -
      • -

        removeImportMenu

        -
        public void removeImportMenu(JMenu sketchMenu)
        -
        Rather than re-building the library menu for every open sketch (very slow - and prone to bugs when updating libs, particularly with the contribs mgr), - share a single instance across all windows.
        -
        -
        Parameters:
        -
        sketchMenu - the Sketch menu that's currently active
        -
        Since:
        -
        3.0a6
        -
        -
      • -
      - - - -
        -
      • -

        insertImportMenu

        -
        public void insertImportMenu(JMenu sketchMenu)
        -
        Re-insert the Import Library menu. Added function so that other modes - need not have an 'import' menu.
        -
        -
        Parameters:
        -
        sketchMenu - the Sketch menu that's currently active
        -
        Since:
        -
        3.0a6
        -
        -
      • -
      - - - -
        -
      • -

        getImportMenu

        -
        public JMenu getImportMenu()
        -
      • -
      - - - -
        -
      • -

        rebuildImportMenu

        -
        public void rebuildImportMenu()
        -
      • -
      - - - -
        -
      • -

        getExampleCategoryFolders

        -
        public File[] getExampleCategoryFolders()
        -
        Override this to control the order of the first set of example folders - and how they appear in the examples window.
        -
      • -
      - - - - - - - -
        -
      • -

        rebuildExamplesFrame

        -
        public void rebuildExamplesFrame()
        -
      • -
      - - - -
        -
      • -

        showExamplesFrame

        -
        public void showExamplesFrame()
        -
      • -
      - - - - - - - -
        -
      • -

        rebuildSketchbookFrame

        -
        public void rebuildSketchbookFrame()
        -
        Sketchbook has changed, update it on next viewing.
        -
      • -
      - - - -
        -
      • -

        showSketchbookFrame

        -
        public void showSketchbookFrame()
        -
      • -
      - - - -
        -
      • -

        loadIcon

        -
        public ImageIcon loadIcon(String filename)
        -
        Get an ImageIcon object from the Mode folder. - Or when prefixed with /lib, load it from the main /lib folder.
        -
        -
        Since:
        -
        3.0a6
        -
        -
      • -
      - - - -
        -
      • -

        loadImage

        -
        public Image loadImage(String filename)
        -
        Get an image object from the mode folder. - Or when prefixed with /lib, load it from the main /lib folder.
        -
      • -
      - - - -
        -
      • -

        lookupReference

        -
        public String lookupReference(String keyword)
        -
        Returns the HTML filename (including path prefix if necessary) - for this keyword, or null if it doesn't exist.
        -
      • -
      - - - -
        -
      • -

        getTokenMarker

        -
        public TokenMarker getTokenMarker()
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public String getString(String attribute)
        -
        -
        Since:
        -
        3.0a6
        -
        -
      • -
      - - - -
        -
      • -

        getBoolean

        -
        public boolean getBoolean(String attribute)
        -
      • -
      - - - -
        -
      • -

        getInteger

        -
        public int getInteger(String attribute)
        -
      • -
      - - - -
        -
      • -

        getColor

        -
        public Color getColor(String attribute)
        -
      • -
      - - - -
        -
      • -

        getFont

        -
        public Font getFont(String attribute)
        -
      • -
      - - - - - - - -
        -
      • -

        makeGradient

        -
        public Image makeGradient(String attribute,
        -                          int wide,
        -                          int high)
        -
      • -
      - - - -
        -
      • -

        hideExtension

        -
        public boolean hideExtension(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.) - You can override this in your Mode subclass to handle it differently.
        -
      • -
      - - - -
        -
      • -

        isDefaultExtension

        -
        public boolean isDefaultExtension(SketchCode code)
        -
        True if the specified code has the default file extension.
        -
      • -
      - - - -
        -
      • -

        isDefaultExtension

        -
        public boolean isDefaultExtension(String what)
        -
        True if the specified extension is the default file extension.
        -
      • -
      - - - -
        -
      • -

        canEdit

        -
        public boolean canEdit(File f)
        -
        -
        Parameters:
        -
        f - File to be checked against this mode's accepted extensions.
        -
        Returns:
        -
        Whether or not the given file name features an extension supported by this mode.
        -
        -
      • -
      - - - -
        -
      • -

        validExtension

        -
        public boolean validExtension(String what)
        -
        Check this extension (no dots, please) against the list of valid - extensions.
        -
      • -
      - - - -
        -
      • -

        getDefaultExtension

        -
        public abstract String getDefaultExtension()
        -
        Returns the default extension for this editor setup.
        -
      • -
      - - - -
        -
      • -

        getModuleExtension

        -
        public String getModuleExtension()
        -
        Returns the appropriate file extension to use for auxilliary source files in a sketch. - For example, in a Java-mode sketch, auxilliary files should be name "Foo.java"; in - Python mode, they should be named "foo.py". - -

        Modes that do not override this function will get the default behavior of returning the - default extension.

        -
      • -
      - - - -
        -
      • -

        getExtensions

        -
        public abstract String[] getExtensions()
        -
        Returns a String[] array of proper extensions.
        -
      • -
      - - - -
        -
      • -

        getIgnorable

        -
        public abstract String[] getIgnorable()
        -
        Get array of file/directory names that needn't be copied during "Save As".
        -
      • -
      - - - -
        -
      • -

        findLibraryByName

        -
        public Library findLibraryByName(String libName)
        -
        Checks coreLibraries and contribLibraries for a library with the specified name
        -
        -
        Parameters:
        -
        libName - the name of the library to find
        -
        Returns:
        -
        the Library or null if not found
        -
        -
      • -
      - - - -
        -
      • -

        prepareExportFolder

        -
        public void prepareExportFolder(File targetFolder)
        -
        Create a fresh applet/application folder if the 'delete target folder' - pref has been set in the preferences.
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/Platform.CLibrary.html b/build/javadoc/everything/processing/app/Platform.CLibrary.html deleted file mode 100644 index fd5e06aed7..0000000000 --- a/build/javadoc/everything/processing/app/Platform.CLibrary.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - -Platform.CLibrary - - - - - - - - - - - -
-
processing.app
-

Interface Platform.CLibrary

-
-
-
-
    -
  • -
    -
    All Superinterfaces:
    -
    Library
    -
    -
    -
    Enclosing class:
    -
    Platform
    -
    -
    -
    -
    public static interface Platform.CLibrary
    -extends Library
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from interface Library

        -Library.Handler
      • -
      -
    • -
    - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      static Platform.CLibraryINSTANCE 
      -
        -
      • - - -

        Fields inherited from interface Library

        -OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRUCTURE_ALIGNMENT, OPTION_TYPE_MAPPER
      • -
      -
    • -
    - - -
  • -
-
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/Platform.html b/build/javadoc/everything/processing/app/Platform.html deleted file mode 100644 index 19aacec2da..0000000000 --- a/build/javadoc/everything/processing/app/Platform.html +++ /dev/null @@ -1,513 +0,0 @@ - - - - - -Platform - - - - - - - - - - - -
-
processing.app
-

Class Platform

-
-
- -
-
    -
  • -
    -
    Direct Known Subclasses:
    -
    LinuxPlatform, MacPlatform, WindowsPlatform
    -
    -
    -
    -
    public class Platform
    -extends 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 Detail

      - - - -
        -
      • -

        Platform

        -
        public Platform()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        init

        -
        public void init(Base base)
        -
      • -
      - - - -
        -
      • -

        setLookAndFeel

        -
        public void setLookAndFeel()
        -                    throws 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. 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.
        -
        -
      • -
      - - - -
        -
      • -

        saveLanguage

        -
        public void saveLanguage(String languageCode)
        -
        Handle any platform-specific languages saving. This is necessary on OS X - because of how bundles are handled, but perhaps your platform would like - to Think Different too?
        -
        -
        Parameters:
        -
        languageCode - 2-digit lowercase ISO language code
        -
        -
      • -
      - - - -
        -
      • -

        getSettingsFolder

        -
        public File getSettingsFolder()
        -                       throws Exception
        -
        This function should throw an exception or return a value. - Do not return null.
        -
        -
        Throws:
        -
        Exception
        -
        -
      • -
      - - - -
        -
      • -

        getDefaultSketchbookFolder

        -
        public File getDefaultSketchbookFolder()
        -                                throws Exception
        -
        -
        Returns:
        -
        if not overridden, a folder named "sketchbook" in user.home.
        -
        Throws:
        -
        Exception - so that subclasses can throw a fit
        -
        -
      • -
      - - - - - - - -
        -
      • -

        openFolderAvailable

        -
        public boolean openFolderAvailable()
        -
      • -
      - - - - - - - -
        -
      • -

        deleteFile

        -
        public final boolean deleteFile(File file)
        -                         throws IOException
        -
        Attempts to move to the Trash on OS X, or the Recycle Bin on Windows. - Also tries to find a suitable Trash location on Linux. - If not possible, just deletes the file or folder instead.
        -
        -
        Parameters:
        -
        file - the folder or file to be removed/deleted
        -
        Returns:
        -
        true if the folder was successfully removed
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        setenv

        -
        public void setenv(String variable,
        -                   String value)
        -
      • -
      - - - - - - - -
        -
      • -

        unsetenv

        -
        public int unsetenv(String variable)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/Preferences.html b/build/javadoc/everything/processing/app/Preferences.html deleted file mode 100644 index 82f0c4bca0..0000000000 --- a/build/javadoc/everything/processing/app/Preferences.html +++ /dev/null @@ -1,498 +0,0 @@ - - - - - -Preferences - - - - - - - - - - - -
-
processing.app
-

Class Preferences

-
-
-
    -
  • Object
  • -
  • -
      -
    • Preferences
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class Preferences
    -extends Object
    -
    Storage class for user preferences and environment settings. -

    - This class does not use the Properties class because .properties files use - ISO 8859-1 encoding, which is highly likely to be a problem when trying to - save sketch folders and locations. Like the rest of Processing, we use UTF8. -

    - We don't use the Java Preferences API 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 (impossible) to remove the preferences.txt to - reset them (when they become corrupt), or to find the the file to make - edits for numerous obscure preferences that are not part of the preferences - window. If we added a generic editor (e.g. about:config in Mozilla) for - such things, we could start using the Java Preferences API. But wow, that - sounds like a lot of work. Not unlike writing this paragraph.

    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

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

      Constructor Detail

      - - - -
        -
      • -

        Preferences

        -
        public Preferences()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        init

        -
        public static void init()
        -
      • -
      - - - -
        -
      • -

        load

        -
        public static void load(InputStream input)
        -                 throws IOException
        -
        Load a set of key/value pairs from a UTF-8 encoded file into 'table'. - For 3.0a6, this removes any platform-specific extensions from keys, so - that we don't have platform-specific entries in a user's preferences.txt - file, which would require all prefs to be changed twice, or risk being - overwritten by the unchanged platform-specific version on reload.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getDefault

        -
        public static String getDefault(String attribute)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public static void set(String attribute,
        -                       String value)
        -
      • -
      - - - -
        -
      • -

        unset

        -
        public static void unset(String attribute)
        -
      • -
      - - - -
        -
      • -

        getBoolean

        -
        public static boolean getBoolean(String attribute)
        -
      • -
      - - - -
        -
      • -

        setBoolean

        -
        public static void setBoolean(String attribute,
        -                              boolean value)
        -
      • -
      - - - -
        -
      • -

        getInteger

        -
        public static int getInteger(String attribute)
        -
      • -
      - - - -
        -
      • -

        setInteger

        -
        public static void setInteger(String key,
        -                              int value)
        -
      • -
      - - - -
        -
      • -

        getColor

        -
        public static Color getColor(String name)
        -
      • -
      - - - -
        -
      • -

        setColor

        -
        public static void setColor(String attr,
        -                            Color what)
        -
      • -
      - - - -
        -
      • -

        getFont

        -
        public static Font getFont(String attr)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/PreferencesFrame.html b/build/javadoc/everything/processing/app/PreferencesFrame.html deleted file mode 100644 index 4d337dd2d6..0000000000 --- a/build/javadoc/everything/processing/app/PreferencesFrame.html +++ /dev/null @@ -1,272 +0,0 @@ - - - - - -PreferencesFrame - - - - - - - - - - - -
-
processing.app
-

Class PreferencesFrame

-
-
-
    -
  • Object
  • -
  • -
      -
    • PreferencesFrame
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class PreferencesFrame
    -extends Object
    -
    Creates the window for modifying preferences.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PreferencesFrame

        -
        public PreferencesFrame(Base base)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        sketchbookCallback

        -
        public void sketchbookCallback(File file)
        -
        Callback for the folder selector.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/ProgressFrame.TaskAddFile.html b/build/javadoc/everything/processing/app/ProgressFrame.TaskAddFile.html deleted file mode 100644 index 542911078f..0000000000 --- a/build/javadoc/everything/processing/app/ProgressFrame.TaskAddFile.html +++ /dev/null @@ -1,321 +0,0 @@ - - - - - -ProgressFrame.TaskAddFile - - - - - - - - - - - -
-
processing.app
-

Class ProgressFrame.TaskAddFile

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TaskAddFile

        -
        public TaskAddFile()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setProgressBarStatus

        -
        public void setProgressBarStatus(int status)
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/ProgressFrame.TaskSaveAs.html b/build/javadoc/everything/processing/app/ProgressFrame.TaskSaveAs.html deleted file mode 100644 index 756c0d0c81..0000000000 --- a/build/javadoc/everything/processing/app/ProgressFrame.TaskSaveAs.html +++ /dev/null @@ -1,321 +0,0 @@ - - - - - -ProgressFrame.TaskSaveAs - - - - - - - - - - - -
-
processing.app
-

Class ProgressFrame.TaskSaveAs

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TaskSaveAs

        -
        public TaskSaveAs()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setProgressBarStatus

        -
        public void setProgressBarStatus(int status)
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/ProgressFrame.html b/build/javadoc/everything/processing/app/ProgressFrame.html deleted file mode 100644 index 89f65fe66d..0000000000 --- a/build/javadoc/everything/processing/app/ProgressFrame.html +++ /dev/null @@ -1,469 +0,0 @@ - - - - - -ProgressFrame - - - - - - - - - - - -
-
processing.app
-

Class ProgressFrame

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ProgressFrame

        -
        public ProgressFrame(File[] c,
        -                     File nf,
        -                     String oldName,
        -                     String newName,
        -                     Editor editor)
        -
        Use for Save As
        -
      • -
      - - - -
        -
      • -

        ProgressFrame

        -
        public ProgressFrame(File sf,
        -                     File add,
        -                     Editor editor)
        -
        Used for Add File
        -
      • -
      -
    • -
    - - -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/Recent.html b/build/javadoc/everything/processing/app/Recent.html deleted file mode 100644 index 807df78edd..0000000000 --- a/build/javadoc/everything/processing/app/Recent.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -Recent - - - - - - - - - - - -
-
processing.app
-

Class Recent

-
-
- -
-
    -
  • -
    -
    -
    public class Recent
    -extends Object
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Recent

        -
        public Recent(Base base)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getMenu

        -
        public JMenu getMenu()
        -
      • -
      - - - -
        -
      • -

        getToolbarMenu

        -
        public JMenu getToolbarMenu()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/RunnerListener.html b/build/javadoc/everything/processing/app/RunnerListener.html deleted file mode 100644 index 29555240f9..0000000000 --- a/build/javadoc/everything/processing/app/RunnerListener.html +++ /dev/null @@ -1,300 +0,0 @@ - - - - - -RunnerListener - - - - - - - - - - - -
-
processing.app
-

Interface RunnerListener

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    Editor
    -
    -
    -
    -
    public interface RunnerListener
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        statusError

        -
        void statusError(String message)
        -
      • -
      - - - -
        -
      • -

        statusError

        -
        void statusError(Exception exception)
        -
      • -
      - - - -
        -
      • -

        statusNotice

        -
        void statusNotice(String message)
        -
      • -
      - - - -
        -
      • -

        startIndeterminate

        -
        void startIndeterminate()
        -
      • -
      - - - -
        -
      • -

        stopIndeterminate

        -
        void stopIndeterminate()
        -
      • -
      - - - -
        -
      • -

        statusHalt

        -
        void statusHalt()
        -
      • -
      - - - -
        -
      • -

        isHalted

        -
        boolean isHalted()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/Settings.html b/build/javadoc/everything/processing/app/Settings.html deleted file mode 100644 index 7b1458a5b5..0000000000 --- a/build/javadoc/everything/processing/app/Settings.html +++ /dev/null @@ -1,440 +0,0 @@ - - - - - -Settings - - - - - - - - - - - -
-
processing.app
-

Class Settings

-
-
- -
-
    -
  • -
    -
    -
    public class Settings
    -extends 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.
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        load

        -
        public void load()
        -
      • -
      - - - -
        -
      • -

        load

        -
        public void load(File additions)
        -
      • -
      - - - -
        -
      • -

        save

        -
        public void save()
        -
      • -
      - - - - - - - -
        -
      • -

        getDefault

        -
        public String getDefault(String attribute)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String attribute,
        -                String value)
        -
      • -
      - - - -
        -
      • -

        getBoolean

        -
        public boolean getBoolean(String attribute)
        -
      • -
      - - - -
        -
      • -

        setBoolean

        -
        public void setBoolean(String attribute,
        -                       boolean value)
        -
      • -
      - - - -
        -
      • -

        getInteger

        -
        public int getInteger(String attribute)
        -
      • -
      - - - -
        -
      • -

        setInteger

        -
        public void setInteger(String key,
        -                       int value)
        -
      • -
      - - - -
        -
      • -

        getColor

        -
        public Color getColor(String attribute)
        -
      • -
      - - - -
        -
      • -

        setColor

        -
        public void setColor(String attr,
        -                     Color what)
        -
      • -
      - - - -
        -
      • -

        getFont

        -
        public Font getFont(String attr)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/SingleInstance.html b/build/javadoc/everything/processing/app/SingleInstance.html deleted file mode 100644 index f884fec359..0000000000 --- a/build/javadoc/everything/processing/app/SingleInstance.html +++ /dev/null @@ -1,238 +0,0 @@ - - - - - -SingleInstance - - - - - - - - - - - -
-
processing.app
-

Class SingleInstance

-
-
-
    -
  • Object
  • -
  • -
      -
    • SingleInstance
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class SingleInstance
    -extends Object
    -
    Class that handles a small server that prevents multiple instances of - Processing from running simultaneously. If there's already an instance - running, it'll handle opening a new empty sketch, or any files that had - been passed in on the command line.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        SingleInstance

        -
        public SingleInstance()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/Sketch.html b/build/javadoc/everything/processing/app/Sketch.html deleted file mode 100644 index fbae7e3523..0000000000 --- a/build/javadoc/everything/processing/app/Sketch.html +++ /dev/null @@ -1,912 +0,0 @@ - - - - - -Sketch - - - - - - - - - - - -
-
processing.app
-

Class Sketch

-
-
- -
-
    -
  • -
    -
    -
    public class Sketch
    -extends Object
    -
    Stores information about files in the current sketch.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Sketch

        -
        public Sketch(String path,
        -              Mode mode)
        -
        Used by the command-line version to create a sketch object.
        -
        -
        Parameters:
        -
        path - location of the main .pde file
        -
        mode - what flavor of sketch we're dealing with.
        -
        -
      • -
      - - - -
        -
      • -

        Sketch

        -
        public Sketch(String path,
        -              Editor editor)
        -       throws 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:
        -
        IOException
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        reload

        -
        public void reload()
        -
        Reload the current sketch. Used to update the text area when - an external editor is in use.
        -
      • -
      - - - -
        -
      • -

        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 IOException
        -
        Save all code in the current sketch. This just forces the files to save - in place, so if it's an untitled (un-saved) sketch, saveAs() should be - called instead. (This is handled inside Editor.handleSave()).
        -
        -
        Throws:
        -
        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(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.
        -
        -
      • -
      - - - -
        -
      • -

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

        makeTempFolder

        -
        public File makeTempFolder()
        -
        Create a temporary folder that includes the sketch's name in its title.
        -
      • -
      - - - -
        -
      • -

        ensureExistence

        -
        public void ensureExistence()
        -
        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.
        -
      • -
      - - - -
        -
      • -

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

        getName

        -
        public String getName()
        -
        Returns the name of this sketch. (The pretty name of the main tab.)
        -
      • -
      - - - -
        -
      • -

        getMainFile

        -
        public File getMainFile()
        -
        Returns a File object for the main .pde file for this sketch.
        -
      • -
      - - - -
        -
      • -

        getMainFilePath

        -
        public String getMainFilePath()
        -
        Returns path to the main .pde file for this sketch.
        -
      • -
      - - - -
        -
      • -

        getFolder

        -
        public File getFolder()
        -
        Returns the sketch folder.
        -
      • -
      - - - -
        -
      • -

        getDataFolder

        -
        public File getDataFolder()
        -
        Returns the location of the sketch's data folder. (It may not exist yet.)
        -
      • -
      - - - -
        -
      • -

        hasDataFolder

        -
        public boolean hasDataFolder()
        -
      • -
      - - - -
        -
      • -

        prepareDataFolder

        -
        public 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 File getCodeFolder()
        -
        Returns the location of the sketch's code folder. (It may not exist yet.)
        -
      • -
      - - - -
        -
      • -

        hasCodeFolder

        -
        public boolean hasCodeFolder()
        -
      • -
      - - - -
        -
      • -

        prepareCodeFolder

        -
        public 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.
        -
      • -
      - - - - - - - -
        -
      • -

        getCodeCount

        -
        public int getCodeCount()
        -
      • -
      - - - -
        -
      • -

        getCode

        -
        public SketchCode getCode(int index)
        -
      • -
      - - - -
        -
      • -

        getCodeIndex

        -
        public int getCodeIndex(SketchCode who)
        -
      • -
      - - - -
        -
      • -

        getCurrentCode

        -
        public SketchCode getCurrentCode()
        -
      • -
      - - - -
        -
      • -

        getCurrentCodeIndex

        -
        public int getCurrentCodeIndex()
        -
      • -
      - - - -
        -
      • -

        getMainProgram

        -
        public String getMainProgram()
        -
      • -
      - - - -
        -
      • -

        setUntitled

        -
        public void setUntitled(boolean untitled)
        -
      • -
      - - - -
        -
      • -

        isUntitled

        -
        public boolean isUntitled()
        -
      • -
      - - - -
        -
      • -

        checkName

        -
        public static String checkName(String origName)
        -
        Convert to sanitized name and alert the user - if changes were made.
        -
      • -
      - - - -
        -
      • -

        isSanitaryName

        -
        public static boolean isSanitaryName(String name)
        -
        Return true if the name is valid for a Processing sketch. Extensions of the form .foo are - ignored.
        -
      • -
      - - - -
        -
      • -

        sanitizeName

        -
        public static String sanitizeName(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 - or underscore. -

        - In Processing 2.0, sketches can no longer begin with an underscore, - because these aren't valid class names on Android.

        -
      • -
      - - - -
        -
      • -

        getMode

        -
        public Mode getMode()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/SketchCode.html b/build/javadoc/everything/processing/app/SketchCode.html deleted file mode 100644 index 7a4cb450d7..0000000000 --- a/build/javadoc/everything/processing/app/SketchCode.html +++ /dev/null @@ -1,660 +0,0 @@ - - - - - -SketchCode - - - - - - - - - - - -
-
processing.app
-

Class SketchCode

-
-
-
    -
  • Object
  • -
  • -
      -
    • SketchCode
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class SketchCode
    -extends Object
    -
    Represents a single tab of a sketch.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        SketchCode

        -
        public SketchCode(File file,
        -                  String extension)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getFile

        -
        public File getFile()
        -
      • -
      - - - - - - - -
        -
      • -

        getFileName

        -
        public String getFileName()
        -
      • -
      - - - -
        -
      • -

        getPrettyName

        -
        public String getPrettyName()
        -
      • -
      - - - -
        -
      • -

        getExtension

        -
        public String getExtension()
        -
      • -
      - - - -
        -
      • -

        isExtension

        -
        public boolean isExtension(String what)
        -
      • -
      - - - -
        -
      • -

        getProgram

        -
        public String getProgram()
        -
        get the current text for this tab
        -
      • -
      - - - -
        -
      • -

        setProgram

        -
        public void setProgram(String replacement)
        -
        set the current text for this tab
        -
      • -
      - - - -
        -
      • -

        getSavedProgram

        -
        public String getSavedProgram()
        -
        get the last version saved of this tab
        -
      • -
      - - - -
        -
      • -

        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 Document getDocument()
        -
      • -
      - - - -
        -
      • -

        setDocument

        -
        public void setDocument(Document d)
        -
      • -
      - - - - - - - -
        -
      • -

        getSelectionStart

        -
        public int getSelectionStart()
        -
      • -
      - - - -
        -
      • -

        getSelectionStop

        -
        public int getSelectionStop()
        -
      • -
      - - - -
        -
      • -

        getScrollPosition

        -
        public int getScrollPosition()
        -
      • -
      - - - -
        -
      • -

        lastVisited

        -
        public long lastVisited()
        -
      • -
      - - - -
        -
      • -

        load

        -
        public void load()
        -          throws IOException
        -
        Load this piece of code from a file.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        save

        -
        public void save()
        -          throws IOException
        -
        Save this piece of code, regardless of whether the modified - flag is set or not.
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        saveAs

        -
        public void saveAs(File newFile)
        -            throws IOException
        -
        Save this file to another location, used by Sketch.saveAs()
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        setFolder

        -
        public void setFolder(File sketchFolder)
        -
        Called when the sketch folder name/location has changed. Called when - renaming tab 0, the main code.
        -
      • -
      - - - -
        -
      • -

        lastModified

        -
        public long lastModified()
        -
        Used to determine whether this file was modified externally
        -
        -
        Returns:
        -
        The time the file was last modified
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/SketchException.html b/build/javadoc/everything/processing/app/SketchException.html deleted file mode 100644 index c4daf51876..0000000000 --- a/build/javadoc/everything/processing/app/SketchException.html +++ /dev/null @@ -1,540 +0,0 @@ - - - - - -SketchException - - - - - - - - - - - -
-
processing.app
-

Class SketchException

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    -
    public class SketchException
    -extends Exception
    -
    An exception with a line number attached that occurs - during either pre-processing, compile, or run time.
    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        SketchException

        -
        public SketchException(String message)
        -
      • -
      - - - -
        -
      • -

        SketchException

        -
        public SketchException(String message,
        -                       boolean showStackTrace)
        -
      • -
      - - - -
        -
      • -

        SketchException

        -
        public SketchException(String message,
        -                       int file,
        -                       int line)
        -
      • -
      - - - -
        -
      • -

        SketchException

        -
        public SketchException(String message,
        -                       int file,
        -                       int line,
        -                       int column)
        -
      • -
      - - - -
        -
      • -

        SketchException

        -
        public SketchException(String message,
        -                       int file,
        -                       int line,
        -                       int column,
        -                       boolean showStackTrace)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getMessage

        -
        public String getMessage()
        -
        Override getMessage() in Throwable, so that I can set - the message text outside the constructor.
        -
        -
        Overrides:
        -
        getMessage in class Throwable
        -
        -
      • -
      - - - -
        -
      • -

        setMessage

        -
        public void setMessage(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 Throwable
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/SketchReference.html b/build/javadoc/everything/processing/app/SketchReference.html deleted file mode 100644 index 48cb6cb990..0000000000 --- a/build/javadoc/everything/processing/app/SketchReference.html +++ /dev/null @@ -1,287 +0,0 @@ - - - - - -SketchReference - - - - - - - - - - - -
-
processing.app
-

Class SketchReference

-
-
-
    -
  • Object
  • -
  • -
      -
    • SketchReference
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class SketchReference
    -extends Object
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        SketchReference

        -
        public SketchReference(String name,
        -                       File pde)
        -
      • -
      -
    • -
    - - -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/Toolkit.html b/build/javadoc/everything/processing/app/Toolkit.html deleted file mode 100644 index d80080b509..0000000000 --- a/build/javadoc/everything/processing/app/Toolkit.html +++ /dev/null @@ -1,772 +0,0 @@ - - - - - -Toolkit - - - - - - - - - - - -
-
processing.app
-

Class Toolkit

-
-
- -
-
    -
  • -
    -
    -
    public class Toolkit
    -extends Object
    -
    Utility functions for base that require a java.awt.Toolkit object. These - are broken out from Base as we start moving toward the possibility of the - code running in headless mode.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        WINDOW_CLOSE_KEYSTROKE

        -
        public static final KeyStroke WINDOW_CLOSE_KEYSTROKE
        -
        Command-W on Mac OS X, Ctrl-W on Windows and Linux
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Toolkit

        -
        public Toolkit()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        newJMenuItem

        -
        public static JMenuItem newJMenuItem(String title,
        -                                     int what)
        -
        A software engineer, somewhere, needs to have his abstraction - taken away. In some countries they jail or beat people for crafting - the sort of API that would require a five line helper function - just to set the shortcut key for a menu item.
        -
      • -
      - - - -
        -
      • -

        newJMenuItemShift

        -
        public static JMenuItem newJMenuItemShift(String title,
        -                                          int what)
        -
        Like newJMenuItem() but adds shift as a modifier for the shortcut.
        -
      • -
      - - - -
        -
      • -

        newJMenuItemAlt

        -
        public static JMenuItem newJMenuItemAlt(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. This function should almost - never be used, because it's bad for non-US keyboards that use ALT in - strange and wondrous ways.
        -
      • -
      - - - - - - - -
        -
      • -

        addDisabledItem

        -
        public static void addDisabledItem(JMenu menu,
        -                                   String title)
        -
      • -
      - - - -
        -
      • -

        setMenuMnemonics

        -
        public static void setMenuMnemonics(JMenuItem... menu)
        -
        Removes all mnemonics, then sets a mnemonic for each menu and menu item - recursively by these rules: -
          -
        1. It tries to assign one of - KDE's defaults.
        2. -
        3. Failing that, it loops through the first letter of each word, where a word - is a block of Unicode "alphabetical" chars, looking for an upper-case ASCII mnemonic - that is not taken. This is to try to be relevant, by using a letter well-associated - with the command. (MS guidelines)
        4. -
        5. Ditto, but with lowercase.
        6. -
        7. Next, it tries the second ASCII character, if its width >= half the width of - 'A'.
        8. -
        9. If the first letters are all taken/non-ASCII, then it loops through the - ASCII letters in the item, widest to narrowest, seeing if any of them is not taken. - To improve readability, it discriminates against decenders (qypgj), imagining they - have 2/3 their actual width. (MS guidelines: avoid decenders). It also discriminates - against vowels, imagining they have 2/3 their actual width. (MS and Gnome guidelines: - avoid vowels.)
        10. -
        11. Failing that, it will loop left-to-right for an available digit. This is a last - resort because the normal setMnemonic dislikes them.
        12. -
        13. If that doesn't work, it doesn't assign a mnemonic.
        14. -
        - - As a special case, strings starting "sketchbook → " have that bit ignored - because otherwise the Recent menu looks awful. However, the name "sketchbook → - Sketch", for example, will have the 'S' of "Sketch" chosen, but the 's' of 'sketchbook - will get underlined. - No letter by an underscore will be assigned. - Disabled on Mac, per Apple guidelines. - menu may contain nulls. - - Author: George Bateman. Initial work Myer Nore.
        -
        -
        Parameters:
        -
        menu - A menu, a list of menus or an array of menu items to set mnemonics for.
        -
        -
      • -
      - - - -
        -
      • -

        setMenuMnemonics

        -
        public static void setMenuMnemonics(JMenuBar menubar)
        -
        As setMenuMnemonics(JMenuItem...).
        -
      • -
      - - - -
        -
      • -

        setMenuMnemonics

        -
        public static void setMenuMnemonics(JPopupMenu menu)
        -
        As setMenuMnemonics(JMenuItem...).
        -
      • -
      - - - -
        -
      • -

        setMenuMnemsInside

        -
        public static void setMenuMnemsInside(JMenu menu)
        -
        Calls setMenuMnemonics(JMenuItem...) on the sub-elements only.
        -
      • -
      - - - -
        -
      • -

        getScreenSize

        -
        public static Dimension getScreenSize()
        -
      • -
      - - - -
        -
      • -

        getLibImage

        -
        public static Image getLibImage(String filename)
        -
        Return an Image object from inside the Processing 'lib' folder. - Moved here so that Base can stay headless.
        -
      • -
      - - - -
        -
      • -

        getLibIcon

        -
        public static ImageIcon getLibIcon(String filename)
        -
        Get an ImageIcon from the Processing 'lib' folder.
        -
        -
        Since:
        -
        3.0a6
        -
        -
      • -
      - - - -
        -
      • -

        setIcon

        -
        public static void setIcon(Frame frame)
        -
      • -
      - - - -
        -
      • -

        setIcon

        -
        public static void setIcon(Window window)
        -
        Give this Frame the Processing icon set. Ignored on OS X, because they - thought different and made this function set the minified image of the - window, not the window icon for the dock or cmd-tab.
        -
      • -
      - - - -
        -
      • -

        createRoundRect

        -
        public static Shape createRoundRect(float x1,
        -                                    float y1,
        -                                    float x2,
        -                                    float y2,
        -                                    float tl,
        -                                    float tr,
        -                                    float br,
        -                                    float bl)
        -
      • -
      - - - -
        -
      • -

        registerWindowCloseKeys

        -
        public static void registerWindowCloseKeys(JRootPane root,
        -                                           ActionListener disposer)
        -
        Registers key events for a Ctrl-W and ESC with an ActionListener - that will take care of disposing the window.
        -
      • -
      - - - -
        -
      • -

        beep

        -
        public static void beep()
        -
      • -
      - - - -
        -
      • -

        getSystemClipboard

        -
        public static Clipboard getSystemClipboard()
        -
      • -
      - - - -
        -
      • -

        prepareGraphics

        -
        public static Graphics2D prepareGraphics(Graphics g)
        -
        Handles scaling for high-res displays, also sets text anti-aliasing - options to be far less ugly than the defaults. - Moved to a utility function because it's used in several classes.
        -
        -
        Returns:
        -
        a Graphics2D object, as a bit o sugar
        -
        -
      • -
      - - - -
        -
      • -

        highResDisplay

        -
        public static boolean highResDisplay()
        -
      • -
      - - - -
        -
      • -

        getMonoFontFamilies

        -
        public static String[] getMonoFontFamilies()
        -
      • -
      - - - -
        -
      • -

        getMonoFontName

        -
        public static String getMonoFontName()
        -
      • -
      - - - -
        -
      • -

        getMonoFont

        -
        public static Font getMonoFont(int size,
        -                               int style)
        -
      • -
      - - - -
        -
      • -

        getSansFont

        -
        public static Font getSansFont(int size,
        -                               int style)
        -
      • -
      - - - -
        -
      • -

        debugOpacity

        -
        public static void debugOpacity(Component comp)
        -
        Do not use or rely upon presence of this method: not approved as final API.
        -
      • -
      - - - -
        -
      • -

        getMenuItemIndex

        -
        public static int getMenuItemIndex(JMenu menu,
        -                                   JMenuItem item)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/UpdateCheck.html b/build/javadoc/everything/processing/app/UpdateCheck.html deleted file mode 100644 index 8947d94f50..0000000000 --- a/build/javadoc/everything/processing/app/UpdateCheck.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - - -UpdateCheck - - - - - - - - - - - -
-
processing.app
-

Class UpdateCheck

-
-
-
    -
  • Object
  • -
  • -
      -
    • UpdateCheck
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class UpdateCheck
    -extends Object
    -
    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.

    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/WebServer.html b/build/javadoc/everything/processing/app/WebServer.html deleted file mode 100644 index 8a6da016a6..0000000000 --- a/build/javadoc/everything/processing/app/WebServer.html +++ /dev/null @@ -1,909 +0,0 @@ - - - - - -WebServer - - - - - - - - - - - -
-
processing.app
-

Class WebServer

-
-
- -
-
    -
  • -
    -
    -
    public class WebServer
    -extends Object
    -
    This code is placed here in anticipation of running the reference from an - internal web server that reads the docs from a zip file, instead of using - thousands of .html files on the disk, which is really inefficient. -

    - This is a very simple, multi-threaded HTTP server, originally based on - this article on java.sun.com.

    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/contrib/AvailableContribution.html b/build/javadoc/everything/processing/app/contrib/AvailableContribution.html deleted file mode 100644 index ffdd023080..0000000000 --- a/build/javadoc/everything/processing/app/contrib/AvailableContribution.html +++ /dev/null @@ -1,360 +0,0 @@ - - - - - -AvailableContribution - - - - - - - - - - - -
-
processing.app.contrib
-

Class AvailableContribution

-
-
- -
-
    -
  • -
    -
    -
    public class AvailableContribution
    -extends Contribution
    -
    A class to hold information about a Contribution that can be downloaded.
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        install

        -
        public LocalContribution install(Base base,
        -                                 File contribArchive,
        -                                 boolean confirmReplace,
        -                                 StatusPanel status)
        -
        -
        Parameters:
        -
        contribArchive - a zip file containing the library to install
        -
        confirmReplace - true to open a dialog asking the user to confirm removing/moving - the library when a library by the same name already exists
        -
        status - the StatusPanel. Pass null if this function is called for an - install-on-startup
        -
        Returns:
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        writePropertiesFile

        -
        public boolean writePropertiesFile(File propFile)
        -
        We overwrite those fields that aren't proper in the properties file with - the curated version from the Processing site. This ensures that things have - been cleaned up (for instance, that the "sentence" is really a sentence) - and that bad data from the contrib's .properties file doesn't break the - manager. However, it also ensures that valid fields in the properties file - aren't overwritten, since the properties file may be more recent than the - contributions.txt file.
        -
        -
        Parameters:
        -
        propFile -
        -
        Returns:
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/contrib/Contribution.html b/build/javadoc/everything/processing/app/contrib/Contribution.html deleted file mode 100644 index b1fe5283ed..0000000000 --- a/build/javadoc/everything/processing/app/contrib/Contribution.html +++ /dev/null @@ -1,441 +0,0 @@ - - - - - -Contribution - - - - - - - - - - - -
-
processing.app.contrib
-

Class Contribution

-
-
-
    -
  • Object
  • -
  • -
      -
    • Contribution
    • -
    -
  • -
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Contribution

        -
        public Contribution()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getName

        -
        public String getName()
        -
      • -
      - - - -
        -
      • -

        getAuthorList

        -
        public String getAuthorList()
        -
      • -
      - - - -
        -
      • -

        getUrl

        -
        public String getUrl()
        -
      • -
      - - - -
        -
      • -

        getSentence

        -
        public String getSentence()
        -
      • -
      - - - -
        -
      • -

        getParagraph

        -
        public String getParagraph()
        -
      • -
      - - - -
        -
      • -

        getVersion

        -
        public int getVersion()
        -
      • -
      - - - -
        -
      • -

        getPrettyVersion

        -
        public String getPrettyVersion()
        -
      • -
      - - - -
        -
      • -

        getLastUpdated

        -
        public long getLastUpdated()
        -
      • -
      - - - -
        -
      • -

        getMinRevision

        -
        public int getMinRevision()
        -
      • -
      - - - -
        -
      • -

        getMaxRevision

        -
        public int getMaxRevision()
        -
      • -
      - - - -
        -
      • -

        isCompatible

        -
        public boolean isCompatible(int versionNum)
        -
      • -
      - - - - - - - -
        -
      • -

        getTypeName

        -
        public String getTypeName()
        -
      • -
      - - - -
        -
      • -

        isInstalled

        -
        public abstract boolean isInstalled()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/contrib/ContributionChangeListener.html b/build/javadoc/everything/processing/app/contrib/ContributionChangeListener.html deleted file mode 100644 index 3218ca6495..0000000000 --- a/build/javadoc/everything/processing/app/contrib/ContributionChangeListener.html +++ /dev/null @@ -1,250 +0,0 @@ - - - - - -ContributionChangeListener - - - - - - - - - - - -
-
processing.app.contrib
-

Interface ContributionChangeListener

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    ContributionListPanel
    -
    -
    -
    -
    public interface ContributionChangeListener
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/contrib/ContributionListPanel.html b/build/javadoc/everything/processing/app/contrib/ContributionListPanel.html deleted file mode 100644 index 096af1c29a..0000000000 --- a/build/javadoc/everything/processing/app/contrib/ContributionListPanel.html +++ /dev/null @@ -1,530 +0,0 @@ - - - - - -ContributionListPanel - - - - - - - - - - - -
-
processing.app.contrib
-

Class ContributionListPanel

-
-
- -
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/contrib/ContributionListing.html b/build/javadoc/everything/processing/app/contrib/ContributionListing.html deleted file mode 100644 index 9adec4f956..0000000000 --- a/build/javadoc/everything/processing/app/contrib/ContributionListing.html +++ /dev/null @@ -1,283 +0,0 @@ - - - - - -ContributionListing - - - - - - - - - - - -
-
processing.app.contrib
-

Class ContributionListing

-
-
-
    -
  • Object
  • -
  • -
      -
    • ContributionListing
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class ContributionListing
    -extends Object
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/contrib/ContributionManager.html b/build/javadoc/everything/processing/app/contrib/ContributionManager.html deleted file mode 100644 index 499f43d354..0000000000 --- a/build/javadoc/everything/processing/app/contrib/ContributionManager.html +++ /dev/null @@ -1,397 +0,0 @@ - - - - - -ContributionManager - - - - - - - - - - - -
-
processing.app.contrib
-

Class ContributionManager

-
-
-
    -
  • Object
  • -
  • -
      -
    • ContributionManager
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class ContributionManager
    -extends Object
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ContributionManager

        -
        public ContributionManager()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        downloadAndInstallOnImport

        -
        public static void downloadAndInstallOnImport(Base base,
        -                                              List<AvailableContribution> aList)
        -
        Blocking call to download and install a set of libraries. Used when a list - of libraries have to be installed while forcing the user to not modify - anything and providing feedback via the console status area, such as when - the user tries to run a sketch that imports uninstaled libraries.
        -
        -
        Parameters:
        -
        aList - The list of AvailableContributions to be downloaded and installed.
        -
        -
      • -
      - - - -
        -
      • -

        refreshInstalled

        -
        public static void refreshInstalled(Editor e)
        -
      • -
      - - - -
        -
      • -

        getUniqueName

        -
        public static File getUniqueName(File parentFolder,
        -                                 String fileName)
        -
        Returns a file in the parent folder that does not exist yet. If - parent/fileName already exists, this will look for parent/fileName(2) - then parent/fileName(3) and so forth.
        -
        -
        Returns:
        -
        a file that does not exist yet
        -
        -
      • -
      - - - -
        -
      • -

        getFileName

        -
        public static String getFileName(File libFile)
        -
        Returns the name of a file without its path or extension. - - For example, - "/path/to/helpfullib.zip" returns "helpfullib" - "helpfullib-0.1.1.plb" returns "helpfullib-0.1.1"
        -
      • -
      - - - -
        -
      • -

        cleanup

        -
        public static void cleanup(Base base)
        -                    throws Exception
        -
        Called by Base to clean up entries previously marked for deletion - and remove any "requires restart" flags. - Also updates all entries previously marked for update.
        -
        -
        Throws:
        -
        Exception
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/contrib/ContributionManagerDialog.html b/build/javadoc/everything/processing/app/contrib/ContributionManagerDialog.html deleted file mode 100644 index f90266c677..0000000000 --- a/build/javadoc/everything/processing/app/contrib/ContributionManagerDialog.html +++ /dev/null @@ -1,307 +0,0 @@ - - - - - -ContributionManagerDialog - - - - - - - - - - - -
-
processing.app.contrib
-

Class ContributionManagerDialog

-
-
-
    -
  • Object
  • -
  • -
      -
    • ContributionManagerDialog
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class ContributionManagerDialog
    -extends Object
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ContributionManagerDialog

        -
        public ContributionManagerDialog(ContributionType type)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        hasUpdates

        -
        public boolean hasUpdates()
        -
      • -
      - - - -
        -
      • -

        hasUpdates

        -
        public boolean hasUpdates(Base base)
        -
      • -
      - - - -
        -
      • -

        showFrame

        -
        public void showFrame(Editor editor)
        -
      • -
      - - - -
        -
      • -

        hasAlreadyBeenOpened

        -
        public boolean hasAlreadyBeenOpened()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/contrib/ContributionType.html b/build/javadoc/everything/processing/app/contrib/ContributionType.html deleted file mode 100644 index a3670cc9eb..0000000000 --- a/build/javadoc/everything/processing/app/contrib/ContributionType.html +++ /dev/null @@ -1,488 +0,0 @@ - - - - - -ContributionType - - - - - - - - - - - -
-
processing.app.contrib
-

Enum ContributionType

-
-
- -
- -
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static ContributionType[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (ContributionType c : ContributionType.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static ContributionType valueOf(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:
        -
        IllegalArgumentException - if this enum type has no constant with the specified name
        -
        NullPointerException - if the argument is null
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getTitle

        -
        public String getTitle()
        -
        Get this type name as a purtied up, capitalized version.
        -
        -
        Returns:
        -
        Mode for mode, Tool for tool, etc.
        -
        -
      • -
      - - - -
        -
      • -

        getFolderName

        -
        public String getFolderName()
        -
      • -
      - - - - - - - -
        -
      • -

        isTempFolderName

        -
        public boolean isTempFolderName(String name)
        -
      • -
      - - - - - - - -
        -
      • -

        getSketchbookFolder

        -
        public File getSketchbookFolder()
        -
      • -
      - - - -
        -
      • -

        listCandidates

        -
        public File[] listCandidates(File folder)
        -
        Return a list of directories that have the necessary subfolder for this - contribution type. For instance, a list of folders that have a 'mode' - subfolder if this is a ModeContribution.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/contrib/ExamplesContribution.html b/build/javadoc/everything/processing/app/contrib/ExamplesContribution.html deleted file mode 100644 index 01d9e29ada..0000000000 --- a/build/javadoc/everything/processing/app/contrib/ExamplesContribution.html +++ /dev/null @@ -1,344 +0,0 @@ - - - - - -ExamplesContribution - - - - - - - - - - - -
-
processing.app.contrib
-

Class ExamplesContribution

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        isExamplesCompatible

        -
        public static boolean isExamplesCompatible(Base base,
        -                                           File exampleLocationFolder)
        -
        Function to determine whether or not the example present in the - exampleLocation directory is compatible with the present mode.
        -
        -
        Parameters:
        -
        base -
        -
        exampleLocationFolder -
        -
        Returns:
        -
        true if the example is compatible with the mode of the currently - active editor
        -
        -
      • -
      - - - -
        -
      • -

        loadMissing

        -
        public static void loadMissing(Base base)
        -
      • -
      - - - - - - - -
        -
      • -

        getCompatibleModesList

        -
        public ArrayList<String> getCompatibleModesList()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/contrib/LocalContribution.html b/build/javadoc/everything/processing/app/contrib/LocalContribution.html deleted file mode 100644 index 359f47f228..0000000000 --- a/build/javadoc/everything/processing/app/contrib/LocalContribution.html +++ /dev/null @@ -1,443 +0,0 @@ - - - - - -LocalContribution - - - - - - - - - - - -
-
processing.app.contrib
-

Class LocalContribution

-
-
- -
- -
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        LocalContribution

        -
        public LocalContribution(File folder)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        getFolder

        -
        public File getFolder()
        -
      • -
      - - - - - - - -
        -
      • -

        getId

        -
        public String getId()
        -
      • -
      - - - -
        -
      • -

        getLatestVersion

        -
        public int getLatestVersion()
        -
      • -
      - - - -
        -
      • -

        getSpecifiedImports

        -
        public String[] getSpecifiedImports()
        -
        Returns the imports (package-names) for a library, as specified in its library.properties - (e.g., imports=libname.*,libname.support.*)
        -
        -
        Returns:
        -
        String[] packageNames (without wildcards) or null if none are specified
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/contrib/ModeContribution.html b/build/javadoc/everything/processing/app/contrib/ModeContribution.html deleted file mode 100644 index 6169bebd90..0000000000 --- a/build/javadoc/everything/processing/app/contrib/ModeContribution.html +++ /dev/null @@ -1,370 +0,0 @@ - - - - - -ModeContribution - - - - - - - - - - - -
-
processing.app.contrib
-

Class ModeContribution

-
-
- -
- -
-
- -
-
-
    -
  • - - -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/contrib/ToolContribution.html b/build/javadoc/everything/processing/app/contrib/ToolContribution.html deleted file mode 100644 index 6c0a5e4c3a..0000000000 --- a/build/javadoc/everything/processing/app/contrib/ToolContribution.html +++ /dev/null @@ -1,422 +0,0 @@ - - - - - -ToolContribution - - - - - - - - - - - -
-
processing.app.contrib
-

Class ToolContribution

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        clearClassLoader

        -
        public void clearClassLoader(Base base)
        -
        Method to close the ClassLoader so that the archives are no longer "locked" and - a tool can be removed without restart.
        -
      • -
      - - - - - - - -
        -
      • -

        init

        -
        public void init(Editor editor)
        -
        -
        Specified by:
        -
        init in interface Tool
        -
        -
      • -
      - - - -
        -
      • -

        run

        -
        public void run()
        -
        -
        Specified by:
        -
        run in interface Runnable
        -
        Specified by:
        -
        run in interface Tool
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getReferenceIndexFile

        -
        public File getReferenceIndexFile()
        -
        Returns the object stored in the referenceFile field, which contains an - instance of the file object representing the index file of the reference
        -
        -
        Returns:
        -
        referenceFile
        -
        -
      • -
      - - - -
        -
      • -

        hasReference

        -
        public boolean hasReference()
        -
        Tests whether the reference's index file indicated by referenceFile exists.
        -
        -
        Returns:
        -
        true if and only if the file denoted by referenceFile exists; false - otherwise.
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/contrib/package-frame.html b/build/javadoc/everything/processing/app/contrib/package-frame.html deleted file mode 100644 index 6ee89ff681..0000000000 --- a/build/javadoc/everything/processing/app/contrib/package-frame.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - -processing.app.contrib - - - - -

processing.app.contrib

- - - diff --git a/build/javadoc/everything/processing/app/contrib/package-summary.html b/build/javadoc/everything/processing/app/contrib/package-summary.html deleted file mode 100644 index b9b90752b4..0000000000 --- a/build/javadoc/everything/processing/app/contrib/package-summary.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - -processing.app.contrib - - - - - - - - - - -
-

Package processing.app.contrib

-
-
- -
- - - - - - diff --git a/build/javadoc/everything/processing/app/contrib/package-tree.html b/build/javadoc/everything/processing/app/contrib/package-tree.html deleted file mode 100644 index a01dbc1d4e..0000000000 --- a/build/javadoc/everything/processing/app/contrib/package-tree.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - -processing.app.contrib Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.app.contrib

-Package Hierarchies: - -
- - - - - - - diff --git a/build/javadoc/everything/processing/app/exec/LineProcessor.html b/build/javadoc/everything/processing/app/exec/LineProcessor.html deleted file mode 100644 index ff7738dad3..0000000000 --- a/build/javadoc/everything/processing/app/exec/LineProcessor.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - - -LineProcessor - - - - - - - - - - - -
-
processing.app.exec
-

Interface LineProcessor

-
-
-
-
    -
  • -
    -
    -
    public interface LineProcessor
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        processLine

        -
        void processLine(String line)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/exec/ProcessHelper.html b/build/javadoc/everything/processing/app/exec/ProcessHelper.html deleted file mode 100644 index 6bf552e64c..0000000000 --- a/build/javadoc/everything/processing/app/exec/ProcessHelper.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - -ProcessHelper - - - - - - - - - - - -
-
processing.app.exec
-

Class ProcessHelper

-
-
-
    -
  • Object
  • -
  • -
      -
    • ProcessHelper
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class ProcessHelper
    -extends Object
    -
    Class to handle calling Runtime.exec() and stuffing output and error streams - into Strings that can be dealt with more easily.
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/exec/ProcessRegistry.html b/build/javadoc/everything/processing/app/exec/ProcessRegistry.html deleted file mode 100644 index 487b065fcc..0000000000 --- a/build/javadoc/everything/processing/app/exec/ProcessRegistry.html +++ /dev/null @@ -1,288 +0,0 @@ - - - - - -ProcessRegistry - - - - - - - - - - - -
-
processing.app.exec
-

Class ProcessRegistry

-
-
-
    -
  • Object
  • -
  • -
      -
    • ProcessRegistry
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class ProcessRegistry
    -extends Object
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ProcessRegistry

        -
        public ProcessRegistry()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        watch

        -
        public static void watch(Process p)
        -
        When starting up a process
        -
        -
        Parameters:
        -
        p -
        -
        -
      • -
      - - - -
        -
      • -

        unwatch

        -
        public static void unwatch(Process p)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/exec/ProcessResult.html b/build/javadoc/everything/processing/app/exec/ProcessResult.html deleted file mode 100644 index 8ef1b0c2de..0000000000 --- a/build/javadoc/everything/processing/app/exec/ProcessResult.html +++ /dev/null @@ -1,387 +0,0 @@ - - - - - -ProcessResult - - - - - - - - - - - -
-
processing.app.exec
-

Class ProcessResult

-
-
-
    -
  • Object
  • -
  • -
      -
    • ProcessResult
    • -
    -
  • -
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ProcessResult

        -
        public ProcessResult(String cmd,
        -                     int result,
        -                     String output,
        -                     String error,
        -                     long time)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        getCmd

        -
        public String getCmd()
        -
      • -
      - - - -
        -
      • -

        getResult

        -
        public int getResult()
        -
      • -
      - - - -
        -
      • -

        succeeded

        -
        public boolean succeeded()
        -
      • -
      - - - -
        -
      • -

        getStderr

        -
        public String getStderr()
        -
      • -
      - - - -
        -
      • -

        getStdout

        -
        public String getStdout()
        -
      • -
      - - - -
        -
      • -

        getTime

        -
        public long getTime()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/exec/StreamPump.html b/build/javadoc/everything/processing/app/exec/StreamPump.html deleted file mode 100644 index a988faeb3b..0000000000 --- a/build/javadoc/everything/processing/app/exec/StreamPump.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - -StreamPump - - - - - - - - - - - -
-
processing.app.exec
-

Class StreamPump

-
-
-
    -
  • Object
  • -
  • -
      -
    • StreamPump
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Runnable
    -
    -
    -
    -
    public class StreamPump
    -extends Object
    -implements Runnable
    -

    A StreamPump reads lines of text from its given InputStream - and informs its LineProcessors until the InputStream is exhausted. - It is useful only for pumping lines of text, and not for arbitrary - binary cruft. It's handy for reading the output of processes that - emit textual data, for example.

    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/exec/StreamRedirectThread.html b/build/javadoc/everything/processing/app/exec/StreamRedirectThread.html deleted file mode 100644 index 08b59c62f5..0000000000 --- a/build/javadoc/everything/processing/app/exec/StreamRedirectThread.html +++ /dev/null @@ -1,354 +0,0 @@ - - - - - -StreamRedirectThread - - - - - - - - - - - -
-
processing.app.exec
-

Class StreamRedirectThread

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Runnable
    -
    -
    -
    -
    public class StreamRedirectThread
    -extends Thread
    -
    StreamRedirectThread is a thread which copies it's input to - it's output and terminates when it completes.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        StreamRedirectThread

        -
        public StreamRedirectThread(String name,
        -                            InputStream in,
        -                            OutputStream out)
        -
        Set up for copy.
        -
        -
        Parameters:
        -
        name - Name of the thread
        -
        in - Stream to copy from
        -
        out - Stream to copy to
        -
        -
      • -
      - - - -
        -
      • -

        StreamRedirectThread

        -
        public StreamRedirectThread(String name,
        -                            Reader in,
        -                            Writer out)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        run

        -
        public void run()
        -
        Copy.
        -
        -
        Specified by:
        -
        run in interface Runnable
        -
        Overrides:
        -
        run in class Thread
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/exec/SystemOutSiphon.html b/build/javadoc/everything/processing/app/exec/SystemOutSiphon.html deleted file mode 100644 index 725dfdfee4..0000000000 --- a/build/javadoc/everything/processing/app/exec/SystemOutSiphon.html +++ /dev/null @@ -1,279 +0,0 @@ - - - - - -SystemOutSiphon - - - - - - - - - - - -
-
processing.app.exec
-

Class SystemOutSiphon

-
-
-
    -
  • Object
  • -
  • -
      -
    • SystemOutSiphon
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Runnable
    -
    -
    -
    -
    public class SystemOutSiphon
    -extends Object
    -implements Runnable
    -
    Siphons from an InputStream of System.out (from a Process) - and sends it to the real System.out.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        SystemOutSiphon

        -
        public SystemOutSiphon(InputStream input)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        run

        -
        public void run()
        -
        -
        Specified by:
        -
        run in interface Runnable
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/exec/package-frame.html b/build/javadoc/everything/processing/app/exec/package-frame.html deleted file mode 100644 index cc489d5764..0000000000 --- a/build/javadoc/everything/processing/app/exec/package-frame.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - -processing.app.exec - - - - -

processing.app.exec

- - - diff --git a/build/javadoc/everything/processing/app/exec/package-summary.html b/build/javadoc/everything/processing/app/exec/package-summary.html deleted file mode 100644 index 78a6d18818..0000000000 --- a/build/javadoc/everything/processing/app/exec/package-summary.html +++ /dev/null @@ -1,186 +0,0 @@ - - - - - -processing.app.exec - - - - - - - - - - -
-

Package processing.app.exec

-
-
-
    -
  • - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    LineProcessor 
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    ProcessHelper -
    Class to handle calling Runtime.exec() and stuffing output and error streams - into Strings that can be dealt with more easily.
    -
    ProcessRegistry 
    ProcessResult 
    StreamPump -
    A StreamPump reads lines of text from its given InputStream - and informs its LineProcessors until the InputStream is exhausted.
    -
    StreamRedirectThread -
    StreamRedirectThread is a thread which copies it's input to - it's output and terminates when it completes.
    -
    SystemOutSiphon -
    Siphons from an InputStream of System.out (from a Process) - and sends it to the real System.out.
    -
    -
  • -
-
- - - - - - diff --git a/build/javadoc/everything/processing/app/exec/package-tree.html b/build/javadoc/everything/processing/app/exec/package-tree.html deleted file mode 100644 index 7a15bc6f77..0000000000 --- a/build/javadoc/everything/processing/app/exec/package-tree.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - -processing.app.exec Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.app.exec

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Interface Hierarchy

- -
- - - - - - diff --git a/build/javadoc/everything/processing/app/package-frame.html b/build/javadoc/everything/processing/app/package-frame.html deleted file mode 100644 index cd504254c0..0000000000 --- a/build/javadoc/everything/processing/app/package-frame.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - -processing.app - - - - -

processing.app

- - - diff --git a/build/javadoc/everything/processing/app/package-summary.html b/build/javadoc/everything/processing/app/package-summary.html deleted file mode 100644 index 5a9ddc4afa..0000000000 --- a/build/javadoc/everything/processing/app/package-summary.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - -processing.app - - - - - - - - - - -
-

Package processing.app

-
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    Formatter -
    This may change to a more generic String manipulating interface/class, since - it probably affects other code as well.
    -
    Platform.CLibrary 
    RunnerListener 
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    About 
    Base -
    The base class for the main processing application.
    -
    ChangeDetector 
    ColorChooser -
    Generic color selector frame, pulled from the Tool object.
    -
    Editor -
    Main editor panel for the Processing Development Environment.
    -
    EditorButton 
    EditorConsole -
    Message console that sits below the editing area.
    -
    EditorFooter -
    Console/error/whatever tabs at the bottom of the editor window.
    -
    EditorHeader -
    Sketch tabs at the top of the editor window.
    -
    EditorState 
    EditorStatus -
    Panel just below the editing area that contains status messages.
    -
    EditorToolbar -
    Run/Stop button plus Mode selection
    -
    FindReplace -
    Find & Replace window for the Processing editor.
    -
    Language -
    Internationalization (i18n)
    -
    Library 
    Mode 
    Platform -
    Used by Base for platform-specific tweaking, for instance finding the - sketchbook location using the Windows registry, or OS X event handling.
    -
    Preferences -
    Storage class for user preferences and environment settings.
    -
    PreferencesFrame -
    Creates the window for modifying preferences.
    -
    ProgressFrame -
    Class used to handle progress bar, and run Save As or Add File in - background so that progress bar can update without freezing.
    -
    Recent 
    Settings -
    Storage class for theme settings.
    -
    SingleInstance -
    Class that handles a small server that prevents multiple instances of - Processing from running simultaneously.
    -
    Sketch -
    Stores information about files in the current sketch.
    -
    SketchCode -
    Represents a single tab of a sketch.
    -
    SketchReference 
    Toolkit -
    Utility functions for base that require a java.awt.Toolkit object.
    -
    UpdateCheck -
    Threaded class to check for updates in the background.
    -
    WebServer -
    This code is placed here in anticipation of running the reference from an - internal web server that reads the docs from a zip file, instead of using - thousands of .html files on the disk, which is really inefficient.
    -
    -
  • -
  • - - - - - - - - - - - - -
    Exception Summary 
    ExceptionDescription
    SketchException -
    An exception with a line number attached that occurs - during either pre-processing, compile, or run time.
    -
    -
  • -
-
- - - - - - diff --git a/build/javadoc/everything/processing/app/package-tree.html b/build/javadoc/everything/processing/app/package-tree.html deleted file mode 100644 index 7555ee6ddd..0000000000 --- a/build/javadoc/everything/processing/app/package-tree.html +++ /dev/null @@ -1,238 +0,0 @@ - - - - - -processing.app Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.app

-Package Hierarchies: - -
- - - - - - - diff --git a/build/javadoc/everything/processing/app/platform/LinuxPlatform.html b/build/javadoc/everything/processing/app/platform/LinuxPlatform.html deleted file mode 100644 index bc7404c544..0000000000 --- a/build/javadoc/everything/processing/app/platform/LinuxPlatform.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - - -LinuxPlatform - - - - - - - - - - - -
-
processing.app.platform
-

Class LinuxPlatform

-
-
- -
-
    -
  • -
    -
    -
    public class LinuxPlatform
    -extends Platform
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/platform/MacPlatform.html b/build/javadoc/everything/processing/app/platform/MacPlatform.html deleted file mode 100644 index 914bcb8c32..0000000000 --- a/build/javadoc/everything/processing/app/platform/MacPlatform.html +++ /dev/null @@ -1,372 +0,0 @@ - - - - - -MacPlatform - - - - - - - - - - - -
-
processing.app.platform
-

Class MacPlatform

-
-
- -
-
    -
  • -
    -
    -
    public class MacPlatform
    -extends Platform
    -
    Platform handler for Mac OS X.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        MacPlatform

        -
        public MacPlatform()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        saveLanguage

        -
        public void saveLanguage(String language)
        -
        Description copied from class: Platform
        -
        Handle any platform-specific languages saving. This is necessary on OS X - because of how bundles are handled, but perhaps your platform would like - to Think Different too?
        -
        -
        Overrides:
        -
        saveLanguage in class Platform
        -
        Parameters:
        -
        language - 2-digit lowercase ISO language code
        -
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init(Base base)
        -
        -
        Overrides:
        -
        init in class Platform
        -
        -
      • -
      - - - -
        -
      • -

        getSettingsFolder

        -
        public File getSettingsFolder()
        -                       throws Exception
        -
        Description copied from class: Platform
        -
        This function should throw an exception or return a value. - Do not return null.
        -
        -
        Overrides:
        -
        getSettingsFolder in class Platform
        -
        Throws:
        -
        Exception
        -
        -
      • -
      - - - -
        -
      • -

        getDefaultSketchbookFolder

        -
        public File getDefaultSketchbookFolder()
        -                                throws Exception
        -
        -
        Overrides:
        -
        getDefaultSketchbookFolder in class Platform
        -
        Returns:
        -
        if not overridden, a folder named "sketchbook" in user.home.
        -
        Throws:
        -
        Exception - so that subclasses can throw a fit
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/platform/ThinkDifferent.html b/build/javadoc/everything/processing/app/platform/ThinkDifferent.html deleted file mode 100644 index 51d0a9432d..0000000000 --- a/build/javadoc/everything/processing/app/platform/ThinkDifferent.html +++ /dev/null @@ -1,243 +0,0 @@ - - - - - -ThinkDifferent - - - - - - - - - - - -
-
processing.app.platform
-

Class ThinkDifferent

-
-
-
    -
  • Object
  • -
  • -
      -
    • ThinkDifferent
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class ThinkDifferent
    -extends Object
    -
    Deal with issues related to thinking differently. This handles the basic - Mac OS X menu commands (and apple events) for open, about, prefs, etc. - - 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. - - Rewritten for 0232 to remove deprecation issues, per the message - here. - (We're able to do this now because we're dropping older Java versions.)
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ThinkDifferent

        -
        public ThinkDifferent()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/platform/WindowsPlatform.WinLibC.html b/build/javadoc/everything/processing/app/platform/WindowsPlatform.WinLibC.html deleted file mode 100644 index 72f8994fb0..0000000000 --- a/build/javadoc/everything/processing/app/platform/WindowsPlatform.WinLibC.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - -WindowsPlatform.WinLibC - - - - - - - - - - - -
-
processing.app.platform
-

Interface WindowsPlatform.WinLibC

-
-
-
-
    -
  • -
    -
    All Superinterfaces:
    -
    Library
    -
    -
    -
    Enclosing class:
    -
    WindowsPlatform
    -
    -
    -
    -
    public static interface WindowsPlatform.WinLibC
    -extends Library
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from interface Library

        -Library.Handler
      • -
      -
    • -
    - -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from interface Library

        -OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRUCTURE_ALIGNMENT, OPTION_TYPE_MAPPER
      • -
      -
    • -
    - - -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        _putenv

        -
        int _putenv(String name)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/platform/WindowsPlatform.html b/build/javadoc/everything/processing/app/platform/WindowsPlatform.html deleted file mode 100644 index 77e8358a37..0000000000 --- a/build/javadoc/everything/processing/app/platform/WindowsPlatform.html +++ /dev/null @@ -1,411 +0,0 @@ - - - - - -WindowsPlatform - - - - - - - - - - - -
-
processing.app.platform
-

Class WindowsPlatform

-
-
- -
-
    -
  • -
    -
    -
    public class WindowsPlatform
    -extends Platform
    -
    Platform-specific glue for Windows.
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/platform/WindowsRegistry.REGISTRY_ROOT_KEY.html b/build/javadoc/everything/processing/app/platform/WindowsRegistry.REGISTRY_ROOT_KEY.html deleted file mode 100644 index d3e5ee86c4..0000000000 --- a/build/javadoc/everything/processing/app/platform/WindowsRegistry.REGISTRY_ROOT_KEY.html +++ /dev/null @@ -1,366 +0,0 @@ - - - - - -WindowsRegistry.REGISTRY_ROOT_KEY - - - - - - - - - - - -
-
processing.app.platform
-

Enum WindowsRegistry.REGISTRY_ROOT_KEY

-
-
- -
- -
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static WindowsRegistry.REGISTRY_ROOT_KEY[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (WindowsRegistry.REGISTRY_ROOT_KEY c : WindowsRegistry.REGISTRY_ROOT_KEY.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static WindowsRegistry.REGISTRY_ROOT_KEY valueOf(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:
        -
        IllegalArgumentException - if this enum type has no constant with the specified name
        -
        NullPointerException - if the argument is null
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/platform/WindowsRegistry.html b/build/javadoc/everything/processing/app/platform/WindowsRegistry.html deleted file mode 100644 index 8da511f740..0000000000 --- a/build/javadoc/everything/processing/app/platform/WindowsRegistry.html +++ /dev/null @@ -1,570 +0,0 @@ - - - - - -WindowsRegistry - - - - - - - - - - - -
-
processing.app.platform
-

Class WindowsRegistry

-
-
-
    -
  • Object
  • -
  • -
      -
    • WindowsRegistry
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class WindowsRegistry
    -extends Object
    -
    Methods for accessing the Windows Registry. Only String and DWORD values - supported at the moment. -

    - Not sure where this code came from originally (if you know the reference, - please get in touch so that we can add a proper citation). Several changes - were made to update it for JNA 3.5.2's platform classes and clean up the - syntax to make it less like a C program. [fry 130720]

    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/platform/package-frame.html b/build/javadoc/everything/processing/app/platform/package-frame.html deleted file mode 100644 index 5a4c5fe2b7..0000000000 --- a/build/javadoc/everything/processing/app/platform/package-frame.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - -processing.app.platform - - - - -

processing.app.platform

- - - diff --git a/build/javadoc/everything/processing/app/platform/package-summary.html b/build/javadoc/everything/processing/app/platform/package-summary.html deleted file mode 100644 index 74ae74c00b..0000000000 --- a/build/javadoc/everything/processing/app/platform/package-summary.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - -processing.app.platform - - - - - - - - - - -
-

Package processing.app.platform

-
-
- -
- - - - - - diff --git a/build/javadoc/everything/processing/app/platform/package-tree.html b/build/javadoc/everything/processing/app/platform/package-tree.html deleted file mode 100644 index e5a50f482a..0000000000 --- a/build/javadoc/everything/processing/app/platform/package-tree.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - -processing.app.platform Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.app.platform

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Interface Hierarchy

- -

Enum Hierarchy

- -
- - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/Brackets.html b/build/javadoc/everything/processing/app/syntax/Brackets.html deleted file mode 100644 index 995c189775..0000000000 --- a/build/javadoc/everything/processing/app/syntax/Brackets.html +++ /dev/null @@ -1,283 +0,0 @@ - - - - - -Brackets - - - - - - - - - - - -
-
processing.app.syntax
-

Class Brackets

-
-
- -
-
    -
  • -
    -
    -
    public class Brackets
    -extends Object
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Brackets

        -
        public Brackets()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        invalidate

        -
        public void invalidate()
        -
      • -
      - - - -
        -
      • -

        findMatchingBracket

        -
        public int findMatchingBracket(String text,
        -                               int pos)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/DefaultInputHandler.html b/build/javadoc/everything/processing/app/syntax/DefaultInputHandler.html deleted file mode 100644 index 05d60dc874..0000000000 --- a/build/javadoc/everything/processing/app/syntax/DefaultInputHandler.html +++ /dev/null @@ -1,507 +0,0 @@ - - - - - -DefaultInputHandler - - - - - - - - - - - -
-
processing.app.syntax
-

Class DefaultInputHandler

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    KeyListener, EventListener
    -
    -
    -
    Direct Known Subclasses:
    -
    PdeInputHandler
    -
    -
    -
    -
    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.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      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(String keyBinding,
        -                          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(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(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 KeyListener
        -
        Overrides:
        -
        keyPressed in class KeyAdapter
        -
        -
      • -
      - - - - - - - -
        -
      • -

        parseKeyStroke

        -
        public static KeyStroke parseKeyStroke(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/HtmlSelection.html b/build/javadoc/everything/processing/app/syntax/HtmlSelection.html deleted file mode 100644 index a55cfb5b61..0000000000 --- a/build/javadoc/everything/processing/app/syntax/HtmlSelection.html +++ /dev/null @@ -1,314 +0,0 @@ - - - - - -HtmlSelection - - - - - - - - - - - -
-
processing.app.syntax
-

Class HtmlSelection

-
-
-
    -
  • Object
  • -
  • -
      -
    • HtmlSelection
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.MacroRecorder.html b/build/javadoc/everything/processing/app/syntax/InputHandler.MacroRecorder.html deleted file mode 100644 index 4e79382531..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.MacroRecorder.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - -InputHandler.MacroRecorder - - - - - - - - - - - -
-
processing.app.syntax
-

Interface InputHandler.MacroRecorder

-
-
-
-
    -
  • -
    -
    Enclosing class:
    -
    InputHandler
    -
    -
    -
    -
    public static interface InputHandler.MacroRecorder
    -
    Macro recorder.
    -
  • -
-
-
- -
-
-
    -
  • - - -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.NonRecordable.html b/build/javadoc/everything/processing/app/syntax/InputHandler.NonRecordable.html deleted file mode 100644 index a138838cba..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.NonRecordable.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - -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 deleted file mode 100644 index 102a5039f9..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.NonRepeatable.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - -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 deleted file mode 100644 index c8fd5bce4c..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.Wrapper.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - -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 deleted file mode 100644 index d04d3eac15..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.backspace.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.backspace - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.backspace

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.backspace
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.backspace_word.html b/build/javadoc/everything/processing/app/syntax/InputHandler.backspace_word.html deleted file mode 100644 index e3db0b39b4..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.backspace_word.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.backspace_word - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.backspace_word

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.backspace_word
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.clipboard_copy.html b/build/javadoc/everything/processing/app/syntax/InputHandler.clipboard_copy.html deleted file mode 100644 index 9ac1d95dcb..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.clipboard_copy.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.clipboard_copy - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.clipboard_copy

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.clipboard_copy
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.clipboard_cut.html b/build/javadoc/everything/processing/app/syntax/InputHandler.clipboard_cut.html deleted file mode 100644 index 42489f0ed7..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.clipboard_cut.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.clipboard_cut - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.clipboard_cut

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.clipboard_cut
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.clipboard_paste.html b/build/javadoc/everything/processing/app/syntax/InputHandler.clipboard_paste.html deleted file mode 100644 index 8fad92300f..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.clipboard_paste.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.clipboard_paste - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.clipboard_paste

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.clipboard_paste
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.delete.html b/build/javadoc/everything/processing/app/syntax/InputHandler.delete.html deleted file mode 100644 index 7726a5dfa5..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.delete.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.delete - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.delete

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.delete
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.delete_word.html b/build/javadoc/everything/processing/app/syntax/InputHandler.delete_word.html deleted file mode 100644 index 0f68a2e253..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.delete_word.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.delete_word - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.delete_word

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.delete_word
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.document_end.html b/build/javadoc/everything/processing/app/syntax/InputHandler.document_end.html deleted file mode 100644 index ba026e7aaf..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.document_end.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.document_end - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.document_end

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.document_end
    • -
    -
  • -
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        document_end

        -
        public document_end(boolean select)
        -
      • -
      -
    • -
    - - -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.document_home.html b/build/javadoc/everything/processing/app/syntax/InputHandler.document_home.html deleted file mode 100644 index df313381c0..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.document_home.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.document_home - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.document_home

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.document_home
    • -
    -
  • -
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        document_home

        -
        public document_home(boolean select)
        -
      • -
      -
    • -
    - - -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.end.html b/build/javadoc/everything/processing/app/syntax/InputHandler.end.html deleted file mode 100644 index 62257578fb..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.end.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.end - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.end

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.end
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.home.html b/build/javadoc/everything/processing/app/syntax/InputHandler.home.html deleted file mode 100644 index 161a86d911..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.home.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.home - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.home

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.home
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.html b/build/javadoc/everything/processing/app/syntax/InputHandler.html deleted file mode 100644 index 0502dc1eb6..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.html +++ /dev/null @@ -1,1360 +0,0 @@ - - - - - -InputHandler - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    KeyListener, EventListener
    -
    -
    -
    Direct Known Subclasses:
    -
    DefaultInputHandler
    -
    -
    -
    -
    public abstract class InputHandler
    -extends 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.

    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        SMART_HOME_END_PROPERTY

        -
        public static final 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
        -
        -
      • -
      - - - -
        -
      • -

        CONTEXT_AWARE_HOME_END

        -
        public static final String CONTEXT_AWARE_HOME_END
        -
        If this PDE property is set to Boolean.TRUE, the home/end keys will - go to the first/last non-whitespace character of the line. If already at - the that character, the keypress will move the cursor to the actual - start/end of the line. - - SMART_HOME_END_PROPERTY takes precedence over this property.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - - - - - -
        -
      • -

        BACKSPACE_WORD

        -
        public static final ActionListener BACKSPACE_WORD
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        DOCUMENT_END

        -
        public static final ActionListener DOCUMENT_END
        -
      • -
      - - - - - - - -
        -
      • -

        SELECT_DOC_END

        -
        public static final ActionListener SELECT_DOC_END
        -
      • -
      - - - -
        -
      • -

        INSERT_BREAK

        -
        public static final ActionListener INSERT_BREAK
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        DOCUMENT_HOME

        -
        public static final ActionListener DOCUMENT_HOME
        -
      • -
      - - - - - - - -
        -
      • -

        SELECT_DOC_HOME

        -
        public static final ActionListener SELECT_DOC_HOME
        -
      • -
      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        SELECT_NEXT_CHAR

        -
        public static final ActionListener SELECT_NEXT_CHAR
        -
      • -
      - - - -
        -
      • -

        SELECT_NEXT_LINE

        -
        public static final ActionListener SELECT_NEXT_LINE
        -
      • -
      - - - -
        -
      • -

        SELECT_NEXT_PAGE

        -
        public static final ActionListener SELECT_NEXT_PAGE
        -
      • -
      - - - -
        -
      • -

        SELECT_NEXT_WORD

        -
        public static final ActionListener SELECT_NEXT_WORD
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        SELECT_PREV_CHAR

        -
        public static final ActionListener SELECT_PREV_CHAR
        -
      • -
      - - - -
        -
      • -

        SELECT_PREV_LINE

        -
        public static final ActionListener SELECT_PREV_LINE
        -
      • -
      - - - -
        -
      • -

        SELECT_PREV_PAGE

        -
        public static final ActionListener SELECT_PREV_PAGE
        -
      • -
      - - - -
        -
      • -

        SELECT_PREV_WORD

        -
        public static final ActionListener SELECT_PREV_WORD
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        CLIPBOARD_CUT

        -
        public static final ActionListener CLIPBOARD_CUT
        -
      • -
      - - - -
        -
      • -

        CLIPBOARD_COPY

        -
        public static final ActionListener CLIPBOARD_COPY
        -
      • -
      - - - -
        -
      • -

        CLIPBOARD_PASTE

        -
        public static final ActionListener CLIPBOARD_PASTE
        -
      • -
      - - - - -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        InputHandler

        -
        public InputHandler()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getAction

        -
        public static ActionListener getAction(String name)
        -
        Returns a named text area action.
        -
        -
        Parameters:
        -
        name - The action name
        -
        -
      • -
      - - - -
        -
      • -

        getActionName

        -
        public static String getActionName(ActionListener listener)
        -
        Returns the name of the specified text area action.
        -
        -
        Parameters:
        -
        listener - The action
        -
        -
      • -
      - - - -
        -
      • -

        getActions

        -
        public static Set<String> 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(String keyBinding,
        -                                   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(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(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(ActionListener listener,
        -                          Object source,
        -                          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(EventObject evt)
        -
        Returns the text area that fired the specified event.
        -
        -
        Parameters:
        -
        evt - The event
        -
        -
      • -
      - - - -
        -
      • -

        findWordStart

        -
        public static int findWordStart(String line,
        -                                int pos,
        -                                String noWordSep)
        -
        Locates the start of the word at the specified position. - Moved from TextUtilities.java [fry 121210].
        -
        -
        Parameters:
        -
        line - The text
        -
        pos - The position
        -
        -
      • -
      - - - -
        -
      • -

        findWordEnd

        -
        public static int findWordEnd(String line,
        -                              int pos,
        -                              String noWordSep)
        -
        Locates the end of the word at the specified position. - Moved from TextUtilities.java [fry 121210].
        -
        -
        Parameters:
        -
        line - The text
        -
        pos - The position
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.insert_break.html b/build/javadoc/everything/processing/app/syntax/InputHandler.insert_break.html deleted file mode 100644 index c177fc0820..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.insert_break.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.insert_break - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.insert_break

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.insert_break
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.insert_char.html b/build/javadoc/everything/processing/app/syntax/InputHandler.insert_char.html deleted file mode 100644 index 8956f3ed84..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.insert_char.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.insert_char - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.insert_char

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.insert_char
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.insert_tab.html b/build/javadoc/everything/processing/app/syntax/InputHandler.insert_tab.html deleted file mode 100644 index 2bb57eb9b3..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.insert_tab.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.insert_tab - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.insert_tab

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.insert_tab
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.next_char.html b/build/javadoc/everything/processing/app/syntax/InputHandler.next_char.html deleted file mode 100644 index 021629d6e0..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.next_char.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.next_char - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.next_char

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.next_char
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.next_line.html b/build/javadoc/everything/processing/app/syntax/InputHandler.next_line.html deleted file mode 100644 index be8681bcee..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.next_line.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.next_line - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.next_line

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.next_line
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.next_page.html b/build/javadoc/everything/processing/app/syntax/InputHandler.next_page.html deleted file mode 100644 index 8c9d1b560f..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.next_page.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.next_page - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.next_page

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.next_page
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.next_word.html b/build/javadoc/everything/processing/app/syntax/InputHandler.next_word.html deleted file mode 100644 index 3b63603281..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.next_word.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.next_word - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.next_word

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.next_word
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.overwrite.html b/build/javadoc/everything/processing/app/syntax/InputHandler.overwrite.html deleted file mode 100644 index fc3620f7a4..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.overwrite.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.overwrite - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.overwrite

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.overwrite
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.prev_char.html b/build/javadoc/everything/processing/app/syntax/InputHandler.prev_char.html deleted file mode 100644 index bbcd6a8607..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.prev_char.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.prev_char - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.prev_char

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.prev_char
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.prev_line.html b/build/javadoc/everything/processing/app/syntax/InputHandler.prev_line.html deleted file mode 100644 index 6db287d1f2..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.prev_line.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.prev_line - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.prev_line

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.prev_line
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.prev_page.html b/build/javadoc/everything/processing/app/syntax/InputHandler.prev_page.html deleted file mode 100644 index e3035ffa48..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.prev_page.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.prev_page - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.prev_page

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.prev_page
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.prev_word.html b/build/javadoc/everything/processing/app/syntax/InputHandler.prev_word.html deleted file mode 100644 index d2230ace46..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.prev_word.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.prev_word - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.prev_word

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.prev_word
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.repeat.html b/build/javadoc/everything/processing/app/syntax/InputHandler.repeat.html deleted file mode 100644 index da8365ad1e..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.repeat.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.repeat - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.repeat

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.repeat
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.toggle_rect.html b/build/javadoc/everything/processing/app/syntax/InputHandler.toggle_rect.html deleted file mode 100644 index 42cbb12ac6..0000000000 --- a/build/javadoc/everything/processing/app/syntax/InputHandler.toggle_rect.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -InputHandler.toggle_rect - - - - - - - - - - - -
-
processing.app.syntax
-

Class InputHandler.toggle_rect

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputHandler.toggle_rect
    • -
    -
  • -
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/JEditTextArea.html b/build/javadoc/everything/processing/app/syntax/JEditTextArea.html deleted file mode 100644 index 512331100a..0000000000 --- a/build/javadoc/everything/processing/app/syntax/JEditTextArea.html +++ /dev/null @@ -1,2262 +0,0 @@ - - - - - -JEditTextArea - - - - - - - - - - - -
-
processing.app.syntax
-

Class JEditTextArea

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    ImageObserver, MenuContainer, Serializable
    -
    -
    -
    -
    public class JEditTextArea
    -extends JComponent
    -
    The text area component from the JEdit Syntax (syntax.jedit.org) project. - This is a very early version of what later was completely rewritten and - become jEdit (jedit.org). Over the years we've also added minor features - for use with Processing (notably mouse wheel support and copyAsHTML). [fry] -

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

      Field Detail

      - - - -
        -
      • -

        LEFT_OF_SCROLLBAR

        -
        public static 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.
        -
      • -
      - - - -
        -
      • -

        leftHandGutter

        -
        public static final int leftHandGutter
        -
        The size of the offset between the leftmost padding and the code
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JEditTextArea

        -
        public JEditTextArea(TextAreaDefaults defaults,
        -                     InputHandler inputHandler)
        -
        Creates a new JEditTextArea with the specified settings.
        -
        -
        Parameters:
        -
        defaults - The default settings
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        getScrollPosition

        -
        public int getScrollPosition()
        -
        Deprecated. Use getVerticalScrollPosition().
        -
        Get current position of the vertical scroll bar. [fry]
        -
      • -
      - - - -
        -
      • -

        setScrollPosition

        -
        public void setScrollPosition(int what)
        - -
        Set position of the vertical scroll bar. [fry]
        -
      • -
      - - - -
        -
      • -

        getVerticalScrollPosition

        -
        public int getVerticalScrollPosition()
        -
        Get current position of the vertical scroll bar.
        -
      • -
      - - - -
        -
      • -

        setVerticalScrollPosition

        -
        public void setVerticalScrollPosition(int what)
        -
        Set position of the vertical scroll bar.
        -
      • -
      - - - -
        -
      • -

        getHorizontalScrollPosition

        -
        public int getHorizontalScrollPosition()
        -
        Get current position of the horizontal scroll bar.
        -
      • -
      - - - -
        -
      • -

        setHorizontalScrollPosition

        -
        public void setHorizontalScrollPosition(int what)
        -
        Set position of the horizontal scroll bar.
        -
      • -
      - - - -
        -
      • -

        getPainter

        -
        public final TextAreaPainter getPainter()
        -
        Returns the object responsible for painting this text area.
        -
      • -
      - - - -
        -
      • -

        getPrintable

        -
        public final Printable getPrintable()
        -
      • -
      - - - -
        -
      • -

        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 area 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.
        -
      • -
      - - - -
        -
      • -

        getLastLine

        -
        public final int getLastLine()
        -
        Convenience for checking what's on-screen. [fry]
        -
      • -
      - - - -
        -
      • -

        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 coordinate. 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
        -
        -
      • -
      - - - -
        -
      • -

        getLineStartNonWhiteSpaceOffset

        -
        public int getLineStartNonWhiteSpaceOffset(int line)
        -
      • -
      - - - -
        -
      • -

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

        getLineStopNonWhiteSpaceOffset

        -
        public int getLineStopNonWhiteSpaceOffset(int line)
        -
      • -
      - - - -
        -
      • -

        getLineSelectionStopOffset

        -
        public int getLineSelectionStopOffset(int line)
        -
        Returns the start offset of the line after this line, or the end of - this line if there is no next 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 String getText()
        -
        Returns the entire text of this text area.
        -
      • -
      - - - -
        -
      • -

        setText

        -
        public void setText(String text)
        -
        Sets the entire text of this text area.
        -
      • -
      - - - -
        -
      • -

        getText

        -
        public final 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,
        -                          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 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,
        -                              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 String getSelectedText()
        -
        Returns the selected text, or null if no selection is active.
        -
      • -
      - - - -
        -
      • -

        setSelectedText

        -
        public void setSelectedText(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 JPopupMenu getRightClickPopup()
        -
        Returns the right click popup menu.
        -
      • -
      - - - -
        -
      • -

        setRightClickPopup

        -
        public final void setRightClickPopup(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(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(CaretListener listener)
        -
        Adds a caret change listener to this text area.
        -
        -
        Parameters:
        -
        listener - The listener
        -
        -
      • -
      - - - -
        -
      • -

        removeCaretListener

        -
        public final void removeCaretListener(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.
        -
      • -
      - - - -
        -
      • -

        copyAsHTML

        -
        public void copyAsHTML()
        -
        Copy the current selection as HTML, formerly "Format for Discourse". -

        - Original code by owd. -

        - Revised and updated for revision 0108 by Ben Fry (10 March 2006). -

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

        - Updated for 0185 to incorporate the HTML changes from the Arduino project, - and set the formatter to always use HTML (disabling, but not removing the - YaBB version of the code) and also fixing it for the Tools API. -

        - Updated for 0190 to simply be part of JEditTextArea, removed YaBB code. - Simplest and most sensible to have it live here, since it's no longer - specific to any language or version of the PDE.

        -
      • -
      - - - -
        -
      • -

        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 JComponent
        -
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/KeywordMap.html b/build/javadoc/everything/processing/app/syntax/KeywordMap.html deleted file mode 100644 index 51932b3615..0000000000 --- a/build/javadoc/everything/processing/app/syntax/KeywordMap.html +++ /dev/null @@ -1,390 +0,0 @@ - - - - - -KeywordMap - - - - - - - - - - - -
-
processing.app.syntax
-

Class KeywordMap

-
-
-
    -
  • Object
  • -
  • -
      -
    • KeywordMap
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class KeywordMap
    -extends 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

      - - - - - - - - -
      Constructors 
      Constructor and Description
      KeywordMap(boolean ignoreCase) -
      Creates a new KeywordMap.
      -
      -
    • -
    - - -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        KeywordMap

        -
        public KeywordMap(boolean ignoreCase)
        -
        Creates a new KeywordMap.
        -
        -
        Parameters:
        -
        ignoreCase - True if keys are case insensitive
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        lookup

        -
        public byte lookup(Segment text,
        -                   int offset,
        -                   int length,
        -                   boolean paren)
        -
        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
        -
        -
      • -
      - - - -
        -
      • -

        regionMatches

        -
        public static boolean regionMatches(boolean ignoreCase,
        -                                    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
        -
        -
      • -
      - - - -
        -
      • -

        add

        -
        public void add(String keyword,
        -                byte id,
        -                boolean paren)
        -
        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/PdeInputHandler.html b/build/javadoc/everything/processing/app/syntax/PdeInputHandler.html deleted file mode 100644 index d9507e3095..0000000000 --- a/build/javadoc/everything/processing/app/syntax/PdeInputHandler.html +++ /dev/null @@ -1,415 +0,0 @@ - - - - - -PdeInputHandler - - - - - - - - - - - -
-
processing.app.syntax
-

Class PdeInputHandler

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    KeyListener, EventListener
    -
    -
    -
    -
    public class PdeInputHandler
    -extends DefaultInputHandler
    -
    Sets key bindings used by the PDE, except for those that are Mode-specific. - Not part of the original jeditsyntax DefaultInputHandler because it makes - use of Preferences and other PDE classes.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PdeInputHandler

        -
        public PdeInputHandler()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - - - - - -
        -
      • -

        handlePressed

        -
        public boolean handlePressed(KeyEvent event)
        -
        Override this function in your InputHandler to do any gymnastics.
        -
        -
        Returns:
        -
        true if key has been handled (no further handling should be done)
        -
        -
      • -
      - - - -
        -
      • -

        handleTyped

        -
        public boolean handleTyped(KeyEvent event)
        -
        Override this instead of keyPressed/keyTyped
        -
        -
        Returns:
        -
        true if key has been handled (no further handling should be done)
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/PdeKeywords.html b/build/javadoc/everything/processing/app/syntax/PdeKeywords.html deleted file mode 100644 index 0174f3d15a..0000000000 --- a/build/javadoc/everything/processing/app/syntax/PdeKeywords.html +++ /dev/null @@ -1,331 +0,0 @@ - - - - - -PdeKeywords - - - - - - - - - - - -
-
processing.app.syntax
-

Class PdeKeywords

-
-
- -
-
    -
  • -
    -
    -
    public class PdeKeywords
    -extends TokenMarker
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PdeKeywords

        -
        public PdeKeywords()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        addColoring

        -
        public void addColoring(String keyword,
        -                        String coloring)
        -
        Add a keyword, and the associated coloring. KEYWORD2 and KEYWORD3 - should only be used with functions (where parens are present). - This is done for the extra paren handling.
        -
        -
        Specified by:
        -
        addColoring in class TokenMarker
        -
        Parameters:
        -
        coloring - one of KEYWORD1, KEYWORD2, LITERAL1, etc.
        -
        -
      • -
      - - - -
        -
      • -

        markTokensImpl

        -
        public byte markTokensImpl(byte token,
        -                           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
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/PdeTextAreaDefaults.html b/build/javadoc/everything/processing/app/syntax/PdeTextAreaDefaults.html deleted file mode 100644 index 8acfb6b4be..0000000000 --- a/build/javadoc/everything/processing/app/syntax/PdeTextAreaDefaults.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - - -PdeTextAreaDefaults - - - - - - - - - - - -
-
processing.app.syntax
-

Class PdeTextAreaDefaults

-
-
- -
-
    -
  • -
    -
    -
    public class PdeTextAreaDefaults
    -extends TextAreaDefaults
    -
    Defaults that are PDE (but not Mode) specific. PDE specific in this case - means that it's using other PDE classes like Preferences.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PdeTextAreaDefaults

        -
        public PdeTextAreaDefaults(Mode mode)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/SyntaxDocument.html b/build/javadoc/everything/processing/app/syntax/SyntaxDocument.html deleted file mode 100644 index 364a09e8b5..0000000000 --- a/build/javadoc/everything/processing/app/syntax/SyntaxDocument.html +++ /dev/null @@ -1,481 +0,0 @@ - - - - - -SyntaxDocument - - - - - - - - - - - -
-
processing.app.syntax
-

Class SyntaxDocument

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      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(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 deleted file mode 100644 index 3e54139fe2..0000000000 --- a/build/javadoc/everything/processing/app/syntax/SyntaxStyle.html +++ /dev/null @@ -1,320 +0,0 @@ - - - - - -SyntaxStyle - - - - - - - - - - - -
-
processing.app.syntax
-

Class SyntaxStyle

-
-
-
    -
  • Object
  • -
  • -
      -
    • SyntaxStyle
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class SyntaxStyle
    -extends Object
    -
    A simple text style class. - It can specify the color and bold flag of a run of text.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        SyntaxStyle

        -
        public SyntaxStyle(Color color,
        -                   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 Color getColor()
        -
        Returns the color specified in this style.
        -
      • -
      - - - -
        -
      • -

        isBold

        -
        public boolean isBold()
        -
        Returns true if boldface is enabled for this style.
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public String toString()
        -
        Returns a string representation of this object.
        -
        -
        Overrides:
        -
        toString in class Object
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/TextAreaDefaults.html b/build/javadoc/everything/processing/app/syntax/TextAreaDefaults.html deleted file mode 100644 index fb88c498b7..0000000000 --- a/build/javadoc/everything/processing/app/syntax/TextAreaDefaults.html +++ /dev/null @@ -1,512 +0,0 @@ - - - - - -TextAreaDefaults - - - - - - - - - - - -
-
processing.app.syntax
-

Class TextAreaDefaults

-
-
-
    -
  • Object
  • -
  • -
      -
    • TextAreaDefaults
    • -
    -
  • -
-
-
    -
  • -
    -
    Direct Known Subclasses:
    -
    PdeTextAreaDefaults
    -
    -
    -
    -
    public class TextAreaDefaults
    -extends 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 Detail

      - - - - - - - -
        -
      • -

        caretVisible

        -
        public boolean caretVisible
        -
      • -
      - - - -
        -
      • -

        caretBlinks

        -
        public boolean caretBlinks
        -
      • -
      - - - -
        -
      • -

        blockCaret

        -
        public boolean blockCaret
        -
      • -
      - - - -
        -
      • -

        electricScroll

        -
        public int electricScroll
        -
      • -
      - - - -
        -
      • -

        cols

        -
        public int cols
        -
      • -
      - - - -
        -
      • -

        rows

        -
        public int rows
        -
      • -
      - - - - - - - -
        -
      • -

        caretColor

        -
        public Color caretColor
        -
      • -
      - - - -
        -
      • -

        selectionColor

        -
        public Color selectionColor
        -
      • -
      - - - -
        -
      • -

        lineHighlightColor

        -
        public Color lineHighlightColor
        -
      • -
      - - - -
        -
      • -

        lineHighlight

        -
        public boolean lineHighlight
        -
      • -
      - - - -
        -
      • -

        bracketHighlightColor

        -
        public Color bracketHighlightColor
        -
      • -
      - - - -
        -
      • -

        bracketHighlight

        -
        public boolean bracketHighlight
        -
      • -
      - - - -
        -
      • -

        eolMarkerColor

        -
        public Color eolMarkerColor
        -
      • -
      - - - -
        -
      • -

        eolMarkers

        -
        public boolean eolMarkers
        -
      • -
      - - - -
        -
      • -

        paintInvalid

        -
        public boolean paintInvalid
        -
      • -
      - - - -
        -
      • -

        fgcolor

        -
        public Color fgcolor
        -
      • -
      - - - -
        -
      • -

        bgcolor

        -
        public Color bgcolor
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TextAreaDefaults

        -
        public TextAreaDefaults()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/TextAreaPainter.Highlight.html b/build/javadoc/everything/processing/app/syntax/TextAreaPainter.Highlight.html deleted file mode 100644 index 63232a81ca..0000000000 --- a/build/javadoc/everything/processing/app/syntax/TextAreaPainter.Highlight.html +++ /dev/null @@ -1,285 +0,0 @@ - - - - - -TextAreaPainter.Highlight - - - - - - - - - - - -
-
processing.app.syntax
-

Interface TextAreaPainter.Highlight

-
-
-
-
    -
  • -
    -
    Enclosing class:
    -
    TextAreaPainter
    -
    -
    -
    -
    public static interface TextAreaPainter.Highlight
    -
    Highlight interface.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

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

        -
        String getToolTipText(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 deleted file mode 100644 index 01940ec739..0000000000 --- a/build/javadoc/everything/processing/app/syntax/TextAreaPainter.html +++ /dev/null @@ -1,696 +0,0 @@ - - - - - -TextAreaPainter - - - - - - - - - - - -
-
processing.app.syntax
-

Class TextAreaPainter

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TextAreaPainter

        -
        public TextAreaPainter(JEditTextArea textArea,
        -                       TextAreaDefaults defaults)
        -
        Creates a new repaint manager. This should be not be called directly.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        updateAppearance

        -
        public void updateAppearance()
        -
      • -
      - - - -
        -
      • -

        getCompositionTextpainter

        -
        public CompositionTextPainter getCompositionTextpainter()
        -
        Get CompositionTextPainter, creating one if it doesn't exist.
        -
      • -
      - - - -
        -
      • -

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

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

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

        isBlockCaretEnabled

        -
        public final boolean isBlockCaretEnabled()
        -
        Returns true if the caret should be drawn as a block, false otherwise.
        -
      • -
      - - - -
        -
      • -

        getFontMetrics

        -
        public FontMetrics getFontMetrics()
        -
        Returns the font metrics used by this component.
        -
      • -
      - - - - - - - -
        -
      • -

        paint

        -
        public void paint(Graphics gfx)
        -
        Repaints the text.
        -
        -
        Overrides:
        -
        paint in class JComponent
        -
        Parameters:
        -
        gfx - The graphics context
        -
        -
      • -
      - - - -
        -
      • -

        getPrintable

        -
        public Printable getPrintable()
        -
      • -
      - - - -
        -
      • -

        invalidateLine

        -
        public final void invalidateLine(int line)
        -
        Marks a line as needing a repaint.
        -
        -
        Parameters:
        -
        line - The line to invalidate
        -
        -
      • -
      - - - -
        -
      • -

        nextTabStop

        -
        public float nextTabStop(float x,
        -                         int tabOffset)
        -
        Returns next tab stop after a specified point.
        -
        -
        Specified by:
        -
        nextTabStop in interface TabExpander
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        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 Segment getCurrentLine()
        -
        Accessor used by tools that want to hook in and grab the formatting.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/Token.html b/build/javadoc/everything/processing/app/syntax/Token.html deleted file mode 100644 index 780c10a55d..0000000000 --- a/build/javadoc/everything/processing/app/syntax/Token.html +++ /dev/null @@ -1,812 +0,0 @@ - - - - - -Token - - - - - - - - - - - -
-
processing.app.syntax
-

Class Token

-
-
- -
-
    -
  • -
    -
    -
    public class Token
    -extends 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

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      static byteCOMMENT1 -
      This can be used to mark a comment.
      -
      static byteCOMMENT2 -
      This can be used to mark a comment.
      -
      static byteEND -
      The token type, that along with a length of 0 - marks the end of the token list.
      -
      static byteFUNCTION1 -
      Functions
      -
      static byteFUNCTION2 -
      Methods (functions inside a class)
      -
      static byteFUNCTION3 -
      Loop/function-like blocks (for, while, etc.)
      -
      static byteFUNCTION4 -
      Built-in Processing functions (setup, draw, mouseDragged).
      -
      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 -
      Keywords (void, int, boolean, etc.)
      -
      static byteKEYWORD2 -
      Fields [variables within a class]
      -
      static byteKEYWORD3 -
      Loop/function-like blocks (for, while, etc.)
      -
      static byteKEYWORD4 -
      Processing variables (width, height, focused, etc.)
      -
      static byteKEYWORD5 -
      Datatypes (int, boolean, etc.)
      -
      static byteKEYWORD6 -
      Keywords which can be followed by parenthesis
      -
      static byteLABEL -
      Label token id.
      -
      intlength -
      The length of this token.
      -
      static byteLITERAL1 -
      Strings in quotes
      -
      static byteLITERAL2 -
      Constants (QUARTER_PI, CORNERS, etc.)
      -
      Tokennext -
      The next token in the linked list.
      -
      static byteNULL -
      Normal text token id.
      -
      static byteOPERATOR -
      Operator token id.
      -
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      Token(int length, - byte id) -
      Creates a new token.
      -
      -
    • -
    - - -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      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
        -
        This can be used to mark a comment.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        COMMENT2

        -
        public static final byte COMMENT2
        -
        This can be used to mark a comment.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        LITERAL1

        -
        public static final byte LITERAL1
        -
        Strings in quotes
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        LITERAL2

        -
        public static final byte LITERAL2
        -
        Constants (QUARTER_PI, CORNERS, 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
        -
        Keywords (void, int, boolean, etc.)
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        KEYWORD2

        -
        public static final byte KEYWORD2
        -
        Fields [variables within a class]
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        KEYWORD3

        -
        public static final byte KEYWORD3
        -
        Loop/function-like blocks (for, while, etc.)
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        KEYWORD4

        -
        public static final byte KEYWORD4
        -
        Processing variables (width, height, focused, etc.)
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        KEYWORD5

        -
        public static final byte KEYWORD5
        -
        Datatypes (int, boolean, etc.)
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        KEYWORD6

        -
        public static final byte KEYWORD6
        -
        Keywords which can be followed by parenthesis
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - - - - - -
        -
      • -

        FUNCTION2

        -
        public static final byte FUNCTION2
        -
        Methods (functions inside a class)
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        FUNCTION3

        -
        public static final byte FUNCTION3
        -
        Loop/function-like blocks (for, while, etc.)
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        FUNCTION4

        -
        public static final byte FUNCTION4
        -
        Built-in Processing functions (setup, draw, mouseDragged).
        -
        -
        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 String toString()
        -
        Returns a string representation of this token.
        -
        -
        Overrides:
        -
        toString in class Object
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/TokenMarker.html b/build/javadoc/everything/processing/app/syntax/TokenMarker.html deleted file mode 100644 index f6f680d1d3..0000000000 --- a/build/javadoc/everything/processing/app/syntax/TokenMarker.html +++ /dev/null @@ -1,382 +0,0 @@ - - - - - -TokenMarker - - - - - - - - - - - -
-
processing.app.syntax
-

Class TokenMarker

-
-
-
    -
  • Object
  • -
  • -
      -
    • TokenMarker
    • -
    -
  • -
-
-
    -
  • -
    -
    Direct Known Subclasses:
    -
    PdeKeywords
    -
    -
    -
    -
    public abstract class TokenMarker
    -extends 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.

    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        addColoring

        -
        public abstract void addColoring(String keyword,
        -                                 String coloring)
        -
      • -
      - - - -
        -
      • -

        markTokens

        -
        public Token markTokens(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/im/CompositionTextManager.html b/build/javadoc/everything/processing/app/syntax/im/CompositionTextManager.html deleted file mode 100644 index 0a87275608..0000000000 --- a/build/javadoc/everything/processing/app/syntax/im/CompositionTextManager.html +++ /dev/null @@ -1,457 +0,0 @@ - - - - - -CompositionTextManager - - - - - - - - - - - -
-
processing.app.syntax.im
-

Class CompositionTextManager

-
-
-
    -
  • Object
  • -
  • -
      -
    • CompositionTextManager
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class CompositionTextManager
    -extends Object
    -
    This class Manage texts from input method - by begin-process-end steps. - - First, if a user start inputing via input method, - beginCompositionText is called from InputMethodSupport. - Second, the user continues from input method, processCompositionText is called - and reflect user inputs to text area. - Finally the user try to commit text, endCompositionText is called.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        COMPOSING_UNDERBAR_HEIGHT

        -
        public static final int COMPOSING_UNDERBAR_HEIGHT
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        CompositionTextManager

        -
        public CompositionTextManager(JEditTextArea textArea)
        -
        Create text manager class with a textarea.
        -
        -
        Parameters:
        -
        textArea - texarea component for PDE.
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getIsInputProcess

        -
        public boolean getIsInputProcess()
        -
        Get this text manager is whether in input process or not.
        -
      • -
      - - - -
        -
      • -

        insertFullWidthSpace

        -
        public void insertFullWidthSpace()
        -
        Insert full width space
        -
      • -
      - - - -
        -
      • -

        beginCompositionText

        -
        public void beginCompositionText(AttributedCharacterIterator text,
        -                                 int committed_count)
        -
        Called when a user begins input from input method. - This method initializes text manager.
        -
        -
        Parameters:
        -
        text - Text from InputMethodEvent.
        -
        commited_count - Numbers of committed characters in text.
        -
        -
      • -
      - - - -
        -
      • -

        processCompositionText

        -
        public void processCompositionText(AttributedCharacterIterator text,
        -                                   int committed_count)
        -
        Called when a user processing input characters and - select candidates from input method.
        -
        -
        Parameters:
        -
        text - Text from InputMethodEvent.
        -
        commited_count - Numbers of committed characters in text.
        -
        -
      • -
      - - - -
        -
      • -

        endCompositionText

        -
        public void endCompositionText(AttributedCharacterIterator text,
        -                               int committed_count)
        -
        Called when a user fixed text from input method or delete all - composition text. This method resets CompositionTextPainter.
        -
        -
        Parameters:
        -
        text - Text from InputMethodEvent.
        -
        commited_count - Numbers of committed characters in text.
        -
        -
      • -
      - - - -
        -
      • -

        getTextLocation

        -
        public Rectangle getTextLocation()
        -
      • -
      - - - - - - - -
        -
      • -

        getInsertPositionOffset

        -
        public int getInsertPositionOffset()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/im/CompositionTextPainter.html b/build/javadoc/everything/processing/app/syntax/im/CompositionTextPainter.html deleted file mode 100644 index b3f1e65b1f..0000000000 --- a/build/javadoc/everything/processing/app/syntax/im/CompositionTextPainter.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - -CompositionTextPainter - - - - - - - - - - - -
-
processing.app.syntax.im
-

Class CompositionTextPainter

-
-
-
    -
  • Object
  • -
  • -
      -
    • CompositionTextPainter
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class CompositionTextPainter
    -extends Object
    -
    Paint texts from input method. Text via input method are transmitted by - AttributedCaharacterIterator. This class helps the PDE's TextAreaPainter - to handle AttributedCaharacterIterator. - - For practical purposes, paint to textarea is done by TextLayout class. - Because TextLayout class is easy to draw composing texts. (For example, - draw underline composing texts, focus when select from candidates text.)
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        CompositionTextPainter

        -
        public CompositionTextPainter(JEditTextArea textArea)
        -
        Constructor for painter.
        -
        -
        Parameters:
        -
        textArea - textarea used by PDE.
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        hasComposedTextLayout

        -
        public boolean hasComposedTextLayout()
        -
        Check the painter has TextLayout. - If a user input via InputMethod, this result will return true.
        -
        -
        Parameters:
        -
        textarea - textarea used by PDE.
        -
        -
      • -
      - - - -
        -
      • -

        setComposedTextLayout

        -
        public void setComposedTextLayout(TextLayout composedTextLayout,
        -                                  int composedStartCaretPosition)
        -
        Set TextLayout to the painter. - TextLayout will be created and set by CompositionTextManager.
        -
        -
        Parameters:
        -
        textarea - textarea used by PDE.
        -
        See Also:
        -
        CompositionTextManager
        -
        -
      • -
      - - - -
        -
      • -

        invalidateComposedTextLayout

        -
        public void invalidateComposedTextLayout(int composedEndCaretPosition)
        -
        Invalidate this TextLayout to set null. - If a user end input via InputMethod, this method will called from CompositionTextManager.endCompositionText
        -
      • -
      - - - -
        -
      • -

        draw

        -
        public void draw(Graphics gfx,
        -                 Color fillBackGroundColor)
        -
        Draw text via input method with composed text information. - This method can draw texts with some underlines to illustrate converting characters. - - This method is workaround for TextAreaPainter. - Because, TextAreaPainter can't treat AttributedCharacterIterator directly. - AttributedCharacterIterator has very important information when composing text. - It has a map where are converted characters and committed characters. - Ideally, changing TextAreaPainter method can treat AttributedCharacterIterator is better. But it's very tough!! - So I choose to write some code as a workaround. - - This draw method is proceeded with the following steps. - 1. Original TextAreaPainter draws characters. - 2. This refillComposedArea method erase previous paint characters by textarea's background color. - The refill area is only square that width and height defined by characters with input method. - 3. CompositionTextPainter.draw method paints composed text. It was actually drawn by TextLayout.
        -
        -
        Parameters:
        -
        gfx - set TextAreaPainter's Graphics object.
        -
        fillBackGroundColor - set textarea's background.
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/im/InputMethodSupport.html b/build/javadoc/everything/processing/app/syntax/im/InputMethodSupport.html deleted file mode 100644 index acd7fb02d3..0000000000 --- a/build/javadoc/everything/processing/app/syntax/im/InputMethodSupport.html +++ /dev/null @@ -1,433 +0,0 @@ - - - - - -InputMethodSupport - - - - - - - - - - - -
-
processing.app.syntax.im
-

Class InputMethodSupport

-
-
-
    -
  • Object
  • -
  • -
      -
    • InputMethodSupport
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    InputMethodListener, InputMethodRequests, EventListener
    -
    -
    -
    -
    public class InputMethodSupport
    -extends Object
    -implements InputMethodRequests, InputMethodListener
    -
    Support in-line Japanese input for PDE. (Maybe Chinese, Korean and more) - This class is implemented by Java Input Method Framework and handles - If you would like to know more about Java Input Method Framework, - Please see http://java.sun.com/j2se/1.5.0/docs/guide/imf/ - - This class is implemented to fix Bug #854. - http://dev.processing.org/bugs/show_bug.cgi?id=854
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/im/package-frame.html b/build/javadoc/everything/processing/app/syntax/im/package-frame.html deleted file mode 100644 index acaf8d1324..0000000000 --- a/build/javadoc/everything/processing/app/syntax/im/package-frame.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - -processing.app.syntax.im - - - - -

processing.app.syntax.im

- - - diff --git a/build/javadoc/everything/processing/app/syntax/im/package-summary.html b/build/javadoc/everything/processing/app/syntax/im/package-summary.html deleted file mode 100644 index 55e77dbb7c..0000000000 --- a/build/javadoc/everything/processing/app/syntax/im/package-summary.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - -processing.app.syntax.im - - - - - - - - - - -
-

Package processing.app.syntax.im

-
-
- -
- - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/im/package-tree.html b/build/javadoc/everything/processing/app/syntax/im/package-tree.html deleted file mode 100644 index b2e76fc9c4..0000000000 --- a/build/javadoc/everything/processing/app/syntax/im/package-tree.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - -processing.app.syntax.im Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.app.syntax.im

-Package Hierarchies: - -
- - - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/package-frame.html b/build/javadoc/everything/processing/app/syntax/package-frame.html deleted file mode 100644 index 4909e8673c..0000000000 --- a/build/javadoc/everything/processing/app/syntax/package-frame.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - -processing.app.syntax - - - - -

processing.app.syntax

- - - diff --git a/build/javadoc/everything/processing/app/syntax/package-summary.html b/build/javadoc/everything/processing/app/syntax/package-summary.html deleted file mode 100644 index 847ba0932c..0000000000 --- a/build/javadoc/everything/processing/app/syntax/package-summary.html +++ /dev/null @@ -1,363 +0,0 @@ - - - - - -processing.app.syntax - - - - - - - - - - -
-

Package processing.app.syntax

-
-
- -
- - - - - - diff --git a/build/javadoc/everything/processing/app/syntax/package-tree.html b/build/javadoc/everything/processing/app/syntax/package-tree.html deleted file mode 100644 index 0966c7dd9a..0000000000 --- a/build/javadoc/everything/processing/app/syntax/package-tree.html +++ /dev/null @@ -1,217 +0,0 @@ - - - - - -processing.app.syntax Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.app.syntax

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Interface Hierarchy

- -
- - - - - - diff --git a/build/javadoc/everything/processing/app/tools/Archiver.html b/build/javadoc/everything/processing/app/tools/Archiver.html deleted file mode 100644 index 5a45f4a884..0000000000 --- a/build/javadoc/everything/processing/app/tools/Archiver.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - -Archiver - - - - - - - - - - - -
-
processing.app.tools
-

Class Archiver

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Runnable, Tool
    -
    -
    -
    -
    public class Archiver
    -extends Object
    -implements Tool
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/tools/ColorSelector.html b/build/javadoc/everything/processing/app/tools/ColorSelector.html deleted file mode 100644 index 9edea7ff64..0000000000 --- a/build/javadoc/everything/processing/app/tools/ColorSelector.html +++ /dev/null @@ -1,319 +0,0 @@ - - - - - -ColorSelector - - - - - - - - - - - -
-
processing.app.tools
-

Class ColorSelector

-
-
-
    -
  • Object
  • -
  • -
      -
    • ColorSelector
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Runnable, Tool
    -
    -
    -
    -
    public class ColorSelector
    -extends Object
    -implements Tool
    -
    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).

    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ColorSelector

        -
        public ColorSelector()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        init

        -
        public void init(Editor editor)
        -
        -
        Specified by:
        -
        init in interface Tool
        -
        -
      • -
      - - - -
        -
      • -

        run

        -
        public void run()
        -
        -
        Specified by:
        -
        run in interface Runnable
        -
        Specified by:
        -
        run in interface Tool
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/tools/CreateFont.html b/build/javadoc/everything/processing/app/tools/CreateFont.html deleted file mode 100644 index 93f8adfa13..0000000000 --- a/build/javadoc/everything/processing/app/tools/CreateFont.html +++ /dev/null @@ -1,476 +0,0 @@ - - - - - -CreateFont - - - - - - - - - - - -
-
processing.app.tools
-

Class CreateFont

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        CreateFont

        -
        public CreateFont()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        init

        -
        public void init(Editor editor)
        -
        -
        Specified by:
        -
        init in interface Tool
        -
        -
      • -
      - - - -
        -
      • -

        run

        -
        public void run()
        -
        -
        Specified by:
        -
        run in interface Runnable
        -
        Specified by:
        -
        run in interface Tool
        -
        -
      • -
      - - - -
        -
      • -

        update

        -
        public void update()
        -
      • -
      - - - -
        -
      • -

        build

        -
        public void build()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/tools/InstallCommander.html b/build/javadoc/everything/processing/app/tools/InstallCommander.html deleted file mode 100644 index ed84dbc492..0000000000 --- a/build/javadoc/everything/processing/app/tools/InstallCommander.html +++ /dev/null @@ -1,313 +0,0 @@ - - - - - -InstallCommander - - - - - - - - - - - -
-
processing.app.tools
-

Class InstallCommander

-
-
-
    -
  • Object
  • -
  • -
      -
    • InstallCommander
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Runnable, Tool
    -
    -
    -
    -
    public class InstallCommander
    -extends Object
    -implements Tool
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        InstallCommander

        -
        public InstallCommander()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        init

        -
        public void init(Editor editor)
        -
        -
        Specified by:
        -
        init in interface Tool
        -
        -
      • -
      - - - -
        -
      • -

        run

        -
        public void run()
        -
        -
        Specified by:
        -
        run in interface 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 deleted file mode 100644 index 83ad12f2ba..0000000000 --- a/build/javadoc/everything/processing/app/tools/Tool.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - -Tool - - - - - - - - - - - -
-
processing.app.tools
-

Interface Tool

-
-
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        init

        -
        void init(Editor editor)
        -
      • -
      - - - -
        -
      • -

        run

        -
        void run()
        -
        -
        Specified by:
        -
        run in interface Runnable
        -
        -
      • -
      - - - -
        -
      • -

        getMenuTitle

        -
        String getMenuTitle()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/app/tools/package-frame.html b/build/javadoc/everything/processing/app/tools/package-frame.html deleted file mode 100644 index fc5fa9f133..0000000000 --- a/build/javadoc/everything/processing/app/tools/package-frame.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - -processing.app.tools - - - - -

processing.app.tools

-
-

Interfaces

- -

Classes

- -
- - diff --git a/build/javadoc/everything/processing/app/tools/package-summary.html b/build/javadoc/everything/processing/app/tools/package-summary.html deleted file mode 100644 index 5597380cfb..0000000000 --- a/build/javadoc/everything/processing/app/tools/package-summary.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - - -processing.app.tools - - - - - - - - - - -
-

Package processing.app.tools

-
-
-
    -
  • - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    Tool -
    Interface for items to be shown in the Tools menu.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    Archiver 
    ColorSelector -
    Color selector tool for the Tools menu.
    -
    CreateFont -
    GUI tool for font creation heaven/hell.
    -
    InstallCommander 
    -
  • -
-
- - - - - - diff --git a/build/javadoc/everything/processing/app/tools/package-tree.html b/build/javadoc/everything/processing/app/tools/package-tree.html deleted file mode 100644 index 416dad8ee3..0000000000 --- a/build/javadoc/everything/processing/app/tools/package-tree.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - -processing.app.tools Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.app.tools

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Interface Hierarchy

- -
- - - - - - diff --git a/build/javadoc/everything/processing/core/PApplet.html b/build/javadoc/everything/processing/core/PApplet.html deleted file mode 100644 index aeb91e8c61..0000000000 --- a/build/javadoc/everything/processing/core/PApplet.html +++ /dev/null @@ -1,19001 +0,0 @@ - - - - - -PApplet - - - - - - - - - - - -
-
processing.core
-

Class PApplet

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    -
    public class PApplet
    -extends Object
    -implements PConstants
    -
    Base class for all sketches that use processing.core. -

    - The - Window Size and Full Screen page on the Wiki has useful information - about sizing, multiple displays, full screen, etc. -

    - Processing uses active mode rendering. 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(). -

    - Starting with 3.0a6, blit operations are on the EDT, so as not to cause - GUI problems with Swing and AWT. In the case of the default renderer, the - sketch renders to an offscreen image, then the EDT is asked to bring that - image to the screen. -

    - For code that needs to run on the EDT, use EventQueue.invokeLater(). When - doing so, be careful to synchronize between that code and the Processing - animation thread. That is, you can't call Processing methods from the EDT - or at any random time from another 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 Processing 3.0, we have removed Applet as the base class for PApplet. - This means that we can remove lots of legacy code, however one downside is - that it's no longer possible (without extra code) to embed a PApplet into - another Java application. -

    - As of Processing 3.0, we have discontinued support for versions of Java - prior to 1.8. We don't have enough people to support it, and for a - project of our (tiny) size, we should be focusing on the future, rather - than working around legacy Java code.

    -
  • -
-
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      PApplet() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and TypeMethod and Description
      static floatabs(float n) -
      ( begin auto-generated from abs.xml ) - - Calculates the absolute value (magnitude) of a number.
      -
      static intabs(int n) 
      static floatacos(float value) -
      ( begin auto-generated from acos.xml ) - - The inverse of cos(), returns the arc cosine of a value.
      -
      floatalpha(int rgb) -
      ( begin auto-generated from alpha.xml ) - - Extracts the alpha value from a color.
      -
      voidambient(float gray) 
      voidambient(float v1, - float v2, - float v3) 
      voidambient(int rgb) -
      ( begin auto-generated from ambient.xml ) - - Sets the ambient reflectance for shapes drawn to the screen.
      -
      voidambientLight(float v1, - float v2, - float v3) -
      ( begin auto-generated from ambientLight.xml ) - - Adds an ambient light.
      -
      voidambientLight(float v1, - float v2, - float v3, - float x, - float y, - float z) 
      static byte[]append(byte[] array, - byte value) -
      ( begin auto-generated from append.xml ) - - Expands an array by one element and adds data to the new position.
      -
      static char[]append(char[] array, - char value) 
      static float[]append(float[] array, - float value) 
      static int[]append(int[] array, - int value) 
      static Objectappend(Object array, - Object value) 
      static String[]append(String[] array, - 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) -
      ( begin auto-generated from applyMatrix.xml ) - - Multiplies the current matrix by the one specified through the - parameters.
      -
      voidapplyMatrix(PMatrix2D source) 
      voidapplyMatrix(PMatrix3D source) 
      voidarc(float a, - float b, - float c, - float d, - float start, - float stop) -
      ( begin auto-generated from arc.xml ) - - Draws an arc in the display window.
      -
      voidarc(float a, - float b, - float c, - float d, - float start, - float stop, - int mode) 
      static voidarraycopy(Object src, - int srcPosition, - Object dst, - int dstPosition, - int length) -
      Deprecated.  -
      Use arrayCopy() instead.
      -
      -
      static voidarrayCopy(Object src, - int srcPosition, - Object dst, - int dstPosition, - int length) -
      ( begin auto-generated from arrayCopy.xml ) - - Copies an array (or part of an array) to another array.
      -
      static voidarraycopy(Object src, - Object dst) -
      Deprecated.  -
      Use arrayCopy() instead.
      -
      -
      static voidarrayCopy(Object src, - Object dst) -
      Shortcut to copy the entire contents of - the source into the destination array.
      -
      static voidarraycopy(Object src, - Object dst, - int length) -
      Deprecated.  -
      Use arrayCopy() instead.
      -
      -
      static voidarrayCopy(Object src, - Object dst, - int length) -
      Convenience method for arraycopy().
      -
      static floatasin(float value) -
      ( begin auto-generated from asin.xml ) - - The inverse of sin(), returns the arc sine of a value.
      -
      static floatatan(float value) -
      ( begin auto-generated from atan.xml ) - - The inverse of tan(), returns the arc tangent of a value.
      -
      static floatatan2(float y, - float x) -
      ( begin auto-generated from atan2.xml ) - - Calculates the angle (in radians) from a specified point to the - coordinate origin as measured from the positive x-axis.
      -
      voidattrib(String name, - boolean... values) 
      voidattrib(String name, - float... values) 
      voidattrib(String name, - int... values) 
      voidbackground(float gray) 
      voidbackground(float gray, - float alpha) 
      voidbackground(float v1, - float v2, - float v3) 
      voidbackground(float v1, - float v2, - float v3, - float alpha) 
      voidbackground(int rgb) -
      ( begin auto-generated from background.xml ) - - The background() function sets the color used for the background - of the Processing window.
      -
      voidbackground(int rgb, - float alpha) 
      voidbackground(PImage image) -
      Takes an RGB or ARGB image and sets it as the background.
      -
      voidbeginCamera() -
      ( begin auto-generated from beginCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
      -
      voidbeginContour() 
      PGLbeginPGL() 
      voidbeginRaw(PGraphics rawGraphics) 
      PGraphicsbeginRaw(String renderer, - String filename) -
      ( begin auto-generated from beginRaw.xml ) - - To create vectors from 3D data, use the beginRaw() and - endRaw() commands.
      -
      voidbeginRecord(PGraphics recorder) 
      PGraphicsbeginRecord(String renderer, - String filename) -
      ( begin auto-generated from beginRecord.xml ) - - Opens a new file and all subsequent drawing functions are echoed to this - file as well as the display window.
      -
      voidbeginShape() -
      Start a new shape of type POLYGON
      -
      voidbeginShape(int kind) -
      ( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms.
      -
      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) -
      ( begin auto-generated from bezier.xml ) - - Draws a Bezier curve on the screen.
      -
      voidbezierDetail(int detail) -
      ( begin auto-generated from bezierDetail.xml ) - - Sets the resolution at which Beziers display.
      -
      floatbezierPoint(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from bezierPoint.xml ) - - Evaluates the Bezier at point t for points a, b, c, d.
      -
      floatbezierTangent(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from bezierTangent.xml ) - - Calculates the tangent of a point on a 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) -
      ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves.
      -
      static Stringbinary(byte value) -
      Returns a String that contains the binary value of a byte.
      -
      static Stringbinary(char value) -
      Returns a String that contains the binary value of a char.
      -
      static Stringbinary(int value) -
      Returns a String that contains the binary value of an int.
      -
      static Stringbinary(int value, - int digits) -
      ( begin auto-generated from binary.xml ) - - Converts a byte, char, int, or color to a String containing the - equivalent binary notation.
      -
      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) -
      ( begin auto-generated from PImage_blend.xml ) - - Blends a region of pixels into the image specified by the img - parameter.
      -
      static intblendColor(int c1, - int c2, - int mode) 
      voidblendMode(int mode) -
      ( begin auto-generated from blendMode.xml ) - - This is a new reference entry for Processing 2.0.
      -
      floatblue(int rgb) -
      ( begin auto-generated from blue.xml ) - - Extracts the blue value from a color, scaled to match current - colorMode().
      -
      voidbox(float size) -
      ( begin auto-generated from box.xml ) - - A box is an extruded rectangle.
      -
      voidbox(float w, - float h, - float d) 
      floatbrightness(int rgb) -
      ( begin auto-generated from brightness.xml ) - - Extracts the brightness value from a color.
      -
      voidcamera() -
      ( begin auto-generated from camera.xml ) - - Sets the position of the camera through setting the eye position, the - center of the scene, and which axis is facing upward.
      -
      voidcamera(float eyeX, - float eyeY, - float eyeZ, - float centerX, - float centerY, - float centerZ, - float upX, - float upY, - float upZ) 
      booleancanDraw() -
      Not official API, not guaranteed to work in the future.
      -
      static intceil(float n) -
      ( begin auto-generated from ceil.xml ) - - Calculates the closest int value that is greater than or equal to the - value of the parameter.
      -
      static StringcheckExtension(String filename) -
      Get the compression-free extension for this filename.
      -
      voidclear() 
      voidclip(float a, - float b, - float c, - float d) 
      intcolor(float fgray) 
      intcolor(float fgray, - float falpha) 
      intcolor(float v1, - float v2, - float v3) 
      intcolor(float v1, - float v2, - float v3, - float alpha) 
      intcolor(int gray) -
      ( begin auto-generated from color.xml ) - - Creates colors for storing in variables of the color datatype.
      -
      intcolor(int gray, - int alpha) -
      As of 0116 this also takes color(#FF8800, alpha)
      -
      intcolor(int v1, - int v2, - int v3) 
      intcolor(int v1, - int v2, - int v3, - int alpha) 
      voidcolorMode(int mode) -
      ( begin auto-generated from colorMode.xml ) - - Changes the way Processing interprets color data.
      -
      voidcolorMode(int mode, - float max) 
      voidcolorMode(int mode, - float max1, - float max2, - float max3) 
      voidcolorMode(int mode, - float max1, - float max2, - float max3, - float maxA) 
      static boolean[]concat(boolean[] a, - boolean[] b) -
      ( begin auto-generated from concat.xml ) - - Concatenates two arrays.
      -
      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 Objectconcat(Object a, - Object b) 
      static String[]concat(String[] a, - String[] b) 
      static floatconstrain(float amt, - float low, - float high) -
      ( begin auto-generated from constrain.xml ) - - Constrains a value to not exceed a maximum and minimum value.
      -
      static intconstrain(int amt, - int low, - int high) 
      PImagecopy() 
      voidcopy(int sx, - int sy, - int sw, - int sh, - int dx, - int dy, - int dw, - int dh) -
      ( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another.
      -
      voidcopy(PImage src, - int sx, - int sy, - int sw, - int sh, - int dx, - int dy, - int dw, - int dh) 
      static floatcos(float angle) -
      ( begin auto-generated from cos.xml ) - - Calculates the cosine of an angle.
      -
      PFontcreateFont(String name, - float size) 
      PFontcreateFont(String name, - float size, - boolean smooth) 
      PFontcreateFont(String name, - float size, - boolean smooth, - char[] charset) -
      ( begin auto-generated from createFont.xml ) - - Dynamically converts a font to the format used by Processing from either - a font name that's installed on the computer, or from a .ttf or .otf - file inside the sketches "data" folder.
      -
      PGraphicscreateGraphics(int w, - int h) 
      PGraphicscreateGraphics(int w, - int h, - String renderer) -
      ( begin auto-generated from createGraphics.xml ) - - Creates and returns a new PGraphics object of the types P2D or - P3D.
      -
      PGraphicscreateGraphics(int w, - int h, - String renderer, - String path) -
      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 w, - int h, - int format) -
      ( begin auto-generated from createImage.xml ) - - Creates a new PImage (the datatype for storing images).
      -
      static InputStreamcreateInput(File file) 
      InputStreamcreateInput(String filename) -
      ( begin auto-generated from createInput.xml ) - - This is a function for advanced programmers to open a Java InputStream.
      -
      InputStreamcreateInputRaw(String filename) -
      Call openStream() without automatic gzip decompression.
      -
      static OutputStreamcreateOutput(File file) 
      OutputStreamcreateOutput(String filename) -
      ( begin auto-generated from createOutput.xml ) - - Similar to createInput(), this creates a Java OutputStream - for a given filename or path.
      -
      static voidcreatePath(File file) 
      static voidcreatePath(String path) -
      Takes a path and creates any in-between folders if they don't - already exist.
      -
      static BufferedReadercreateReader(File file) 
      static BufferedReadercreateReader(InputStream input) 
      BufferedReadercreateReader(String filename) -
      ( begin auto-generated from createReader.xml ) - - Creates a BufferedReader object that can be used to read files - line-by-line as individual String objects.
      -
      PShapecreateShape() 
      PShapecreateShape(int type) 
      PShapecreateShape(int kind, - float... p) 
      static PrintWritercreateWriter(File file) 
      static PrintWritercreateWriter(OutputStream output) 
      PrintWritercreateWriter(String filename) -
      ( begin auto-generated from createWriter.xml ) - - Creates a new file in the sketch folder, and a PrintWriter object - to write to it.
      -
      voidcursor() -
      Show the cursor after noCursor() was called.
      -
      voidcursor(int kind) -
      Set the cursor type
      -
      voidcursor(PImage img) -
      Replace the cursor with the specified PImage.
      -
      voidcursor(PImage img, - int x, - int y) -
      ( begin auto-generated from cursor.xml ) - - Sets the cursor to a predefined symbol, an image, or makes it visible if - already hidden.
      -
      voidcurve(float x1, - float y1, - float x2, - float y2, - float x3, - float y3, - float x4, - float y4) -
      ( begin auto-generated from curve.xml ) - - Draws a curved line on the screen.
      -
      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) -
      ( begin auto-generated from curveDetail.xml ) - - Sets the resolution at which curves display.
      -
      floatcurvePoint(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from curvePoint.xml ) - - Evalutes the curve at point t for points a, b, c, d.
      -
      floatcurveTangent(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from curveTangent.xml ) - - Calculates the tangent of a point on a curve.
      -
      voidcurveTightness(float tightness) -
      ( begin auto-generated from curveTightness.xml ) - - Modifies the quality of forms created with curve() and - curveVertex().
      -
      voidcurveVertex(float x, - float y) -
      ( begin auto-generated from curveVertex.xml ) - - Specifies vertex coordinates for curves.
      -
      voidcurveVertex(float x, - float y, - float z) 
      FiledataFile(String where) -
      Return a full path to an item in the data folder as a File object.
      -
      StringdataPath(String where) -
      Return a full path to an item in the data folder.
      -
      static intday() -
      ( begin auto-generated from day.xml ) - - Processing communicates with the clock on your computer.
      -
      static voiddebug(String msg) 
      static floatdegrees(float radians) -
      ( begin auto-generated from degrees.xml ) - - Converts a radian measurement to its corresponding value in degrees.
      -
      voiddelay(int napTime) -
      The delay() function causes the program to halt for a specified time.
      -
      static FiledesktopFile(String what) -
      Not a supported function.
      -
      static StringdesktopPath(String what) -
      Not a supported function.
      -
      voiddie(String what) -
      Function for an applet/application to kill itself and - display an error.
      -
      voiddie(String what, - Exception e) -
      Same as above but with an exception.
      -
      voiddirectionalLight(float v1, - float v2, - float v3, - float nx, - float ny, - float nz) -
      ( begin auto-generated from directionalLight.xml ) - - Adds a directional light.
      -
      intdisplayDensity() 
      static intdisplayDensity(int display) 
      voiddispose() -
      Called to dispose of resources and shut down the sketch.
      -
      static floatdist(float x1, - float y1, - float x2, - float y2) 
      static floatdist(float x1, - float y1, - float z1, - float x2, - float y2, - float z2) -
      ( begin auto-generated from dist.xml ) - - Calculates the distance between two points.
      -
      voiddraw() -
      ( begin auto-generated from draw.xml ) - - Called directly after setup() and continuously executes the lines - of code contained inside its block until the program is stopped or - noLoop() is called.
      -
      voidedge(boolean edge) -
      Sets whether the upcoming vertex is part of an edge.
      -
      voidellipse(float a, - float b, - float c, - float d) -
      ( begin auto-generated from ellipse.xml ) - - Draws an ellipse (oval) in the display window.
      -
      voidellipseMode(int mode) -
      ( begin auto-generated from ellipseMode.xml ) - - The origin of the ellipse is modified by the ellipseMode() - function.
      -
      voidemissive(float gray) -
      gray number specifying value between white and black
      -
      voidemissive(float v1, - float v2, - float v3) 
      voidemissive(int rgb) -
      ( begin auto-generated from emissive.xml ) - - Sets the emissive color of the material used for drawing shapes drawn to - the screen.
      -
      voidendCamera() -
      ( begin auto-generated from endCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
      -
      voidendContour() 
      voidendPGL() 
      voidendRaw() -
      ( begin auto-generated from endRaw.xml ) - - Complement to beginRaw(); they must always be used together.
      -
      voidendRecord() -
      ( begin auto-generated from endRecord.xml ) - - Stops the recording process started by beginRecord() and closes - the file.
      -
      voidendShape() 
      voidendShape(int mode) -
      ( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape().
      -
      static Processexec(String... args) 
      voidexit() -
      ( begin auto-generated from exit.xml ) - - Quits/stops/exits the program.
      -
      voidexitActual() -
      Some subclasses (I'm looking at you, processing.py) might wish to do something - other than actually terminate the JVM.
      -
      booleanexitCalled() 
      static floatexp(float n) -
      ( begin auto-generated from exp.xml ) - - Returns Euler's number e (2.71828...) raised to the power of the - value parameter.
      -
      static boolean[]expand(boolean[] list) -
      ( begin auto-generated from expand.xml ) - - Increases the size of an array.
      -
      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 double[]expand(double[] list) 
      static double[]expand(double[] 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 long[]expand(long[] list) 
      static long[]expand(long[] list, - int newSize) 
      static Objectexpand(Object array) 
      static Objectexpand(Object list, - int newSize) 
      static String[]expand(String[] list) 
      static String[]expand(String[] list, - int newSize) 
      voidfill(float gray) 
      voidfill(float gray, - float alpha) 
      voidfill(float v1, - float v2, - float v3) 
      voidfill(float v1, - float v2, - float v3, - float alpha) 
      voidfill(int rgb) -
      ( begin auto-generated from fill.xml ) - - Sets the color used to fill shapes.
      -
      voidfill(int rgb, - float alpha) 
      voidfilter(int kind) 
      voidfilter(int kind, - float param) -
      ( begin auto-generated from PImage_filter.xml ) - - Filters an image as defined by one of the following modes:

      THRESHOLD - converts the image to black and white pixels depending if - they are above or below the threshold defined by the level parameter.
      -
      voidfilter(PShader shader) 
      static intfloor(float n) -
      ( begin auto-generated from floor.xml ) - - Calculates the closest int value that is less than or equal to the value - of the parameter.
      -
      voidflush() 
      voidfocusGained() 
      voidfocusLost() 
      voidframeRate(float fps) -
      ( begin auto-generated from frameRate.xml ) - - Specifies the number of frames to be displayed every second.
      -
      voidfrustum(float left, - float right, - float bottom, - float top, - float near, - float far) -
      ( begin auto-generated from frustum.xml ) - - Sets a perspective matrix defined through the parameters.
      -
      voidfullScreen() -
      Create a full-screen sketch using the default renderer.
      -
      voidfullScreen(int display) 
      voidfullScreen(String renderer) -
      ( begin auto-generated from fullScreen.xml ) - - Description to come...
      -
      voidfullScreen(String renderer, - int display) 
      PImageget() -
      Returns a copy of this PImage.
      -
      intget(int x, - int y) -
      ( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image.
      -
      PImageget(int x, - int y, - int w, - int h) 
      static StringgetExtension(String filename) 
      FramegetFrame() 
      PGraphicsgetGraphics() 
      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.
      -
      floatgreen(int rgb) -
      ( begin auto-generated from green.xml ) - - Extracts the green value from a color, scaled to match current - colorMode().
      -
      voidhandleDraw() 
      static Stringhex(byte value) -
      ( begin auto-generated from hex.xml ) - - Converts a byte, char, int, or color to a String containing the - equivalent hexadecimal notation.
      -
      static Stringhex(char value) 
      static Stringhex(int value) 
      static Stringhex(int value, - int digits) 
      static voidhideMenuBar() -
      Convenience method, should only be called by PSurface subclasses.
      -
      voidhint(int which) 
      static inthour() -
      ( begin auto-generated from hour.xml ) - - Processing communicates with the clock on your computer.
      -
      floathue(int rgb) -
      ( begin auto-generated from hue.xml ) - - Extracts the hue value from a color.
      -
      voidimage(PImage img, - float a, - float b) -
      ( begin auto-generated from image.xml ) - - Displays images to the screen.
      -
      voidimage(PImage img, - float a, - float b, - float c, - float d) 
      voidimage(PImage img, - 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) -
      ( begin auto-generated from imageMode.xml ) - - Modifies the location from which images draw.
      -
      voidinit() -
      Applet initialization.
      -
      StringinsertFrame(String what) -
      Check a string for #### signs to see if the frame number should be - inserted.
      -
      static Stringjoin(String[] list, - char separator) -
      ( begin auto-generated from join.xml ) - - Combines an array of Strings into one String, each separated by the - character(s) used for the separator parameter.
      -
      static Stringjoin(String[] list, - String separator) 
      voidkeyPressed() -
      ( begin auto-generated from keyPressed.xml ) - - The keyPressed() function is called once every time a key is - pressed.
      -
      voidkeyPressed(KeyEvent event) 
      voidkeyReleased() -
      ( begin auto-generated from keyReleased.xml ) - - The keyReleased() function is called once every time a key is - released.
      -
      voidkeyReleased(KeyEvent event) 
      voidkeyTyped() -
      ( begin auto-generated from keyTyped.xml ) - - The keyTyped() function is called once every time a key is - pressed, but action keys such as Ctrl, Shift, and Alt are ignored.
      -
      voidkeyTyped(KeyEvent event) 
      static Processlaunch(String... args) -
      Launch a process using the platform's shell.
      -
      static voidlaunch(String filename) -
      ( begin auto-generated from launch.xml ) - - Attempts to open an application or file using your platform's launcher.
      -
      static floatlerp(float start, - float stop, - float amt) -
      ( begin auto-generated from lerp.xml ) - - Calculates a number between two numbers at a specific increment.
      -
      intlerpColor(int c1, - int c2, - float amt) -
      ( begin auto-generated from lerpColor.xml ) - - Calculates a color or colors between two color at a specific increment.
      -
      static intlerpColor(int c1, - int c2, - float amt, - int mode) 
      voidlightFalloff(float constant, - float linear, - float quadratic) -
      ( begin auto-generated from lightFalloff.xml ) - - Sets the falloff rates for point lights, spot lights, and ambient - lights.
      -
      voidlights() -
      ( begin auto-generated from lights.xml ) - - Sets the default ambient light, directional light, falloff, and specular - values.
      -
      voidlightSpecular(float v1, - float v2, - float v3) -
      ( begin auto-generated from lightSpecular.xml ) - - Sets the specular color for lights.
      -
      voidline(float x1, - float y1, - float x2, - float y2) -
      ( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen.
      -
      voidline(float x1, - float y1, - float z1, - float x2, - float y2, - float z2) 
      voidlink(String url) -
      Links to a webpage either in the same window or in a new window.
      -
      static byte[]loadBytes(File file) 
      static byte[]loadBytes(InputStream input) 
      byte[]loadBytes(String filename) -
      ( begin auto-generated from loadBytes.xml ) - - Reads the contents of a file or url and places it in a byte array.
      -
      PFontloadFont(String filename) -
      ( begin auto-generated from loadFont.xml ) - - Loads a font into a variable of type PFont.
      -
      PImageloadImage(String filename) -
      ( begin auto-generated from loadImage.xml ) - - Loads an image into a variable of type PImage.
      -
      PImageloadImage(String filename, - String extension) 
      static JSONArrayloadJSONArray(File file) 
      JSONArrayloadJSONArray(String filename) 
      static JSONObjectloadJSONObject(File file) 
      JSONObjectloadJSONObject(String filename) 
      voidloadPixels() -
      ( begin auto-generated from loadPixels.xml ) - - Loads the pixel data for the display window into the pixels[] - array.
      -
      PShaderloadShader(String fragFilename) -
      ( begin auto-generated from loadShader.xml ) - - This is a new reference entry for Processing 2.0.
      -
      PShaderloadShader(String fragFilename, - String vertFilename) 
      PShapeloadShape(String filename) 
      PShapeloadShape(String filename, - String options) 
      static String[]loadStrings(BufferedReader reader) 
      static String[]loadStrings(File file) 
      static String[]loadStrings(InputStream input) 
      String[]loadStrings(String filename) -
      ( begin auto-generated from loadStrings.xml ) - - Reads the contents of a file or url and creates a String array of its - individual lines.
      -
      TableloadTable(String filename) 
      TableloadTable(String filename, - String options) -
      Options may contain "header", "tsv", "csv", or "bin" separated by commas.
      -
      XMLloadXML(String filename) 
      XMLloadXML(String filename, - String options) 
      static floatlog(float n) -
      ( begin auto-generated from log.xml ) - - Calculates the natural logarithm (the base-e logarithm) of a - number.
      -
      voidloop() -
      ( begin auto-generated from loop.xml ) - - Causes Processing to continuously execute the code within draw().
      -
      static floatmag(float a, - float b) 
      static floatmag(float a, - float b, - float c) -
      ( begin auto-generated from mag.xml ) - - Calculates the magnitude (or length) of a vector.
      -
      static voidmain(String mainClass) -
      Convenience method so that PApplet.main("YourSketch") launches a sketch, - rather than having to wrap it into a single element String array.
      -
      static voidmain(String[] args) -
      main() method for running this class from the command line.
      -
      static voidmain(String mainClass, - String[] sketchArgs) -
      Convenience method so that PApplet.main("YourSketch", args) launches a - sketch, rather than having to wrap it into a String array, and appending - the 'args' array when not null.
      -
      static floatmap(float value, - float start1, - float stop1, - float start2, - float stop2) -
      ( begin auto-generated from map.xml ) - - Re-maps a number from one range to another.
      -
      voidmask(PImage img) -
      ( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel.
      -
      static String[]match(String str, - String regexp) -
      ( begin auto-generated from match.xml ) - - The match() function is used to apply a regular expression to a piece of - text, and return matching groups (elements found inside parentheses) as - a String array.
      -
      static String[][]matchAll(String str, - String regexp) -
      ( begin auto-generated from matchAll.xml ) - - This function is used to apply a regular expression to a piece of text, - and return a list of matching groups (elements found inside parentheses) - as a two-dimensional String array.
      -
      static floatmax(float[] list) 
      static floatmax(float a, - float b) 
      static floatmax(float a, - float b, - float c) 
      static intmax(int[] list) 
      static intmax(int a, - int b) -
      ( begin auto-generated from max.xml ) - - Determines the largest value in a sequence of numbers.
      -
      static intmax(int a, - int b, - int c) 
      voidmethod(String name) -
      Call a method in the current class based on its name.
      -
      intmillis() -
      ( begin auto-generated from millis.xml ) - - Returns the number of milliseconds (thousandths of a second) since - starting an applet.
      -
      static floatmin(float[] list) 
      static floatmin(float a, - float b) 
      static floatmin(float a, - float b, - float c) -
      ( begin auto-generated from min.xml ) - - Determines the smallest value in a sequence of numbers.
      -
      static intmin(int[] list) 
      static intmin(int a, - int b) -
      Find the maximum value in an array.
      -
      static intmin(int a, - int b, - int c) 
      static intminute() -
      ( begin auto-generated from minute.xml ) - - Processing communicates with the clock on your computer.
      -
      floatmodelX(float x, - float y, - float z) -
      ( begin auto-generated from modelX.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
      -
      floatmodelY(float x, - float y, - float z) -
      ( begin auto-generated from modelY.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
      -
      floatmodelZ(float x, - float y, - float z) -
      ( begin auto-generated from modelZ.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
      -
      static intmonth() -
      ( begin auto-generated from month.xml ) - - Processing communicates with the clock on your computer.
      -
      voidmouseClicked() -
      ( begin auto-generated from mouseClicked.xml ) - - The mouseClicked() function is called once after a mouse button - has been pressed and then released.
      -
      voidmouseClicked(MouseEvent event) 
      voidmouseDragged() -
      ( begin auto-generated from mouseDragged.xml ) - - The mouseDragged() function is called once every time the mouse - moves and a mouse button is pressed.
      -
      voidmouseDragged(MouseEvent event) 
      voidmouseEntered() 
      voidmouseEntered(MouseEvent event) 
      voidmouseExited() 
      voidmouseExited(MouseEvent event) 
      voidmouseMoved() -
      ( begin auto-generated from mouseMoved.xml ) - - The mouseMoved() function is called every time the mouse moves - and a mouse button is not pressed.
      -
      voidmouseMoved(MouseEvent event) 
      voidmousePressed() -
      ( begin auto-generated from mousePressed.xml ) - - The mousePressed() function is called once after every time a - mouse button is pressed.
      -
      voidmousePressed(MouseEvent event) 
      voidmouseReleased() -
      ( begin auto-generated from mouseReleased.xml ) - - The mouseReleased() function is called every time a mouse button - is released.
      -
      voidmouseReleased(MouseEvent event) 
      voidmouseWheel() 
      voidmouseWheel(MouseEvent event) -
      The event.getAmount() method returns negative values if the mouse wheel - if rotated up or away from the user and positive in the other direction.
      -
      static String[]nf(float[] num, - int left, - int right) 
      static Stringnf(float num, - int left, - int right) 
      static String[]nf(int[] num, - int digits) 
      static Stringnf(int num, - int digits) -
      ( begin auto-generated from nf.xml ) - - Utility function for formatting numbers into strings.
      -
      static String[]nfc(float[] num, - int right) 
      static Stringnfc(float num, - int right) 
      static Stringnfc(int num) -
      nfc() or "number format with commas".
      -
      static String[]nfc(int[] num) -
      ( begin auto-generated from nfc.xml ) - - Utility function for formatting numbers into strings and placing - appropriate commas to mark units of 1000.
      -
      static String[]nfp(float[] num, - int left, - int right) 
      static Stringnfp(float num, - int left, - int right) 
      static String[]nfp(int[] num, - int digits) 
      static Stringnfp(int num, - int digits) -
      ( begin auto-generated from nfp.xml ) - - Utility function for formatting numbers into strings.
      -
      static String[]nfs(float[] num, - int left, - int right) 
      static Stringnfs(float num, - int left, - int right) 
      static String[]nfs(int[] num, - int digits) 
      static Stringnfs(int num, - int digits) -
      ( begin auto-generated from nfs.xml ) - - Utility function for formatting numbers into strings.
      -
      voidnoClip() 
      voidnoCursor() -
      ( begin auto-generated from noCursor.xml ) - - Hides the cursor from view.
      -
      voidnoFill() -
      ( begin auto-generated from noFill.xml ) - - Disables filling geometry.
      -
      floatnoise(float x) 
      floatnoise(float x, - float y) 
      floatnoise(float x, - float y, - float z) -
      ( begin auto-generated from noise.xml ) - - Returns the Perlin noise value at specified coordinates.
      -
      voidnoiseDetail(int lod) -
      ( begin auto-generated from noiseDetail.xml ) - - Adjusts the character and level of detail produced by the Perlin noise - function.
      -
      voidnoiseDetail(int lod, - float falloff) 
      voidnoiseSeed(long seed) -
      ( begin auto-generated from noiseSeed.xml ) - - Sets the seed value for noise().
      -
      voidnoLights() -
      ( begin auto-generated from noLights.xml ) - - Disable all lighting.
      -
      voidnoLoop() -
      ( begin auto-generated from noLoop.xml ) - - Stops Processing from continuously executing the code within - draw().
      -
      static floatnorm(float value, - float start, - float stop) -
      ( begin auto-generated from norm.xml ) - - Normalizes a number from another range into a value between 0 and 1.
      -
      voidnormal(float nx, - float ny, - float nz) -
      ( begin auto-generated from normal.xml ) - - Sets the current normal vector.
      -
      voidnoSmooth() 
      voidnoStroke() -
      ( begin auto-generated from noStroke.xml ) - - Disables drawing the stroke (outline).
      -
      voidnoTexture() -
      Removes texture image for current shape.
      -
      voidnoTint() -
      ( begin auto-generated from noTint.xml ) - - Removes the current fill value for displaying images and reverts to - displaying images with their original hues.
      -
      voidorientation(int which) 
      voidortho() -
      ( begin auto-generated from ortho.xml ) - - Sets an orthographic projection and defines a parallel clipping volume.
      -
      voidortho(float left, - float right, - float bottom, - float top) 
      voidortho(float left, - float right, - float bottom, - float top, - float near, - float far) 
      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(String what) -
      Convert the string "true" or "false" to a boolean.
      -
      static boolean[]parseBoolean(String[] what) 
      static byteparseByte(boolean what) 
      static byte[]parseByte(boolean[] 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 float[]parseFloat(byte[] what) 
      static floatparseFloat(int what) -
      Convert an int to a float value.
      -
      static float[]parseFloat(int[] what) 
      static floatparseFloat(String what) 
      static float[]parseFloat(String[] what) 
      static float[]parseFloat(String[] what, - float missing) 
      static floatparseFloat(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(String what) -
      Parse a String into an int value.
      -
      static int[]parseInt(String[] what) -
      Make an array of int elements from an array of String objects.
      -
      static int[]parseInt(String[] what, - int missing) -
      Make an array of int elements from an array of String objects.
      -
      static intparseInt(String what, - int otherwise) -
      Parse a String to an int, and provide an alternate value that - should be used when the number is invalid.
      -
      JSONArrayparseJSONArray(String input) 
      JSONObjectparseJSONObject(String input) 
      XMLparseXML(String xmlString) 
      XMLparseXML(String xmlString, - String options) 
      voidpause() -
      Sketch has been paused.
      -
      voidperspective() -
      ( begin auto-generated from perspective.xml ) - - Sets a perspective projection applying foreshortening, making distant - objects appear smaller than closer ones.
      -
      voidperspective(float fovy, - float aspect, - float zNear, - float zFar) 
      voidpixelDensity(int density) 
      voidpoint(float x, - float y) -
      ( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel.
      -
      voidpoint(float x, - float y, - float z) 
      voidpointLight(float v1, - float v2, - float v3, - float x, - float y, - float z) -
      ( begin auto-generated from pointLight.xml ) - - Adds a point light.
      -
      voidpopMatrix() -
      ( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack.
      -
      voidpopStyle() -
      ( begin auto-generated from popStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings; these functions are - always used together.
      -
      voidpostEvent(Event pe) -
      Add an event to the internal event queue, or process it immediately if - the sketch is not currently looping.
      -
      static floatpow(float n, - float e) -
      ( begin auto-generated from pow.xml ) - - Facilitates exponential expressions.
      -
      static voidprint(boolean what) 
      static voidprint(byte what) -
      ( begin auto-generated from print.xml ) - - Writes to the console area of the Processing environment.
      -
      static voidprint(char what) 
      static voidprint(double what) 
      static voidprint(float what) 
      static voidprint(int what) 
      static voidprint(long what) 
      static voidprint(Object... variables) 
      static voidprint(String what) 
      static voidprintArray(Object what) -
      ( begin auto-generated from printArray.xml ) - - To come...
      -
      voidprintCamera() -
      ( begin auto-generated from printCamera.xml ) - - Prints the current camera matrix to the Console (the text window at the - bottom of Processing).
      -
      static voidprintln() -
      ( begin auto-generated from println.xml ) - - Writes to the text area of the Processing environment's console.
      -
      static voidprintln(boolean what) 
      static voidprintln(byte what) 
      static voidprintln(char what) 
      static voidprintln(double what) 
      static voidprintln(float what) 
      static voidprintln(int what) 
      static voidprintln(long what) 
      static voidprintln(Object... variables) 
      static voidprintln(Object what) -
      For arrays, use printArray() instead.
      -
      static voidprintln(String what) 
      voidprintMatrix() -
      ( begin auto-generated from printMatrix.xml ) - - Prints the current matrix to the Console (the text window at the bottom - of Processing).
      -
      voidprintProjection() -
      ( begin auto-generated from printProjection.xml ) - - Prints the current projection matrix to the Console (the text window at - the bottom of Processing).
      -
      voidpushMatrix() -
      ( begin auto-generated from pushMatrix.xml ) - - Pushes the current transformation matrix onto the matrix stack.
      -
      voidpushStyle() -
      ( begin auto-generated from pushStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings.
      -
      voidquad(float x1, - float y1, - float x2, - float y2, - float x3, - float y3, - float x4, - float y4) -
      ( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon.
      -
      voidquadraticVertex(float cx, - float cy, - float x3, - float y3) 
      voidquadraticVertex(float cx, - float cy, - float cz, - float x3, - float y3, - float z3) 
      static floatradians(float degrees) -
      ( begin auto-generated from radians.xml ) - - Converts a degree measurement to its corresponding value in radians.
      -
      floatrandom(float high) 
      floatrandom(float low, - float high) -
      ( begin auto-generated from random.xml ) - - Generates random numbers.
      -
      floatrandomGaussian() -
      ( begin auto-generated from randomGaussian.xml ) - - Returns a float from a random series of numbers having a mean of 0 - and standard deviation of 1.
      -
      voidrandomSeed(long seed) -
      ( begin auto-generated from randomSeed.xml ) - - Sets the seed value for random().
      -
      voidrect(float a, - float b, - float c, - float d) -
      ( begin auto-generated from rect.xml ) - - Draws a rectangle to the screen.
      -
      voidrect(float a, - float b, - float c, - float d, - float r) 
      voidrect(float a, - float b, - float c, - float d, - float tl, - float tr, - float br, - float bl) 
      voidrectMode(int mode) -
      ( begin auto-generated from rectMode.xml ) - - Modifies the location from which rectangles draw.
      -
      floatred(int rgb) -
      ( begin auto-generated from red.xml ) - - Extracts the red value from a color, scaled to match current - colorMode().
      -
      voidredraw() -
      ( begin auto-generated from redraw.xml ) - - Executes the code within draw() one time.
      -
      voidregisterMethod(String methodName, - Object target) -
      Register a built-in event so that it can be fired for libraries, etc.
      -
      PImagerequestImage(String filename) 
      PImagerequestImage(String filename, - String extension) -
      ( begin auto-generated from requestImage.xml ) - - This function load images on a separate thread so that your sketch does - not freeze while images load during setup().
      -
      voidresetMatrix() -
      ( begin auto-generated from resetMatrix.xml ) - - Replaces the current matrix with the identity matrix.
      -
      voidresetShader() -
      ( begin auto-generated from resetShader.xml ) - - This is a new reference entry for Processing 2.0.
      -
      voidresetShader(int kind) 
      voidresume() -
      Sketch has resumed.
      -
      static boolean[]reverse(boolean[] list) -
      ( begin auto-generated from reverse.xml ) - - Reverses the order of an array.
      -
      static byte[]reverse(byte[] list) 
      static char[]reverse(char[] list) 
      static float[]reverse(float[] list) 
      static int[]reverse(int[] list) 
      static Objectreverse(Object list) 
      static String[]reverse(String[] list) 
      voidrotate(float angle) -
      ( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter.
      -
      voidrotate(float angle, - float x, - float y, - float z) -
      Advanced
      -
      voidrotateX(float angle) -
      ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter.
      -
      voidrotateY(float angle) -
      ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter.
      -
      voidrotateZ(float angle) -
      ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter.
      -
      static intround(float n) -
      ( begin auto-generated from round.xml ) - - Calculates the integer closest to the value parameter.
      -
      static voidrunSketch(String[] args, - PApplet constructedSketch) 
      floatsaturation(int rgb) -
      ( begin auto-generated from saturation.xml ) - - Extracts the saturation value from a color.
      -
      voidsave(String filename) -
      ( begin auto-generated from save.xml ) - - Saves an image from the display window.
      -
      static voidsaveBytes(File file, - byte[] data) 
      static voidsaveBytes(OutputStream output, - byte[] data) 
      voidsaveBytes(String filename, - byte[] data) -
      ( begin auto-generated from saveBytes.xml ) - - Opposite of loadBytes(), will write an entire array of bytes to a - file.
      -
      FilesaveFile(String where) -
      Identical to savePath(), but returns a File object.
      -
      voidsaveFrame() 
      voidsaveFrame(String filename) -
      ( begin auto-generated from saveFrame.xml ) - - Saves a numbered sequence of images, one image each time the function is - run.
      -
      booleansaveJSONArray(JSONArray json, - String filename) 
      booleansaveJSONArray(JSONArray json, - String filename, - String options) 
      booleansaveJSONObject(JSONObject json, - String filename) 
      booleansaveJSONObject(JSONObject json, - String filename, - String options) 
      StringsavePath(String where) -
      Returns a path inside the applet folder to save to.
      -
      static booleansaveStream(File target, - InputStream source) 
      booleansaveStream(File target, - String source) -
      Identical to the other saveStream(), but writes to a File - object, for greater control over the file location.
      -
      static voidsaveStream(OutputStream target, - InputStream source) 
      booleansaveStream(String target, - InputStream source) 
      booleansaveStream(String target, - String source) -
      ( begin auto-generated from saveStream.xml ) - - Save the contents of a stream to a file in the sketch folder.
      -
      static voidsaveStrings(File file, - String[] data) 
      static voidsaveStrings(OutputStream output, - String[] data) 
      voidsaveStrings(String filename, - String[] data) -
      ( begin auto-generated from saveStrings.xml ) - - Writes an array of strings to a file, one line per string.
      -
      booleansaveTable(Table table, - String filename) 
      booleansaveTable(Table table, - String filename, - String options) 
      booleansaveXML(XML xml, - String filename) 
      booleansaveXML(XML xml, - String filename, - String options) 
      voidscale(float s) -
      ( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices.
      -
      voidscale(float x, - float y) -
      Advanced
      -
      voidscale(float x, - float y, - float z) 
      floatscreenX(float x, - float y) -
      ( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen.
      -
      floatscreenX(float x, - float y, - float z) 
      floatscreenY(float x, - float y) -
      ( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen.
      -
      floatscreenY(float x, - float y, - float z) 
      floatscreenZ(float x, - float y, - float z) -
      ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen.
      -
      static intsecond() -
      ( begin auto-generated from second.xml ) - - Processing communicates with the clock on your computer.
      -
      voidselectFolder(String prompt, - String callback) -
      See selectInput() for details.
      -
      voidselectFolder(String prompt, - String callback, - File file) 
      voidselectFolder(String prompt, - String callback, - File file, - Object callbackObject) 
      static voidselectFolder(String prompt, - String callbackMethod, - File defaultSelection, - Object callbackObject, - Frame parentFrame) 
      voidselectInput(String prompt, - String callback) -
      Open a platform-specific file chooser dialog to select a file for input.
      -
      voidselectInput(String prompt, - String callback, - File file) 
      voidselectInput(String prompt, - String callback, - File file, - Object callbackObject) 
      static voidselectInput(String prompt, - String callbackMethod, - File file, - Object callbackObject, - Frame parent) 
      voidselectOutput(String prompt, - String callback) -
      See selectInput() for details.
      -
      voidselectOutput(String prompt, - String callback, - File file) 
      voidselectOutput(String prompt, - String callback, - File file, - Object callbackObject) 
      static voidselectOutput(String prompt, - String callbackMethod, - File file, - Object callbackObject, - Frame parent) 
      voidset(int x, - int y, - int c) -
      ( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
      -
      - The x and y parameters specify the pixel to change and the - color parameter specifies the color value.
      -
      voidset(int x, - int y, - PImage img) -
      Advanced
      -
      voidsetFrame(Frame frame) 
      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.
      -
      voidsettings() -
      ( begin auto-generated from settings.xml ) - - Description to come...
      -
      voidsetup() -
      ( begin auto-generated from setup.xml ) - - The setup() function is called once when the program starts.
      -
      voidshader(PShader shader) -
      ( begin auto-generated from shader.xml ) - - This is a new reference entry for Processing 2.0.
      -
      voidshader(PShader shader, - int kind) 
      voidshape(PShape shape) 
      voidshape(PShape shape, - float x, - float y) -
      ( begin auto-generated from shape.xml ) - - Displays shapes to the screen.
      -
      voidshape(PShape shape, - float a, - float b, - float c, - float d) 
      voidshapeMode(int mode) -
      ( begin auto-generated from shapeMode.xml ) - - Modifies the location from which shapes draw.
      -
      voidshearX(float angle) -
      ( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter.
      -
      voidshearY(float angle) -
      ( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter.
      -
      voidshininess(float shine) -
      ( begin auto-generated from shininess.xml ) - - Sets the amount of gloss in the surface of shapes.
      -
      static boolean[]shorten(boolean[] list) -
      ( begin auto-generated from shorten.xml ) - - Decreases an array by one element and returns the shortened array.
      -
      static byte[]shorten(byte[] list) 
      static char[]shorten(char[] list) 
      static float[]shorten(float[] list) 
      static int[]shorten(int[] list) 
      static Objectshorten(Object list) 
      static String[]shorten(String[] list) 
      static voidshowDepthWarning(String method) -
      Display a warning that the specified method is only available with 3D.
      -
      static voidshowDepthWarningXYZ(String method) -
      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.
      -
      static voidshowMethodWarning(String method) -
      Display a warning that the specified method is simply unavailable.
      -
      static voidshowMissingWarning(String method) -
      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 voidshowVariationWarning(String str) -
      Error that a particular variation of a method is unavailable (even though - other variations are).
      -
      static floatsin(float angle) -
      ( begin auto-generated from sin.xml ) - - Calculates the sine of an angle.
      -
      voidsize(int width, - int height) -
      ( begin auto-generated from size.xml ) - - Defines the dimension of the display window in units of pixels.
      -
      voidsize(int width, - int height, - String renderer) 
      voidsize(int width, - int height, - String renderer, - String path) 
      intsketchDisplay() 
      FilesketchFile(String where) 
      booleansketchFullScreen() 
      intsketchHeight() 
      StringsketchOutputPath() 
      OutputStreamsketchOutputStream() 
      StringsketchPath() 
      StringsketchPath(String where) -
      Prepend the sketch folder path to the filename (or path) that is - passed in.
      -
      intsketchPixelDensity() 
      StringsketchRenderer() 
      intsketchSmooth() 
      intsketchWidth() 
      intsketchWindowColor() 
      voidsmooth() 
      voidsmooth(int level) 
      static byte[]sort(byte[] list) -
      ( begin auto-generated from sort.xml ) - - Sorts an array of numbers from smallest to largest and puts an array of - words in alphabetical order.
      -
      static byte[]sort(byte[] list, - int count) 
      static char[]sort(char[] list) 
      static char[]sort(char[] list, - int count) 
      static float[]sort(float[] list) 
      static float[]sort(float[] list, - int count) 
      static int[]sort(int[] list) 
      static int[]sort(int[] list, - int count) 
      static String[]sort(String[] list) 
      static String[]sort(String[] list, - int count) 
      voidspecular(float gray) -
      gray number specifying value between white and black
      -
      voidspecular(float v1, - float v2, - float v3) 
      voidspecular(int rgb) -
      ( begin auto-generated from specular.xml ) - - Sets the specular color of the materials used for shapes drawn to the - screen, which sets the color of hightlights.
      -
      voidsphere(float r) -
      ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles.
      -
      voidsphereDetail(int res) -
      ( begin auto-generated from sphereDetail.xml ) - - Controls the detail used to render a sphere by adjusting the number of - vertices of the sphere mesh.
      -
      voidsphereDetail(int ures, - int vres) 
      static boolean[]splice(boolean[] list, - boolean[] value, - int index) 
      static boolean[]splice(boolean[] list, - boolean value, - int index) -
      ( begin auto-generated from splice.xml ) - - Inserts a value or array of values into an existing array.
      -
      static byte[]splice(byte[] list, - byte[] value, - int index) 
      static byte[]splice(byte[] list, - byte value, - int index) 
      static char[]splice(char[] list, - char[] value, - int index) 
      static char[]splice(char[] list, - char value, - int index) 
      static float[]splice(float[] list, - float[] value, - int index) 
      static float[]splice(float[] list, - float value, - int index) 
      static int[]splice(int[] list, - int[] value, - int index) 
      static int[]splice(int[] list, - int value, - int index) 
      static Objectsplice(Object list, - Object value, - int index) 
      static String[]splice(String[] list, - String[] value, - int index) 
      static String[]splice(String[] list, - String value, - int index) 
      static String[]split(String value, - char delim) -
      ( begin auto-generated from split.xml ) - - The split() function breaks a string into pieces using a character or - string as the divider.
      -
      static String[]split(String value, - String delim) 
      static String[]splitTokens(String value) 
      static String[]splitTokens(String value, - String delim) -
      ( begin auto-generated from splitTokens.xml ) - - The splitTokens() function splits a String at one or many character - "tokens." The tokens parameter specifies the character or - characters to be used as a boundary.
      -
      voidspotLight(float v1, - float v2, - float v3, - float x, - float y, - float z, - float nx, - float ny, - float nz, - float angle, - float concentration) -
      ( begin auto-generated from spotLight.xml ) - - Adds a spot light.
      -
      static floatsq(float n) -
      ( begin auto-generated from sq.xml ) - - Squares a number (multiplies a number by itself).
      -
      static floatsqrt(float n) -
      ( begin auto-generated from sqrt.xml ) - - Calculates the square root of a number.
      -
      voidstart() -
      Called by the browser or applet viewer to inform this applet that it - should start its execution.
      -
      voidstop() -
      Called by the browser or applet viewer to inform - this applet that it should stop its execution.
      -
      static Stringstr(boolean x) 
      static String[]str(boolean[] x) 
      static Stringstr(byte x) 
      static String[]str(byte[] x) 
      static Stringstr(char x) 
      static String[]str(char[] x) 
      static Stringstr(float x) 
      static String[]str(float[] x) 
      static Stringstr(int x) 
      static String[]str(int[] x) 
      voidstroke(float gray) 
      voidstroke(float gray, - float alpha) 
      voidstroke(float v1, - float v2, - float v3) 
      voidstroke(float v1, - float v2, - float v3, - float alpha) 
      voidstroke(int rgb) -
      ( begin auto-generated from stroke.xml ) - - Sets the color used to draw lines and borders around shapes.
      -
      voidstroke(int rgb, - float alpha) 
      voidstrokeCap(int cap) -
      ( begin auto-generated from strokeCap.xml ) - - Sets the style for rendering line endings.
      -
      voidstrokeJoin(int join) -
      ( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments.
      -
      voidstrokeWeight(float weight) -
      ( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes.
      -
      voidstyle(PStyle s) 
      static boolean[]subset(boolean[] list, - int start) 
      static boolean[]subset(boolean[] list, - int start, - int count) -
      ( begin auto-generated from subset.xml ) - - Extracts an array of elements from an existing array.
      -
      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 Objectsubset(Object list, - int start) 
      static Objectsubset(Object list, - int start, - int count) 
      static String[]subset(String[] list, - int start) 
      static String[]subset(String[] list, - int start, - int count) 
      static floattan(float angle) -
      ( begin auto-generated from tan.xml ) - - Calculates the ratio of the sine and cosine of an angle.
      -
      voidtext(char[] chars, - int start, - int stop, - float x, - float y) -
      Advanced
      -
      voidtext(char[] chars, - int start, - int stop, - float x, - float y, - float z) 
      voidtext(char c, - float x, - float y) -
      ( begin auto-generated from text.xml ) - - Draws text to the screen.
      -
      voidtext(char c, - float x, - float y, - float z) 
      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(String str, - float x, - float y) -
      Advanced
      -
      voidtext(String str, - float x, - float y, - float z) -
      Same as above but with a z coordinate.
      -
      voidtext(String str, - float x1, - float y1, - float x2, - float y2) -
      Advanced
      -
      voidtextAlign(int alignX) 
      voidtextAlign(int alignX, - int alignY) -
      ( begin auto-generated from textAlign.xml ) - - Sets the current alignment for drawing text.
      -
      floattextAscent() -
      ( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size.
      -
      floattextDescent() -
      ( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size.
      -
      voidtextFont(PFont which) -
      ( begin auto-generated from textFont.xml ) - - Sets the current font that will be drawn with the text() - function.
      -
      voidtextFont(PFont which, - float size) 
      voidtextLeading(float leading) -
      ( begin auto-generated from textLeading.xml ) - - Sets the spacing between lines of text in units of pixels.
      -
      voidtextMode(int mode) -
      ( begin auto-generated from textMode.xml ) - - Sets the way text draws to the screen.
      -
      voidtextSize(float size) -
      ( begin auto-generated from textSize.xml ) - - Sets the current font size.
      -
      voidtexture(PImage image) -
      ( begin auto-generated from texture.xml ) - - Sets a texture to be applied to vertex points.
      -
      voidtextureMode(int mode) -
      ( begin auto-generated from textureMode.xml ) - - Sets the coordinate space for texture mapping.
      -
      voidtextureWrap(int wrap) -
      ( begin auto-generated from textureWrap.xml ) - - Description to come...
      -
      floattextWidth(char c) 
      floattextWidth(char[] chars, - int start, - int length) 
      floattextWidth(String str) -
      ( begin auto-generated from textWidth.xml ) - - Calculates and returns the width of any character or text string.
      -
      voidthread(String name) -
      Launch a new thread and call the specified function from that new thread.
      -
      voidtint(float gray) 
      voidtint(float gray, - float alpha) 
      voidtint(float v1, - float v2, - float v3) 
      voidtint(float v1, - float v2, - float v3, - float alpha) 
      voidtint(int rgb) -
      ( begin auto-generated from tint.xml ) - - Sets the fill value for displaying images.
      -
      voidtint(int rgb, - float alpha) 
      voidtranslate(float x, - float y) -
      ( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window.
      -
      voidtranslate(float x, - float y, - float z) 
      voidtriangle(float x1, - float y1, - float x2, - float y2, - float x3, - float y3) -
      ( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points.
      -
      static Stringtrim(String str) -
      ( begin auto-generated from trim.xml ) - - Removes whitespace characters from the beginning and end of a String.
      -
      static String[]trim(String[] array) 
      static intunbinary(String value) -
      ( begin auto-generated from unbinary.xml ) - - Converts a String representation of a binary number to its equivalent - integer value.
      -
      static intunhex(String value) -
      ( begin auto-generated from unhex.xml ) - - Converts a String representation of a hexadecimal number to its - equivalent integer value.
      -
      voidunregisterMethod(String name, - Object target) 
      voidupdatePixels() -
      ( begin auto-generated from updatePixels.xml ) - - Updates the display window with the data in the pixels[] array.
      -
      voidupdatePixels(int x1, - int y1, - int x2, - int y2) 
      static StringurlDecode(String str) 
      static StringurlEncode(String str) 
      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) -
      ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices.
      -
      static intyear() -
      ( begin auto-generated from year.xml ) - - Processing communicates with the clock on your computer.
      -
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        javaVersionName

        -
        public static final String javaVersionName
        -
        Full name of the Java version (i.e. 1.5.0_11).
        -
      • -
      - - - -
        -
      • -

        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 specifying a double with the preprocessor is awkward.

        -
      • -
      - - - -
        -
      • -

        platform

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

        useNativeSelect

        -
        public static boolean useNativeSelect
        -
        Whether to use native (AWT) dialogs for selectInput and selectOutput. - The native dialogs on Linux tend to be pretty awful. With selectFolder() - this is ignored, because there is no native folder selector, except on - Mac OS X. On OS X, the native folder selector will be used unless - useNativeSelect is set to false.
        -
      • -
      - - - -
        -
      • -

        g

        -
        public PGraphics g
        -
        The PGraphics renderer associated with this PApplet
        -
      • -
      - - - -
        -
      • -

        displayWidth

        -
        public int displayWidth
        -
        ( begin auto-generated from displayWidth.xml ) - - System variable which stores the width of the computer screen. For - example, if the current screen resolution is 1024x768, - displayWidth is 1024 and displayHeight is 768. These - dimensions are useful when exporting full-screen applications. -

        - To ensure that the sketch takes over the entire screen, use "Present" - instead of "Run". Otherwise the window will still have a frame border - around it and not be placed in the upper corner of the screen. On Mac OS - X, the menu bar will remain present unless "Present" mode is used. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        displayHeight

        -
        public int displayHeight
        -
        ( begin auto-generated from displayHeight.xml ) - - System variable that stores the height of the computer screen. For - example, if the current screen resolution is 1024x768, - displayWidth is 1024 and displayHeight is 768. These - dimensions are useful when exporting full-screen applications. -

        - To ensure that the sketch takes over the entire screen, use "Present" - instead of "Run". Otherwise the window will still have a frame border - around it and not be placed in the upper corner of the screen. On Mac OS - X, the menu bar will remain present unless "Present" mode is used. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        recorder

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

        args

        -
        public String[] args
        -
        Command line options passed in from main(). - This does not include the arguments passed in to PApplet itself.
        -
        -
        See Also:
        -
        main(java.lang.String[])
        -
        -
      • -
      - - - -
        -
      • -

        DEFAULT_WIDTH

        -
        public static final int DEFAULT_WIDTH
        -
        Default width and height for sketch when not specified
        -
        -
        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
        -
        ( begin auto-generated from pixels.xml ) - - Array containing the values for all the pixels in the display window. - These values are of the color datatype. This array is the size of the - display window. For example, if the image is 100x100 pixels, there will - be 10000 values and if the window is 200x300 pixels, there will be 60000 - values. The index value defines the position of a value within - the array. For example, the statement color b = pixels[230] will - set the variable b to be equal to the value at that location in - the array.
        -
        - Before accessing this array, the data must loaded with the - loadPixels() function. After the array data has been modified, - the updatePixels() function must be run to update the changes. - Without loadPixels(), running the code may (or will in future - releases) result in a NullPointerException. - - ( end auto-generated )
        -
        -
        See Also:
        -
        loadPixels(), -updatePixels(), -get(int, int, int, int), -set(int, int, int), -PImage
        -
        -
      • -
      - - - -
        -
      • -

        width

        -
        public int width
        -
        ( begin auto-generated from width.xml ) - - System variable which stores the width of the display window. This value - is set by the first parameter of the size() function. For - example, the function call size(320, 240) sets the width - variable to the value 320. The value of width is zero until - size() is called. - - ( end auto-generated )
        -
        -
        See Also:
        -
        height, -size(int, int)
        -
        -
      • -
      - - - -
        -
      • -

        height

        -
        public int height
        -
        ( begin auto-generated from height.xml ) - - System variable which stores the height of the display window. This - value is set by the second parameter of the size() function. For - example, the function call size(320, 240) sets the height - variable to the value 240. The value of height is zero until - size() is called. - - ( end auto-generated )
        -
        -
        See Also:
        -
        width, -size(int, int)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        pmouseX

        -
        public int pmouseX
        -
        ( begin auto-generated from pmouseX.xml ) - - The system variable pmouseX always contains the horizontal - position of the mouse in the frame previous to the current frame.
        -
        - You may find that pmouseX and pmouseY have different - values inside draw() and inside events like mousePressed() - and mouseMoved(). This is because they're used for different - roles, so don't mix them. Inside draw(), pmouseX and - pmouseY update only once per frame (once per trip through your - draw()). But, inside mouse events, they update each time the - event is called. If they weren't separated, then the mouse would be read - only once per frame, making response choppy. If the mouse variables were - always updated multiple times per frame, using line(pmouseX, - pmouseY, mouseX, mouseY) inside draw() would have lots - of gaps, because pmouseX may have changed several times in - between the calls to line(). Use pmouseX and - pmouseY inside draw() if you want values relative to the - previous frame. Use pmouseX and pmouseY inside the mouse - functions if you want continuous response. - - ( end auto-generated )
        -
        -
        See Also:
        -
        mouseX, -mouseY, -pmouseY, -mousePressed, -mousePressed(), -mouseReleased(), -mouseClicked(), -mouseMoved(), -mouseDragged(), -mouseButton, -mouseWheel(MouseEvent)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        firstMouse

        -
        @Deprecated
        -public boolean firstMouse
        -
        Deprecated. Please refrain from using this variable, it will be removed - from future releases of Processing because it cannot be used consistently - across platforms and input methods.
        -
        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
        -
        ( begin auto-generated from mouseButton.xml ) - - Processing automatically tracks if the mouse button is pressed and which - button is pressed. The value of the system variable mouseButton - is either LEFT, RIGHT, or CENTER depending on which - button is pressed. - - ( end auto-generated ) - -

        Advanced:

        - - If running on Mac OS, a ctrl-click will be interpreted as the right-hand - mouse button (unlike Java, which reports it as the left mouse).
        -
        -
        See Also:
        -
        mouseX, -mouseY, -pmouseX, -pmouseY, -mousePressed, -mousePressed(), -mouseReleased(), -mouseClicked(), -mouseMoved(), -mouseDragged(), -mouseWheel(MouseEvent)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        mouseEvent

        -
        @Deprecated
        -public MouseEvent mouseEvent
        -
        Deprecated. Use a mouse event handler that passes an event instead.
        -
      • -
      - - - -
        -
      • -

        key

        -
        public char key
        -
        ( begin auto-generated from key.xml ) - - The system variable key always contains the value of the most - recent key on the keyboard that was used (either pressed or released). -

        - For non-ASCII keys, use the keyCode variable. The keys included - in the ASCII specification (BACKSPACE, TAB, ENTER, RETURN, ESC, and - DELETE) do not require checking to see if they key is coded, and you - should simply use the key variable instead of keyCode If - you're making cross-platform projects, note that the ENTER key is - commonly used on PCs and Unix and the RETURN key is used instead on - Macintosh. Check for both ENTER and RETURN to make sure your program - will work for all platforms. - - ( end auto-generated ) - -

        Advanced

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

        -
        -
        See Also:
        -
        keyCode, -keyPressed, -keyPressed(), -keyReleased()
        -
        -
      • -
      - - - -
        -
      • -

        keyCode

        -
        public int keyCode
        -
        ( begin auto-generated from keyCode.xml ) - - The variable keyCode is used to detect special keys such as the - UP, DOWN, LEFT, RIGHT arrow keys and ALT, CONTROL, SHIFT. When checking - for these keys, it's first necessary to check and see if the key is - coded. This is done with the conditional "if (key == CODED)" as shown in - the example. -

        - The keys included in the ASCII specification (BACKSPACE, TAB, ENTER, - RETURN, ESC, and DELETE) do not require checking to see if they key is - coded, and you should simply use the key variable instead of - keyCode If you're making cross-platform projects, note that the - ENTER key is commonly used on PCs and Unix and the RETURN key is used - instead on Macintosh. Check for both ENTER and RETURN to make sure your - program will work for all platforms. -

        - For users familiar with Java, the values for UP and DOWN are simply - shorter versions of Java's KeyEvent.VK_UP and KeyEvent.VK_DOWN. Other - keyCode values can be found in the Java KeyEvent reference. - - ( end auto-generated ) - -

        Advanced

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

        -
        -
        See Also:
        -
        key, -keyPressed, -keyPressed(), -keyReleased()
        -
        -
      • -
      - - - -
        -
      • -

        keyPressed

        -
        public boolean keyPressed
        -
        ( begin auto-generated from keyPressed_var.xml ) - - The boolean system variable keyPressed is true if any key - is pressed and false if no keys are pressed. - - ( end auto-generated )
        -
        -
        See Also:
        -
        key, -keyCode, -keyPressed(), -keyReleased()
        -
        -
      • -
      - - - -
        -
      • -

        keyEvent

        -
        @Deprecated
        -public KeyEvent keyEvent
        -
        Deprecated. Use a key event handler that passes an event instead.
        -
        The last KeyEvent object passed into a mouse function.
        -
      • -
      - - - -
        -
      • -

        focused

        -
        public boolean focused
        -
        ( begin auto-generated from focused.xml ) - - Confirms if a Processing program is "focused", meaning that it is active - and will accept input from mouse or keyboard. This variable is "true" if - it is focused and "false" if not. This variable is often used when you - want to warn people they need to click on or roll over an applet before - it will work. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        frameRate

        -
        public float frameRate
        -
        ( begin auto-generated from frameRate_var.xml ) - - The system variable frameRate contains the approximate frame rate - of the software as it executes. The initial value is 10 fps and is - updated with each frame. The value is averaged (integrated) over several - frames. As such, this value won't be valid until after 5-10 frames. - - ( end auto-generated )
        -
        -
        See Also:
        -
        frameRate(float), -frameCount
        -
        -
      • -
      - - - -
        -
      • -

        frameCount

        -
        public int frameCount
        -
        ( begin auto-generated from frameCount.xml ) - - The system variable frameCount contains the number of frames - displayed since the program started. Inside setup() the value is - 0 and and after the first iteration of draw it is 1, etc. - - ( end auto-generated )
        -
        -
        See Also:
        -
        frameRate(float), -frameRate
        -
        -
      • -
      - - - -
        -
      • -

        finished

        -
        public volatile boolean finished
        -
        true if the sketch has stopped permanently.
        -
      • -
      - - - -
        -
      • -

        ARGS_EDITOR_LOCATION

        -
        public static final String ARGS_EDITOR_LOCATION
        -
        Position of the upper-lefthand corner of the editor window - that launched this applet.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - - - - - -
        -
      • -

        ARGS_LOCATION

        -
        public static final String ARGS_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.

        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        ARGS_DISPLAY

        -
        public static final String ARGS_DISPLAY
        -
        Used by the PDE to suggest a display (set in prefs, passed on Run)
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        ARGS_SKETCH_FOLDER

        -
        public static final 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 String EXTERNAL_STOP
        -
        When run externally to a PdeEditor, - this is sent by the sketch when it quits.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        EXTERNAL_MOVE

        -
        public static final 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
        -
        -
      • -
      - - - -
        -
      • -

        frame

        -
        public Frame frame
        -
        The frame containing this sketch (if any)
        -
      • -
      - - - -
        -
      • -

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

      Constructor Detail

      - - - -
        -
      • -

        PApplet

        -
        public PApplet()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getFrame

        -
        public Frame getFrame()
        -
      • -
      - - - -
        -
      • -

        setFrame

        -
        public void setFrame(Frame frame)
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init()
        -
        Applet initialization. This can do GUI work because the components have - not been 'realized' yet: things aren't visible, displayed, etc.
        -
      • -
      - - - -
        -
      • -

        settings

        -
        public void settings()
        -
        ( begin auto-generated from settings.xml ) - - Description to come... - - ( end auto-generated ) - - Override this method to call size() when not using the PDE.
        -
        -
        See Also:
        -
        fullScreen(), -setup(), -PApplet#size(), -smooth()
        -
        -
      • -
      - - - -
        -
      • -

        sketchWidth

        -
        public final int sketchWidth()
        -
      • -
      - - - -
        -
      • -

        sketchHeight

        -
        public final int sketchHeight()
        -
      • -
      - - - -
        -
      • -

        sketchRenderer

        -
        public final String sketchRenderer()
        -
      • -
      - - - -
        -
      • -

        sketchSmooth

        -
        public final int sketchSmooth()
        -
      • -
      - - - -
        -
      • -

        sketchFullScreen

        -
        public final boolean sketchFullScreen()
        -
      • -
      - - - -
        -
      • -

        sketchDisplay

        -
        public final int sketchDisplay()
        -
      • -
      - - - -
        -
      • -

        sketchOutputPath

        -
        public final String sketchOutputPath()
        -
      • -
      - - - -
        -
      • -

        sketchOutputStream

        -
        public final OutputStream sketchOutputStream()
        -
      • -
      - - - -
        -
      • -

        sketchWindowColor

        -
        public final int sketchWindowColor()
        -
      • -
      - - - -
        -
      • -

        sketchPixelDensity

        -
        public final int sketchPixelDensity()
        -
      • -
      - - - -
        -
      • -

        displayDensity

        -
        public int displayDensity()
        -
      • -
      - - - -
        -
      • -

        displayDensity

        -
        public static int displayDensity(int display)
        -
      • -
      - - - -
        -
      • -

        pixelDensity

        -
        public void pixelDensity(int density)
        -
        -
        Parameters:
        -
        density - 1 or 2
        -
        -
      • -
      - - - -
        -
      • -

        smooth

        -
        public void smooth()
        -
      • -
      - - - -
        -
      • -

        smooth

        -
        public void smooth(int level)
        -
        -
        Parameters:
        -
        level - either 0, 1, 2, 4, 8
        -
        -
      • -
      - - - -
        -
      • -

        noSmooth

        -
        public void noSmooth()
        -
      • -
      - - - -
        -
      • -

        getGraphics

        -
        public PGraphics getGraphics()
        -
      • -
      - - - -
        -
      • -

        orientation

        -
        public void orientation(int which)
        -
      • -
      - - - -
        -
      • -

        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.

        -
      • -
      - - - -
        -
      • -

        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.

        -
      • -
      - - - -
        -
      • -

        pause

        -
        public void pause()
        -
        Sketch has been paused. Called when switching tabs in a browser or - swapping to a different application on Android. Also called just before - quitting. Use to safely disable things like serial, sound, or sensors.
        -
      • -
      - - - -
        -
      • -

        resume

        -
        public void resume()
        -
        Sketch has resumed. Called when switching tabs in a browser or - swapping to this application on Android. Also called on startup. - Use this to safely disable things like serial, sound, or sensors.
        -
      • -
      - - - -
        -
      • -

        registerMethod

        -
        public void registerMethod(String methodName,
        -                           Object target)
        -
        Register a built-in event so that it can be fired for libraries, etc. - Supported events include: -
          -
        • pre – at the very top of the draw() method (safe to draw) -
        • draw – at the end of the draw() method (safe to draw) -
        • post – after draw() has exited (not safe to draw) -
        • pause – called when the sketch is paused -
        • resume – called when the sketch is resumed -
        • dispose – when the sketch is shutting down (definitely not safe to draw) -
            - In addition, the new (for 2.0) processing.event classes are passed to - the following event types: -
              -
            • mouseEvent -
            • keyEvent -
            • touchEvent -
            - The older java.awt events are no longer supported. - See the Library Wiki page for more details.
        -
        -
        Parameters:
        -
        methodName - name of the method to be called
        -
        target - the target object that should receive the event
        -
        -
      • -
      - - - -
        -
      • -

        unregisterMethod

        -
        public void unregisterMethod(String name,
        -                             Object target)
        -
      • -
      - - - -
        -
      • -

        setup

        -
        public void setup()
        -
        ( begin auto-generated from setup.xml ) - - The setup() function is called once when the program starts. It's - used to define initial - enviroment properties such as screen size and background color and to - load media such as images - and fonts as the program starts. There can only be one setup() - function for each program and - it shouldn't be called again after its initial execution. Note: - Variables declared within - setup() are not accessible within other functions, including - draw(). - - ( end auto-generated )
        -
        -
        See Also:
        -
        size(int, int), -loop(), -noLoop(), -draw()
        -
        -
      • -
      - - - -
        -
      • -

        draw

        -
        public void draw()
        -
        ( begin auto-generated from draw.xml ) - - Called directly after setup() and continuously executes the lines - of code contained inside its block until the program is stopped or - noLoop() is called. The draw() function is called - automatically and should never be called explicitly. It should always be - controlled with noLoop(), redraw() and loop(). - After noLoop() stops the code in draw() from executing, - redraw() causes the code inside draw() to execute once and - loop() will causes the code inside draw() to execute - continuously again. The number of times draw() executes in each - second may be controlled with frameRate() function. - There can only be one draw() function for each sketch - and draw() must exist if you want the code to run continuously or - to process events such as mousePressed(). Sometimes, you might - have an empty call to draw() in your program as shown in the - above example. - - ( end auto-generated )
        -
        -
        See Also:
        -
        setup(), -loop(), -noLoop(), -redraw(), -frameRate(float), -PGraphics.background(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        fullScreen

        -
        public void fullScreen()
        -
        Create a full-screen sketch using the default renderer.
        -
      • -
      - - - -
        -
      • -

        fullScreen

        -
        public void fullScreen(int display)
        -
      • -
      - - - -
        -
      • -

        fullScreen

        -
        public void fullScreen(String renderer)
        -
        ( begin auto-generated from fullScreen.xml ) - - Description to come... - - ( end auto-generated )
        -
        -
        Parameters:
        -
        renderer - the renderer to use, e.g. P2D, P3D, JAVA2D (default)
        -
        See Also:
        -
        settings(), -setup(), -PApplet#size(), -smooth()
        -
        -
      • -
      - - - -
        -
      • -

        fullScreen

        -
        public void fullScreen(String renderer,
        -                       int display)
        -
        -
        Parameters:
        -
        display - the screen to run the sketch on (1, 2, 3, etc.)
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public void size(int width,
        -                 int height)
        -
        ( begin auto-generated from size.xml ) - - Defines the dimension of the display window in units of pixels. The - size() function must be the first line in setup(). If - size() is not used, the default size of the window is 100x100 - pixels. The system variables width and height are set by - the parameters passed to this function.
        -
        - Do not use variables as the parameters to size() function, - because it will cause problems when exporting your sketch. When - variables are used, the dimensions of your sketch cannot be determined - during export. Instead, employ numeric values in the size() - statement, and then use the built-in width and height - variables inside your program when the dimensions of the display window - are needed.
        -
        - The size() function can only be used once inside a sketch, and - cannot be used for resizing.
        -
        renderer parameter selects which rendering engine to use. - For example, if you will be drawing 3D shapes, use P3D, if you - want to export images from a program as a PDF file use PDF. A - brief description of the three primary renderers follows:
        -
        - P2D (Processing 2D) - The default renderer that supports two - dimensional drawing.
        -
        - P3D (Processing 3D) - 3D graphics renderer that makes use of - OpenGL-compatible graphics hardware.
        -
        - PDF - The PDF renderer draws 2D graphics directly to an Acrobat - PDF file. This produces excellent results when you need vector shapes - for high resolution output or printing. You must first use Import - Library → PDF to make use of the library. More information can be - found in the PDF library reference.
        -
        - The P3D renderer doesn't support strokeCap() or - strokeJoin(), which can lead to ugly results when using - strokeWeight(). (Issue - 123)
        -
        - The maximum width and height is limited by your operating system, and is - usually the width and height of your actual screen. On some machines it - may simply be the number of pixels on your current screen, meaning that - a screen of 800x600 could support size(1600, 300), since it's the - same number of pixels. This varies widely so you'll have to try - different rendering modes and sizes until you get what you're looking - for. If you need something larger, use createGraphics to create a - non-visible drawing surface.
        -
        - Again, the size() function must be the first line of the code (or - first item inside setup). Any code that appears before the size() - command may run more than once, which can lead to confusing results. - - ( end auto-generated ) - -

        Advanced

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

        -
        -
        Parameters:
        -
        width - width of the display window in units of pixels
        -
        height - height of the display window in units of pixels
        -
        See Also:
        -
        width, -height
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public void size(int width,
        -                 int height,
        -                 String renderer)
        -
      • -
      - - - -
        -
      • -

        size

        -
        public void size(int width,
        -                 int height,
        -                 String renderer,
        -                 String path)
        -
      • -
      - - - -
        -
      • -

        createGraphics

        -
        public PGraphics createGraphics(int w,
        -                                int h)
        -
      • -
      - - - -
        -
      • -

        createGraphics

        -
        public PGraphics createGraphics(int w,
        -                                int h,
        -                                String renderer)
        -
        ( begin auto-generated from createGraphics.xml ) - - Creates and returns a new PGraphics object of the types P2D or - P3D. Use this class if you need to draw into an off-screen graphics - buffer. The PDF renderer requires the filename parameter. The DXF - renderer should not be used with createGraphics(), it's only - built for use with beginRaw() and endRaw().
        -
        - It's important to call any drawing functions between beginDraw() - and endDraw() statements. This is also true for any functions - that affect drawing, such as smooth() or colorMode().
        -
        the main drawing surface which is completely opaque, surfaces - created with createGraphics() can have transparency. This makes - it possible to draw into a graphics and maintain the alpha channel. By - using save() to write a PNG or TGA file, the transparency of the - graphics object will be honored. Note that transparency levels are - binary: pixels are either complete opaque or transparent. For the time - being, this means that text characters will be opaque blocks. This will - be fixed in a future release (Issue 80). - - ( end auto-generated ) -

        Advanced

        - 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(). -
          -
          - PGraphics big;
          -
          - void setup() {
          -   big = createGraphics(3000, 3000);
          -
          -   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. -
        • 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(). -
        -
        -
        Parameters:
        -
        w - width in pixels
        -
        h - height in pixels
        -
        renderer - Either P2D, P3D, or PDF
        -
        See Also:
        -
        PGraphics.PGraphics()
        -
        -
      • -
      - - - -
        -
      • -

        createGraphics

        -
        public PGraphics createGraphics(int w,
        -                                int h,
        -                                String renderer,
        -                                String path)
        -
        Create an offscreen graphics surface for drawing, in this case - for a renderer that writes to a file (such as PDF or DXF).
        -
        -
        Parameters:
        -
        path - the name of the file (can be an absolute or relative path)
        -
        -
      • -
      - - - -
        -
      • -

        createImage

        -
        public PImage createImage(int w,
        -                          int h,
        -                          int format)
        -
        ( begin auto-generated from createImage.xml ) - - Creates a new PImage (the datatype for storing images). This provides a - fresh buffer of pixels to play with. Set the size of the buffer with the - width and height parameters. The format parameter - defines how the pixels are stored. See the PImage reference for more information. -

        - Be sure to include all three parameters, specifying only the width and - height (but no format) will produce a strange error. -

        - Advanced users please note that createImage() should be used instead of - the syntax new PImage(). - - ( end auto-generated ) -

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        w - width in pixels
        -
        h - height in pixels
        -
        format - Either RGB, ARGB, ALPHA (grayscale alpha channel)
        -
        See Also:
        -
        PImage, -PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        handleDraw

        -
        public void handleDraw()
        -
      • -
      - - - -
        -
      • -

        canDraw

        -
        public boolean canDraw()
        -
        Not official API, not guaranteed to work in the future.
        -
      • -
      - - - -
        -
      • -

        redraw

        -
        public void redraw()
        -
        ( begin auto-generated from redraw.xml ) - - Executes the code within draw() one time. This functions allows - the program to update the display window only when necessary, for - example when an event registered by mousePressed() or - keyPressed() occurs. -

        structuring a program, it only makes sense to call redraw() - within events such as mousePressed(). This is because - redraw() does not run draw() immediately (it only sets a - flag that indicates an update is needed). -

        redraw() within draw() has no effect because - draw() is continuously called anyway. - - ( end auto-generated )
        -
        -
        See Also:
        -
        draw(), -loop(), -noLoop(), -frameRate(float)
        -
        -
      • -
      - - - -
        -
      • -

        loop

        -
        public void loop()
        -
        ( begin auto-generated from loop.xml ) - - Causes Processing to continuously execute the code within draw(). - If noLoop() is called, the code in draw() stops executing. - - ( end auto-generated )
        -
        -
        See Also:
        -
        noLoop(), -redraw(), -draw()
        -
        -
      • -
      - - - -
        -
      • -

        noLoop

        -
        public void noLoop()
        -
        ( begin auto-generated from noLoop.xml ) - - Stops Processing from continuously executing the code within - draw(). If loop() is called, the code in draw() - begin to run continuously again. If using noLoop() in - setup(), it should be the last line inside the block. -

        - When noLoop() is used, it's not possible to manipulate or access - the screen inside event handling functions such as mousePressed() - or keyPressed(). Instead, use those functions to call - redraw() or loop(), which will run draw(), which - can update the screen properly. This means that when noLoop() has been - called, no drawing can happen, and functions like saveFrame() or - loadPixels() may not be used. -

        - Note that if the sketch is resized, redraw() will be called to - update the sketch, even after noLoop() has been specified. - Otherwise, the sketch would enter an odd state until loop() was called. - - ( end auto-generated )
        -
        -
        See Also:
        -
        loop(), -redraw(), -draw()
        -
        -
      • -
      - - - -
        -
      • -

        postEvent

        -
        public void postEvent(Event pe)
        -
        Add an event to the internal event queue, or process it immediately if - the sketch is not currently looping.
        -
      • -
      - - - -
        -
      • -

        mousePressed

        -
        public void mousePressed()
        -
        ( begin auto-generated from mousePressed.xml ) - - The mousePressed() function is called once after every time a - mouse button is pressed. The mouseButton variable (see the - related reference entry) can be used to determine which button has been pressed. - - ( end auto-generated ) -

        Advanced

        - - 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.
        -
        -
        See Also:
        -
        mouseX, -mouseY, -pmouseX, -pmouseY, -mousePressed, -mouseReleased(), -mouseClicked(), -mouseMoved(), -mouseDragged(), -mouseButton, -mouseWheel(MouseEvent)
        -
        -
      • -
      - - - -
        -
      • -

        mousePressed

        -
        public void mousePressed(MouseEvent event)
        -
      • -
      - - - - - - - -
        -
      • -

        mouseReleased

        -
        public void mouseReleased(MouseEvent event)
        -
      • -
      - - - - - - - -
        -
      • -

        mouseClicked

        -
        public void mouseClicked(MouseEvent event)
        -
      • -
      - - - - - - - -
        -
      • -

        mouseDragged

        -
        public void mouseDragged(MouseEvent event)
        -
      • -
      - - - - - - - -
        -
      • -

        mouseMoved

        -
        public void mouseMoved(MouseEvent event)
        -
      • -
      - - - -
        -
      • -

        mouseEntered

        -
        public void mouseEntered()
        -
      • -
      - - - -
        -
      • -

        mouseEntered

        -
        public void mouseEntered(MouseEvent event)
        -
      • -
      - - - -
        -
      • -

        mouseExited

        -
        public void mouseExited()
        -
      • -
      - - - -
        -
      • -

        mouseExited

        -
        public void mouseExited(MouseEvent event)
        -
      • -
      - - - -
        -
      • -

        mouseWheel

        -
        public void mouseWheel()
        -
      • -
      - - - - - - - -
        -
      • -

        keyPressed

        -
        public void keyPressed()
        -
        ( begin auto-generated from keyPressed.xml ) - - The keyPressed() function is called once every time a key is - pressed. The key that was pressed is stored in the key variable. -

        - For non-ASCII keys, use the keyCode variable. The keys included - in the ASCII specification (BACKSPACE, TAB, ENTER, RETURN, ESC, and - DELETE) do not require checking to see if they key is coded, and you - should simply use the key variable instead of keyCode If - you're making cross-platform projects, note that the ENTER key is - commonly used on PCs and Unix and the RETURN key is used instead on - Macintosh. Check for both ENTER and RETURN to make sure your program - will work for all platforms. -

        - Because of how operating systems handle key repeats, holding down a key - may cause multiple calls to keyPressed() (and keyReleased() as well). - The rate of repeat is set by the operating system and how each computer - is configured. - - ( end auto-generated ) -

        Advanced

        - - 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.
        - 
        -
        -
        See Also:
        -
        key, -keyCode, -keyPressed, -keyReleased()
        -
        -
      • -
      - - - -
        -
      • -

        keyPressed

        -
        public void keyPressed(KeyEvent event)
        -
      • -
      - - - -
        -
      • -

        keyReleased

        -
        public void keyReleased()
        -
        ( begin auto-generated from keyReleased.xml ) - - The keyReleased() function is called once every time a key is - released. The key that was released will be stored in the key - variable. See key and keyReleased for more information. - - ( end auto-generated )
        -
        -
        See Also:
        -
        key, -keyCode, -keyPressed, -keyPressed()
        -
        -
      • -
      - - - -
        -
      • -

        keyReleased

        -
        public void keyReleased(KeyEvent event)
        -
      • -
      - - - -
        -
      • -

        keyTyped

        -
        public void keyTyped()
        -
        ( begin auto-generated from keyTyped.xml ) - - The keyTyped() function is called once every time a key is - pressed, but action keys such as Ctrl, Shift, and Alt are ignored. - Because of how operating systems handle key repeats, holding down a key - will cause multiple calls to keyTyped(), the rate is set by the - operating system and how each computer is configured. - - ( end auto-generated )
        -
        -
        See Also:
        -
        keyPressed, -key, -keyCode, -keyReleased()
        -
        -
      • -
      - - - -
        -
      • -

        keyTyped

        -
        public void keyTyped(KeyEvent event)
        -
      • -
      - - - -
        -
      • -

        focusGained

        -
        public void focusGained()
        -
      • -
      - - - -
        -
      • -

        focusLost

        -
        public void focusLost()
        -
      • -
      - - - -
        -
      • -

        millis

        -
        public int millis()
        -
        ( begin auto-generated from millis.xml ) - - Returns the number of milliseconds (thousandths of a second) since - starting an applet. This information is often used for timing animation - sequences. - - ( end auto-generated ) - -

        Advanced

        -

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

        -
        -
        See Also:
        -
        second(), -minute(), -hour(), -day(), -month(), -year()
        -
        -
      • -
      - - - -
        -
      • -

        second

        -
        public static int second()
        -
        ( begin auto-generated from second.xml ) - - Processing communicates with the clock on your computer. The - second() function returns the current second as a value from 0 - 59. - - ( end auto-generated )
        -
        -
        See Also:
        -
        millis(), -minute(), -hour(), -day(), -month(), -year()
        -
        -
      • -
      - - - -
        -
      • -

        minute

        -
        public static int minute()
        -
        ( begin auto-generated from minute.xml ) - - Processing communicates with the clock on your computer. The - minute() function returns the current minute as a value from 0 - 59. - - ( end auto-generated )
        -
        -
        See Also:
        -
        millis(), -second(), -hour(), -day(), -month(), -year()
        -
        -
      • -
      - - - -
        -
      • -

        hour

        -
        public static int hour()
        -
        ( begin auto-generated from hour.xml ) - - Processing communicates with the clock on your computer. The - hour() function returns the current hour as a value from 0 - 23. - - ( end auto-generated )
        -
        -
        See Also:
        -
        millis(), -second(), -minute(), -day(), -month(), -year()
        -
        -
      • -
      - - - -
        -
      • -

        day

        -
        public static int day()
        -
        ( begin auto-generated from day.xml ) - - Processing communicates with the clock on your computer. The - day() function returns the current day as a value from 1 - 31. - - ( end auto-generated ) -

        Advanced

        - 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()

        -
        -
        See Also:
        -
        millis(), -second(), -minute(), -hour(), -month(), -year()
        -
        -
      • -
      - - - -
        -
      • -

        month

        -
        public static int month()
        -
        ( begin auto-generated from month.xml ) - - Processing communicates with the clock on your computer. The - month() function returns the current month as a value from 1 - 12. - - ( end auto-generated )
        -
        -
        See Also:
        -
        millis(), -second(), -minute(), -hour(), -day(), -year()
        -
        -
      • -
      - - - -
        -
      • -

        year

        -
        public static int year()
        -
        ( begin auto-generated from year.xml ) - - Processing communicates with the clock on your computer. The - year() function returns the current year as an integer (2003, - 2004, 2005, etc). - - ( end auto-generated ) - The year() function returns the current year as an integer (2003, 2004, 2005, etc).
        -
        -
        See Also:
        -
        millis(), -second(), -minute(), -hour(), -day(), -month()
        -
        -
      • -
      - - - -
        -
      • -

        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. - - The screen only updates when the end of draw() is reached, so delay() - cannot be used to slow down drawing. For instance, you cannot use delay() - to control the timing of an animation. - - The delay() function should only be used for pausing scripts (i.e. - a script that needs to pause a few seconds before attempting a download, - or a sketch that needs to wait a few milliseconds before reading from - the serial port).
        -
      • -
      - - - -
        -
      • -

        frameRate

        -
        public void frameRate(float fps)
        -
        ( begin auto-generated from frameRate.xml ) - - Specifies the number of frames to be displayed every second. If the - processor is not fast enough to maintain the specified rate, it will not - be achieved. For example, the function call frameRate(30) will - attempt to refresh 30 times a second. It is recommended to set the frame - rate within setup(). The default rate is 60 frames per second. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        fps - number of desired frames per second
        -
        See Also:
        -
        frameRate, -frameCount, -setup(), -draw(), -loop(), -noLoop(), -redraw()
        -
        -
      • -
      - - - -
        -
      • -

        link

        -
        public void link(String url)
        -
        Links to a webpage either in the same window or in a new window. The - complete URL must be specified. - -

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        url - the complete URL, as a String in quotes
        -
        -
      • -
      - - - -
        -
      • -

        launch

        -
        public static void launch(String filename)
        -
        ( begin auto-generated from launch.xml ) - - Attempts to open an application or file using your platform's launcher. - The file parameter is a String specifying the file name and - location. The location parameter must be a full path name, or the name - of an executable in the system's PATH. In most cases, using a full path - is the best option, rather than relying on the system PATH. Be sure to - make the file executable before attempting to open it (chmod +x). -

        - The args parameter is a String or String array which is passed to - the command line. If you have multiple parameters, e.g. an application - and a document, or a command with multiple switches, use the version - that takes a String array, and place each individual item in a separate - element. -

        - If args is a String (not an array), then it can only be a single file or - application with no parameters. It's not the same as executing that - String using a shell. For instance, open("jikes -help") will not work properly. -

        - This function behaves differently on each platform. On Windows, the - parameters are sent to the Windows shell via "cmd /c". On Mac OS X, the - "open" command is used (type "man open" in Terminal.app for - documentation). On Linux, it first tries gnome-open, then kde-open, but - if neither are available, it sends the command to the shell without any - alterations. -

        - For users familiar with Java, this is not quite the same as - Runtime.exec(), because the launcher command is prepended. Instead, the - exec(String[]) function is a shortcut for - Runtime.getRuntime.exec(String[]). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of the file
        -
        -
      • -
      - - - -
        -
      • -

        launch

        -
        public static Process launch(String... args)
        -
        Launch a process using the platform's 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).
        -
        -
        Parameters:
        -
        args - list of commands passed to the command line
        -
        -
      • -
      - - - - - - - -
        -
      • -

        die

        -
        public void die(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(String what,
        -                Exception e)
        -
        Same as above but with an exception. Also needs work.
        -
      • -
      - - - -
        -
      • -

        exit

        -
        public void exit()
        -
        ( begin auto-generated from exit.xml ) - - Quits/stops/exits the program. Programs without a draw() function - exit automatically after the last line has run, but programs with - draw() run continuously until the program is manually stopped or - exit() is run.
        -
        - Rather than terminating immediately, exit() will cause the sketch - to exit after draw() has completed (or after setup() - completes if called during the setup() function).
        -
        - For Java programmers, this is not the same as System.exit(). - Further, System.exit() should not be used because closing out an - application while draw() is running may cause a crash - (particularly with P3D). - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        exitCalled

        -
        public boolean exitCalled()
        -
      • -
      - - - -
        -
      • -

        exitActual

        -
        public void exitActual()
        -
        Some subclasses (I'm looking at you, processing.py) might wish to do something - other than actually terminate the JVM. This gives them a chance to do whatever - they have in mind when cleaning up.
        -
      • -
      - - - -
        -
      • -

        dispose

        -
        public void dispose()
        -
        Called to dispose of resources and shut down the sketch. - Destroys the thread, dispose the renderer,and notify listeners. -

        - Not to be called or overriden by users. If called multiple times, - will only notify listeners once. Register a dispose listener instead.

        -
      • -
      - - - -
        -
      • -

        method

        -
        public void method(String name)
        -
        Call a method in the current class based on its name. -

        - Note that the function being called must be public. Inside the PDE, - 'public' is automatically added, but when used without the preprocessor, - (like from Eclipse) you'll have to do it yourself.

        -
      • -
      - - - -
        -
      • -

        thread

        -
        public void thread(String name)
        -
        Launch a new thread and call the specified function from that new thread. - This is a very simple way to do a thread without needing to get into - classes, runnables, etc. -

        - Note that the function being called must be public. Inside the PDE, - 'public' is automatically added, but when used without the preprocessor, - (like from Eclipse) you'll have to do it yourself.

        -
        -
        Parameters:
        -
        name - name of the function to be executed in a separate thread
        -
        See Also:
        -
        setup(), -draw(), -loop(), -noLoop()
        -
        -
      • -
      - - - -
        -
      • -

        save

        -
        public void save(String filename)
        -
        ( begin auto-generated from save.xml ) - - Saves an image from the display window. Images are saved in TIFF, TARGA, - JPEG, and PNG format depending on the extension within the - filename parameter. For example, "image.tif" will have a TIFF - image and "image.png" will save a PNG image. If no extension is included - in the filename, the image will save in TIFF format and .tif will - be added to the name. These files are saved to the sketch's folder, - which may be opened by selecting "Show sketch folder" from the "Sketch" - menu. It is not possible to use save() while running the program - in a web browser. -
        images saved from the main drawing window will be opaque. To save - images without a background, use createGraphics(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - any sequence of letters and numbers
        -
        See Also:
        -
        saveFrame(), -createGraphics(int, int, String)
        -
        -
      • -
      - - - -
        -
      • -

        saveFrame

        -
        public void saveFrame()
        -
      • -
      - - - -
        -
      • -

        saveFrame

        -
        public void saveFrame(String filename)
        -
        ( begin auto-generated from saveFrame.xml ) - - Saves a numbered sequence of images, one image each time the function is - run. To save an image that is identical to the display window, run the - function at the end of draw() or within mouse and key events such - as mousePressed() and keyPressed(). If saveFrame() - is called without parameters, it will save the files as screen-0000.tif, - screen-0001.tif, etc. It is possible to specify the name of the sequence - with the filename parameter and make the choice of saving TIFF, - TARGA, PNG, or JPEG files with the ext parameter. These image - sequences can be loaded into programs such as Apple's QuickTime software - and made into movies. These files are saved to the sketch's folder, - which may be opened by selecting "Show sketch folder" from the "Sketch" - menu.
        -
        - It is not possible to use saveXxxxx() functions inside a web browser - unless the sketch is signed applet. To - save a file back to a server, see the save to - web code snippet on the Processing Wiki.
        -
        - All images saved from the main drawing window will be opaque. To save - images without a background, use createGraphics(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - any sequence of letters or numbers that ends with either ".tif", ".tga", ".jpg", or ".png"
        -
        See Also:
        -
        save(String), -createGraphics(int, int, String, String), -frameCount
        -
        -
      • -
      - - - -
        -
      • -

        insertFrame

        -
        public String insertFrame(String what)
        -
        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.
        -
      • -
      - - - -
        -
      • -

        cursor

        -
        public void cursor(int kind)
        -
        Set the cursor type
        -
        -
        Parameters:
        -
        kind - either ARROW, CROSS, HAND, MOVE, TEXT, or WAIT
        -
        -
      • -
      - - - -
        -
      • -

        cursor

        -
        public void cursor(PImage img)
        -
        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 img,
        -                   int x,
        -                   int y)
        -
        ( begin auto-generated from cursor.xml ) - - Sets the cursor to a predefined symbol, an image, or makes it visible if - already hidden. If you are trying to set an image as the cursor, it is - recommended to make the size 16x16 or 32x32 pixels. It is not possible - to load an image as the cursor if you are exporting your program for the - Web and not all MODES work with all Web browsers. The values for - parameters x and y must be less than the dimensions of the image. -

        - Setting or hiding the cursor generally does not work with "Present" mode - (when running full-screen). - - ( end auto-generated ) -

        Advanced

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

        -
        -
        Parameters:
        -
        img - any variable of type PImage
        -
        x - the horizontal active spot of the cursor
        -
        y - the vertical active spot of the cursor
        -
        See Also:
        -
        noCursor()
        -
        -
      • -
      - - - -
        -
      • -

        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()
        -
        ( begin auto-generated from noCursor.xml ) - - Hides the cursor from view. Will not work when running the program in a - web browser or when running in full screen (Present) mode. - - ( end auto-generated ) -

        Advanced

        - Hide the cursor by creating a transparent image - and using it as a custom cursor.
        -
        -
        See Also:
        -
        cursor()
        -
        -
      • -
      - - - -
        -
      • -

        print

        -
        public static void print(byte what)
        -
        ( begin auto-generated from print.xml ) - - Writes to the console area of the Processing environment. This is often - helpful for looking at the data a program is producing. The companion - function println() works like print(), but creates a new - line of text for each call to the function. Individual elements can be - separated with quotes ("") and joined with the addition operator (+).
        -
        - Beginning with release 0125, to print the contents of an array, use - println(). There's no sensible way to do a print() of an array, - because there are too many possibilities for how to separate the data - (spaces, commas, etc). If you want to print an array as a single line, - use join(). With join(), you can choose any delimiter you - like and print() the result.
        -
        - Using print() on an object will output null, a memory - location that may look like "@10be08," or the result of the - toString() method from the object that's being printed. Advanced - users who want more useful output when calling print() on their - own classes can add a toString() method to the class that returns - a String. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        what - data to print to console
        -
        See Also:
        -
        println(), -printArray(Object), -join(String[], char)
        -
        -
      • -
      - - - -
        -
      • -

        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(long what)
        -
      • -
      - - - -
        -
      • -

        print

        -
        public static void print(float what)
        -
      • -
      - - - -
        -
      • -

        print

        -
        public static void print(double what)
        -
      • -
      - - - -
        -
      • -

        print

        -
        public static void print(String what)
        -
      • -
      - - - -
        -
      • -

        print

        -
        public static void print(Object... variables)
        -
        -
        Parameters:
        -
        variables - list of data, separated by commas
        -
        -
      • -
      - - - -
        -
      • -

        println

        -
        public static void println()
        -
        ( begin auto-generated from println.xml ) - - Writes to the text area of the Processing environment's console. This is - often helpful for looking at the data a program is producing. Each call - to this function creates a new line of output. Individual elements can - be separated with quotes ("") and joined with the string concatenation - operator (+). See print() for more about what to expect in the output. -

        println() on an array (by itself) will write the - contents of the array to the console. This is often helpful for looking - at the data a program is producing. A new line is put between each - element of the array. This function can only print one dimensional - arrays. For arrays with higher dimensions, the result will be closer to - that of print(). - - ( end auto-generated )
        -
        -
        See Also:
        -
        print(byte), -printArray(Object)
        -
        -
      • -
      - - - -
        -
      • -

        println

        -
        public static void println(byte what)
        -
        -
        Parameters:
        -
        what - data to print to console
        -
        -
      • -
      - - - -
        -
      • -

        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(long what)
        -
      • -
      - - - -
        -
      • -

        println

        -
        public static void println(float what)
        -
      • -
      - - - -
        -
      • -

        println

        -
        public static void println(double what)
        -
      • -
      - - - -
        -
      • -

        println

        -
        public static void println(String what)
        -
      • -
      - - - -
        -
      • -

        println

        -
        public static void println(Object... variables)
        -
        -
        Parameters:
        -
        variables - list of data, separated by commas
        -
        -
      • -
      - - - -
        -
      • -

        println

        -
        public static void println(Object what)
        -
        For arrays, use printArray() instead. This function causes a warning - because the new print(Object...) and println(Object...) functions can't - be reliably bound by the compiler.
        -
      • -
      - - - -
        -
      • -

        printArray

        -
        public static void printArray(Object what)
        -
        ( begin auto-generated from printArray.xml ) - - To come... - - ( end auto-generated )
        -
        -
        Parameters:
        -
        what - one-dimensional array
        -
        See Also:
        -
        print(byte), -println()
        -
        -
      • -
      - - - -
        -
      • -

        debug

        -
        public static void debug(String msg)
        -
      • -
      - - - -
        -
      • -

        abs

        -
        public static final float abs(float n)
        -
        ( begin auto-generated from abs.xml ) - - Calculates the absolute value (magnitude) of a number. The absolute - value of a number is always positive. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - number to compute
        -
        -
      • -
      - - - -
        -
      • -

        abs

        -
        public static final int abs(int n)
        -
      • -
      - - - -
        -
      • -

        sq

        -
        public static final float sq(float n)
        -
        ( begin auto-generated from sq.xml ) - - Squares a number (multiplies a number by itself). The result is always a - positive number, as multiplying two negative numbers always yields a - positive result. For example, -1 * -1 = 1. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - number to square
        -
        See Also:
        -
        sqrt(float)
        -
        -
      • -
      - - - -
        -
      • -

        sqrt

        -
        public static final float sqrt(float n)
        -
        ( begin auto-generated from sqrt.xml ) - - Calculates the square root of a number. The square root of a number is - always positive, even though there may be a valid negative root. The - square root s of number a is such that s*s = a. It - is the opposite of squaring. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - non-negative number
        -
        See Also:
        -
        pow(float, float), -sq(float)
        -
        -
      • -
      - - - -
        -
      • -

        log

        -
        public static final float log(float n)
        -
        ( begin auto-generated from log.xml ) - - Calculates the natural logarithm (the base-e logarithm) of a - number. This function expects the values greater than 0.0. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - number greater than 0.0
        -
        -
      • -
      - - - -
        -
      • -

        exp

        -
        public static final float exp(float n)
        -
        ( begin auto-generated from exp.xml ) - - Returns Euler's number e (2.71828...) raised to the power of the - value parameter. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - exponent to raise
        -
        -
      • -
      - - - -
        -
      • -

        pow

        -
        public static final float pow(float n,
        -                              float e)
        -
        ( begin auto-generated from pow.xml ) - - Facilitates exponential expressions. The pow() function is an - efficient way of multiplying numbers by themselves (or their reciprocal) - in large quantities. For example, pow(3, 5) is equivalent to the - expression 3*3*3*3*3 and pow(3, -5) is equivalent to 1 / 3*3*3*3*3. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - base of the exponential expression
        -
        e - power by which to raise the base
        -
        See Also:
        -
        sqrt(float)
        -
        -
      • -
      - - - -
        -
      • -

        max

        -
        public static final int max(int a,
        -                            int b)
        -
        ( begin auto-generated from max.xml ) - - Determines the largest value in a sequence of numbers. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - first number to compare
        -
        b - second number to compare
        -
        See Also:
        -
        min(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        max

        -
        public static final float max(float a,
        -                              float b)
        -
      • -
      - - - -
        -
      • -

        max

        -
        public static final int max(int a,
        -                            int b,
        -                            int c)
        -
        -
        Parameters:
        -
        c - third number to compare
        -
        -
      • -
      - - - -
        -
      • -

        max

        -
        public static final float max(float a,
        -                              float b,
        -                              float c)
        -
      • -
      - - - -
        -
      • -

        max

        -
        public static final int max(int[] list)
        -
        -
        Parameters:
        -
        list - array of numbers to compare
        -
        -
      • -
      - - - -
        -
      • -

        max

        -
        public static final float max(float[] list)
        -
      • -
      - - - -
        -
      • -

        min

        -
        public static final int min(int a,
        -                            int b)
        -
        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 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)
        -
        ( begin auto-generated from min.xml ) - - Determines the smallest value in a sequence of numbers. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - first number
        -
        b - second number
        -
        c - third number
        -
        See Also:
        -
        max(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        min

        -
        public static final int min(int[] list)
        -
        -
        Parameters:
        -
        list - array of numbers to compare
        -
        -
      • -
      - - - -
        -
      • -

        min

        -
        public static final float min(float[] list)
        -
      • -
      - - - -
        -
      • -

        constrain

        -
        public static final int constrain(int amt,
        -                                  int low,
        -                                  int high)
        -
      • -
      - - - -
        -
      • -

        constrain

        -
        public static final float constrain(float amt,
        -                                    float low,
        -                                    float high)
        -
        ( begin auto-generated from constrain.xml ) - - Constrains a value to not exceed a maximum and minimum value. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        amt - the value to constrain
        -
        low - minimum limit
        -
        high - maximum limit
        -
        See Also:
        -
        max(float, float, float), -min(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        sin

        -
        public static final float sin(float angle)
        -
        ( begin auto-generated from sin.xml ) - - Calculates the sine of an angle. This function expects the values of the - angle parameter to be provided in radians (values from 0 to - 6.28). Values are returned in the range -1 to 1. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - an angle in radians
        -
        See Also:
        -
        cos(float), -tan(float), -radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        cos

        -
        public static final float cos(float angle)
        -
        ( begin auto-generated from cos.xml ) - - Calculates the cosine of an angle. This function expects the values of - the angle parameter to be provided in radians (values from 0 to - PI*2). Values are returned in the range -1 to 1. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - an angle in radians
        -
        See Also:
        -
        sin(float), -tan(float), -radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        tan

        -
        public static final float tan(float angle)
        -
        ( begin auto-generated from tan.xml ) - - Calculates the ratio of the sine and cosine of an angle. This function - expects the values of the angle parameter to be provided in - radians (values from 0 to PI*2). Values are returned in the range - infinity to -infinity. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - an angle in radians
        -
        See Also:
        -
        cos(float), -sin(float), -radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        asin

        -
        public static final float asin(float value)
        -
        ( begin auto-generated from asin.xml ) - - The inverse of sin(), returns the arc sine of a value. This - function expects the values in the range of -1 to 1 and values are - returned in the range -PI/2 to PI/2. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - the value whose arc sine is to be returned
        -
        See Also:
        -
        sin(float), -acos(float), -atan(float)
        -
        -
      • -
      - - - -
        -
      • -

        acos

        -
        public static final float acos(float value)
        -
        ( begin auto-generated from acos.xml ) - - The inverse of cos(), returns the arc cosine of a value. This - function expects the values in the range of -1 to 1 and values are - returned in the range 0 to PI (3.1415927). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - the value whose arc cosine is to be returned
        -
        See Also:
        -
        cos(float), -asin(float), -atan(float)
        -
        -
      • -
      - - - -
        -
      • -

        atan

        -
        public static final float atan(float value)
        -
        ( begin auto-generated from atan.xml ) - - The inverse of tan(), returns the arc tangent of a value. This - function expects the values in the range of -Infinity to Infinity - (exclusive) and values are returned in the range -PI/2 to PI/2 . - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - -Infinity to Infinity (exclusive)
        -
        See Also:
        -
        tan(float), -asin(float), -acos(float)
        -
        -
      • -
      - - - -
        -
      • -

        atan2

        -
        public static final float atan2(float y,
        -                                float x)
        -
        ( begin auto-generated from atan2.xml ) - - Calculates the angle (in radians) from a specified point to the - coordinate origin as measured from the positive x-axis. Values are - returned as a float in the range from PI to -PI. - The atan2() function is most often used for orienting geometry to - the position of the cursor. Note: The y-coordinate of the point is the - first parameter and the x-coordinate is the second due the the structure - of calculating the tangent. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        y - y-coordinate of the point
        -
        x - x-coordinate of the point
        -
        See Also:
        -
        tan(float)
        -
        -
      • -
      - - - -
        -
      • -

        degrees

        -
        public static final float degrees(float radians)
        -
        ( begin auto-generated from degrees.xml ) - - Converts a radian measurement to its corresponding value in degrees. - Radians and degrees are two ways of measuring the same thing. There are - 360 degrees in a circle and 2*PI radians in a circle. For example, - 90° = PI/2 = 1.5707964. All trigonometric functions in Processing - require their parameters to be specified in radians. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        radians - radian value to convert to degrees
        -
        See Also:
        -
        radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        radians

        -
        public static final float radians(float degrees)
        -
        ( begin auto-generated from radians.xml ) - - Converts a degree measurement to its corresponding value in radians. - Radians and degrees are two ways of measuring the same thing. There are - 360 degrees in a circle and 2*PI radians in a circle. For example, - 90° = PI/2 = 1.5707964. All trigonometric functions in Processing - require their parameters to be specified in radians. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        degrees - degree value to convert to radians
        -
        See Also:
        -
        degrees(float)
        -
        -
      • -
      - - - -
        -
      • -

        ceil

        -
        public static final int ceil(float n)
        -
        ( begin auto-generated from ceil.xml ) - - Calculates the closest int value that is greater than or equal to the - value of the parameter. For example, ceil(9.03) returns the value 10. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - number to round up
        -
        See Also:
        -
        floor(float), -round(float)
        -
        -
      • -
      - - - -
        -
      • -

        floor

        -
        public static final int floor(float n)
        -
        ( begin auto-generated from floor.xml ) - - Calculates the closest int value that is less than or equal to the value - of the parameter. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - number to round down
        -
        See Also:
        -
        ceil(float), -round(float)
        -
        -
      • -
      - - - -
        -
      • -

        round

        -
        public static final int round(float n)
        -
        ( begin auto-generated from round.xml ) - - Calculates the integer closest to the value parameter. For - example, round(9.2) returns the value 9. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - number to round
        -
        See Also:
        -
        floor(float), -ceil(float)
        -
        -
      • -
      - - - -
        -
      • -

        mag

        -
        public static final float mag(float a,
        -                              float b)
        -
      • -
      - - - -
        -
      • -

        mag

        -
        public static final float mag(float a,
        -                              float b,
        -                              float c)
        -
        ( begin auto-generated from mag.xml ) - - Calculates the magnitude (or length) of a vector. A vector is a - direction in space commonly used in computer graphics and linear - algebra. Because it has no "start" position, the magnitude of a vector - can be thought of as the distance from coordinate (0,0) to its (x,y) - value. Therefore, mag() is a shortcut for writing "dist(0, 0, x, y)". - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - first value
        -
        b - second value
        -
        c - third value
        -
        See Also:
        -
        dist(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from dist.xml ) - - Calculates the distance between two points. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        z1 - z-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        z2 - z-coordinate of the second point
        -
        -
      • -
      - - - - - - - -
        -
      • -

        norm

        -
        public static final float norm(float value,
        -                               float start,
        -                               float stop)
        -
        ( begin auto-generated from norm.xml ) - - Normalizes a number from another range into a value between 0 and 1. -

        - Identical to map(value, low, high, 0, 1); -

        - Numbers outside the range are not clamped to 0 and 1, because - out-of-range values are often intentional and useful. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - the incoming value to be converted
        -
        start - lower bound of the value's current range
        -
        stop - upper bound of the value's current range
        -
        See Also:
        -
        map(float, float, float, float, float), -lerp(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        map

        -
        public static final float map(float value,
        -                              float start1,
        -                              float stop1,
        -                              float start2,
        -                              float stop2)
        -
        ( begin auto-generated from map.xml ) - - Re-maps a number from one range to another. In the example above, - the number '25' is converted from a value in the range 0..100 into - a value that ranges from the left edge (0) to the right edge (width) - of the screen. -

        - Numbers outside the range are not clamped to 0 and 1, because - out-of-range values are often intentional and useful. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - the incoming value to be converted
        -
        start1 - lower bound of the value's current range
        -
        stop1 - upper bound of the value's current range
        -
        start2 - lower bound of the value's target range
        -
        stop2 - upper bound of the value's target range
        -
        See Also:
        -
        norm(float, float, float), -lerp(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        random

        -
        public final float random(float high)
        -
      • -
      - - - -
        -
      • -

        randomGaussian

        -
        public final float randomGaussian()
        -
        ( begin auto-generated from randomGaussian.xml ) - - Returns a float from a random series of numbers having a mean of 0 - and standard deviation of 1. Each time the randomGaussian() - function is called, it returns a number fitting a Gaussian, or - normal, distribution. There is theoretically no minimum or maximum - value that randomGaussian() might return. Rather, there is - just a very low probability that values far from the mean will be - returned; and a higher probability that numbers near the mean will - be returned. - - ( end auto-generated )
        -
        -
        See Also:
        -
        random(float,float), -noise(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        random

        -
        public final float random(float low,
        -                          float high)
        -
        ( begin auto-generated from random.xml ) - - Generates random numbers. Each time the random() function is - called, it returns an unexpected value within the specified range. If - one parameter is passed to the function it will return a float - between zero and the value of the high parameter. The function - call random(5) returns values between 0 and 5 (starting at zero, - up to but not including 5). If two parameters are passed, it will return - a float with a value between the the parameters. The function - call random(-5, 10.2) returns values starting at -5 up to (but - not including) 10.2. To convert a floating-point random number to an - integer, use the int() function. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        low - lower limit
        -
        high - upper limit
        -
        See Also:
        -
        randomSeed(long), -noise(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        randomSeed

        -
        public final void randomSeed(long seed)
        -
        ( begin auto-generated from randomSeed.xml ) - - Sets the seed value for random(). By default, random() - produces different results each time the program is run. Set the - value parameter to a constant to return the same pseudo-random - numbers each time the software is run. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        seed - seed value
        -
        See Also:
        -
        random(float,float), -noise(float, float, float), -noiseSeed(long)
        -
        -
      • -
      - - - -
        -
      • -

        noise

        -
        public float noise(float x)
        -
      • -
      - - - -
        -
      • -

        noise

        -
        public float noise(float x,
        -                   float y)
        -
      • -
      - - - -
        -
      • -

        noise

        -
        public float noise(float x,
        -                   float y,
        -                   float z)
        -
        ( begin auto-generated from noise.xml ) - - Returns the Perlin noise value at specified coordinates. Perlin noise is - a random sequence generator producing a more natural ordered, harmonic - succession of numbers compared to the standard random() function. - It was invented by Ken Perlin in the 1980s and been used since in - graphical applications to produce procedural textures, natural motion, - shapes, terrains etc.

        The main difference to the - random() function is that Perlin noise is defined in an infinite - n-dimensional space where each pair of coordinates corresponds to a - fixed semi-random value (fixed only for the lifespan of the program). - The resulting value will always be between 0.0 and 1.0. Processing can - compute 1D, 2D and 3D noise, depending on the number of coordinates - given. The noise value can be animated by moving through the noise space - as demonstrated in the example above. The 2nd and 3rd dimension can also - be interpreted as time.

        The actual noise is structured - similar to an audio signal, in respect to the function's use of - frequencies. Similar to the concept of harmonics in physics, perlin - noise is computed over several octaves which are added together for the - final result.

        Another way to adjust the character of the - resulting sequence is the scale of the input coordinates. As the - function works within an infinite space the value of the coordinates - doesn't matter as such, only the distance between successive coordinates - does (eg. when using noise() within a loop). As a general rule - the smaller the difference between coordinates, the smoother the - resulting noise sequence will be. Steps of 0.005-0.03 work best for most - applications, but this will differ depending on use. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - x-coordinate in noise space
        -
        y - y-coordinate in noise space
        -
        z - z-coordinate in noise space
        -
        See Also:
        -
        noiseSeed(long), -noiseDetail(int, float), -random(float,float)
        -
        -
      • -
      - - - -
        -
      • -

        noiseDetail

        -
        public void noiseDetail(int lod)
        -
        ( begin auto-generated from noiseDetail.xml ) - - Adjusts the character and level of detail produced by the Perlin noise - function. Similar to harmonics in physics, noise is computed over - several octaves. Lower octaves contribute more to the output signal and - as such define the overal intensity of the noise, whereas higher octaves - create finer grained details in the noise sequence. By default, noise is - computed over 4 octaves with each octave contributing exactly half than - its predecessor, starting at 50% strength for the 1st octave. This - falloff amount can be changed by adding an additional function - parameter. Eg. a falloff factor of 0.75 means each octave will now have - 75% impact (25% less) of the previous lower octave. Any value between - 0.0 and 1.0 is valid, however note that values greater than 0.5 might - result in greater than 1.0 values returned by noise().

        By changing these parameters, the signal created by the noise() - function can be adapted to fit very specific needs and characteristics. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        lod - number of octaves to be used by the noise
        -
        falloff - falloff factor for each octave
        -
        See Also:
        -
        noise(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        noiseDetail

        -
        public void noiseDetail(int lod,
        -                        float falloff)
        -
        -
        Parameters:
        -
        falloff - falloff factor for each octave
        -
        -
      • -
      - - - -
        -
      • -

        noiseSeed

        -
        public void noiseSeed(long seed)
        -
        ( begin auto-generated from noiseSeed.xml ) - - Sets the seed value for noise(). By default, noise() - produces different results each time the program is run. Set the - value parameter to a constant to return the same pseudo-random - numbers each time the software is run. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        seed - seed value
        -
        See Also:
        -
        noise(float, float, float), -noiseDetail(int, float), -random(float,float), -randomSeed(long)
        -
        -
      • -
      - - - -
        -
      • -

        loadImage

        -
        public PImage loadImage(String filename)
        -
        ( begin auto-generated from loadImage.xml ) - - Loads an image into a variable of type PImage. Four types of - images ( .gif, .jpg, .tga, .png) images may - be loaded. To load correctly, images must be located in the data - directory of the current sketch. In most cases, load all images in - setup() to preload them at the start of the program. Loading - images inside draw() will reduce the speed of a program.
        -
        filename parameter can also be a URL to a file found - online. For security reasons, a Processing sketch found online can only - download files from the same server from which it came. Getting around - this restriction requires a signed - applet.
        -
        extension parameter is used to determine the image type in - cases where the image filename does not end with a proper extension. - Specify the extension as the second parameter to loadImage(), as - shown in the third example on this page.
        -
        an image is not loaded successfully, the null value is - returned and an error message will be printed to the console. The error - message does not halt the program, however the null value may cause a - NullPointerException if your code does not check whether the value - returned from loadImage() is null.
        -
        on the type of error, a PImage object may still be - returned, but the width and height of the image will be set to -1. This - happens if bad image data is returned or cannot be decoded properly. - Sometimes this happens with image URLs that produce a 403 error or that - redirect to a password prompt, because loadImage() will attempt - to interpret the HTML as image data. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of file to load, can be .gif, .jpg, .tga, or a handful of other image types depending on your platform
        -
        See Also:
        -
        PImage, -PGraphics.image(PImage, float, float, float, float), -PGraphics.imageMode(int), -PGraphics.background(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        loadImage

        -
        public PImage loadImage(String filename,
        -                        String extension)
        -
        -
        Parameters:
        -
        extension - type of image to load, for example "png", "gif", "jpg"
        -
        -
      • -
      - - - -
        -
      • -

        requestImage

        -
        public PImage requestImage(String filename)
        -
      • -
      - - - -
        -
      • -

        requestImage

        -
        public PImage requestImage(String filename,
        -                           String extension)
        -
        ( begin auto-generated from requestImage.xml ) - - This function load images on a separate thread so that your sketch does - not freeze while images load during setup(). While the image is - loading, its width and height will be 0. If an error occurs while - loading the image, its width and height will be set to -1. You'll know - when the image has loaded properly because its width and height will be - greater than 0. Asynchronous image loading (particularly when - downloading from a server) can dramatically improve performance.
        -
        extension parameter is used to determine the image type in - cases where the image filename does not end with a proper extension. - Specify the extension as the second parameter to requestImage(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of the file to load, can be .gif, .jpg, .tga, or a handful of other image types depending on your platform
        -
        extension - the type of image to load, for example "png", "gif", "jpg"
        -
        See Also:
        -
        PImage, -loadImage(String, String)
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        parseXML

        -
        public XML parseXML(String xmlString,
        -                    String options)
        -
      • -
      - - - -
        -
      • -

        saveXML

        -
        public boolean saveXML(XML xml,
        -                       String filename)
        -
        -
        Parameters:
        -
        xml - the XML object to save to disk
        -
        filename - name of the file to write to
        -
        See Also:
        -
        XML, -loadXML(String), -parseXML(String)
        -
        -
      • -
      - - - -
        -
      • -

        saveXML

        -
        public boolean saveXML(XML xml,
        -                       String filename,
        -                       String options)
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        loadJSONObject

        -
        public static JSONObject loadJSONObject(File file)
        -
      • -
      - - - - - - - -
        -
      • -

        saveJSONObject

        -
        public boolean saveJSONObject(JSONObject json,
        -                              String filename,
        -                              String options)
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        loadJSONArray

        -
        public static JSONArray loadJSONArray(File file)
        -
      • -
      - - - - - - - -
        -
      • -

        saveJSONArray

        -
        public boolean saveJSONArray(JSONArray json,
        -                             String filename,
        -                             String options)
        -
      • -
      - - - - - - - -
        -
      • -

        loadTable

        -
        public Table loadTable(String filename,
        -                       String options)
        -
        Options may contain "header", "tsv", "csv", or "bin" separated by commas. - - Another option is "dictionary=filename.tsv", which allows users to - specify a "dictionary" file that contains a mapping of the column titles - and the data types used in the table file. This can be far more efficient - (in terms of speed and memory usage) for loading and parsing tables. The - dictionary file can only be tab separated values (.tsv) and its extension - will be ignored. This option was added in Processing 2.0.2.
        -
      • -
      - - - -
        -
      • -

        saveTable

        -
        public boolean saveTable(Table table,
        -                         String filename)
        -
        -
        Parameters:
        -
        table - the Table object to save to a file
        -
        filename - the filename to which the Table should be saved
        -
        See Also:
        -
        Table, -loadTable(String)
        -
        -
      • -
      - - - -
        -
      • -

        saveTable

        -
        public boolean saveTable(Table table,
        -                         String filename,
        -                         String options)
        -
        -
        Parameters:
        -
        options - can be one of "tsv", "csv", "bin", or "html"
        -
        -
      • -
      - - - -
        -
      • -

        loadFont

        -
        public PFont loadFont(String filename)
        -
        ( begin auto-generated from loadFont.xml ) - - Loads a font into a variable of type PFont. To load correctly, - fonts must be located in the data directory of the current sketch. To - create a font to use with Processing, select "Create Font..." from the - Tools menu. This will create a font in the format Processing requires - and also adds it to the current sketch's data directory.
        -
        - Like loadImage() and other functions that load data, the - loadFont() function should not be used inside draw(), - because it will slow down the sketch considerably, as the font will be - re-loaded from the disk (or network) on each frame.
        -
        - For most renderers, Processing displays fonts using the .vlw font - format, which uses images for each letter, rather than defining them - through vector data. When hint(ENABLE_NATIVE_FONTS) is used with - the JAVA2D renderer, the native version of a font will be used if it is - installed on the user's machine.
        -
        - Using createFont() (instead of loadFont) enables vector data to - be used with the JAVA2D (default) renderer setting. This can be helpful - when many font sizes are needed, or when using any renderer based on - JAVA2D, such as the PDF library. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of the font to load
        -
        See Also:
        -
        PFont, -PGraphics.textFont(PFont, float), -createFont(String, float, boolean, char[])
        -
        -
      • -
      - - - -
        -
      • -

        createFont

        -
        public PFont createFont(String name,
        -                        float size)
        -
      • -
      - - - -
        -
      • -

        createFont

        -
        public PFont createFont(String name,
        -                        float size,
        -                        boolean smooth)
        -
      • -
      - - - -
        -
      • -

        createFont

        -
        public PFont createFont(String name,
        -                        float size,
        -                        boolean smooth,
        -                        char[] charset)
        -
        ( begin auto-generated from createFont.xml ) - - Dynamically converts a font to the format used by Processing from either - a font name that's installed on the computer, or from a .ttf or .otf - file inside the sketches "data" folder. This function is an advanced - feature for precise control. On most occasions you should create fonts - through selecting "Create Font..." from the Tools menu. -

        - Use the PFont.list() method to first determine the names for the - fonts recognized by the computer and are compatible with this function. - Because of limitations in Java, not all fonts can be used and some might - work with one operating system and not others. When sharing a sketch - with other people or posting it on the web, you may need to include a - .ttf or .otf version of your font in the data directory of the sketch - because other people might not have the font installed on their - computer. Only fonts that can legally be distributed should be included - with a sketch. -

        - The size parameter states the font size you want to generate. The - smooth parameter specifies if the font should be antialiased or - not, and the charset parameter is an array of chars that - specifies the characters to generate. -

        - This function creates a bitmapped version of a font in the same manner - as the Create Font tool. It loads a font by name, and converts it to a - series of images based on the size of the font. When possible, the - text() function will use a native font rather than the bitmapped - version created behind the scenes with createFont(). For - instance, when using P2D, the actual native version of the font will be - employed by the sketch, improving drawing quality and performance. With - the P3D renderer, the bitmapped version will be used. While this can - drastically improve speed and appearance, results are poor when - exporting if the sketch does not include the .otf or .ttf file, and the - requested font is not available on the machine running the sketch. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        name - name of the font to load
        -
        size - point size of the font
        -
        smooth - true for an antialiased font, false for aliased
        -
        charset - array containing characters to be generated
        -
        See Also:
        -
        PFont, -PGraphics.textFont(PFont, float), -PGraphics#text(String, float, float, float, float, float), -loadFont(String)
        -
        -
      • -
      - - - -
        -
      • -

        selectInput

        -
        public void selectInput(String prompt,
        -                        String callback)
        -
        Open a platform-specific file chooser dialog to select a file for input. - After the selection is made, the selected File will be passed to the - 'callback' function. If the dialog is closed or canceled, null will be - sent to the function, so that the program is not waiting for additional - input. The callback is necessary because of how threading works. - -
        - void setup() {
        -   selectInput("Select a file to process:", "fileSelected");
        - }
        -
        - void fileSelected(File selection) {
        -   if (selection == null) {
        -     println("Window was closed or the user hit cancel.");
        -   } else {
        -     println("User selected " + fileSeleted.getAbsolutePath());
        -   }
        - }
        - 
        - - For advanced users, the method must be 'public', which is true for all - methods inside a sketch when run from the PDE, but must explicitly be - set when using Eclipse or other development environments.
        -
        -
        Parameters:
        -
        prompt - message to the user
        -
        callback - name of the method to be called when the selection is made
        -
        -
      • -
      - - - -
        -
      • -

        selectInput

        -
        public void selectInput(String prompt,
        -                        String callback,
        -                        File file)
        -
      • -
      - - - -
        -
      • -

        selectInput

        -
        public void selectInput(String prompt,
        -                        String callback,
        -                        File file,
        -                        Object callbackObject)
        -
      • -
      - - - -
        -
      • -

        selectInput

        -
        public static void selectInput(String prompt,
        -                               String callbackMethod,
        -                               File file,
        -                               Object callbackObject,
        -                               Frame parent)
        -
      • -
      - - - -
        -
      • -

        selectOutput

        -
        public void selectOutput(String prompt,
        -                         String callback)
        -
        See selectInput() for details.
        -
        -
        Parameters:
        -
        prompt - message to the user
        -
        callback - name of the method to be called when the selection is made
        -
        -
      • -
      - - - -
        -
      • -

        selectOutput

        -
        public void selectOutput(String prompt,
        -                         String callback,
        -                         File file)
        -
      • -
      - - - -
        -
      • -

        selectOutput

        -
        public void selectOutput(String prompt,
        -                         String callback,
        -                         File file,
        -                         Object callbackObject)
        -
      • -
      - - - -
        -
      • -

        selectOutput

        -
        public static void selectOutput(String prompt,
        -                                String callbackMethod,
        -                                File file,
        -                                Object callbackObject,
        -                                Frame parent)
        -
      • -
      - - - -
        -
      • -

        selectFolder

        -
        public void selectFolder(String prompt,
        -                         String callback)
        -
        See selectInput() for details.
        -
        -
        Parameters:
        -
        prompt - message to the user
        -
        callback - name of the method to be called when the selection is made
        -
        -
      • -
      - - - -
        -
      • -

        selectFolder

        -
        public void selectFolder(String prompt,
        -                         String callback,
        -                         File file)
        -
      • -
      - - - -
        -
      • -

        selectFolder

        -
        public void selectFolder(String prompt,
        -                         String callback,
        -                         File file,
        -                         Object callbackObject)
        -
      • -
      - - - -
        -
      • -

        selectFolder

        -
        public static void selectFolder(String prompt,
        -                                String callbackMethod,
        -                                File defaultSelection,
        -                                Object callbackObject,
        -                                Frame parentFrame)
        -
      • -
      - - - -
        -
      • -

        checkExtension

        -
        public static String checkExtension(String filename)
        -
        Get the compression-free extension for this filename.
        -
        -
        Parameters:
        -
        filename - The filename to check
        -
        Returns:
        -
        an extension, skipping past .gz if it's present
        -
        -
      • -
      - - - -
        -
      • -

        createReader

        -
        public BufferedReader createReader(String filename)
        -
        ( begin auto-generated from createReader.xml ) - - Creates a BufferedReader object that can be used to read files - line-by-line as individual String objects. This is the complement - to the createWriter() function. -

        - Starting with Processing release 0134, all files loaded and saved by the - Processing API use UTF-8 encoding. In previous releases, the default - encoding for your platform was used, which causes problems when files - are moved to other platforms. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of the file to be opened
        -
        See Also:
        -
        BufferedReader, -createWriter(String), -PrintWriter
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        createWriter

        -
        public PrintWriter createWriter(String filename)
        -
        ( begin auto-generated from createWriter.xml ) - - Creates a new file in the sketch folder, and a PrintWriter object - to write to it. For the file to be made correctly, it should be flushed - and must be closed with its flush() and close() methods - (see above example). -

        - Starting with Processing release 0134, all files loaded and saved by the - Processing API use UTF-8 encoding. In previous releases, the default - encoding for your platform was used, which causes problems when files - are moved to other platforms. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of the file to be created
        -
        See Also:
        -
        PrintWriter, -createReader(java.lang.String), -BufferedReader
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        createInput

        -
        public InputStream createInput(String filename)
        -
        ( begin auto-generated from createInput.xml ) - - This is a function for advanced programmers to open a Java InputStream. - It's useful if you want to use the facilities provided by PApplet to - easily open files from the data folder or from a URL, but want an - InputStream object so that you can use other parts of Java to take more - control of how the stream is read.
        -
        - The filename passed in can be:
        - - A URL, for instance openStream("http://processing.org/")
        - - A file in the sketch's data folder
        - - The full path to a file to be opened locally (when running as an - application)
        -
        - If the requested item doesn't exist, null is returned. If not online, - this will also check to see if the user is asking for a file whose name - isn't properly capitalized. If capitalization is different, an error - will be printed to the console. This helps prevent issues that appear - when a sketch is exported to the web, where case sensitivity matters, as - opposed to running from inside the Processing Development Environment on - Windows or Mac OS, where case sensitivity is preserved but ignored.
        -
        - If the file ends with .gz, the stream will automatically be gzip - decompressed. If you don't want the automatic decompression, use the - related function createInputRaw(). -
        - In earlier releases, this function was called openStream().
        -
        - - ( end auto-generated ) - -

        Advanced

        - 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) -
        -
        -
        Parameters:
        -
        filename - the name of the file to use as input
        -
        See Also:
        -
        createOutput(String), -PApplet#selectOutput(String), -PApplet#selectInput(String)
        -
        -
      • -
      - - - -
        -
      • -

        createInputRaw

        -
        public InputStream createInputRaw(String filename)
        -
        Call openStream() without automatic gzip decompression.
        -
      • -
      - - - - - - - -
        -
      • -

        loadBytes

        -
        public byte[] loadBytes(String filename)
        -
        ( begin auto-generated from loadBytes.xml ) - - Reads the contents of a file or url and places it in a byte array. If a - file is specified, it must be located in the sketch's "data" - directory/folder.
        -
        - The filename parameter can also be a URL to a file found online. For - security reasons, a Processing sketch found online can only download - files from the same server from which it came. Getting around this - restriction requires a signed applet. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of a file in the data folder or a URL.
        -
        See Also:
        -
        loadStrings(String), -saveStrings(String, String[]), -saveBytes(String, byte[])
        -
        -
      • -
      - - - -
        -
      • -

        loadBytes

        -
        public static byte[] loadBytes(InputStream input)
        -
      • -
      - - - -
        -
      • -

        loadBytes

        -
        public static byte[] loadBytes(File file)
        -
      • -
      - - - -
        -
      • -

        loadStrings

        -
        public static String[] loadStrings(File file)
        -
      • -
      - - - -
        -
      • -

        loadStrings

        -
        public String[] loadStrings(String filename)
        -
        ( begin auto-generated from loadStrings.xml ) - - Reads the contents of a file or url and creates a String array of its - individual lines. If a file is specified, it must be located in the - sketch's "data" directory/folder.
        -
        - The filename parameter can also be a URL to a file found online. For - security reasons, a Processing sketch found online can only download - files from the same server from which it came. Getting around this - restriction requires a signed applet. -
        - If the file is not available or an error occurs, null will be - returned and an error message will be printed to the console. The error - message does not halt the program, however the null value may cause a - NullPointerException if your code does not check whether the value - returned is null. -

        - Starting with Processing release 0134, all files loaded and saved by the - Processing API use UTF-8 encoding. In previous releases, the default - encoding for your platform was used, which causes problems when files - are moved to other platforms. - - ( end auto-generated ) - -

        Advanced

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

        -
        -
        Parameters:
        -
        filename - name of the file or url to load
        -
        See Also:
        -
        loadBytes(String), -saveStrings(String, String[]), -saveBytes(String, byte[])
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        createOutput

        -
        public OutputStream createOutput(String filename)
        -
        ( begin auto-generated from createOutput.xml ) - - Similar to createInput(), 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. -

        - This function is a convenience over the Java approach that requires you - to 1) create a FileOutputStream object, 2) determine the exact file - location, and 3) handle exceptions. Exceptions are handled internally by - the function, which is more appropriate for "sketch" projects. -

        - If the output filename ends with .gz, the output will be - automatically GZIP compressed as it is written. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of the file to open
        -
        See Also:
        -
        createInput(String), -PApplet#selectOutput()
        -
        -
      • -
      - - - - - - - -
        -
      • -

        saveStream

        -
        public boolean saveStream(String target,
        -                          String source)
        -
        ( begin auto-generated from saveStream.xml ) - - 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).
        -
        - When using the targetFile parameter, it writes to a File - object for greater control over the file location. (Note that unlike - some other functions, this will not automatically compress or uncompress - gzip files.) - - ( end auto-generated )
        -
        -
        Parameters:
        -
        target - name of the file to write to
        -
        source - location to read from (a filename, path, or URL)
        -
        See Also:
        -
        createOutput(String)
        -
        -
      • -
      - - - -
        -
      • -

        saveStream

        -
        public boolean saveStream(File target,
        -                          String source)
        -
        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 boolean saveStream(String target,
        -                          InputStream source)
        -
      • -
      - - - -
        -
      • -

        saveStream

        -
        public static boolean saveStream(File target,
        -                                 InputStream source)
        -
      • -
      - - - - - - - -
        -
      • -

        saveBytes

        -
        public void saveBytes(String filename,
        -                      byte[] data)
        -
        ( begin auto-generated from saveBytes.xml ) - - Opposite of loadBytes(), will write an entire array of bytes to a - file. The data is saved in binary format. This file is saved to the - sketch's folder, which is opened by selecting "Show sketch folder" from - the "Sketch" menu.
        -
        - It is not possible to use saveXxxxx() functions inside a web browser - unless the sketch is signed applet. To - save a file back to a server, see the save to - web code snippet on the Processing Wiki. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - name of the file to write to
        -
        data - array of bytes to be written
        -
        See Also:
        -
        loadStrings(String), -loadBytes(String), -saveStrings(String, String[])
        -
        -
      • -
      - - - -
        -
      • -

        saveBytes

        -
        public static void saveBytes(File file,
        -                             byte[] data)
        -
      • -
      - - - -
        -
      • -

        saveBytes

        -
        public static void saveBytes(OutputStream output,
        -                             byte[] data)
        -
      • -
      - - - -
        -
      • -

        saveStrings

        -
        public void saveStrings(String filename,
        -                        String[] data)
        -
        ( begin auto-generated from saveStrings.xml ) - - Writes an array of strings to a file, one line per string. This file is - saved to the sketch's folder, which is opened by selecting "Show sketch - folder" from the "Sketch" menu.
        -
        - It is not possible to use saveXxxxx() functions inside a web browser - unless the sketch is signed applet. To - save a file back to a server, see the save to - web code snippet on the Processing Wiki.
        -
        - Starting with Processing 1.0, all files loaded and saved by the - Processing API use UTF-8 encoding. In previous releases, the default - encoding for your platform was used, which causes problems when files - are moved to other platforms. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        filename - filename for output
        -
        data - string array to be written
        -
        See Also:
        -
        loadStrings(String), -loadBytes(String), -saveBytes(String, byte[])
        -
        -
      • -
      - - - -
        -
      • -

        saveStrings

        -
        public static void saveStrings(File file,
        -                               String[] data)
        -
      • -
      - - - -
        -
      • -

        saveStrings

        -
        public static void saveStrings(OutputStream output,
        -                               String[] data)
        -
      • -
      - - - -
        -
      • -

        sketchPath

        -
        public String sketchPath()
        -
      • -
      - - - -
        -
      • -

        sketchPath

        -
        public String sketchPath(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 File sketchFile(String where)
        -
      • -
      - - - -
        -
      • -

        savePath

        -
        public String savePath(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 File saveFile(String where)
        -
        Identical to savePath(), but returns a File object.
        -
      • -
      - - - -
        -
      • -

        desktopFile

        -
        public static File desktopFile(String what)
        -
        Not a supported function. For testing use only.
        -
      • -
      - - - -
        -
      • -

        desktopPath

        -
        public static String desktopPath(String what)
        -
        Not a supported function. For testing use only.
        -
      • -
      - - - -
        -
      • -

        dataPath

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

        - This is only available with applications, not applets or Android. - On Windows and Linux, this is simply the data folder, which is located - in the same directory as the EXE file and lib folders. On Mac OS X, this - is a path to the data folder buried inside Contents/Java. - For the latter point, that also means that the data folder should not be - considered writable. Use sketchPath() for now, or inputPath() and - outputPath() once they're available in the 2.0 release. -

        - dataPath() is not supported with applets because applets have their data - folder wrapped into the JAR file. To read data from the data folder that - works with an applet, you should use other methods such as createInput(), - createReader(), or loadStrings().

        -
      • -
      - - - -
        -
      • -

        dataFile

        -
        public File dataFile(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(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(File file)
        -
      • -
      - - - -
        -
      • -

        getExtension

        -
        public static String getExtension(String filename)
        -
      • -
      - - - -
        -
      • -

        urlEncode

        -
        public static String urlEncode(String str)
        -
      • -
      - - - -
        -
      • -

        urlDecode

        -
        public static String urlDecode(String str)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static byte[] sort(byte[] list)
        -
        ( begin auto-generated from sort.xml ) - - Sorts an array of numbers from smallest to largest and puts an array of - words in alphabetical order. The original array is not modified, a - re-ordered array is returned. The count parameter states the - number of elements to sort. For example if there are 12 elements in an - array and if count is the value 5, only the first five elements on the - array will be sorted. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        list - array to sort
        -
        See Also:
        -
        reverse(boolean[])
        -
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static byte[] sort(byte[] list,
        -                          int count)
        -
        -
        Parameters:
        -
        count - number of elements to sort, starting from 0
        -
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static char[] sort(char[] list)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static char[] sort(char[] list,
        -                          int count)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static int[] sort(int[] list)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static int[] sort(int[] list,
        -                         int count)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static float[] sort(float[] list)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static float[] sort(float[] list,
        -                           int count)
        -
      • -
      - - - - - - - -
        -
      • -

        sort

        -
        public static String[] sort(String[] list,
        -                            int count)
        -
      • -
      - - - -
        -
      • -

        arrayCopy

        -
        public static void arrayCopy(Object src,
        -                             int srcPosition,
        -                             Object dst,
        -                             int dstPosition,
        -                             int length)
        -
        ( begin auto-generated from arrayCopy.xml ) - - Copies an array (or part of an array) to another array. The src - array is copied to the dst array, beginning at the position - specified by srcPos and into the position specified by - dstPos. The number of elements to copy is determined by - length. The simplified version with two arguments copies an - entire array to another of the same size. It is equivalent to - "arrayCopy(src, 0, dst, 0, src.length)". This function is far more - efficient for copying array data than iterating through a for and - copying each element. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        src - the source array
        -
        srcPosition - starting position in the source array
        -
        dst - the destination array of the same data type as the source array
        -
        dstPosition - starting position in the destination array
        -
        length - number of array elements to be copied
        -
        See Also:
        -
        concat(boolean[], boolean[])
        -
        -
      • -
      - - - -
        -
      • -

        arrayCopy

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

        arrayCopy

        -
        public static void arrayCopy(Object src,
        -                             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(Object src,
        -                             int srcPosition,
        -                             Object dst,
        -                             int dstPosition,
        -                             int length)
        -
        Deprecated. Use arrayCopy() instead.
        -
      • -
      - - - -
        -
      • -

        arraycopy

        -
        public static void arraycopy(Object src,
        -                             Object dst,
        -                             int length)
        -
        Deprecated. Use arrayCopy() instead.
        -
      • -
      - - - -
        -
      • -

        arraycopy

        -
        public static void arraycopy(Object src,
        -                             Object dst)
        -
        Deprecated. Use arrayCopy() instead.
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static boolean[] expand(boolean[] list)
        -
        ( begin auto-generated from expand.xml ) - - Increases the size of an array. By default, this function doubles the - size of the array, but the optional newSize parameter provides - precise control over the increase in size. -

        - When using an array of objects, the data returned from the function must - be cast to the object array's data type. For example: SomeClass[] - items = (SomeClass[]) expand(originalArray). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        list - the array to expand
        -
        See Also:
        -
        shorten(boolean[])
        -
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static boolean[] expand(boolean[] list,
        -                               int newSize)
        -
        -
        Parameters:
        -
        newSize - new size for the array
        -
        -
      • -
      - - - -
        -
      • -

        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 long[] expand(long[] list)
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static long[] expand(long[] list,
        -                            int newSize)
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static float[] expand(float[] list)
        -
      • -
      - - - -
        -
      • -

        expand

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

        expand

        -
        public static double[] expand(double[] list)
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static double[] expand(double[] list,
        -                              int newSize)
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static String[] expand(String[] list)
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static String[] expand(String[] list,
        -                              int newSize)
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static Object expand(Object array)
        -
      • -
      - - - -
        -
      • -

        expand

        -
        public static Object expand(Object list,
        -                            int newSize)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public static byte[] append(byte[] array,
        -                            byte value)
        -
        ( begin auto-generated from append.xml ) - - Expands an array by one element and adds data to the new position. The - datatype of the element parameter must be the same as the - datatype of the array. -

        - When using an array of objects, the data returned from the function must - be cast to the object array's data type. For example: SomeClass[] - items = (SomeClass[]) append(originalArray, element). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        array - array to append
        -
        value - new data for the array
        -
        See Also:
        -
        shorten(boolean[]), -expand(boolean[])
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public static char[] append(char[] array,
        -                            char value)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public static int[] append(int[] array,
        -                           int value)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public static float[] append(float[] array,
        -                             float value)
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        shorten

        -
        public static boolean[] shorten(boolean[] list)
        -
        ( begin auto-generated from shorten.xml ) - - Decreases an array by one element and returns the shortened array. -

        - When using an array of objects, the data returned from the function must - be cast to the object array's data type. For example: SomeClass[] - items = (SomeClass[]) shorten(originalArray). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        list - array to shorten
        -
        See Also:
        -
        append(byte[], byte), -expand(boolean[])
        -
        -
      • -
      - - - -
        -
      • -

        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 String[] shorten(String[] list)
        -
      • -
      - - - -
        -
      • -

        shorten

        -
        public static Object shorten(Object list)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final boolean[] splice(boolean[] list,
        -                                     boolean value,
        -                                     int index)
        -
        ( begin auto-generated from splice.xml ) - - Inserts a value or array of values into an existing array. The first two - parameters must be of the same datatype. The array parameter - defines the array which will be modified and the second parameter - defines the data which will be inserted. -

        - When using an array of objects, the data returned from the function must - be cast to the object array's data type. For example: SomeClass[] - items = (SomeClass[]) splice(array1, array2, index). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        list - array to splice into
        -
        value - value to be spliced in
        -
        index - position in the array from which to insert data
        -
        See Also:
        -
        concat(boolean[], boolean[]), -subset(boolean[], int, int)
        -
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final boolean[] splice(boolean[] list,
        -                                     boolean[] value,
        -                                     int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final byte[] splice(byte[] list,
        -                                  byte value,
        -                                  int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final byte[] splice(byte[] list,
        -                                  byte[] value,
        -                                  int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final char[] splice(char[] list,
        -                                  char value,
        -                                  int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final char[] splice(char[] list,
        -                                  char[] value,
        -                                  int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final int[] splice(int[] list,
        -                                 int value,
        -                                 int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final int[] splice(int[] list,
        -                                 int[] value,
        -                                 int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final float[] splice(float[] list,
        -                                   float value,
        -                                   int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final float[] splice(float[] list,
        -                                   float[] value,
        -                                   int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final String[] splice(String[] list,
        -                                    String value,
        -                                    int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final String[] splice(String[] list,
        -                                    String[] value,
        -                                    int index)
        -
      • -
      - - - -
        -
      • -

        splice

        -
        public static final Object splice(Object list,
        -                                  Object value,
        -                                  int index)
        -
      • -
      - - - -
        -
      • -

        subset

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

        subset

        -
        public static boolean[] subset(boolean[] list,
        -                               int start,
        -                               int count)
        -
        ( begin auto-generated from subset.xml ) - - Extracts an array of elements from an existing array. The array - parameter defines the array from which the elements will be copied and - the offset and length parameters determine which elements - to extract. If no length is given, elements will be extracted - from the offset to the end of the array. When specifying the - offset remember the first array element is 0. This function does - not change the source array. -

        - When using an array of objects, the data returned from the function must - be cast to the object array's data type. For example: SomeClass[] - items = (SomeClass[]) subset(originalArray, 0, 4). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        list - array to extract from
        -
        start - position to begin
        -
        count - number of values to extract
        -
        See Also:
        -
        splice(boolean[], boolean, int)
        -
        -
      • -
      - - - -
        -
      • -

        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 String[] subset(String[] list,
        -                              int start)
        -
      • -
      - - - -
        -
      • -

        subset

        -
        public static String[] subset(String[] list,
        -                              int start,
        -                              int count)
        -
      • -
      - - - -
        -
      • -

        subset

        -
        public static Object subset(Object list,
        -                            int start)
        -
      • -
      - - - -
        -
      • -

        subset

        -
        public static Object subset(Object list,
        -                            int start,
        -                            int count)
        -
      • -
      - - - -
        -
      • -

        concat

        -
        public static boolean[] concat(boolean[] a,
        -                               boolean[] b)
        -
        ( begin auto-generated from concat.xml ) - - Concatenates two arrays. For example, concatenating the array { 1, 2, 3 - } and the array { 4, 5, 6 } yields { 1, 2, 3, 4, 5, 6 }. Both parameters - must be arrays of the same datatype. -

        - When using an array of objects, the data returned from the function must - be cast to the object array's data type. For example: SomeClass[] - items = (SomeClass[]) concat(array1, array2). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - first array to concatenate
        -
        b - second array to concatenate
        -
        See Also:
        -
        splice(boolean[], boolean, int), -arrayCopy(Object, int, Object, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        reverse

        -
        public static boolean[] reverse(boolean[] list)
        -
        ( begin auto-generated from reverse.xml ) - - Reverses the order of an array. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        list - booleans[], bytes[], chars[], ints[], floats[], or Strings[]
        -
        See Also:
        -
        sort(String[], int)
        -
        -
      • -
      - - - -
        -
      • -

        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 String[] reverse(String[] list)
        -
      • -
      - - - -
        -
      • -

        reverse

        -
        public static Object reverse(Object list)
        -
      • -
      - - - -
        -
      • -

        trim

        -
        public static String trim(String str)
        -
        ( begin auto-generated from trim.xml ) - - Removes whitespace characters from the beginning and end of a String. In - addition to standard whitespace characters such as space, carriage - return, and tab, this function also removes the Unicode "nbsp" character. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        str - any string
        -
        See Also:
        -
        split(String, String), -join(String[], char)
        -
        -
      • -
      - - - -
        -
      • -

        trim

        -
        public static String[] trim(String[] array)
        -
        -
        Parameters:
        -
        array - a String array
        -
        -
      • -
      - - - -
        -
      • -

        join

        -
        public static String join(String[] list,
        -                          char separator)
        -
        ( begin auto-generated from join.xml ) - - Combines an array of Strings into one String, each separated by the - character(s) used for the separator parameter. To join arrays of - ints or floats, it's necessary to first convert them to strings using - nf() or nfs(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        list - array of Strings
        -
        separator - char or String to be placed between each item
        -
        See Also:
        -
        split(String, String), -trim(String), -nf(float, int, int), -nfs(float, int, int)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        splitTokens

        -
        public static String[] splitTokens(String value)
        -
      • -
      - - - -
        -
      • -

        splitTokens

        -
        public static String[] splitTokens(String value,
        -                                   String delim)
        -
        ( begin auto-generated from splitTokens.xml ) - - The splitTokens() function splits a String at one or many character - "tokens." The tokens parameter specifies the character or - characters to be used as a boundary. -

        - If no tokens character is specified, any whitespace character is - used to split. Whitespace characters include tab (\\t), line feed (\\n), - carriage return (\\r), form feed (\\f), and space. To convert a String - to an array of integers or floats, use the datatype conversion functions - int() and float() to convert the array of Strings. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - the String to be split
        -
        delim - list of individual characters that will be used as separators
        -
        See Also:
        -
        split(String, String), -join(String[], String), -trim(String)
        -
        -
      • -
      - - - -
        -
      • -

        split

        -
        public static String[] split(String value,
        -                             char delim)
        -
        ( begin auto-generated from split.xml ) - - The split() function breaks a string into pieces using a character or - string as the divider. The delim parameter specifies the - character or characters that mark the boundaries between each piece. A - String[] array is returned that contains each of the pieces. -

        - If the result is a set of numbers, you can convert the String[] array to - to a float[] or int[] array using the datatype conversion functions - int() and float() (see example above). -

        - The splitTokens() function works in a similar fashion, except - that it splits using a range of characters instead of a specific - character or sequence. - - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - the String to be split
        -
        delim - the character or String used to separate the data
        -
        -
      • -
      - - - - - - - -
        -
      • -

        match

        -
        public static String[] match(String str,
        -                             String regexp)
        -
        ( begin auto-generated from match.xml ) - - The match() function is used to apply a regular expression to a piece of - text, and return matching groups (elements found inside parentheses) as - a String array. No match will return null. If no groups are specified in - the regexp, but the sequence matches, an array of length one (with the - matched text as the first element of the array) will be returned.
        -
        - To use the function, first check to see if the result is null. If the - result is null, then the sequence did not match. If the sequence did - match, an array is returned. - If there are groups (specified by sets of parentheses) in the regexp, - then the contents of each will be returned in the array. - Element [0] of a regexp match returns the entire matching string, and - the match groups start at element [1] (the first group is [1], the - second [2], and so on).
        -
        - The syntax can be found in the reference for Java's Pattern class. - For regular expression syntax, read the Java - Tutorial on the topic. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        str - the String to be searched
        -
        regexp - the regexp to be used for matching
        -
        See Also:
        -
        matchAll(String, String), -split(String, String), -splitTokens(String, String), -join(String[], String), -trim(String)
        -
        -
      • -
      - - - -
        -
      • -

        matchAll

        -
        public static String[][] matchAll(String str,
        -                                  String regexp)
        -
        ( begin auto-generated from matchAll.xml ) - - This function is used to apply a regular expression to a piece of text, - and return a list of matching groups (elements found inside parentheses) - as a two-dimensional String array. No matches will return null. If no - groups are specified in the regexp, but the sequence matches, a two - dimensional array is still returned, but the second dimension is only of - length one.
        -
        - To use the function, first check to see if the result is null. If the - result is null, then the sequence did not match at all. If the sequence - did match, a 2D array is returned. If there are groups (specified by - sets of parentheses) in the regexp, then the contents of each will be - returned in the array. - Assuming, a loop with counter variable i, element [i][0] of a regexp - match returns the entire matching string, and the match groups start at - element [i][1] (the first group is [i][1], the second [i][2], and so - on).
        -
        - The syntax can be found in the reference for Java's Pattern class. - For regular expression syntax, read the Java - Tutorial on the topic. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        str - the String to be searched
        -
        regexp - the regexp to be used for matching
        -
        See Also:
        -
        match(String, String), -split(String, String), -splitTokens(String, String), -join(String[], String), -trim(String)
        -
        -
      • -
      - - - -
        -
      • -

        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(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(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(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(String what)
        -
        Parse a String into an int value. Returns 0 if the value is bad.
        -
      • -
      - - - -
        -
      • -

        parseInt

        -
        public static final int parseInt(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(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(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(String what)
        -
      • -
      - - - -
        -
      • -

        parseFloat

        -
        public static final float parseFloat(String what,
        -                                     float otherwise)
        -
      • -
      - - - -
        -
      • -

        parseFloat

        -
        public static final float[] parseFloat(byte[] what)
        -
      • -
      - - - -
        -
      • -

        parseFloat

        -
        public static final float[] parseFloat(int[] what)
        -
      • -
      - - - -
        -
      • -

        parseFloat

        -
        public static final float[] parseFloat(String[] what)
        -
      • -
      - - - -
        -
      • -

        parseFloat

        -
        public static final float[] parseFloat(String[] what,
        -                                       float missing)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String str(boolean x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String str(byte x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String str(char x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String str(int x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String str(float x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String[] str(boolean[] x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String[] str(byte[] x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String[] str(char[] x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String[] str(int[] x)
        -
      • -
      - - - -
        -
      • -

        str

        -
        public static final String[] str(float[] x)
        -
      • -
      - - - -
        -
      • -

        nf

        -
        public static String[] nf(int[] num,
        -                          int digits)
        -
      • -
      - - - -
        -
      • -

        nf

        -
        public static String nf(int num,
        -                        int digits)
        -
        ( begin auto-generated from nf.xml ) - - Utility function for formatting numbers into strings. There are two - versions, one for formatting floats and one for formatting ints. The - values for the digits, left, and right parameters - should always be positive integers.

        As shown in the above - example, nf() is used to add zeros to the left and/or right of a - number. This is typically for aligning a list of numbers. To - remove digits from a floating-point number, use the - int(), ceil(), floor(), or round() - functions. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        num - the number(s) to format
        -
        digits - number of digits to pad with zero
        -
        See Also:
        -
        nfs(float, int, int), -nfp(float, int, int), -nfc(float, int), -PApplet#int(float)
        -
        -
      • -
      - - - -
        -
      • -

        nfc

        -
        public static String[] nfc(int[] num)
        -
        ( begin auto-generated from nfc.xml ) - - Utility function for formatting numbers into strings and placing - appropriate commas to mark units of 1000. There are two versions, one - for formatting ints and one for formatting an array of ints. The value - for the digits parameter should always be a positive integer. -

        - For a non-US locale, this will insert periods instead of commas, or - whatever is apprioriate for that region. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        num - the number(s) to format
        -
        See Also:
        -
        nf(float, int, int), -nfp(float, int, int), -nfs(float, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        nfc

        -
        public static String nfc(int num)
        -
        nfc() or "number format with commas". This is an unfortunate misnomer - because in locales where a comma is not the separator for numbers, it - won't actually be outputting a comma, it'll use whatever makes sense for - the locale.
        -
      • -
      - - - -
        -
      • -

        nfs

        -
        public static String nfs(int num,
        -                         int digits)
        -
        ( begin auto-generated from nfs.xml ) - - Utility function for formatting numbers into strings. Similar to - nf() but leaves a blank space in front of positive numbers so - they align with negative numbers in spite of the minus symbol. There are - two versions, one for formatting floats and one for formatting ints. The - values for the digits, left, and right parameters - should always be positive integers. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        num - the number(s) to format
        -
        digits - number of digits to pad with zeroes
        -
        See Also:
        -
        nf(float, int, int), -nfp(float, int, int), -nfc(float, int)
        -
        -
      • -
      - - - -
        -
      • -

        nfs

        -
        public static String[] nfs(int[] num,
        -                           int digits)
        -
      • -
      - - - -
        -
      • -

        nfp

        -
        public static String nfp(int num,
        -                         int digits)
        -
        ( begin auto-generated from nfp.xml ) - - Utility function for formatting numbers into strings. Similar to - nf() but puts a "+" in front of positive numbers and a "-" in - front of negative numbers. There are two versions, one for formatting - floats and one for formatting ints. The values for the digits, - left, and right parameters should always be positive integers. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        num - the number(s) to format
        -
        digits - number of digits to pad with zeroes
        -
        See Also:
        -
        nf(float, int, int), -nfs(float, int, int), -nfc(float, int)
        -
        -
      • -
      - - - -
        -
      • -

        nfp

        -
        public static String[] nfp(int[] num,
        -                           int digits)
        -
      • -
      - - - -
        -
      • -

        nf

        -
        public static String[] nf(float[] num,
        -                          int left,
        -                          int right)
        -
      • -
      - - - -
        -
      • -

        nf

        -
        public static String nf(float num,
        -                        int left,
        -                        int right)
        -
        -
        Parameters:
        -
        num[] - the number(s) to format
        -
        left - number of digits to the left of the decimal point
        -
        right - number of digits to the right of the decimal point
        -
        -
      • -
      - - - -
        -
      • -

        nfc

        -
        public static String[] nfc(float[] num,
        -                           int right)
        -
        -
        Parameters:
        -
        num[] - the number(s) to format
        -
        right - number of digits to the right of the decimal point
        -
        -
      • -
      - - - -
        -
      • -

        nfc

        -
        public static String nfc(float num,
        -                         int right)
        -
      • -
      - - - -
        -
      • -

        nfs

        -
        public static String[] nfs(float[] num,
        -                           int left,
        -                           int right)
        -
        -
        Parameters:
        -
        num[] - the number(s) to format
        -
        left - the number of digits to the left of the decimal point
        -
        right - the number of digits to the right of the decimal point
        -
        -
      • -
      - - - -
        -
      • -

        nfs

        -
        public static String nfs(float num,
        -                         int left,
        -                         int right)
        -
      • -
      - - - -
        -
      • -

        nfp

        -
        public static String[] nfp(float[] num,
        -                           int left,
        -                           int right)
        -
        -
        Parameters:
        -
        left - the number of digits to the left of the decimal point
        -
        right - the number of digits to the right of the decimal point
        -
        -
      • -
      - - - -
        -
      • -

        nfp

        -
        public static String nfp(float num,
        -                         int left,
        -                         int right)
        -
      • -
      - - - -
        -
      • -

        hex

        -
        public static final String hex(byte value)
        -
        ( begin auto-generated from hex.xml ) - - Converts a byte, char, int, or color to a String containing the - equivalent hexadecimal notation. For example color(0, 102, 153) will - convert to the String "FF006699". This function can help make your geeky - debugging sessions much happier. -

        - Note that the maximum number of digits is 8, because an int value can - only represent up to 32 bits. Specifying more than eight digits will - simply shorten the string to eight anyway. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - the value to convert
        -
        See Also:
        -
        unhex(String), -binary(byte), -unbinary(String)
        -
        -
      • -
      - - - -
        -
      • -

        hex

        -
        public static final String hex(char value)
        -
      • -
      - - - -
        -
      • -

        hex

        -
        public static final String hex(int value)
        -
      • -
      - - - -
        -
      • -

        hex

        -
        public static final String hex(int value,
        -                               int digits)
        -
        -
        Parameters:
        -
        digits - the number of digits (maximum 8)
        -
        -
      • -
      - - - -
        -
      • -

        unhex

        -
        public static final int unhex(String value)
        -
        ( begin auto-generated from unhex.xml ) - - Converts a String representation of a hexadecimal number to its - equivalent integer value. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - String to convert to an integer
        -
        See Also:
        -
        hex(int, int), -binary(byte), -unbinary(String)
        -
        -
      • -
      - - - -
        -
      • -

        binary

        -
        public static final String binary(byte value)
        -
        Returns a String that contains the binary value of a byte. - The returned value will always have 8 digits.
        -
      • -
      - - - -
        -
      • -

        binary

        -
        public static final String binary(char value)
        -
        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 String binary(int value)
        -
        Returns a String that contains the binary value of an int. The length - depends on the size of the number itself. If you want a specific number - of digits use binary(int what, int digits) to specify how many.
        -
      • -
      - - - -
        -
      • -

        binary

        -
        public static final String binary(int value,
        -                                  int digits)
        -
        ( begin auto-generated from binary.xml ) - - Converts a byte, char, int, or color to a String containing the - equivalent binary notation. For example color(0, 102, 153, 255) will - convert to the String "11111111000000000110011010011001". This function - can help make your geeky debugging sessions much happier. -

        - Note that the maximum number of digits is 32, because an int value can - only represent up to 32 bits. Specifying more than 32 digits will simply - shorten the string to 32 anyway. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - value to convert
        -
        digits - number of digits to return
        -
        See Also:
        -
        unbinary(String), -hex(int,int), -unhex(String)
        -
        -
      • -
      - - - -
        -
      • -

        unbinary

        -
        public static final int unbinary(String value)
        -
        ( begin auto-generated from unbinary.xml ) - - Converts a String representation of a binary number to its equivalent - integer value. For example, unbinary("00001000") will return 8. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        value - String to convert to an integer
        -
        See Also:
        -
        binary(byte), -hex(int,int), -unhex(String)
        -
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int gray)
        -
        ( begin auto-generated from color.xml ) - - Creates colors for storing in variables of the color datatype. - The parameters are interpreted as RGB or HSB values depending on the - current colorMode(). The default mode is RGB values from 0 to 255 - and therefore, the function call color(255, 204, 0) will return a - bright yellow color. More about how colors are stored can be found in - the reference for the color datatype. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        gray - number specifying value between white and black
        -
        See Also:
        -
        colorMode(int)
        -
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(float fgray)
        -
        -
        Parameters:
        -
        fgray - number specifying value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int gray,
        -                       int alpha)
        -
        As of 0116 this also takes color(#FF8800, alpha)
        -
        -
        Parameters:
        -
        alpha - relative to current color range
        -
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(float fgray,
        -                       float falpha)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int v1,
        -                       int v2,
        -                       int v3)
        -
        -
        Parameters:
        -
        v1 - red or hue values relative to the current color range
        -
        v2 - green or saturation values relative to the current color range
        -
        v3 - blue or brightness values relative to the current color range
        -
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int v1,
        -                       int v2,
        -                       int v3,
        -                       int alpha)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(float v1,
        -                       float v2,
        -                       float v3)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(float v1,
        -                       float v2,
        -                       float v3,
        -                       float alpha)
        -
      • -
      - - - -
        -
      • -

        lerpColor

        -
        public int lerpColor(int c1,
        -                     int c2,
        -                     float amt)
        -
        ( begin auto-generated from lerpColor.xml ) - - Calculates a color or colors between two color at a specific increment. - The amt parameter is the amount to interpolate between the two - values where 0.0 equal to the first point, 0.1 is very near the first - point, 0.5 is half-way in between, etc. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        c1 - interpolate from this color
        -
        c2 - interpolate to this color
        -
        amt - between 0.0 and 1.0
        -
        See Also:
        -
        PImage.blendColor(int, int, int), -PGraphics.color(float, float, float, float), -lerp(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        blendColor

        -
        public static int blendColor(int c1,
        -                             int c2,
        -                             int mode)
        -
      • -
      - - - -
        -
      • -

        main

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

        - Usage: PApplet [options] <class name> [sketch args] -

          -
        • The [options] are one or several of the parameters seen below. -
        • The class name is required. If you're running outside the PDE and - your class is in a package, this should include the full name. That means - that if the class is called Sketchy and the package is com.sketchycompany - then com.sketchycompany.Sketchy should be used as the class name. -
        • The [sketch args] are any command line parameters you want to send to - the sketch itself. These will be passed into the args[] array in PApplet. -

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

          static public void main(String args[]) {
          -   PApplet.main("YourSketchName");
          - }
          - That will properly launch your code 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              Presentation mode: blanks the entire screen and
          -                        shows the sketch by itself. If the sketch is
          -                        smaller than the screen, the background around it
          -                        will use the --window-color setting.
          -
          - --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.
          -
          - --window-color=#xxxxxx Background color of the window. The color used
          -                        around the sketch when it's smaller than the
          -                        minimum window size for the OS, and the matte
          -                        color when using 'present' mode.
          -
          - --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 sketch.
          -                        Displays are numbered starting from 1. This will
          -                        be overridden by fullScreen() calls that specify
          -                        a display. Omitting this option will cause the
          -                        default display to be used.
          -
          - 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
          -
          - All parameters *after* the sketch class name are passed to the sketch
          - itself and available from its 'args' array while the sketch is running.
        -
        -
        See Also:
        -
        -
        -
      • -
      - - - -
        -
      • -

        main

        -
        public static void main(String mainClass)
        -
        Convenience method so that PApplet.main("YourSketch") launches a sketch, - rather than having to wrap it into a single element String array.
        -
        -
        Parameters:
        -
        mainClass - name of the class to load (with package if any)
        -
        -
      • -
      - - - -
        -
      • -

        main

        -
        public static void main(String mainClass,
        -                        String[] sketchArgs)
        -
        Convenience method so that PApplet.main("YourSketch", args) launches a - sketch, rather than having to wrap it into a String array, and appending - the 'args' array when not null.
        -
        -
        Parameters:
        -
        mainClass - name of the class to load (with package if any)
        -
        args - command line arguments to pass to the sketch's 'args' array. - Note that this is *not* the same as the args passed to (and - understood by) PApplet such as --display.
        -
        -
      • -
      - - - -
        -
      • -

        runSketch

        -
        public static void runSketch(String[] args,
        -                             PApplet constructedSketch)
        -
      • -
      - - - -
        -
      • -

        hideMenuBar

        -
        public static void hideMenuBar()
        -
        Convenience method, should only be called by PSurface subclasses.
        -
      • -
      - - - -
        -
      • -

        beginRecord

        -
        public PGraphics beginRecord(String renderer,
        -                             String filename)
        -
        ( begin auto-generated from beginRecord.xml ) - - Opens a new file and all subsequent drawing functions are echoed to this - file as well as the display window. The beginRecord() function - requires two parameters, the first is the renderer and the second is the - file name. This function is always used with endRecord() to stop - the recording process and close the file. -

        - Note that beginRecord() will only pick up any settings that happen after - it has been called. For instance, if you call textFont() before - beginRecord(), then that font will not be set for the file that you're - recording to. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        renderer - for example, PDF
        -
        filename - filename for output
        -
        See Also:
        -
        endRecord()
        -
        -
      • -
      - - - -
        -
      • -

        beginRecord

        -
        public void beginRecord(PGraphics recorder)
        -
      • -
      - - - -
        -
      • -

        endRecord

        -
        public void endRecord()
        -
        ( begin auto-generated from endRecord.xml ) - - Stops the recording process started by beginRecord() and closes - the file. - - ( end auto-generated )
        -
        -
        See Also:
        -
        beginRecord(String, String)
        -
        -
      • -
      - - - -
        -
      • -

        beginRaw

        -
        public PGraphics beginRaw(String renderer,
        -                          String filename)
        -
        ( begin auto-generated from beginRaw.xml ) - - To create vectors from 3D data, use the beginRaw() and - endRaw() commands. These commands will grab the shape data just - before it is rendered to the screen. At this stage, your entire scene is - nothing but a long list of individual lines and triangles. This means - that a shape created with sphere() function will be made up of - hundreds of triangles, rather than a single object. Or that a - multi-segment line shape (such as a curve) will be rendered as - individual segments. -

        - When using beginRaw() and endRaw(), it's possible to write - to either a 2D or 3D renderer. For instance, beginRaw() with the - PDF library will write the geometry as flattened triangles and lines, - even if recording from the P3D renderer. -

        - If you want a background to show up in your files, use rect(0, 0, - width, height) after setting the fill() to the background - color. Otherwise the background will not be rendered to the file because - the background is not shape. -

        - Using hint(ENABLE_DEPTH_SORT) can improve the appearance of 3D - geometry drawn to 2D file formats. See the hint() reference for - more details. -

        - See examples in the reference for the PDF and DXF - libraries for more information. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        renderer - for example, PDF or DXF
        -
        filename - filename for output
        -
        See Also:
        -
        endRaw(), -hint(int)
        -
        -
      • -
      - - - -
        -
      • -

        beginRaw

        -
        public void beginRaw(PGraphics rawGraphics)
        -
        -
        Parameters:
        -
        rawGraphics - ???
        -
        -
      • -
      - - - -
        -
      • -

        endRaw

        -
        public void endRaw()
        -
        ( begin auto-generated from endRaw.xml ) - - Complement to beginRaw(); they must always be used together. See - the beginRaw() reference for details. - - ( end auto-generated )
        -
        -
        See Also:
        -
        beginRaw(String, String)
        -
        -
      • -
      - - - -
        -
      • -

        loadPixels

        -
        public void loadPixels()
        -
        ( begin auto-generated from loadPixels.xml ) - - Loads the pixel data for the display window into the pixels[] - array. This function must always be called before reading from or - writing to pixels[]. -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. - - ( end auto-generated ) -

        Advanced

        - 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[].
        -
        -
        See Also:
        -
        pixels, -updatePixels()
        -
        -
      • -
      - - - -
        -
      • -

        updatePixels

        -
        public void updatePixels()
        -
        ( begin auto-generated from updatePixels.xml ) - - Updates the display window with the data in the pixels[] array. - Use in conjunction with loadPixels(). If you're only reading - pixels from the array, there's no need to call updatePixels() - unless there are changes. -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. -

        - Currently, none of the renderers use the additional parameters to - updatePixels(), however this may be implemented in the future. - - ( end auto-generated )
        -
        -
        See Also:
        -
        loadPixels(), -pixels
        -
        -
      • -
      - - - -
        -
      • -

        updatePixels

        -
        public void updatePixels(int x1,
        -                         int y1,
        -                         int x2,
        -                         int y2)
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the upper-left corner
        -
        y1 - y-coordinate of the upper-left corner
        -
        x2 - width of the region
        -
        y2 - height of the region
        -
        -
      • -
      - - - -
        -
      • -

        beginPGL

        -
        public PGL beginPGL()
        -
      • -
      - - - -
        -
      • -

        endPGL

        -
        public void endPGL()
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public void flush()
        -
      • -
      - - - -
        -
      • -

        hint

        -
        public void hint(int which)
        -
      • -
      - - - -
        -
      • -

        beginShape

        -
        public void beginShape()
        -
        Start a new shape of type POLYGON
        -
      • -
      - - - -
        -
      • -

        beginShape

        -
        public void beginShape(int kind)
        -
        ( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms. beginShape() begins recording - vertices for a shape and endShape() stops recording. The value of - the MODE parameter tells it which types of shapes to create from - the provided vertices. With no mode specified, the shape can be any - irregular polygon. The parameters available for beginShape() are POINTS, - LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, and QUAD_STRIP. - After calling the beginShape() function, a series of - vertex() commands must follow. To stop drawing the shape, call - endShape(). The vertex() function with two parameters - specifies a position in 2D and the vertex() function with three - parameters specifies a position in 3D. Each shape will be outlined with - the current stroke color and filled with the fill color. -

        - Transformations such as translate(), rotate(), and - scale() do not work within beginShape(). It is also not - possible to use other shapes, such as ellipse() or rect() - within beginShape(). -

        - The P3D renderer settings allow stroke() and fill() - settings to be altered per-vertex, however the default P2D renderer does - not. Settings such as strokeWeight(), strokeCap(), and - strokeJoin() cannot be changed while inside a - beginShape()/endShape() block with any renderer. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        kind - Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIP
        -
        See Also:
        -
        PShape, -PGraphics.endShape(), -PGraphics.vertex(float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from normal.xml ) - - Sets the current normal vector. This is for drawing three dimensional - shapes and surfaces and specifies a vector perpendicular to the surface - of the shape which determines how lighting affects it. Processing - attempts to automatically assign normals to shapes, but since that's - imperfect, this is a better option when you want more control. This - function is identical to glNormal3f() in OpenGL. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        nx - x direction
        -
        ny - y direction
        -
        nz - z direction
        -
        See Also:
        -
        PGraphics.beginShape(int), -PGraphics.endShape(int), -PGraphics.lights()
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   float... values)
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   int... values)
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   boolean... values)
        -
      • -
      - - - -
        -
      • -

        textureMode

        -
        public void textureMode(int mode)
        -
        ( begin auto-generated from textureMode.xml ) - - Sets the coordinate space for texture mapping. There are two options, - IMAGE, which refers to the actual coordinates of the image, and - NORMAL, which refers to a normalized space of values ranging from 0 - to 1. The default mode is IMAGE. In IMAGE, if an image is 100 x 200 - pixels, mapping the image onto the entire size of a quad would require - the points (0,0) (0,100) (100,200) (0,200). The same mapping in - NORMAL_SPACE is (0,0) (0,1) (1,1) (0,1). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either IMAGE or NORMAL
        -
        See Also:
        -
        PGraphics.texture(PImage), -PGraphics.textureWrap(int)
        -
        -
      • -
      - - - -
        -
      • -

        textureWrap

        -
        public void textureWrap(int wrap)
        -
        ( begin auto-generated from textureWrap.xml ) - - Description to come... - - ( end auto-generated from textureWrap.xml )
        -
        -
        Parameters:
        -
        wrap - Either CLAMP (default) or REPEAT
        -
        See Also:
        -
        PGraphics.texture(PImage), -PGraphics.textureMode(int)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        noTexture

        -
        public void noTexture()
        -
        Removes texture image for current shape. - Needs to be called between beginShape and endShape
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices. - vertex() is used to specify the vertex coordinates for points, - lines, triangles, quads, and polygons and is used exclusively within the - beginShape() and endShape() function.
        -
        - Drawing a vertex in 3D using the z parameter requires the P3D - parameter in combination with size as shown in the above example.
        -
        - This function is also used to map a texture onto the geometry. The - texture() function declares the texture to apply to the geometry - and the u and v coordinates set define the mapping of this - texture to the form. By default, the coordinates used for u and - v are specified in relation to the image's size in pixels, but - this relation can be changed with textureMode(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - x-coordinate of the vertex
        -
        y - y-coordinate of the vertex
        -
        z - z-coordinate of the vertex
        -
        u - horizontal coordinate for the texture mapping
        -
        v - vertical coordinate for the texture mapping
        -
        See Also:
        -
        PGraphics.beginShape(int), -PGraphics.endShape(int), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.texture(PImage)
        -
        -
      • -
      - - - -
        -
      • -

        beginContour

        -
        public void beginContour()
        -
      • -
      - - - -
        -
      • -

        endContour

        -
        public void endContour()
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape()
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape(int mode)
        -
        ( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape(). When endshape() - is called, all of image data defined since the previous call to - beginShape() is written into the image buffer. The constant CLOSE - as the value for the MODE parameter to close the shape (to connect the - beginning and the end). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - use CLOSE to close the shape
        -
        See Also:
        -
        PShape, -PGraphics.beginShape(int)
        -
        -
      • -
      - - - -
        -
      • -

        loadShape

        -
        public PShape loadShape(String filename)
        -
        -
        Parameters:
        -
        filename - name of file to load, can be .svg or .obj
        -
        See Also:
        -
        PShape, -createShape()
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        createShape

        -
        public PShape createShape(int type)
        -
      • -
      - - - -
        -
      • -

        createShape

        -
        public PShape createShape(int kind,
        -                          float... p)
        -
        -
        Parameters:
        -
        kind - either POINT, LINE, TRIANGLE, QUAD, RECT, ELLIPSE, ARC, BOX, SPHERE
        -
        p - parameters that match the kind of shape
        -
        -
      • -
      - - - -
        -
      • -

        loadShader

        -
        public PShader loadShader(String fragFilename)
        -
        ( begin auto-generated from loadShader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        fragFilename - name of fragment shader file
        -
        -
      • -
      - - - -
        -
      • -

        loadShader

        -
        public PShader loadShader(String fragFilename,
        -                          String vertFilename)
        -
        -
        Parameters:
        -
        vertFilename - name of vertex shader file
        -
        -
      • -
      - - - -
        -
      • -

        shader

        -
        public void shader(PShader shader)
        -
        ( begin auto-generated from shader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        shader - name of shader file
        -
        -
      • -
      - - - -
        -
      • -

        shader

        -
        public void shader(PShader shader,
        -                   int kind)
        -
        -
        Parameters:
        -
        kind - type of shader, either POINTS, LINES, or TRIANGLES
        -
        -
      • -
      - - - -
        -
      • -

        resetShader

        -
        public void resetShader()
        -
        ( begin auto-generated from resetShader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        resetShader

        -
        public void resetShader(int kind)
        -
        -
        Parameters:
        -
        kind - type of shader, either POINTS, LINES, or TRIANGLES
        -
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(PShader shader)
        -
        -
        Parameters:
        -
        shader - the fragment shader to apply
        -
        -
      • -
      - - - -
        -
      • -

        clip

        -
        public void clip(float a,
        -                 float b,
        -                 float c,
        -                 float d)
        -
      • -
      - - - -
        -
      • -

        noClip

        -
        public void noClip()
        -
      • -
      - - - -
        -
      • -

        blendMode

        -
        public void blendMode(int mode)
        -
        ( begin auto-generated from blendMode.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - the blending mode to use
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves. Each call to - bezierVertex() defines the position of two control points and one - anchor point of a Bezier curve, adding a new segment to a line or shape. - The first time bezierVertex() is used within a - beginShape() call, it must be prefaced with a call to - vertex() to set the first anchor point. This function must be - used between beginShape() and endShape() and only when - there is no MODE parameter specified to beginShape(). Using the - 3D version requires rendering with P3D (see the Environment reference - for more information). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x2 - the x-coordinate of the 1st control point
        -
        y2 - the y-coordinate of the 1st control point
        -
        z2 - the z-coordinate of the 1st control point
        -
        x3 - the x-coordinate of the 2nd control point
        -
        y3 - the y-coordinate of the 2nd control point
        -
        z3 - the z-coordinate of the 2nd control point
        -
        x4 - the x-coordinate of the anchor point
        -
        y4 - the y-coordinate of the anchor point
        -
        z4 - the z-coordinate of the anchor point
        -
        See Also:
        -
        PGraphics.curveVertex(float, float, float), -PGraphics.vertex(float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float cx,
        -                            float cy,
        -                            float cz,
        -                            float x3,
        -                            float y3,
        -                            float z3)
        -
        -
        Parameters:
        -
        cz - the z-coordinate of the control point
        -
        z3 - the z-coordinate of the anchor point
        -
        -
      • -
      - - - - - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
        -
        Parameters:
        -
        z - the z-coordinate of the vertex
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y)
        -
        ( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel. The - first parameter is the horizontal value for the point, the second value - is the vertical value for the point, and the optional third value is the - depth value. Drawing this shape in 3D with the z parameter - requires the P3D parameter in combination with size() as shown in - the above example. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - x-coordinate of the point
        -
        y - y-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y,
        -                  float z)
        -
        -
        Parameters:
        -
        z - z-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2)
        -
        ( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen. The - version of line() with four parameters draws the line in 2D. To - color a line, use the stroke() function. A line cannot be filled, - therefore the fill() function will not affect the color of a - line. 2D lines are drawn with a width of one pixel by default, but this - can be changed with the strokeWeight() function. The version with - six parameters allows the line to be placed anywhere within XYZ space. - Drawing this shape in 3D with the z parameter requires the P3D - parameter in combination with size() as shown in the above example. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        See Also:
        -
        PGraphics.strokeWeight(float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int), -PGraphics.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float z1,
        -                 float x2,
        -                 float y2,
        -                 float z2)
        -
        -
        Parameters:
        -
        z1 - z-coordinate of the first point
        -
        z2 - z-coordinate of the second point
        -
        -
      • -
      - - - -
        -
      • -

        triangle

        -
        public void triangle(float x1,
        -                     float y1,
        -                     float x2,
        -                     float y2,
        -                     float x3,
        -                     float y3)
        -
        ( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points. The first two - arguments specify the first point, the middle two arguments specify the - second point, and the last two arguments specify the third point. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        x3 - x-coordinate of the third point
        -
        y3 - y-coordinate of the third point
        -
        See Also:
        -
        beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        quad

        -
        public void quad(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2,
        -                 float x3,
        -                 float y3,
        -                 float x4,
        -                 float y4)
        -
        ( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon. It is similar to a - rectangle, but the angles between its edges are not constrained to - ninety degrees. The first pair of parameters (x1,y1) sets the first - vertex and the subsequent pairs should proceed clockwise or - counter-clockwise around the defined shape. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the first corner
        -
        y1 - y-coordinate of the first corner
        -
        x2 - x-coordinate of the second corner
        -
        y2 - y-coordinate of the second corner
        -
        x3 - x-coordinate of the third corner
        -
        y3 - y-coordinate of the third corner
        -
        x4 - x-coordinate of the fourth corner
        -
        y4 - y-coordinate of the fourth corner
        -
        -
      • -
      - - - -
        -
      • -

        rectMode

        -
        public void rectMode(int mode)
        -
        ( begin auto-generated from rectMode.xml ) - - Modifies the location from which rectangles draw. The default mode is - rectMode(CORNER), which specifies the location to be the upper - left corner of the shape and uses the third and fourth parameters of - rect() to specify the width and height. The syntax - rectMode(CORNERS) uses the first and second parameters of - rect() to set the location of one corner and uses the third and - fourth parameters to set the opposite corner. The syntax - rectMode(CENTER) draws the image from its center point and uses - the third and forth parameters of rect() to specify the image's - width and height. The syntax rectMode(RADIUS) draws the image - from its center point and uses the third and forth parameters of - rect() to specify half of the image's width and height. The - parameter must be written in ALL CAPS because Processing is a case - sensitive language. Note: In version 125, the mode named CENTER_RADIUS - was shortened to RADIUS. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CORNER, CORNERS, CENTER, or RADIUS
        -
        See Also:
        -
        PGraphics.rect(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rect

        -
        public void rect(float a,
        -                 float b,
        -                 float c,
        -                 float d)
        -
        ( begin auto-generated from rect.xml ) - - Draws a rectangle to the screen. A rectangle is a four-sided shape with - every angle at ninety degrees. By default, the first two parameters set - the location of the upper-left corner, the third sets the width, and the - fourth sets the height. These parameters may be changed with the - rectMode() function. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - x-coordinate of the rectangle by default
        -
        b - y-coordinate of the rectangle by default
        -
        c - width of the rectangle by default
        -
        d - height of the rectangle by default
        -
        See Also:
        -
        PGraphics.rectMode(int), -PGraphics.quad(float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rect

        -
        public void rect(float a,
        -                 float b,
        -                 float c,
        -                 float d,
        -                 float r)
        -
        -
        Parameters:
        -
        r - radii for all four corners
        -
        -
      • -
      - - - -
        -
      • -

        rect

        -
        public void rect(float a,
        -                 float b,
        -                 float c,
        -                 float d,
        -                 float tl,
        -                 float tr,
        -                 float br,
        -                 float bl)
        -
        -
        Parameters:
        -
        tl - radius for top-left corner
        -
        tr - radius for top-right corner
        -
        br - radius for bottom-right corner
        -
        bl - radius for bottom-left corner
        -
        -
      • -
      - - - -
        -
      • -

        ellipseMode

        -
        public void ellipseMode(int mode)
        -
        ( begin auto-generated from ellipseMode.xml ) - - The origin of the ellipse is modified by the ellipseMode() - function. The default configuration is ellipseMode(CENTER), which - specifies the location of the ellipse as the center of the shape. The - RADIUS mode is the same, but the width and height parameters to - ellipse() specify the radius of the ellipse, rather than the - diameter. The CORNER mode draws the shape from the upper-left - corner of its bounding box. The CORNERS mode uses the four - parameters to ellipse() to set two opposing corners of the - ellipse's bounding box. The parameter must be written in ALL CAPS - because Processing is a case-sensitive language. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CENTER, RADIUS, CORNER, or CORNERS
        -
        See Also:
        -
        ellipse(float, float, float, float), -arc(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        ellipse

        -
        public void ellipse(float a,
        -                    float b,
        -                    float c,
        -                    float d)
        -
        ( begin auto-generated from ellipse.xml ) - - Draws an ellipse (oval) in the display window. An ellipse with an equal - width and height is a circle. The first two parameters set - the location, the third sets the width, and the fourth sets the height. - The origin may be changed with the ellipseMode() function. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - x-coordinate of the ellipse
        -
        b - y-coordinate of the ellipse
        -
        c - width of the ellipse by default
        -
        d - height of the ellipse by default
        -
        See Also:
        -
        ellipseMode(int), -arc(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        arc

        -
        public void arc(float a,
        -                float b,
        -                float c,
        -                float d,
        -                float start,
        -                float stop)
        -
        ( begin auto-generated from arc.xml ) - - Draws an arc in the display window. Arcs are drawn along the outer edge - of an ellipse defined by the x, y, width and - height parameters. The origin or the arc's ellipse may be changed - with the ellipseMode() function. The start and stop - parameters specify the angles at which to draw the arc. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - x-coordinate of the arc's ellipse
        -
        b - y-coordinate of the arc's ellipse
        -
        c - width of the arc's ellipse by default
        -
        d - height of the arc's ellipse by default
        -
        start - angle to start the arc, specified in radians
        -
        stop - angle to stop the arc, specified in radians
        -
        See Also:
        -
        ellipse(float, float, float, float), -ellipseMode(int), -radians(float), -degrees(float)
        -
        -
      • -
      - - - -
        -
      • -

        arc

        -
        public void arc(float a,
        -                float b,
        -                float c,
        -                float d,
        -                float start,
        -                float stop,
        -                int mode)
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float size)
        -
        ( begin auto-generated from box.xml ) - - A box is an extruded rectangle. A box with equal dimension on all sides - is a cube. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        size - dimension of the box in all dimensions (creates a cube)
        -
        See Also:
        -
        PGraphics.sphere(float)
        -
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float w,
        -                float h,
        -                float d)
        -
        -
        Parameters:
        -
        w - dimension of the box in the x-dimension
        -
        h - dimension of the box in the y-dimension
        -
        d - dimension of the box in the z-dimension
        -
        -
      • -
      - - - -
        -
      • -

        sphereDetail

        -
        public void sphereDetail(int res)
        -
        ( begin auto-generated from sphereDetail.xml ) - - Controls the detail used to render a sphere by adjusting the number of - vertices of the sphere mesh. The default resolution is 30, which creates - a fairly detailed sphere definition with vertices every 360/30 = 12 - degrees. If you're going to render a great number of spheres per frame, - it is advised to reduce the level of detail using this function. The - setting stays active until sphereDetail() is called again with a - new parameter and so should not be called prior to every - sphere() statement, unless you wish to render spheres with - different settings, e.g. using less detail for smaller spheres or ones - further away from the camera. To control the detail of the horizontal - and vertical resolution independently, use the version of the functions - with two parameters. - - ( end auto-generated ) - -

        Advanced

        - Code for sphereDetail() submitted by toxi [031031]. - Code for enhanced u/v version from davbol [080801].
        -
        -
        Parameters:
        -
        res - number of segments (minimum 3) used per full circle revolution
        -
        See Also:
        -
        PGraphics.sphere(float)
        -
        -
      • -
      - - - -
        -
      • -

        sphereDetail

        -
        public void sphereDetail(int ures,
        -                         int vres)
        -
        -
        Parameters:
        -
        ures - number of segments used longitudinally per full circle revolutoin
        -
        vres - number of segments used latitudinally from top to bottom
        -
        -
      • -
      - - - -
        -
      • -

        sphere

        -
        public void sphere(float r)
        -
        ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles. - - ( end auto-generated ) - -

        Advanced

        -

        - 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
        - 
        -
        -
        Parameters:
        -
        r - the radius of the sphere
        -
        See Also:
        -
        PGraphics.sphereDetail(int)
        -
        -
      • -
      - - - -
        -
      • -

        bezierPoint

        -
        public float bezierPoint(float a,
        -                         float b,
        -                         float c,
        -                         float d,
        -                         float t)
        -
        ( begin auto-generated from bezierPoint.xml ) - - Evaluates the Bezier at point t for points a, b, c, d. The parameter t - varies between 0 and 1, a and d are points on the curve, and 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. - - ( end auto-generated ) - -

        Advanced

        - 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();
        -
        -
        Parameters:
        -
        a - coordinate of first point on the curve
        -
        b - coordinate of first control point
        -
        c - coordinate of second control point
        -
        d - coordinate of second point on the curve
        -
        t - value between 0 and 1
        -
        See Also:
        -
        PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float), -PGraphics.bezierVertex(float, float, float, float, float, float), -PGraphics.curvePoint(float, float, float, float, float)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from bezier.xml ) - - Draws a Bezier curve on the screen. These curves are defined by a series - of anchor and control points. The first two parameters specify the first - anchor point and the last two parameters specify the other anchor point. - The middle parameters specify the control points which define the shape - of the curve. Bezier curves were developed by French engineer Pierre - Bezier. Using the 3D version requires rendering with P3D (see the - Environment reference for more information). - - ( end auto-generated ) - -

        Advanced

        - 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);
        -
        -
        Parameters:
        -
        x1 - coordinates for the first anchor point
        -
        y1 - coordinates for the first anchor point
        -
        z1 - coordinates for the first anchor point
        -
        x2 - coordinates for the first control point
        -
        y2 - coordinates for the first control point
        -
        z2 - coordinates for the first control point
        -
        x3 - coordinates for the second control point
        -
        y3 - coordinates for the second control point
        -
        z3 - coordinates for the second control point
        -
        x4 - coordinates for the second anchor point
        -
        y4 - coordinates for the second anchor point
        -
        z4 - coordinates for the second anchor point
        -
        See Also:
        -
        PGraphics.bezierVertex(float, float, float, float, float, float), -PGraphics.curve(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        curveTightness

        -
        public void curveTightness(float tightness)
        -
        ( begin auto-generated from curveTightness.xml ) - - Modifies the quality of forms created with curve() and - curveVertex(). The parameter squishy determines how the - curve fits to the vertex points. The value 0.0 is the default value for - squishy (this value defines the curves to be Catmull-Rom splines) - and the value 1.0 connects all the points with straight lines. Values - within the range -5.0 and 5.0 will deform the curves but will leave them - recognizable and as values increase in magnitude, they will continue to deform. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        tightness - amount of deformation from the original vertices
        -
        See Also:
        -
        PGraphics.curve(float, float, float, float, float, float, float, float, float, float, float, float), -PGraphics.curveVertex(float, float)
        -
        -
      • -
      - - - -
        -
      • -

        curve

        -
        public void curve(float x1,
        -                  float y1,
        -                  float x2,
        -                  float y2,
        -                  float x3,
        -                  float y3,
        -                  float x4,
        -                  float y4)
        -
        ( begin auto-generated from curve.xml ) - - Draws a curved line on the screen. The first and second parameters - specify the beginning control point and the last two parameters specify - the ending control point. The middle parameters specify the start and - stop of the curve. Longer curves can be created by putting a series of - curve() functions together or using curveVertex(). An - additional function called curveTightness() provides control for - the visual quality of the curve. The curve() function is an - implementation of Catmull-Rom splines. Using the 3D version requires - rendering with P3D (see the Environment reference for more information). - - ( end auto-generated ) - -

        Advanced

        - As of revision 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();
        - 
        -
        -
        Parameters:
        -
        x1 - coordinates for the beginning control point
        -
        y1 - coordinates for the beginning control point
        -
        x2 - coordinates for the first point
        -
        y2 - coordinates for the first point
        -
        x3 - coordinates for the second point
        -
        y3 - coordinates for the second point
        -
        x4 - coordinates for the ending control point
        -
        y4 - coordinates for the ending control point
        -
        See Also:
        -
        PGraphics.curveVertex(float, float), -PGraphics.curveTightness(float), -PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Parameters:
        -
        z1 - coordinates for the beginning control point
        -
        z2 - coordinates for the first point
        -
        z3 - coordinates for the second point
        -
        z4 - coordinates for the ending control point
        -
        -
      • -
      - - - -
        -
      • -

        imageMode

        -
        public void imageMode(int mode)
        -
        ( begin auto-generated from imageMode.xml ) - - Modifies the location from which images draw. The default mode is - imageMode(CORNER), which specifies the location to be the upper - left corner and uses the fourth and fifth parameters of image() - to set the image's width and height. The syntax - imageMode(CORNERS) uses the second and third parameters of - image() to set the location of one corner of the image and uses - the fourth and fifth parameters to set the opposite corner. Use - imageMode(CENTER) to draw images centered at the given x and y - position.
        -
        - The parameter to imageMode() must be written in ALL CAPS because - Processing is a case-sensitive language. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CORNER, CORNERS, or CENTER
        -
        See Also:
        -
        loadImage(String, String), -PImage, -PGraphics.image(PImage, float, float, float, float), -PGraphics.background(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        image

        -
        public void image(PImage img,
        -                  float a,
        -                  float b)
        -
        ( begin auto-generated from image.xml ) - - Displays images to the screen. The images must be in the sketch's "data" - directory to load correctly. Select "Add file..." from the "Sketch" menu - to add the image. Processing currently works with GIF, JPEG, and Targa - images. The img parameter specifies the image to display and the - x and y parameters define the location of the image from - its upper-left corner. The image is displayed at its original size - unless the width and height parameters specify a different - size.
        -
        - The imageMode() function changes the way the parameters work. For - example, a call to imageMode(CORNERS) will change the - width and height parameters to define the x and y values - of the opposite corner of the image.
        -
        - The color of an image may be modified with the tint() function. - This function will maintain transparency for GIF and PNG images. - - ( end auto-generated ) - -

        Advanced

        - Starting with release 0124, when using the default (JAVA2D) renderer, - smooth() will also improve image quality of resized images.
        -
        -
        Parameters:
        -
        img - the image to display
        -
        a - x-coordinate of the image
        -
        b - y-coordinate of the image
        -
        See Also:
        -
        loadImage(String, String), -PImage, -PGraphics.imageMode(int), -PGraphics.tint(float), -PGraphics.background(float, float, float, float), -PGraphics.alpha(int)
        -
        -
      • -
      - - - -
        -
      • -

        image

        -
        public void image(PImage img,
        -                  float a,
        -                  float b,
        -                  float c,
        -                  float d)
        -
        -
        Parameters:
        -
        c - width to display the image
        -
        d - height to display the image
        -
        -
      • -
      - - - -
        -
      • -

        image

        -
        public void image(PImage img,
        -                  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)
        -
        ( begin auto-generated from shapeMode.xml ) - - Modifies the location from which shapes draw. The default mode is - shapeMode(CORNER), which specifies the location to be the upper - left corner of the shape and uses the third and fourth parameters of - shape() to specify the width and height. The syntax - shapeMode(CORNERS) uses the first and second parameters of - shape() to set the location of one corner and uses the third and - fourth parameters to set the opposite corner. The syntax - shapeMode(CENTER) draws the shape from its center point and uses - the third and forth parameters of shape() to specify the width - and height. The parameter must be written in "ALL CAPS" because - Processing is a case sensitive language. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CORNER, CORNERS, CENTER
        -
        See Also:
        -
        PShape, -PGraphics.shape(PShape), -PGraphics.rectMode(int)
        -
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape)
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float x,
        -                  float y)
        -
        ( begin auto-generated from shape.xml ) - - Displays shapes to the screen. The shapes must be in the sketch's "data" - directory to load correctly. Select "Add file..." from the "Sketch" menu - to add the shape. Processing currently works with SVG shapes only. The - sh parameter specifies the shape to display and the x and - y parameters define the location of the shape from its upper-left - corner. The shape is displayed at its original size unless the - width and height parameters specify a different size. The - shapeMode() function changes the way the parameters work. A call - to shapeMode(CORNERS), for example, will change the width and - height parameters to define the x and y values of the opposite corner of - the shape. -

        - Note complex shapes may draw awkwardly with P3D. This renderer does not - yet support shapes that have holes or complicated breaks. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        shape - the shape to display
        -
        x - x-coordinate of the shape
        -
        y - y-coordinate of the shape
        -
        See Also:
        -
        PShape, -loadShape(String), -Convenience method to draw at a particular location.
        -
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float a,
        -                  float b,
        -                  float c,
        -                  float d)
        -
        -
        Parameters:
        -
        a - x-coordinate of the shape
        -
        b - y-coordinate of the shape
        -
        c - width to display the shape
        -
        d - height to display the shape
        -
        -
      • -
      - - - -
        -
      • -

        textAlign

        -
        public void textAlign(int alignX)
        -
      • -
      - - - -
        -
      • -

        textAlign

        -
        public void textAlign(int alignX,
        -                      int alignY)
        -
        ( begin auto-generated from textAlign.xml ) - - Sets the current alignment for drawing text. The parameters LEFT, - CENTER, and RIGHT set the display characteristics of the letters in - relation to the values for the x and y parameters of the - text() function. -

        - In Processing 0125 and later, an optional second parameter can be used - to vertically align the text. BASELINE is the default, and the vertical - alignment will be reset to BASELINE if the second parameter is not used. - The TOP and CENTER parameters are straightforward. The BOTTOM parameter - offsets the line based on the current textDescent(). For multiple - lines, the final line will be aligned to the bottom, with the previous - lines appearing above it. -

        - When using text() with width and height parameters, BASELINE is - ignored, and treated as TOP. (Otherwise, text would by default draw - outside the box, since BASELINE is the default setting. BASELINE is not - a useful drawing mode for text drawn in a rectangle.) -

        - The vertical alignment is based on the value of textAscent(), - which many fonts do not specify correctly. It may be necessary to use a - hack and offset by a few pixels by hand so that the offset looks - correct. To do this as less of a hack, use some percentage of - textAscent() or textDescent() so that the hack works even - if you change the size of the font. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        alignX - horizontal alignment, either LEFT, CENTER, or RIGHT
        -
        alignY - vertical alignment, either TOP, BOTTOM, CENTER, or BASELINE
        -
        See Also:
        -
        loadFont(String), -PFont, -PGraphics.text(String, float, float), -PGraphics.textSize(float), -PGraphics.textAscent(), -PGraphics.textDescent()
        -
        -
      • -
      - - - -
        -
      • -

        textAscent

        -
        public float textAscent()
        -
        ( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size. This information - is useful for determining the height of the font above the baseline. For - example, adding the textAscent() and textDescent() values - will give you the total height of the line. - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.textDescent()
        -
        -
      • -
      - - - -
        -
      • -

        textDescent

        -
        public float textDescent()
        -
        ( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size. This - information is useful for determining the height of the font below the - baseline. For example, adding the textAscent() and - textDescent() values will give you the total height of the line. - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.textAscent()
        -
        -
      • -
      - - - -
        -
      • -

        textFont

        -
        public void textFont(PFont which)
        -
        ( begin auto-generated from textFont.xml ) - - Sets the current font that will be drawn with the text() - function. Fonts must be loaded with loadFont() before it can be - used. This font will be used in all subsequent calls to the - text() function. If no size parameter is input, the font - will appear at its original size (the size it was created at with the - "Create Font..." tool) until it is changed with textSize().

        Because fonts are usually bitmaped, you should create fonts at - the sizes that will be used most commonly. Using textFont() - without the size parameter will result in the cleanest-looking text.

        With the default (JAVA2D) and PDF renderers, it's also possible - to enable the use of native fonts via the command - hint(ENABLE_NATIVE_FONTS). This will produce vector text in - JAVA2D sketches and PDF output in cases where the vector data is - available: when the font is still installed, or the font is created via - the createFont() function (rather than the Create Font tool). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        which - any variable of the type PFont
        -
        See Also:
        -
        createFont(String, float, boolean), -loadFont(String), -PFont, -PGraphics.text(String, float, float), -PGraphics.textSize(float)
        -
        -
      • -
      - - - -
        -
      • -

        textFont

        -
        public void textFont(PFont which,
        -                     float size)
        -
        -
        Parameters:
        -
        size - the size of the letters in units of pixels
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textMode

        -
        public void textMode(int mode)
        -
        ( begin auto-generated from textMode.xml ) - - Sets the way text draws to the screen. In the default configuration, the - MODEL mode, it's possible to rotate, scale, and place letters in - two and three dimensional space.
        -
        - The SHAPE mode draws text using the the glyph outlines of - individual characters rather than as textures. This mode is only - supported with the PDF and P3D renderer settings. With the - PDF renderer, you must call textMode(SHAPE) before any - other drawing occurs. If the outlines are not available, then - textMode(SHAPE) will be ignored and textMode(MODEL) will - be used instead.
        -
        - The textMode(SHAPE) option in P3D can be combined with - beginRaw() to write vector-accurate text to 2D and 3D output - files, for instance DXF or PDF. The SHAPE mode is - not currently optimized for P3D, so if recording shape data, use - textMode(MODEL) until you're ready to capture the geometry with beginRaw(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either MODEL or SHAPE
        -
        See Also:
        -
        loadFont(String), -PFont.PFont(java.io.InputStream), -PGraphics.text(String, float, float), -PGraphics.textFont(PFont), -PGraphics.beginRaw(PGraphics), -createFont(String, float, boolean)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textWidth

        -
        public float textWidth(char c)
        -
        -
        Parameters:
        -
        c - the character to measure
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textWidth

        -
        public float textWidth(char[] chars,
        -                       int start,
        -                       int length)
        -
      • -
      - - - - - - - -
        -
      • -

        text

        -
        public void text(char c,
        -                 float x,
        -                 float y,
        -                 float z)
        -
        -
        Parameters:
        -
        z - z-coordinate of text
        -
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(String str,
        -                 float x,
        -                 float y)
        -

        Advanced

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

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        chars - the alphanumberic symbols to be displayed
        -
        start - array index at which to start writing characters
        -
        stop - array index at which to stop writing characters
        -
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(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(String str,
        -                 float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2)
        -

        Advanced

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

        -
        -
        Parameters:
        -
        x1 - by default, the x-coordinate of text, see rectMode() for more info
        -
        y1 - by default, the x-coordinate of text, see rectMode() for more info
        -
        x2 - by default, the width of the text box, see rectMode() for more info
        -
        y2 - by default, the height of the text box, see rectMode() for more info
        -
        -
      • -
      - - - -
        -
      • -

        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.
        -
        -
        Parameters:
        -
        num - the numeric value to be displayed
        -
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(float num,
        -                 float x,
        -                 float y,
        -                 float z)
        -
      • -
      - - - - - - - -
        -
      • -

        popMatrix

        -
        public void popMatrix()
        -
        ( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack. - Understanding pushing and popping requires understanding the concept of - a matrix stack. The pushMatrix() function saves the current - coordinate system to the stack and popMatrix() restores the prior - coordinate system. pushMatrix() and popMatrix() are used - in conjuction with the other transformation functions and may be - embedded to control the scope of the transformations. - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.pushMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float x,
        -                      float y)
        -
        ( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window. The - x parameter specifies left/right translation, the y - parameter specifies up/down translation, and the z parameter - specifies translations toward/away from the screen. Using this function - with the z parameter requires using P3D as a parameter in - combination with size as shown in the above example. Transformations - apply to everything that happens after and subsequent calls to the - function accumulates the effect. For example, calling translate(50, - 0) and then translate(20, 0) is the same as translate(70, - 0). If translate() is called within draw(), the - transformation is reset when the loop begins again. This function can be - further controlled by the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - left/right translation
        -
        y - up/down translation
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float x,
        -                      float y,
        -                      float z)
        -
        -
        Parameters:
        -
        z - forward/backward translation
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle)
        -
        ( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter. - Angles should be specified in radians (values from 0 to TWO_PI) or - converted to radians with the radians() function. -

        - Objects are always rotated around their relative position to the origin - and positive numbers rotate objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - rotate(HALF_PI) and then rotate(HALF_PI) is the same as - rotate(PI). All tranformations are reset when draw() - begins again. -

        - Technically, rotate() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateX(PI/2) and then rotateX(PI/2) is the same - as rotateX(PI). If rotateX() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the example above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateY(PI/2) and then rotateY(PI/2) is the same - as rotateY(PI). If rotateY() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateZ(PI/2) and then rotateZ(PI/2) is the same - as rotateZ(PI). If rotateZ() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle,
        -                   float x,
        -                   float y,
        -                   float z)
        -

        Advanced

        - Rotate about a vector in space. Same as the glRotatef() function.
        -
        -
        Parameters:
        -
        x -
        -
        y -
        -
        z -
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float s)
        -
        ( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices. Objects always scale from their relative origin to the - coordinate system. Scale values are specified as decimal percentages. - For example, the function call scale(2.0) increases the dimension - of a shape by 200%. Transformations apply to everything that happens - after and subsequent calls to the function multiply the effect. For - example, calling scale(2.0) and then scale(1.5) is the - same as scale(3.0). If scale() is called within - draw(), the transformation is reset when the loop begins again. - Using this fuction with the z parameter requires using P3D as a - parameter for size() as shown in the example above. This function - can be further controlled by pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        s - percentage to scale the object
        -
        See Also:
        -
        PGraphics.pushMatrix(), -PGraphics.popMatrix(), -PGraphics.translate(float, float, float), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float)
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y)
        -

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        x - percentage to scale the object in the x-axis
        -
        y - percentage to scale the object in the y-axis
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y,
        -                  float z)
        -
        -
        Parameters:
        -
        z - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - -
        -
      • -

        shearX

        -
        public void shearX(float angle)
        -
        ( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearX(PI/2) and then shearX(PI/2) is the same as - shearX(PI). If shearX() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearX() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        public void shearY(float angle)
        -
        ( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearY(PI/2) and then shearY(PI/2) is the same as - shearY(PI). If shearY() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearY() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearX(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -radians(float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(PMatrix source)
        -
        ( begin auto-generated from applyMatrix.xml ) - - Multiplies the current matrix by the one specified through the - parameters. This is very slow because it will try to calculate the - inverse of the transform, so avoid it whenever possible. The equivalent - function in OpenGL is glMultMatrix(). - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.pushMatrix(), -PGraphics.popMatrix(), -PGraphics.resetMatrix(), -PGraphics.printMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(PMatrix2D source)
        -
      • -
      - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(float n00,
        -                        float n01,
        -                        float n02,
        -                        float n10,
        -                        float n11,
        -                        float n12)
        -
        -
        Parameters:
        -
        n00 - numbers which define the 4x4 matrix to be multiplied
        -
        n01 - numbers which define the 4x4 matrix to be multiplied
        -
        n02 - numbers which define the 4x4 matrix to be multiplied
        -
        n10 - numbers which define the 4x4 matrix to be multiplied
        -
        n11 - numbers which define the 4x4 matrix to be multiplied
        -
        n12 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Parameters:
        -
        n03 - numbers which define the 4x4 matrix to be multiplied
        -
        n13 - numbers which define the 4x4 matrix to be multiplied
        -
        n20 - numbers which define the 4x4 matrix to be multiplied
        -
        n21 - numbers which define the 4x4 matrix to be multiplied
        -
        n22 - numbers which define the 4x4 matrix to be multiplied
        -
        n23 - numbers which define the 4x4 matrix to be multiplied
        -
        n30 - numbers which define the 4x4 matrix to be multiplied
        -
        n31 - numbers which define the 4x4 matrix to be multiplied
        -
        n32 - numbers which define the 4x4 matrix to be multiplied
        -
        n33 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - -
        -
      • -

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

        beginCamera

        -
        public void beginCamera()
        -
        ( begin auto-generated from beginCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space. The functions are useful if - you want to more control over camera movement, however for most users, - the camera() function will be sufficient.

        The camera - functions will replace any transformations (such as rotate() or - translate()) that occur before them in draw(), but they - will not automatically replace the camera transform itself. For this - reason, camera functions should be placed at the beginning of - draw() (so that transformations happen afterwards), and the - camera() function can be used after beginCamera() if you - want to reset the camera before applying transformations.

        This function sets the matrix mode to the camera matrix so calls such - as translate(), rotate(), applyMatrix() and resetMatrix() - affect the camera. beginCamera() should always be used with a - following endCamera() and pairs of beginCamera() and - endCamera() cannot be nested. - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.camera(), -PGraphics.endCamera(), -PGraphics.applyMatrix(PMatrix), -PGraphics.resetMatrix(), -PGraphics.translate(float, float, float), -PGraphics.scale(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        endCamera

        -
        public void endCamera()
        -
        ( begin auto-generated from endCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space. Please see the reference for - beginCamera() for a description of how the functions are used. - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.camera(float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        camera

        -
        public void camera()
        -
        ( begin auto-generated from camera.xml ) - - Sets the position of the camera through setting the eye position, the - center of the scene, and which axis is facing upward. Moving the eye - position and the direction it is pointing (the center of the scene) - allows the images to be seen from different angles. The version without - any parameters sets the camera to the default position, pointing to the - center of the display window with the Y axis as up. The default values - are camera(width/2.0, height/2.0, (height/2.0) / tan(PI*30.0 / - 180.0), width/2.0, height/2.0, 0, 0, 1, 0). This function is similar - to gluLookAt() in OpenGL, but it first clears the current camera settings. - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.endCamera(), -PGraphics.frustum(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        camera

        -
        public void camera(float eyeX,
        -                   float eyeY,
        -                   float eyeZ,
        -                   float centerX,
        -                   float centerY,
        -                   float centerZ,
        -                   float upX,
        -                   float upY,
        -                   float upZ)
        -
        -
        Parameters:
        -
        eyeX - x-coordinate for the eye
        -
        eyeY - y-coordinate for the eye
        -
        eyeZ - z-coordinate for the eye
        -
        centerX - x-coordinate for the center of the scene
        -
        centerY - y-coordinate for the center of the scene
        -
        centerZ - z-coordinate for the center of the scene
        -
        upX - usually 0.0, 1.0, or -1.0
        -
        upY - usually 0.0, 1.0, or -1.0
        -
        upZ - usually 0.0, 1.0, or -1.0
        -
        -
      • -
      - - - - - - - -
        -
      • -

        ortho

        -
        public void ortho()
        -
        ( begin auto-generated from ortho.xml ) - - Sets an orthographic projection and defines a parallel clipping volume. - All objects with the same dimension appear the same size, regardless of - whether they are near or far from the camera. The parameters to this - function specify the clipping volume where left and right are the - minimum and maximum x values, top and bottom are the minimum and maximum - y values, and near and far are the minimum and maximum z values. If no - parameters are given, the default is used: ortho(0, width, 0, height, - -10, 10). - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho(float left,
        -                  float right,
        -                  float bottom,
        -                  float top)
        -
        -
        Parameters:
        -
        left - left plane of the clipping volume
        -
        right - right plane of the clipping volume
        -
        bottom - bottom plane of the clipping volume
        -
        top - top plane of the clipping volume
        -
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho(float left,
        -                  float right,
        -                  float bottom,
        -                  float top,
        -                  float near,
        -                  float far)
        -
        -
        Parameters:
        -
        near - maximum distance from the origin to the viewer
        -
        far - maximum distance from the origin away from the viewer
        -
        -
      • -
      - - - -
        -
      • -

        perspective

        -
        public void perspective()
        -
        ( begin auto-generated from perspective.xml ) - - Sets a perspective projection applying foreshortening, making distant - objects appear smaller than closer ones. The parameters define a viewing - volume with the shape of truncated pyramid. Objects near to the front of - the volume appear their actual size, while farther objects appear - smaller. This projection simulates the perspective of the world more - accurately than orthographic projection. The version of perspective - without parameters sets the default perspective and the version with - four parameters allows the programmer to set the area precisely. The - default values are: perspective(PI/3.0, width/height, cameraZ/10.0, - cameraZ*10.0) where cameraZ is ((height/2.0) / tan(PI*60.0/360.0)); - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        perspective

        -
        public void perspective(float fovy,
        -                        float aspect,
        -                        float zNear,
        -                        float zFar)
        -
        -
        Parameters:
        -
        fovy - field-of-view angle (in radians) for vertical direction
        -
        aspect - ratio of width to height
        -
        zNear - z-position of nearest clipping plane
        -
        zFar - z-position of farthest clipping plane
        -
        -
      • -
      - - - -
        -
      • -

        frustum

        -
        public void frustum(float left,
        -                    float right,
        -                    float bottom,
        -                    float top,
        -                    float near,
        -                    float far)
        -
        ( begin auto-generated from frustum.xml ) - - Sets a perspective matrix defined through the parameters. Works like - glFrustum, except it wipes out the current perspective matrix rather - than muliplying itself with it. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        left - left coordinate of the clipping plane
        -
        right - right coordinate of the clipping plane
        -
        bottom - bottom coordinate of the clipping plane
        -
        top - top coordinate of the clipping plane
        -
        near - near component of the clipping plane; must be greater than zero
        -
        far - far component of the clipping plane; must be greater than the near value
        -
        See Also:
        -
        PGraphics.camera(float, float, float, float, float, float, float, float, float), -PGraphics.endCamera(), -PGraphics.perspective(float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y)
        -
        ( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenY(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y)
        -
        ( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y,
        -                     float z)
        -
        -
        Parameters:
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y,
        -                     float z)
        -
        -
        Parameters:
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenZ

        -
        public float screenZ(float x,
        -                     float y,
        -                     float z)
        -
        ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenY(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelX

        -
        public float modelX(float x,
        -                    float y,
        -                    float z)
        -
        ( begin auto-generated from modelX.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the X value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The X value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use. -

        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.modelY(float, float, float), -PGraphics.modelZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelY

        -
        public float modelY(float x,
        -                    float y,
        -                    float z)
        -
        ( begin auto-generated from modelY.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the Y value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The Y value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use.
        -
        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.modelX(float, float, float), -PGraphics.modelZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelZ

        -
        public float modelZ(float x,
        -                    float y,
        -                    float z)
        -
        ( begin auto-generated from modelZ.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the Z value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The Z value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use.
        -
        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.modelX(float, float, float), -PGraphics.modelY(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        pushStyle

        -
        public void pushStyle()
        -
        ( begin auto-generated from pushStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings. Note that these functions - are always used together. They allow you to change the style settings - and later return to what you had. When a new style is started with - pushStyle(), it builds on the current style information. The - pushStyle() and popStyle() functions can be embedded to - provide more control (see the second example above for a demonstration.) -

        - The style information controlled by the following functions are included - in the style: - fill(), stroke(), tint(), strokeWeight(), strokeCap(), strokeJoin(), - imageMode(), rectMode(), ellipseMode(), shapeMode(), colorMode(), - textAlign(), textFont(), textMode(), textSize(), textLeading(), - emissive(), specular(), shininess(), ambient() - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.popStyle()
        -
        -
      • -
      - - - -
        -
      • -

        popStyle

        -
        public void popStyle()
        -
        ( begin auto-generated from popStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings; these functions are - always used together. They allow you to change the style settings and - later return to what you had. When a new style is started with - pushStyle(), it builds on the current style information. The - pushStyle() and popStyle() functions can be embedded to - provide more control (see the second example above for a demonstration.) - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.pushStyle()
        -
        -
      • -
      - - - -
        -
      • -

        style

        -
        public void style(PStyle s)
        -
      • -
      - - - -
        -
      • -

        strokeWeight

        -
        public void strokeWeight(float weight)
        -
        ( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes. All widths are set in units of pixels. -

        - When drawing with P3D, series of connected lines (such as the stroke - around a polygon, triangle, or ellipse) produce unattractive results - when a thick stroke weight is set (see - Issue 123). With P3D, the minimum and maximum values for - strokeWeight() are controlled by the graphics card and the - operating system's OpenGL implementation. For instance, the thickness - may not go higher than 10 pixels. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        weight - the weight (in pixels) of the stroke
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        strokeJoin

        -
        public void strokeJoin(int join)
        -
        ( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments. These joints - are either mitered, beveled, or rounded and specified with the - corresponding parameters MITER, BEVEL, and ROUND. The default joint is - MITER. -

        - This function is not available with the P3D renderer, (see - Issue 123). More information about the renderers can be found in the - size() reference. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        join - either MITER, BEVEL, ROUND
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeWeight(float), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        strokeCap

        -
        public void strokeCap(int cap)
        -
        ( begin auto-generated from strokeCap.xml ) - - Sets the style for rendering line endings. These ends are either - squared, extended, or rounded and specified with the corresponding - parameters SQUARE, PROJECT, and ROUND. The default cap is ROUND. -

        - This function is not available with the P3D renderer (see - Issue 123). More information about the renderers can be found in the - size() reference. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        cap - either SQUARE, PROJECT, or ROUND
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeWeight(float), -PGraphics.strokeJoin(int), -size(int, int, String, String)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        stroke

        -
        public void stroke(int rgb)
        -
        ( begin auto-generated from stroke.xml ) - - Sets the color used to draw lines and borders around shapes. This color - is either specified in terms of the RGB or HSB color depending on the - current colorMode() (the default color space is RGB, with each - value in the range from 0 to 255). -

        - When using hexadecimal notation to specify a color, use "#" or "0x" - before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six - digits to specify a color (the way colors are specified in HTML and - CSS). When using the hexadecimal notation starting with "0x", the - hexadecimal value must be specified with eight characters; the first two - characters define the alpha component and the remainder the red, green, - and blue components. -

        - The value for the parameter "gray" must be less than or equal to the - current maximum value as specified by colorMode(). The default - maximum value is 255. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color value in hexadecimal notation
        -
        See Also:
        -
        PGraphics.noStroke(), -PGraphics.strokeWeight(float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int), -PGraphics.fill(int, float), -PGraphics.noFill(), -PGraphics.tint(int, float), -PGraphics.background(float, float, float, float), -PGraphics.colorMode(int, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(int rgb,
        -                   float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the stroke
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float gray)
        -
        -
        Parameters:
        -
        gray - specifies a value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float gray,
        -                   float alpha)
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float v1,
        -                   float v2,
        -                   float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float v1,
        -                   float v2,
        -                   float v3,
        -                   float alpha)
        -
      • -
      - - - - - - - -
        -
      • -

        tint

        -
        public void tint(int rgb)
        -
        ( begin auto-generated from tint.xml ) - - Sets the fill value for displaying images. Images can be tinted to - specified colors or made transparent by setting the alpha.
        -
        - To make an image transparent, but not change it's color, use white as - the tint color and specify an alpha value. For instance, tint(255, 128) - will make an image 50% transparent (unless colorMode() has been - used).
        -
        - When using hexadecimal notation to specify a color, use "#" or "0x" - before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six - digits to specify a color (the way colors are specified in HTML and - CSS). When using the hexadecimal notation starting with "0x", the - hexadecimal value must be specified with eight characters; the first two - characters define the alpha component and the remainder the red, green, - and blue components.
        -
        - The value for the parameter "gray" must be less than or equal to the - current maximum value as specified by colorMode(). The default - maximum value is 255.
        -
        - The tint() function is also used to control the coloring of - textures in 3D. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color value in hexadecimal notation
        -
        See Also:
        -
        PGraphics.noTint(), -PGraphics.image(PImage, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(int rgb,
        -                 float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the image
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float gray)
        -
        -
        Parameters:
        -
        gray - specifies a value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float gray,
        -                 float alpha)
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float v1,
        -                 float v2,
        -                 float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float v1,
        -                 float v2,
        -                 float v3,
        -                 float alpha)
        -
      • -
      - - - - - - - -
        -
      • -

        fill

        -
        public void fill(int rgb)
        -
        ( begin auto-generated from fill.xml ) - - Sets the color used to fill shapes. For example, if you run fill(204, - 102, 0), all subsequent shapes will be filled with orange. This - color is either specified in terms of the RGB or HSB color depending on - the current colorMode() (the default color space is RGB, with - each value in the range from 0 to 255). -

        - When using hexadecimal notation to specify a color, use "#" or "0x" - before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six - digits to specify a color (the way colors are specified in HTML and - CSS). When using the hexadecimal notation starting with "0x", the - hexadecimal value must be specified with eight characters; the first two - characters define the alpha component and the remainder the red, green, - and blue components. -

        - The value for the parameter "gray" must be less than or equal to the - current maximum value as specified by colorMode(). The default - maximum value is 255. -

        - To change the color of an image (or a texture), use tint(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color variable or hex value
        -
        See Also:
        -
        PGraphics.noFill(), -PGraphics.stroke(int, float), -PGraphics.noStroke(), -PGraphics.tint(int, float), -PGraphics.background(float, float, float, float), -PGraphics.colorMode(int, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(int rgb,
        -                 float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the fill
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float gray)
        -
        -
        Parameters:
        -
        gray - number specifying value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float gray,
        -                 float alpha)
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float v1,
        -                 float v2,
        -                 float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float v1,
        -                 float v2,
        -                 float v3,
        -                 float alpha)
        -
      • -
      - - - -
        -
      • -

        ambient

        -
        public void ambient(int rgb)
        -
        ( begin auto-generated from ambient.xml ) - - Sets the ambient reflectance for shapes drawn to the screen. This is - combined with the ambient light component of environment. The color - components set through the parameters define the reflectance. For - example in the default color mode, setting v1=255, v2=126, v3=0, would - cause all the red light to reflect and half of the green light to - reflect. Used in combination with emissive(), specular(), - and shininess() in setting the material properties of shapes. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        PGraphics.emissive(float, float, float), -PGraphics.specular(float, float, float), -PGraphics.shininess(float)
        -
        -
      • -
      - - - -
        -
      • -

        ambient

        -
        public void ambient(float gray)
        -
        -
        Parameters:
        -
        gray - number specifying value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        ambient

        -
        public void ambient(float v1,
        -                    float v2,
        -                    float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        specular

        -
        public void specular(float gray)
        -
        gray number specifying value between white and black
        -
      • -
      - - - -
        -
      • -

        specular

        -
        public void specular(float v1,
        -                     float v2,
        -                     float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        emissive

        -
        public void emissive(float gray)
        -
        gray number specifying value between white and black
        -
      • -
      - - - -
        -
      • -

        emissive

        -
        public void emissive(float v1,
        -                     float v2,
        -                     float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        noLights

        -
        public void noLights()
        -
        ( begin auto-generated from noLights.xml ) - - Disable all lighting. Lighting is turned off by default and enabled with - the lights() function. This function can be used to disable - lighting so that 2D geometry (which does not require lighting) can be - drawn after a set of lighted 3D geometry. - - ( end auto-generated )
        -
        -
        See Also:
        -
        PGraphics.lights()
        -
        -
      • -
      - - - - - - - -
        -
      • -

        ambientLight

        -
        public void ambientLight(float v1,
        -                         float v2,
        -                         float v3,
        -                         float x,
        -                         float y,
        -                         float z)
        -
        -
        Parameters:
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        -
      • -
      - - - -
        -
      • -

        directionalLight

        -
        public void directionalLight(float v1,
        -                             float v2,
        -                             float v3,
        -                             float nx,
        -                             float ny,
        -                             float nz)
        -
        ( begin auto-generated from directionalLight.xml ) - - Adds a directional light. Directional light comes from one direction and - is stronger when hitting a surface squarely and weaker if it hits at a a - gentle angle. After hitting a surface, a directional lights scatters in - all directions. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The nx, ny, and nz parameters specify the - direction the light is facing. For example, setting ny to -1 will - cause the geometry to be lit from below (the light is facing directly upward). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        nx - direction along the x-axis
        -
        ny - direction along the y-axis
        -
        nz - direction along the z-axis
        -
        See Also:
        -
        PGraphics.lights(), -PGraphics.ambientLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        spotLight

        -
        public void spotLight(float v1,
        -                      float v2,
        -                      float v3,
        -                      float x,
        -                      float y,
        -                      float z,
        -                      float nx,
        -                      float ny,
        -                      float nz,
        -                      float angle,
        -                      float concentration)
        -
        ( begin auto-generated from spotLight.xml ) - - Adds a spot light. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The x, y, and z parameters specify the - position of the light and nx, ny, nz specify the - direction or light. The angle parameter affects angle of the - spotlight cone. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        nx - direction along the x axis
        -
        ny - direction along the y axis
        -
        nz - direction along the z axis
        -
        angle - angle of the spotlight cone
        -
        concentration - exponent determining the center bias of the cone
        -
        See Also:
        -
        PGraphics.lights(), -PGraphics.directionalLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.ambientLight(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        lightFalloff

        -
        public void lightFalloff(float constant,
        -                         float linear,
        -                         float quadratic)
        -
        ( begin auto-generated from lightFalloff.xml ) - - Sets the falloff rates for point lights, spot lights, and ambient - lights. The parameters are used to determine the falloff with the - following equation:

        d = distance from light position to - vertex position
        falloff = 1 / (CONSTANT + d * LINEAR + (d*d) * - QUADRATIC)

        Like fill(), it affects only the elements - which are created after it in the code. The default value if - LightFalloff(1.0, 0.0, 0.0). Thinking about an ambient light with - a falloff can be tricky. It is used, for example, if you wanted a region - of your scene to be lit ambiently one color and another region to be lit - ambiently by another color, you would use an ambient light with location - and falloff. You can think of it as a point light that doesn't care - which direction a surface is facing. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        constant - constant value or determining falloff
        -
        linear - linear value for determining falloff
        -
        quadratic - quadratic value for determining falloff
        -
        See Also:
        -
        PGraphics.lights(), -PGraphics.ambientLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float), -PGraphics.lightSpecular(float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        background

        -
        public void background(int rgb)
        -
        ( begin auto-generated from background.xml ) - - The background() function sets the color used for the background - of the Processing window. The default background is light gray. In the - draw() function, the background color is used to clear the - display window at the beginning of each frame. -

        - An image can also be used as the background for a sketch, however its - width and height must be the same size as the sketch window. To resize - an image 'b' to the size of the sketch window, use b.resize(width, height). -

        - Images used as background will ignore the current tint() setting. -

        - It is not possible to use transparency (alpha) in background colors with - the main drawing surface, however they will work properly with createGraphics(). - - ( end auto-generated ) - -

        Advanced

        -

        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.

        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        PGraphics.stroke(float), -PGraphics.fill(float), -PGraphics.tint(float), -PGraphics.colorMode(int)
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(int rgb,
        -                       float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the background
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float gray)
        -
        -
        Parameters:
        -
        gray - specifies a value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float gray,
        -                       float alpha)
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float v1,
        -                       float v2,
        -                       float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on the current color mode)
        -
        v2 - green or saturation value (depending on the current color mode)
        -
        v3 - blue or brightness value (depending on the current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float v1,
        -                       float v2,
        -                       float v3,
        -                       float alpha)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
      • -
      - - - -
        -
      • -

        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. Use image.filter(OPAQUE) to handle this easily.
        -
        - When using 3D, this will also clear the zbuffer (if it exists).
        -
        -
        Parameters:
        -
        image - PImage to set as background (must be same size as the sketch window)
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode)
        -
        ( begin auto-generated from colorMode.xml ) - - Changes the way Processing interprets color data. By default, the - parameters for fill(), stroke(), background(), and - color() are defined by values between 0 and 255 using the RGB - color model. The colorMode() function is used to change the - numerical range used for specifying colors and to switch color systems. - For example, calling colorMode(RGB, 1.0) will specify that values - are specified between 0 and 1. The limits for defining colors are - altered by setting the parameters range1, range2, range3, and range 4. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - Either RGB or HSB, corresponding to Red/Green/Blue and Hue/Saturation/Brightness
        -
        See Also:
        -
        PGraphics.background(float), -PGraphics.fill(float), -PGraphics.stroke(float)
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float max)
        -
        -
        Parameters:
        -
        max - range for all color elements
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float max1,
        -                      float max2,
        -                      float max3)
        -
        -
        Parameters:
        -
        max1 - range for the red or hue depending on the current color mode
        -
        max2 - range for the green or saturation depending on the current color mode
        -
        max3 - range for the blue or brightness depending on the current color mode
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float max1,
        -                      float max2,
        -                      float max3,
        -                      float maxA)
        -
        -
        Parameters:
        -
        maxA - range for the alpha
        -
        -
      • -
      - - - - - - - -
        -
      • -

        red

        -
        public final float red(int rgb)
        -
        ( begin auto-generated from red.xml ) - - Extracts the red value from a color, scaled to match current - colorMode(). This value is always returned as a float so be - careful not to assign it to an int value.

        The red() function - is easy to use and undestand, but is slower than another technique. To - achieve the same results when working in colorMode(RGB, 255), but - with greater speed, use the >> (right shift) operator with a bit - mask. For example, the following two lines of code are equivalent:
        float r1 = red(myColor);
        float r2 = myColor >> 16 - & 0xFF;
        - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        PGraphics.green(int), -PGraphics.blue(int), -PGraphics.alpha(int), -PGraphics.hue(int), -PGraphics.saturation(int), -PGraphics.brightness(int)
        -
        -
      • -
      - - - -
        -
      • -

        green

        -
        public final float green(int rgb)
        -
        ( begin auto-generated from green.xml ) - - Extracts the green value from a color, scaled to match current - colorMode(). This value is always returned as a float so be - careful not to assign it to an int value.

        The green() - function is easy to use and undestand, but is slower than another - technique. To achieve the same results when working in colorMode(RGB, - 255), but with greater speed, use the >> (right shift) - operator with a bit mask. For example, the following two lines of code - are equivalent:
        float r1 = green(myColor);
        float r2 = - myColor >> 8 & 0xFF;
        - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        PGraphics.red(int), -PGraphics.blue(int), -PGraphics.alpha(int), -PGraphics.hue(int), -PGraphics.saturation(int), -PGraphics.brightness(int)
        -
        -
      • -
      - - - -
        -
      • -

        blue

        -
        public final float blue(int rgb)
        -
        ( begin auto-generated from blue.xml ) - - Extracts the blue value from a color, scaled to match current - colorMode(). This value is always returned as a float so be - careful not to assign it to an int value.

        The blue() - function is easy to use and undestand, but is slower than another - technique. To achieve the same results when working in colorMode(RGB, - 255), but with greater speed, use a bit mask to remove the other - color components. For example, the following two lines of code are - equivalent:
        float r1 = blue(myColor);
        float r2 = myColor - & 0xFF;
        - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        PGraphics.red(int), -PGraphics.green(int), -PGraphics.alpha(int), -PGraphics.hue(int), -PGraphics.saturation(int), -PGraphics.brightness(int)
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        lerpColor

        -
        public static int lerpColor(int c1,
        -                            int c2,
        -                            float amt,
        -                            int mode)
        -
      • -
      - - - -
        -
      • -

        showDepthWarning

        -
        public static void showDepthWarning(String method)
        -
        Display a warning that the specified method is only available with 3D.
        -
        -
        Parameters:
        -
        method - The method name (no parentheses)
        -
        -
      • -
      - - - -
        -
      • -

        showDepthWarningXYZ

        -
        public static void showDepthWarningXYZ(String method)
        -
        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.
        -
        -
        Parameters:
        -
        method - The method name (no parentheses)
        -
        -
      • -
      - - - -
        -
      • -

        showMethodWarning

        -
        public static void showMethodWarning(String method)
        -
        Display a warning that the specified method is simply unavailable.
        -
      • -
      - - - -
        -
      • -

        showVariationWarning

        -
        public static void showVariationWarning(String str)
        -
        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.
        -
      • -
      - - - -
        -
      • -

        showMissingWarning

        -
        public static void showMissingWarning(String method)
        -
        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.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get(int x,
        -               int y)
        -
        ( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image. If no - parameters are specified, the entire image is returned. Use the x - and y parameters to get the value of one pixel. Get a section of - the display window by specifying an additional width and - height parameter. When getting an image, the x and - y parameters define the coordinates for the upper-left corner of - the image, regardless of the current imageMode().
        -
        - If the pixel requested is outside of the image window, black is - returned. The numbers returned are scaled according to the current color - ranges, but only RGB values are returned by this function. For example, - even though you may have drawn a shape with colorMode(HSB), the - numbers returned will be in RGB format.
        -
        - Getting the color of a single pixel with get(x, y) is easy, but - not as fast as grabbing the data directly from pixels[]. The - equivalent statement to get(x, y) using pixels[] is - pixels[y*width+x]. See the reference for pixels[] for more information. - - ( end auto-generated ) - -

        Advanced

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

        -
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        See Also:
        -
        set(int, int, int), -pixels, -copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public PImage get(int x,
        -                  int y,
        -                  int w,
        -                  int h)
        -
        -
        Parameters:
        -
        w - width of pixel rectangle to get
        -
        h - height of pixel rectangle to get
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public PImage get()
        -
        Returns a copy of this PImage. Equivalent to get(0, 0, width, height). - Deprecated, just use copy() instead.
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public PImage copy()
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                int c)
        -
        ( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
        -
        - The x and y parameters specify the pixel to change and the - color parameter specifies the color value. The color parameter is - affected by the current color mode (the default is RGB values from 0 to - 255). When setting an image, the x and y parameters define - the coordinates for the upper-left corner of the image, regardless of - the current imageMode(). -

        - Setting the color of a single pixel with set(x, y) is easy, but - not as fast as putting the data directly into pixels[]. The - equivalent statement to set(x, y, #000000) using pixels[] - is pixels[y*width+x] = #000000. See the reference for - pixels[] for more information. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        c - any value of the color datatype
        -
        See Also:
        -
        PImage.get(int, int, int, int), -PImage.pixels, -PImage.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                PImage img)
        -

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        img - image to copy into the original image
        -
        -
      • -
      - - - -
        -
      • -

        mask

        -
        public void mask(PImage img)
        -
        ( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel. This mask image should only contain - grayscale data, but only the blue color channel is used. The mask image - needs to be the same size as the image to which it is applied.
        -
        - In addition to using a mask image, an integer array containing the alpha - channel data can be specified directly. This method is useful for - creating dynamically generated alpha masks. This array must be of the - same length as the target image's pixels array and should contain only - grayscale data of values between 0-255. - - ( end auto-generated ) - -

        Advanced

        - - 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" grayscale by - performing a proper luminance-based conversion.

        -
        -
        Parameters:
        -
        maskArray - array of integers used as the alpha channel, needs to be the same length as the image's pixel array
        -
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(int kind)
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(int kind,
        -                   float param)
        -
        ( begin auto-generated from PImage_filter.xml ) - - Filters an image as defined by one of the following modes:

        THRESHOLD - converts the image to black and white pixels depending if - they are above or below the threshold defined by the level parameter. - The level must be between 0.0 (black) and 1.0(white). If no level is - specified, 0.5 is used.
        -
        - GRAY - converts any colors in the image to grayscale equivalents
        -
        - INVERT - sets each pixel to its inverse value
        -
        - POSTERIZE - limits each channel of the image to the number of colors - specified as the level parameter
        -
        - BLUR - executes a Guassian blur with the level parameter specifying the - extent of the blurring. If no level parameter is used, the blur is - equivalent to Guassian blur of radius 1
        -
        - OPAQUE - sets the alpha channel to entirely opaque
        -
        - ERODE - reduces the light areas with the amount defined by the level - parameter
        -
        - DILATE - increases the light areas with the amount defined by the level parameter - - ( end auto-generated ) - -

        Advanced

        - 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

        -
        -
        Parameters:
        -
        kind - Either THRESHOLD, GRAY, OPAQUE, INVERT, POSTERIZE, BLUR, ERODE, or DILATE
        -
        param - unique for each, see above
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(int sx,
        -                 int sy,
        -                 int sw,
        -                 int sh,
        -                 int dx,
        -                 int dy,
        -                 int dw,
        -                 int dh)
        -
        ( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another. If the source and - destination regions aren't the same size, it will automatically resize - source pixels to fit the specified target region. No alpha information - is used in the process, however if the source image has an alpha channel - set, it will be copied as well. -

        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        sx - X coordinate of the source's upper left corner
        -
        sy - Y coordinate of the source's upper left corner
        -
        sw - source image width
        -
        sh - source image height
        -
        dx - X coordinate of the destination's upper left corner
        -
        dy - Y coordinate of the destination's upper left corner
        -
        dw - destination image width
        -
        dh - destination image height
        -
        See Also:
        -
        PGraphics.alpha(int), -PImage.blend(PImage, int, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(PImage src,
        -                 int sx,
        -                 int sy,
        -                 int sw,
        -                 int sh,
        -                 int dx,
        -                 int dy,
        -                 int dw,
        -                 int dh)
        -
        -
        Parameters:
        -
        src - an image variable referring to the source image.
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from PImage_blend.xml ) - - Blends a region of pixels into the image specified by the img - parameter. These copies utilize full alpha channel support and a choice - of the following modes to blend the colors of source pixels (A) with the - ones of pixels in the destination image (B):
        -
        - BLEND - linear interpolation of colours: C = A*factor + B
        -
        - ADD - additive blending with white clip: C = min(A*factor + B, 255)
        -
        - SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, - 0)
        -
        - DARKEST - only the darkest colour succeeds: C = min(A*factor, B)
        -
        - LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)
        -
        - 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.
        -
        - All modes use the alpha information (highest byte) of source image - pixels as the blending factor. If the source and destination regions are - different sizes, the image will be automatically resized to match the - destination size. If the srcImg parameter is not used, the - display window is used as the source image.
        -
        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        src - an image variable referring to the source image
        -
        sx - X coordinate of the source's upper left corner
        -
        sy - Y coordinate of the source's upper left corner
        -
        sw - source image width
        -
        sh - source image height
        -
        dx - X coordinate of the destinations's upper left corner
        -
        dy - Y coordinate of the destinations's upper left corner
        -
        dw - destination image width
        -
        dh - destination image height
        -
        mode - Either BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN
        -
        See Also:
        -
        alpha(int), -PImage.copy(PImage, int, int, int, int, int, int, int, int), -PImage.blendColor(int,int,int)
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PConstants.html b/build/javadoc/everything/processing/core/PConstants.html deleted file mode 100644 index 2ea1524f51..0000000000 --- a/build/javadoc/everything/processing/core/PConstants.html +++ /dev/null @@ -1,3268 +0,0 @@ - - - - - -PConstants - - - - - - - - - - - -
-
processing.core
-

Interface PConstants

-
-
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PFont.Glyph.html b/build/javadoc/everything/processing/core/PFont.Glyph.html deleted file mode 100644 index 14f6f74711..0000000000 --- a/build/javadoc/everything/processing/core/PFont.Glyph.html +++ /dev/null @@ -1,383 +0,0 @@ - - - - - -PFont.Glyph - - - - - - - - - - - -
-
processing.core
-

Class PFont.Glyph

-
-
-
    -
  • Object
  • -
  • -
      -
    • PFont.Glyph
    • -
    -
  • -
-
-
    -
  • -
    -
    Enclosing class:
    -
    PFont
    -
    -
    -
    -
    public class PFont.Glyph
    -extends Object
    -
    A single character, and its visage.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        image

        -
        public PImage image
        -
      • -
      - - - -
        -
      • -

        value

        -
        public int value
        -
      • -
      - - - -
        -
      • -

        height

        -
        public int height
        -
      • -
      - - - -
        -
      • -

        width

        -
        public int width
        -
      • -
      - - - -
        -
      • -

        index

        -
        public int index
        -
      • -
      - - - -
        -
      • -

        setWidth

        -
        public int setWidth
        -
      • -
      - - - -
        -
      • -

        topExtent

        -
        public int topExtent
        -
      • -
      - - - -
        -
      • -

        leftExtent

        -
        public int leftExtent
        -
      • -
      -
    • -
    - - -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PFont.html b/build/javadoc/everything/processing/core/PFont.html deleted file mode 100644 index 4c807e575e..0000000000 --- a/build/javadoc/everything/processing/core/PFont.html +++ /dev/null @@ -1,827 +0,0 @@ - - - - - -PFont - - - - - - - - - - - -
-
processing.core
-

Class PFont

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    -
    public class PFont
    -extends 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)
    - 
    -
    -
    See Also:
    -
    PApplet.loadFont(String), -PApplet.createFont(String, float, boolean, char[]), -PGraphics.textFont(PFont)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        CHARSET

        -
        public static char[] 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(Font font,
        -             boolean smooth)
        -
        ( begin auto-generated from PFont.xml ) - - PFont is the font class for Processing. To create a font to use with - Processing, select "Create Font..." from the Tools menu. This will - create a font in the format Processing requires and also adds it to the - current sketch's data directory. Processing displays fonts using the - .vlw font format, which uses images for each letter, rather than - defining them through vector data. The loadFont() function - constructs a new font and textFont() makes a font active. The - list() method creates a list of the fonts installed on the - computer, which is useful information to use with the - createFont() function for dynamically converting fonts into a - format to use with Processing. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        font - font the font object to create from
        -
        smooth - smooth true to enable smoothing/anti-aliasing
        -
        -
      • -
      - - - -
        -
      • -

        PFont

        -
        public PFont(Font font,
        -             boolean smooth,
        -             char[] charset)
        -
        Create a new image-based font on the fly. If charset is set to null, - the characters will only be created as bitmaps when they're drawn.
        -
        -
        Parameters:
        -
        charset - array of all unicode chars that should be included
        -
        -
      • -
      - - - -
        -
      • -

        PFont

        -
        public PFont(Font font,
        -             boolean smooth,
        -             char[] charset,
        -             boolean stream)
        -
        Adds an additional parameter that indicates the font came from a file, - not a built-in OS font.
        -
      • -
      - - - - -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        save

        -
        public void save(OutputStream output)
        -          throws 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:
        -
        IOException
        -
        -
      • -
      - - - -
        -
      • -

        getName

        -
        public String getName()
        -
      • -
      - - - -
        -
      • -

        getPostScriptName

        -
        public String getPostScriptName()
        -
      • -
      - - - -
        -
      • -

        setNative

        -
        public void setNative(Object font)
        -
        Set the native complement of this font. Might be set internally via the - findFont() function, or externally by a deriveFont() call if the font - is resized by PGraphicsJava2D.
        -
      • -
      - - - -
        -
      • -

        getFont

        -
        @Deprecated
        -public Font getFont()
        -
        Deprecated. 
        -
        Use the getNative() method instead, which allows library interfaces to be - written in a cross-platform fashion for desktop, Android, and others.
        -
      • -
      - - - -
        -
      • -

        getNative

        -
        public Object getNative()
        -
        Return the native java.awt.Font associated with this PFont (if any).
        -
      • -
      - - - -
        -
      • -

        getSize

        -
        public int getSize()
        -
        Return size of this font.
        -
      • -
      - - - -
        -
      • -

        isStream

        -
        public boolean isStream()
        -
      • -
      - - - -
        -
      • -

        setSubsetting

        -
        public void setSubsetting()
        -
      • -
      - - - -
        -
      • -

        findNative

        -
        public Object findNative()
        -
        Attempt to find the native version of this font. - (Public so that it can be used by OpenGL or other renderers.)
        -
      • -
      - - - -
        -
      • -

        getGlyph

        -
        public PFont.Glyph getGlyph(char c)
        -
      • -
      - - - -
        -
      • -

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

        getGlyphCount

        -
        public int getGlyphCount()
        -
      • -
      - - - -
        -
      • -

        getGlyph

        -
        public PFont.Glyph getGlyph(int i)
        -
      • -
      - - - -
        -
      • -

        getShape

        -
        public PShape getShape(char ch)
        -
      • -
      - - - -
        -
      • -

        getShape

        -
        public PShape getShape(char ch,
        -                       float detail)
        -
      • -
      - - - -
        -
      • -

        list

        -
        public static String[] list()
        -
        ( begin auto-generated from PFont_list.xml ) - - Gets a list of the fonts installed on the system. The data is returned - as a String array. This list provides the names of each font for input - into createFont(), which allows Processing to dynamically format - fonts. This function is meant as a tool for programming local - applications and is not recommended for use in applets. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        loadFonts

        -
        public static void loadFonts()
        -
      • -
      - - - -
        -
      • -

        findFont

        -
        public static Font findFont(String name)
        -
        Starting with Java 1.5, Apple broke the ability to specify most fonts. - This bug was filed years ago as #4769141 at bugreporter.apple.com. More: - Bug 407.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PGraphics.html b/build/javadoc/everything/processing/core/PGraphics.html deleted file mode 100644 index f97e318eaf..0000000000 --- a/build/javadoc/everything/processing/core/PGraphics.html +++ /dev/null @@ -1,9564 +0,0 @@ - - - - - -PGraphics - - - - - - - - - - - -
-
processing.core
-

Class PGraphics

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Cloneable, PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    PGraphicsFX2D, PGraphicsJava2D, PGraphicsOpenGL
    -
    -
    -
    -
    public class PGraphics
    -extends PImage
    -implements PConstants
    -
    ( begin auto-generated from PGraphics.xml ) - - Main graphics and rendering context, as well as the base API - implementation for processing "core". Use this class if you need to draw - into an off-screen graphics buffer. A PGraphics object can be - constructed with the createGraphics() function. The - beginDraw() and endDraw() methods (see above example) are - necessary to set up the buffer and to finalize it. The fields and - methods for this class are extensive. For a complete list, visit the developer's reference. - - ( end auto-generated ) - -

    Advanced

    - 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. - - We're working right now on synchronizing the two references, so the website reference - is generated from the javadoc comments. Yay.
    -
    -
    See Also:
    -
    PApplet.createGraphics(int, int, String)
    -
    -
  • -
-
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      PGraphics() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      floatalpha(int rgb) -
      ( begin auto-generated from alpha.xml ) - - Extracts the alpha value from a color.
      -
      voidambient(float gray) 
      voidambient(float v1, - float v2, - float v3) 
      voidambient(int rgb) -
      ( begin auto-generated from ambient.xml ) - - Sets the ambient reflectance for shapes drawn to the screen.
      -
      voidambientLight(float v1, - float v2, - float v3) -
      ( begin auto-generated from ambientLight.xml ) - - Adds an ambient light.
      -
      voidambientLight(float v1, - float v2, - float v3, - float x, - float y, - float z) 
      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) -
      ( begin auto-generated from applyMatrix.xml ) - - Multiplies the current matrix by the one specified through the - parameters.
      -
      voidapplyMatrix(PMatrix2D source) 
      voidapplyMatrix(PMatrix3D source) 
      voidarc(float a, - float b, - float c, - float d, - float start, - float stop) -
      ( begin auto-generated from arc.xml ) - - Draws an arc in the display window.
      -
      voidarc(float a, - float b, - float c, - float d, - float start, - float stop, - int mode) 
      voidattrib(String name, - boolean... values) 
      voidattrib(String name, - float... values) 
      voidattrib(String name, - int... values) 
      voidbackground(float gray) 
      voidbackground(float gray, - float alpha) 
      voidbackground(float v1, - float v2, - float v3) 
      voidbackground(float v1, - float v2, - float v3, - float alpha) 
      voidbackground(int rgb) -
      ( begin auto-generated from background.xml ) - - The background() function sets the color used for the background - of the Processing window.
      -
      voidbackground(int rgb, - float alpha) 
      voidbackground(PImage image) -
      Takes an RGB or ARGB image and sets it as the background.
      -
      voidbeginCamera() -
      ( begin auto-generated from beginCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
      -
      voidbeginContour() 
      voidbeginDraw() -
      ( begin auto-generated from PGraphics_beginDraw.xml ) - - Sets the default properties for a PGraphics object.
      -
      PGLbeginPGL() 
      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) -
      ( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms.
      -
      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) -
      ( begin auto-generated from bezier.xml ) - - Draws a Bezier curve on the screen.
      -
      voidbezierDetail(int detail) -
      ( begin auto-generated from bezierDetail.xml ) - - Sets the resolution at which Beziers display.
      -
      floatbezierPoint(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from bezierPoint.xml ) - - Evaluates the Bezier at point t for points a, b, c, d.
      -
      floatbezierTangent(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from bezierTangent.xml ) - - Calculates the tangent of a point on a 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) -
      ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves.
      -
      voidblendMode(int mode) -
      ( begin auto-generated from blendMode.xml ) - - This is a new reference entry for Processing 2.0.
      -
      floatblue(int rgb) -
      ( begin auto-generated from blue.xml ) - - Extracts the blue value from a color, scaled to match current - colorMode().
      -
      voidbox(float size) -
      ( begin auto-generated from box.xml ) - - A box is an extruded rectangle.
      -
      voidbox(float w, - float h, - float d) 
      floatbrightness(int rgb) -
      ( begin auto-generated from brightness.xml ) - - Extracts the brightness value from a color.
      -
      voidcamera() -
      ( begin auto-generated from camera.xml ) - - Sets the position of the camera through setting the eye position, the - center of the scene, and which axis is facing upward.
      -
      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.
      -
      voidclear() 
      voidclip(float a, - float b, - float c, - float d) 
      intcolor(float gray) 
      intcolor(float gray, - float alpha) 
      intcolor(float v1, - float v2, - float v3) 
      intcolor(float v1, - float v2, - float v3, - float a) 
      intcolor(int c) 
      intcolor(int c, - float alpha) 
      intcolor(int c, - int alpha) 
      intcolor(int v1, - int v2, - int v3) 
      intcolor(int v1, - int v2, - int v3, - int a) 
      voidcolorMode(int mode) -
      ( begin auto-generated from colorMode.xml ) - - Changes the way Processing interprets color data.
      -
      voidcolorMode(int mode, - float max) 
      voidcolorMode(int mode, - float max1, - float max2, - float max3) 
      voidcolorMode(int mode, - float max1, - float max2, - float max3, - float maxA) 
      PShapecreateShape() 
      PShapecreateShape(int type) 
      PShapecreateShape(int kind, - float... p) 
      PSurfacecreateSurface() 
      voidcurve(float x1, - float y1, - float x2, - float y2, - float x3, - float y3, - float x4, - float y4) -
      ( begin auto-generated from curve.xml ) - - Draws a curved line on the screen.
      -
      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) -
      ( begin auto-generated from curveDetail.xml ) - - Sets the resolution at which curves display.
      -
      floatcurvePoint(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from curvePoint.xml ) - - Evalutes the curve at point t for points a, b, c, d.
      -
      floatcurveTangent(float a, - float b, - float c, - float d, - float t) -
      ( begin auto-generated from curveTangent.xml ) - - Calculates the tangent of a point on a curve.
      -
      voidcurveTightness(float tightness) -
      ( begin auto-generated from curveTightness.xml ) - - Modifies the quality of forms created with curve() and - curveVertex().
      -
      voidcurveVertex(float x, - float y) -
      ( begin auto-generated from curveVertex.xml ) - - Specifies vertex coordinates for curves.
      -
      voidcurveVertex(float x, - float y, - float z) 
      voiddirectionalLight(float v1, - float v2, - float v3, - float nx, - float ny, - float nz) -
      ( begin auto-generated from directionalLight.xml ) - - Adds a directional light.
      -
      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) -
      ( begin auto-generated from ellipse.xml ) - - Draws an ellipse (oval) in the display window.
      -
      voidellipseMode(int mode) -
      ( begin auto-generated from ellipseMode.xml ) - - The origin of the ellipse is modified by the ellipseMode() - function.
      -
      voidemissive(float gray) -
      gray number specifying value between white and black
      -
      voidemissive(float v1, - float v2, - float v3) 
      voidemissive(int rgb) -
      ( begin auto-generated from emissive.xml ) - - Sets the emissive color of the material used for drawing shapes drawn to - the screen.
      -
      voidendCamera() -
      ( begin auto-generated from endCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space.
      -
      voidendContour() 
      voidendDraw() -
      ( begin auto-generated from PGraphics_endDraw.xml ) - - Finalizes the rendering of a PGraphics object so that it can be shown on screen.
      -
      voidendPGL() 
      voidendRaw() 
      voidendShape() 
      voidendShape(int mode) -
      ( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape().
      -
      voidfill(float gray) 
      voidfill(float gray, - float alpha) 
      voidfill(float v1, - float v2, - float v3) 
      voidfill(float v1, - float v2, - float v3, - float alpha) 
      voidfill(int rgb) -
      ( begin auto-generated from fill.xml ) - - Sets the color used to fill shapes.
      -
      voidfill(int rgb, - float alpha) 
      voidfilter(PShader shader) 
      voidflush() 
      voidfrustum(float left, - float right, - float bottom, - float top, - float near, - float far) -
      ( begin auto-generated from frustum.xml ) - - Sets a perspective matrix defined through the parameters.
      -
      ObjectgetCache(PImage image) -
      Get cache storage data for the specified renderer.
      -
      FontMetricsgetFontMetrics(Font font) -
      Convenience method to get a legit FontMetrics object.
      -
      FontRenderContextgetFontRenderContext(Font font) -
      Convenience method to jump through some Java2D hoops and get an FRC.
      -
      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.
      -
      PGraphicsgetRaw() 
      PStylegetStyle() 
      PStylegetStyle(PStyle s) 
      floatgreen(int rgb) -
      ( begin auto-generated from green.xml ) - - Extracts the green value from a color, scaled to match current - colorMode().
      -
      booleanhaveRaw() 
      voidhint(int which) -
      ( begin auto-generated from hint.xml ) - - Set various hints and hacks for the renderer.
      -
      floathue(int rgb) -
      ( begin auto-generated from hue.xml ) - - Extracts the hue value from a color.
      -
      voidimage(PImage img, - float a, - float b) -
      ( begin auto-generated from image.xml ) - - Displays images to the screen.
      -
      voidimage(PImage img, - float a, - float b, - float c, - float d) 
      voidimage(PImage img, - 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) -
      ( begin auto-generated from imageMode.xml ) - - Modifies the location from which images draw.
      -
      booleanis2D() -
      Return true if this renderer supports 2D drawing.
      -
      booleanis2X() 
      booleanis3D() -
      Return true if this renderer supports 3D drawing.
      -
      booleanisGL() -
      Return true if this renderer does rendering through OpenGL.
      -
      intlerpColor(int c1, - int c2, - float amt) -
      ( begin auto-generated from lerpColor.xml ) - - Calculates a color or colors between two color at a specific increment.
      -
      static intlerpColor(int c1, - int c2, - float amt, - int mode) 
      voidlightFalloff(float constant, - float linear, - float quadratic) -
      ( begin auto-generated from lightFalloff.xml ) - - Sets the falloff rates for point lights, spot lights, and ambient - lights.
      -
      voidlights() -
      ( begin auto-generated from lights.xml ) - - Sets the default ambient light, directional light, falloff, and specular - values.
      -
      voidlightSpecular(float v1, - float v2, - float v3) -
      ( begin auto-generated from lightSpecular.xml ) - - Sets the specular color for lights.
      -
      voidline(float x1, - float y1, - float x2, - float y2) -
      ( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen.
      -
      voidline(float x1, - float y1, - float z1, - float x2, - float y2, - float z2) 
      PShaderloadShader(String fragFilename) -
      ( begin auto-generated from loadShader.xml ) - - This is a new reference entry for Processing 2.0.
      -
      PShaderloadShader(String fragFilename, - String vertFilename) 
      PShapeloadShape(String filename) 
      PShapeloadShape(String filename, - String options) 
      floatmodelX(float x, - float y, - float z) -
      ( begin auto-generated from modelX.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
      -
      floatmodelY(float x, - float y, - float z) -
      ( begin auto-generated from modelY.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
      -
      floatmodelZ(float x, - float y, - float z) -
      ( begin auto-generated from modelZ.xml ) - - Returns the three-dimensional X, Y, Z position in model space.
      -
      voidnoClip() 
      voidnoFill() -
      ( begin auto-generated from noFill.xml ) - - Disables filling geometry.
      -
      voidnoLights() -
      ( begin auto-generated from noLights.xml ) - - Disable all lighting.
      -
      voidnormal(float nx, - float ny, - float nz) -
      ( begin auto-generated from normal.xml ) - - Sets the current normal vector.
      -
      voidnoSmooth() 
      voidnoStroke() -
      ( begin auto-generated from noStroke.xml ) - - Disables drawing the stroke (outline).
      -
      voidnoTexture() -
      Removes texture image for current shape.
      -
      voidnoTint() -
      ( begin auto-generated from noTint.xml ) - - Removes the current fill value for displaying images and reverts to - displaying images with their original hues.
      -
      voidortho() -
      ( begin auto-generated from ortho.xml ) - - Sets an orthographic projection and defines a parallel clipping volume.
      -
      voidortho(float left, - float right, - float bottom, - float top) 
      voidortho(float left, - float right, - float bottom, - float top, - float near, - float far) 
      voidperspective() -
      ( begin auto-generated from perspective.xml ) - - Sets a perspective projection applying foreshortening, making distant - objects appear smaller than closer ones.
      -
      voidperspective(float fovy, - float aspect, - float zNear, - float zFar) 
      voidpoint(float x, - float y) -
      ( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel.
      -
      voidpoint(float x, - float y, - float z) 
      voidpointLight(float v1, - float v2, - float v3, - float x, - float y, - float z) -
      ( begin auto-generated from pointLight.xml ) - - Adds a point light.
      -
      voidpopMatrix() -
      ( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack.
      -
      voidpopStyle() -
      ( begin auto-generated from popStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings; these functions are - always used together.
      -
      voidprintCamera() -
      ( begin auto-generated from printCamera.xml ) - - Prints the current camera matrix to the Console (the text window at the - bottom of Processing).
      -
      voidprintMatrix() -
      ( begin auto-generated from printMatrix.xml ) - - Prints the current matrix to the Console (the text window at the bottom - of Processing).
      -
      voidprintProjection() -
      ( begin auto-generated from printProjection.xml ) - - Prints the current projection matrix to the Console (the text window at - the bottom of Processing).
      -
      voidpushMatrix() -
      ( begin auto-generated from pushMatrix.xml ) - - Pushes the current transformation matrix onto the matrix stack.
      -
      voidpushStyle() -
      ( begin auto-generated from pushStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings.
      -
      voidquad(float x1, - float y1, - float x2, - float y2, - float x3, - float y3, - float x4, - float y4) -
      ( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon.
      -
      voidquadraticVertex(float cx, - float cy, - float x3, - float y3) 
      voidquadraticVertex(float cx, - float cy, - float cz, - float x3, - float y3, - float z3) 
      voidrect(float a, - float b, - float c, - float d) -
      ( begin auto-generated from rect.xml ) - - Draws a rectangle to the screen.
      -
      voidrect(float a, - float b, - float c, - float d, - float r) 
      voidrect(float a, - float b, - float c, - float d, - float tl, - float tr, - float br, - float bl) 
      voidrectMode(int mode) -
      ( begin auto-generated from rectMode.xml ) - - Modifies the location from which rectangles draw.
      -
      floatred(int rgb) -
      ( begin auto-generated from red.xml ) - - Extracts the red value from a color, scaled to match current - colorMode().
      -
      voidremoveCache(PImage image) -
      Remove information associated with this renderer from the cache, if any.
      -
      voidresetMatrix() -
      ( begin auto-generated from resetMatrix.xml ) - - Replaces the current matrix with the identity matrix.
      -
      voidresetShader() -
      ( begin auto-generated from resetShader.xml ) - - This is a new reference entry for Processing 2.0.
      -
      voidresetShader(int kind) 
      voidrotate(float angle) -
      ( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter.
      -
      voidrotate(float angle, - float x, - float y, - float z) -
      Advanced
      -
      voidrotateX(float angle) -
      ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter.
      -
      voidrotateY(float angle) -
      ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter.
      -
      voidrotateZ(float angle) -
      ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter.
      -
      floatsaturation(int rgb) -
      ( begin auto-generated from saturation.xml ) - - Extracts the saturation value from a color.
      -
      voidscale(float s) -
      ( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices.
      -
      voidscale(float x, - float y) -
      Advanced
      -
      voidscale(float x, - float y, - float z) 
      floatscreenX(float x, - float y) -
      ( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen.
      -
      floatscreenX(float x, - float y, - float z) 
      floatscreenY(float x, - float y) -
      ( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen.
      -
      floatscreenY(float x, - float y, - float z) 
      floatscreenZ(float x, - float y, - float z) -
      ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen.
      -
      voidsetCache(PImage image, - Object storage) -
      Store data of some kind for the renderer that requires extra metadata of - some kind.
      -
      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(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.
      -
      voidshader(PShader shader) -
      ( begin auto-generated from shader.xml ) - - This is a new reference entry for Processing 2.0.
      -
      voidshader(PShader shader, - int kind) 
      voidshape(PShape shape) 
      voidshape(PShape shape, - float x, - float y) -
      ( begin auto-generated from shape.xml ) - - Displays shapes to the screen.
      -
      voidshape(PShape shape, - float a, - float b, - float c, - float d) 
      voidshapeMode(int mode) -
      ( begin auto-generated from shapeMode.xml ) - - Modifies the location from which shapes draw.
      -
      voidshearX(float angle) -
      ( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter.
      -
      voidshearY(float angle) -
      ( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter.
      -
      voidshininess(float shine) -
      ( begin auto-generated from shininess.xml ) - - Sets the amount of gloss in the surface of shapes.
      -
      static voidshowDepthWarning(String method) -
      Display a warning that the specified method is only available with 3D.
      -
      static voidshowDepthWarningXYZ(String method) -
      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.
      -
      static voidshowException(String msg) -
      Show an renderer-related exception that halts the program.
      -
      static voidshowMethodWarning(String method) -
      Display a warning that the specified method is simply unavailable.
      -
      static voidshowMissingWarning(String method) -
      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 voidshowVariationWarning(String str) -
      Error that a particular variation of a method is unavailable (even though - other variations are).
      -
      static voidshowWarning(String msg) -
      Show a renderer error, and keep track of it so that it's only shown once.
      -
      static voidshowWarning(String msg, - Object... args) -
      Version of showWarning() that takes a parsed String.
      -
      voidsmooth() 
      voidsmooth(int quality) 
      voidspecular(float gray) -
      gray number specifying value between white and black
      -
      voidspecular(float v1, - float v2, - float v3) 
      voidspecular(int rgb) -
      ( begin auto-generated from specular.xml ) - - Sets the specular color of the materials used for shapes drawn to the - screen, which sets the color of hightlights.
      -
      voidsphere(float r) -
      ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles.
      -
      voidsphereDetail(int res) -
      ( begin auto-generated from sphereDetail.xml ) - - Controls the detail used to render a sphere by adjusting the number of - vertices of the sphere mesh.
      -
      voidsphereDetail(int ures, - int vres) 
      voidspotLight(float v1, - float v2, - float v3, - float x, - float y, - float z, - float nx, - float ny, - float nz, - float angle, - float concentration) -
      ( begin auto-generated from spotLight.xml ) - - Adds a spot light.
      -
      voidstroke(float gray) 
      voidstroke(float gray, - float alpha) 
      voidstroke(float v1, - float v2, - float v3) 
      voidstroke(float v1, - float v2, - float v3, - float alpha) 
      voidstroke(int rgb) -
      ( begin auto-generated from stroke.xml ) - - Sets the color used to draw lines and borders around shapes.
      -
      voidstroke(int rgb, - float alpha) 
      voidstrokeCap(int cap) -
      ( begin auto-generated from strokeCap.xml ) - - Sets the style for rendering line endings.
      -
      voidstrokeJoin(int join) -
      ( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments.
      -
      voidstrokeWeight(float weight) -
      ( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes.
      -
      voidstyle(PStyle s) 
      voidtext(char[] chars, - int start, - int stop, - float x, - float y) -
      Advanced
      -
      voidtext(char[] chars, - int start, - int stop, - float x, - float y, - float z) 
      voidtext(char c, - float x, - float y) -
      ( begin auto-generated from text.xml ) - - Draws text to the screen.
      -
      voidtext(char c, - float x, - float y, - float z) 
      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(String str, - float x, - float y) -
      Advanced
      -
      voidtext(String str, - float x, - float y, - float z) -
      Same as above but with a z coordinate.
      -
      voidtext(String str, - float x1, - float y1, - float x2, - float y2) -
      Advanced
      -
      voidtextAlign(int alignX) 
      voidtextAlign(int alignX, - int alignY) -
      ( begin auto-generated from textAlign.xml ) - - Sets the current alignment for drawing text.
      -
      floattextAscent() -
      ( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size.
      -
      floattextDescent() -
      ( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size.
      -
      voidtextFont(PFont which) -
      ( begin auto-generated from textFont.xml ) - - Sets the current font that will be drawn with the text() - function.
      -
      voidtextFont(PFont which, - float size) 
      voidtextLeading(float leading) -
      ( begin auto-generated from textLeading.xml ) - - Sets the spacing between lines of text in units of pixels.
      -
      voidtextMode(int mode) -
      ( begin auto-generated from textMode.xml ) - - Sets the way text draws to the screen.
      -
      voidtextSize(float size) -
      ( begin auto-generated from textSize.xml ) - - Sets the current font size.
      -
      voidtexture(PImage image) -
      ( begin auto-generated from texture.xml ) - - Sets a texture to be applied to vertex points.
      -
      voidtextureMode(int mode) -
      ( begin auto-generated from textureMode.xml ) - - Sets the coordinate space for texture mapping.
      -
      voidtextureWrap(int wrap) -
      ( begin auto-generated from textureWrap.xml ) - - Description to come...
      -
      floattextWidth(char c) 
      floattextWidth(char[] chars, - int start, - int length) 
      floattextWidth(String str) -
      ( begin auto-generated from textWidth.xml ) - - Calculates and returns the width of any character or text string.
      -
      voidtint(float gray) 
      voidtint(float gray, - float alpha) 
      voidtint(float v1, - float v2, - float v3) 
      voidtint(float v1, - float v2, - float v3, - float alpha) 
      voidtint(int rgb) -
      ( begin auto-generated from tint.xml ) - - Sets the fill value for displaying images.
      -
      voidtint(int rgb, - float alpha) 
      voidtranslate(float x, - float y) -
      ( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window.
      -
      voidtranslate(float x, - float y, - float z) 
      voidtriangle(float x1, - float y1, - float x2, - float y2, - float x3, - float y3) -
      ( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points.
      -
      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) -
      ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices.
      -
      - - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        pixelCount

        -
        public int pixelCount
        -
      • -
      - - - -
        -
      • -

        smooth

        -
        public int smooth
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        VERTEX_FIELD_COUNT

        -
        public static final int VERTEX_FIELD_COUNT
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
      • -
      - - - -
        -
      • -

        ambientColor

        -
        public int ambientColor
        -
      • -
      - - - -
        -
      • -

        ambientR

        -
        public float ambientR
        -
      • -
      - - - -
        -
      • -

        ambientG

        -
        public float ambientG
        -
      • -
      - - - -
        -
      • -

        ambientB

        -
        public float ambientB
        -
      • -
      - - - -
        -
      • -

        setAmbient

        -
        public boolean setAmbient
        -
      • -
      - - - -
        -
      • -

        specularColor

        -
        public int specularColor
        -
      • -
      - - - -
        -
      • -

        specularR

        -
        public float specularR
        -
      • -
      - - - -
        -
      • -

        specularG

        -
        public float specularG
        -
      • -
      - - - -
        -
      • -

        specularB

        -
        public float specularB
        -
      • -
      - - - -
        -
      • -

        emissiveColor

        -
        public int emissiveColor
        -
      • -
      - - - -
        -
      • -

        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 Image image
        -
        Java AWT Image object associated with this renderer. For the 1.0 version - of P2D and P3D, this was associated with their MemoryImageSource. - For PGraphicsJava2D, it will be the offscreen drawing buffer.
        -
      • -
      - - - -
        -
      • -

        DEFAULT_VERTICES

        -
        public static final int DEFAULT_VERTICES
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        bezierDetail

        -
        public int bezierDetail
        -
      • -
      - - - -
        -
      • -

        curveDetail

        -
        public int curveDetail
        -
      • -
      - - - -
        -
      • -

        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()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      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(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: this is ignored by the Methods task 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.

        -
      • -
      - - - -
        -
      • -

        createSurface

        -
        public PSurface createSurface()
        -
      • -
      - - - -
        -
      • -

        setCache

        -
        public void setCache(PImage image,
        -                     Object storage)
        -
        Store data of some kind for the 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.
        -
        -
        Parameters:
        -
        renderer - The PGraphics renderer associated to the image
        -
        storage - The metadata required by the renderer
        -
        -
      • -
      - - - -
        -
      • -

        getCache

        -
        public Object getCache(PImage image)
        -
        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:
        -
        renderer - The PGraphics renderer associated to the image
        -
        Returns:
        -
        metadata stored for the specified renderer
        -
        -
      • -
      - - - -
        -
      • -

        removeCache

        -
        public void removeCache(PImage image)
        -
        Remove information associated with this renderer from the cache, if any.
        -
        -
        Parameters:
        -
        renderer - The PGraphics renderer whose cache data should be removed
        -
        -
      • -
      - - - -
        -
      • -

        canDraw

        -
        public boolean canDraw()
        -
        Some renderers have requirements re: when they are ready to draw.
        -
      • -
      - - - -
        -
      • -

        beginDraw

        -
        public void beginDraw()
        -
        ( begin auto-generated from PGraphics_beginDraw.xml ) - - Sets the default properties for a PGraphics object. It should be called - before anything is drawn into the object. - - ( end auto-generated ) -

        Advanced

        - When creating your own PGraphics, you should call this before - drawing anything.
        -
      • -
      - - - -
        -
      • -

        endDraw

        -
        public void endDraw()
        -
        ( begin auto-generated from PGraphics_endDraw.xml ) - - Finalizes the rendering of a PGraphics object so that it can be shown on screen. - - ( end auto-generated ) -

        Advanced

        -

        - When creating your own PGraphics, you should call this when - you're finished drawing.

        -
      • -
      - - - -
        -
      • -

        beginPGL

        -
        public PGL beginPGL()
        -
      • -
      - - - -
        -
      • -

        endPGL

        -
        public void endPGL()
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public void flush()
        -
      • -
      - - - -
        -
      • -

        hint

        -
        public void hint(int which)
        -
        ( begin auto-generated from hint.xml ) - - Set various hints and hacks for the renderer. This is used to handle - obscure rendering features that cannot be implemented in a consistent - manner across renderers. Many options will often graduate to standard - features instead of hints over time. -

        - hint(ENABLE_OPENGL_4X_SMOOTH) - Enable 4x anti-aliasing for P3D. This - can help force anti-aliasing if it has not been enabled by the user. On - some graphics cards, this can also be set by the graphics driver's - control panel, however not all cards make this available. This hint must - be called immediately after the size() command because it resets the - renderer, obliterating any settings and anything drawn (and like size(), - re-running the code that came before it again). -

        - hint(DISABLE_OPENGL_2X_SMOOTH) - In Processing 1.0, Processing always - enables 2x smoothing when the P3D renderer is used. This hint disables - the default 2x smoothing and returns the smoothing behavior found in - earlier releases, where smooth() and noSmooth() could be used to enable - and disable smoothing, though the quality was inferior. -

        - hint(ENABLE_NATIVE_FONTS) - Use the native version fonts when they are - installed, rather than the bitmapped version from a .vlw file. This is - useful with the default (or JAVA2D) renderer setting, as it will improve - font rendering speed. This is not enabled by default, because it can be - misleading while testing because the type will look great on your - machine (because you have the font installed) but lousy on others' - machines if the identical font is unavailable. This option can only be - set per-sketch, and must be called before any use of textFont(). -

        - hint(DISABLE_DEPTH_TEST) - Disable the zbuffer, allowing you to draw on - top of everything at will. When depth testing is disabled, items will be - drawn to the screen sequentially, like a painting. This hint is most - often used to draw in 3D, then draw in 2D on top of it (for instance, to - draw GUI controls in 2D on top of a 3D interface). Starting in release - 0149, this will also clear the depth buffer. Restore the default with - hint(ENABLE_DEPTH_TEST), but note that with the depth buffer cleared, - any 3D drawing that happens later in draw() will ignore existing shapes - on the screen. -

        - hint(ENABLE_DEPTH_SORT) - Enable primitive z-sorting of triangles and - lines in P3D and OPENGL. This can slow performance considerably, and the - algorithm is not yet perfect. Restore the default with hint(DISABLE_DEPTH_SORT). -

        - hint(DISABLE_OPENGL_ERROR_REPORT) - Speeds up the P3D renderer setting - by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT). -

        - As of release 0149, unhint() has been removed in favor of adding - additional ENABLE/DISABLE constants to reset the default behavior. This - prevents the double negatives, and also reinforces which hints can be - enabled or disabled. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        which - name of the hint to be enabled or disabled
        -
        See Also:
        -
        PGraphics, -PApplet.createGraphics(int, int, String, String), -PApplet.size(int, int)
        -
        -
      • -
      - - - -
        -
      • -

        beginShape

        -
        public void beginShape()
        -
        Start a new shape of type POLYGON
        -
      • -
      - - - -
        -
      • -

        beginShape

        -
        public void beginShape(int kind)
        -
        ( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms. beginShape() begins recording - vertices for a shape and endShape() stops recording. The value of - the MODE parameter tells it which types of shapes to create from - the provided vertices. With no mode specified, the shape can be any - irregular polygon. The parameters available for beginShape() are POINTS, - LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, and QUAD_STRIP. - After calling the beginShape() function, a series of - vertex() commands must follow. To stop drawing the shape, call - endShape(). The vertex() function with two parameters - specifies a position in 2D and the vertex() function with three - parameters specifies a position in 3D. Each shape will be outlined with - the current stroke color and filled with the fill color. -

        - Transformations such as translate(), rotate(), and - scale() do not work within beginShape(). It is also not - possible to use other shapes, such as ellipse() or rect() - within beginShape(). -

        - The P3D renderer settings allow stroke() and fill() - settings to be altered per-vertex, however the default P2D renderer does - not. Settings such as strokeWeight(), strokeCap(), and - strokeJoin() cannot be changed while inside a - beginShape()/endShape() block with any renderer. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        kind - Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIP
        -
        See Also:
        -
        PShape, -endShape(), -vertex(float, float, float, float, float), -curveVertex(float, float, float), -bezierVertex(float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from normal.xml ) - - Sets the current normal vector. This is for drawing three dimensional - shapes and surfaces and specifies a vector perpendicular to the surface - of the shape which determines how lighting affects it. Processing - attempts to automatically assign normals to shapes, but since that's - imperfect, this is a better option when you want more control. This - function is identical to glNormal3f() in OpenGL. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        nx - x direction
        -
        ny - y direction
        -
        nz - z direction
        -
        See Also:
        -
        beginShape(int), -endShape(int), -lights()
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   float... values)
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   int... values)
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   boolean... values)
        -
      • -
      - - - -
        -
      • -

        textureMode

        -
        public void textureMode(int mode)
        -
        ( begin auto-generated from textureMode.xml ) - - Sets the coordinate space for texture mapping. There are two options, - IMAGE, which refers to the actual coordinates of the image, and - NORMAL, which refers to a normalized space of values ranging from 0 - to 1. The default mode is IMAGE. In IMAGE, if an image is 100 x 200 - pixels, mapping the image onto the entire size of a quad would require - the points (0,0) (0,100) (100,200) (0,200). The same mapping in - NORMAL_SPACE is (0,0) (0,1) (1,1) (0,1). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either IMAGE or NORMAL
        -
        See Also:
        -
        texture(PImage), -textureWrap(int)
        -
        -
      • -
      - - - -
        -
      • -

        textureWrap

        -
        public void textureWrap(int wrap)
        -
        ( begin auto-generated from textureWrap.xml ) - - Description to come... - - ( end auto-generated from textureWrap.xml )
        -
        -
        Parameters:
        -
        wrap - Either CLAMP (default) or REPEAT
        -
        See Also:
        -
        texture(PImage), -textureMode(int)
        -
        -
      • -
      - - - -
        -
      • -

        texture

        -
        public void texture(PImage image)
        -
        ( begin auto-generated from texture.xml ) - - Sets a texture to be applied to vertex points. The texture() - function must be called between beginShape() and - endShape() and before any calls to vertex(). -

        - When textures are in use, the fill color is ignored. Instead, use tint() - to specify the color of the texture as it is applied to the shape. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        image - reference to a PImage object
        -
        See Also:
        -
        textureMode(int), -textureWrap(int), -beginShape(int), -endShape(int), -vertex(float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        noTexture

        -
        public void noTexture()
        -
        Removes texture image for current shape. - Needs to be called between beginShape and endShape
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices. - vertex() is used to specify the vertex coordinates for points, - lines, triangles, quads, and polygons and is used exclusively within the - beginShape() and endShape() function.
        -
        - Drawing a vertex in 3D using the z parameter requires the P3D - parameter in combination with size as shown in the above example.
        -
        - This function is also used to map a texture onto the geometry. The - texture() function declares the texture to apply to the geometry - and the u and v coordinates set define the mapping of this - texture to the form. By default, the coordinates used for u and - v are specified in relation to the image's size in pixels, but - this relation can be changed with textureMode(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - x-coordinate of the vertex
        -
        y - y-coordinate of the vertex
        -
        z - z-coordinate of the vertex
        -
        u - horizontal coordinate for the texture mapping
        -
        v - vertical coordinate for the texture mapping
        -
        See Also:
        -
        beginShape(int), -endShape(int), -bezierVertex(float, float, float, float, float, float, float, float, float), -quadraticVertex(float, float, float, float, float, float), -curveVertex(float, float, float), -texture(PImage)
        -
        -
      • -
      - - - -
        -
      • -

        beginContour

        -
        public void beginContour()
        -
      • -
      - - - -
        -
      • -

        endContour

        -
        public void endContour()
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape()
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape(int mode)
        -
        ( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape(). When endshape() - is called, all of image data defined since the previous call to - beginShape() is written into the image buffer. The constant CLOSE - as the value for the MODE parameter to close the shape (to connect the - beginning and the end). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - use CLOSE to close the shape
        -
        See Also:
        -
        PShape, -beginShape(int)
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        createShape

        -
        public PShape createShape(int type)
        -
      • -
      - - - -
        -
      • -

        createShape

        -
        public PShape createShape(int kind,
        -                          float... p)
        -
        -
        Parameters:
        -
        kind - either POINT, LINE, TRIANGLE, QUAD, RECT, ELLIPSE, ARC, BOX, SPHERE
        -
        p - parameters that match the kind of shape
        -
        -
      • -
      - - - -
        -
      • -

        loadShader

        -
        public PShader loadShader(String fragFilename)
        -
        ( begin auto-generated from loadShader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        fragFilename - name of fragment shader file
        -
        -
      • -
      - - - -
        -
      • -

        loadShader

        -
        public PShader loadShader(String fragFilename,
        -                          String vertFilename)
        -
        -
        Parameters:
        -
        vertFilename - name of vertex shader file
        -
        -
      • -
      - - - -
        -
      • -

        shader

        -
        public void shader(PShader shader)
        -
        ( begin auto-generated from shader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        shader - name of shader file
        -
        -
      • -
      - - - -
        -
      • -

        shader

        -
        public void shader(PShader shader,
        -                   int kind)
        -
        -
        Parameters:
        -
        kind - type of shader, either POINTS, LINES, or TRIANGLES
        -
        -
      • -
      - - - -
        -
      • -

        resetShader

        -
        public void resetShader()
        -
        ( begin auto-generated from resetShader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        resetShader

        -
        public void resetShader(int kind)
        -
        -
        Parameters:
        -
        kind - type of shader, either POINTS, LINES, or TRIANGLES
        -
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(PShader shader)
        -
        -
        Parameters:
        -
        shader - the fragment shader to apply
        -
        -
      • -
      - - - -
        -
      • -

        clip

        -
        public void clip(float a,
        -                 float b,
        -                 float c,
        -                 float d)
        -
      • -
      - - - -
        -
      • -

        noClip

        -
        public void noClip()
        -
      • -
      - - - -
        -
      • -

        blendMode

        -
        public void blendMode(int mode)
        -
        ( begin auto-generated from blendMode.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - the blending mode to use
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves. Each call to - bezierVertex() defines the position of two control points and one - anchor point of a Bezier curve, adding a new segment to a line or shape. - The first time bezierVertex() is used within a - beginShape() call, it must be prefaced with a call to - vertex() to set the first anchor point. This function must be - used between beginShape() and endShape() and only when - there is no MODE parameter specified to beginShape(). Using the - 3D version requires rendering with P3D (see the Environment reference - for more information). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x2 - the x-coordinate of the 1st control point
        -
        y2 - the y-coordinate of the 1st control point
        -
        z2 - the z-coordinate of the 1st control point
        -
        x3 - the x-coordinate of the 2nd control point
        -
        y3 - the y-coordinate of the 2nd control point
        -
        z3 - the z-coordinate of the 2nd control point
        -
        x4 - the x-coordinate of the anchor point
        -
        y4 - the y-coordinate of the anchor point
        -
        z4 - the z-coordinate of the anchor point
        -
        See Also:
        -
        curveVertex(float, float, float), -vertex(float, float, float, float, float), -quadraticVertex(float, float, float, float, float, float), -bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float cx,
        -                            float cy,
        -                            float cz,
        -                            float x3,
        -                            float y3,
        -                            float z3)
        -
        -
        Parameters:
        -
        cz - the z-coordinate of the control point
        -
        z3 - the z-coordinate of the anchor point
        -
        -
      • -
      - - - - - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
        -
        Parameters:
        -
        z - the z-coordinate of the vertex
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y)
        -
        ( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel. The - first parameter is the horizontal value for the point, the second value - is the vertical value for the point, and the optional third value is the - depth value. Drawing this shape in 3D with the z parameter - requires the P3D parameter in combination with size() as shown in - the above example. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - x-coordinate of the point
        -
        y - y-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y,
        -                  float z)
        -
        -
        Parameters:
        -
        z - z-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2)
        -
        ( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen. The - version of line() with four parameters draws the line in 2D. To - color a line, use the stroke() function. A line cannot be filled, - therefore the fill() function will not affect the color of a - line. 2D lines are drawn with a width of one pixel by default, but this - can be changed with the strokeWeight() function. The version with - six parameters allows the line to be placed anywhere within XYZ space. - Drawing this shape in 3D with the z parameter requires the P3D - parameter in combination with size() as shown in the above example. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        See Also:
        -
        strokeWeight(float), -strokeJoin(int), -strokeCap(int), -beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float z1,
        -                 float x2,
        -                 float y2,
        -                 float z2)
        -
        -
        Parameters:
        -
        z1 - z-coordinate of the first point
        -
        z2 - z-coordinate of the second point
        -
        -
      • -
      - - - -
        -
      • -

        triangle

        -
        public void triangle(float x1,
        -                     float y1,
        -                     float x2,
        -                     float y2,
        -                     float x3,
        -                     float y3)
        -
        ( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points. The first two - arguments specify the first point, the middle two arguments specify the - second point, and the last two arguments specify the third point. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        x3 - x-coordinate of the third point
        -
        y3 - y-coordinate of the third point
        -
        See Also:
        -
        PApplet.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        quad

        -
        public void quad(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2,
        -                 float x3,
        -                 float y3,
        -                 float x4,
        -                 float y4)
        -
        ( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon. It is similar to a - rectangle, but the angles between its edges are not constrained to - ninety degrees. The first pair of parameters (x1,y1) sets the first - vertex and the subsequent pairs should proceed clockwise or - counter-clockwise around the defined shape. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x1 - x-coordinate of the first corner
        -
        y1 - y-coordinate of the first corner
        -
        x2 - x-coordinate of the second corner
        -
        y2 - y-coordinate of the second corner
        -
        x3 - x-coordinate of the third corner
        -
        y3 - y-coordinate of the third corner
        -
        x4 - x-coordinate of the fourth corner
        -
        y4 - y-coordinate of the fourth corner
        -
        -
      • -
      - - - -
        -
      • -

        rectMode

        -
        public void rectMode(int mode)
        -
        ( begin auto-generated from rectMode.xml ) - - Modifies the location from which rectangles draw. The default mode is - rectMode(CORNER), which specifies the location to be the upper - left corner of the shape and uses the third and fourth parameters of - rect() to specify the width and height. The syntax - rectMode(CORNERS) uses the first and second parameters of - rect() to set the location of one corner and uses the third and - fourth parameters to set the opposite corner. The syntax - rectMode(CENTER) draws the image from its center point and uses - the third and forth parameters of rect() to specify the image's - width and height. The syntax rectMode(RADIUS) draws the image - from its center point and uses the third and forth parameters of - rect() to specify half of the image's width and height. The - parameter must be written in ALL CAPS because Processing is a case - sensitive language. Note: In version 125, the mode named CENTER_RADIUS - was shortened to RADIUS. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CORNER, CORNERS, CENTER, or RADIUS
        -
        See Also:
        -
        rect(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rect

        -
        public void rect(float a,
        -                 float b,
        -                 float c,
        -                 float d)
        -
        ( begin auto-generated from rect.xml ) - - Draws a rectangle to the screen. A rectangle is a four-sided shape with - every angle at ninety degrees. By default, the first two parameters set - the location of the upper-left corner, the third sets the width, and the - fourth sets the height. These parameters may be changed with the - rectMode() function. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - x-coordinate of the rectangle by default
        -
        b - y-coordinate of the rectangle by default
        -
        c - width of the rectangle by default
        -
        d - height of the rectangle by default
        -
        See Also:
        -
        rectMode(int), -quad(float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rect

        -
        public void rect(float a,
        -                 float b,
        -                 float c,
        -                 float d,
        -                 float r)
        -
        -
        Parameters:
        -
        r - radii for all four corners
        -
        -
      • -
      - - - -
        -
      • -

        rect

        -
        public void rect(float a,
        -                 float b,
        -                 float c,
        -                 float d,
        -                 float tl,
        -                 float tr,
        -                 float br,
        -                 float bl)
        -
        -
        Parameters:
        -
        tl - radius for top-left corner
        -
        tr - radius for top-right corner
        -
        br - radius for bottom-right corner
        -
        bl - radius for bottom-left corner
        -
        -
      • -
      - - - -
        -
      • -

        ellipseMode

        -
        public void ellipseMode(int mode)
        -
        ( begin auto-generated from ellipseMode.xml ) - - The origin of the ellipse is modified by the ellipseMode() - function. The default configuration is ellipseMode(CENTER), which - specifies the location of the ellipse as the center of the shape. The - RADIUS mode is the same, but the width and height parameters to - ellipse() specify the radius of the ellipse, rather than the - diameter. The CORNER mode draws the shape from the upper-left - corner of its bounding box. The CORNERS mode uses the four - parameters to ellipse() to set two opposing corners of the - ellipse's bounding box. The parameter must be written in ALL CAPS - because Processing is a case-sensitive language. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CENTER, RADIUS, CORNER, or CORNERS
        -
        See Also:
        -
        PApplet.ellipse(float, float, float, float), -PApplet.arc(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        ellipse

        -
        public void ellipse(float a,
        -                    float b,
        -                    float c,
        -                    float d)
        -
        ( begin auto-generated from ellipse.xml ) - - Draws an ellipse (oval) in the display window. An ellipse with an equal - width and height is a circle. The first two parameters set - the location, the third sets the width, and the fourth sets the height. - The origin may be changed with the ellipseMode() function. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - x-coordinate of the ellipse
        -
        b - y-coordinate of the ellipse
        -
        c - width of the ellipse by default
        -
        d - height of the ellipse by default
        -
        See Also:
        -
        PApplet.ellipseMode(int), -PApplet.arc(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        arc

        -
        public void arc(float a,
        -                float b,
        -                float c,
        -                float d,
        -                float start,
        -                float stop)
        -
        ( begin auto-generated from arc.xml ) - - Draws an arc in the display window. Arcs are drawn along the outer edge - of an ellipse defined by the x, y, width and - height parameters. The origin or the arc's ellipse may be changed - with the ellipseMode() function. The start and stop - parameters specify the angles at which to draw the arc. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - x-coordinate of the arc's ellipse
        -
        b - y-coordinate of the arc's ellipse
        -
        c - width of the arc's ellipse by default
        -
        d - height of the arc's ellipse by default
        -
        start - angle to start the arc, specified in radians
        -
        stop - angle to stop the arc, specified in radians
        -
        See Also:
        -
        PApplet.ellipse(float, float, float, float), -PApplet.ellipseMode(int), -PApplet.radians(float), -PApplet.degrees(float)
        -
        -
      • -
      - - - -
        -
      • -

        arc

        -
        public void arc(float a,
        -                float b,
        -                float c,
        -                float d,
        -                float start,
        -                float stop,
        -                int mode)
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float size)
        -
        ( begin auto-generated from box.xml ) - - A box is an extruded rectangle. A box with equal dimension on all sides - is a cube. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        size - dimension of the box in all dimensions (creates a cube)
        -
        See Also:
        -
        sphere(float)
        -
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float w,
        -                float h,
        -                float d)
        -
        -
        Parameters:
        -
        w - dimension of the box in the x-dimension
        -
        h - dimension of the box in the y-dimension
        -
        d - dimension of the box in the z-dimension
        -
        -
      • -
      - - - -
        -
      • -

        sphereDetail

        -
        public void sphereDetail(int res)
        -
        ( begin auto-generated from sphereDetail.xml ) - - Controls the detail used to render a sphere by adjusting the number of - vertices of the sphere mesh. The default resolution is 30, which creates - a fairly detailed sphere definition with vertices every 360/30 = 12 - degrees. If you're going to render a great number of spheres per frame, - it is advised to reduce the level of detail using this function. The - setting stays active until sphereDetail() is called again with a - new parameter and so should not be called prior to every - sphere() statement, unless you wish to render spheres with - different settings, e.g. using less detail for smaller spheres or ones - further away from the camera. To control the detail of the horizontal - and vertical resolution independently, use the version of the functions - with two parameters. - - ( end auto-generated ) - -

        Advanced

        - Code for sphereDetail() submitted by toxi [031031]. - Code for enhanced u/v version from davbol [080801].
        -
        -
        Parameters:
        -
        res - number of segments (minimum 3) used per full circle revolution
        -
        See Also:
        -
        sphere(float)
        -
        -
      • -
      - - - -
        -
      • -

        sphereDetail

        -
        public void sphereDetail(int ures,
        -                         int vres)
        -
        -
        Parameters:
        -
        ures - number of segments used longitudinally per full circle revolutoin
        -
        vres - number of segments used latitudinally from top to bottom
        -
        -
      • -
      - - - -
        -
      • -

        sphere

        -
        public void sphere(float r)
        -
        ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles. - - ( end auto-generated ) - -

        Advanced

        -

        - 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
        - 
        -
        -
        Parameters:
        -
        r - the radius of the sphere
        -
        See Also:
        -
        sphereDetail(int)
        -
        -
      • -
      - - - -
        -
      • -

        bezierPoint

        -
        public float bezierPoint(float a,
        -                         float b,
        -                         float c,
        -                         float d,
        -                         float t)
        -
        ( begin auto-generated from bezierPoint.xml ) - - Evaluates the Bezier at point t for points a, b, c, d. The parameter t - varies between 0 and 1, a and d are points on the curve, and 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. - - ( end auto-generated ) - -

        Advanced

        - 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();
        -
        -
        Parameters:
        -
        a - coordinate of first point on the curve
        -
        b - coordinate of first control point
        -
        c - coordinate of second control point
        -
        d - coordinate of second point on the curve
        -
        t - value between 0 and 1
        -
        See Also:
        -
        bezier(float, float, float, float, float, float, float, float, float, float, float, float), -bezierVertex(float, float, float, float, float, float), -curvePoint(float, float, float, float, float)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from bezier.xml ) - - Draws a Bezier curve on the screen. These curves are defined by a series - of anchor and control points. The first two parameters specify the first - anchor point and the last two parameters specify the other anchor point. - The middle parameters specify the control points which define the shape - of the curve. Bezier curves were developed by French engineer Pierre - Bezier. Using the 3D version requires rendering with P3D (see the - Environment reference for more information). - - ( end auto-generated ) - -

        Advanced

        - 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);
        -
        -
        Parameters:
        -
        x1 - coordinates for the first anchor point
        -
        y1 - coordinates for the first anchor point
        -
        z1 - coordinates for the first anchor point
        -
        x2 - coordinates for the first control point
        -
        y2 - coordinates for the first control point
        -
        z2 - coordinates for the first control point
        -
        x3 - coordinates for the second control point
        -
        y3 - coordinates for the second control point
        -
        z3 - coordinates for the second control point
        -
        x4 - coordinates for the second anchor point
        -
        y4 - coordinates for the second anchor point
        -
        z4 - coordinates for the second anchor point
        -
        See Also:
        -
        bezierVertex(float, float, float, float, float, float), -curve(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        curvePoint

        -
        public float curvePoint(float a,
        -                        float b,
        -                        float c,
        -                        float d,
        -                        float t)
        -
        ( begin auto-generated from curvePoint.xml ) - - Evalutes the curve at point t for points a, b, c, d. The parameter t - varies between 0 and 1, a and d are points on the curve, and 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 curve at t. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        a - coordinate of first point on the curve
        -
        b - coordinate of second point on the curve
        -
        c - coordinate of third point on the curve
        -
        d - coordinate of fourth point on the curve
        -
        t - value between 0 and 1
        -
        See Also:
        -
        curve(float, float, float, float, float, float, float, float, float, float, float, float), -curveVertex(float, float), -bezierPoint(float, float, float, float, float)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        curveTightness

        -
        public void curveTightness(float tightness)
        -
        ( begin auto-generated from curveTightness.xml ) - - Modifies the quality of forms created with curve() and - curveVertex(). The parameter squishy determines how the - curve fits to the vertex points. The value 0.0 is the default value for - squishy (this value defines the curves to be Catmull-Rom splines) - and the value 1.0 connects all the points with straight lines. Values - within the range -5.0 and 5.0 will deform the curves but will leave them - recognizable and as values increase in magnitude, they will continue to deform. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        tightness - amount of deformation from the original vertices
        -
        See Also:
        -
        curve(float, float, float, float, float, float, float, float, float, float, float, float), -curveVertex(float, float)
        -
        -
      • -
      - - - -
        -
      • -

        curve

        -
        public void curve(float x1,
        -                  float y1,
        -                  float x2,
        -                  float y2,
        -                  float x3,
        -                  float y3,
        -                  float x4,
        -                  float y4)
        -
        ( begin auto-generated from curve.xml ) - - Draws a curved line on the screen. The first and second parameters - specify the beginning control point and the last two parameters specify - the ending control point. The middle parameters specify the start and - stop of the curve. Longer curves can be created by putting a series of - curve() functions together or using curveVertex(). An - additional function called curveTightness() provides control for - the visual quality of the curve. The curve() function is an - implementation of Catmull-Rom splines. Using the 3D version requires - rendering with P3D (see the Environment reference for more information). - - ( end auto-generated ) - -

        Advanced

        - As of revision 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();
        - 
        -
        -
        Parameters:
        -
        x1 - coordinates for the beginning control point
        -
        y1 - coordinates for the beginning control point
        -
        x2 - coordinates for the first point
        -
        y2 - coordinates for the first point
        -
        x3 - coordinates for the second point
        -
        y3 - coordinates for the second point
        -
        x4 - coordinates for the ending control point
        -
        y4 - coordinates for the ending control point
        -
        See Also:
        -
        curveVertex(float, float), -curveTightness(float), -bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Parameters:
        -
        z1 - coordinates for the beginning control point
        -
        z2 - coordinates for the first point
        -
        z3 - coordinates for the second point
        -
        z4 - coordinates for the ending control point
        -
        -
      • -
      - - - -
        -
      • -

        smooth

        -
        public void smooth()
        -
      • -
      - - - -
        -
      • -

        smooth

        -
        public void smooth(int quality)
        -
      • -
      - - - -
        -
      • -

        noSmooth

        -
        public void noSmooth()
        -
      • -
      - - - -
        -
      • -

        imageMode

        -
        public void imageMode(int mode)
        -
        ( begin auto-generated from imageMode.xml ) - - Modifies the location from which images draw. The default mode is - imageMode(CORNER), which specifies the location to be the upper - left corner and uses the fourth and fifth parameters of image() - to set the image's width and height. The syntax - imageMode(CORNERS) uses the second and third parameters of - image() to set the location of one corner of the image and uses - the fourth and fifth parameters to set the opposite corner. Use - imageMode(CENTER) to draw images centered at the given x and y - position.
        -
        - The parameter to imageMode() must be written in ALL CAPS because - Processing is a case-sensitive language. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CORNER, CORNERS, or CENTER
        -
        See Also:
        -
        PApplet.loadImage(String, String), -PImage, -image(PImage, float, float, float, float), -background(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        image

        -
        public void image(PImage img,
        -                  float a,
        -                  float b)
        -
        ( begin auto-generated from image.xml ) - - Displays images to the screen. The images must be in the sketch's "data" - directory to load correctly. Select "Add file..." from the "Sketch" menu - to add the image. Processing currently works with GIF, JPEG, and Targa - images. The img parameter specifies the image to display and the - x and y parameters define the location of the image from - its upper-left corner. The image is displayed at its original size - unless the width and height parameters specify a different - size.
        -
        - The imageMode() function changes the way the parameters work. For - example, a call to imageMode(CORNERS) will change the - width and height parameters to define the x and y values - of the opposite corner of the image.
        -
        - The color of an image may be modified with the tint() function. - This function will maintain transparency for GIF and PNG images. - - ( end auto-generated ) - -

        Advanced

        - Starting with release 0124, when using the default (JAVA2D) renderer, - smooth() will also improve image quality of resized images.
        -
        -
        Parameters:
        -
        img - the image to display
        -
        a - x-coordinate of the image
        -
        b - y-coordinate of the image
        -
        See Also:
        -
        PApplet.loadImage(String, String), -PImage, -imageMode(int), -tint(float), -background(float, float, float, float), -alpha(int)
        -
        -
      • -
      - - - -
        -
      • -

        image

        -
        public void image(PImage img,
        -                  float a,
        -                  float b,
        -                  float c,
        -                  float d)
        -
        -
        Parameters:
        -
        c - width to display the image
        -
        d - height to display the image
        -
        -
      • -
      - - - -
        -
      • -

        image

        -
        public void image(PImage img,
        -                  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)
        -
        ( begin auto-generated from shapeMode.xml ) - - Modifies the location from which shapes draw. The default mode is - shapeMode(CORNER), which specifies the location to be the upper - left corner of the shape and uses the third and fourth parameters of - shape() to specify the width and height. The syntax - shapeMode(CORNERS) uses the first and second parameters of - shape() to set the location of one corner and uses the third and - fourth parameters to set the opposite corner. The syntax - shapeMode(CENTER) draws the shape from its center point and uses - the third and forth parameters of shape() to specify the width - and height. The parameter must be written in "ALL CAPS" because - Processing is a case sensitive language. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either CORNER, CORNERS, CENTER
        -
        See Also:
        -
        PShape, -shape(PShape), -rectMode(int)
        -
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape)
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float x,
        -                  float y)
        -
        ( begin auto-generated from shape.xml ) - - Displays shapes to the screen. The shapes must be in the sketch's "data" - directory to load correctly. Select "Add file..." from the "Sketch" menu - to add the shape. Processing currently works with SVG shapes only. The - sh parameter specifies the shape to display and the x and - y parameters define the location of the shape from its upper-left - corner. The shape is displayed at its original size unless the - width and height parameters specify a different size. The - shapeMode() function changes the way the parameters work. A call - to shapeMode(CORNERS), for example, will change the width and - height parameters to define the x and y values of the opposite corner of - the shape. -

        - Note complex shapes may draw awkwardly with P3D. This renderer does not - yet support shapes that have holes or complicated breaks. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        shape - the shape to display
        -
        x - x-coordinate of the shape
        -
        y - y-coordinate of the shape
        -
        See Also:
        -
        PShape, -PApplet.loadShape(String), -Convenience method to draw at a particular location.
        -
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float a,
        -                  float b,
        -                  float c,
        -                  float d)
        -
        -
        Parameters:
        -
        a - x-coordinate of the shape
        -
        b - y-coordinate of the shape
        -
        c - width to display the shape
        -
        d - height to display the shape
        -
        -
      • -
      - - - -
        -
      • -

        textAlign

        -
        public void textAlign(int alignX)
        -
      • -
      - - - -
        -
      • -

        textAlign

        -
        public void textAlign(int alignX,
        -                      int alignY)
        -
        ( begin auto-generated from textAlign.xml ) - - Sets the current alignment for drawing text. The parameters LEFT, - CENTER, and RIGHT set the display characteristics of the letters in - relation to the values for the x and y parameters of the - text() function. -

        - In Processing 0125 and later, an optional second parameter can be used - to vertically align the text. BASELINE is the default, and the vertical - alignment will be reset to BASELINE if the second parameter is not used. - The TOP and CENTER parameters are straightforward. The BOTTOM parameter - offsets the line based on the current textDescent(). For multiple - lines, the final line will be aligned to the bottom, with the previous - lines appearing above it. -

        - When using text() with width and height parameters, BASELINE is - ignored, and treated as TOP. (Otherwise, text would by default draw - outside the box, since BASELINE is the default setting. BASELINE is not - a useful drawing mode for text drawn in a rectangle.) -

        - The vertical alignment is based on the value of textAscent(), - which many fonts do not specify correctly. It may be necessary to use a - hack and offset by a few pixels by hand so that the offset looks - correct. To do this as less of a hack, use some percentage of - textAscent() or textDescent() so that the hack works even - if you change the size of the font. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        alignX - horizontal alignment, either LEFT, CENTER, or RIGHT
        -
        alignY - vertical alignment, either TOP, BOTTOM, CENTER, or BASELINE
        -
        See Also:
        -
        PApplet.loadFont(String), -PFont, -text(String, float, float), -textSize(float), -textAscent(), -textDescent()
        -
        -
      • -
      - - - -
        -
      • -

        textAscent

        -
        public float textAscent()
        -
        ( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size. This information - is useful for determining the height of the font above the baseline. For - example, adding the textAscent() and textDescent() values - will give you the total height of the line. - - ( end auto-generated )
        -
        -
        See Also:
        -
        textDescent()
        -
        -
      • -
      - - - -
        -
      • -

        textDescent

        -
        public float textDescent()
        -
        ( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size. This - information is useful for determining the height of the font below the - baseline. For example, adding the textAscent() and - textDescent() values will give you the total height of the line. - - ( end auto-generated )
        -
        -
        See Also:
        -
        textAscent()
        -
        -
      • -
      - - - -
        -
      • -

        textFont

        -
        public void textFont(PFont which)
        -
        ( begin auto-generated from textFont.xml ) - - Sets the current font that will be drawn with the text() - function. Fonts must be loaded with loadFont() before it can be - used. This font will be used in all subsequent calls to the - text() function. If no size parameter is input, the font - will appear at its original size (the size it was created at with the - "Create Font..." tool) until it is changed with textSize().

        Because fonts are usually bitmaped, you should create fonts at - the sizes that will be used most commonly. Using textFont() - without the size parameter will result in the cleanest-looking text.

        With the default (JAVA2D) and PDF renderers, it's also possible - to enable the use of native fonts via the command - hint(ENABLE_NATIVE_FONTS). This will produce vector text in - JAVA2D sketches and PDF output in cases where the vector data is - available: when the font is still installed, or the font is created via - the createFont() function (rather than the Create Font tool). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        which - any variable of the type PFont
        -
        See Also:
        -
        PApplet.createFont(String, float, boolean), -PApplet.loadFont(String), -PFont, -text(String, float, float), -textSize(float)
        -
        -
      • -
      - - - -
        -
      • -

        textFont

        -
        public void textFont(PFont which,
        -                     float size)
        -
        -
        Parameters:
        -
        size - the size of the letters in units of pixels
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textMode

        -
        public void textMode(int mode)
        -
        ( begin auto-generated from textMode.xml ) - - Sets the way text draws to the screen. In the default configuration, the - MODEL mode, it's possible to rotate, scale, and place letters in - two and three dimensional space.
        -
        - The SHAPE mode draws text using the the glyph outlines of - individual characters rather than as textures. This mode is only - supported with the PDF and P3D renderer settings. With the - PDF renderer, you must call textMode(SHAPE) before any - other drawing occurs. If the outlines are not available, then - textMode(SHAPE) will be ignored and textMode(MODEL) will - be used instead.
        -
        - The textMode(SHAPE) option in P3D can be combined with - beginRaw() to write vector-accurate text to 2D and 3D output - files, for instance DXF or PDF. The SHAPE mode is - not currently optimized for P3D, so if recording shape data, use - textMode(MODEL) until you're ready to capture the geometry with beginRaw(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - either MODEL or SHAPE
        -
        See Also:
        -
        PApplet.loadFont(String), -PFont.PFont(java.io.InputStream), -text(String, float, float), -textFont(PFont), -beginRaw(PGraphics), -PApplet.createFont(String, float, boolean)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textWidth

        -
        public float textWidth(char c)
        -
        -
        Parameters:
        -
        c - the character to measure
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textWidth

        -
        public float textWidth(char[] chars,
        -                       int start,
        -                       int length)
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(char c,
        -                 float x,
        -                 float y)
        -
        ( begin auto-generated from text.xml ) - - Draws text to the screen. Displays the information specified in the - data or stringdata parameters on the screen in the - position specified by the x and y parameters and the - optional z parameter. A default font will be used unless a font - is set with the textFont() function. Change the color of the text - with the fill() function. The text displays in relation to the - textAlign() function, which gives the option to draw to the left, - right, and center of the coordinates. -

        - The x2 and y2 parameters define a rectangular area to - display within and may only be used with string data. For text drawn - inside a rectangle, the coordinates are interpreted based on the current - rectMode() setting. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        c - the alphanumeric character to be displayed
        -
        x - x-coordinate of text
        -
        y - y-coordinate of text
        -
        See Also:
        -
        textAlign(int, int), -textFont(PFont), -textMode(int), -textSize(float), -textLeading(float), -textWidth(String), -textAscent(), -textDescent(), -rectMode(int), -fill(int, float)
        -
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(char c,
        -                 float x,
        -                 float y,
        -                 float z)
        -
        -
        Parameters:
        -
        z - z-coordinate of text
        -
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(String str,
        -                 float x,
        -                 float y)
        -

        Advanced

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

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        chars - the alphanumberic symbols to be displayed
        -
        start - array index at which to start writing characters
        -
        stop - array index at which to stop writing characters
        -
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(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(String str,
        -                 float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2)
        -

        Advanced

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

        -
        -
        Parameters:
        -
        x1 - by default, the x-coordinate of text, see rectMode() for more info
        -
        y1 - by default, the x-coordinate of text, see rectMode() for more info
        -
        x2 - by default, the width of the text box, see rectMode() for more info
        -
        y2 - by default, the height of the text box, see rectMode() for more info
        -
        -
      • -
      - - - -
        -
      • -

        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.
        -
        -
        Parameters:
        -
        num - the numeric value to be displayed
        -
        -
      • -
      - - - -
        -
      • -

        text

        -
        public void text(float num,
        -                 float x,
        -                 float y,
        -                 float z)
        -
      • -
      - - - -
        -
      • -

        getFontMetrics

        -
        public FontMetrics getFontMetrics(Font font)
        -
        Convenience method to get a legit FontMetrics object. Where possible, - override this any renderer subclass so that you're not using what's - returned by getDefaultToolkit() to get your metrics.
        -
      • -
      - - - -
        -
      • -

        getFontRenderContext

        -
        public FontRenderContext getFontRenderContext(Font font)
        -
        Convenience method to jump through some Java2D hoops and get an FRC.
        -
      • -
      - - - -
        -
      • -

        pushMatrix

        -
        public void pushMatrix()
        -
        ( begin auto-generated from pushMatrix.xml ) - - Pushes the current transformation matrix onto the matrix stack. - Understanding pushMatrix() and popMatrix() requires - understanding the concept of a matrix stack. The pushMatrix() - function saves the current coordinate system to the stack and - popMatrix() restores the prior coordinate system. - pushMatrix() and popMatrix() are used in conjuction with - the other transformation functions and may be embedded to control the - scope of the transformations. - - ( end auto-generated )
        -
        -
        See Also:
        -
        popMatrix(), -translate(float, float, float), -scale(float), -rotate(float), -rotateX(float), -rotateY(float), -rotateZ(float)
        -
        -
      • -
      - - - -
        -
      • -

        popMatrix

        -
        public void popMatrix()
        -
        ( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack. - Understanding pushing and popping requires understanding the concept of - a matrix stack. The pushMatrix() function saves the current - coordinate system to the stack and popMatrix() restores the prior - coordinate system. pushMatrix() and popMatrix() are used - in conjuction with the other transformation functions and may be - embedded to control the scope of the transformations. - - ( end auto-generated )
        -
        -
        See Also:
        -
        pushMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float x,
        -                      float y)
        -
        ( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window. The - x parameter specifies left/right translation, the y - parameter specifies up/down translation, and the z parameter - specifies translations toward/away from the screen. Using this function - with the z parameter requires using P3D as a parameter in - combination with size as shown in the above example. Transformations - apply to everything that happens after and subsequent calls to the - function accumulates the effect. For example, calling translate(50, - 0) and then translate(20, 0) is the same as translate(70, - 0). If translate() is called within draw(), the - transformation is reset when the loop begins again. This function can be - further controlled by the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - left/right translation
        -
        y - up/down translation
        -
        See Also:
        -
        popMatrix(), -pushMatrix(), -rotate(float), -rotateX(float), -rotateY(float), -rotateZ(float), -scale(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float x,
        -                      float y,
        -                      float z)
        -
        -
        Parameters:
        -
        z - forward/backward translation
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle)
        -
        ( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter. - Angles should be specified in radians (values from 0 to TWO_PI) or - converted to radians with the radians() function. -

        - Objects are always rotated around their relative position to the origin - and positive numbers rotate objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - rotate(HALF_PI) and then rotate(HALF_PI) is the same as - rotate(PI). All tranformations are reset when draw() - begins again. -

        - Technically, rotate() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        popMatrix(), -pushMatrix(), -rotateX(float), -rotateY(float), -rotateZ(float), -scale(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateX(PI/2) and then rotateX(PI/2) is the same - as rotateX(PI). If rotateX() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the example above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        popMatrix(), -pushMatrix(), -rotate(float), -rotateY(float), -rotateZ(float), -scale(float, float, float), -translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateY(PI/2) and then rotateY(PI/2) is the same - as rotateY(PI). If rotateY() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        popMatrix(), -pushMatrix(), -rotate(float), -rotateX(float), -rotateZ(float), -scale(float, float, float), -translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateZ(PI/2) and then rotateZ(PI/2) is the same - as rotateZ(PI). If rotateZ() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        popMatrix(), -pushMatrix(), -rotate(float), -rotateX(float), -rotateY(float), -scale(float, float, float), -translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle,
        -                   float x,
        -                   float y,
        -                   float z)
        -

        Advanced

        - Rotate about a vector in space. Same as the glRotatef() function.
        -
        -
        Parameters:
        -
        x -
        -
        y -
        -
        z -
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float s)
        -
        ( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices. Objects always scale from their relative origin to the - coordinate system. Scale values are specified as decimal percentages. - For example, the function call scale(2.0) increases the dimension - of a shape by 200%. Transformations apply to everything that happens - after and subsequent calls to the function multiply the effect. For - example, calling scale(2.0) and then scale(1.5) is the - same as scale(3.0). If scale() is called within - draw(), the transformation is reset when the loop begins again. - Using this fuction with the z parameter requires using P3D as a - parameter for size() as shown in the example above. This function - can be further controlled by pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        s - percentage to scale the object
        -
        See Also:
        -
        pushMatrix(), -popMatrix(), -translate(float, float, float), -rotate(float), -rotateX(float), -rotateY(float), -rotateZ(float)
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y)
        -

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        x - percentage to scale the object in the x-axis
        -
        y - percentage to scale the object in the y-axis
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y,
        -                  float z)
        -
        -
        Parameters:
        -
        z - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - -
        -
      • -

        shearX

        -
        public void shearX(float angle)
        -
        ( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearX(PI/2) and then shearX(PI/2) is the same as - shearX(PI). If shearX() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearX() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        popMatrix(), -pushMatrix(), -shearY(float), -scale(float, float, float), -translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        public void shearY(float angle)
        -
        ( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearY(PI/2) and then shearY(PI/2) is the same as - shearY(PI). If shearY() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearY() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        popMatrix(), -pushMatrix(), -shearX(float), -scale(float, float, float), -translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        resetMatrix

        -
        public void resetMatrix()
        -
        ( begin auto-generated from resetMatrix.xml ) - - Replaces the current matrix with the identity matrix. The equivalent - function in OpenGL is glLoadIdentity(). - - ( end auto-generated )
        -
        -
        See Also:
        -
        pushMatrix(), -popMatrix(), -applyMatrix(PMatrix), -printMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(PMatrix source)
        -
        ( begin auto-generated from applyMatrix.xml ) - - Multiplies the current matrix by the one specified through the - parameters. This is very slow because it will try to calculate the - inverse of the transform, so avoid it whenever possible. The equivalent - function in OpenGL is glMultMatrix(). - - ( end auto-generated )
        -
        -
        See Also:
        -
        pushMatrix(), -popMatrix(), -resetMatrix(), -printMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(PMatrix2D source)
        -
      • -
      - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(float n00,
        -                        float n01,
        -                        float n02,
        -                        float n10,
        -                        float n11,
        -                        float n12)
        -
        -
        Parameters:
        -
        n00 - numbers which define the 4x4 matrix to be multiplied
        -
        n01 - numbers which define the 4x4 matrix to be multiplied
        -
        n02 - numbers which define the 4x4 matrix to be multiplied
        -
        n10 - numbers which define the 4x4 matrix to be multiplied
        -
        n11 - numbers which define the 4x4 matrix to be multiplied
        -
        n12 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Parameters:
        -
        n03 - numbers which define the 4x4 matrix to be multiplied
        -
        n13 - numbers which define the 4x4 matrix to be multiplied
        -
        n20 - numbers which define the 4x4 matrix to be multiplied
        -
        n21 - numbers which define the 4x4 matrix to be multiplied
        -
        n22 - numbers which define the 4x4 matrix to be multiplied
        -
        n23 - numbers which define the 4x4 matrix to be multiplied
        -
        n30 - numbers which define the 4x4 matrix to be multiplied
        -
        n31 - numbers which define the 4x4 matrix to be multiplied
        -
        n32 - numbers which define the 4x4 matrix to be multiplied
        -
        n33 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - -
        -
      • -

        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()
        -
        ( begin auto-generated from printMatrix.xml ) - - Prints the current matrix to the Console (the text window at the bottom - of Processing). - - ( end auto-generated )
        -
        -
        See Also:
        -
        pushMatrix(), -popMatrix(), -resetMatrix(), -applyMatrix(PMatrix)
        -
        -
      • -
      - - - -
        -
      • -

        beginCamera

        -
        public void beginCamera()
        -
        ( begin auto-generated from beginCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space. The functions are useful if - you want to more control over camera movement, however for most users, - the camera() function will be sufficient.

        The camera - functions will replace any transformations (such as rotate() or - translate()) that occur before them in draw(), but they - will not automatically replace the camera transform itself. For this - reason, camera functions should be placed at the beginning of - draw() (so that transformations happen afterwards), and the - camera() function can be used after beginCamera() if you - want to reset the camera before applying transformations.

        This function sets the matrix mode to the camera matrix so calls such - as translate(), rotate(), applyMatrix() and resetMatrix() - affect the camera. beginCamera() should always be used with a - following endCamera() and pairs of beginCamera() and - endCamera() cannot be nested. - - ( end auto-generated )
        -
        -
        See Also:
        -
        camera(), -endCamera(), -applyMatrix(PMatrix), -resetMatrix(), -translate(float, float, float), -scale(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        endCamera

        -
        public void endCamera()
        -
        ( begin auto-generated from endCamera.xml ) - - The beginCamera() and endCamera() functions enable - advanced customization of the camera space. Please see the reference for - beginCamera() for a description of how the functions are used. - - ( end auto-generated )
        -
        -
        See Also:
        -
        camera(float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        camera

        -
        public void camera()
        -
        ( begin auto-generated from camera.xml ) - - Sets the position of the camera through setting the eye position, the - center of the scene, and which axis is facing upward. Moving the eye - position and the direction it is pointing (the center of the scene) - allows the images to be seen from different angles. The version without - any parameters sets the camera to the default position, pointing to the - center of the display window with the Y axis as up. The default values - are camera(width/2.0, height/2.0, (height/2.0) / tan(PI*30.0 / - 180.0), width/2.0, height/2.0, 0, 0, 1, 0). This function is similar - to gluLookAt() in OpenGL, but it first clears the current camera settings. - - ( end auto-generated )
        -
        -
        See Also:
        -
        endCamera(), -frustum(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        camera

        -
        public void camera(float eyeX,
        -                   float eyeY,
        -                   float eyeZ,
        -                   float centerX,
        -                   float centerY,
        -                   float centerZ,
        -                   float upX,
        -                   float upY,
        -                   float upZ)
        -
        -
        Parameters:
        -
        eyeX - x-coordinate for the eye
        -
        eyeY - y-coordinate for the eye
        -
        eyeZ - z-coordinate for the eye
        -
        centerX - x-coordinate for the center of the scene
        -
        centerY - y-coordinate for the center of the scene
        -
        centerZ - z-coordinate for the center of the scene
        -
        upX - usually 0.0, 1.0, or -1.0
        -
        upY - usually 0.0, 1.0, or -1.0
        -
        upZ - usually 0.0, 1.0, or -1.0
        -
        -
      • -
      - - - - - - - -
        -
      • -

        ortho

        -
        public void ortho()
        -
        ( begin auto-generated from ortho.xml ) - - Sets an orthographic projection and defines a parallel clipping volume. - All objects with the same dimension appear the same size, regardless of - whether they are near or far from the camera. The parameters to this - function specify the clipping volume where left and right are the - minimum and maximum x values, top and bottom are the minimum and maximum - y values, and near and far are the minimum and maximum z values. If no - parameters are given, the default is used: ortho(0, width, 0, height, - -10, 10). - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho(float left,
        -                  float right,
        -                  float bottom,
        -                  float top)
        -
        -
        Parameters:
        -
        left - left plane of the clipping volume
        -
        right - right plane of the clipping volume
        -
        bottom - bottom plane of the clipping volume
        -
        top - top plane of the clipping volume
        -
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho(float left,
        -                  float right,
        -                  float bottom,
        -                  float top,
        -                  float near,
        -                  float far)
        -
        -
        Parameters:
        -
        near - maximum distance from the origin to the viewer
        -
        far - maximum distance from the origin away from the viewer
        -
        -
      • -
      - - - -
        -
      • -

        perspective

        -
        public void perspective()
        -
        ( begin auto-generated from perspective.xml ) - - Sets a perspective projection applying foreshortening, making distant - objects appear smaller than closer ones. The parameters define a viewing - volume with the shape of truncated pyramid. Objects near to the front of - the volume appear their actual size, while farther objects appear - smaller. This projection simulates the perspective of the world more - accurately than orthographic projection. The version of perspective - without parameters sets the default perspective and the version with - four parameters allows the programmer to set the area precisely. The - default values are: perspective(PI/3.0, width/height, cameraZ/10.0, - cameraZ*10.0) where cameraZ is ((height/2.0) / tan(PI*60.0/360.0)); - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        perspective

        -
        public void perspective(float fovy,
        -                        float aspect,
        -                        float zNear,
        -                        float zFar)
        -
        -
        Parameters:
        -
        fovy - field-of-view angle (in radians) for vertical direction
        -
        aspect - ratio of width to height
        -
        zNear - z-position of nearest clipping plane
        -
        zFar - z-position of farthest clipping plane
        -
        -
      • -
      - - - -
        -
      • -

        frustum

        -
        public void frustum(float left,
        -                    float right,
        -                    float bottom,
        -                    float top,
        -                    float near,
        -                    float far)
        -
        ( begin auto-generated from frustum.xml ) - - Sets a perspective matrix defined through the parameters. Works like - glFrustum, except it wipes out the current perspective matrix rather - than muliplying itself with it. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        left - left coordinate of the clipping plane
        -
        right - right coordinate of the clipping plane
        -
        bottom - bottom coordinate of the clipping plane
        -
        top - top coordinate of the clipping plane
        -
        near - near component of the clipping plane; must be greater than zero
        -
        far - far component of the clipping plane; must be greater than the near value
        -
        See Also:
        -
        camera(float, float, float, float, float, float, float, float, float), -endCamera(), -perspective(float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y)
        -
        ( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        screenY(float, float, float), -screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y)
        -
        ( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        screenX(float, float, float), -screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y,
        -                     float z)
        -
        -
        Parameters:
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y,
        -                     float z)
        -
        -
        Parameters:
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenZ

        -
        public float screenZ(float x,
        -                     float y,
        -                     float z)
        -
        ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        screenX(float, float, float), -screenY(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelX

        -
        public float modelX(float x,
        -                    float y,
        -                    float z)
        -
        ( begin auto-generated from modelX.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the X value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The X value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use. -

        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        modelY(float, float, float), -modelZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelY

        -
        public float modelY(float x,
        -                    float y,
        -                    float z)
        -
        ( begin auto-generated from modelY.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the Y value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The Y value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use.
        -
        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        modelX(float, float, float), -modelZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelZ

        -
        public float modelZ(float x,
        -                    float y,
        -                    float z)
        -
        ( begin auto-generated from modelZ.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the Z value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The Z value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use.
        -
        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        modelX(float, float, float), -modelY(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        pushStyle

        -
        public void pushStyle()
        -
        ( begin auto-generated from pushStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings. Note that these functions - are always used together. They allow you to change the style settings - and later return to what you had. When a new style is started with - pushStyle(), it builds on the current style information. The - pushStyle() and popStyle() functions can be embedded to - provide more control (see the second example above for a demonstration.) -

        - The style information controlled by the following functions are included - in the style: - fill(), stroke(), tint(), strokeWeight(), strokeCap(), strokeJoin(), - imageMode(), rectMode(), ellipseMode(), shapeMode(), colorMode(), - textAlign(), textFont(), textMode(), textSize(), textLeading(), - emissive(), specular(), shininess(), ambient() - - ( end auto-generated )
        -
        -
        See Also:
        -
        popStyle()
        -
        -
      • -
      - - - -
        -
      • -

        popStyle

        -
        public void popStyle()
        -
        ( begin auto-generated from popStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings; these functions are - always used together. They allow you to change the style settings and - later return to what you had. When a new style is started with - pushStyle(), it builds on the current style information. The - pushStyle() and popStyle() functions can be embedded to - provide more control (see the second example above for a demonstration.) - - ( end auto-generated )
        -
        -
        See Also:
        -
        pushStyle()
        -
        -
      • -
      - - - -
        -
      • -

        style

        -
        public void style(PStyle s)
        -
      • -
      - - - -
        -
      • -

        getStyle

        -
        public PStyle getStyle()
        -
      • -
      - - - - - - - -
        -
      • -

        strokeWeight

        -
        public void strokeWeight(float weight)
        -
        ( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes. All widths are set in units of pixels. -

        - When drawing with P3D, series of connected lines (such as the stroke - around a polygon, triangle, or ellipse) produce unattractive results - when a thick stroke weight is set (see - Issue 123). With P3D, the minimum and maximum values for - strokeWeight() are controlled by the graphics card and the - operating system's OpenGL implementation. For instance, the thickness - may not go higher than 10 pixels. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        weight - the weight (in pixels) of the stroke
        -
        See Also:
        -
        stroke(int, float), -strokeJoin(int), -strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        strokeJoin

        -
        public void strokeJoin(int join)
        -
        ( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments. These joints - are either mitered, beveled, or rounded and specified with the - corresponding parameters MITER, BEVEL, and ROUND. The default joint is - MITER. -

        - This function is not available with the P3D renderer, (see - Issue 123). More information about the renderers can be found in the - size() reference. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        join - either MITER, BEVEL, ROUND
        -
        See Also:
        -
        stroke(int, float), -strokeWeight(float), -strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        strokeCap

        -
        public void strokeCap(int cap)
        -
        ( begin auto-generated from strokeCap.xml ) - - Sets the style for rendering line endings. These ends are either - squared, extended, or rounded and specified with the corresponding - parameters SQUARE, PROJECT, and ROUND. The default cap is ROUND. -

        - This function is not available with the P3D renderer (see - Issue 123). More information about the renderers can be found in the - size() reference. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        cap - either SQUARE, PROJECT, or ROUND
        -
        See Also:
        -
        stroke(int, float), -strokeWeight(float), -strokeJoin(int), -PApplet.size(int, int, String, String)
        -
        -
      • -
      - - - -
        -
      • -

        noStroke

        -
        public void noStroke()
        -
        ( begin auto-generated from noStroke.xml ) - - Disables drawing the stroke (outline). If both noStroke() and - noFill() are called, nothing will be drawn to the screen. - - ( end auto-generated )
        -
        -
        See Also:
        -
        stroke(int, float), -fill(float, float, float, float), -noFill()
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(int rgb)
        -
        ( begin auto-generated from stroke.xml ) - - Sets the color used to draw lines and borders around shapes. This color - is either specified in terms of the RGB or HSB color depending on the - current colorMode() (the default color space is RGB, with each - value in the range from 0 to 255). -

        - When using hexadecimal notation to specify a color, use "#" or "0x" - before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six - digits to specify a color (the way colors are specified in HTML and - CSS). When using the hexadecimal notation starting with "0x", the - hexadecimal value must be specified with eight characters; the first two - characters define the alpha component and the remainder the red, green, - and blue components. -

        - The value for the parameter "gray" must be less than or equal to the - current maximum value as specified by colorMode(). The default - maximum value is 255. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color value in hexadecimal notation
        -
        See Also:
        -
        noStroke(), -strokeWeight(float), -strokeJoin(int), -strokeCap(int), -fill(int, float), -noFill(), -tint(int, float), -background(float, float, float, float), -colorMode(int, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(int rgb,
        -                   float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the stroke
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float gray)
        -
        -
        Parameters:
        -
        gray - specifies a value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float gray,
        -                   float alpha)
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float v1,
        -                   float v2,
        -                   float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        stroke

        -
        public void stroke(float v1,
        -                   float v2,
        -                   float v3,
        -                   float alpha)
        -
      • -
      - - - - - - - -
        -
      • -

        tint

        -
        public void tint(int rgb)
        -
        ( begin auto-generated from tint.xml ) - - Sets the fill value for displaying images. Images can be tinted to - specified colors or made transparent by setting the alpha.
        -
        - To make an image transparent, but not change it's color, use white as - the tint color and specify an alpha value. For instance, tint(255, 128) - will make an image 50% transparent (unless colorMode() has been - used).
        -
        - When using hexadecimal notation to specify a color, use "#" or "0x" - before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six - digits to specify a color (the way colors are specified in HTML and - CSS). When using the hexadecimal notation starting with "0x", the - hexadecimal value must be specified with eight characters; the first two - characters define the alpha component and the remainder the red, green, - and blue components.
        -
        - The value for the parameter "gray" must be less than or equal to the - current maximum value as specified by colorMode(). The default - maximum value is 255.
        -
        - The tint() function is also used to control the coloring of - textures in 3D. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color value in hexadecimal notation
        -
        See Also:
        -
        noTint(), -image(PImage, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(int rgb,
        -                 float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the image
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float gray)
        -
        -
        Parameters:
        -
        gray - specifies a value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float gray,
        -                 float alpha)
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float v1,
        -                 float v2,
        -                 float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        tint

        -
        public void tint(float v1,
        -                 float v2,
        -                 float v3,
        -                 float alpha)
        -
      • -
      - - - -
        -
      • -

        noFill

        -
        public void noFill()
        -
        ( begin auto-generated from noFill.xml ) - - Disables filling geometry. If both noStroke() and noFill() - are called, nothing will be drawn to the screen. - - ( end auto-generated )
        -
        -
        See Also:
        -
        fill(float, float, float, float), -stroke(int, float), -noStroke()
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(int rgb)
        -
        ( begin auto-generated from fill.xml ) - - Sets the color used to fill shapes. For example, if you run fill(204, - 102, 0), all subsequent shapes will be filled with orange. This - color is either specified in terms of the RGB or HSB color depending on - the current colorMode() (the default color space is RGB, with - each value in the range from 0 to 255). -

        - When using hexadecimal notation to specify a color, use "#" or "0x" - before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six - digits to specify a color (the way colors are specified in HTML and - CSS). When using the hexadecimal notation starting with "0x", the - hexadecimal value must be specified with eight characters; the first two - characters define the alpha component and the remainder the red, green, - and blue components. -

        - The value for the parameter "gray" must be less than or equal to the - current maximum value as specified by colorMode(). The default - maximum value is 255. -

        - To change the color of an image (or a texture), use tint(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color variable or hex value
        -
        See Also:
        -
        noFill(), -stroke(int, float), -noStroke(), -tint(int, float), -background(float, float, float, float), -colorMode(int, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(int rgb,
        -                 float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the fill
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float gray)
        -
        -
        Parameters:
        -
        gray - number specifying value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float gray,
        -                 float alpha)
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float v1,
        -                 float v2,
        -                 float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill(float v1,
        -                 float v2,
        -                 float v3,
        -                 float alpha)
        -
      • -
      - - - -
        -
      • -

        ambient

        -
        public void ambient(int rgb)
        -
        ( begin auto-generated from ambient.xml ) - - Sets the ambient reflectance for shapes drawn to the screen. This is - combined with the ambient light component of environment. The color - components set through the parameters define the reflectance. For - example in the default color mode, setting v1=255, v2=126, v3=0, would - cause all the red light to reflect and half of the green light to - reflect. Used in combination with emissive(), specular(), - and shininess() in setting the material properties of shapes. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        emissive(float, float, float), -specular(float, float, float), -shininess(float)
        -
        -
      • -
      - - - -
        -
      • -

        ambient

        -
        public void ambient(float gray)
        -
        -
        Parameters:
        -
        gray - number specifying value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        ambient

        -
        public void ambient(float v1,
        -                    float v2,
        -                    float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        specular

        -
        public void specular(int rgb)
        -
        ( begin auto-generated from specular.xml ) - - Sets the specular color of the materials used for shapes drawn to the - screen, which sets the color of hightlights. Specular refers to light - which bounces off a surface in a perferred direction (rather than - bouncing in all directions like a diffuse light). Used in combination - with emissive(), ambient(), and shininess() in - setting the material properties of shapes. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color to set
        -
        See Also:
        -
        lightSpecular(float, float, float), -ambient(float, float, float), -emissive(float, float, float), -shininess(float)
        -
        -
      • -
      - - - -
        -
      • -

        specular

        -
        public void specular(float gray)
        -
        gray number specifying value between white and black
        -
      • -
      - - - -
        -
      • -

        specular

        -
        public void specular(float v1,
        -                     float v2,
        -                     float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        shininess

        -
        public void shininess(float shine)
        -
        ( begin auto-generated from shininess.xml ) - - Sets the amount of gloss in the surface of shapes. Used in combination - with ambient(), specular(), and emissive() in - setting the material properties of shapes. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        shine - degree of shininess
        -
        See Also:
        -
        emissive(float, float, float), -ambient(float, float, float), -specular(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        emissive

        -
        public void emissive(int rgb)
        -
        ( begin auto-generated from emissive.xml ) - - Sets the emissive color of the material used for drawing shapes drawn to - the screen. Used in combination with ambient(), - specular(), and shininess() in setting the material - properties of shapes. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - color to set
        -
        See Also:
        -
        ambient(float, float, float), -specular(float, float, float), -shininess(float)
        -
        -
      • -
      - - - -
        -
      • -

        emissive

        -
        public void emissive(float gray)
        -
        gray number specifying value between white and black
        -
      • -
      - - - -
        -
      • -

        emissive

        -
        public void emissive(float v1,
        -                     float v2,
        -                     float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        noLights

        -
        public void noLights()
        -
        ( begin auto-generated from noLights.xml ) - - Disable all lighting. Lighting is turned off by default and enabled with - the lights() function. This function can be used to disable - lighting so that 2D geometry (which does not require lighting) can be - drawn after a set of lighted 3D geometry. - - ( end auto-generated )
        -
        -
        See Also:
        -
        lights()
        -
        -
      • -
      - - - -
        -
      • -

        ambientLight

        -
        public void ambientLight(float v1,
        -                         float v2,
        -                         float v3)
        -
        ( begin auto-generated from ambientLight.xml ) - - Adds an ambient light. Ambient light doesn't come from a specific - direction, the rays have light have bounced around so much that objects - are evenly lit from all sides. Ambient lights are almost always used in - combination with other types of lights. Lights need to be included in - the draw() to remain persistent in a looping program. Placing - them in the setup() of a looping program will cause them to only - have an effect the first time through the loop. The effect of the - parameters is determined by the current color mode. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        See Also:
        -
        lights(), -directionalLight(float, float, float, float, float, float), -pointLight(float, float, float, float, float, float), -spotLight(float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        ambientLight

        -
        public void ambientLight(float v1,
        -                         float v2,
        -                         float v3,
        -                         float x,
        -                         float y,
        -                         float z)
        -
        -
        Parameters:
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        -
      • -
      - - - -
        -
      • -

        directionalLight

        -
        public void directionalLight(float v1,
        -                             float v2,
        -                             float v3,
        -                             float nx,
        -                             float ny,
        -                             float nz)
        -
        ( begin auto-generated from directionalLight.xml ) - - Adds a directional light. Directional light comes from one direction and - is stronger when hitting a surface squarely and weaker if it hits at a a - gentle angle. After hitting a surface, a directional lights scatters in - all directions. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The nx, ny, and nz parameters specify the - direction the light is facing. For example, setting ny to -1 will - cause the geometry to be lit from below (the light is facing directly upward). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        nx - direction along the x-axis
        -
        ny - direction along the y-axis
        -
        nz - direction along the z-axis
        -
        See Also:
        -
        lights(), -ambientLight(float, float, float, float, float, float), -pointLight(float, float, float, float, float, float), -spotLight(float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        pointLight

        -
        public void pointLight(float v1,
        -                       float v2,
        -                       float v3,
        -                       float x,
        -                       float y,
        -                       float z)
        -
        ( begin auto-generated from pointLight.xml ) - - Adds a point light. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The x, y, and z parameters set the position - of the light. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        See Also:
        -
        lights(), -directionalLight(float, float, float, float, float, float), -ambientLight(float, float, float, float, float, float), -spotLight(float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        spotLight

        -
        public void spotLight(float v1,
        -                      float v2,
        -                      float v3,
        -                      float x,
        -                      float y,
        -                      float z,
        -                      float nx,
        -                      float ny,
        -                      float nz,
        -                      float angle,
        -                      float concentration)
        -
        ( begin auto-generated from spotLight.xml ) - - Adds a spot light. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The x, y, and z parameters specify the - position of the light and nx, ny, nz specify the - direction or light. The angle parameter affects angle of the - spotlight cone. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on current color mode)
        -
        v2 - green or saturation value (depending on current color mode)
        -
        v3 - blue or brightness value (depending on current color mode)
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        nx - direction along the x axis
        -
        ny - direction along the y axis
        -
        nz - direction along the z axis
        -
        angle - angle of the spotlight cone
        -
        concentration - exponent determining the center bias of the cone
        -
        See Also:
        -
        lights(), -directionalLight(float, float, float, float, float, float), -pointLight(float, float, float, float, float, float), -ambientLight(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        lightFalloff

        -
        public void lightFalloff(float constant,
        -                         float linear,
        -                         float quadratic)
        -
        ( begin auto-generated from lightFalloff.xml ) - - Sets the falloff rates for point lights, spot lights, and ambient - lights. The parameters are used to determine the falloff with the - following equation:

        d = distance from light position to - vertex position
        falloff = 1 / (CONSTANT + d * LINEAR + (d*d) * - QUADRATIC)

        Like fill(), it affects only the elements - which are created after it in the code. The default value if - LightFalloff(1.0, 0.0, 0.0). Thinking about an ambient light with - a falloff can be tricky. It is used, for example, if you wanted a region - of your scene to be lit ambiently one color and another region to be lit - ambiently by another color, you would use an ambient light with location - and falloff. You can think of it as a point light that doesn't care - which direction a surface is facing. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        constant - constant value or determining falloff
        -
        linear - linear value for determining falloff
        -
        quadratic - quadratic value for determining falloff
        -
        See Also:
        -
        lights(), -ambientLight(float, float, float, float, float, float), -pointLight(float, float, float, float, float, float), -spotLight(float, float, float, float, float, float, float, float, float, float, float), -lightSpecular(float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        background

        -
        public void background(int rgb)
        -
        ( begin auto-generated from background.xml ) - - The background() function sets the color used for the background - of the Processing window. The default background is light gray. In the - draw() function, the background color is used to clear the - display window at the beginning of each frame. -

        - An image can also be used as the background for a sketch, however its - width and height must be the same size as the sketch window. To resize - an image 'b' to the size of the sketch window, use b.resize(width, height). -

        - Images used as background will ignore the current tint() setting. -

        - It is not possible to use transparency (alpha) in background colors with - the main drawing surface, however they will work properly with createGraphics(). - - ( end auto-generated ) - -

        Advanced

        -

        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.

        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        stroke(float), -fill(float), -tint(float), -colorMode(int)
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(int rgb,
        -                       float alpha)
        -
        -
        Parameters:
        -
        alpha - opacity of the background
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float gray)
        -
        -
        Parameters:
        -
        gray - specifies a value between white and black
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float gray,
        -                       float alpha)
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float v1,
        -                       float v2,
        -                       float v3)
        -
        -
        Parameters:
        -
        v1 - red or hue value (depending on the current color mode)
        -
        v2 - green or saturation value (depending on the current color mode)
        -
        v3 - blue or brightness value (depending on the current color mode)
        -
        -
      • -
      - - - -
        -
      • -

        background

        -
        public void background(float v1,
        -                       float v2,
        -                       float v3,
        -                       float alpha)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
      • -
      - - - -
        -
      • -

        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. Use image.filter(OPAQUE) to handle this easily.
        -
        - When using 3D, this will also clear the zbuffer (if it exists).
        -
        -
        Parameters:
        -
        image - PImage to set as background (must be same size as the sketch window)
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode)
        -
        ( begin auto-generated from colorMode.xml ) - - Changes the way Processing interprets color data. By default, the - parameters for fill(), stroke(), background(), and - color() are defined by values between 0 and 255 using the RGB - color model. The colorMode() function is used to change the - numerical range used for specifying colors and to switch color systems. - For example, calling colorMode(RGB, 1.0) will specify that values - are specified between 0 and 1. The limits for defining colors are - altered by setting the parameters range1, range2, range3, and range 4. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        mode - Either RGB or HSB, corresponding to Red/Green/Blue and Hue/Saturation/Brightness
        -
        See Also:
        -
        background(float), -fill(float), -stroke(float)
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float max)
        -
        -
        Parameters:
        -
        max - range for all color elements
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float max1,
        -                      float max2,
        -                      float max3)
        -
        -
        Parameters:
        -
        max1 - range for the red or hue depending on the current color mode
        -
        max2 - range for the green or saturation depending on the current color mode
        -
        max3 - range for the blue or brightness depending on the current color mode
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float max1,
        -                      float max2,
        -                      float max3,
        -                      float maxA)
        -
        -
        Parameters:
        -
        maxA - range for the alpha
        -
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int c)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(float gray)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int c,
        -                       int alpha)
        -
        -
        Parameters:
        -
        c - can be packed ARGB or a gray in this case
        -
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int c,
        -                       float alpha)
        -
        -
        Parameters:
        -
        c - 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 v1,
        -                       int v2,
        -                       int v3)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(float v1,
        -                       float v2,
        -                       float v3)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(int v1,
        -                       int v2,
        -                       int v3,
        -                       int a)
        -
      • -
      - - - -
        -
      • -

        color

        -
        public final int color(float v1,
        -                       float v2,
        -                       float v3,
        -                       float a)
        -
      • -
      - - - - - - - -
        -
      • -

        red

        -
        public final float red(int rgb)
        -
        ( begin auto-generated from red.xml ) - - Extracts the red value from a color, scaled to match current - colorMode(). This value is always returned as a float so be - careful not to assign it to an int value.

        The red() function - is easy to use and undestand, but is slower than another technique. To - achieve the same results when working in colorMode(RGB, 255), but - with greater speed, use the >> (right shift) operator with a bit - mask. For example, the following two lines of code are equivalent:
        float r1 = red(myColor);
        float r2 = myColor >> 16 - & 0xFF;
        - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        green(int), -blue(int), -alpha(int), -hue(int), -saturation(int), -brightness(int)
        -
        -
      • -
      - - - -
        -
      • -

        green

        -
        public final float green(int rgb)
        -
        ( begin auto-generated from green.xml ) - - Extracts the green value from a color, scaled to match current - colorMode(). This value is always returned as a float so be - careful not to assign it to an int value.

        The green() - function is easy to use and undestand, but is slower than another - technique. To achieve the same results when working in colorMode(RGB, - 255), but with greater speed, use the >> (right shift) - operator with a bit mask. For example, the following two lines of code - are equivalent:
        float r1 = green(myColor);
        float r2 = - myColor >> 8 & 0xFF;
        - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        red(int), -blue(int), -alpha(int), -hue(int), -saturation(int), -brightness(int)
        -
        -
      • -
      - - - -
        -
      • -

        blue

        -
        public final float blue(int rgb)
        -
        ( begin auto-generated from blue.xml ) - - Extracts the blue value from a color, scaled to match current - colorMode(). This value is always returned as a float so be - careful not to assign it to an int value.

        The blue() - function is easy to use and undestand, but is slower than another - technique. To achieve the same results when working in colorMode(RGB, - 255), but with greater speed, use a bit mask to remove the other - color components. For example, the following two lines of code are - equivalent:
        float r1 = blue(myColor);
        float r2 = myColor - & 0xFF;
        - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        red(int), -green(int), -alpha(int), -hue(int), -saturation(int), -brightness(int)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        saturation

        -
        public final float saturation(int rgb)
        -
        ( begin auto-generated from saturation.xml ) - - Extracts the saturation value from a color. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        red(int), -green(int), -blue(int), -alpha(int), -hue(int), -brightness(int)
        -
        -
      • -
      - - - -
        -
      • -

        brightness

        -
        public final float brightness(int rgb)
        -
        ( begin auto-generated from brightness.xml ) - - Extracts the brightness value from a color. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        rgb - any value of the color datatype
        -
        See Also:
        -
        red(int), -green(int), -blue(int), -alpha(int), -hue(int), -saturation(int)
        -
        -
      • -
      - - - -
        -
      • -

        lerpColor

        -
        public int lerpColor(int c1,
        -                     int c2,
        -                     float amt)
        -
        ( begin auto-generated from lerpColor.xml ) - - Calculates a color or colors between two color at a specific increment. - The amt parameter is the amount to interpolate between the two - values where 0.0 equal to the first point, 0.1 is very near the first - point, 0.5 is half-way in between, etc. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        c1 - interpolate from this color
        -
        c2 - interpolate to this color
        -
        amt - between 0.0 and 1.0
        -
        See Also:
        -
        PImage.blendColor(int, int, int), -color(float, float, float, float), -PApplet.lerp(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        lerpColor

        -
        public static int lerpColor(int c1,
        -                            int c2,
        -                            float amt,
        -                            int mode)
        -
      • -
      - - - -
        -
      • -

        beginRaw

        -
        public void beginRaw(PGraphics rawGraphics)
        -
        Record individual lines and triangles by echoing them to another renderer.
        -
      • -
      - - - -
        -
      • -

        endRaw

        -
        public void endRaw()
        -
      • -
      - - - -
        -
      • -

        haveRaw

        -
        public boolean haveRaw()
        -
      • -
      - - - - - - - -
        -
      • -

        showWarning

        -
        public static void showWarning(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)
        -
        -
      • -
      - - - -
        -
      • -

        showWarning

        -
        public static void showWarning(String msg,
        -                               Object... args)
        -
        Version of showWarning() that takes a parsed String.
        -
      • -
      - - - -
        -
      • -

        showDepthWarning

        -
        public static void showDepthWarning(String method)
        -
        Display a warning that the specified method is only available with 3D.
        -
        -
        Parameters:
        -
        method - The method name (no parentheses)
        -
        -
      • -
      - - - -
        -
      • -

        showDepthWarningXYZ

        -
        public static void showDepthWarningXYZ(String method)
        -
        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.
        -
        -
        Parameters:
        -
        method - The method name (no parentheses)
        -
        -
      • -
      - - - -
        -
      • -

        showMethodWarning

        -
        public static void showMethodWarning(String method)
        -
        Display a warning that the specified method is simply unavailable.
        -
      • -
      - - - -
        -
      • -

        showVariationWarning

        -
        public static void showVariationWarning(String str)
        -
        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.
        -
      • -
      - - - -
        -
      • -

        showMissingWarning

        -
        public static void showMissingWarning(String method)
        -
        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.
        -
      • -
      - - - -
        -
      • -

        showException

        -
        public static void showException(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 3D drawing. Defaults to false.
        -
      • -
      - - - -
        -
      • -

        isGL

        -
        public boolean isGL()
        -
        Return true if this renderer does rendering through OpenGL. Defaults to false.
        -
      • -
      - - - -
        -
      • -

        is2X

        -
        public boolean is2X()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PGraphicsDanger2D.html b/build/javadoc/everything/processing/core/PGraphicsDanger2D.html deleted file mode 100644 index bf39dbdfb4..0000000000 --- a/build/javadoc/everything/processing/core/PGraphicsDanger2D.html +++ /dev/null @@ -1,1186 +0,0 @@ - - - - - -PGraphicsDanger2D - - - - - - - - - - - -
-
processing.core
-

Class PGraphicsDanger2D

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Cloneable, PConstants
    -
    -
    -
    -
    public class PGraphicsDanger2D
    -extends PGraphicsJava2D
    -
    Experimental/enhanced renderer that draws directly to the Graphics context - without an intermediate image. This greatly speeds up performance - (especially on hidpi displays), but prevents pixel access. It also causes - some rendering hiccups (frame rate is not as smooth), but that's why it's - experimental. - - Works with both normal and hidpi, without need for an extra E2D_2X. - - This is not the final class name, and it's not clear in what form (or if) - this will ship with 3.0.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PGraphicsDanger2D

        -
        public PGraphicsDanger2D()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        beginDraw

        -
        public void beginDraw()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from PGraphics_beginDraw.xml ) - - Sets the default properties for a PGraphics object. It should be called - before anything is drawn into the object. - - ( end auto-generated ) -

        Advanced

        - When creating your own PGraphics, you should call this before - drawing anything.
        -
        -
        Overrides:
        -
        beginDraw in class PGraphicsJava2D
        -
        -
      • -
      - - - -
        -
      • -

        loadPixels

        -
        public void loadPixels()
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_loadPixels.xml ) - - Loads the pixel data for the image into its pixels[] array. This - function must always be called before reading from or writing to pixels[]. -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. - - ( end auto-generated ) - -

        Advanced

        - 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()
        -
        -
        Overrides:
        -
        updatePixels in class PImage
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        Parameters:
        -
        x - x-coordinate of the upper-left corner
        -
        y - y-coordinate of the upper-left corner
        -
        c - width
        -
        d - height
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get(int x,
        -               int y)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image. If no - parameters are specified, the entire image is returned. Use the x - and y parameters to get the value of one pixel. Get a section of - the display window by specifying an additional width and - height parameter. When getting an image, the x and - y parameters define the coordinates for the upper-left corner of - the image, regardless of the current imageMode().
        -
        - If the pixel requested is outside of the image window, black is - returned. The numbers returned are scaled according to the current color - ranges, but only RGB values are returned by this function. For example, - even though you may have drawn a shape with colorMode(HSB), the - numbers returned will be in RGB format.
        -
        - Getting the color of a single pixel with get(x, y) is easy, but - not as fast as grabbing the data directly from pixels[]. The - equivalent statement to get(x, y) using pixels[] is - pixels[y*width+x]. See the reference for pixels[] for more information. - - ( end auto-generated ) - -

        Advanced

        - 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
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        See Also:
        -
        PApplet.set(int, int, int), -PApplet.pixels, -PApplet.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public PImage get(int x,
        -                  int y,
        -                  int c,
        -                  int d)
        -
        -
        Overrides:
        -
        get in class PImage
        -
        c - width of pixel rectangle to get
        -
        d - height of pixel rectangle to get
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public PImage get()
        -
        Description copied from class: PImage
        -
        Returns a copy of this PImage. Equivalent to get(0, 0, width, height). - Deprecated, just use copy() instead.
        -
        -
        Overrides:
        -
        get in class PGraphicsJava2D
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                int argb)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
        -
        - The x and y parameters specify the pixel to change and the - color parameter specifies the color value. The color parameter is - affected by the current color mode (the default is RGB values from 0 to - 255). When setting an image, the x and y parameters define - the coordinates for the upper-left corner of the image, regardless of - the current imageMode(). -

        - Setting the color of a single pixel with set(x, y) is easy, but - not as fast as putting the data directly into pixels[]. The - equivalent statement to set(x, y, #000000) using pixels[] - is pixels[y*width+x] = #000000. See the reference for - pixels[] for more information. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        set in class PGraphicsJava2D
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        argb - any value of the color datatype
        -
        See Also:
        -
        PImage.get(int, int, int, int), -PImage.pixels, -PImage.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                PImage image)
        -
        Description copied from class: PImage
        -

        Advanced

        - 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
        -
        image - image to copy into the original image
        -
        -
      • -
      - - - -
        -
      • -

        mask

        -
        public void mask(int[] alpha)
        -
        -
        Overrides:
        -
        mask in class PGraphicsJava2D
        -
        -
      • -
      - - - -
        -
      • -

        mask

        -
        public void mask(PImage alpha)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel. This mask image should only contain - grayscale data, but only the blue color channel is used. The mask image - needs to be the same size as the image to which it is applied.
        -
        - In addition to using a mask image, an integer array containing the alpha - channel data can be specified directly. This method is useful for - creating dynamically generated alpha masks. This array must be of the - same length as the target image's pixels array and should contain only - grayscale data of values between 0-255. - - ( end auto-generated ) - -

        Advanced

        - - 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" grayscale by - performing a proper luminance-based conversion.

        -
        -
        Overrides:
        -
        mask in class PGraphicsJava2D
        -
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(int kind)
        -
        -
        Overrides:
        -
        filter in class PImage
        -
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(int kind,
        -                   float param)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_filter.xml ) - - Filters an image as defined by one of the following modes:

        THRESHOLD - converts the image to black and white pixels depending if - they are above or below the threshold defined by the level parameter. - The level must be between 0.0 (black) and 1.0(white). If no level is - specified, 0.5 is used.
        -
        - GRAY - converts any colors in the image to grayscale equivalents
        -
        - INVERT - sets each pixel to its inverse value
        -
        - POSTERIZE - limits each channel of the image to the number of colors - specified as the level parameter
        -
        - BLUR - executes a Guassian blur with the level parameter specifying the - extent of the blurring. If no level parameter is used, the blur is - equivalent to Guassian blur of radius 1
        -
        - OPAQUE - sets the alpha channel to entirely opaque
        -
        - ERODE - reduces the light areas with the amount defined by the level - parameter
        -
        - DILATE - increases the light areas with the amount defined by the level parameter - - ( end auto-generated ) - -

        Advanced

        - 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
        -
        Parameters:
        -
        kind - Either THRESHOLD, GRAY, OPAQUE, INVERT, POSTERIZE, BLUR, ERODE, or DILATE
        -
        param - unique for each, see above
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        ( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another. If the source and - destination regions aren't the same size, it will automatically resize - source pixels to fit the specified target region. No alpha information - is used in the process, however if the source image has an alpha channel - set, it will be copied as well. -

        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        copy in class PGraphicsJava2D
        -
        Parameters:
        -
        sx1 - X coordinate of the source's upper left corner
        -
        sy1 - Y coordinate of the source's upper left corner
        -
        sx2 - source image width
        -
        sy2 - source image height
        -
        dx1 - X coordinate of the destination's upper left corner
        -
        dy1 - Y coordinate of the destination's upper left corner
        -
        dx2 - destination image width
        -
        dy2 - destination image height
        -
        See Also:
        -
        PGraphics.alpha(int), -PImage.blend(PImage, int, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(PImage src,
        -                 int sx1,
        -                 int sy1,
        -                 int sx2,
        -                 int sy2,
        -                 int dx1,
        -                 int dy1,
        -                 int dx2,
        -                 int dy2)
        -
        -
        Overrides:
        -
        copy in class PGraphicsJava2D
        -
        Parameters:
        -
        src - an image variable referring to the source image.
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Overrides:
        -
        blend in class PImage
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        ( begin auto-generated from PImage_blend.xml ) - - Blends a region of pixels into the image specified by the img - parameter. These copies utilize full alpha channel support and a choice - of the following modes to blend the colors of source pixels (A) with the - ones of pixels in the destination image (B):
        -
        - BLEND - linear interpolation of colours: C = A*factor + B
        -
        - ADD - additive blending with white clip: C = min(A*factor + B, 255)
        -
        - SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, - 0)
        -
        - DARKEST - only the darkest colour succeeds: C = min(A*factor, B)
        -
        - LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)
        -
        - 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.
        -
        - All modes use the alpha information (highest byte) of source image - pixels as the blending factor. If the source and destination regions are - different sizes, the image will be automatically resized to match the - destination size. If the srcImg parameter is not used, the - display window is used as the source image.
        -
        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        blend in class PImage
        -
        Parameters:
        -
        src - an image variable referring to the source image
        -
        sx1 - X coordinate of the source's upper left corner
        -
        sy1 - Y coordinate of the source's upper left corner
        -
        sx2 - source image width
        -
        sy2 - source image height
        -
        dx1 - X coordinate of the destinations's upper left corner
        -
        dy1 - Y coordinate of the destinations's upper left corner
        -
        dx2 - destination image width
        -
        dy2 - destination image height
        -
        mode - Either BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN
        -
        See Also:
        -
        PApplet.alpha(int), -PImage.copy(PImage, int, int, int, int, int, int, int, int), -PImage.blendColor(int,int,int)
        -
        -
      • -
      - - - -
        -
      • -

        save

        -
        public boolean save(String filename)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_save.xml ) - - Saves the image into a file. Images are saved in TIFF, TARGA, JPEG, and - PNG format depending on the extension within the filename - parameter. For example, "image.tif" will have a TIFF image and - "image.png" will save a PNG image. If no extension is included in the - filename, the image will save in TIFF format and .tif will be - added to the name. These files are saved to the sketch's folder, which - may be opened by selecting "Show sketch folder" from the "Sketch" menu. - It is not possible to use save() while running the program in a - web browser.

        To save an image created within the code, rather - than through loading, it's necessary to make the image with the - createImage() function so it is aware of the location of the - program and can therefore save the file to the right place. See the - createImage() reference for more information. - - ( end auto-generated ) -

        Advanced

        - 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
        -
        Parameters:
        -
        filename - a sequence of letters and numbers
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PGraphicsFX2D.html b/build/javadoc/everything/processing/core/PGraphicsFX2D.html deleted file mode 100644 index f324bc44db..0000000000 --- a/build/javadoc/everything/processing/core/PGraphicsFX2D.html +++ /dev/null @@ -1,2518 +0,0 @@ - - - - - -PGraphicsFX2D - - - - - - - - - - - -
-
processing.core
-

Class PGraphicsFX2D

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PGraphicsFX2D

        -
        public PGraphicsFX2D()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      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
        -
        ( begin auto-generated from PGraphics_beginDraw.xml ) - - Sets the default properties for a PGraphics object. It should be called - before anything is drawn into the object. - - ( end auto-generated ) -

        Advanced

        - 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
        -
        ( begin auto-generated from PGraphics_endDraw.xml ) - - Finalizes the rendering of a PGraphics object so that it can be shown on screen. - - ( end auto-generated ) -

        Advanced

        -

        - 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
        -
        ( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms. beginShape() begins recording - vertices for a shape and endShape() stops recording. The value of - the MODE parameter tells it which types of shapes to create from - the provided vertices. With no mode specified, the shape can be any - irregular polygon. The parameters available for beginShape() are POINTS, - LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, and QUAD_STRIP. - After calling the beginShape() function, a series of - vertex() commands must follow. To stop drawing the shape, call - endShape(). The vertex() function with two parameters - specifies a position in 2D and the vertex() function with three - parameters specifies a position in 3D. Each shape will be outlined with - the current stroke color and filled with the fill color. -

        - Transformations such as translate(), rotate(), and - scale() do not work within beginShape(). It is also not - possible to use other shapes, such as ellipse() or rect() - within beginShape(). -

        - The P3D renderer settings allow stroke() and fill() - settings to be altered per-vertex, however the default P2D renderer does - not. Settings such as strokeWeight(), strokeCap(), and - strokeJoin() cannot be changed while inside a - beginShape()/endShape() block with any renderer. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        beginShape in class PGraphics
        -
        Parameters:
        -
        kind - Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIP
        -
        See Also:
        -
        PShape, -PGraphics.endShape(), -PGraphics.vertex(float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        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[] v)
        -
        Description copied from class: PGraphics
        -
        Used by renderer subclasses or PShape to efficiently pass in already - formatted vertex information.
        -
        -
        Overrides:
        -
        vertex in class PGraphics
        -
        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)
        -
        -
        Overrides:
        -
        vertex in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float z,
        -                   float u,
        -                   float v)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices. - vertex() is used to specify the vertex coordinates for points, - lines, triangles, quads, and polygons and is used exclusively within the - beginShape() and endShape() function.
        -
        - Drawing a vertex in 3D using the z parameter requires the P3D - parameter in combination with size as shown in the above example.
        -
        - This function is also used to map a texture onto the geometry. The - texture() function declares the texture to apply to the geometry - and the u and v coordinates set define the mapping of this - texture to the form. By default, the coordinates used for u and - v are specified in relation to the image's size in pixels, but - this relation can be changed with textureMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        vertex in class PGraphics
        -
        Parameters:
        -
        x - x-coordinate of the vertex
        -
        y - y-coordinate of the vertex
        -
        z - z-coordinate of the vertex
        -
        u - horizontal coordinate for the texture mapping
        -
        v - vertical coordinate for the texture mapping
        -
        See Also:
        -
        PGraphics.beginShape(int), -PGraphics.endShape(int), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.texture(PImage)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        endContour

        -
        public void endContour()
        -
        -
        Overrides:
        -
        endContour in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape(int mode)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape(). When endshape() - is called, all of image data defined since the previous call to - beginShape() is written into the image buffer. The constant CLOSE - as the value for the MODE parameter to close the shape (to connect the - beginning and the end). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        endShape in class PGraphics
        -
        Parameters:
        -
        mode - use CLOSE to close the shape
        -
        See Also:
        -
        PShape, -PGraphics.beginShape(int)
        -
        -
      • -
      - - - -
        -
      • -

        noClip

        -
        public void noClip()
        -
        -
        Overrides:
        -
        noClip 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)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves. Each call to - bezierVertex() defines the position of two control points and one - anchor point of a Bezier curve, adding a new segment to a line or shape. - The first time bezierVertex() is used within a - beginShape() call, it must be prefaced with a call to - vertex() to set the first anchor point. This function must be - used between beginShape() and endShape() and only when - there is no MODE parameter specified to beginShape(). Using the - 3D version requires rendering with P3D (see the Environment reference - for more information). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        bezierVertex in class PGraphics
        -
        Parameters:
        -
        x2 - the x-coordinate of the 1st control point
        -
        y2 - the y-coordinate of the 1st control point
        -
        z2 - the z-coordinate of the 1st control point
        -
        x3 - the x-coordinate of the 2nd control point
        -
        y3 - the y-coordinate of the 2nd control point
        -
        z3 - the z-coordinate of the 2nd control point
        -
        x4 - the x-coordinate of the anchor point
        -
        y4 - the y-coordinate of the anchor point
        -
        z4 - the z-coordinate of the anchor point
        -
        See Also:
        -
        PGraphics.curveVertex(float, float, float), -PGraphics.vertex(float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float x2,
        -                            float y2,
        -                            float z2,
        -                            float x4,
        -                            float y4,
        -                            float z4)
        -
        -
        Overrides:
        -
        quadraticVertex in class PGraphics
        -
        z2 - the z-coordinate of the control point
        -
        z4 - the z-coordinate of the anchor point
        -
        -
      • -
      - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
        -
        Overrides:
        -
        curveVertex in class PGraphics
        -
        z - the z-coordinate of the vertex
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel. The - first parameter is the horizontal value for the point, the second value - is the vertical value for the point, and the optional third value is the - depth value. Drawing this shape in 3D with the z parameter - requires the P3D parameter in combination with size() as shown in - the above example. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        point in class PGraphics
        -
        Parameters:
        -
        x - x-coordinate of the point
        -
        y - y-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen. The - version of line() with four parameters draws the line in 2D. To - color a line, use the stroke() function. A line cannot be filled, - therefore the fill() function will not affect the color of a - line. 2D lines are drawn with a width of one pixel by default, but this - can be changed with the strokeWeight() function. The version with - six parameters allows the line to be placed anywhere within XYZ space. - Drawing this shape in 3D with the z parameter requires the P3D - parameter in combination with size() as shown in the above example. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        line in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        See Also:
        -
        PGraphics.strokeWeight(float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int), -PGraphics.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        triangle

        -
        public void triangle(float x1,
        -                     float y1,
        -                     float x2,
        -                     float y2,
        -                     float x3,
        -                     float y3)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points. The first two - arguments specify the first point, the middle two arguments specify the - second point, and the last two arguments specify the third point. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        triangle in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        x3 - x-coordinate of the third point
        -
        y3 - y-coordinate of the third point
        -
        See Also:
        -
        PApplet.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        quad

        -
        public void quad(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2,
        -                 float x3,
        -                 float y3,
        -                 float x4,
        -                 float y4)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon. It is similar to a - rectangle, but the angles between its edges are not constrained to - ninety degrees. The first pair of parameters (x1,y1) sets the first - vertex and the subsequent pairs should proceed clockwise or - counter-clockwise around the defined shape. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        quad in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first corner
        -
        y1 - y-coordinate of the first corner
        -
        x2 - x-coordinate of the second corner
        -
        y2 - y-coordinate of the second corner
        -
        x3 - x-coordinate of the third corner
        -
        y3 - y-coordinate of the third corner
        -
        x4 - x-coordinate of the fourth corner
        -
        y4 - y-coordinate of the fourth corner
        -
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float w,
        -                float h,
        -                float d)
        -
        -
        Overrides:
        -
        box in class PGraphics
        -
        Parameters:
        -
        w - dimension of the box in the x-dimension
        -
        h - dimension of the box in the y-dimension
        -
        d - dimension of the box in the z-dimension
        -
        -
      • -
      - - - -
        -
      • -

        sphere

        -
        public void sphere(float r)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles. - - ( end auto-generated ) - -

        Advanced

        -

        - 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
        -
        Parameters:
        -
        r - the radius of the sphere
        -
        See Also:
        -
        PGraphics.sphereDetail(int)
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        popMatrix

        -
        public void popMatrix()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack. - Understanding pushing and popping requires understanding the concept of - a matrix stack. The pushMatrix() function saves the current - coordinate system to the stack and popMatrix() restores the prior - coordinate system. pushMatrix() and popMatrix() are used - in conjuction with the other transformation functions and may be - embedded to control the scope of the transformations. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        popMatrix in class PGraphics
        -
        See Also:
        -
        PGraphics.pushMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float tx,
        -                      float ty)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window. The - x parameter specifies left/right translation, the y - parameter specifies up/down translation, and the z parameter - specifies translations toward/away from the screen. Using this function - with the z parameter requires using P3D as a parameter in - combination with size as shown in the above example. Transformations - apply to everything that happens after and subsequent calls to the - function accumulates the effect. For example, calling translate(50, - 0) and then translate(20, 0) is the same as translate(70, - 0). If translate() is called within draw(), the - transformation is reset when the loop begins again. This function can be - further controlled by the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        translate in class PGraphics
        -
        Parameters:
        -
        tx - left/right translation
        -
        ty - up/down translation
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter. - Angles should be specified in radians (values from 0 to TWO_PI) or - converted to radians with the radians() function. -

        - Objects are always rotated around their relative position to the origin - and positive numbers rotate objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - rotate(HALF_PI) and then rotate(HALF_PI) is the same as - rotate(PI). All tranformations are reset when draw() - begins again. -

        - Technically, rotate() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotate in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateX(PI/2) and then rotateX(PI/2) is the same - as rotateX(PI). If rotateX() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the example above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateX in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateY(PI/2) and then rotateY(PI/2) is the same - as rotateY(PI). If rotateY() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateY in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateZ(PI/2) and then rotateZ(PI/2) is the same - as rotateZ(PI). If rotateZ() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateZ in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle,
        -                   float vx,
        -                   float vy,
        -                   float vz)
        -
        Description copied from class: PGraphics
        -

        Advanced

        - 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
        -
        ( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices. Objects always scale from their relative origin to the - coordinate system. Scale values are specified as decimal percentages. - For example, the function call scale(2.0) increases the dimension - of a shape by 200%. Transformations apply to everything that happens - after and subsequent calls to the function multiply the effect. For - example, calling scale(2.0) and then scale(1.5) is the - same as scale(3.0). If scale() is called within - draw(), the transformation is reset when the loop begins again. - Using this fuction with the z parameter requires using P3D as a - parameter for size() as shown in the example above. This function - can be further controlled by pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        scale in class PGraphics
        -
        Parameters:
        -
        s - percentage to scale the object
        -
        See Also:
        -
        PGraphics.pushMatrix(), -PGraphics.popMatrix(), -PGraphics.translate(float, float, float), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float)
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float sx,
        -                  float sy)
        -
        Description copied from class: PGraphics
        -

        Advanced

        - 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
        -
        Parameters:
        -
        sx - percentage to scale the object in the x-axis
        -
        sy - percentage to scale the object in the y-axis
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float sx,
        -                  float sy,
        -                  float sz)
        -
        -
        Overrides:
        -
        scale in class PGraphics
        -
        sz - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - -
        -
      • -

        shearX

        -
        public void shearX(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearX(PI/2) and then shearX(PI/2) is the same as - shearX(PI). If shearX() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearX() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shearX in class PGraphics
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        public void shearY(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearY(PI/2) and then shearY(PI/2) is the same as - shearY(PI). If shearY() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearY() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shearY in class PGraphics
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearX(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(float n00,
        -                        float n01,
        -                        float n02,
        -                        float n10,
        -                        float n11,
        -                        float n12)
        -
        -
        Overrides:
        -
        applyMatrix in class PGraphics
        -
        Parameters:
        -
        n00 - numbers which define the 4x4 matrix to be multiplied
        -
        n01 - numbers which define the 4x4 matrix to be multiplied
        -
        n02 - numbers which define the 4x4 matrix to be multiplied
        -
        n10 - numbers which define the 4x4 matrix to be multiplied
        -
        n11 - numbers which define the 4x4 matrix to be multiplied
        -
        n12 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Overrides:
        -
        applyMatrix in class PGraphics
        -
        n03 - numbers which define the 4x4 matrix to be multiplied
        -
        n13 - numbers which define the 4x4 matrix to be multiplied
        -
        n20 - numbers which define the 4x4 matrix to be multiplied
        -
        n21 - numbers which define the 4x4 matrix to be multiplied
        -
        n22 - numbers which define the 4x4 matrix to be multiplied
        -
        n23 - numbers which define the 4x4 matrix to be multiplied
        -
        n30 - numbers which define the 4x4 matrix to be multiplied
        -
        n31 - numbers which define the 4x4 matrix to be multiplied
        -
        n32 - numbers which define the 4x4 matrix to be multiplied
        -
        n33 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - - - - - -
        -
      • -

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

        screenX

        -
        public float screenX(float x,
        -                     float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenX in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenY(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenY in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenX in class PGraphics
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenY in class PGraphics
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenZ

        -
        public float screenZ(float x,
        -                     float y,
        -                     float z)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenZ in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenY(float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        strokeJoin

        -
        public void strokeJoin(int join)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments. These joints - are either mitered, beveled, or rounded and specified with the - corresponding parameters MITER, BEVEL, and ROUND. The default joint is - MITER. -

        - This function is not available with the P3D renderer, (see - Issue 123). More information about the renderers can be found in the - size() reference. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        strokeJoin in class PGraphics
        -
        Parameters:
        -
        join - either MITER, BEVEL, ROUND
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeWeight(float), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        strokeWeight

        -
        public void strokeWeight(float weight)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes. All widths are set in units of pixels. -

        - When drawing with P3D, series of connected lines (such as the stroke - around a polygon, triangle, or ellipse) produce unattractive results - when a thick stroke weight is set (see - Issue 123). With P3D, the minimum and maximum values for - strokeWeight() are controlled by the graphics card and the - operating system's OpenGL implementation. For instance, the thickness - may not go higher than 10 pixels. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        strokeWeight in class PGraphics
        -
        Parameters:
        -
        weight - the weight (in pixels) of the stroke
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

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

        loadPixels

        -
        public void loadPixels()
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_loadPixels.xml ) - - Loads the pixel data for the image into its pixels[] array. This - function must always be called before reading from or writing to pixels[]. -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. - - ( end auto-generated ) - -

        Advanced

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

        mask

        -
        public void mask(PImage alpha)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel. This mask image should only contain - grayscale data, but only the blue color channel is used. The mask image - needs to be the same size as the image to which it is applied.
        -
        - In addition to using a mask image, an integer array containing the alpha - channel data can be specified directly. This method is useful for - creating dynamically generated alpha masks. This array must be of the - same length as the target image's pixels array and should contain only - grayscale data of values between 0-255. - - ( end auto-generated ) - -

        Advanced

        - - 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" grayscale by - performing a proper luminance-based conversion.

        -
        -
        Overrides:
        -
        mask in class PImage
        -
        -
      • -
      - - - -
        -
      • -

        showTodoWarning

        -
        public static void showTodoWarning(String method,
        -                                   int issue)
        -
        Display a warning that the specified method is simply unavailable.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PGraphicsJava2D.html b/build/javadoc/everything/processing/core/PGraphicsJava2D.html deleted file mode 100644 index 53726778a9..0000000000 --- a/build/javadoc/everything/processing/core/PGraphicsJava2D.html +++ /dev/null @@ -1,3116 +0,0 @@ - - - - - -PGraphicsJava2D - - - - - - - - - - - -
-
processing.core
-

Class PGraphicsJava2D

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Cloneable, PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    PGraphicsDanger2D
    -
    -
    -
    -
    public class PGraphicsJava2D
    -extends PGraphics
    -
    Subclass for PGraphics that implements the graphics API using Java2D. -

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

    - Advanced debugging notes for Java2D.

    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - - - - - -
        -
      • -

        fillGradient

        -
        public boolean fillGradient
        -
      • -
      - - - -
        -
      • -

        fillGradientObject

        -
        public Paint fillGradientObject
        -
      • -
      - - - -
        -
      • -

        strokeGradient

        -
        public boolean strokeGradient
        -
      • -
      - - - -
        -
      • -

        strokeGradientObject

        -
        public Paint strokeGradientObject
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PGraphicsJava2D

        -
        public PGraphicsJava2D()
        -
      • -
      -
    • -
    - -
      -
    • - - -

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

        checkImage

        -
        public Graphics2D checkImage()
        -
      • -
      - - - -
        -
      • -

        beginDraw

        -
        public void beginDraw()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from PGraphics_beginDraw.xml ) - - Sets the default properties for a PGraphics object. It should be called - before anything is drawn into the object. - - ( end auto-generated ) -

        Advanced

        - 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
        -
        ( begin auto-generated from PGraphics_endDraw.xml ) - - Finalizes the rendering of a PGraphics object so that it can be shown on screen. - - ( end auto-generated ) -

        Advanced

        -

        - When creating your own PGraphics, you should call this when - you're finished drawing.

        -
        -
        Overrides:
        -
        endDraw in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        hint

        -
        public void hint(int which)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from hint.xml ) - - Set various hints and hacks for the renderer. This is used to handle - obscure rendering features that cannot be implemented in a consistent - manner across renderers. Many options will often graduate to standard - features instead of hints over time. -

        - hint(ENABLE_OPENGL_4X_SMOOTH) - Enable 4x anti-aliasing for P3D. This - can help force anti-aliasing if it has not been enabled by the user. On - some graphics cards, this can also be set by the graphics driver's - control panel, however not all cards make this available. This hint must - be called immediately after the size() command because it resets the - renderer, obliterating any settings and anything drawn (and like size(), - re-running the code that came before it again). -

        - hint(DISABLE_OPENGL_2X_SMOOTH) - In Processing 1.0, Processing always - enables 2x smoothing when the P3D renderer is used. This hint disables - the default 2x smoothing and returns the smoothing behavior found in - earlier releases, where smooth() and noSmooth() could be used to enable - and disable smoothing, though the quality was inferior. -

        - hint(ENABLE_NATIVE_FONTS) - Use the native version fonts when they are - installed, rather than the bitmapped version from a .vlw file. This is - useful with the default (or JAVA2D) renderer setting, as it will improve - font rendering speed. This is not enabled by default, because it can be - misleading while testing because the type will look great on your - machine (because you have the font installed) but lousy on others' - machines if the identical font is unavailable. This option can only be - set per-sketch, and must be called before any use of textFont(). -

        - hint(DISABLE_DEPTH_TEST) - Disable the zbuffer, allowing you to draw on - top of everything at will. When depth testing is disabled, items will be - drawn to the screen sequentially, like a painting. This hint is most - often used to draw in 3D, then draw in 2D on top of it (for instance, to - draw GUI controls in 2D on top of a 3D interface). Starting in release - 0149, this will also clear the depth buffer. Restore the default with - hint(ENABLE_DEPTH_TEST), but note that with the depth buffer cleared, - any 3D drawing that happens later in draw() will ignore existing shapes - on the screen. -

        - hint(ENABLE_DEPTH_SORT) - Enable primitive z-sorting of triangles and - lines in P3D and OPENGL. This can slow performance considerably, and the - algorithm is not yet perfect. Restore the default with hint(DISABLE_DEPTH_SORT). -

        - hint(DISABLE_OPENGL_ERROR_REPORT) - Speeds up the P3D renderer setting - by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT). -

        - As of release 0149, unhint() has been removed in favor of adding - additional ENABLE/DISABLE constants to reset the default behavior. This - prevents the double negatives, and also reinforces which hints can be - enabled or disabled. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        hint in class PGraphics
        -
        Parameters:
        -
        which - name of the hint to be enabled or disabled
        -
        See Also:
        -
        PGraphics, -PApplet.createGraphics(int, int, String, String), -PApplet.size(int, int)
        -
        -
      • -
      - - - -
        -
      • -

        beginShape

        -
        public void beginShape(int kind)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms. beginShape() begins recording - vertices for a shape and endShape() stops recording. The value of - the MODE parameter tells it which types of shapes to create from - the provided vertices. With no mode specified, the shape can be any - irregular polygon. The parameters available for beginShape() are POINTS, - LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, and QUAD_STRIP. - After calling the beginShape() function, a series of - vertex() commands must follow. To stop drawing the shape, call - endShape(). The vertex() function with two parameters - specifies a position in 2D and the vertex() function with three - parameters specifies a position in 3D. Each shape will be outlined with - the current stroke color and filled with the fill color. -

        - Transformations such as translate(), rotate(), and - scale() do not work within beginShape(). It is also not - possible to use other shapes, such as ellipse() or rect() - within beginShape(). -

        - The P3D renderer settings allow stroke() and fill() - settings to be altered per-vertex, however the default P2D renderer does - not. Settings such as strokeWeight(), strokeCap(), and - strokeJoin() cannot be changed while inside a - beginShape()/endShape() block with any renderer. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        beginShape in class PGraphics
        -
        Parameters:
        -
        kind - Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIP
        -
        See Also:
        -
        PShape, -PGraphics.endShape(), -PGraphics.vertex(float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        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[] v)
        -
        Description copied from class: PGraphics
        -
        Used by renderer subclasses or PShape to efficiently pass in already - formatted vertex information.
        -
        -
        Overrides:
        -
        vertex in class PGraphics
        -
        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)
        -
        -
        Overrides:
        -
        vertex in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float z,
        -                   float u,
        -                   float v)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices. - vertex() is used to specify the vertex coordinates for points, - lines, triangles, quads, and polygons and is used exclusively within the - beginShape() and endShape() function.
        -
        - Drawing a vertex in 3D using the z parameter requires the P3D - parameter in combination with size as shown in the above example.
        -
        - This function is also used to map a texture onto the geometry. The - texture() function declares the texture to apply to the geometry - and the u and v coordinates set define the mapping of this - texture to the form. By default, the coordinates used for u and - v are specified in relation to the image's size in pixels, but - this relation can be changed with textureMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        vertex in class PGraphics
        -
        Parameters:
        -
        x - x-coordinate of the vertex
        -
        y - y-coordinate of the vertex
        -
        z - z-coordinate of the vertex
        -
        u - horizontal coordinate for the texture mapping
        -
        v - vertical coordinate for the texture mapping
        -
        See Also:
        -
        PGraphics.beginShape(int), -PGraphics.endShape(int), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.texture(PImage)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        endContour

        -
        public void endContour()
        -
        -
        Overrides:
        -
        endContour in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape(int mode)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape(). When endshape() - is called, all of image data defined since the previous call to - beginShape() is written into the image buffer. The constant CLOSE - as the value for the MODE parameter to close the shape (to connect the - beginning and the end). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        endShape in class PGraphics
        -
        Parameters:
        -
        mode - use CLOSE to close the shape
        -
        See Also:
        -
        PShape, -PGraphics.beginShape(int)
        -
        -
      • -
      - - - -
        -
      • -

        noClip

        -
        public void noClip()
        -
        -
        Overrides:
        -
        noClip 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)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves. Each call to - bezierVertex() defines the position of two control points and one - anchor point of a Bezier curve, adding a new segment to a line or shape. - The first time bezierVertex() is used within a - beginShape() call, it must be prefaced with a call to - vertex() to set the first anchor point. This function must be - used between beginShape() and endShape() and only when - there is no MODE parameter specified to beginShape(). Using the - 3D version requires rendering with P3D (see the Environment reference - for more information). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        bezierVertex in class PGraphics
        -
        Parameters:
        -
        x2 - the x-coordinate of the 1st control point
        -
        y2 - the y-coordinate of the 1st control point
        -
        z2 - the z-coordinate of the 1st control point
        -
        x3 - the x-coordinate of the 2nd control point
        -
        y3 - the y-coordinate of the 2nd control point
        -
        z3 - the z-coordinate of the 2nd control point
        -
        x4 - the x-coordinate of the anchor point
        -
        y4 - the y-coordinate of the anchor point
        -
        z4 - the z-coordinate of the anchor point
        -
        See Also:
        -
        PGraphics.curveVertex(float, float, float), -PGraphics.vertex(float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float x2,
        -                            float y2,
        -                            float z2,
        -                            float x4,
        -                            float y4,
        -                            float z4)
        -
        -
        Overrides:
        -
        quadraticVertex in class PGraphics
        -
        z2 - the z-coordinate of the control point
        -
        z4 - the z-coordinate of the anchor point
        -
        -
      • -
      - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
        -
        Overrides:
        -
        curveVertex in class PGraphics
        -
        z - the z-coordinate of the vertex
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel. The - first parameter is the horizontal value for the point, the second value - is the vertical value for the point, and the optional third value is the - depth value. Drawing this shape in 3D with the z parameter - requires the P3D parameter in combination with size() as shown in - the above example. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        point in class PGraphics
        -
        Parameters:
        -
        x - x-coordinate of the point
        -
        y - y-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen. The - version of line() with four parameters draws the line in 2D. To - color a line, use the stroke() function. A line cannot be filled, - therefore the fill() function will not affect the color of a - line. 2D lines are drawn with a width of one pixel by default, but this - can be changed with the strokeWeight() function. The version with - six parameters allows the line to be placed anywhere within XYZ space. - Drawing this shape in 3D with the z parameter requires the P3D - parameter in combination with size() as shown in the above example. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        line in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        See Also:
        -
        PGraphics.strokeWeight(float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int), -PGraphics.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        triangle

        -
        public void triangle(float x1,
        -                     float y1,
        -                     float x2,
        -                     float y2,
        -                     float x3,
        -                     float y3)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points. The first two - arguments specify the first point, the middle two arguments specify the - second point, and the last two arguments specify the third point. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        triangle in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        x3 - x-coordinate of the third point
        -
        y3 - y-coordinate of the third point
        -
        See Also:
        -
        PApplet.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        quad

        -
        public void quad(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2,
        -                 float x3,
        -                 float y3,
        -                 float x4,
        -                 float y4)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon. It is similar to a - rectangle, but the angles between its edges are not constrained to - ninety degrees. The first pair of parameters (x1,y1) sets the first - vertex and the subsequent pairs should proceed clockwise or - counter-clockwise around the defined shape. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        quad in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first corner
        -
        y1 - y-coordinate of the first corner
        -
        x2 - x-coordinate of the second corner
        -
        y2 - y-coordinate of the second corner
        -
        x3 - x-coordinate of the third corner
        -
        y3 - y-coordinate of the third corner
        -
        x4 - x-coordinate of the fourth corner
        -
        y4 - y-coordinate of the fourth corner
        -
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float w,
        -                float h,
        -                float d)
        -
        -
        Overrides:
        -
        box in class PGraphics
        -
        Parameters:
        -
        w - dimension of the box in the x-dimension
        -
        h - dimension of the box in the y-dimension
        -
        d - dimension of the box in the z-dimension
        -
        -
      • -
      - - - -
        -
      • -

        sphere

        -
        public void sphere(float r)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles. - - ( end auto-generated ) - -

        Advanced

        -

        - 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
        -
        Parameters:
        -
        r - the radius of the sphere
        -
        See Also:
        -
        PGraphics.sphereDetail(int)
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        textAscent

        -
        public float textAscent()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size. This information - is useful for determining the height of the font above the baseline. For - example, adding the textAscent() and textDescent() values - will give you the total height of the line. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        textAscent in class PGraphics
        -
        See Also:
        -
        PGraphics.textDescent()
        -
        -
      • -
      - - - -
        -
      • -

        textDescent

        -
        public float textDescent()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size. This - information is useful for determining the height of the font below the - baseline. For example, adding the textAscent() and - textDescent() values will give you the total height of the line. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        textDescent in class PGraphics
        -
        See Also:
        -
        PGraphics.textAscent()
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getFontMetrics

        -
        public FontMetrics getFontMetrics(Font font)
        -
        Description copied from class: PGraphics
        -
        Convenience method to get a legit FontMetrics object. Where possible, - override this any renderer subclass so that you're not using what's - returned by getDefaultToolkit() to get your metrics.
        -
        -
        Overrides:
        -
        getFontMetrics in class PGraphics
        -
        -
      • -
      - - - - - - - -
        -
      • -

        popMatrix

        -
        public void popMatrix()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack. - Understanding pushing and popping requires understanding the concept of - a matrix stack. The pushMatrix() function saves the current - coordinate system to the stack and popMatrix() restores the prior - coordinate system. pushMatrix() and popMatrix() are used - in conjuction with the other transformation functions and may be - embedded to control the scope of the transformations. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        popMatrix in class PGraphics
        -
        See Also:
        -
        PGraphics.pushMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float tx,
        -                      float ty)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window. The - x parameter specifies left/right translation, the y - parameter specifies up/down translation, and the z parameter - specifies translations toward/away from the screen. Using this function - with the z parameter requires using P3D as a parameter in - combination with size as shown in the above example. Transformations - apply to everything that happens after and subsequent calls to the - function accumulates the effect. For example, calling translate(50, - 0) and then translate(20, 0) is the same as translate(70, - 0). If translate() is called within draw(), the - transformation is reset when the loop begins again. This function can be - further controlled by the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        translate in class PGraphics
        -
        Parameters:
        -
        tx - left/right translation
        -
        ty - up/down translation
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotate.xml ) - - Rotates a shape the amount specified by the angle parameter. - Angles should be specified in radians (values from 0 to TWO_PI) or - converted to radians with the radians() function. -

        - Objects are always rotated around their relative position to the origin - and positive numbers rotate objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - rotate(HALF_PI) and then rotate(HALF_PI) is the same as - rotate(PI). All tranformations are reset when draw() - begins again. -

        - Technically, rotate() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotate in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateX(PI/2) and then rotateX(PI/2) is the same - as rotateX(PI). If rotateX() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the example above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateX in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateY(PI/2) and then rotateY(PI/2) is the same - as rotateY(PI). If rotateY() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateY in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateZ(PI/2) and then rotateZ(PI/2) is the same - as rotateZ(PI). If rotateZ() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateZ in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle,
        -                   float vx,
        -                   float vy,
        -                   float vz)
        -
        Description copied from class: PGraphics
        -

        Advanced

        - 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
        -
        ( begin auto-generated from scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices. Objects always scale from their relative origin to the - coordinate system. Scale values are specified as decimal percentages. - For example, the function call scale(2.0) increases the dimension - of a shape by 200%. Transformations apply to everything that happens - after and subsequent calls to the function multiply the effect. For - example, calling scale(2.0) and then scale(1.5) is the - same as scale(3.0). If scale() is called within - draw(), the transformation is reset when the loop begins again. - Using this fuction with the z parameter requires using P3D as a - parameter for size() as shown in the example above. This function - can be further controlled by pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        scale in class PGraphics
        -
        Parameters:
        -
        s - percentage to scale the object
        -
        See Also:
        -
        PGraphics.pushMatrix(), -PGraphics.popMatrix(), -PGraphics.translate(float, float, float), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float)
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float sx,
        -                  float sy)
        -
        Description copied from class: PGraphics
        -

        Advanced

        - 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
        -
        Parameters:
        -
        sx - percentage to scale the object in the x-axis
        -
        sy - percentage to scale the object in the y-axis
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float sx,
        -                  float sy,
        -                  float sz)
        -
        -
        Overrides:
        -
        scale in class PGraphics
        -
        sz - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - -
        -
      • -

        shearX

        -
        public void shearX(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearX(PI/2) and then shearX(PI/2) is the same as - shearX(PI). If shearX() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearX() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shearX in class PGraphics
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        public void shearY(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearY(PI/2) and then shearY(PI/2) is the same as - shearY(PI). If shearY() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearY() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shearY in class PGraphics
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearX(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(float n00,
        -                        float n01,
        -                        float n02,
        -                        float n10,
        -                        float n11,
        -                        float n12)
        -
        -
        Overrides:
        -
        applyMatrix in class PGraphics
        -
        Parameters:
        -
        n00 - numbers which define the 4x4 matrix to be multiplied
        -
        n01 - numbers which define the 4x4 matrix to be multiplied
        -
        n02 - numbers which define the 4x4 matrix to be multiplied
        -
        n10 - numbers which define the 4x4 matrix to be multiplied
        -
        n11 - numbers which define the 4x4 matrix to be multiplied
        -
        n12 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Overrides:
        -
        applyMatrix in class PGraphics
        -
        n03 - numbers which define the 4x4 matrix to be multiplied
        -
        n13 - numbers which define the 4x4 matrix to be multiplied
        -
        n20 - numbers which define the 4x4 matrix to be multiplied
        -
        n21 - numbers which define the 4x4 matrix to be multiplied
        -
        n22 - numbers which define the 4x4 matrix to be multiplied
        -
        n23 - numbers which define the 4x4 matrix to be multiplied
        -
        n30 - numbers which define the 4x4 matrix to be multiplied
        -
        n31 - numbers which define the 4x4 matrix to be multiplied
        -
        n32 - numbers which define the 4x4 matrix to be multiplied
        -
        n33 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - - - - - -
        -
      • -

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

        screenX

        -
        public float screenX(float x,
        -                     float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenX in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenY(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenY in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenX in class PGraphics
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenY in class PGraphics
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenZ

        -
        public float screenZ(float x,
        -                     float y,
        -                     float z)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenZ in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenY(float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        strokeJoin

        -
        public void strokeJoin(int join)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments. These joints - are either mitered, beveled, or rounded and specified with the - corresponding parameters MITER, BEVEL, and ROUND. The default joint is - MITER. -

        - This function is not available with the P3D renderer, (see - Issue 123). More information about the renderers can be found in the - size() reference. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        strokeJoin in class PGraphics
        -
        Parameters:
        -
        join - either MITER, BEVEL, ROUND
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeWeight(float), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        strokeWeight

        -
        public void strokeWeight(float weight)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes. All widths are set in units of pixels. -

        - When drawing with P3D, series of connected lines (such as the stroke - around a polygon, triangle, or ellipse) produce unattractive results - when a thick stroke weight is set (see - Issue 123). With P3D, the minimum and maximum values for - strokeWeight() are controlled by the graphics card and the - operating system's OpenGL implementation. For instance, the thickness - may not go higher than 10 pixels. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        strokeWeight in class PGraphics
        -
        Parameters:
        -
        weight - the weight (in pixels) of the stroke
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        ( begin auto-generated from PImage_loadPixels.xml ) - - Loads the pixel data for the image into its pixels[] array. This - function must always be called before reading from or writing to pixels[]. -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. - - ( end auto-generated ) - -

        Advanced

        - 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(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
        -
        Parameters:
        -
        x - x-coordinate of the upper-left corner
        -
        y - y-coordinate of the upper-left corner
        -
        c - width
        -
        d - height
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get(int x,
        -               int y)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image. If no - parameters are specified, the entire image is returned. Use the x - and y parameters to get the value of one pixel. Get a section of - the display window by specifying an additional width and - height parameter. When getting an image, the x and - y parameters define the coordinates for the upper-left corner of - the image, regardless of the current imageMode().
        -
        - If the pixel requested is outside of the image window, black is - returned. The numbers returned are scaled according to the current color - ranges, but only RGB values are returned by this function. For example, - even though you may have drawn a shape with colorMode(HSB), the - numbers returned will be in RGB format.
        -
        - Getting the color of a single pixel with get(x, y) is easy, but - not as fast as grabbing the data directly from pixels[]. The - equivalent statement to get(x, y) using pixels[] is - pixels[y*width+x]. See the reference for pixels[] for more information. - - ( end auto-generated ) - -

        Advanced

        - 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
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        See Also:
        -
        PApplet.set(int, int, int), -PApplet.pixels, -PApplet.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public PImage get()
        -
        Description copied from class: PImage
        -
        Returns a copy of this PImage. Equivalent to get(0, 0, width, height). - Deprecated, just use copy() instead.
        -
        -
        Overrides:
        -
        get in class PImage
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                int argb)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
        -
        - The x and y parameters specify the pixel to change and the - color parameter specifies the color value. The color parameter is - affected by the current color mode (the default is RGB values from 0 to - 255). When setting an image, the x and y parameters define - the coordinates for the upper-left corner of the image, regardless of - the current imageMode(). -

        - Setting the color of a single pixel with set(x, y) is easy, but - not as fast as putting the data directly into pixels[]. The - equivalent statement to set(x, y, #000000) using pixels[] - is pixels[y*width+x] = #000000. See the reference for - pixels[] for more information. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        set in class PImage
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        argb - any value of the color datatype
        -
        See Also:
        -
        PImage.get(int, int, int, int), -PImage.pixels, -PImage.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        mask

        -
        public void mask(int[] alpha)
        -
        -
        Overrides:
        -
        mask in class PImage
        -
        -
      • -
      - - - -
        -
      • -

        mask

        -
        public void mask(PImage alpha)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel. This mask image should only contain - grayscale data, but only the blue color channel is used. The mask image - needs to be the same size as the image to which it is applied.
        -
        - In addition to using a mask image, an integer array containing the alpha - channel data can be specified directly. This method is useful for - creating dynamically generated alpha masks. This array must be of the - same length as the target image's pixels array and should contain only - grayscale data of values between 0-255. - - ( end auto-generated ) - -

        Advanced

        - - 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" grayscale by - performing a proper luminance-based conversion.

        -
        -
        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
        -
        ( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another. If the source and - destination regions aren't the same size, it will automatically resize - source pixels to fit the specified target region. No alpha information - is used in the process, however if the source image has an alpha channel - set, it will be copied as well. -

        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        copy in class PImage
        -
        Parameters:
        -
        sx - X coordinate of the source's upper left corner
        -
        sy - Y coordinate of the source's upper left corner
        -
        sw - source image width
        -
        sh - source image height
        -
        dx - X coordinate of the destination's upper left corner
        -
        dy - Y coordinate of the destination's upper left corner
        -
        dw - destination image width
        -
        dh - destination image height
        -
        See Also:
        -
        PGraphics.alpha(int), -PImage.blend(PImage, int, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(PImage src,
        -                 int sx,
        -                 int sy,
        -                 int sw,
        -                 int sh,
        -                 int dx,
        -                 int dy,
        -                 int dw,
        -                 int dh)
        -
        -
        Overrides:
        -
        copy in class PImage
        -
        Parameters:
        -
        src - an image variable referring to the source image.
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PImage.html b/build/javadoc/everything/processing/core/PImage.html deleted file mode 100644 index 8cd94547b8..0000000000 --- a/build/javadoc/everything/processing/core/PImage.html +++ /dev/null @@ -1,1786 +0,0 @@ - - - - - -PImage - - - - - - - - - - - -
-
processing.core
-

Class PImage

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Cloneable, PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    PGraphics
    -
    -
    -
    -
    public class PImage
    -extends Object
    -implements PConstants, Cloneable
    -
    ( begin auto-generated from PImage.xml ) - - Datatype for storing images. Processing can display .gif, - .jpg, .tga, and .png images. Images may be - displayed in 2D and 3D space. Before an image is used, it must be loaded - with the loadImage() function. The PImage class contains - fields for the width and height of the image, as well as - an array called pixels[] that contains the values for every pixel - in the image. The methods described below allow easy access to the - image's pixels and alpha channel and simplify the process of compositing.
    -
    using the pixels[] array, be sure to use the - loadPixels() method on the image to make sure that the pixel data - is properly loaded.
    -
    create a new image, use the createImage() function. Do not - use the syntax new PImage(). - - ( end auto-generated )
    -
    -
    See Also:
    -
    PApplet.loadImage(String), -PApplet.imageMode(int), -PApplet.createImage(int, int, int)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      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
        -
        ( begin auto-generated from pixels.xml ) - - Array containing the values for all the pixels in the display window. - These values are of the color datatype. This array is the size of the - display window. For example, if the image is 100x100 pixels, there will - be 10000 values and if the window is 200x300 pixels, there will be 60000 - values. The index value defines the position of a value within - the array. For example, the statement color b = pixels[230] will - set the variable b to be equal to the value at that location in - the array.
        -
        - Before accessing this array, the data must loaded with the - loadPixels() function. After the array data has been modified, - the updatePixels() function must be run to update the changes. - Without loadPixels(), running the code may (or will in future - releases) result in a NullPointerException. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        pixelDensity

        -
        public int pixelDensity
        -
        1 for most images, 2 for hi-dpi/retina
        -
      • -
      - - - -
        -
      • -

        pixelWidth

        -
        public int pixelWidth
        -
        Actual dimensions of pixels array, taking into account the 2x setting.
        -
      • -
      - - - -
        -
      • -

        pixelHeight

        -
        public int pixelHeight
        -
      • -
      - - - -
        -
      • -

        width

        -
        public int width
        -
        ( begin auto-generated from PImage_width.xml ) - - The width of the image in units of pixels. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        height

        -
        public int height
        -
        ( begin auto-generated from PImage_height.xml ) - - The height of the image in units of pixels. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        parent

        -
        public PApplet parent
        -
        Path to parent object that will be used with save(). - This prevents users from needing savePath() to use PImage.save().
        -
      • -
      - - - -
        -
      • -

        loaded

        -
        public boolean loaded
        -
        Loaded pixels flag
        -
      • -
      - - - - - - - - - - - - - - - - -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PImage

        -
        public PImage()
        -
        ( begin auto-generated from PImage.xml ) - - Datatype for storing images. Processing can display .gif, - .jpg, .tga, and .png images. Images may be - displayed in 2D and 3D space. Before an image is used, it must be loaded - with the loadImage() function. The PImage object contains - fields for the width and height of the image, as well as - an array called pixels[] which contains the values for every - pixel in the image. A group of methods, described below, allow easy - access to the image's pixels and alpha channel and simplify the process - of compositing. -

        - Before using the pixels[] array, be sure to use the - loadPixels() method on the image to make sure that the pixel data - is properly loaded. -

        - To create a new image, use the createImage() function (do not use - new PImage()). - ( end auto-generated )
        -
        -
        See Also:
        -
        PApplet.loadImage(String, String), -PApplet.imageMode(int), -PApplet.createImage(int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        PImage

        -
        public PImage(int width,
        -              int height)
        -
        -
        Parameters:
        -
        width - image width
        -
        height - image height
        -
        -
      • -
      - - - -
        -
      • -

        PImage

        -
        public PImage(int width,
        -              int height,
        -              int format)
        -
        -
        Parameters:
        -
        format - Either RGB, ARGB, ALPHA (grayscale alpha channel)
        -
        -
      • -
      - - - -
        -
      • -

        PImage

        -
        public PImage(int width,
        -              int height,
        -              int format,
        -              int factor)
        -
      • -
      - - - -
        -
      • -

        PImage

        -
        public PImage(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.
        -
        -
        Parameters:
        -
        img - assumes a MediaTracker has been used to fully download - the data and the img is valid
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        init

        -
        public void init(int width,
        -                 int height,
        -                 int format)
        -
        Do not remove, see notes in the other variant.
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init(int width,
        -                 int height,
        -                 int format,
        -                 int factor)
        -
        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

        -
        @Deprecated
        -public Image getImage()
        -
        Deprecated. 
        -
        Use the getNative() method instead, which allows library interfaces to be - written in a cross-platform fashion for desktop, Android, and others.
        -
      • -
      - - - -
        -
      • -

        getNative

        -
        public Object getNative()
        -
        Returns a native BufferedImage from this PImage.
        -
      • -
      - - - -
        -
      • -

        isModified

        -
        public boolean isModified()
        -
      • -
      - - - -
        -
      • -

        setModified

        -
        public void setModified()
        -
      • -
      - - - -
        -
      • -

        setModified

        -
        public void setModified(boolean m)
        -
      • -
      - - - -
        -
      • -

        getModifiedX1

        -
        public int getModifiedX1()
        -
      • -
      - - - -
        -
      • -

        getModifiedX2

        -
        public int getModifiedX2()
        -
      • -
      - - - -
        -
      • -

        getModifiedY1

        -
        public int getModifiedY1()
        -
      • -
      - - - -
        -
      • -

        getModifiedY2

        -
        public int getModifiedY2()
        -
      • -
      - - - -
        -
      • -

        loadPixels

        -
        public void loadPixels()
        -
        ( begin auto-generated from PImage_loadPixels.xml ) - - Loads the pixel data for the image into its pixels[] array. This - function must always be called before reading from or writing to pixels[]. -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. - - ( end auto-generated ) - -

        Advanced

        - 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()
        -
      • -
      - - - -
        -
      • -

        updatePixels

        -
        public void updatePixels(int x,
        -                         int y,
        -                         int w,
        -                         int h)
        -
        ( begin auto-generated from PImage_updatePixels.xml ) - - Updates the image with the data in its pixels[] array. Use in - conjunction with loadPixels(). If you're only reading pixels from - the array, there's no need to call updatePixels(). -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. -

        - Currently, none of the renderers use the additional parameters to - updatePixels(), however this may be implemented in the future. - - ( end auto-generated ) -

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        x - x-coordinate of the upper-left corner
        -
        y - y-coordinate of the upper-left corner
        -
        w - width
        -
        h - height
        -
        -
      • -
      - - - -
        -
      • -

        clone

        -
        public Object clone()
        -             throws 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 Object
        -
        Throws:
        -
        CloneNotSupportedException
        -
        -
      • -
      - - - -
        -
      • -

        resize

        -
        public void resize(int w,
        -                   int h)
        -
        ( begin auto-generated from PImage_resize.xml ) - - Resize the image to a new width and height. To make the image scale - proportionally, use 0 as the value for the wide or high - parameter. For instance, to make the width of an image 150 pixels, and - change the height using the same proportion, use resize(150, 0).
        -
        - Even though a PGraphics is technically a PImage, it is not possible to - rescale the image data found in a PGraphics. (It's simply not possible - to do this consistently across renderers: technically infeasible with - P3D, or what would it even do with PDF?) If you want to resize PGraphics - content, first get a copy of its image data using the get() - method, and call resize() on the PImage that is returned. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        w - the resized image width
        -
        h - the resized image height
        -
        See Also:
        -
        get(int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        isLoaded

        -
        public boolean isLoaded()
        -
      • -
      - - - -
        -
      • -

        setLoaded

        -
        public void setLoaded()
        -
      • -
      - - - -
        -
      • -

        setLoaded

        -
        public void setLoaded(boolean l)
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get(int x,
        -               int y)
        -
        ( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image. If no - parameters are specified, the entire image is returned. Use the x - and y parameters to get the value of one pixel. Get a section of - the display window by specifying an additional width and - height parameter. When getting an image, the x and - y parameters define the coordinates for the upper-left corner of - the image, regardless of the current imageMode().
        -
        - If the pixel requested is outside of the image window, black is - returned. The numbers returned are scaled according to the current color - ranges, but only RGB values are returned by this function. For example, - even though you may have drawn a shape with colorMode(HSB), the - numbers returned will be in RGB format.
        -
        - Getting the color of a single pixel with get(x, y) is easy, but - not as fast as grabbing the data directly from pixels[]. The - equivalent statement to get(x, y) using pixels[] is - pixels[y*width+x]. See the reference for pixels[] for more information. - - ( end auto-generated ) - -

        Advanced

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

        -
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        See Also:
        -
        PApplet.set(int, int, int), -PApplet.pixels, -PApplet.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public PImage get(int x,
        -                  int y,
        -                  int w,
        -                  int h)
        -
        -
        Parameters:
        -
        w - width of pixel rectangle to get
        -
        h - height of pixel rectangle to get
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public PImage get()
        -
        Returns a copy of this PImage. Equivalent to get(0, 0, width, height). - Deprecated, just use copy() instead.
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public PImage copy()
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                int c)
        -
        ( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
        -
        - The x and y parameters specify the pixel to change and the - color parameter specifies the color value. The color parameter is - affected by the current color mode (the default is RGB values from 0 to - 255). When setting an image, the x and y parameters define - the coordinates for the upper-left corner of the image, regardless of - the current imageMode(). -

        - Setting the color of a single pixel with set(x, y) is easy, but - not as fast as putting the data directly into pixels[]. The - equivalent statement to set(x, y, #000000) using pixels[] - is pixels[y*width+x] = #000000. See the reference for - pixels[] for more information. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        c - any value of the color datatype
        -
        See Also:
        -
        get(int, int, int, int), -pixels, -copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                PImage img)
        -

        Advanced

        - 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.
        -
        -
        Parameters:
        -
        img - image to copy into the original image
        -
        -
      • -
      - - - -
        -
      • -

        mask

        -
        @Deprecated
        -public void mask(int[] maskArray)
        -
        Deprecated. 
        -
      • -
      - - - -
        -
      • -

        mask

        -
        public void mask(PImage img)
        -
        ( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel. This mask image should only contain - grayscale data, but only the blue color channel is used. The mask image - needs to be the same size as the image to which it is applied.
        -
        - In addition to using a mask image, an integer array containing the alpha - channel data can be specified directly. This method is useful for - creating dynamically generated alpha masks. This array must be of the - same length as the target image's pixels array and should contain only - grayscale data of values between 0-255. - - ( end auto-generated ) - -

        Advanced

        - - 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" grayscale by - performing a proper luminance-based conversion.

        -
        -
        Parameters:
        -
        maskArray - array of integers used as the alpha channel, needs to be the same length as the image's pixel array
        -
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(int kind)
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(int kind,
        -                   float param)
        -
        ( begin auto-generated from PImage_filter.xml ) - - Filters an image as defined by one of the following modes:

        THRESHOLD - converts the image to black and white pixels depending if - they are above or below the threshold defined by the level parameter. - The level must be between 0.0 (black) and 1.0(white). If no level is - specified, 0.5 is used.
        -
        - GRAY - converts any colors in the image to grayscale equivalents
        -
        - INVERT - sets each pixel to its inverse value
        -
        - POSTERIZE - limits each channel of the image to the number of colors - specified as the level parameter
        -
        - BLUR - executes a Guassian blur with the level parameter specifying the - extent of the blurring. If no level parameter is used, the blur is - equivalent to Guassian blur of radius 1
        -
        - OPAQUE - sets the alpha channel to entirely opaque
        -
        - ERODE - reduces the light areas with the amount defined by the level - parameter
        -
        - DILATE - increases the light areas with the amount defined by the level parameter - - ( end auto-generated ) - -

        Advanced

        - 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

        -
        -
        Parameters:
        -
        kind - Either THRESHOLD, GRAY, OPAQUE, INVERT, POSTERIZE, BLUR, ERODE, or DILATE
        -
        param - unique for each, see above
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(int sx,
        -                 int sy,
        -                 int sw,
        -                 int sh,
        -                 int dx,
        -                 int dy,
        -                 int dw,
        -                 int dh)
        -
        ( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another. If the source and - destination regions aren't the same size, it will automatically resize - source pixels to fit the specified target region. No alpha information - is used in the process, however if the source image has an alpha channel - set, it will be copied as well. -

        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        sx - X coordinate of the source's upper left corner
        -
        sy - Y coordinate of the source's upper left corner
        -
        sw - source image width
        -
        sh - source image height
        -
        dx - X coordinate of the destination's upper left corner
        -
        dy - Y coordinate of the destination's upper left corner
        -
        dw - destination image width
        -
        dh - destination image height
        -
        See Also:
        -
        PGraphics.alpha(int), -blend(PImage, int, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(PImage src,
        -                 int sx,
        -                 int sy,
        -                 int sw,
        -                 int sh,
        -                 int dx,
        -                 int dy,
        -                 int dw,
        -                 int dh)
        -
        -
        Parameters:
        -
        src - an image variable referring to the source image.
        -
        -
      • -
      - - - -
        -
      • -

        blendColor

        -
        public static int blendColor(int c1,
        -                             int c2,
        -                             int mode)
        -
        ( begin auto-generated from blendColor.xml ) - - Blends two color values together based on the blending mode given as the - MODE parameter. The possible modes are described in the reference - for the blend() function. - - ( end auto-generated ) -

        Advanced

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

        -
        -
        Parameters:
        -
        c1 - the first color to blend
        -
        c2 - the second color to blend
        -
        mode - either BLEND, ADD, SUBTRACT, DARKEST, LIGHTEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, or BURN
        -
        See Also:
        -
        blend(PImage, int, int, int, int, int, int, int, int, int), -PApplet.color(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        ( begin auto-generated from PImage_blend.xml ) - - Blends a region of pixels into the image specified by the img - parameter. These copies utilize full alpha channel support and a choice - of the following modes to blend the colors of source pixels (A) with the - ones of pixels in the destination image (B):
        -
        - BLEND - linear interpolation of colours: C = A*factor + B
        -
        - ADD - additive blending with white clip: C = min(A*factor + B, 255)
        -
        - SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, - 0)
        -
        - DARKEST - only the darkest colour succeeds: C = min(A*factor, B)
        -
        - LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)
        -
        - 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.
        -
        - All modes use the alpha information (highest byte) of source image - pixels as the blending factor. If the source and destination regions are - different sizes, the image will be automatically resized to match the - destination size. If the srcImg parameter is not used, the - display window is used as the source image.
        -
        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        src - an image variable referring to the source image
        -
        sx - X coordinate of the source's upper left corner
        -
        sy - Y coordinate of the source's upper left corner
        -
        sw - source image width
        -
        sh - source image height
        -
        dx - X coordinate of the destinations's upper left corner
        -
        dy - Y coordinate of the destinations's upper left corner
        -
        dw - destination image width
        -
        dh - destination image height
        -
        mode - Either BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN
        -
        See Also:
        -
        PApplet.alpha(int), -copy(PImage, int, int, int, int, int, int, int, int), -blendColor(int,int,int)
        -
        -
      • -
      - - - -
        -
      • -

        save

        -
        public boolean save(String filename)
        -
        ( begin auto-generated from PImage_save.xml ) - - Saves the image into a file. Images are saved in TIFF, TARGA, JPEG, and - PNG format depending on the extension within the filename - parameter. For example, "image.tif" will have a TIFF image and - "image.png" will save a PNG image. If no extension is included in the - filename, the image will save in TIFF format and .tif will be - added to the name. These files are saved to the sketch's folder, which - may be opened by selecting "Show sketch folder" from the "Sketch" menu. - It is not possible to use save() while running the program in a - web browser.

        To save an image created within the code, rather - than through loading, it's necessary to make the image with the - createImage() function so it is aware of the location of the - program and can therefore save the file to the right place. See the - createImage() reference for more information. - - ( end auto-generated ) -

        Advanced

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

        -
        -
        Parameters:
        -
        filename - a sequence of letters and numbers
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PMatrix.html b/build/javadoc/everything/processing/core/PMatrix.html deleted file mode 100644 index 130d92602f..0000000000 --- a/build/javadoc/everything/processing/core/PMatrix.html +++ /dev/null @@ -1,826 +0,0 @@ - - - - - -PMatrix - - - - - - - - - - - -
-
processing.core
-

Interface PMatrix

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    PMatrix2D, PMatrix3D
    -
    -
    -
    -
    public interface PMatrix
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      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(PMatrix left) -
      Apply another matrix to the left of this one.
      -
      voidpreApply(PMatrix2D left) 
      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) 
      voidshearX(float angle) 
      voidshearY(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)
        -
      • -
      - - - -
        -
      • -

        shearX

        -
        void shearX(float angle)
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        void shearY(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(PMatrix left)
        -
        Apply another matrix to the left of this one.
        -
      • -
      - - - -
        -
      • -

        preApply

        -
        void preApply(PMatrix2D left)
        -
      • -
      - - - -
        -
      • -

        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

        -
        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 deleted file mode 100644 index 115987fbe6..0000000000 --- a/build/javadoc/everything/processing/core/PMatrix2D.html +++ /dev/null @@ -1,1204 +0,0 @@ - - - - - -PMatrix2D - - - - - - - - - - - -
-
processing.core
-

Class PMatrix2D

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PMatrix
    -
    -
    -
    -
    public class PMatrix2D
    -extends Object
    -implements PMatrix
    -
    3x2 affine matrix implementation.
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      floatm00 
      floatm01 
      floatm02 
      floatm10 
      floatm11 
      floatm12 
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      Constructor and Description
      PMatrix2D() 
      PMatrix2D(float m00, - float m01, - float m02, - float m10, - float m11, - float m12) 
      PMatrix2D(PMatrix matrix) 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      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(PMatrix source) -
      Apply another matrix to the left of this one.
      -
      voidpreApply(PMatrix2D left) 
      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) 
      voidshearX(float angle) 
      voidshearY(float angle) 
      voidtranslate(float tx, - float ty) 
      voidtranslate(float x, - float y, - float z) 
      voidtranspose() -
      Transpose this matrix.
      -
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

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

        shearX

        -
        public void shearX(float angle)
        -
        -
        Specified by:
        -
        shearX in interface PMatrix
        -
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        public void shearY(float angle)
        -
        -
        Specified by:
        -
        shearY 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(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(PMatrix source)
        -
        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)
        -
        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 deleted file mode 100644 index cf1204b211..0000000000 --- a/build/javadoc/everything/processing/core/PMatrix3D.html +++ /dev/null @@ -1,1507 +0,0 @@ - - - - - -PMatrix3D - - - - - - - - - - - -
-
processing.core
-

Class PMatrix3D

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PMatrix
    -
    -
    -
    -
    public final class PMatrix3D
    -extends Object
    -implements PMatrix
    -
    4x4 matrix implementation.
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      floatm00 
      floatm01 
      floatm02 
      floatm03 
      floatm10 
      floatm11 
      floatm12 
      floatm13 
      floatm20 
      floatm21 
      floatm22 
      floatm23 
      floatm30 
      floatm31 
      floatm32 
      floatm33 
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - -
      Constructors 
      Constructor and Description
      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

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      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(PMatrix source) -
      Apply another matrix to the left of this one.
      -
      voidpreApply(PMatrix2D left) 
      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) 
      voidshearX(float angle) 
      voidshearY(float angle) 
      voidtranslate(float tx, - float ty) 
      voidtranslate(float tx, - float ty, - float tz) 
      voidtranspose() -
      Transpose this matrix.
      -
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

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

        shearX

        -
        public void shearX(float angle)
        -
        -
        Specified by:
        -
        shearX in interface PMatrix
        -
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        public void shearY(float angle)
        -
        -
        Specified by:
        -
        shearY 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(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(PMatrix source)
        -
        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/PShape.html b/build/javadoc/everything/processing/core/PShape.html deleted file mode 100644 index bf1324dc14..0000000000 --- a/build/javadoc/everything/processing/core/PShape.html +++ /dev/null @@ -1,3557 +0,0 @@ - - - - - -PShape - - - - - - - - - - - -
-
processing.core
-

Class PShape

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    PShapeOBJ, PShapeOpenGL, PShapeSVG
    -
    -
    -
    -
    public class PShape
    -extends Object
    -implements PConstants
    -
    ( begin auto-generated from PShape.xml ) - - Datatype for storing shapes. Processing can currently load and display - SVG (Scalable Vector Graphics) shapes. Before a shape is used, it must - be loaded with the loadShape() function. The shape() - function is used to draw the shape to the display window. The - PShape object contain a group of methods, linked below, that can - operate on the shape data. -

    - The loadShape() function supports SVG files created with Inkscape - and Adobe Illustrator. It is not a full SVG implementation, but offers - some straightforward support for handling vector data. - - ( end auto-generated ) -

    Advanced

    - - 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().

    -
    -
    See Also:
    -
    PApplet.loadShape(String), -PApplet.createShape(), -PApplet.shapeMode(int)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        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
        -
        ( begin auto-generated from PShape_width.xml ) - - The width of the PShape document. - - ( end auto-generated )
        -
        -
        See Also:
        -
        height
        -
        -
      • -
      - - - -
        -
      • -

        height

        -
        public float height
        -
        ( begin auto-generated from PShape_height.xml ) - - The height of the PShape document. - - ( end auto-generated )
        -
        -
        See Also:
        -
        width
        -
        -
      • -
      - - - -
        -
      • -

        depth

        -
        public float depth
        -
      • -
      - - - -
        -
      • -

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

      Constructor Detail

      - - - -
        -
      • -

        PShape

        -
        public PShape()
        -
      • -
      - - - -
        -
      • -

        PShape

        -
        public PShape(int family)
        -
      • -
      - - - -
        -
      • -

        PShape

        -
        public PShape(PGraphics g,
        -              int family)
        -
      • -
      - - - -
        -
      • -

        PShape

        -
        public PShape(PGraphics g,
        -              int kind,
        -              float... params)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setFamily

        -
        public void setFamily(int family)
        -
      • -
      - - - -
        -
      • -

        setKind

        -
        public void setKind(int kind)
        -
      • -
      - - - -
        -
      • -

        setName

        -
        public void setName(String name)
        -
      • -
      - - - -
        -
      • -

        getName

        -
        public String getName()
        -
      • -
      - - - -
        -
      • -

        isVisible

        -
        public boolean isVisible()
        -
        ( begin auto-generated from PShape_isVisible.xml ) - - Returns a boolean value "true" if the image is set to be visible, - "false" if not. This is modified with the setVisible() parameter. -

        - The visibility of a shape is usually controlled by whatever program - created the SVG file. For instance, this parameter is controlled by - showing or hiding the shape in the layers palette in Adobe Illustrator. - - ( end auto-generated )
        -
        -
        See Also:
        -
        setVisible(boolean)
        -
        -
      • -
      - - - -
        -
      • -

        setVisible

        -
        public void setVisible(boolean visible)
        -
        ( begin auto-generated from PShape_setVisible.xml ) - - Sets the shape to be visible or invisible. This is determined by the - value of the visible parameter. -

        - The visibility of a shape is usually controlled by whatever program - created the SVG file. For instance, this parameter is controlled by - showing or hiding the shape in the layers palette in Adobe Illustrator. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        visible - "false" makes the shape invisible and "true" makes it visible
        -
        See Also:
        -
        isVisible()
        -
        -
      • -
      - - - -
        -
      • -

        disableStyle

        -
        public void disableStyle()
        -
        ( begin auto-generated from PShape_disableStyle.xml ) - - Disables the shape's style data and uses Processing's current styles. - Styles include attributes such as colors, stroke weight, and stroke - joints. - - ( end auto-generated ) -

        Advanced

        - Overrides this shape's style information and uses PGraphics styles and - colors. Identical to ignoreStyles(true). Also disables styles for all - child shapes.
        -
        -
        See Also:
        -
        enableStyle()
        -
        -
      • -
      - - - -
        -
      • -

        enableStyle

        -
        public void enableStyle()
        -
        ( begin auto-generated from PShape_enableStyle.xml ) - - Enables the shape's style data and ignores Processing's current styles. - Styles include attributes such as colors, stroke weight, and stroke - joints. - - ( end auto-generated )
        -
        -
        See Also:
        -
        disableStyle()
        -
        -
      • -
      - - - -
        -
      • -

        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).
        -
      • -
      - - - -
        -
      • -

        getDepth

        -
        public float getDepth()
        -
        Get the depth of the shape area (not necessarily the shape boundary). Only makes sense for 3D PShape subclasses, - such as PShape3D.
        -
      • -
      - - - -
        -
      • -

        is2D

        -
        public boolean is2D()
        -
        Return true if this shape is 2D. Defaults to true.
        -
      • -
      - - - -
        -
      • -

        is3D

        -
        public boolean is3D()
        -
        Return true if this shape is 3D. Defaults to false.
        -
      • -
      - - - -
        -
      • -

        set3D

        -
        public void set3D(boolean val)
        -
      • -
      - - - -
        -
      • -

        textureMode

        -
        public void textureMode(int mode)
        -
      • -
      - - - -
        -
      • -

        texture

        -
        public void texture(PImage tex)
        -
      • -
      - - - -
        -
      • -

        noTexture

        -
        public void noTexture()
        -
      • -
      - - - -
        -
      • -

        beginContour

        -
        public void beginContour()
        -
        -
        See Also:
        -
        endContour()
        -
        -
      • -
      - - - -
        -
      • -

        endContour

        -
        public void endContour()
        -
        -
        See Also:
        -
        beginContour()
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y)
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float u,
        -                   float v)
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float z)
        -
      • -
      - - - -
        -
      • -

        vertex

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

        normal

        -
        public void normal(float nx,
        -                   float ny,
        -                   float nz)
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   float... values)
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   int... values)
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   boolean... values)
        -
      • -
      - - - - - - - -
        -
      • -

        beginShape

        -
        public void beginShape(int kind)
        -
      • -
      - - - - - - - -
        -
      • -

        endShape

        -
        public void endShape(int mode)
        -
      • -
      - - - -
        -
      • -

        strokeWeight

        -
        public void strokeWeight(float weight)
        -
      • -
      - - - -
        -
      • -

        strokeJoin

        -
        public void strokeJoin(int join)
        -
      • -
      - - - -
        -
      • -

        strokeCap

        -
        public void strokeCap(int cap)
        -
      • -
      - - - -
        -
      • -

        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)
        -
      • -
      - - - -
        -
      • -

        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 alpha)
        -
      • -
      - - - -
        -
      • -

        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 alpha)
        -
      • -
      - - - -
        -
      • -

        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)
        -
      • -
      - - - -
        -
      • -

        emissive

        -
        public void emissive(int rgb)
        -
      • -
      - - - -
        -
      • -

        emissive

        -
        public void emissive(float gray)
        -
      • -
      - - - -
        -
      • -

        emissive

        -
        public void emissive(float x,
        -                     float y,
        -                     float z)
        -
      • -
      - - - -
        -
      • -

        shininess

        -
        public void shininess(float shine)
        -
      • -
      - - - -
        -
      • -

        bezierDetail

        -
        public void bezierDetail(int detail)
        -
      • -
      - - - -
        -
      • -

        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)
        -
      • -
      - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float cx,
        -                            float cy,
        -                            float x3,
        -                            float y3)
        -
      • -
      - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float cx,
        -                            float cy,
        -                            float cz,
        -                            float x3,
        -                            float y3,
        -                            float z3)
        -
      • -
      - - - -
        -
      • -

        curveDetail

        -
        public void curveDetail(int detail)
        -
      • -
      - - - -
        -
      • -

        curveTightness

        -
        public void curveTightness(float tightness)
        -
      • -
      - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y)
        -
      • -
      - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
      • -
      - - - -
        -
      • -

        draw

        -
        public void draw(PGraphics g)
        -
        Called by the following (the shape() command adds the g) - PShape s = loadShape("blah.svg"); - shape(s);
        -
      • -
      - - - -
        -
      • -

        getParent

        -
        public PShape getParent()
        -
      • -
      - - - -
        -
      • -

        getChildCount

        -
        public int getChildCount()
        -
      • -
      - - - -
        -
      • -

        getChildren

        -
        public PShape[] getChildren()
        -
      • -
      - - - -
        -
      • -

        getChild

        -
        public PShape getChild(int index)
        -
        ( begin auto-generated from PShape_getChild.xml ) - - Extracts a child shape from a parent shape. Specify the name of the - shape with the target parameter. The shape is returned as a - PShape object, or null is returned if there is an error. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        index - the layer position of the shape to get
        -
        See Also:
        -
        addChild(PShape)
        -
        -
      • -
      - - - -
        -
      • -

        getChild

        -
        public PShape getChild(String target)
        -
        -
        Parameters:
        -
        target - the name of the shape to get
        -
        -
      • -
      - - - -
        -
      • -

        findChild

        -
        public PShape findChild(String target)
        -
        Same as getChild(name), except that it first walks all the way up the - hierarchy to the eldest grandparent, so that children can be found anywhere.
        -
      • -
      - - - -
        -
      • -

        addChild

        -
        public void addChild(PShape who)
        -
        -
        Parameters:
        -
        who - any variable of type PShape
        -
        See Also:
        -
        getChild(int)
        -
        -
      • -
      - - - -
        -
      • -

        addChild

        -
        public void addChild(PShape who,
        -                     int idx)
        -
        -
        Parameters:
        -
        idx - the layer position in which to insert the new child
        -
        -
      • -
      - - - -
        -
      • -

        removeChild

        -
        public void removeChild(int idx)
        -
        Remove the child shape with index idx.
        -
      • -
      - - - -
        -
      • -

        addName

        -
        public void addName(String nom,
        -                    PShape shape)
        -
        Add a shape to the name lookup table.
        -
      • -
      - - - -
        -
      • -

        getChildIndex

        -
        public int getChildIndex(PShape who)
        -
        Returns the index of child who.
        -
      • -
      - - - -
        -
      • -

        getTessellation

        -
        public PShape getTessellation()
        -
      • -
      - - - -
        -
      • -

        getFamily

        -
        public int getFamily()
        -
        The shape type, one of GROUP, PRIMITIVE, PATH, or GEOMETRY.
        -
      • -
      - - - -
        -
      • -

        getKind

        -
        public int getKind()
        -
      • -
      - - - -
        -
      • -

        getParams

        -
        public float[] getParams()
        -
      • -
      - - - -
        -
      • -

        getParams

        -
        public float[] getParams(float[] target)
        -
      • -
      - - - -
        -
      • -

        getParam

        -
        public float getParam(int index)
        -
      • -
      - - - -
        -
      • -

        setPath

        -
        public void setPath(int vcount,
        -                    float[][] verts)
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getVertex

        -
        public PVector getVertex(int index,
        -                         PVector vec)
        -
        -
        Parameters:
        -
        vec - PVector to assign the data to
        -
        -
      • -
      - - - -
        -
      • -

        getVertexX

        -
        public float getVertexX(int index)
        -
      • -
      - - - -
        -
      • -

        getVertexY

        -
        public float getVertexY(int index)
        -
      • -
      - - - -
        -
      • -

        getVertexZ

        -
        public float getVertexZ(int index)
        -
      • -
      - - - -
        -
      • -

        setVertex

        -
        public void setVertex(int index,
        -                      float x,
        -                      float y)
        -
        -
        Parameters:
        -
        index - the location of the vertex
        -
        x - the x value for the vertex
        -
        y - the y value for the vertex
        -
        See Also:
        -
        getVertex(int), -getVertexCount()
        -
        -
      • -
      - - - -
        -
      • -

        setVertex

        -
        public void setVertex(int index,
        -                      float x,
        -                      float y,
        -                      float z)
        -
        -
        Parameters:
        -
        z - the z value for the vertex
        -
        -
      • -
      - - - -
        -
      • -

        setVertex

        -
        public void setVertex(int index,
        -                      PVector vec)
        -
        -
        Parameters:
        -
        vec - the PVector to define the x, y, z coordinates
        -
        -
      • -
      - - - -
        -
      • -

        getNormal

        -
        public PVector getNormal(int index)
        -
      • -
      - - - -
        -
      • -

        getNormal

        -
        public PVector getNormal(int index,
        -                         PVector vec)
        -
      • -
      - - - -
        -
      • -

        getNormalX

        -
        public float getNormalX(int index)
        -
      • -
      - - - -
        -
      • -

        getNormalY

        -
        public float getNormalY(int index)
        -
      • -
      - - - -
        -
      • -

        getNormalZ

        -
        public float getNormalZ(int index)
        -
      • -
      - - - -
        -
      • -

        setNormal

        -
        public void setNormal(int index,
        -                      float nx,
        -                      float ny,
        -                      float nz)
        -
      • -
      - - - -
        -
      • -

        setAttrib

        -
        public void setAttrib(String name,
        -                      int index,
        -                      float... values)
        -
      • -
      - - - -
        -
      • -

        setAttrib

        -
        public void setAttrib(String name,
        -                      int index,
        -                      int... values)
        -
      • -
      - - - -
        -
      • -

        setAttrib

        -
        public void setAttrib(String name,
        -                      int index,
        -                      boolean... values)
        -
      • -
      - - - -
        -
      • -

        getTextureU

        -
        public float getTextureU(int index)
        -
      • -
      - - - -
        -
      • -

        getTextureV

        -
        public float getTextureV(int index)
        -
      • -
      - - - -
        -
      • -

        setTextureUV

        -
        public void setTextureUV(int index,
        -                         float u,
        -                         float v)
        -
      • -
      - - - -
        -
      • -

        setTextureMode

        -
        public void setTextureMode(int mode)
        -
      • -
      - - - -
        -
      • -

        setTexture

        -
        public void setTexture(PImage tex)
        -
      • -
      - - - -
        -
      • -

        getFill

        -
        public int getFill(int index)
        -
      • -
      - - - -
        -
      • -

        setFill

        -
        public void setFill(boolean fill)
        -
      • -
      - - - -
        -
      • -

        setFill

        -
        public void setFill(int fill)
        -
      • -
      - - - -
        -
      • -

        setFill

        -
        public void setFill(int index,
        -                    int fill)
        -
      • -
      - - - -
        -
      • -

        getTint

        -
        public int getTint(int index)
        -
      • -
      - - - -
        -
      • -

        setTint

        -
        public void setTint(boolean tint)
        -
      • -
      - - - -
        -
      • -

        setTint

        -
        public void setTint(int fill)
        -
      • -
      - - - -
        -
      • -

        setTint

        -
        public void setTint(int index,
        -                    int tint)
        -
      • -
      - - - -
        -
      • -

        getStroke

        -
        public int getStroke(int index)
        -
      • -
      - - - -
        -
      • -

        setStroke

        -
        public void setStroke(boolean stroke)
        -
      • -
      - - - -
        -
      • -

        setStroke

        -
        public void setStroke(int stroke)
        -
      • -
      - - - -
        -
      • -

        setStroke

        -
        public void setStroke(int index,
        -                      int stroke)
        -
      • -
      - - - -
        -
      • -

        getStrokeWeight

        -
        public float getStrokeWeight(int index)
        -
      • -
      - - - -
        -
      • -

        setStrokeWeight

        -
        public void setStrokeWeight(float weight)
        -
      • -
      - - - -
        -
      • -

        setStrokeWeight

        -
        public void setStrokeWeight(int index,
        -                            float weight)
        -
      • -
      - - - -
        -
      • -

        setStrokeJoin

        -
        public void setStrokeJoin(int join)
        -
      • -
      - - - -
        -
      • -

        setStrokeCap

        -
        public void setStrokeCap(int cap)
        -
      • -
      - - - -
        -
      • -

        getAmbient

        -
        public int getAmbient(int index)
        -
      • -
      - - - -
        -
      • -

        setAmbient

        -
        public void setAmbient(int ambient)
        -
      • -
      - - - -
        -
      • -

        setAmbient

        -
        public void setAmbient(int index,
        -                       int ambient)
        -
      • -
      - - - -
        -
      • -

        getSpecular

        -
        public int getSpecular(int index)
        -
      • -
      - - - -
        -
      • -

        setSpecular

        -
        public void setSpecular(int specular)
        -
      • -
      - - - -
        -
      • -

        setSpecular

        -
        public void setSpecular(int index,
        -                        int specular)
        -
      • -
      - - - -
        -
      • -

        getEmissive

        -
        public int getEmissive(int index)
        -
      • -
      - - - -
        -
      • -

        setEmissive

        -
        public void setEmissive(int emissive)
        -
      • -
      - - - -
        -
      • -

        setEmissive

        -
        public void setEmissive(int index,
        -                        int emissive)
        -
      • -
      - - - -
        -
      • -

        getShininess

        -
        public float getShininess(int index)
        -
      • -
      - - - -
        -
      • -

        setShininess

        -
        public void setShininess(float shine)
        -
      • -
      - - - -
        -
      • -

        setShininess

        -
        public void setShininess(int index,
        -                         float shine)
        -
      • -
      - - - -
        -
      • -

        getVertexCodes

        -
        public int[] getVertexCodes()
        -
      • -
      - - - -
        -
      • -

        getVertexCodeCount

        -
        public int getVertexCodeCount()
        -
      • -
      - - - -
        -
      • -

        getVertexCode

        -
        public int getVertexCode(int index)
        -
        One of VERTEX, BEZIER_VERTEX, CURVE_VERTEX, or BREAK.
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public boolean isClosed()
        -
      • -
      - - - -
        -
      • -

        contains

        -
        public boolean contains(float x,
        -                        float y)
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float x,
        -                      float y)
        -
        ( begin auto-generated from PShape_translate.xml ) - - Specifies an amount to displace the shape. The x parameter - specifies left/right translation, the y parameter specifies - up/down translation, and the z parameter specifies translations - toward/away from the screen. Subsequent calls to the method accumulates - the effect. For example, calling translate(50, 0) and then - translate(20, 0) is the same as translate(70, 0). This - transformation is applied directly to the shape, it's not refreshed each - time draw() is run. -

        - Using this method with the z parameter requires using the P3D - parameter in combination with size. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        tx - left/right translation
        -
        ty - up/down translation
        -
        See Also:
        -
        rotate(float), -scale(float), -resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float x,
        -                      float y,
        -                      float z)
        -
        -
        Parameters:
        -
        tz - forward/back translation
        -
        -
      • -
      - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        ( begin auto-generated from PShape_rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to TWO_PI) or converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Subsequent calls to the method accumulates the effect. For example, - calling rotateX(HALF_PI) and then rotateX(HALF_PI) is the - same as rotateX(PI). This transformation is applied directly to - the shape, it's not refreshed each time draw() is run. -

        - This method requires a 3D renderer. You need to use P3D as a third - parameter for the size() function as shown in the example above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        rotate(float), -rotateY(float), -rotateZ(float), -scale(float), -translate(float, float), -resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        ( begin auto-generated from PShape_rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to TWO_PI) or converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Subsequent calls to the method accumulates the effect. For example, - calling rotateY(HALF_PI) and then rotateY(HALF_PI) is the - same as rotateY(PI). This transformation is applied directly to - the shape, it's not refreshed each time draw() is run. -

        - This method requires a 3D renderer. You need to use P3D as a third - parameter for the size() function as shown in the example above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        rotate(float), -rotateX(float), -rotateZ(float), -scale(float), -translate(float, float), -resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        ( begin auto-generated from PShape_rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to TWO_PI) or converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Subsequent calls to the method accumulates the effect. For example, - calling rotateZ(HALF_PI) and then rotateZ(HALF_PI) is the - same as rotateZ(PI). This transformation is applied directly to - the shape, it's not refreshed each time draw() is run. -

        - This method requires a 3D renderer. You need to use P3D as a third - parameter for the size() function as shown in the example above. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        rotate(float), -rotateX(float), -rotateY(float), -scale(float), -translate(float, float), -resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle)
        -
        ( begin auto-generated from PShape_rotate.xml ) - - Rotates a shape the amount specified by the angle parameter. - Angles should be specified in radians (values from 0 to TWO_PI) or - converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the method accumulates the effect. For example, calling - rotate(HALF_PI) and then rotate(HALF_PI) is the same as - rotate(PI). This transformation is applied directly to the shape, - it's not refreshed each time draw() is run. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        rotateX(float), -rotateY(float), -rotateZ(float), -scale(float), -translate(float, float), -resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle,
        -                   float v0,
        -                   float v1,
        -                   float v2)
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float s)
        -
        ( begin auto-generated from PShape_scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices. Shapes always scale from the relative origin of their bounding - box. Scale values are specified as decimal percentages. For example, the - method call scale(2.0) increases the dimension of a shape by - 200%. Subsequent calls to the method multiply the effect. For example, - calling scale(2.0) and then scale(1.5) is the same as - scale(3.0). This transformation is applied directly to the shape, - it's not refreshed each time draw() is run. -

        - Using this method with the z parameter requires using the P3D - parameter in combination with size. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        s - percentate to scale the object
        -
        See Also:
        -
        rotate(float), -translate(float, float), -resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y)
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y,
        -                  float z)
        -
        -
        Parameters:
        -
        x - percentage to scale the object in the x-axis
        -
        y - percentage to scale the object in the y-axis
        -
        z - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - -
        -
      • -

        resetMatrix

        -
        public void resetMatrix()
        -
        ( begin auto-generated from PShape_resetMatrix.xml ) - - Replaces the current matrix of a shape with the identity matrix. The - equivalent function in OpenGL is glLoadIdentity(). - - ( end auto-generated )
        -
        -
        See Also:
        -
        rotate(float), -scale(float), -translate(float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode)
        -
        Set the pivot point for all transformations.
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float max)
        -
        -
        Parameters:
        -
        max - range for all color elements
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float maxX,
        -                      float maxY,
        -                      float maxZ)
        -
        -
        Parameters:
        -
        maxX - range for the red or hue depending on the current color mode
        -
        maxY - range for the green or saturation depending on the current color mode
        -
        maxZ - range for the blue or brightness depending on the current color mode
        -
        -
      • -
      - - - -
        -
      • -

        colorMode

        -
        public void colorMode(int mode,
        -                      float maxX,
        -                      float maxY,
        -                      float maxZ,
        -                      float maxA)
        -
        -
        Parameters:
        -
        maxA - range for the alpha
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PShapeOBJ.html b/build/javadoc/everything/processing/core/PShapeOBJ.html deleted file mode 100644 index fa2a611e65..0000000000 --- a/build/javadoc/everything/processing/core/PShapeOBJ.html +++ /dev/null @@ -1,316 +0,0 @@ - - - - - -PShapeOBJ - - - - - - - - - - - -
-
processing.core
-

Class PShapeOBJ

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    -
    public class PShapeOBJ
    -extends PShape
    -
    This class is not part of the Processing API and should not be used - directly. Instead, use loadShape() and methods like it, which will make - use of this class. Using this class directly will cause your code to break - when combined with future versions of Processing. -

    - OBJ loading implemented using code from Saito's OBJLoader library: - http://code.google.com/p/saitoobjloader/ - and OBJReader from Ahmet Kizilay - http://www.openprocessing.org/visuals/?visualID=191

    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PShapeSVG.Font.html b/build/javadoc/everything/processing/core/PShapeSVG.Font.html deleted file mode 100644 index ea0d57972d..0000000000 --- a/build/javadoc/everything/processing/core/PShapeSVG.Font.html +++ /dev/null @@ -1,476 +0,0 @@ - - - - - -PShapeSVG.Font - - - - - - - - - - - -
-
processing.core
-

Class PShapeSVG.Font

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    Enclosing class:
    -
    PShapeSVG
    -
    -
    -
    -
    public static class PShapeSVG.Font
    -extends PShapeSVG
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PShapeSVG.FontGlyph.html b/build/javadoc/everything/processing/core/PShapeSVG.FontGlyph.html deleted file mode 100644 index d495c61ffe..0000000000 --- a/build/javadoc/everything/processing/core/PShapeSVG.FontGlyph.html +++ /dev/null @@ -1,335 +0,0 @@ - - - - - -PShapeSVG.FontGlyph - - - - - - - - - - - -
-
processing.core
-

Class PShapeSVG.FontGlyph

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    Enclosing class:
    -
    PShapeSVG
    -
    -
    -
    -
    public static class PShapeSVG.FontGlyph
    -extends PShapeSVG
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PShapeSVG.html b/build/javadoc/everything/processing/core/PShapeSVG.html deleted file mode 100644 index 931a105c27..0000000000 --- a/build/javadoc/everything/processing/core/PShapeSVG.html +++ /dev/null @@ -1,475 +0,0 @@ - - - - - -PShapeSVG - - - - - - - - - - - -
-
processing.core
-

Class PShapeSVG

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    PShapeSVG.Font, PShapeSVG.FontGlyph
    -
    -
    -
    -
    public class PShapeSVG
    -extends PShape
    -
    This class is not part of the Processing API and should not be used - directly. Instead, use loadShape() and methods like it, which will make - use of this class. Using this class directly will cause your code to break - when combined with future versions of Processing. -

    - 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 <g> 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.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PShapeSVG

        -
        public PShapeSVG(XML svg)
        -
        Initializes a new SVG Object from the given XML.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getChild

        -
        public PShape getChild(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.
        - PShape layer3 = svg.getChild("Layer 3");
        - 
        -
        -
        Overrides:
        -
        getChild in class PShape
        -
        Parameters:
        -
        name - the name of the shape to get
        -
        -
      • -
      - - - -
        -
      • -

        print

        -
        public void print()
        -
        Prints out the SVG document. Useful for parsing.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PStyle.html b/build/javadoc/everything/processing/core/PStyle.html deleted file mode 100644 index ce74493622..0000000000 --- a/build/javadoc/everything/processing/core/PStyle.html +++ /dev/null @@ -1,724 +0,0 @@ - - - - - -PStyle - - - - - - - - - - - -
-
processing.core
-

Class PStyle

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        imageMode

        -
        public int imageMode
        -
      • -
      - - - -
        -
      • -

        rectMode

        -
        public int rectMode
        -
      • -
      - - - -
        -
      • -

        ellipseMode

        -
        public int ellipseMode
        -
      • -
      - - - -
        -
      • -

        shapeMode

        -
        public int shapeMode
        -
      • -
      - - - -
        -
      • -

        blendMode

        -
        public int blendMode
        -
      • -
      - - - -
        -
      • -

        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/PSurface.html b/build/javadoc/everything/processing/core/PSurface.html deleted file mode 100644 index 1188e6ed35..0000000000 --- a/build/javadoc/everything/processing/core/PSurface.html +++ /dev/null @@ -1,570 +0,0 @@ - - - - - -PSurface - - - - - - - - - - - -
-
processing.core
-

Interface PSurface

-
-
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        MIN_WINDOW_WIDTH

        -
        static final int MIN_WINDOW_WIDTH
        -
        Minimum dimensions for the window holding an applet. This varies between - platforms, Mac OS X 10.3 (confirmed with 10.7 and Java 6) 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 allows window - sizes to be negative numbers.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - - -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        initOffscreen

        -
        void initOffscreen(PApplet sketch)
        -
      • -
      - - - -
        -
      • -

        initFrame

        -
        void initFrame(PApplet sketch)
        -
      • -
      - - - -
        -
      • -

        setTitle

        -
        void setTitle(String title)
        -
        Set the window (and dock, or whatever necessary) title.
        -
      • -
      - - - -
        -
      • -

        setVisible

        -
        void setVisible(boolean visible)
        -
        Show or hide the window.
        -
      • -
      - - - -
        -
      • -

        setResizable

        -
        void setResizable(boolean resizable)
        -
        Set true if we want to resize things (default is not resizable)
        -
      • -
      - - - -
        -
      • -

        placeWindow

        -
        void placeWindow(int[] location,
        -                 int[] editorLocation)
        -
      • -
      - - - -
        -
      • -

        placePresent

        -
        void placePresent(int stopColor)
        -
      • -
      - - - -
        -
      • -

        setupExternalMessages

        -
        void setupExternalMessages()
        -
      • -
      - - - -
        -
      • -

        setSize

        -
        void setSize(int width,
        -             int height)
        -
      • -
      - - - -
        -
      • -

        setSmooth

        -
        void setSmooth(int level)
        -
        Sometimes smoothing must be set at the drawing surface level - not just inside the renderer itself.
        -
      • -
      - - - -
        -
      • -

        setFrameRate

        -
        void setFrameRate(float fps)
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        void setCursor(int kind)
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        void setCursor(PImage image,
        -               int hotspotX,
        -               int hotspotY)
        -
      • -
      - - - -
        -
      • -

        showCursor

        -
        void showCursor()
        -
      • -
      - - - -
        -
      • -

        hideCursor

        -
        void hideCursor()
        -
      • -
      - - - -
        -
      • -

        startThread

        -
        void startThread()
        -
        Start the animation thread
        -
      • -
      - - - -
        -
      • -

        pauseThread

        -
        void pauseThread()
        -
        On the next trip through the animation thread, things should go sleepy-bye. - Does not pause the thread immediately because that needs to happen on the - animation thread itself, so fires on the next trip through draw().
        -
      • -
      - - - -
        -
      • -

        resumeThread

        -
        void resumeThread()
        -
      • -
      - - - -
        -
      • -

        stopThread

        -
        boolean stopThread()
        -
        Stop the animation thread (set it null)
        -
        -
        Returns:
        -
        false if already stopped
        -
        -
      • -
      - - - -
        -
      • -

        isStopped

        -
        boolean isStopped()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PSurfaceAWT.html b/build/javadoc/everything/processing/core/PSurfaceAWT.html deleted file mode 100644 index 437c5dbf3e..0000000000 --- a/build/javadoc/everything/processing/core/PSurfaceAWT.html +++ /dev/null @@ -1,622 +0,0 @@ - - - - - -PSurfaceAWT - - - - - - - - - - - -
-
processing.core
-

Class PSurfaceAWT

-
-
- -
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PSurfaceDanger.html b/build/javadoc/everything/processing/core/PSurfaceDanger.html deleted file mode 100644 index 12974fa393..0000000000 --- a/build/javadoc/everything/processing/core/PSurfaceDanger.html +++ /dev/null @@ -1,315 +0,0 @@ - - - - - -PSurfaceDanger - - - - - - - - - - - -
-
processing.core
-

Class PSurfaceDanger

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PSurface
    -
    -
    -
    -
    public class PSurfaceDanger
    -extends PSurfaceAWT
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PSurfaceFX.PApplicationFX.html b/build/javadoc/everything/processing/core/PSurfaceFX.PApplicationFX.html deleted file mode 100644 index 614c317f6a..0000000000 --- a/build/javadoc/everything/processing/core/PSurfaceFX.PApplicationFX.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - -PSurfaceFX.PApplicationFX - - - - - - - - - - - -
-
processing.core
-

Class PSurfaceFX.PApplicationFX

-
-
-
    -
  • Object
  • -
  • -
      -
    • Application
    • -
    • -
        -
      • PSurfaceFX.PApplicationFX
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    Enclosing class:
    -
    PSurfaceFX
    -
    -
    -
    -
    public static class PSurfaceFX.PApplicationFX
    -extends Application
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from class Application

        -Application.Parameters
      • -
      -
    • -
    - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      static PSurfaceFXsurface 
      -
        -
      • - - -

        Fields inherited from class Application

        -STYLESHEET_CASPIAN, STYLESHEET_MODENA
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      PApplicationFX() 
      -
    • -
    - - -
  • -
-
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PApplicationFX

        -
        public PApplicationFX()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        start

        -
        public void start(Stage stage)
        -
        -
        Specified by:
        -
        start in class Application
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PSurfaceFX.html b/build/javadoc/everything/processing/core/PSurfaceFX.html deleted file mode 100644 index a0cdb94878..0000000000 --- a/build/javadoc/everything/processing/core/PSurfaceFX.html +++ /dev/null @@ -1,673 +0,0 @@ - - - - - -PSurfaceFX - - - - - - - - - - - -
-
processing.core
-

Class PSurfaceFX

-
-
-
    -
  • Object
  • -
  • -
      -
    • PSurfaceFX
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PSurface
    -
    -
    -
    -
    public class PSurfaceFX
    -extends Object
    -implements PSurface
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Method Detail

      - - - - - - - - - - - -
        -
      • -

        setTitle

        -
        public void setTitle(String title)
        -
        Set the window (and dock, or whatever necessary) title.
        -
        -
        Specified by:
        -
        setTitle in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setVisible

        -
        public void setVisible(boolean visible)
        -
        Show or hide the window.
        -
        -
        Specified by:
        -
        setVisible in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setResizable

        -
        public void setResizable(boolean resizable)
        -
        Set true if we want to resize things (default is not resizable)
        -
        -
        Specified by:
        -
        setResizable in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        placeWindow

        -
        public void placeWindow(int[] location,
        -                        int[] editorLocation)
        -
        -
        Specified by:
        -
        placeWindow in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        placePresent

        -
        public void placePresent(int stopColor)
        -
        -
        Specified by:
        -
        placePresent in interface PSurface
        -
        -
      • -
      - - - - - - - -
        -
      • -

        setSize

        -
        public void setSize(int width,
        -                    int height)
        -
        -
        Specified by:
        -
        setSize in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setSmooth

        -
        public void setSmooth(int level)
        -
        Description copied from interface: PSurface
        -
        Sometimes smoothing must be set at the drawing surface level - not just inside the renderer itself.
        -
        -
        Specified by:
        -
        setSmooth in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setFrameRate

        -
        public void setFrameRate(float fps)
        -
        -
        Specified by:
        -
        setFrameRate in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        public void setCursor(int kind)
        -
        -
        Specified by:
        -
        setCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        public void setCursor(PImage image,
        -                      int hotspotX,
        -                      int hotspotY)
        -
        -
        Specified by:
        -
        setCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        showCursor

        -
        public void showCursor()
        -
        -
        Specified by:
        -
        showCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        hideCursor

        -
        public void hideCursor()
        -
        -
        Specified by:
        -
        hideCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        startThread

        -
        public void startThread()
        -
        Description copied from interface: PSurface
        -
        Start the animation thread
        -
        -
        Specified by:
        -
        startThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        pauseThread

        -
        public void pauseThread()
        -
        Description copied from interface: PSurface
        -
        On the next trip through the animation thread, things should go sleepy-bye. - Does not pause the thread immediately because that needs to happen on the - animation thread itself, so fires on the next trip through draw().
        -
        -
        Specified by:
        -
        pauseThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        resumeThread

        -
        public void resumeThread()
        -
        -
        Specified by:
        -
        resumeThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        stopThread

        -
        public boolean stopThread()
        -
        Description copied from interface: PSurface
        -
        Stop the animation thread (set it null)
        -
        -
        Specified by:
        -
        stopThread in interface PSurface
        -
        Returns:
        -
        false if already stopped
        -
        -
      • -
      - - - -
        -
      • -

        isStopped

        -
        public boolean isStopped()
        -
        -
        Specified by:
        -
        isStopped in interface PSurface
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PSurfaceNone.html b/build/javadoc/everything/processing/core/PSurfaceNone.html deleted file mode 100644 index 664d43b57a..0000000000 --- a/build/javadoc/everything/processing/core/PSurfaceNone.html +++ /dev/null @@ -1,673 +0,0 @@ - - - - - -PSurfaceNone - - - - - - - - - - - -
-
processing.core
-

Class PSurfaceNone

-
-
-
    -
  • Object
  • -
  • -
      -
    • PSurfaceNone
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PSurface
    -
    -
    -
    Direct Known Subclasses:
    -
    PSurfaceAWT
    -
    -
    -
    -
    public class PSurfaceNone
    -extends Object
    -implements PSurface
    -
    Surface that's not really visible. Used for PDF and friends, or as a base - class for other drawing surfaces. It includes the standard rendering loop.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PSurfaceNone

        -
        public PSurfaceNone(PGraphics graphics)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - - - - - -
        -
      • -

        setTitle

        -
        public void setTitle(String title)
        -
        Set the window (and dock, or whatever necessary) title.
        -
        -
        Specified by:
        -
        setTitle in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setVisible

        -
        public void setVisible(boolean visible)
        -
        Show or hide the window.
        -
        -
        Specified by:
        -
        setVisible in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setResizable

        -
        public void setResizable(boolean resizable)
        -
        Set true if we want to resize things (default is not resizable)
        -
        -
        Specified by:
        -
        setResizable in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        placeWindow

        -
        public void placeWindow(int[] location,
        -                        int[] editorLocation)
        -
        -
        Specified by:
        -
        placeWindow in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        placePresent

        -
        public void placePresent(int stopColor)
        -
        -
        Specified by:
        -
        placePresent in interface PSurface
        -
        -
      • -
      - - - - - - - -
        -
      • -

        setSize

        -
        public void setSize(int wide,
        -                    int high)
        -
        -
        Specified by:
        -
        setSize in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setSmooth

        -
        public void setSmooth(int level)
        -
        Description copied from interface: PSurface
        -
        Sometimes smoothing must be set at the drawing surface level - not just inside the renderer itself.
        -
        -
        Specified by:
        -
        setSmooth in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        public void setCursor(int kind)
        -
        -
        Specified by:
        -
        setCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        public void setCursor(PImage image,
        -                      int hotspotX,
        -                      int hotspotY)
        -
        -
        Specified by:
        -
        setCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        showCursor

        -
        public void showCursor()
        -
        -
        Specified by:
        -
        showCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        hideCursor

        -
        public void hideCursor()
        -
        -
        Specified by:
        -
        hideCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        createThread

        -
        public Thread createThread()
        -
      • -
      - - - -
        -
      • -

        startThread

        -
        public void startThread()
        -
        Description copied from interface: PSurface
        -
        Start the animation thread
        -
        -
        Specified by:
        -
        startThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        stopThread

        -
        public boolean stopThread()
        -
        Description copied from interface: PSurface
        -
        Stop the animation thread (set it null)
        -
        -
        Specified by:
        -
        stopThread in interface PSurface
        -
        Returns:
        -
        false if already stopped
        -
        -
      • -
      - - - -
        -
      • -

        isStopped

        -
        public boolean isStopped()
        -
        -
        Specified by:
        -
        isStopped in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        pauseThread

        -
        public void pauseThread()
        -
        Description copied from interface: PSurface
        -
        On the next trip through the animation thread, things should go sleepy-bye. - Does not pause the thread immediately because that needs to happen on the - animation thread itself, so fires on the next trip through draw().
        -
        -
        Specified by:
        -
        pauseThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        resumeThread

        -
        public void resumeThread()
        -
        -
        Specified by:
        -
        resumeThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setFrameRate

        -
        public void setFrameRate(float fps)
        -
        -
        Specified by:
        -
        setFrameRate in interface PSurface
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/PVector.html b/build/javadoc/everything/processing/core/PVector.html deleted file mode 100644 index 30515e08e6..0000000000 --- a/build/javadoc/everything/processing/core/PVector.html +++ /dev/null @@ -1,1811 +0,0 @@ - - - - - -PVector - - - - - - - - - - - -
-
processing.core
-

Class PVector

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    -
    public class PVector
    -extends Object
    -implements Serializable
    -
    ( begin auto-generated from PVector.xml ) - - A class to describe a two or three dimensional vector. This datatype - stores two or three variables that are commonly used as a position, - velocity, and/or acceleration. Technically, position is a point - and velocity and acceleration are vectors, but this is - often simplified to consider all three as vectors. For example, if you - consider a rectangle moving across the screen, at any given instant it - has a position (the object's location, expressed as a point.), a - velocity (the rate at which the object's position changes per time unit, - expressed as a vector), and acceleration (the rate at which the object's - velocity changes per time unit, expressed as a vector). Since vectors - represent groupings of values, we cannot simply use traditional - addition/multiplication/etc. Instead, we'll need to do some "vector" - math, which is made easy by the methods inside the PVector - class.
    -
    - The methods for this class are extensive. For a complete list, visit the - developer's reference. - - ( end auto-generated ) - - 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.

    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      floatx -
      ( begin auto-generated from PVector_x.xml ) - - The x component of the vector.
      -
      floaty -
      ( begin auto-generated from PVector_y.xml ) - - The y component of the vector.
      -
      floatz -
      ( begin auto-generated from PVector_z.xml ) - - The z component of the vector.
      -
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      Constructor and Description
      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

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and TypeMethod and Description
      PVectoradd(float x, - float y, - float z) 
      PVectoradd(PVector v) -
      ( begin auto-generated from PVector_add.xml ) - - Adds x, y, and z components to a vector, adds one vector to another, or - adds two independent vectors together.
      -
      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) -
      ( begin auto-generated from PVector_angleBetween.xml ) - - Calculates and returns the angle (in radians) between two vectors.
      -
      float[]array() -
      ( begin auto-generated from PVector_array.xml ) - - Return a representation of this vector as a float array.
      -
      PVectorcopy() 
      PVectorcross(PVector v) -
      ( begin auto-generated from PVector_cross.xml ) - - Calculates and returns a vector composed of the cross product between - two vectors.
      -
      PVectorcross(PVector v, - PVector target) 
      static PVectorcross(PVector v1, - PVector v2, - PVector target) 
      floatdist(PVector v) -
      ( begin auto-generated from PVector_dist.xml ) - - Calculates the Euclidean distance between two points (considering a - point as a vector object).
      -
      static floatdist(PVector v1, - PVector v2) 
      PVectordiv(float n) -
      ( begin auto-generated from PVector_div.xml ) - - Divides a vector by a scalar or divides one vector by another.
      -
      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) -
      Divide a vector by a scalar and store the result in another vector.
      -
      floatdot(float x, - float y, - float z) 
      floatdot(PVector v) -
      ( begin auto-generated from PVector_dot.xml ) - - Calculates the dot product of two vectors.
      -
      static floatdot(PVector v1, - PVector v2) 
      booleanequals(Object obj) 
      static PVectorfromAngle(float angle) -
      ( begin auto-generated from PVector_sub.xml ) - - Make a new 2D unit vector from an angle.
      -
      static PVectorfromAngle(float angle, - PVector target) -
      Make a new 2D unit vector from an angle
      -
      PVectorget() -
      Deprecated. 
      -
      float[]get(float[] target) 
      inthashCode() 
      floatheading() -
      ( begin auto-generated from PVector_setMag.xml ) - - Calculate the angle of rotation for this vector (only 2D vectors) - - ( end auto-generated )
      -
      floatheading2D() -
      Deprecated. 
      -
      PVectorlerp(float x, - float y, - float z, - float amt) -
      Linear interpolate the vector to x,y,z values
      -
      PVectorlerp(PVector v, - float amt) -
      ( begin auto-generated from PVector_rotate.xml ) - - Linear interpolate the vector to another vector - - ( end auto-generated )
      -
      static PVectorlerp(PVector v1, - PVector v2, - float amt) -
      Linear interpolate between two vectors (returns a new PVector object)
      -
      PVectorlimit(float max) -
      ( begin auto-generated from PVector_limit.xml ) - - Limit the magnitude of this vector to the value used for the max parameter.
      -
      floatmag() -
      ( begin auto-generated from PVector_mag.xml ) - - Calculates the magnitude (length) of the vector and returns the result - as a float (this is simply the equation sqrt(x*x + y*y + z*z).) - - ( end auto-generated )
      -
      floatmagSq() -
      ( begin auto-generated from PVector_mag.xml ) - - Calculates the squared magnitude of the vector and returns the result - as a float (this is simply the equation (x*x + y*y + z*z).) - Faster if the real length is not required in the - case of comparing vectors, etc.
      -
      PVectormult(float n) -
      ( begin auto-generated from PVector_mult.xml ) - - Multiplies a vector by a scalar or multiplies one vector by another.
      -
      static PVectormult(PVector v, - float n) 
      static PVectormult(PVector v, - float n, - PVector target) -
      Multiply a vector by a scalar, and write the result into a target PVector.
      -
      PVectornormalize() -
      ( begin auto-generated from PVector_normalize.xml ) - - Normalize the vector to length 1 (make it a unit vector).
      -
      PVectornormalize(PVector target) 
      static PVectorrandom2D() -
      ( begin auto-generated from PVector_random2D.xml ) - - Make a new 2D unit vector with a random direction.
      -
      static PVectorrandom2D(PApplet parent) -
      Make a new 2D unit vector with a random direction - using Processing's current random number generator
      -
      static PVectorrandom2D(PVector target) -
      Set a 2D vector to a random unit vector with a random direction
      -
      static PVectorrandom2D(PVector target, - PApplet parent) -
      Make a new 2D unit vector with a random direction.
      -
      static PVectorrandom3D() -
      ( begin auto-generated from PVector_random3D.xml ) - - Make a new 3D unit vector with a random direction.
      -
      static PVectorrandom3D(PApplet parent) -
      Make a new 3D unit vector with a random direction - using Processing's current random number generator
      -
      static PVectorrandom3D(PVector target) -
      Set a 3D vector to a random unit vector with a random direction
      -
      static PVectorrandom3D(PVector target, - PApplet parent) -
      Make a new 3D unit vector with a random direction
      -
      PVectorrotate(float theta) -
      ( begin auto-generated from PVector_rotate.xml ) - - Rotate the vector by an angle (only 2D vectors), magnitude remains the same - - ( end auto-generated )
      -
      PVectorset(float[] source) -
      Set the x, y (and maybe z) coordinates using a float[] array as the source.
      -
      PVectorset(float x, - float y) 
      PVectorset(float x, - float y, - float z) -
      ( begin auto-generated from PVector_set.xml ) - - Sets the x, y, and z component of the vector using two or three separate - variables, the data from a PVector, or the values from a float array.
      -
      PVectorset(PVector v) 
      PVectorsetMag(float len) -
      ( begin auto-generated from PVector_setMag.xml ) - - Set the magnitude of this vector to the value used for the len parameter.
      -
      PVectorsetMag(PVector target, - float len) -
      Sets the magnitude of this vector, storing the result in another vector.
      -
      PVectorsub(float x, - float y, - float z) 
      PVectorsub(PVector v) -
      ( begin auto-generated from PVector_sub.xml ) - - Subtracts x, y, and z components from a vector, subtracts one vector - from another, or subtracts two independent vectors.
      -
      static PVectorsub(PVector v1, - PVector v2) -
      Subtract one vector from another
      -
      static PVectorsub(PVector v1, - PVector v2, - PVector target) -
      Subtract one vector from another and store in another vector
      -
      StringtoString() 
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        x

        -
        public float x
        -
        ( begin auto-generated from PVector_x.xml ) - - The x component of the vector. This field (variable) can be used to both - get and set the value (see above example.) - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        y

        -
        public float y
        -
        ( begin auto-generated from PVector_y.xml ) - - The y component of the vector. This field (variable) can be used to both - get and set the value (see above example.) - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        z

        -
        public float z
        -
        ( begin auto-generated from PVector_z.xml ) - - The z component of the vector. This field (variable) can be used to both - get and set the value (see above example.) - - ( end auto-generated )
        -
      • -
      -
    • -
    - -
      -
    • - - -

      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 z coordinate.
        -
        -
      • -
      - - - -
        -
      • -

        PVector

        -
        public PVector(float x,
        -               float y)
        -
        Constructor for a 2D vector: z coordinate is set to 0.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        set

        -
        public PVector set(float x,
        -                   float y,
        -                   float z)
        -
        ( begin auto-generated from PVector_set.xml ) - - Sets the x, y, and z component of the vector using two or three separate - variables, the data from a PVector, or the values from a float array. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        x - the x component of the vector
        -
        y - the y component of the vector
        -
        z - the z component of the vector
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public PVector set(float x,
        -                   float y)
        -
        -
        Parameters:
        -
        x - the x component of the vector
        -
        y - the y component of the vector
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public PVector set(PVector v)
        -
        -
        Parameters:
        -
        v - any variable of type PVector
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public PVector set(float[] source)
        -
        Set the x, y (and maybe z) coordinates using a float[] array as the source.
        -
        -
        Parameters:
        -
        source - array to copy from
        -
        -
      • -
      - - - -
        -
      • -

        random2D

        -
        public static PVector random2D()
        -
        ( begin auto-generated from PVector_random2D.xml ) - - Make a new 2D unit vector with a random direction. If you pass in "this" - as an argument, it will use the PApplet's random number generator. You can - also pass in a target PVector to fill.
        -
        -
        Returns:
        -
        the random PVector
        -
        See Also:
        -
        random3D()
        -
        -
      • -
      - - - -
        -
      • -

        random2D

        -
        public static PVector random2D(PApplet parent)
        -
        Make a new 2D unit vector with a random direction - using Processing's current random number generator
        -
        -
        Parameters:
        -
        parent - current PApplet instance
        -
        Returns:
        -
        the random PVector
        -
        -
      • -
      - - - -
        -
      • -

        random2D

        -
        public static PVector random2D(PVector target)
        -
        Set a 2D vector to a random unit vector with a random direction
        -
        -
        Parameters:
        -
        target - the target vector (if null, a new vector will be created)
        -
        Returns:
        -
        the random PVector
        -
        -
      • -
      - - - -
        -
      • -

        random2D

        -
        public static PVector random2D(PVector target,
        -                               PApplet parent)
        -
        Make a new 2D unit vector with a random direction. Pass in the parent - PApplet if you want randomSeed() to work (and be predictable). Or leave - it null and be... random.
        -
        -
        Returns:
        -
        the random PVector
        -
        -
      • -
      - - - -
        -
      • -

        random3D

        -
        public static PVector random3D()
        -
        ( begin auto-generated from PVector_random3D.xml ) - - Make a new 3D unit vector with a random direction. If you pass in "this" - as an argument, it will use the PApplet's random number generator. You can - also pass in a target PVector to fill.
        -
        -
        Returns:
        -
        the random PVector
        -
        See Also:
        -
        random2D()
        -
        -
      • -
      - - - -
        -
      • -

        random3D

        -
        public static PVector random3D(PApplet parent)
        -
        Make a new 3D unit vector with a random direction - using Processing's current random number generator
        -
        -
        Parameters:
        -
        parent - current PApplet instance
        -
        Returns:
        -
        the random PVector
        -
        -
      • -
      - - - -
        -
      • -

        random3D

        -
        public static PVector random3D(PVector target)
        -
        Set a 3D vector to a random unit vector with a random direction
        -
        -
        Parameters:
        -
        target - the target vector (if null, a new vector will be created)
        -
        Returns:
        -
        the random PVector
        -
        -
      • -
      - - - -
        -
      • -

        random3D

        -
        public static PVector random3D(PVector target,
        -                               PApplet parent)
        -
        Make a new 3D unit vector with a random direction
        -
        -
        Returns:
        -
        the random PVector
        -
        -
      • -
      - - - -
        -
      • -

        fromAngle

        -
        public static PVector fromAngle(float angle)
        -
        ( begin auto-generated from PVector_sub.xml ) - - Make a new 2D unit vector from an angle. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        angle - the angle in radians
        -
        Returns:
        -
        the new unit PVector
        -
        -
      • -
      - - - -
        -
      • -

        fromAngle

        -
        public static PVector fromAngle(float angle,
        -                                PVector target)
        -
        Make a new 2D unit vector from an angle
        -
        -
        Parameters:
        -
        target - the target vector (if null, a new vector will be created)
        -
        Returns:
        -
        the PVector
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public PVector copy()
        -
      • -
      - - - -
        -
      • -

        get

        -
        @Deprecated
        -public PVector get()
        -
        Deprecated. 
        -
        ( begin auto-generated from PVector_get.xml ) - - Gets a copy of the vector, returns a PVector object. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        get

        -
        public float[] get(float[] target)
        -
        -
        Parameters:
        -
        target -
        -
        -
      • -
      - - - -
        -
      • -

        mag

        -
        public float mag()
        -
        ( begin auto-generated from PVector_mag.xml ) - - Calculates the magnitude (length) of the vector and returns the result - as a float (this is simply the equation sqrt(x*x + y*y + z*z).) - - ( end auto-generated )
        -
        -
        Returns:
        -
        magnitude (length) of the vector
        -
        See Also:
        -
        magSq()
        -
        -
      • -
      - - - -
        -
      • -

        magSq

        -
        public float magSq()
        -
        ( begin auto-generated from PVector_mag.xml ) - - Calculates the squared magnitude of the vector and returns the result - as a float (this is simply the equation (x*x + y*y + z*z).) - Faster if the real length is not required in the - case of comparing vectors, etc. - - ( end auto-generated )
        -
        -
        Returns:
        -
        squared magnitude of the vector
        -
        See Also:
        -
        mag()
        -
        -
      • -
      - - - -
        -
      • -

        add

        -
        public PVector add(PVector v)
        -
        ( begin auto-generated from PVector_add.xml ) - - Adds x, y, and z components to a vector, adds one vector to another, or - adds two independent vectors together. The version of the method that - adds two vectors together is a static method and returns a PVector, the - others have no return value -- they act directly on the vector. See the - examples for more context. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v - the vector to be added
        -
        -
      • -
      - - - -
        -
      • -

        add

        -
        public PVector add(float x,
        -                   float y,
        -                   float z)
        -
        -
        Parameters:
        -
        x - x component of the vector
        -
        y - y component of the vector
        -
        z - z component of the vector
        -
        -
      • -
      - - - -
        -
      • -

        add

        -
        public static PVector add(PVector v1,
        -                          PVector v2)
        -
        Add two vectors
        -
        -
        Parameters:
        -
        v1 - a vector
        -
        v2 - another vector
        -
        -
      • -
      - - - -
        -
      • -

        add

        -
        public static PVector add(PVector v1,
        -                          PVector v2,
        -                          PVector target)
        -
        Add two vectors into a target vector
        -
        -
        Parameters:
        -
        target - the target vector (if null, a new vector will be created)
        -
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public PVector sub(PVector v)
        -
        ( begin auto-generated from PVector_sub.xml ) - - Subtracts x, y, and z components from a vector, subtracts one vector - from another, or subtracts two independent vectors. The version of the - method that subtracts two vectors is a static method and returns a - PVector, the others have no return value -- they act directly on the - vector. See the examples for more context. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v - any variable of type PVector
        -
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public PVector sub(float x,
        -                   float y,
        -                   float z)
        -
        -
        Parameters:
        -
        x - the x component of the vector
        -
        y - the y component of the vector
        -
        z - the z component of the vector
        -
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public static PVector sub(PVector v1,
        -                          PVector v2)
        -
        Subtract one vector from another
        -
        -
        Parameters:
        -
        v1 - the x, y, and z components of a PVector object
        -
        v2 - the x, y, and z components of a PVector object
        -
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public static PVector sub(PVector v1,
        -                          PVector v2,
        -                          PVector target)
        -
        Subtract one vector from another and store in another vector
        -
        -
        Parameters:
        -
        v1 - the x, y, and z components of a PVector object
        -
        v2 - the x, y, and z components of a PVector object
        -
        target - PVector in which to store the result
        -
        -
      • -
      - - - -
        -
      • -

        mult

        -
        public PVector mult(float n)
        -
        ( begin auto-generated from PVector_mult.xml ) - - Multiplies a vector by a scalar or multiplies one vector by another. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - the number to multiply with the vector
        -
        -
      • -
      - - - -
        -
      • -

        mult

        -
        public static PVector mult(PVector v,
        -                           float n)
        -
        -
        Parameters:
        -
        v - the vector to multiply by the scalar
        -
        -
      • -
      - - - -
        -
      • -

        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:
        -
        target - PVector in which to store the result
        -
        -
      • -
      - - - -
        -
      • -

        div

        -
        public PVector div(float n)
        -
        ( begin auto-generated from PVector_div.xml ) - - Divides a vector by a scalar or divides one vector by another. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        n - the number by which to divide the vector
        -
        -
      • -
      - - - -
        -
      • -

        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 - the vector to divide by the scalar
        -
        Returns:
        -
        a new vector that is v1 / n
        -
        -
      • -
      - - - -
        -
      • -

        div

        -
        public static PVector div(PVector v,
        -                          float n,
        -                          PVector target)
        -
        Divide a vector by a scalar and store the result in another vector.
        -
        -
        Parameters:
        -
        target - PVector in which to store the result
        -
        -
      • -
      - - - -
        -
      • -

        dist

        -
        public float dist(PVector v)
        -
        ( begin auto-generated from PVector_dist.xml ) - - Calculates the Euclidean distance between two points (considering a - point as a vector object). - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v - the x, y, and z coordinates of a PVector
        -
        -
      • -
      - - - -
        -
      • -

        dist

        -
        public static float dist(PVector v1,
        -                         PVector v2)
        -
        -
        Parameters:
        -
        v1 - any variable of type PVector
        -
        v2 - any variable of type PVector
        -
        Returns:
        -
        the Euclidean distance between v1 and v2
        -
        -
      • -
      - - - -
        -
      • -

        dot

        -
        public float dot(PVector v)
        -
        ( begin auto-generated from PVector_dot.xml ) - - Calculates the dot product of two vectors. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v - any variable of type PVector
        -
        Returns:
        -
        the dot product
        -
        -
      • -
      - - - -
        -
      • -

        dot

        -
        public float dot(float x,
        -                 float y,
        -                 float z)
        -
        -
        Parameters:
        -
        x - x component of the vector
        -
        y - y component of the vector
        -
        z - z component of the vector
        -
        -
      • -
      - - - -
        -
      • -

        dot

        -
        public static float dot(PVector v1,
        -                        PVector v2)
        -
        -
        Parameters:
        -
        v1 - any variable of type PVector
        -
        v2 - any variable of type PVector
        -
        -
      • -
      - - - -
        -
      • -

        cross

        -
        public PVector cross(PVector v)
        -
        ( begin auto-generated from PVector_cross.xml ) - - Calculates and returns a vector composed of the cross product between - two vectors. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v - the vector to calculate the cross product
        -
        -
      • -
      - - - -
        -
      • -

        cross

        -
        public PVector cross(PVector v,
        -                     PVector target)
        -
        -
        Parameters:
        -
        v - any variable of type PVector
        -
        target - PVector to store the result
        -
        -
      • -
      - - - -
        -
      • -

        cross

        -
        public static PVector cross(PVector v1,
        -                            PVector v2,
        -                            PVector target)
        -
        -
        Parameters:
        -
        v1 - any variable of type PVector
        -
        v2 - any variable of type PVector
        -
        target - PVector to store the result
        -
        -
      • -
      - - - -
        -
      • -

        normalize

        -
        public PVector normalize()
        -
        ( begin auto-generated from PVector_normalize.xml ) - - Normalize the vector to length 1 (make it a unit vector). - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        normalize

        -
        public PVector normalize(PVector target)
        -
        -
        Parameters:
        -
        target - Set to null to create a new vector
        -
        Returns:
        -
        a new vector (if target was null), or target
        -
        -
      • -
      - - - -
        -
      • -

        limit

        -
        public PVector limit(float max)
        -
        ( begin auto-generated from PVector_limit.xml ) - - Limit the magnitude of this vector to the value used for the max parameter. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        max - the maximum magnitude for the vector
        -
        -
      • -
      - - - -
        -
      • -

        setMag

        -
        public PVector setMag(float len)
        -
        ( begin auto-generated from PVector_setMag.xml ) - - Set the magnitude of this vector to the value used for the len parameter. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        len - the new length for this vector
        -
        -
      • -
      - - - -
        -
      • -

        setMag

        -
        public PVector setMag(PVector target,
        -                      float len)
        -
        Sets the magnitude of this vector, storing the result in another vector.
        -
        -
        Parameters:
        -
        target - Set to null to create a new vector
        -
        len - the new length for the new vector
        -
        Returns:
        -
        a new vector (if target was null), or target
        -
        -
      • -
      - - - -
        -
      • -

        heading

        -
        public float heading()
        -
        ( begin auto-generated from PVector_setMag.xml ) - - Calculate the angle of rotation for this vector (only 2D vectors) - - ( end auto-generated )
        -
        -
        Returns:
        -
        the angle of rotation
        -
        -
      • -
      - - - -
        -
      • -

        heading2D

        -
        @Deprecated
        -public float heading2D()
        -
        Deprecated. 
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public PVector rotate(float theta)
        -
        ( begin auto-generated from PVector_rotate.xml ) - - Rotate the vector by an angle (only 2D vectors), magnitude remains the same - - ( end auto-generated )
        -
        -
        Parameters:
        -
        theta - the angle of rotation
        -
        -
      • -
      - - - -
        -
      • -

        lerp

        -
        public PVector lerp(PVector v,
        -                    float amt)
        -
        ( begin auto-generated from PVector_rotate.xml ) - - Linear interpolate the vector to another vector - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v - the vector to lerp to
        -
        amt - The amount of interpolation; some value between 0.0 (old vector) and 1.0 (new vector). 0.1 is very near the new vector. 0.5 is halfway in between.
        -
        See Also:
        -
        PApplet.lerp(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        lerp

        -
        public static PVector lerp(PVector v1,
        -                           PVector v2,
        -                           float amt)
        -
        Linear interpolate between two vectors (returns a new PVector object)
        -
        -
        Parameters:
        -
        v1 - the vector to start from
        -
        v2 - the vector to lerp to
        -
        -
      • -
      - - - -
        -
      • -

        lerp

        -
        public PVector lerp(float x,
        -                    float y,
        -                    float z,
        -                    float amt)
        -
        Linear interpolate the vector to x,y,z values
        -
        -
        Parameters:
        -
        x - the x component to lerp to
        -
        y - the y component to lerp to
        -
        z - the z component to lerp to
        -
        -
      • -
      - - - -
        -
      • -

        angleBetween

        -
        public static float angleBetween(PVector v1,
        -                                 PVector v2)
        -
        ( begin auto-generated from PVector_angleBetween.xml ) - - Calculates and returns the angle (in radians) between two vectors. - - ( end auto-generated )
        -
        -
        Parameters:
        -
        v1 - the x, y, and z components of a PVector
        -
        v2 - the x, y, and z components of a PVector
        -
        -
      • -
      - - - - - - - -
        -
      • -

        array

        -
        public float[] array()
        -
        ( begin auto-generated from PVector_array.xml ) - - 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 PVector.get() method to copy into your own array. - - ( end auto-generated )
        -
      • -
      - - - -
        -
      • -

        equals

        -
        public boolean equals(Object obj)
        -
        -
        Overrides:
        -
        equals in class Object
        -
        -
      • -
      - - - -
        -
      • -

        hashCode

        -
        public int hashCode()
        -
        -
        Overrides:
        -
        hashCode in class Object
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/ThinkDifferent.html b/build/javadoc/everything/processing/core/ThinkDifferent.html deleted file mode 100644 index ca44493371..0000000000 --- a/build/javadoc/everything/processing/core/ThinkDifferent.html +++ /dev/null @@ -1,273 +0,0 @@ - - - - - -ThinkDifferent - - - - - - - - - - - -
-
processing.core
-

Class ThinkDifferent

-
-
-
    -
  • Object
  • -
  • -
      -
    • ThinkDifferent
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class ThinkDifferent
    -extends Object
    -
    Deal with issues related to thinking differently. This handles the basic - Mac OS X menu commands (and apple events) for open, about, prefs, etc. - - This is a stripped-down version of what's in processing.app.platform to fix - 3301.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ThinkDifferent

        -
        public ThinkDifferent()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        init

        -
        public static void init(PApplet sketch)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/core/package-frame.html b/build/javadoc/everything/processing/core/package-frame.html deleted file mode 100644 index 420b7ff9fa..0000000000 --- a/build/javadoc/everything/processing/core/package-frame.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - -processing.core - - - - -

processing.core

- - - diff --git a/build/javadoc/everything/processing/core/package-summary.html b/build/javadoc/everything/processing/core/package-summary.html deleted file mode 100644 index c6079e233d..0000000000 --- a/build/javadoc/everything/processing/core/package-summary.html +++ /dev/null @@ -1,288 +0,0 @@ - - - - - -processing.core - - - - - - - - - - -
-

Package processing.core

-
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    PConstants -
    Numbers shared throughout processing.core.
    -
    PMatrix 
    PSurface 
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    PApplet -
    Base class for all sketches that use processing.core.
    -
    PFont -
    Grayscale bitmap font class used by Processing.
    -
    PGraphics -
    ( begin auto-generated from PGraphics.xml ) - - Main graphics and rendering context, as well as the base API - implementation for processing "core".
    -
    PGraphicsDanger2D -
    Experimental/enhanced renderer that draws directly to the Graphics context - without an intermediate image.
    -
    PGraphicsFX2D 
    PGraphicsJava2D -
    Subclass for PGraphics that implements the graphics API using Java2D.
    -
    PImage -
    ( begin auto-generated from PImage.xml ) - - Datatype for storing images.
    -
    PMatrix2D -
    3x2 affine matrix implementation.
    -
    PMatrix3D -
    4x4 matrix implementation.
    -
    PShape -
    ( begin auto-generated from PShape.xml ) - - Datatype for storing shapes.
    -
    PShapeOBJ -
    This class is not part of the Processing API and should not be used - directly.
    -
    PShapeSVG -
    This class is not part of the Processing API and should not be used - directly.
    -
    PShapeSVG.Font 
    PShapeSVG.FontGlyph 
    PStyle 
    PSurfaceAWT 
    PSurfaceDanger 
    PSurfaceFX 
    PSurfaceFX.PApplicationFX 
    PSurfaceNone -
    Surface that's not really visible.
    -
    PVector -
    ( begin auto-generated from PVector.xml ) - - A class to describe a two or three dimensional vector.
    -
    ThinkDifferent -
    Deal with issues related to thinking differently.
    -
    -
  • -
-
- - - - - - diff --git a/build/javadoc/everything/processing/core/package-tree.html b/build/javadoc/everything/processing/core/package-tree.html deleted file mode 100644 index 3fe1249980..0000000000 --- a/build/javadoc/everything/processing/core/package-tree.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - -processing.core Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.core

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Interface Hierarchy

- -
- - - - - - diff --git a/build/javadoc/everything/processing/data/FloatDict.html b/build/javadoc/everything/processing/data/FloatDict.html deleted file mode 100644 index 03ea97723f..0000000000 --- a/build/javadoc/everything/processing/data/FloatDict.html +++ /dev/null @@ -1,878 +0,0 @@ - - - - - -FloatDict - - - - - - - - - - - -
-
processing.data
-

Class FloatDict

-
-
- -
-
    -
  • -
    -
    -
    public class FloatDict
    -extends Object
    -
    A simple table class to use a String as a lookup for an float value.
    -
    -
    See Also:
    -
    IntDict, -StringDict
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        FloatDict

        -
        public FloatDict()
        -
      • -
      - - - -
        -
      • -

        FloatDict

        -
        public FloatDict(int length)
        -
        Create a new lookup with a specific size. This is more efficient than not - specifying a size. Use it when you know the rough size of the thing you're creating.
        -
      • -
      - - - -
        -
      • -

        FloatDict

        -
        public FloatDict(BufferedReader reader)
        -
        Read a set of entries from a Reader that has each key/value pair on - a single line, separated by a tab.
        -
      • -
      - - - -
        -
      • -

        FloatDict

        -
        public FloatDict(Object[][] pairs)
        -
        Constructor to allow (more intuitive) inline initialization, e.g.: -
        - new FloatDict(new Object[][] {
        -   { "key1", 1 },
        -   { "key2", 2 }
        - });
        - 
        -
      • -
      - - - -
        -
      • -

        FloatDict

        -
        public FloatDict(String[] keys,
        -                 float[] values)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        size

        -
        public int size()
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        Remove all entries.
        -
      • -
      - - - -
        -
      • -

        key

        -
        public String key(int index)
        -
      • -
      - - - - - - - -
        -
      • -

        keyArray

        -
        public String[] keyArray()
        -
        Return a copy of the internal keys array. This array can be modified.
        -
      • -
      - - - -
        -
      • -

        keyArray

        -
        public String[] keyArray(String[] outgoing)
        -
      • -
      - - - -
        -
      • -

        value

        -
        public float value(int index)
        -
      • -
      - - - - - - - -
        -
      • -

        valueArray

        -
        public float[] valueArray()
        -
        Create a new array and copy each of the values into it.
        -
      • -
      - - - -
        -
      • -

        valueArray

        -
        public float[] valueArray(float[] array)
        -
        Fill an already-allocated array with the values (more efficient than - creating a new array each time). If 'array' is null, or not the same - size as the number of values, a new array will be allocated and returned.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public float get(String key)
        -
        Return a value for the specified key.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public float get(String key,
        -                 float alternate)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String key,
        -                float amount)
        -
      • -
      - - - -
        -
      • -

        hasKey

        -
        public boolean hasKey(String key)
        -
      • -
      - - - -
        -
      • -

        add

        -
        public void add(String key,
        -                float amount)
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public void sub(String key,
        -                float amount)
        -
      • -
      - - - -
        -
      • -

        mult

        -
        public void mult(String key,
        -                 float amount)
        -
      • -
      - - - -
        -
      • -

        div

        -
        public void div(String key,
        -                float amount)
        -
      • -
      - - - -
        -
      • -

        minIndex

        -
        public int minIndex()
        -
      • -
      - - - -
        -
      • -

        minKey

        -
        public String minKey()
        -
      • -
      - - - -
        -
      • -

        minValue

        -
        public float minValue()
        -
      • -
      - - - -
        -
      • -

        maxIndex

        -
        public int maxIndex()
        -
      • -
      - - - -
        -
      • -

        maxKey

        -
        public String maxKey()
        -
        The key for a max value, or null if everything is NaN (no max).
        -
      • -
      - - - -
        -
      • -

        maxValue

        -
        public float maxValue()
        -
        The max value. (Or NaN if they're all NaN.)
        -
      • -
      - - - -
        -
      • -

        index

        -
        public int index(String what)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public int remove(String key)
        -
      • -
      - - - -
        -
      • -

        removeIndex

        -
        public String removeIndex(int index)
        -
      • -
      - - - -
        -
      • -

        swap

        -
        public void swap(int a,
        -                 int b)
        -
      • -
      - - - -
        -
      • -

        sortKeys

        -
        public void sortKeys()
        -
        Sort the keys alphabetically (ignoring case). Uses the value as a - tie-breaker (only really possible with a key that has a case change).
        -
      • -
      - - - -
        -
      • -

        sortKeysReverse

        -
        public void sortKeysReverse()
        -
      • -
      - - - -
        -
      • -

        sortValues

        -
        public void sortValues()
        -
        Sort by values in descending order (largest value will be at [0]).
        -
      • -
      - - - -
        -
      • -

        sortValuesReverse

        -
        public void sortValuesReverse()
        -
      • -
      - - - -
        -
      • -

        getPercent

        -
        public FloatDict getPercent()
        -
        Sum all of the values in this dictionary, then return a new FloatDict of - each key, divided by the total sum. The total for all values will be ~1.0.
        -
        -
        Returns:
        -
        a Dict with the original keys, mapped to their pct of the total
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public FloatDict copy()
        -
        Returns a duplicate copy of this object.
        -
      • -
      - - - -
        -
      • -

        print

        -
        public void print()
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write(PrintWriter writer)
        -
        Write tab-delimited entries out to
        -
        -
        Parameters:
        -
        writer -
        -
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/data/FloatList.html b/build/javadoc/everything/processing/data/FloatList.html deleted file mode 100644 index b49932ea42..0000000000 --- a/build/javadoc/everything/processing/data/FloatList.html +++ /dev/null @@ -1,1042 +0,0 @@ - - - - - -FloatList - - - - - - - - - - - -
-
processing.data
-

Class FloatList

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Iterable<Float>
    -
    -
    -
    -
    public class FloatList
    -extends Object
    -implements Iterable<Float>
    -
    Helper class for a list of floats. Lists are designed to have some of the - features of ArrayLists, but to maintain the simplicity and efficiency of - working with arrays. - - Functions like sort() and shuffle() always act on the list itself. To get - a sorted copy, use list.copy().sort().
    -
    -
    See Also:
    -
    IntList, -StringList
    -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - - - -
      Constructors 
      Constructor and Description
      FloatList() 
      FloatList(float[] list) 
      FloatList(int length) 
      FloatList(Iterable<Object> iter) -
      Construct an FloatList from an iterable pile of objects.
      -
      FloatList(Object... items) -
      Construct an FloatList from a random pile of objects.
      -
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidadd(int index, - float amount) 
      voidappend(float value) -
      Add a new entry to the list.
      -
      voidappend(float[] values) 
      voidappend(FloatList list) 
      voidappendUnique(float value) -
      Add this value, but only if it's not already in the list.
      -
      float[]array() -
      Create a new array with a copy of all the values.
      -
      float[]array(float[] array) -
      Copy values into the specified array.
      -
      voidclear() -
      Remove all entries from the list.
      -
      FloatListcopy() 
      voiddiv(int index, - float amount) 
      floatget(int index) -
      Get an entry at a particular index.
      -
      FloatListgetPercent() -
      Returns a normalized version of this array.
      -
      FloatListgetSubset(int start) 
      FloatListgetSubset(int start, - int num) 
      booleanhasValue(float value) 
      intindex(float what) -
      Return the first index of a particular value.
      -
      voidinsert(int index, - float value) 
      voidinsert(int index, - float[] values) 
      voidinsert(int index, - FloatList list) 
      Iterator<Float>iterator() -
      Implemented this way so that we can use a FloatList in a for loop.
      -
      Stringjoin(String separator) 
      floatmax() 
      intmaxIndex() 
      floatmin() 
      intminIndex() 
      voidmult(int index, - float amount) 
      floatpop() 
      voidprint() 
      voidpush(float value) -
      Just an alias for append(), but matches pop()
      -
      floatremove(int index) -
      Remove an element from the specified index.
      -
      intremoveValue(int value) 
      intremoveValues(int value) 
      booleanreplaceValue(float value, - float newValue) -
      Replace the first instance of a particular value
      -
      booleanreplaceValues(float value, - float newValue) -
      Replace all instances of a particular value
      -
      voidresize(int length) 
      voidreverse() 
      voidset(int index, - float what) -
      Set the entry at a particular index.
      -
      voidshuffle() -
      Randomize the order of the list elements.
      -
      voidshuffle(PApplet sketch) -
      Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
      -
      intsize() -
      Get the length of the list.
      -
      voidsort() -
      Sorts the array in place.
      -
      voidsortReverse() -
      Reverse sort, orders values from highest to lowest
      -
      voidsub(int index, - float amount) 
      floatsum() 
      StringtoString() 
      float[]values() -
      Returns the actual array being used to store the data.
      -
      - - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        FloatList

        -
        public FloatList()
        -
      • -
      - - - -
        -
      • -

        FloatList

        -
        public FloatList(int length)
        -
      • -
      - - - -
        -
      • -

        FloatList

        -
        public FloatList(float[] list)
        -
      • -
      - - - -
        -
      • -

        FloatList

        -
        public FloatList(Iterable<Object> iter)
        -
        Construct an FloatList from an iterable pile of objects. - For instance, a float array, an array of strings, who knows). - Un-parseable or null values will be set to NaN.
        -
      • -
      - - - -
        -
      • -

        FloatList

        -
        public FloatList(Object... items)
        -
        Construct an FloatList from a random pile of objects. - Un-parseable or null values will be set to NaN.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        size

        -
        public int size()
        -
        Get the length of the list.
        -
      • -
      - - - -
        -
      • -

        resize

        -
        public void resize(int length)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        Remove all entries from the list.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public float get(int index)
        -
        Get an entry at a particular index.
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int index,
        -                float what)
        -
        Set the entry at a particular index. If the index is past the length of - the list, it'll expand the list to accommodate, and fill the intermediate - entries with 0s.
        -
      • -
      - - - -
        -
      • -

        push

        -
        public void push(float value)
        -
        Just an alias for append(), but matches pop()
        -
      • -
      - - - -
        -
      • -

        pop

        -
        public float pop()
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public float remove(int index)
        -
        Remove an element from the specified index.
        -
      • -
      - - - -
        -
      • -

        removeValue

        -
        public int removeValue(int value)
        -
      • -
      - - - -
        -
      • -

        removeValues

        -
        public int removeValues(int value)
        -
      • -
      - - - -
        -
      • -

        replaceValue

        -
        public boolean replaceValue(float value,
        -                            float newValue)
        -
        Replace the first instance of a particular value
        -
      • -
      - - - -
        -
      • -

        replaceValues

        -
        public boolean replaceValues(float value,
        -                             float newValue)
        -
        Replace all instances of a particular value
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(float value)
        -
        Add a new entry to the list.
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(float[] values)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(FloatList list)
        -
      • -
      - - - -
        -
      • -

        appendUnique

        -
        public void appendUnique(float value)
        -
        Add this value, but only if it's not already in the list.
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   float value)
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   float[] values)
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   FloatList list)
        -
      • -
      - - - -
        -
      • -

        index

        -
        public int index(float what)
        -
        Return the first index of a particular value.
        -
      • -
      - - - -
        -
      • -

        hasValue

        -
        public boolean hasValue(float value)
        -
      • -
      - - - -
        -
      • -

        add

        -
        public void add(int index,
        -                float amount)
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public void sub(int index,
        -                float amount)
        -
      • -
      - - - -
        -
      • -

        mult

        -
        public void mult(int index,
        -                 float amount)
        -
      • -
      - - - -
        -
      • -

        div

        -
        public void div(int index,
        -                float amount)
        -
      • -
      - - - -
        -
      • -

        min

        -
        public float min()
        -
      • -
      - - - -
        -
      • -

        minIndex

        -
        public int minIndex()
        -
      • -
      - - - -
        -
      • -

        max

        -
        public float max()
        -
      • -
      - - - -
        -
      • -

        maxIndex

        -
        public int maxIndex()
        -
      • -
      - - - -
        -
      • -

        sum

        -
        public float sum()
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public void sort()
        -
        Sorts the array in place.
        -
      • -
      - - - -
        -
      • -

        sortReverse

        -
        public void sortReverse()
        -
        Reverse sort, orders values from highest to lowest
        -
      • -
      - - - -
        -
      • -

        reverse

        -
        public void reverse()
        -
      • -
      - - - -
        -
      • -

        shuffle

        -
        public void shuffle()
        -
        Randomize the order of the list elements. Note that this does not - obey the randomSeed() function in PApplet.
        -
      • -
      - - - -
        -
      • -

        shuffle

        -
        public void shuffle(PApplet sketch)
        -
        Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
        -
      • -
      - - - - - - - -
        -
      • -

        values

        -
        public float[] values()
        -
        Returns the actual array being used to store the data. For advanced users, - this is the fastest way to access a large list. Suitable for iterating - with a for() loop, but modifying the list will have terrible consequences.
        -
      • -
      - - - -
        -
      • -

        iterator

        -
        public Iterator<Float> iterator()
        -
        Implemented this way so that we can use a FloatList in a for loop.
        -
        -
        Specified by:
        -
        iterator in interface Iterable<Float>
        -
        -
      • -
      - - - -
        -
      • -

        array

        -
        public float[] array()
        -
        Create a new array with a copy of all the values.
        -
        -
        Returns:
        -
        an array sized by the length of the list with each of the values.
        -
        -
      • -
      - - - -
        -
      • -

        array

        -
        public float[] array(float[] array)
        -
        Copy values into the specified array. If the specified array is null or - not the same size, a new array will be allocated.
        -
        -
        Parameters:
        -
        array -
        -
        -
      • -
      - - - -
        -
      • -

        getPercent

        -
        public FloatList getPercent()
        -
        Returns a normalized version of this array. Called getPercent() for - consistency with the Dict classes. It's a getter method because it needs - to returns a new list (because IntList/Dict can't do percentages or - normalization in place on int values).
        -
      • -
      - - - -
        -
      • -

        getSubset

        -
        public FloatList getSubset(int start)
        -
      • -
      - - - -
        -
      • -

        getSubset

        -
        public FloatList getSubset(int start,
        -                           int num)
        -
      • -
      - - - - - - - -
        -
      • -

        print

        -
        public void print()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/data/IntDict.html b/build/javadoc/everything/processing/data/IntDict.html deleted file mode 100644 index 2a02e6207b..0000000000 --- a/build/javadoc/everything/processing/data/IntDict.html +++ /dev/null @@ -1,935 +0,0 @@ - - - - - -IntDict - - - - - - - - - - - -
-
processing.data
-

Class IntDict

-
-
- -
-
    -
  • -
    -
    -
    public class IntDict
    -extends Object
    -
    A simple class to use a String as a lookup for an int value.
    -
    -
    See Also:
    -
    FloatDict, -StringDict
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        IntDict

        -
        public IntDict()
        -
      • -
      - - - -
        -
      • -

        IntDict

        -
        public IntDict(int length)
        -
        Create a new lookup with a specific size. This is more efficient than not - specifying a size. Use it when you know the rough size of the thing you're creating.
        -
      • -
      - - - -
        -
      • -

        IntDict

        -
        public IntDict(BufferedReader reader)
        -
        Read a set of entries from a Reader that has each key/value pair on - a single line, separated by a tab.
        -
      • -
      - - - -
        -
      • -

        IntDict

        -
        public IntDict(String[] keys,
        -               int[] values)
        -
      • -
      - - - -
        -
      • -

        IntDict

        -
        public IntDict(Object[][] pairs)
        -
        Constructor to allow (more intuitive) inline initialization, e.g.: -
        - new FloatDict(new Object[][] {
        -   { "key1", 1 },
        -   { "key2", 2 }
        - });
        - 
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        size

        -
        public int size()
        -
        Returns the number of key/value pairs
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        Remove all entries.
        -
      • -
      - - - -
        -
      • -

        key

        -
        public String key(int index)
        -
      • -
      - - - -
        -
      • -

        keys

        -
        public Iterable<String> keys()
        -
        Return the internal array being used to store the keys. Allocated but - unused entries will be removed. This array should not be modified.
        -
      • -
      - - - - - - - -
        -
      • -

        keyArray

        -
        public String[] keyArray()
        -
        Return a copy of the internal keys array. This array can be modified.
        -
      • -
      - - - -
        -
      • -

        keyArray

        -
        public String[] keyArray(String[] outgoing)
        -
      • -
      - - - -
        -
      • -

        value

        -
        public int value(int index)
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        valueArray

        -
        public int[] valueArray()
        -
        Create a new array and copy each of the values into it.
        -
      • -
      - - - -
        -
      • -

        valueArray

        -
        public int[] valueArray(int[] array)
        -
        Fill an already-allocated array with the values (more efficient than - creating a new array each time). If 'array' is null, or not the same - size as the number of values, a new array will be allocated and returned.
        -
        -
        Parameters:
        -
        array - values to copy into the array
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get(String key)
        -
        Return a value for the specified key.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get(String key,
        -               int alternate)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String key,
        -                int amount)
        -
        Create a new key/value pair or change the value of one.
        -
      • -
      - - - -
        -
      • -

        hasKey

        -
        public boolean hasKey(String key)
        -
      • -
      - - - -
        -
      • -

        increment

        -
        public void increment(String key)
        -
        Increase the value associated with a specific key by 1.
        -
      • -
      - - - -
        -
      • -

        add

        -
        public void add(String key,
        -                int amount)
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public void sub(String key,
        -                int amount)
        -
      • -
      - - - -
        -
      • -

        mult

        -
        public void mult(String key,
        -                 int amount)
        -
      • -
      - - - -
        -
      • -

        div

        -
        public void div(String key,
        -                int amount)
        -
      • -
      - - - -
        -
      • -

        minIndex

        -
        public int minIndex()
        -
      • -
      - - - -
        -
      • -

        minValue

        -
        public int minValue()
        -
      • -
      - - - -
        -
      • -

        minKey

        -
        public String minKey()
        -
      • -
      - - - -
        -
      • -

        maxIndex

        -
        public int maxIndex()
        -
      • -
      - - - -
        -
      • -

        maxValue

        -
        public int maxValue()
        -
      • -
      - - - -
        -
      • -

        maxKey

        -
        public String maxKey()
        -
      • -
      - - - -
        -
      • -

        index

        -
        public int index(String what)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public int remove(String key)
        -
      • -
      - - - -
        -
      • -

        removeIndex

        -
        public String removeIndex(int index)
        -
      • -
      - - - -
        -
      • -

        swap

        -
        public void swap(int a,
        -                 int b)
        -
      • -
      - - - -
        -
      • -

        sortKeys

        -
        public void sortKeys()
        -
        Sort the keys alphabetically (ignoring case). Uses the value as a - tie-breaker (only really possible with a key that has a case change).
        -
      • -
      - - - -
        -
      • -

        sortKeysReverse

        -
        public void sortKeysReverse()
        -
        Sort the keys alphabetically in reverse (ignoring case). Uses the value as a - tie-breaker (only really possible with a key that has a case change).
        -
      • -
      - - - -
        -
      • -

        sortValues

        -
        public void sortValues()
        -
        Sort by values in ascending order. The smallest value will be at [0].
        -
      • -
      - - - -
        -
      • -

        sortValuesReverse

        -
        public void sortValuesReverse()
        -
        Sort by values in descending order. The largest value will be at [0].
        -
      • -
      - - - -
        -
      • -

        getPercent

        -
        public FloatDict getPercent()
        -
        Sum all of the values in this dictionary, then return a new FloatDict of - each key, divided by the total sum. The total for all values will be ~1.0.
        -
        -
        Returns:
        -
        a Dict with the original keys, mapped to their pct of the total
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public IntDict copy()
        -
        Returns a duplicate copy of this object.
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write(PrintWriter writer)
        -
        Write tab-delimited entries out to
        -
        -
        Parameters:
        -
        writer -
        -
        -
      • -
      - - - -
        -
      • -

        print

        -
        public void print()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/data/IntList.html b/build/javadoc/everything/processing/data/IntList.html deleted file mode 100644 index 3b58ba95de..0000000000 --- a/build/javadoc/everything/processing/data/IntList.html +++ /dev/null @@ -1,1044 +0,0 @@ - - - - - -IntList - - - - - - - - - - - -
-
processing.data
-

Class IntList

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Iterable<Integer>
    -
    -
    -
    -
    public class IntList
    -extends Object
    -implements Iterable<Integer>
    -
    Helper class for a list of ints. Lists are designed to have some of the - features of ArrayLists, but to maintain the simplicity and efficiency of - working with arrays. - - Functions like sort() and shuffle() always act on the list itself. To get - a sorted copy, use list.copy().sort().
    -
    -
    See Also:
    -
    FloatList, -StringList
    -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - - - -
      Constructors 
      Constructor and Description
      IntList() 
      IntList(int length) 
      IntList(int[] source) 
      IntList(Iterable<Object> iter) -
      Construct an IntList from an iterable pile of objects.
      -
      IntList(Object... items) -
      Construct an IntList from a random pile of objects.
      -
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidadd(int index, - int amount) 
      voidappend(int value) -
      Add a new entry to the list.
      -
      voidappend(int[] values) 
      voidappend(IntList list) 
      voidappendUnique(int value) -
      Add this value, but only if it's not already in the list.
      -
      int[]array() -
      Create a new array with a copy of all the values.
      -
      int[]array(int[] array) -
      Copy values into the specified array.
      -
      voidclear() -
      Remove all entries from the list.
      -
      IntListcopy() 
      voiddiv(int index, - int amount) 
      static IntListfromRange(int stop) 
      static IntListfromRange(int start, - int stop) 
      intget(int index) -
      Get an entry at a particular index.
      -
      FloatListgetPercent() -
      Returns a normalized version of this array.
      -
      IntListgetSubset(int start) 
      IntListgetSubset(int start, - int num) 
      booleanhasValue(int value) 
      voidincrement(int index) 
      intindex(int what) -
      Return the first index of a particular value.
      -
      voidinsert(int index, - int value) 
      voidinsert(int index, - int[] values) 
      voidinsert(int index, - IntList list) 
      Iterator<Integer>iterator() 
      Stringjoin(String separator) 
      intmax() 
      intmaxIndex() 
      intmin() 
      intminIndex() 
      voidmult(int index, - int amount) 
      intpop() 
      voidprint() 
      voidpush(int value) -
      Just an alias for append(), but matches pop()
      -
      intremove(int index) -
      Remove an element from the specified index
      -
      intremoveValue(int value) 
      intremoveValues(int value) 
      voidresize(int length) 
      voidreverse() 
      voidset(int index, - int what) -
      Set the entry at a particular index.
      -
      voidshuffle() -
      Randomize the order of the list elements.
      -
      voidshuffle(PApplet sketch) -
      Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
      -
      intsize() -
      Get the length of the list.
      -
      voidsort() -
      Sorts the array in place.
      -
      voidsortReverse() -
      Reverse sort, orders values from highest to lowest.
      -
      voidsub(int index, - int amount) 
      intsum() 
      StringtoString() 
      int[]values() -
      Returns the actual array being used to store the data.
      -
      - - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        IntList

        -
        public IntList()
        -
      • -
      - - - -
        -
      • -

        IntList

        -
        public IntList(int length)
        -
      • -
      - - - -
        -
      • -

        IntList

        -
        public IntList(int[] source)
        -
      • -
      - - - -
        -
      • -

        IntList

        -
        public IntList(Iterable<Object> iter)
        -
        Construct an IntList from an iterable pile of objects. - For instance, a float array, an array of strings, who knows). - Un-parseable or null values will be set to 0.
        -
      • -
      - - - -
        -
      • -

        IntList

        -
        public IntList(Object... items)
        -
        Construct an IntList from a random pile of objects. - Un-parseable or null values will be set to zero.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        fromRange

        -
        public static IntList fromRange(int stop)
        -
      • -
      - - - -
        -
      • -

        fromRange

        -
        public static IntList fromRange(int start,
        -                                int stop)
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
        Get the length of the list.
        -
      • -
      - - - -
        -
      • -

        resize

        -
        public void resize(int length)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        Remove all entries from the list.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get(int index)
        -
        Get an entry at a particular index.
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int index,
        -                int what)
        -
        Set the entry at a particular index. If the index is past the length of - the list, it'll expand the list to accommodate, and fill the intermediate - entries with 0s.
        -
      • -
      - - - -
        -
      • -

        push

        -
        public void push(int value)
        -
        Just an alias for append(), but matches pop()
        -
      • -
      - - - -
        -
      • -

        pop

        -
        public int pop()
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public int remove(int index)
        -
        Remove an element from the specified index
        -
      • -
      - - - -
        -
      • -

        removeValue

        -
        public int removeValue(int value)
        -
      • -
      - - - -
        -
      • -

        removeValues

        -
        public int removeValues(int value)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(int value)
        -
        Add a new entry to the list.
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(int[] values)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(IntList list)
        -
      • -
      - - - -
        -
      • -

        appendUnique

        -
        public void appendUnique(int value)
        -
        Add this value, but only if it's not already in the list.
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   int value)
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   int[] values)
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   IntList list)
        -
      • -
      - - - -
        -
      • -

        index

        -
        public int index(int what)
        -
        Return the first index of a particular value.
        -
      • -
      - - - -
        -
      • -

        hasValue

        -
        public boolean hasValue(int value)
        -
      • -
      - - - -
        -
      • -

        increment

        -
        public void increment(int index)
        -
      • -
      - - - -
        -
      • -

        add

        -
        public void add(int index,
        -                int amount)
        -
      • -
      - - - -
        -
      • -

        sub

        -
        public void sub(int index,
        -                int amount)
        -
      • -
      - - - -
        -
      • -

        mult

        -
        public void mult(int index,
        -                 int amount)
        -
      • -
      - - - -
        -
      • -

        div

        -
        public void div(int index,
        -                int amount)
        -
      • -
      - - - -
        -
      • -

        min

        -
        public int min()
        -
      • -
      - - - -
        -
      • -

        minIndex

        -
        public int minIndex()
        -
      • -
      - - - -
        -
      • -

        max

        -
        public int max()
        -
      • -
      - - - -
        -
      • -

        maxIndex

        -
        public int maxIndex()
        -
      • -
      - - - -
        -
      • -

        sum

        -
        public int sum()
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public void sort()
        -
        Sorts the array in place.
        -
      • -
      - - - -
        -
      • -

        sortReverse

        -
        public void sortReverse()
        -
        Reverse sort, orders values from highest to lowest.
        -
      • -
      - - - -
        -
      • -

        reverse

        -
        public void reverse()
        -
      • -
      - - - -
        -
      • -

        shuffle

        -
        public void shuffle()
        -
        Randomize the order of the list elements. Note that this does not - obey the randomSeed() function in PApplet.
        -
      • -
      - - - -
        -
      • -

        shuffle

        -
        public void shuffle(PApplet sketch)
        -
        Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public IntList copy()
        -
      • -
      - - - -
        -
      • -

        values

        -
        public int[] values()
        -
        Returns the actual array being used to store the data. For advanced users, - this is the fastest way to access a large list. Suitable for iterating - with a for() loop, but modifying the list will have terrible consequences.
        -
      • -
      - - - - - - - -
        -
      • -

        array

        -
        public int[] array()
        -
        Create a new array with a copy of all the values.
        -
        -
        Returns:
        -
        an array sized by the length of the list with each of the values.
        -
        -
      • -
      - - - -
        -
      • -

        array

        -
        public int[] array(int[] array)
        -
        Copy values into the specified array. If the specified array is null or - not the same size, a new array will be allocated.
        -
        -
        Parameters:
        -
        array -
        -
        -
      • -
      - - - -
        -
      • -

        getPercent

        -
        public FloatList getPercent()
        -
        Returns a normalized version of this array. Called getPercent() for - consistency with the Dict classes. It's a getter method because it needs - to returns a new list (because IntList/Dict can't do percentages or - normalization in place on int values).
        -
      • -
      - - - -
        -
      • -

        getSubset

        -
        public IntList getSubset(int start)
        -
      • -
      - - - -
        -
      • -

        getSubset

        -
        public IntList getSubset(int start,
        -                         int num)
        -
      • -
      - - - - - - - -
        -
      • -

        print

        -
        public void print()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/data/JSONArray.html b/build/javadoc/everything/processing/data/JSONArray.html deleted file mode 100644 index aaa776b137..0000000000 --- a/build/javadoc/everything/processing/data/JSONArray.html +++ /dev/null @@ -1,1484 +0,0 @@ - - - - - -JSONArray - - - - - - - - - - - -
-
processing.data
-

Class JSONArray

-
-
- -
-
    -
  • -
    -
    -
    public class JSONArray
    -extends Object
    -
    A JSONArray is an ordered sequence of values. Its external text form is a - string wrapped in square brackets with commas separating the values. The - internal form is an object having get and opt - methods for accessing the values by index, and put methods for - adding or replacing values. The values can be any of these types: - Boolean, JSONArray, JSONObject, - Number, String, or the - JSONObject.NULL object. -

    - The constructor can convert a JSON text into a Java object. The - toString method converts to JSON text. -

    - A get method returns a value if one can be found, and throws an - exception if one cannot be found. An opt method returns a - default value instead of throwing an exception, and so is useful for - obtaining optional values. -

    - The generic get() and opt() methods return an - object which you can cast or query for type. There are also typed - get and opt methods that do type checking and type - coercion for you. -

    - The texts produced by the toString methods strictly conform to - JSON syntax rules. The constructors are more forgiving in the texts they will - accept: -

      -
    • An extra , (comma) may appear just - before the closing bracket.
    • -
    • The null value will be inserted when there is , -  (comma) elision.
    • -
    • Strings may be quoted with ' (single - quote).
    • -
    • Strings do not need to be quoted at all if they do not begin with a quote - or single quote, and if they do not contain leading or trailing spaces, and - if they do not contain any of these characters: - { } [ ] / \ : , = ; # and if they do not look like numbers and - if they are not the reserved words true, false, or - null.
    • -
    • Values can be separated by ; (semicolon) as - well as by , (comma).
    • -
    -
    -
    See Also:
    -
    JSONObject, -PApplet.loadJSONObject(String), -PApplet.loadJSONArray(String), -PApplet.saveJSONObject(JSONObject, String), -PApplet.saveJSONArray(JSONArray, String)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JSONArray

        -
        public JSONArray()
        -
        Construct an empty JSONArray.
        -
      • -
      - - - -
        -
      • -

        JSONArray

        -
        public JSONArray(Reader reader)
        -
      • -
      - - - -
        -
      • -

        JSONArray

        -
        public JSONArray(IntList list)
        -
      • -
      - - - -
        -
      • -

        JSONArray

        -
        public JSONArray(FloatList list)
        -
      • -
      - - - -
        -
      • -

        JSONArray

        -
        public JSONArray(StringList list)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        parse

        -
        public static JSONArray parse(String source)
        -
        Construct a JSONArray from a source JSON text.
        -
        -
        Parameters:
        -
        source - A string that begins with - [ (left bracket) - and ends with ] (right bracket).
        -
        Throws:
        -
        JSONException - If there is a syntax error.
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public String getString(int index)
        -
        Get the string associated with an index.
        -
        -
        Parameters:
        -
        index - must be between 0 and length() - 1
        -
        Returns:
        -
        A string value.
        -
        Throws:
        -
        JSONException - If there is no string value for the index.
        -
        See Also:
        -
        getInt(int), -getFloat(int), -getBoolean(int)
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public String getString(int index,
        -                        String defaultValue)
        -
        Get the optional string associated with an index. - The defaultValue is returned if the key is not found.
        -
        -
        Parameters:
        -
        index - The index must be between 0 and length() - 1.
        -
        defaultValue - The default value.
        -
        Returns:
        -
        A String value.
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt(int index)
        -
        Get the int value associated with an index.
        -
        -
        Parameters:
        -
        index - must be between 0 and length() - 1
        -
        Returns:
        -
        The value.
        -
        Throws:
        -
        JSONException - If the key is not found or if the value is not a number.
        -
        See Also:
        -
        getFloat(int), -getString(int), -getBoolean(int)
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt(int index,
        -                  int defaultValue)
        -
        Get the optional int value associated with an index. - The defaultValue is returned if there is no value for the index, - or if the value is not a number and cannot be converted to a number.
        -
        -
        Parameters:
        -
        index - The index must be between 0 and length() - 1.
        -
        defaultValue - The default value.
        -
        Returns:
        -
        The value.
        -
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong(int index)
        -
        Get the long value associated with an index.
        -
        -
        Parameters:
        -
        index - The index must be between 0 and length() - 1
        -
        Returns:
        -
        The value.
        -
        Throws:
        -
        JSONException - If the key is not found or if the value cannot - be converted to a number.
        -
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong(int index,
        -                    long defaultValue)
        -
        Get the optional long value associated with an index. - The defaultValue is returned if there is no value for the index, - or if the value is not a number and cannot be converted to a number.
        -
        -
        Parameters:
        -
        index - The index must be between 0 and length() - 1.
        -
        defaultValue - The default value.
        -
        Returns:
        -
        The value.
        -
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        public float getFloat(int index)
        -
        Get a value from an index as a float. JSON uses 'double' values - internally, so this is simply getDouble() cast to a float.
        -
        -
        Parameters:
        -
        index - must be between 0 and length() - 1
        -
        See Also:
        -
        getInt(int), -getString(int), -getBoolean(int)
        -
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        public float getFloat(int index,
        -                      float defaultValue)
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(int index)
        -
        Get the double value associated with an index.
        -
        -
        Parameters:
        -
        index - must be between 0 and length() - 1
        -
        Returns:
        -
        The value.
        -
        Throws:
        -
        JSONException - If the key is not found or if the value cannot - be converted to a number.
        -
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(int index,
        -                        double defaultValue)
        -
        Get the optional double value associated with an index. - The defaultValue is returned if there is no value for the index, - or if the value is not a number and cannot be converted to a number.
        -
        -
        Parameters:
        -
        index - subscript
        -
        defaultValue - The default value.
        -
        Returns:
        -
        The value.
        -
        -
      • -
      - - - -
        -
      • -

        getBoolean

        -
        public boolean getBoolean(int index)
        -
        Get the boolean value associated with an index. - The string values "true" and "false" are converted to boolean.
        -
        -
        Parameters:
        -
        index - must be between 0 and length() - 1
        -
        Returns:
        -
        The truth.
        -
        Throws:
        -
        JSONException - If there is no value for the index or if the - value is not convertible to boolean.
        -
        See Also:
        -
        getInt(int), -getFloat(int), -getString(int)
        -
        -
      • -
      - - - -
        -
      • -

        getBoolean

        -
        public boolean getBoolean(int index,
        -                          boolean defaultValue)
        -
        Get the optional boolean value associated with an index. - It returns the defaultValue if there is no value at that index or if - it is not a Boolean or the String "true" or "false" (case insensitive).
        -
        -
        Parameters:
        -
        index - The index must be between 0 and length() - 1.
        -
        defaultValue - A boolean default.
        -
        Returns:
        -
        The truth.
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getJSONArray

        -
        public JSONArray getJSONArray(int index,
        -                              JSONArray defaultValue)
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getStringArray

        -
        public String[] getStringArray()
        -
        Get this entire array as a String array.
        -
        -
        See Also:
        -
        getIntArray()
        -
        -
      • -
      - - - -
        -
      • -

        getIntArray

        -
        public int[] getIntArray()
        -
        Get this entire array as an int array. Everything must be an int.
        -
        -
        See Also:
        -
        getStringArray()
        -
        -
      • -
      - - - -
        -
      • -

        getLongArray

        -
        public long[] getLongArray()
        -
        Get this entire array as a long array. Everything must be an long.
        -
      • -
      - - - -
        -
      • -

        getFloatArray

        -
        public float[] getFloatArray()
        -
        Get this entire array as a float array. Everything must be an float.
        -
      • -
      - - - -
        -
      • -

        getDoubleArray

        -
        public double[] getDoubleArray()
        -
        Get this entire array as a double array. Everything must be an double.
        -
      • -
      - - - -
        -
      • -

        getBooleanArray

        -
        public boolean[] getBooleanArray()
        -
        Get this entire array as a boolean array. Everything must be a boolean.
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(String value)
        -
        Append an String value. This increases the array's length by one.
        -
        -
        Parameters:
        -
        value - a String value
        -
        Returns:
        -
        this.
        -
        See Also:
        -
        size(), -remove(int)
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(int value)
        -
        Append an int value. This increases the array's length by one.
        -
        -
        Parameters:
        -
        value - an int value
        -
        Returns:
        -
        this.
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(long value)
        -
        Append an long value. This increases the array's length by one.
        -
        -
        Parameters:
        -
        value - A long value.
        -
        Returns:
        -
        this.
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(float value)
        -
        Append a float value. This increases the array's length by one. - This will store the value as a double, since there are no floats in JSON.
        -
        -
        Parameters:
        -
        value - a float value
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - if the value is not finite.
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(double value)
        -
        Append a double value. This increases the array's length by one.
        -
        -
        Parameters:
        -
        value - A double value.
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - if the value is not finite.
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(boolean value)
        -
        Append a boolean value. This increases the array's length by one.
        -
        -
        Parameters:
        -
        value - a boolean value
        -
        Returns:
        -
        this.
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(JSONArray value)
        -
        -
        Parameters:
        -
        value - a JSONArray value
        -
        -
      • -
      - - - -
        -
      • -

        append

        -
        public JSONArray append(JSONObject value)
        -
        -
        Parameters:
        -
        value - a JSONObject value
        -
        -
      • -
      - - - -
        -
      • -

        setString

        -
        public JSONArray setString(int index,
        -                           String value)
        -
        Put or replace a String value. If the index is greater than the length of - the JSONArray, then null elements will be added as necessary to pad - it out.
        -
        -
        Parameters:
        -
        index - an index value
        -
        value - the value to assign
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - If the index is negative.
        -
        See Also:
        -
        setInt(int, int), -setFloat(int, float), -setBoolean(int, boolean)
        -
        -
      • -
      - - - -
        -
      • -

        setInt

        -
        public JSONArray setInt(int index,
        -                        int value)
        -
        Put or replace an int value. If the index is greater than the length of - the JSONArray, then null elements will be added as necessary to pad - it out.
        -
        -
        Parameters:
        -
        index - an index value
        -
        value - the value to assign
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - If the index is negative.
        -
        See Also:
        -
        setFloat(int, float), -setString(int, String), -setBoolean(int, boolean)
        -
        -
      • -
      - - - -
        -
      • -

        setLong

        -
        public JSONArray setLong(int index,
        -                         long value)
        -
        Put or replace a long value. If the index is greater than the length of - the JSONArray, then null elements will be added as necessary to pad - it out.
        -
        -
        Parameters:
        -
        index - The subscript.
        -
        value - A long value.
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - If the index is negative.
        -
        -
      • -
      - - - -
        -
      • -

        setFloat

        -
        public JSONArray setFloat(int index,
        -                          float value)
        -
        Put or replace a float value. If the index is greater than the length - of the JSONArray, then null elements will be added as necessary to pad - it out. There are no 'double' values in JSON, so this is passed to - setDouble(value).
        -
        -
        Parameters:
        -
        index - an index value
        -
        value - the value to assign
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        RuntimeException - If the index is negative or if the value is - not finite.
        -
        See Also:
        -
        setInt(int, int), -setString(int, String), -setBoolean(int, boolean)
        -
        -
      • -
      - - - -
        -
      • -

        setDouble

        -
        public JSONArray setDouble(int index,
        -                           double value)
        -
        Put or replace a double value. If the index is greater than the length of - the JSONArray, then null elements will be added as necessary to pad - it out.
        -
        -
        Parameters:
        -
        index - The subscript.
        -
        value - A double value.
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - If the index is negative or if the value is - not finite.
        -
        -
      • -
      - - - -
        -
      • -

        setBoolean

        -
        public JSONArray setBoolean(int index,
        -                            boolean value)
        -
        Put or replace a boolean value in the JSONArray. If the index is greater - than the length of the JSONArray, then null elements will be added as - necessary to pad it out.
        -
        -
        Parameters:
        -
        index - an index value
        -
        value - the value to assign
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - If the index is negative.
        -
        See Also:
        -
        setInt(int, int), -setFloat(int, float), -setString(int, String)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        size

        -
        public int size()
        -
        Get the number of elements in the JSONArray, included nulls.
        -
        -
        Returns:
        -
        The length (or size).
        -
        See Also:
        -
        append(String), -remove(int)
        -
        -
      • -
      - - - -
        -
      • -

        isNull

        -
        public boolean isNull(int index)
        -
        Determine if the value is null.
        -
        -
        Parameters:
        -
        index - must be between 0 and length() - 1
        -
        Returns:
        -
        true if the value at the index is null, or if there is no value.
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public Object remove(int index)
        -
        Remove an index and close the hole.
        -
        -
        Parameters:
        -
        index - the index value of the element to be removed
        -
        Returns:
        -
        The value that was associated with the index, or null if there was no value.
        -
        See Also:
        -
        size(), -append(String)
        -
        -
      • -
      - - - -
        -
      • -

        save

        -
        public boolean save(File file,
        -                    String options)
        -
      • -
      - - - -
        -
      • -

        write

        -
        public boolean write(PrintWriter output)
        -
      • -
      - - - - - - - -
        -
      • -

        toString

        -
        public String toString()
        -
        Return the JSON data formatted with two spaces for indents. - Chosen to do this since it's the most common case (e.g. with println()). - Same as format(2). Use the format() function for more options.
        -
        -
        Overrides:
        -
        toString in class Object
        -
        -
      • -
      - - - -
        -
      • -

        format

        -
        public String format(int indentFactor)
        -
        Make a pretty-printed JSON text of this JSONArray. - Warning: This method assumes that the data structure is acyclical.
        -
        -
        Parameters:
        -
        indentFactor - The number of spaces to add to each level of - indentation. Use -1 to specify no indentation and no newlines.
        -
        Returns:
        -
        a printable, displayable, transmittable - representation of the object, beginning - with [ (left bracket) and ending - with ] (right bracket).
        -
        -
      • -
      - - - -
        -
      • -

        join

        -
        public String join(String separator)
        -
        Make a string from the contents of this JSONArray. The - separator string is inserted between each element. - Warning: This method assumes that the data structure is acyclic.
        -
        -
        Parameters:
        -
        separator - A string that will be inserted between the elements.
        -
        Returns:
        -
        a string.
        -
        Throws:
        -
        JSONException - If the array contains an invalid number.
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/data/JSONObject.html b/build/javadoc/everything/processing/data/JSONObject.html deleted file mode 100644 index 96cab568ea..0000000000 --- a/build/javadoc/everything/processing/data/JSONObject.html +++ /dev/null @@ -1,1236 +0,0 @@ - - - - - -JSONObject - - - - - - - - - - - -
-
processing.data
-

Class JSONObject

-
-
-
    -
  • Object
  • -
  • -
      -
    • JSONObject
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class JSONObject
    -extends Object
    -
    A JSONObject is an unordered collection of name/value pairs. Its external - form is a string wrapped in curly braces with colons between the names and - values, and commas between the values and names. The internal form is an - object having get and opt methods for accessing the - values by name, and put methods for adding or replacing values - by name. The values can be any of these types: Boolean, - JSONArray, JSONObject, Number, - String, or the JSONObject.NULL object. A JSONObject - constructor can be used to convert an external form JSON text into an - internal form whose values can be retrieved with the get and - opt methods, or to convert values into a JSON text using the - put and toString methods. A get method - returns a value if one can be found, and throws an exception if one cannot be - found. An opt method returns a default value instead of throwing - an exception, and so is useful for obtaining optional values. -

    - The generic get() and opt() methods return an - object, which you can cast or query for type. There are also typed - get and opt methods that do type checking and type - coercion for you. The opt methods differ from the get methods in that they do - not throw. Instead, they return a specified value, such as null. -

    - The put methods add or replace values in an object. For example, - -

    - myString = new JSONObject().put("JSON", "Hello, World!").toString();
    - 
    - - produces the string {"JSON": "Hello, World"}. -

    - The texts produced by the toString methods strictly conform to - the JSON syntax rules. The constructors are more forgiving in the texts they - will accept: -

      -
    • An extra , (comma) may appear just - before the closing brace.
    • -
    • Strings may be quoted with ' (single - quote).
    • -
    • Strings do not need to be quoted at all if they do not begin with a quote - or single quote, and if they do not contain leading or trailing spaces, and - if they do not contain any of these characters: - { } [ ] / \ : , = ; # and if they do not look like numbers and - if they are not the reserved words true, false, or - null.
    • -
    • Keys can be followed by = or => as well as by - :.
    • -
    • Values can be followed by ; (semicolon) as - well as by , (comma).
    • -
    -
    -
    See Also:
    -
    JSONArray, -PApplet.loadJSONObject(String), -PApplet.loadJSONArray(String), -PApplet.saveJSONObject(JSONObject, String), -PApplet.saveJSONArray(JSONArray, String)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        NULL

        -
        public static final Object NULL
        -
        It is sometimes more convenient and less ambiguous to have a - NULL object than to use Java's null value. - JSONObject.NULL.equals(null) returns true. - JSONObject.NULL.toString() returns "null".
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JSONObject

        -
        public JSONObject()
        -
        Construct an empty JSONObject.
        -
      • -
      - - - -
        -
      • -

        JSONObject

        -
        public JSONObject(Reader reader)
        -
      • -
      - - - -
        -
      • -

        JSONObject

        -
        public JSONObject(IntDict dict)
        -
      • -
      - - - -
        -
      • -

        JSONObject

        -
        public JSONObject(FloatDict dict)
        -
      • -
      - - - -
        -
      • -

        JSONObject

        -
        public JSONObject(StringDict dict)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        parse

        -
        public static JSONObject parse(String source)
        -
        Construct a JSONObject from a source JSON text string. - This is the most commonly used JSONObject constructor.
        -
        -
        Parameters:
        -
        source - A string beginning - with { (left brace) and ending - with } (right brace).
        -
        Throws:
        -
        JSONException - If there is a syntax error in the source - string or a duplicated key.
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public String getString(String key)
        -
        Gets the String associated with a key
        -
        -
        Parameters:
        -
        key - a key string
        -
        Returns:
        -
        A string which is the value.
        -
        Throws:
        -
        JSONException - if there is no string value for the key.
        -
        See Also:
        -
        getInt(String), -getFloat(String), -getBoolean(String)
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public String getString(String key,
        -                        String defaultValue)
        -
        Get an optional string associated with a key. - It returns the defaultValue if there is no such key.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        defaultValue - The default.
        -
        Returns:
        -
        A string which is the value.
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt(String key)
        -
        Gets the int value associated with a key
        -
        -
        Parameters:
        -
        key - a key string
        -
        Returns:
        -
        The integer value.
        -
        Throws:
        -
        JSONException - if the key is not found or if the value cannot - be converted to an integer.
        -
        See Also:
        -
        getFloat(String), -getString(String), -getBoolean(String)
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt(String key,
        -                  int defaultValue)
        -
        Get an optional int value associated with a key, - or the default if there is no such key or if the value is not a number. - If the value is a string, an attempt will be made to evaluate it as - a number.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        defaultValue - The default.
        -
        Returns:
        -
        An object which is the value.
        -
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong(String key)
        -
        Get the long value associated with a key.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        Returns:
        -
        The long value.
        -
        Throws:
        -
        JSONException - if the key is not found or if the value cannot - be converted to a long.
        -
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong(String key,
        -                    long defaultValue)
        -
        Get an optional long value associated with a key, - or the default if there is no such key or if the value is not a number. - If the value is a string, an attempt will be made to evaluate it as - a number.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        defaultValue - The default.
        -
        Returns:
        -
        An object which is the value.
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getFloat

        -
        public float getFloat(String key,
        -                      float defaultValue)
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(String key)
        -
        Get the double value associated with a key.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        Returns:
        -
        The numeric value.
        -
        Throws:
        -
        JSONException - if the key is not found or - if the value is not a Number object and cannot be converted to a number.
        -
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(String key,
        -                        double defaultValue)
        -
        Get an optional double associated with a key, or the - defaultValue if there is no such key or if its value is not a number. - If the value is a string, an attempt will be made to evaluate it as - a number.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        defaultValue - The default.
        -
        Returns:
        -
        An object which is the value.
        -
        -
      • -
      - - - -
        -
      • -

        getBoolean

        -
        public boolean getBoolean(String key)
        -
        Get the boolean value associated with a key.
        -
        -
        Parameters:
        -
        key - a key string
        -
        Returns:
        -
        The truth.
        -
        Throws:
        -
        JSONException - if the value is not a Boolean or the String "true" or "false".
        -
        See Also:
        -
        getInt(String), -getFloat(String), -getString(String)
        -
        -
      • -
      - - - -
        -
      • -

        getBoolean

        -
        public boolean getBoolean(String key,
        -                          boolean defaultValue)
        -
        Get an optional boolean associated with a key. - It returns the defaultValue if there is no such key, or if it is not - a Boolean or the String "true" or "false" (case insensitive).
        -
        -
        Parameters:
        -
        key - A key string.
        -
        defaultValue - The default.
        -
        Returns:
        -
        The truth.
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        hasKey

        -
        public boolean hasKey(String key)
        -
        Determine if the JSONObject contains a specific key.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        Returns:
        -
        true if the key exists in the JSONObject.
        -
        -
      • -
      - - - -
        -
      • -

        isNull

        -
        public boolean isNull(String key)
        -
        Determine if the value associated with the key is null or if there is - no value.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        Returns:
        -
        true if there is no value associated with the key or if - the value is the JSONObject.NULL object.
        -
        -
      • -
      - - - -
        -
      • -

        keyIterator

        -
        public Iterator keyIterator()
        -
        Get an enumeration of the keys of the JSONObject.
        -
        -
        Returns:
        -
        An iterator of the keys.
        -
        -
      • -
      - - - -
        -
      • -

        keys

        -
        public Set keys()
        -
        Get a set of keys of the JSONObject.
        -
        -
        Returns:
        -
        A keySet.
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
        Get the number of keys stored in the JSONObject.
        -
        -
        Returns:
        -
        The number of keys in the JSONObject.
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        setLong

        -
        public JSONObject setLong(String key,
        -                          long value)
        -
        Put a key/long pair in the JSONObject.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        value - A long which is the value.
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - If the key is null.
        -
        -
      • -
      - - - - - - - -
        -
      • -

        setDouble

        -
        public JSONObject setDouble(String key,
        -                            double value)
        -
        Put a key/double pair in the JSONObject.
        -
        -
        Parameters:
        -
        key - A key string.
        -
        value - A double which is the value.
        -
        Returns:
        -
        this.
        -
        Throws:
        -
        JSONException - If the key is null or if the number is invalid.
        -
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        remove

        -
        public Object remove(String key)
        -
        Remove a name and its value, if present.
        -
        -
        Parameters:
        -
        key - The name to be removed.
        -
        Returns:
        -
        The value that was associated with the name, - or null if there was no value.
        -
        -
      • -
      - - - -
        -
      • -

        save

        -
        public boolean save(File file,
        -                    String options)
        -
      • -
      - - - -
        -
      • -

        write

        -
        public boolean write(PrintWriter output)
        -
      • -
      - - - - - - - -
        -
      • -

        toString

        -
        public String toString()
        -
        Return the JSON data formatted with two spaces for indents. - Chosen to do this since it's the most common case (e.g. with println()). - Same as format(2). Use the format() function for more options.
        -
        -
        Overrides:
        -
        toString in class Object
        -
        -
      • -
      - - - -
        -
      • -

        format

        -
        public String format(int indentFactor)
        -
        Make a prettyprinted JSON text of this JSONObject. -

        - Warning: This method assumes that the data structure is acyclical.

        -
        -
        Parameters:
        -
        indentFactor - The number of spaces to add to each level of - indentation.
        -
        Returns:
        -
        a printable, displayable, portable, transmittable - representation of the object, beginning - with { (left brace) and ending - with } (right brace).
        -
        Throws:
        -
        JSONException - If the object contains an invalid number.
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/data/Sort.html b/build/javadoc/everything/processing/data/Sort.html deleted file mode 100644 index 0f6faf77db..0000000000 --- a/build/javadoc/everything/processing/data/Sort.html +++ /dev/null @@ -1,322 +0,0 @@ - - - - - -Sort - - - - - - - - - - - -
-
processing.data
-

Class Sort

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Runnable
    -
    -
    -
    -
    public abstract class Sort
    -extends Object
    -implements Runnable
    -
    Internal sorter used by several data classes. - Advanced users only, not official API.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Sort

        -
        public Sort()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        run

        -
        public void run()
        -
        -
        Specified by:
        -
        run in interface Runnable
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public abstract int size()
        -
      • -
      - - - -
        -
      • -

        compare

        -
        public abstract float compare(int a,
        -                              int b)
        -
      • -
      - - - -
        -
      • -

        swap

        -
        public abstract void swap(int a,
        -                          int b)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/data/StringDict.html b/build/javadoc/everything/processing/data/StringDict.html deleted file mode 100644 index 172010b26a..0000000000 --- a/build/javadoc/everything/processing/data/StringDict.html +++ /dev/null @@ -1,714 +0,0 @@ - - - - - -StringDict - - - - - - - - - - - -
-
processing.data
-

Class StringDict

-
-
-
    -
  • Object
  • -
  • -
      -
    • StringDict
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class StringDict
    -extends Object
    -
    A simple table class to use a String as a lookup for another String value.
    -
    -
    See Also:
    -
    IntDict, -FloatDict
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        StringDict

        -
        public StringDict()
        -
      • -
      - - - -
        -
      • -

        StringDict

        -
        public StringDict(int length)
        -
        Create a new lookup pre-allocated to a specific length. This will not - change the size(), but is more efficient than not specifying a length. - Use it when you know the rough size of the thing you're creating.
        -
      • -
      - - - -
        -
      • -

        StringDict

        -
        public StringDict(BufferedReader reader)
        -
        Read a set of entries from a Reader that has each key/value pair on - a single line, separated by a tab.
        -
      • -
      - - - -
        -
      • -

        StringDict

        -
        public StringDict(String[] keys,
        -                  String[] values)
        -
      • -
      - - - -
        -
      • -

        StringDict

        -
        public StringDict(String[][] pairs)
        -
        Constructor to allow (more intuitive) inline initialization, e.g.: -
        - new StringDict(new String[][] {
        -   { "key1", "value1" },
        -   { "key2", "value2" }
        - });
        - 
        - It's no Python, but beats a static { } block with HashMap.put() statements.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        size

        -
        public int size()
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        Remove all entries.
        -
      • -
      - - - -
        -
      • -

        key

        -
        public String key(int index)
        -
      • -
      - - - - - - - -
        -
      • -

        keyArray

        -
        public String[] keyArray()
        -
        Return a copy of the internal keys array. This array can be modified.
        -
      • -
      - - - -
        -
      • -

        keyArray

        -
        public String[] keyArray(String[] outgoing)
        -
      • -
      - - - -
        -
      • -

        value

        -
        public String value(int index)
        -
      • -
      - - - - - - - -
        -
      • -

        valueArray

        -
        public String[] valueArray()
        -
        Create a new array and copy each of the values into it.
        -
      • -
      - - - -
        -
      • -

        valueArray

        -
        public String[] valueArray(String[] array)
        -
        Fill an already-allocated array with the values (more efficient than - creating a new array each time). If 'array' is null, or not the same - size as the number of values, a new array will be allocated and returned.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public String get(String key)
        -
        Return a value for the specified key.
        -
      • -
      - - - - - - - -
        -
      • -

        set

        -
        public void set(String key,
        -                String value)
        -
      • -
      - - - -
        -
      • -

        index

        -
        public int index(String what)
        -
      • -
      - - - -
        -
      • -

        hasKey

        -
        public boolean hasKey(String key)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public int remove(String key)
        -
      • -
      - - - -
        -
      • -

        removeIndex

        -
        public String removeIndex(int index)
        -
      • -
      - - - -
        -
      • -

        swap

        -
        public void swap(int a,
        -                 int b)
        -
      • -
      - - - -
        -
      • -

        sortKeys

        -
        public void sortKeys()
        -
        Sort the keys alphabetically (ignoring case). Uses the value as a - tie-breaker (only really possible with a key that has a case change).
        -
      • -
      - - - -
        -
      • -

        sortKeysReverse

        -
        public void sortKeysReverse()
        -
      • -
      - - - -
        -
      • -

        sortValues

        -
        public void sortValues()
        -
        Sort by values in descending order (largest value will be at [0]).
        -
      • -
      - - - -
        -
      • -

        sortValuesReverse

        -
        public void sortValuesReverse()
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public StringDict copy()
        -
        Returns a duplicate copy of this object.
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write(PrintWriter writer)
        -
        Write tab-delimited entries out to
        -
        -
        Parameters:
        -
        writer -
        -
        -
      • -
      - - - -
        -
      • -

        print

        -
        public void print()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/data/StringList.html b/build/javadoc/everything/processing/data/StringList.html deleted file mode 100644 index 6ed43cf785..0000000000 --- a/build/javadoc/everything/processing/data/StringList.html +++ /dev/null @@ -1,969 +0,0 @@ - - - - - -StringList - - - - - - - - - - - -
-
processing.data
-

Class StringList

-
-
-
    -
  • Object
  • -
  • -
      -
    • StringList
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Iterable<String>
    -
    -
    -
    -
    public class StringList
    -extends Object
    -implements Iterable<String>
    -
    Helper class for a list of Strings. Lists are designed to have some of the - features of ArrayLists, but to maintain the simplicity and efficiency of - working with arrays. - - Functions like sort() and shuffle() always act on the list itself. To get - a sorted copy, use list.copy().sort().
    -
    -
    See Also:
    -
    IntList, -FloatList
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        StringList

        -
        public StringList()
        -
      • -
      - - - -
        -
      • -

        StringList

        -
        public StringList(int length)
        -
      • -
      - - - -
        -
      • -

        StringList

        -
        public StringList(String[] list)
        -
      • -
      - - - -
        -
      • -

        StringList

        -
        public StringList(Object... items)
        -
        Construct a StringList from a random pile of objects. Null values will - stay null, but all the others will be converted to String values.
        -
      • -
      - - - -
        -
      • -

        StringList

        -
        public StringList(Iterable<String> iter)
        -
        Create from something iterable, for instance: - StringList list = new StringList(hashMap.keySet());
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        size

        -
        public int size()
        -
        Get the length of the list.
        -
      • -
      - - - -
        -
      • -

        resize

        -
        public void resize(int length)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        Remove all entries from the list.
        -
      • -
      - - - -
        -
      • -

        get

        -
        public String get(int index)
        -
        Get an entry at a particular index.
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int index,
        -                String what)
        -
        Set the entry at a particular index. If the index is past the length of - the list, it'll expand the list to accommodate, and fill the intermediate - entries with 0s.
        -
      • -
      - - - -
        -
      • -

        push

        -
        public void push(String value)
        -
        Just an alias for append(), but matches pop()
        -
      • -
      - - - -
        -
      • -

        pop

        -
        public String pop()
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public String remove(int index)
        -
        Remove an element from the specified index.
        -
      • -
      - - - -
        -
      • -

        removeValue

        -
        public int removeValue(String value)
        -
      • -
      - - - -
        -
      • -

        removeValues

        -
        public int removeValues(String value)
        -
      • -
      - - - -
        -
      • -

        replaceValue

        -
        public int replaceValue(String value,
        -                        String newValue)
        -
      • -
      - - - -
        -
      • -

        replaceValues

        -
        public int replaceValues(String value,
        -                         String newValue)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(String value)
        -
        Add a new entry to the list.
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(String[] values)
        -
      • -
      - - - -
        -
      • -

        append

        -
        public void append(StringList list)
        -
      • -
      - - - -
        -
      • -

        appendUnique

        -
        public void appendUnique(String value)
        -
        Add this value, but only if it's not already in the list.
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   String value)
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   String[] values)
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public void insert(int index,
        -                   StringList list)
        -
      • -
      - - - -
        -
      • -

        index

        -
        public int index(String what)
        -
        Return the first index of a particular value.
        -
      • -
      - - - -
        -
      • -

        hasValue

        -
        public boolean hasValue(String value)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public void sort()
        -
        Sorts the array in place.
        -
      • -
      - - - -
        -
      • -

        sortReverse

        -
        public void sortReverse()
        -
        Reverse sort, orders values from highest to lowest.
        -
      • -
      - - - -
        -
      • -

        reverse

        -
        public void reverse()
        -
      • -
      - - - -
        -
      • -

        shuffle

        -
        public void shuffle()
        -
        Randomize the order of the list elements. Note that this does not - obey the randomSeed() function in PApplet.
        -
      • -
      - - - -
        -
      • -

        shuffle

        -
        public void shuffle(PApplet sketch)
        -
        Randomize the list order using the random() function from the specified - sketch, allowing shuffle() to use its current randomSeed() setting.
        -
      • -
      - - - -
        -
      • -

        lower

        -
        public void lower()
        -
        Make the entire list lower case.
        -
      • -
      - - - -
        -
      • -

        upper

        -
        public void upper()
        -
        Make the entire list upper case.
        -
      • -
      - - - - - - - -
        -
      • -

        values

        -
        public String[] values()
        -
        Returns the actual array being used to store the data. Suitable for - iterating with a for() loop, but modifying the list could cause terrible - things to happen.
        -
      • -
      - - - - - - - -
        -
      • -

        array

        -
        public String[] array()
        -
        Create a new array with a copy of all the values.
        -
        -
        Returns:
        -
        an array sized by the length of the list with each of the values.
        -
        -
      • -
      - - - -
        -
      • -

        array

        -
        public String[] array(String[] array)
        -
        Copy values into the specified array. If the specified array is null or - not the same size, a new array will be allocated.
        -
        -
        Parameters:
        -
        array -
        -
        -
      • -
      - - - -
        -
      • -

        getSubset

        -
        public StringList getSubset(int start)
        -
      • -
      - - - -
        -
      • -

        getSubset

        -
        public StringList getSubset(int start,
        -                            int num)
        -
      • -
      - - - -
        -
      • -

        getUnique

        -
        public String[] getUnique()
        -
        Get a list of all unique entries.
        -
      • -
      - - - -
        -
      • -

        getTally

        -
        public IntDict getTally()
        -
        Count the number of times each String entry is found in this list.
        -
      • -
      - - - -
        -
      • -

        getOrder

        -
        public IntDict getOrder()
        -
        Create a dictionary associating each entry in this list to its index.
        -
      • -
      - - - - - - - -
        -
      • -

        print

        -
        public void print()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/data/Table.html b/build/javadoc/everything/processing/data/Table.html deleted file mode 100644 index 46a11811b4..0000000000 --- a/build/javadoc/everything/processing/data/Table.html +++ /dev/null @@ -1,3020 +0,0 @@ - - - - - -Table - - - - - - - - - - - -
-
processing.data
-

Class Table

-
-
- -
-
    -
  • -
    -
    -
    public class Table
    -extends Object
    -

    Generic class for handling tabular data, typically from a CSV, TSV, or - other sort of spreadsheet file.

    -

    CSV files are - comma separated values, - often with the data in quotes. TSV files use tabs as separators, and usually - don't bother with the quotes.

    -

    File names should end with .csv if they're comma separated.

    -

    A rough "spec" for CSV can be found here.

    -
    -
    See Also:
    -
    PApplet.loadTable(String), -PApplet.saveTable(Table, String), -TableRow
    -
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Table

        -
        public Table()
        -
        Creates a new, empty table. Use addRow() to add additional rows.
        -
      • -
      - - - - - - - -
        -
      • -

        Table

        -
        public Table(File file,
        -             String options)
        -      throws IOException
        -
        version that uses a File object; future releases (or data types) - may include additional optimizations here
        -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        Table

        -
        public Table(InputStream input,
        -             String options)
        -      throws IOException
        -
        Read the table from a stream. Possible options include: -
          -
        • csv - parse the table as comma-separated values -
        • tsv - parse the table as tab-separated values -
        • newlines - this CSV file contains newlines inside individual cells -
        • header - this table has a header (title) row -
        -
        -
        Parameters:
        -
        input -
        -
        options -
        -
        Throws:
        -
        IOException
        -
        -
      • -
      - - - - - - - - -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        extensionOptions

        -
        public static String extensionOptions(boolean loading,
        -                                      String filename,
        -                                      String options)
        -
      • -
      - - - -
        -
      • -

        parseInto

        -
        public void parseInto(Object enclosingObject,
        -                      String fieldName)
        -
        incomplete, do not use
        -
      • -
      - - - - - - - - - - - - - - - -
        -
      • -

        addColumn

        -
        public void addColumn(String title)
        -
        -
        Parameters:
        -
        title - the title to be used for the new column
        -
        -
      • -
      - - - -
        -
      • -

        addColumn

        -
        public void addColumn(String title,
        -                      int type)
        -
        -
        Parameters:
        -
        type - the type to be used for the new column: INT, LONG, FLOAT, DOUBLE, STRING, or CATEGORY
        -
        -
      • -
      - - - -
        -
      • -

        insertColumn

        -
        public void insertColumn(int index)
        -
      • -
      - - - -
        -
      • -

        insertColumn

        -
        public void insertColumn(int index,
        -                         String title)
        -
      • -
      - - - -
        -
      • -

        insertColumn

        -
        public void insertColumn(int index,
        -                         String title,
        -                         int type)
        -
      • -
      - - - -
        -
      • -

        removeColumn

        -
        public void removeColumn(String columnName)
        -
        -
        Parameters:
        -
        columnName - the title of the column to be removed
        -
        See Also:
        -
        addColumn()
        -
        -
      • -
      - - - -
        -
      • -

        removeColumn

        -
        public void removeColumn(int column)
        -
        -
        Parameters:
        -
        column - the index number of the column to be removed
        -
        -
      • -
      - - - -
        -
      • -

        getColumnCount

        -
        public int getColumnCount()
        -
        -
        See Also:
        -
        getRowCount()
        -
        -
      • -
      - - - -
        -
      • -

        setColumnCount

        -
        public void setColumnCount(int newCount)
        -
        Change the number of columns in this table. Resizes all rows to ensure - the same number of columns in each row. Entries in the additional (empty) - columns will be set to null.
        -
        -
        Parameters:
        -
        newCount -
        -
        -
      • -
      - - - -
        -
      • -

        setColumnType

        -
        public void setColumnType(String columnName,
        -                          String columnType)
        -
      • -
      - - - -
        -
      • -

        setColumnType

        -
        public void setColumnType(int column,
        -                          String columnType)
        -
        Set the data type for a column so that using it is more efficient.
        -
        -
        Parameters:
        -
        column - the column to change
        -
        columnType - One of int, long, float, double, string, or category.
        -
        -
      • -
      - - - -
        -
      • -

        setColumnType

        -
        public void setColumnType(String columnName,
        -                          int newType)
        -
      • -
      - - - -
        -
      • -

        setColumnType

        -
        public void setColumnType(int column,
        -                          int newType)
        -
        Sets the column type. If data already exists, then it'll be converted to - the new type.
        -
        -
        Parameters:
        -
        column - the column whose type should be changed
        -
        newType - something fresh, maybe try an int or a float for size?
        -
        -
      • -
      - - - -
        -
      • -

        setTableType

        -
        public void setTableType(String type)
        -
        Set the entire table to a specific data type.
        -
      • -
      - - - -
        -
      • -

        setColumnTypes

        -
        public void setColumnTypes(int[] types)
        -
      • -
      - - - -
        -
      • -

        setColumnTypes

        -
        public void setColumnTypes(Table dictionary)
        -
        Set the titles (and if a second column is present) the data types for - this table based on a file loaded separately. This will look for the - title in column 0, and the type in column 1. Better yet, specify a - column named "title" and another named "type" in the dictionary table - to future-proof the code.
        -
        -
        Parameters:
        -
        dictionary -
        -
        -
      • -
      - - - -
        -
      • -

        getColumnType

        -
        public int getColumnType(String columnName)
        -
      • -
      - - - -
        -
      • -

        getColumnType

        -
        public int getColumnType(int column)
        -
        Returns one of Table.STRING, Table.INT, etc...
        -
      • -
      - - - -
        -
      • -

        getColumnTypes

        -
        public int[] getColumnTypes()
        -
      • -
      - - - -
        -
      • -

        removeTitleRow

        -
        @Deprecated
        -public String[] removeTitleRow()
        -
        Deprecated. 
        -
        Remove the first row from the data set, and use it as the column titles. - Use loadTable("table.csv", "header") instead.
        -
      • -
      - - - -
        -
      • -

        setColumnTitles

        -
        public void setColumnTitles(String[] titles)
        -
      • -
      - - - -
        -
      • -

        setColumnTitle

        -
        public void setColumnTitle(int column,
        -                           String title)
        -
      • -
      - - - -
        -
      • -

        hasColumnTitles

        -
        public boolean hasColumnTitles()
        -
      • -
      - - - -
        -
      • -

        getColumnTitles

        -
        public String[] getColumnTitles()
        -
      • -
      - - - -
        -
      • -

        getColumnTitle

        -
        public String getColumnTitle(int col)
        -
      • -
      - - - -
        -
      • -

        getColumnIndex

        -
        public int getColumnIndex(String columnName)
        -
      • -
      - - - -
        -
      • -

        checkColumnIndex

        -
        public int checkColumnIndex(String title)
        -
        Same as getColumnIndex(), but creates the column if it doesn't exist. - Named this way to not conflict with checkColumn(), an internal function - used to ensure that a columns exists, and also to denote that it returns - an int for the column index.
        -
        -
        Parameters:
        -
        title - column title
        -
        Returns:
        -
        index of a new or previously existing column
        -
        -
      • -
      - - - -
        -
      • -

        getRowCount

        -
        public int getRowCount()
        -
        -
        See Also:
        -
        getColumnCount()
        -
        -
      • -
      - - - -
        -
      • -

        lastRowIndex

        -
        public int lastRowIndex()
        -
      • -
      - - - - - - - -
        -
      • -

        setRowCount

        -
        public void setRowCount(int newCount)
        -
      • -
      - - - - - - - -
        -
      • -

        addRow

        -
        public TableRow addRow(TableRow source)
        -
        -
        Parameters:
        -
        source - a reference to the original row to be duplicated
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        addRows

        -
        public void addRows(Table source)
        -
      • -
      - - - -
        -
      • -

        insertRow

        -
        public void insertRow(int insert,
        -                      Object[] columnData)
        -
      • -
      - - - -
        -
      • -

        removeRow

        -
        public void removeRow(int row)
        -
        -
        Parameters:
        -
        row - ID number of the row to remove
        -
        See Also:
        -
        addRow(), -clearRows()
        -
        -
      • -
      - - - -
        -
      • -

        setRow

        -
        public void setRow(int row,
        -                   Object[] pieces)
        -
      • -
      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        getInt

        -
        public int getInt(int row,
        -                  String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to reference
        -
        -
      • -
      - - - -
        -
      • -

        setMissingInt

        -
        public void setMissingInt(int value)
        -
      • -
      - - - - - - - -
        -
      • -

        setInt

        -
        public void setInt(int row,
        -                   String columnName,
        -                   int value)
        -
        -
        Parameters:
        -
        columnName - title of the target column
        -
        -
      • -
      - - - -
        -
      • -

        getIntColumn

        -
        public int[] getIntColumn(String name)
        -
      • -
      - - - -
        -
      • -

        getIntColumn

        -
        public int[] getIntColumn(int col)
        -
      • -
      - - - -
        -
      • -

        getIntRow

        -
        public int[] getIntRow(int row)
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong(int row,
        -                    int column)
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong(int row,
        -                    String columnName)
        -
      • -
      - - - -
        -
      • -

        setMissingLong

        -
        public void setMissingLong(long value)
        -
      • -
      - - - -
        -
      • -

        setLong

        -
        public void setLong(int row,
        -                    int column,
        -                    long value)
        -
      • -
      - - - -
        -
      • -

        setLong

        -
        public void setLong(int row,
        -                    String columnName,
        -                    long value)
        -
      • -
      - - - -
        -
      • -

        getLongColumn

        -
        public long[] getLongColumn(String name)
        -
      • -
      - - - -
        -
      • -

        getLongColumn

        -
        public long[] getLongColumn(int col)
        -
      • -
      - - - -
        -
      • -

        getLongRow

        -
        public long[] getLongRow(int row)
        -
      • -
      - - - - - - - -
        -
      • -

        getFloat

        -
        public float getFloat(int row,
        -                      String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to reference
        -
        -
      • -
      - - - -
        -
      • -

        setMissingFloat

        -
        public void setMissingFloat(float value)
        -
      • -
      - - - - - - - -
        -
      • -

        setFloat

        -
        public void setFloat(int row,
        -                     String columnName,
        -                     float value)
        -
        -
        Parameters:
        -
        columnName - title of the target column
        -
        -
      • -
      - - - -
        -
      • -

        getFloatColumn

        -
        public float[] getFloatColumn(String name)
        -
      • -
      - - - -
        -
      • -

        getFloatColumn

        -
        public float[] getFloatColumn(int col)
        -
      • -
      - - - -
        -
      • -

        getFloatRow

        -
        public float[] getFloatRow(int row)
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(int row,
        -                        int column)
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(int row,
        -                        String columnName)
        -
      • -
      - - - -
        -
      • -

        setMissingDouble

        -
        public void setMissingDouble(double value)
        -
      • -
      - - - -
        -
      • -

        setDouble

        -
        public void setDouble(int row,
        -                      int column,
        -                      double value)
        -
      • -
      - - - -
        -
      • -

        setDouble

        -
        public void setDouble(int row,
        -                      String columnName,
        -                      double value)
        -
      • -
      - - - -
        -
      • -

        getDoubleColumn

        -
        public double[] getDoubleColumn(String name)
        -
      • -
      - - - -
        -
      • -

        getDoubleColumn

        -
        public double[] getDoubleColumn(int col)
        -
      • -
      - - - -
        -
      • -

        getDoubleRow

        -
        public double[] getDoubleRow(int row)
        -
      • -
      - - - - - - - -
        -
      • -

        getString

        -
        public String getString(int row,
        -                        String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to reference
        -
        -
      • -
      - - - -
        -
      • -

        setMissingString

        -
        public void setMissingString(String value)
        -
        Treat entries with this string as "missing". Also used for categorial.
        -
      • -
      - - - - - - - -
        -
      • -

        setString

        -
        public void setString(int row,
        -                      String columnName,
        -                      String value)
        -
        -
        Parameters:
        -
        columnName - title of the target column
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getStringColumn

        -
        public String[] getStringColumn(int column)
        -
        -
        Parameters:
        -
        column - ID number of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        getStringRow

        -
        public String[] getStringRow(int row)
        -
      • -
      - - - -
        -
      • -

        findRowIndex

        -
        public int findRowIndex(String value,
        -                        int column)
        -
        Return the row that contains the first String that matches.
        -
        -
        Parameters:
        -
        value - the String to match
        -
        column - ID number of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        findRowIndex

        -
        public int findRowIndex(String value,
        -                        String columnName)
        -
        Return the row that contains the first String that matches.
        -
        -
        Parameters:
        -
        value - the String to match
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        findRowIndices

        -
        public int[] findRowIndices(String value,
        -                            int column)
        -
        Return a list of rows that contain the String passed in. If there are no - matches, a zero length array will be returned (not a null array).
        -
        -
        Parameters:
        -
        value - the String to match
        -
        column - ID number of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        findRowIndices

        -
        public int[] findRowIndices(String value,
        -                            String columnName)
        -
        Return a list of rows that contain the String passed in. If there are no - matches, a zero length array will be returned (not a null array).
        -
        -
        Parameters:
        -
        value - the String to match
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - - - - - -
        -
      • -

        findRow

        -
        public TableRow findRow(String value,
        -                        String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - - - - - -
        -
      • -

        findRows

        -
        public Iterable<TableRow> findRows(String value,
        -                                   String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        findRowIterator

        -
        public Iterator<TableRow> findRowIterator(String value,
        -                                          int column)
        -
        -
        Parameters:
        -
        value - the value to match
        -
        column - ID number of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        findRowIterator

        -
        public Iterator<TableRow> findRowIterator(String value,
        -                                          String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        matchRowIndex

        -
        public int matchRowIndex(String regexp,
        -                         int column)
        -
        Return the row that contains the first String that matches.
        -
        -
        Parameters:
        -
        regexp - the String to match
        -
        column - ID number of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        matchRowIndex

        -
        public int matchRowIndex(String what,
        -                         String columnName)
        -
        Return the row that contains the first String that matches.
        -
        -
        Parameters:
        -
        what - the String to match
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        matchRowIndices

        -
        public int[] matchRowIndices(String regexp,
        -                             int column)
        -
        Return a list of rows that contain the String passed in. If there are no - matches, a zero length array will be returned (not a null array).
        -
        -
        Parameters:
        -
        what - the String to match
        -
        column - ID number of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        matchRowIndices

        -
        public int[] matchRowIndices(String what,
        -                             String columnName)
        -
        Return a list of rows that match the regex passed in. If there are no - matches, a zero length array will be returned (not a null array).
        -
        -
        Parameters:
        -
        what - the String to match
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - - - - - -
        -
      • -

        matchRow

        -
        public TableRow matchRow(String regexp,
        -                         String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - - - - - -
        -
      • -

        matchRows

        -
        public Iterable<TableRow> matchRows(String regexp,
        -                                    String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        matchRowIterator

        -
        public Iterator<TableRow> matchRowIterator(String value,
        -                                           int column)
        -
        -
        Parameters:
        -
        value - the regular expression to match
        -
        column - ID number of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        matchRowIterator

        -
        public Iterator<TableRow> matchRowIterator(String value,
        -                                           String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        replace

        -
        public void replace(String orig,
        -                    String replacement)
        -
        Replace a String with another. Set empty entries null by using - replace("", null) or use replace(null, "") to go the other direction. - If this is a typed table, only String columns will be modified.
        -
        -
        Parameters:
        -
        orig -
        -
        replacement -
        -
        -
      • -
      - - - -
        -
      • -

        replace

        -
        public void replace(String orig,
        -                    String replacement,
        -                    int col)
        -
      • -
      - - - -
        -
      • -

        replace

        -
        public void replace(String orig,
        -                    String replacement,
        -                    String colName)
        -
      • -
      - - - -
        -
      • -

        replaceAll

        -
        public void replaceAll(String regex,
        -                       String replacement)
        -
      • -
      - - - -
        -
      • -

        replaceAll

        -
        public void replaceAll(String regex,
        -                       String replacement,
        -                       int column)
        -
      • -
      - - - -
        -
      • -

        replaceAll

        -
        public void replaceAll(String regex,
        -                       String replacement,
        -                       String columnName)
        -
        Run String.replaceAll() on all entries in a column. - Only works with columns that are already String values.
        -
        -
        Parameters:
        -
        what - the String to match
        -
        columnName - title of the column to search
        -
        -
      • -
      - - - -
        -
      • -

        removeTokens

        -
        public void removeTokens(String tokens)
        -
        Remove any of the specified characters from the entire table.
        -
        -
        Parameters:
        -
        tokens - a list of individual characters to be removed
        -
        See Also:
        -
        trim()
        -
        -
      • -
      - - - -
        -
      • -

        removeTokens

        -
        public void removeTokens(String tokens,
        -                         int column)
        -
        Removed any of the specified characters from a column. For instance, - the following code removes dollar signs and commas from column 2: -
        - table.removeTokens(",$", 2);
        - 
        -
        -
        Parameters:
        -
        column - ID number of the column to process
        -
        -
      • -
      - - - -
        -
      • -

        removeTokens

        -
        public void removeTokens(String tokens,
        -                         String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to process
        -
        -
      • -
      - - - - - - - -
        -
      • -

        trim

        -
        public void trim(int column)
        -
        -
        Parameters:
        -
        column - ID number of the column to trim
        -
        -
      • -
      - - - -
        -
      • -

        trim

        -
        public void trim(String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to trim
        -
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public void sort(String columnName)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public void sort(int column)
        -
      • -
      - - - -
        -
      • -

        sortReverse

        -
        public void sortReverse(String columnName)
        -
      • -
      - - - -
        -
      • -

        sortReverse

        -
        public void sortReverse(int column)
        -
      • -
      - - - -
        -
      • -

        getUnique

        -
        public String[] getUnique(String columnName)
        -
      • -
      - - - -
        -
      • -

        getUnique

        -
        public String[] getUnique(int column)
        -
      • -
      - - - - - - - -
        -
      • -

        getTally

        -
        public IntDict getTally(int column)
        -
      • -
      - - - - - - - -
        -
      • -

        getOrder

        -
        public IntDict getOrder(int column)
        -
      • -
      - - - -
        -
      • -

        getIntList

        -
        public IntList getIntList(String columnName)
        -
      • -
      - - - -
        -
      • -

        getIntList

        -
        public IntList getIntList(int column)
        -
      • -
      - - - - - - - -
        -
      • -

        getFloatList

        -
        public FloatList getFloatList(int column)
        -
      • -
      - - - - - - - -
        -
      • -

        getStringList

        -
        public StringList getStringList(int column)
        -
      • -
      - - - -
        -
      • -

        getIntDict

        -
        public IntDict getIntDict(String keyColumnName,
        -                          String valueColumnName)
        -
      • -
      - - - -
        -
      • -

        getIntDict

        -
        public IntDict getIntDict(int keyColumn,
        -                          int valueColumn)
        -
      • -
      - - - - - - - -
        -
      • -

        getFloatDict

        -
        public FloatDict getFloatDict(int keyColumn,
        -                              int valueColumn)
        -
      • -
      - - - - - - - -
        -
      • -

        getStringDict

        -
        public StringDict getStringDict(int keyColumn,
        -                                int valueColumn)
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public Table copy()
        -
        Make a copy of the current table
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/data/TableRow.html b/build/javadoc/everything/processing/data/TableRow.html deleted file mode 100644 index dd4ddcb124..0000000000 --- a/build/javadoc/everything/processing/data/TableRow.html +++ /dev/null @@ -1,641 +0,0 @@ - - - - - -TableRow - - - - - - - - - - - -
-
processing.data
-

Interface TableRow

-
-
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getString

        -
        String getString(int column)
        -
        -
        Parameters:
        -
        column - ID number of the column to reference
        -
        See Also:
        -
        getInt(int), -getFloat(int)
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        String getString(String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to reference
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        int getInt(int column)
        -
        -
        Parameters:
        -
        column - ID number of the column to reference
        -
        See Also:
        -
        getFloat(int), -getString(int)
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        int getInt(String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to reference
        -
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        long getLong(int column)
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        long getLong(String columnName)
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        float getFloat(int column)
        -
        -
        Parameters:
        -
        column - ID number of the column to reference
        -
        See Also:
        -
        getInt(int), -getString(int)
        -
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        float getFloat(String columnName)
        -
        -
        Parameters:
        -
        columnName - title of the column to reference
        -
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        double getDouble(int column)
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        double getDouble(String columnName)
        -
      • -
      - - - - - - - -
        -
      • -

        setString

        -
        void setString(String columnName,
        -               String value)
        -
        -
        Parameters:
        -
        columnName - title of the target column
        -
        -
      • -
      - - - - - - - -
        -
      • -

        setInt

        -
        void setInt(String columnName,
        -            int value)
        -
        -
        Parameters:
        -
        columnName - title of the target column
        -
        -
      • -
      - - - -
        -
      • -

        setLong

        -
        void setLong(int column,
        -             long value)
        -
      • -
      - - - -
        -
      • -

        setLong

        -
        void setLong(String columnName,
        -             long value)
        -
      • -
      - - - -
        -
      • -

        setFloat

        -
        void setFloat(int column,
        -              float value)
        -
        -
        Parameters:
        -
        column - ID number of the target column
        -
        value - value to assign
        -
        See Also:
        -
        setInt(int, int), -setString(int, String)
        -
        -
      • -
      - - - -
        -
      • -

        setFloat

        -
        void setFloat(String columnName,
        -              float value)
        -
        -
        Parameters:
        -
        columnName - title of the target column
        -
        -
      • -
      - - - -
        -
      • -

        setDouble

        -
        void setDouble(int column,
        -               double value)
        -
      • -
      - - - -
        -
      • -

        setDouble

        -
        void setDouble(String columnName,
        -               double value)
        -
      • -
      - - - -
        -
      • -

        getColumnCount

        -
        int getColumnCount()
        -
      • -
      - - - -
        -
      • -

        getColumnType

        -
        int getColumnType(String columnName)
        -
      • -
      - - - -
        -
      • -

        getColumnType

        -
        int getColumnType(int column)
        -
      • -
      - - - -
        -
      • -

        getColumnTypes

        -
        int[] getColumnTypes()
        -
      • -
      - - - -
        -
      • -

        getColumnTitle

        -
        String getColumnTitle(int column)
        -
      • -
      - - - -
        -
      • -

        getColumnTitles

        -
        String[] getColumnTitles()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/data/XML.html b/build/javadoc/everything/processing/data/XML.html deleted file mode 100644 index 369490258c..0000000000 --- a/build/javadoc/everything/processing/data/XML.html +++ /dev/null @@ -1,1346 +0,0 @@ - - - - - -XML - - - - - - - - - - - -
-
processing.data
-

Class XML

-
-
- -
- -
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Method Detail

      - - - - - - - - - - - -
        -
      • -

        save

        -
        public boolean save(File file)
        -
      • -
      - - - -
        -
      • -

        save

        -
        public boolean save(File file,
        -                    String options)
        -
      • -
      - - - -
        -
      • -

        write

        -
        public boolean write(PrintWriter output)
        -
      • -
      - - - -
        -
      • -

        getParent

        -
        public XML getParent()
        -
        Returns the parent element. This method returns null for the root - element.
        -
      • -
      - - - -
        -
      • -

        getName

        -
        public 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.
        -
        -
      • -
      - - - -
        -
      • -

        setName

        -
        public void setName(String newName)
        -
      • -
      - - - -
        -
      • -

        getLocalName

        -
        public String getLocalName()
        -
        Returns the name of the element (without namespace prefix). - - Internal function; not included in reference.
        -
      • -
      - - - -
        -
      • -

        getChildCount

        -
        public int getChildCount()
        -
        Returns the number of children.
        -
        -
        Returns:
        -
        the count.
        -
        -
      • -
      - - - -
        -
      • -

        hasChildren

        -
        public boolean hasChildren()
        -
        Returns a boolean of whether or not there are children.
        -
      • -
      - - - -
        -
      • -

        listChildren

        -
        public 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 XML[] getChildren()
        -
        Returns an array containing all the child elements.
        -
      • -
      - - - -
        -
      • -

        getChild

        -
        public XML getChild(int index)
        -
        Quick accessor for an element at a particular index.
        -
      • -
      - - - -
        -
      • -

        getChild

        -
        public XML getChild(String name)
        -
        Get a child by its name or path.
        -
        -
        Parameters:
        -
        name - element name or path/to/element
        -
        Returns:
        -
        the first matching element
        -
        -
      • -
      - - - -
        -
      • -

        getChildren

        -
        public XML[] getChildren(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
        -
        -
      • -
      - - - -
        -
      • -

        addChild

        -
        public XML addChild(String tag)
        -
      • -
      - - - -
        -
      • -

        addChild

        -
        public XML addChild(XML child)
        -
      • -
      - - - -
        -
      • -

        removeChild

        -
        public void removeChild(XML kid)
        -
      • -
      - - - -
        -
      • -

        trim

        -
        public void trim()
        -
      • -
      - - - -
        -
      • -

        getAttributeCount

        -
        public int getAttributeCount()
        -
        Returns the number of attributes.
        -
      • -
      - - - -
        -
      • -

        listAttributes

        -
        public String[] listAttributes()
        -
        Get a list of the names for all of the attributes for this node.
        -
      • -
      - - - -
        -
      • -

        hasAttribute

        -
        public boolean hasAttribute(String name)
        -
        Returns whether an attribute exists.
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        setString

        -
        public void setString(String name,
        -                      String value)
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt(String name)
        -
      • -
      - - - -
        -
      • -

        setInt

        -
        public void setInt(String name,
        -                   int value)
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt(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
        -
        -
      • -
      - - - -
        -
      • -

        setLong

        -
        public void setLong(String name,
        -                    long value)
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong(String name,
        -                    long 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.
        -
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        public float getFloat(String name)
        -
        Returns the value of an attribute, or zero if not present.
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        public float getFloat(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.
        -
        -
      • -
      - - - -
        -
      • -

        setFloat

        -
        public void setFloat(String name,
        -                     float value)
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(String name)
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble(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
        -
        -
      • -
      - - - -
        -
      • -

        setDouble

        -
        public void setDouble(String name,
        -                      double value)
        -
      • -
      - - - -
        -
      • -

        getContent

        -
        public 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.
        -
        See Also:
        -
        getIntContent(), -getFloatContent()
        -
        -
      • -
      - - - -
        -
      • -

        getContent

        -
        public String getContent(String defaultValue)
        -
      • -
      - - - - - - - -
        -
      • -

        getIntContent

        -
        public int getIntContent(int defaultValue)
        -
        -
        Parameters:
        -
        defaultValue - the default value of the attribute
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getFloatContent

        -
        public float getFloatContent(float defaultValue)
        -
        -
        Parameters:
        -
        defaultValue - the default value of the attribute
        -
        -
      • -
      - - - -
        -
      • -

        getLongContent

        -
        public long getLongContent()
        -
      • -
      - - - -
        -
      • -

        getLongContent

        -
        public long getLongContent(long defaultValue)
        -
      • -
      - - - -
        -
      • -

        getDoubleContent

        -
        public double getDoubleContent()
        -
      • -
      - - - -
        -
      • -

        getDoubleContent

        -
        public double getDoubleContent(double defaultValue)
        -
      • -
      - - - -
        -
      • -

        setContent

        -
        public void setContent(String text)
        -
      • -
      - - - -
        -
      • -

        setIntContent

        -
        public void setIntContent(int value)
        -
      • -
      - - - -
        -
      • -

        setFloatContent

        -
        public void setFloatContent(float value)
        -
      • -
      - - - -
        -
      • -

        setLongContent

        -
        public void setLongContent(long value)
        -
      • -
      - - - -
        -
      • -

        setDoubleContent

        -
        public void setDoubleContent(double value)
        -
      • -
      - - - -
        -
      • -

        format

        -
        public String format(int indent)
        -
        Format this XML data as a String.
        -
        -
        Parameters:
        -
        indent - -1 for a single line (and no declaration), >= 0 for indents and newlines
        -
        Returns:
        -
        the content
        -
        See Also:
        -
        toString()
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public String toString()
        -
        Return the XML document formatted with two spaces for indents. - Chosen to do this since it's the most common case (e.g. with println()). - Same as format(2). Use the format() function for more options.
        -
        -
        Overrides:
        -
        toString in class Object
        -
        Returns:
        -
        the content
        -
        See Also:
        -
        format(int)
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/data/package-frame.html b/build/javadoc/everything/processing/data/package-frame.html deleted file mode 100644 index 1875f0f2ba..0000000000 --- a/build/javadoc/everything/processing/data/package-frame.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - -processing.data - - - - -

processing.data

- - - diff --git a/build/javadoc/everything/processing/data/package-summary.html b/build/javadoc/everything/processing/data/package-summary.html deleted file mode 100644 index 2763db48f0..0000000000 --- a/build/javadoc/everything/processing/data/package-summary.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - - -processing.data - - - - - - - - - - -
-

Package processing.data

-
-
-
    -
  • - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    TableRow 
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    FloatDict -
    A simple table class to use a String as a lookup for an float value.
    -
    FloatList -
    Helper class for a list of floats.
    -
    IntDict -
    A simple class to use a String as a lookup for an int value.
    -
    IntList -
    Helper class for a list of ints.
    -
    JSONArray -
    A JSONArray is an ordered sequence of values.
    -
    JSONObject -
    A JSONObject is an unordered collection of name/value pairs.
    -
    Sort -
    Internal sorter used by several data classes.
    -
    StringDict -
    A simple table class to use a String as a lookup for another String value.
    -
    StringList -
    Helper class for a list of Strings.
    -
    Table -
    Generic class for handling tabular data, typically from a CSV, TSV, or - other sort of spreadsheet file.
    -
    XML -
    This is the base class used for the Processing XML library, - representing a single node of an XML tree.
    -
    -
  • -
-
- - - - - - diff --git a/build/javadoc/everything/processing/data/package-tree.html b/build/javadoc/everything/processing/data/package-tree.html deleted file mode 100644 index 34ae459333..0000000000 --- a/build/javadoc/everything/processing/data/package-tree.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - -processing.data Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.data

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Interface Hierarchy

- -
- - - - - - diff --git a/build/javadoc/everything/processing/event/Event.html b/build/javadoc/everything/processing/event/Event.html deleted file mode 100644 index 0e727cf31d..0000000000 --- a/build/javadoc/everything/processing/event/Event.html +++ /dev/null @@ -1,531 +0,0 @@ - - - - - -Event - - - - - - - - - - - -
-
processing.event
-

Class Event

-
-
- -
- -
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Event

        -
        public Event(Object nativeObject,
        -             long millis,
        -             int action,
        -             int modifiers)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getFlavor

        -
        public int getFlavor()
        -
      • -
      - - - -
        -
      • -

        getNative

        -
        public Object getNative()
        -
        Get the platform-native event object. This might be the java.awt event - on the desktop, though if you're using OpenGL on the desktop it'll be a - NEWT event that JOGL uses. Android events are something else altogether. - Bottom line, use this only if you know what you're doing, and don't make - assumptions about the class type.
        -
      • -
      - - - -
        -
      • -

        getMillis

        -
        public long getMillis()
        -
      • -
      - - - -
        -
      • -

        getAction

        -
        public int getAction()
        -
      • -
      - - - -
        -
      • -

        getModifiers

        -
        public int getModifiers()
        -
      • -
      - - - -
        -
      • -

        isShiftDown

        -
        public boolean isShiftDown()
        -
      • -
      - - - -
        -
      • -

        isControlDown

        -
        public boolean isControlDown()
        -
      • -
      - - - -
        -
      • -

        isMetaDown

        -
        public boolean isMetaDown()
        -
      • -
      - - - -
        -
      • -

        isAltDown

        -
        public boolean isAltDown()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/event/KeyEvent.html b/build/javadoc/everything/processing/event/KeyEvent.html deleted file mode 100644 index c308aad49a..0000000000 --- a/build/javadoc/everything/processing/event/KeyEvent.html +++ /dev/null @@ -1,384 +0,0 @@ - - - - - -KeyEvent - - - - - - - - - - - -
-
processing.event
-

Class KeyEvent

-
-
- -
-
    -
  • -
    -
    -
    public class KeyEvent
    -extends Event
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        KeyEvent

        -
        public KeyEvent(Object nativeObject,
        -                long millis,
        -                int action,
        -                int modifiers,
        -                char key,
        -                int keyCode)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getKey

        -
        public char getKey()
        -
      • -
      - - - -
        -
      • -

        getKeyCode

        -
        public int getKeyCode()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/event/MouseEvent.html b/build/javadoc/everything/processing/event/MouseEvent.html deleted file mode 100644 index 83d17120b8..0000000000 --- a/build/javadoc/everything/processing/event/MouseEvent.html +++ /dev/null @@ -1,565 +0,0 @@ - - - - - -MouseEvent - - - - - - - - - - - -
-
processing.event
-

Class MouseEvent

-
-
- -
-
    -
  • -
    -
    -
    public class MouseEvent
    -extends Event
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        MouseEvent

        -
        public MouseEvent(Object nativeObject,
        -                  long millis,
        -                  int action,
        -                  int modifiers,
        -                  int x,
        -                  int y,
        -                  int button,
        -                  int count)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getX

        -
        public int getX()
        -
      • -
      - - - -
        -
      • -

        getY

        -
        public int getY()
        -
      • -
      - - - -
        -
      • -

        getButton

        -
        public int getButton()
        -
        Which button was pressed, either LEFT, CENTER, or RIGHT.
        -
      • -
      - - - -
        -
      • -

        getClickCount

        -
        @Deprecated
        -public int getClickCount()
        -
        Deprecated. 
        -
        Do not use, getCount() is the correct method.
        -
      • -
      - - - -
        -
      • -

        getAmount

        -
        @Deprecated
        -public float getAmount()
        -
        Deprecated. 
        -
        Do not use, getCount() is the correct method.
        -
      • -
      - - - -
        -
      • -

        getCount

        -
        public int getCount()
        -
        Number of clicks for mouse button events, or the number of steps (positive - or negative depending on direction) for a mouse wheel event. - Wheel events follow Java (see here), so - getAmount() will return "negative values if the mouse wheel was rotated - up or away from the user" and positive values in the other direction. - On Mac OS X, this will be reversed when "natural" scrolling is enabled - in System Preferences &rarr Mouse.
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/event/TouchEvent.html b/build/javadoc/everything/processing/event/TouchEvent.html deleted file mode 100644 index 918fd48565..0000000000 --- a/build/javadoc/everything/processing/event/TouchEvent.html +++ /dev/null @@ -1,267 +0,0 @@ - - - - - -TouchEvent - - - - - - - - - - - -
-
processing.event
-

Class TouchEvent

-
-
- -
-
    -
  • -
    -
    -
    public class TouchEvent
    -extends Event
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TouchEvent

        -
        public TouchEvent(Object nativeObject,
        -                  long millis,
        -                  int action,
        -                  int modifiers)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/event/package-frame.html b/build/javadoc/everything/processing/event/package-frame.html deleted file mode 100644 index 8b8020b270..0000000000 --- a/build/javadoc/everything/processing/event/package-frame.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - -processing.event - - - - -

processing.event

-
-

Classes

- -
- - diff --git a/build/javadoc/everything/processing/event/package-summary.html b/build/javadoc/everything/processing/event/package-summary.html deleted file mode 100644 index 0cecb14017..0000000000 --- a/build/javadoc/everything/processing/event/package-summary.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - -processing.event - - - - - - - - - - -
-

Package processing.event

-
-
- -
- - - - - - diff --git a/build/javadoc/everything/processing/event/package-tree.html b/build/javadoc/everything/processing/event/package-tree.html deleted file mode 100644 index e6a35011b2..0000000000 --- a/build/javadoc/everything/processing/event/package-tree.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - -processing.event Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.event

-Package Hierarchies: - -
-
-

Class Hierarchy

- -
- - - - - - diff --git a/build/javadoc/everything/processing/mode/java/preproc/JavaLexer.html b/build/javadoc/everything/processing/mode/java/preproc/JavaLexer.html deleted file mode 100644 index 5885aa0e7b..0000000000 --- a/build/javadoc/everything/processing/mode/java/preproc/JavaLexer.html +++ /dev/null @@ -1,1644 +0,0 @@ - - - - - -JavaLexer - - - - - - - - - - - -
-
processing.mode.java.preproc
-

Class JavaLexer

-
-
-
    -
  • Object
  • -
  • -
      -
    • CharScanner
    • -
    • -
        -
      • JavaLexer
      • -
      -
    • -
    -
  • -
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _tokenSet_0

        -
        public static final BitSet _tokenSet_0
        -
      • -
      - - - -
        -
      • -

        _tokenSet_1

        -
        public static final BitSet _tokenSet_1
        -
      • -
      - - - -
        -
      • -

        _tokenSet_2

        -
        public static final BitSet _tokenSet_2
        -
      • -
      - - - -
        -
      • -

        _tokenSet_3

        -
        public static final BitSet _tokenSet_3
        -
      • -
      - - - -
        -
      • -

        _tokenSet_4

        -
        public static final BitSet _tokenSet_4
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - - - - - -
        -
      • -

        JavaLexer

        -
        public JavaLexer(Reader in)
        -
      • -
      - - - -
        -
      • -

        JavaLexer

        -
        public JavaLexer(InputBuffer ib)
        -
      • -
      - - - -
        -
      • -

        JavaLexer

        -
        public JavaLexer(LexerSharedInputState state)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        enableAssert

        -
        public void enableAssert(boolean shouldEnable)
        -
        Enable the "assert" keyword
        -
      • -
      - - - -
        -
      • -

        isAssertEnabled

        -
        public boolean isAssertEnabled()
        -
        Query the "assert" keyword state
        -
      • -
      - - - -
        -
      • -

        enableEnum

        -
        public void enableEnum(boolean shouldEnable)
        -
        Enable the "enum" keyword
        -
      • -
      - - - -
        -
      • -

        isEnumEnabled

        -
        public boolean isEnumEnabled()
        -
        Query the "enum" keyword state
        -
      • -
      - - - -
        -
      • -

        nextToken

        -
        public Token nextToken()
        -                throws TokenStreamException
        -
        -
        Throws:
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mQUESTION

        -
        public final void mQUESTION(boolean _createToken)
        -                     throws RecognitionException,
        -                            CharStreamException,
        -                            TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLPAREN

        -
        public final void mLPAREN(boolean _createToken)
        -                   throws RecognitionException,
        -                          CharStreamException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mRPAREN

        -
        public final void mRPAREN(boolean _createToken)
        -                   throws RecognitionException,
        -                          CharStreamException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLBRACK

        -
        public final void mLBRACK(boolean _createToken)
        -                   throws RecognitionException,
        -                          CharStreamException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mRBRACK

        -
        public final void mRBRACK(boolean _createToken)
        -                   throws RecognitionException,
        -                          CharStreamException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLCURLY

        -
        public final void mLCURLY(boolean _createToken)
        -                   throws RecognitionException,
        -                          CharStreamException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mRCURLY

        -
        public final void mRCURLY(boolean _createToken)
        -                   throws RecognitionException,
        -                          CharStreamException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mCOLON

        -
        public final void mCOLON(boolean _createToken)
        -                  throws RecognitionException,
        -                         CharStreamException,
        -                         TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mCOMMA

        -
        public final void mCOMMA(boolean _createToken)
        -                  throws RecognitionException,
        -                         CharStreamException,
        -                         TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mASSIGN

        -
        public final void mASSIGN(boolean _createToken)
        -                   throws RecognitionException,
        -                          CharStreamException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mEQUAL

        -
        public final void mEQUAL(boolean _createToken)
        -                  throws RecognitionException,
        -                         CharStreamException,
        -                         TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLNOT

        -
        public final void mLNOT(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBNOT

        -
        public final void mBNOT(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mNOT_EQUAL

        -
        public final void mNOT_EQUAL(boolean _createToken)
        -                      throws RecognitionException,
        -                             CharStreamException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mDIV

        -
        public final void mDIV(boolean _createToken)
        -                throws RecognitionException,
        -                       CharStreamException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mDIV_ASSIGN

        -
        public final void mDIV_ASSIGN(boolean _createToken)
        -                       throws RecognitionException,
        -                              CharStreamException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mPLUS

        -
        public final void mPLUS(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mPLUS_ASSIGN

        -
        public final void mPLUS_ASSIGN(boolean _createToken)
        -                        throws RecognitionException,
        -                               CharStreamException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mINC

        -
        public final void mINC(boolean _createToken)
        -                throws RecognitionException,
        -                       CharStreamException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mMINUS

        -
        public final void mMINUS(boolean _createToken)
        -                  throws RecognitionException,
        -                         CharStreamException,
        -                         TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mMINUS_ASSIGN

        -
        public final void mMINUS_ASSIGN(boolean _createToken)
        -                         throws RecognitionException,
        -                                CharStreamException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mDEC

        -
        public final void mDEC(boolean _createToken)
        -                throws RecognitionException,
        -                       CharStreamException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSTAR

        -
        public final void mSTAR(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSTAR_ASSIGN

        -
        public final void mSTAR_ASSIGN(boolean _createToken)
        -                        throws RecognitionException,
        -                               CharStreamException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mMOD

        -
        public final void mMOD(boolean _createToken)
        -                throws RecognitionException,
        -                       CharStreamException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mMOD_ASSIGN

        -
        public final void mMOD_ASSIGN(boolean _createToken)
        -                       throws RecognitionException,
        -                              CharStreamException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSR

        -
        public final void mSR(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSR_ASSIGN

        -
        public final void mSR_ASSIGN(boolean _createToken)
        -                      throws RecognitionException,
        -                             CharStreamException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBSR

        -
        public final void mBSR(boolean _createToken)
        -                throws RecognitionException,
        -                       CharStreamException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBSR_ASSIGN

        -
        public final void mBSR_ASSIGN(boolean _createToken)
        -                       throws RecognitionException,
        -                              CharStreamException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mGE

        -
        public final void mGE(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mGT

        -
        public final void mGT(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSL

        -
        public final void mSL(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSL_ASSIGN

        -
        public final void mSL_ASSIGN(boolean _createToken)
        -                      throws RecognitionException,
        -                             CharStreamException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLE

        -
        public final void mLE(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLT

        -
        public final void mLT(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBXOR

        -
        public final void mBXOR(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBXOR_ASSIGN

        -
        public final void mBXOR_ASSIGN(boolean _createToken)
        -                        throws RecognitionException,
        -                               CharStreamException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBOR

        -
        public final void mBOR(boolean _createToken)
        -                throws RecognitionException,
        -                       CharStreamException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBOR_ASSIGN

        -
        public final void mBOR_ASSIGN(boolean _createToken)
        -                       throws RecognitionException,
        -                              CharStreamException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLOR

        -
        public final void mLOR(boolean _createToken)
        -                throws RecognitionException,
        -                       CharStreamException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBAND

        -
        public final void mBAND(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBAND_ASSIGN

        -
        public final void mBAND_ASSIGN(boolean _createToken)
        -                        throws RecognitionException,
        -                               CharStreamException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLAND

        -
        public final void mLAND(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSEMI

        -
        public final void mSEMI(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mWS

        -
        public final void mWS(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSL_COMMENT

        -
        public final void mSL_COMMENT(boolean _createToken)
        -                       throws RecognitionException,
        -                              CharStreamException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mML_COMMENT

        -
        public final void mML_COMMENT(boolean _createToken)
        -                       throws RecognitionException,
        -                              CharStreamException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mCHAR_LITERAL

        -
        public final void mCHAR_LITERAL(boolean _createToken)
        -                         throws RecognitionException,
        -                                CharStreamException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSTRING_LITERAL

        -
        public final void mSTRING_LITERAL(boolean _createToken)
        -                           throws RecognitionException,
        -                                  CharStreamException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mIDENT

        -
        public final void mIDENT(boolean _createToken)
        -                  throws RecognitionException,
        -                         CharStreamException,
        -                         TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mNUM_INT

        -
        public final void mNUM_INT(boolean _createToken)
        -                    throws RecognitionException,
        -                           CharStreamException,
        -                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mAT

        -
        public final void mAT(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/mode/java/preproc/JavaRecognizer.html b/build/javadoc/everything/processing/mode/java/preproc/JavaRecognizer.html deleted file mode 100644 index 3f3f0710e0..0000000000 --- a/build/javadoc/everything/processing/mode/java/preproc/JavaRecognizer.html +++ /dev/null @@ -1,3210 +0,0 @@ - - - - - -JavaRecognizer - - - - - - - - - - - -
-
processing.mode.java.preproc
-

Class JavaRecognizer

-
-
-
    -
  • Object
  • -
  • -
      -
    • LLkParser
    • -
    • -
        -
      • JavaRecognizer
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    JavaTokenTypes
    -
    -
    -
    -
    public class JavaRecognizer
    -extends LLkParser
    -implements JavaTokenTypes
    -
    Java 1.5 Recognizer -/** Java 1.5 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. - - 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 - - Version 1.22.5 (January 03, 2005) - Small change to tree structure - o Flattened classOrInterfaceType tree so IDENT no longer has children. TYPE_ARGUMENTS are now - always siblings of IDENT rather than children. Fully.qualified.names trees now - look a little less clean when TYPE_ARGUMENTS are present though. - - This grammar is in the PUBLIC DOMAIN
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _tokenNames

        -
        public static final String[] _tokenNames
        -
      • -
      - - - -
        -
      • -

        _tokenSet_0

        -
        public static final BitSet _tokenSet_0
        -
      • -
      - - - -
        -
      • -

        _tokenSet_1

        -
        public static final BitSet _tokenSet_1
        -
      • -
      - - - -
        -
      • -

        _tokenSet_2

        -
        public static final BitSet _tokenSet_2
        -
      • -
      - - - -
        -
      • -

        _tokenSet_3

        -
        public static final BitSet _tokenSet_3
        -
      • -
      - - - -
        -
      • -

        _tokenSet_4

        -
        public static final BitSet _tokenSet_4
        -
      • -
      - - - -
        -
      • -

        _tokenSet_5

        -
        public static final BitSet _tokenSet_5
        -
      • -
      - - - -
        -
      • -

        _tokenSet_6

        -
        public static final BitSet _tokenSet_6
        -
      • -
      - - - -
        -
      • -

        _tokenSet_7

        -
        public static final BitSet _tokenSet_7
        -
      • -
      - - - -
        -
      • -

        _tokenSet_8

        -
        public static final BitSet _tokenSet_8
        -
      • -
      - - - -
        -
      • -

        _tokenSet_9

        -
        public static final BitSet _tokenSet_9
        -
      • -
      - - - -
        -
      • -

        _tokenSet_10

        -
        public static final BitSet _tokenSet_10
        -
      • -
      - - - -
        -
      • -

        _tokenSet_11

        -
        public static final BitSet _tokenSet_11
        -
      • -
      - - - -
        -
      • -

        _tokenSet_12

        -
        public static final BitSet _tokenSet_12
        -
      • -
      - - - -
        -
      • -

        _tokenSet_13

        -
        public static final BitSet _tokenSet_13
        -
      • -
      - - - -
        -
      • -

        _tokenSet_14

        -
        public static final BitSet _tokenSet_14
        -
      • -
      - - - -
        -
      • -

        _tokenSet_15

        -
        public static final BitSet _tokenSet_15
        -
      • -
      - - - -
        -
      • -

        _tokenSet_16

        -
        public static final BitSet _tokenSet_16
        -
      • -
      - - - -
        -
      • -

        _tokenSet_17

        -
        public static final BitSet _tokenSet_17
        -
      • -
      - - - -
        -
      • -

        _tokenSet_18

        -
        public static final BitSet _tokenSet_18
        -
      • -
      - - - -
        -
      • -

        _tokenSet_19

        -
        public static final BitSet _tokenSet_19
        -
      • -
      - - - -
        -
      • -

        _tokenSet_20

        -
        public static final BitSet _tokenSet_20
        -
      • -
      - - - -
        -
      • -

        _tokenSet_21

        -
        public static final BitSet _tokenSet_21
        -
      • -
      - - - -
        -
      • -

        _tokenSet_22

        -
        public static final BitSet _tokenSet_22
        -
      • -
      - - - -
        -
      • -

        _tokenSet_23

        -
        public static final BitSet _tokenSet_23
        -
      • -
      - - - -
        -
      • -

        _tokenSet_24

        -
        public static final BitSet _tokenSet_24
        -
      • -
      - - - -
        -
      • -

        _tokenSet_25

        -
        public static final BitSet _tokenSet_25
        -
      • -
      - - - -
        -
      • -

        _tokenSet_26

        -
        public static final BitSet _tokenSet_26
        -
      • -
      - - - -
        -
      • -

        _tokenSet_27

        -
        public static final BitSet _tokenSet_27
        -
      • -
      - - - -
        -
      • -

        _tokenSet_28

        -
        public static final BitSet _tokenSet_28
        -
      • -
      - - - -
        -
      • -

        _tokenSet_29

        -
        public static final BitSet _tokenSet_29
        -
      • -
      - - - -
        -
      • -

        _tokenSet_30

        -
        public static final BitSet _tokenSet_30
        -
      • -
      - - - -
        -
      • -

        _tokenSet_31

        -
        public static final BitSet _tokenSet_31
        -
      • -
      - - - -
        -
      • -

        _tokenSet_32

        -
        public static final BitSet _tokenSet_32
        -
      • -
      - - - -
        -
      • -

        _tokenSet_33

        -
        public static final BitSet _tokenSet_33
        -
      • -
      - - - -
        -
      • -

        _tokenSet_34

        -
        public static final BitSet _tokenSet_34
        -
      • -
      - - - -
        -
      • -

        _tokenSet_35

        -
        public static final BitSet _tokenSet_35
        -
      • -
      - - - -
        -
      • -

        _tokenSet_36

        -
        public static final BitSet _tokenSet_36
        -
      • -
      - - - -
        -
      • -

        _tokenSet_37

        -
        public static final BitSet _tokenSet_37
        -
      • -
      - - - -
        -
      • -

        _tokenSet_38

        -
        public static final BitSet _tokenSet_38
        -
      • -
      - - - -
        -
      • -

        _tokenSet_39

        -
        public static final BitSet _tokenSet_39
        -
      • -
      - - - -
        -
      • -

        _tokenSet_40

        -
        public static final BitSet _tokenSet_40
        -
      • -
      - - - -
        -
      • -

        _tokenSet_41

        -
        public static final BitSet _tokenSet_41
        -
      • -
      - - - -
        -
      • -

        _tokenSet_42

        -
        public static final BitSet _tokenSet_42
        -
      • -
      - - - -
        -
      • -

        _tokenSet_43

        -
        public static final BitSet _tokenSet_43
        -
      • -
      - - - -
        -
      • -

        _tokenSet_44

        -
        public static final BitSet _tokenSet_44
        -
      • -
      - - - -
        -
      • -

        _tokenSet_45

        -
        public static final BitSet _tokenSet_45
        -
      • -
      - - - -
        -
      • -

        _tokenSet_46

        -
        public static final BitSet _tokenSet_46
        -
      • -
      - - - -
        -
      • -

        _tokenSet_47

        -
        public static final BitSet _tokenSet_47
        -
      • -
      - - - -
        -
      • -

        _tokenSet_48

        -
        public static final BitSet _tokenSet_48
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JavaRecognizer

        -
        public JavaRecognizer(TokenBuffer tokenBuf)
        -
      • -
      - - - -
        -
      • -

        JavaRecognizer

        -
        public JavaRecognizer(TokenStream lexer)
        -
      • -
      - - - -
        -
      • -

        JavaRecognizer

        -
        public JavaRecognizer(ParserSharedInputState state)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        compilationUnit

        -
        public final void compilationUnit()
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotations

        -
        public final void annotations()
        -                       throws RecognitionException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        packageDefinition

        -
        public final void packageDefinition()
        -                             throws RecognitionException,
        -                                    TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        importDefinition

        -
        public final void importDefinition()
        -                            throws RecognitionException,
        -                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeDefinition

        -
        public final void typeDefinition()
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        identifier

        -
        public final void identifier()
        -                      throws RecognitionException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        identifierStar

        -
        public final void identifierStar()
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        modifiers

        -
        public final void modifiers()
        -                     throws RecognitionException,
        -                            TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        classDefinition

        -
        public final void classDefinition(AST modifiers)
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        interfaceDefinition

        -
        public final void interfaceDefinition(AST modifiers)
        -                               throws RecognitionException,
        -                                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        enumDefinition

        -
        public final void enumDefinition(AST modifiers)
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationDefinition

        -
        public final void annotationDefinition(AST modifiers)
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        declaration

        -
        public final void declaration()
        -                       throws RecognitionException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeSpec

        -
        public final void typeSpec(boolean addImagNode)
        -                    throws RecognitionException,
        -                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        variableDefinitions

        -
        public final void variableDefinitions(AST mods,
        -                                      AST t)
        -                               throws RecognitionException,
        -                                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        classTypeSpec

        -
        public final void classTypeSpec(boolean addImagNode)
        -                         throws RecognitionException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        builtInTypeSpec

        -
        public final void builtInTypeSpec(boolean addImagNode)
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        classOrInterfaceType

        -
        public final void classOrInterfaceType(boolean addImagNode)
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeArguments

        -
        public final void typeArguments()
        -                         throws RecognitionException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeArgumentSpec

        -
        public final void typeArgumentSpec()
        -                            throws RecognitionException,
        -                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        builtInTypeArraySpec

        -
        public final void builtInTypeArraySpec(boolean addImagNode)
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeArgument

        -
        public final void typeArgument()
        -                        throws RecognitionException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        wildcardType

        -
        public final void wildcardType()
        -                        throws RecognitionException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeArgumentBounds

        -
        public final void typeArgumentBounds()
        -                              throws RecognitionException,
        -                                     TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        builtInType

        -
        public final void builtInType()
        -                       throws RecognitionException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        type

        -
        public final void type()
        -                throws RecognitionException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        modifier

        -
        public final void modifier()
        -                    throws RecognitionException,
        -                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotation

        -
        public final void annotation()
        -                      throws RecognitionException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationArguments

        -
        public final void annotationArguments()
        -                               throws RecognitionException,
        -                                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationMemberValueInitializer

        -
        public final void annotationMemberValueInitializer()
        -                                            throws RecognitionException,
        -                                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        anntotationMemberValuePairs

        -
        public final void anntotationMemberValuePairs()
        -                                       throws RecognitionException,
        -                                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationMemberValuePair

        -
        public final void annotationMemberValuePair()
        -                                     throws RecognitionException,
        -                                            TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        conditionalExpression

        -
        public final void conditionalExpression()
        -                                 throws RecognitionException,
        -                                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationMemberArrayInitializer

        -
        public final void annotationMemberArrayInitializer()
        -                                            throws RecognitionException,
        -                                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationMemberArrayValueInitializer

        -
        public final void annotationMemberArrayValueInitializer()
        -                                                 throws RecognitionException,
        -                                                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        superClassClause

        -
        public final void superClassClause()
        -                            throws RecognitionException,
        -                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeParameters

        -
        public final void typeParameters()
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        implementsClause

        -
        public final void implementsClause()
        -                            throws RecognitionException,
        -                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        classBlock

        -
        public final void classBlock()
        -                      throws RecognitionException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        interfaceExtends

        -
        public final void interfaceExtends()
        -                            throws RecognitionException,
        -                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        interfaceBlock

        -
        public final void interfaceBlock()
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        enumBlock

        -
        public final void enumBlock()
        -                     throws RecognitionException,
        -                            TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationBlock

        -
        public final void annotationBlock()
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeParameter

        -
        public final void typeParameter()
        -                         throws RecognitionException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeParameterBounds

        -
        public final void typeParameterBounds()
        -                               throws RecognitionException,
        -                                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        classField

        -
        public final void classField()
        -                      throws RecognitionException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        interfaceField

        -
        public final void interfaceField()
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationField

        -
        public final void annotationField()
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        enumConstant

        -
        public final void enumConstant()
        -                        throws RecognitionException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        declaratorBrackets

        -
        public final void declaratorBrackets(AST typ)
        -                              throws RecognitionException,
        -                                     TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        argList

        -
        public final void argList()
        -                   throws RecognitionException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        enumConstantBlock

        -
        public final void enumConstantBlock()
        -                             throws RecognitionException,
        -                                    TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        enumConstantField

        -
        public final void enumConstantField()
        -                             throws RecognitionException,
        -                                    TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        parameterDeclarationList

        -
        public final void parameterDeclarationList()
        -                                    throws RecognitionException,
        -                                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        throwsClause

        -
        public final void throwsClause()
        -                        throws RecognitionException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        compoundStatement

        -
        public final void compoundStatement()
        -                             throws RecognitionException,
        -                                    TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        ctorHead

        -
        public final void ctorHead()
        -                    throws RecognitionException,
        -                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        constructorBody

        -
        public final void constructorBody()
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        explicitConstructorInvocation

        -
        public final void explicitConstructorInvocation()
        -                                         throws RecognitionException,
        -                                                TokenStreamException
        -
        Catch obvious constructor calls, but not the expr.super(...) calls
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        statement

        -
        public final void statement()
        -                     throws RecognitionException,
        -                            TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        variableDeclarator

        -
        public final void variableDeclarator(AST mods,
        -                                     AST t)
        -                              throws RecognitionException,
        -                                     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:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        varInitializer

        -
        public final void varInitializer()
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        initializer

        -
        public final void initializer()
        -                       throws RecognitionException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        arrayInitializer

        -
        public final void arrayInitializer()
        -                            throws RecognitionException,
        -                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        expression

        -
        public final void expression()
        -                      throws RecognitionException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        parameterDeclaration

        -
        public final void parameterDeclaration()
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        variableLengthParameterDeclaration

        -
        public final void variableLengthParameterDeclaration()
        -                                              throws RecognitionException,
        -                                                     TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        parameterModifier

        -
        public final void parameterModifier()
        -                             throws RecognitionException,
        -                                    TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        forStatement

        -
        public final void forStatement()
        -                        throws RecognitionException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        casesGroup

        -
        public final void casesGroup()
        -                      throws RecognitionException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        tryBlock

        -
        public final void tryBlock()
        -                    throws RecognitionException,
        -                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        forInit

        -
        public final void forInit()
        -                   throws RecognitionException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        traditionalForClause

        -
        public final void traditionalForClause()
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        forEachClause

        -
        public final void forEachClause()
        -                         throws RecognitionException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        forCond

        -
        public final void forCond()
        -                   throws RecognitionException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        forIter

        -
        public final void forIter()
        -                   throws RecognitionException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        aCase

        -
        public final void aCase()
        -                 throws RecognitionException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        caseSList

        -
        public final void caseSList()
        -                     throws RecognitionException,
        -                            TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        expressionList

        -
        public final void expressionList()
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        handler

        -
        public final void handler()
        -                   throws RecognitionException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        finallyClause

        -
        public final void finallyClause()
        -                         throws RecognitionException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        assignmentExpression

        -
        public final void assignmentExpression()
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        logicalOrExpression

        -
        public final void logicalOrExpression()
        -                               throws RecognitionException,
        -                                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        logicalAndExpression

        -
        public final void logicalAndExpression()
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        inclusiveOrExpression

        -
        public final void inclusiveOrExpression()
        -                                 throws RecognitionException,
        -                                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        exclusiveOrExpression

        -
        public final void exclusiveOrExpression()
        -                                 throws RecognitionException,
        -                                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        andExpression

        -
        public final void andExpression()
        -                         throws RecognitionException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        equalityExpression

        -
        public final void equalityExpression()
        -                              throws RecognitionException,
        -                                     TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        relationalExpression

        -
        public final void relationalExpression()
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        shiftExpression

        -
        public final void shiftExpression()
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        additiveExpression

        -
        public final void additiveExpression()
        -                              throws RecognitionException,
        -                                     TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        multiplicativeExpression

        -
        public final void multiplicativeExpression()
        -                                    throws RecognitionException,
        -                                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        unaryExpression

        -
        public final void unaryExpression()
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        unaryExpressionNotPlusMinus

        -
        public final void unaryExpressionNotPlusMinus()
        -                                       throws RecognitionException,
        -                                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        postfixExpression

        -
        public final void postfixExpression()
        -                             throws RecognitionException,
        -                                    TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        primaryExpression

        -
        public final void primaryExpression()
        -                             throws RecognitionException,
        -                                    TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        newExpression

        -
        public final void newExpression()
        -                         throws RecognitionException,
        -                                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:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        identPrimary

        -
        public final void identPrimary()
        -                        throws RecognitionException,
        -                               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:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        constant

        -
        public final void constant()
        -                    throws RecognitionException,
        -                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        newArrayDeclarator

        -
        public final void newArrayDeclarator()
        -                              throws RecognitionException,
        -                                     TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/mode/java/preproc/JavaTokenTypes.html b/build/javadoc/everything/processing/mode/java/preproc/JavaTokenTypes.html deleted file mode 100644 index 856ff43ab0..0000000000 --- a/build/javadoc/everything/processing/mode/java/preproc/JavaTokenTypes.html +++ /dev/null @@ -1,3127 +0,0 @@ - - - - - -JavaTokenTypes - - - - - - - - - - - -
-
processing.mode.java.preproc
-

Interface JavaTokenTypes

-
-
-
- -
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/mode/java/preproc/PdeLexer.html b/build/javadoc/everything/processing/mode/java/preproc/PdeLexer.html deleted file mode 100644 index 8a57607781..0000000000 --- a/build/javadoc/everything/processing/mode/java/preproc/PdeLexer.html +++ /dev/null @@ -1,1666 +0,0 @@ - - - - - -PdeLexer - - - - - - - - - - - -
-
processing.mode.java.preproc
-

Class PdeLexer

-
-
-
    -
  • Object
  • -
  • -
      -
    • CharScanner
    • -
    • -
        -
      • PdeLexer
      • -
      -
    • -
    -
  • -
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _tokenSet_0

        -
        public static final BitSet _tokenSet_0
        -
      • -
      - - - -
        -
      • -

        _tokenSet_1

        -
        public static final BitSet _tokenSet_1
        -
      • -
      - - - -
        -
      • -

        _tokenSet_2

        -
        public static final BitSet _tokenSet_2
        -
      • -
      - - - -
        -
      • -

        _tokenSet_3

        -
        public static final BitSet _tokenSet_3
        -
      • -
      - - - -
        -
      • -

        _tokenSet_4

        -
        public static final BitSet _tokenSet_4
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - - - - - -
        -
      • -

        PdeLexer

        -
        public PdeLexer(Reader in)
        -
      • -
      - - - -
        -
      • -

        PdeLexer

        -
        public PdeLexer(InputBuffer ib)
        -
      • -
      - - - -
        -
      • -

        PdeLexer

        -
        public PdeLexer(LexerSharedInputState state)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        enableAssert

        -
        public void enableAssert(boolean shouldEnable)
        -
        Enable the "assert" keyword
        -
      • -
      - - - -
        -
      • -

        isAssertEnabled

        -
        public boolean isAssertEnabled()
        -
        Query the "assert" keyword state
        -
      • -
      - - - -
        -
      • -

        enableEnum

        -
        public void enableEnum(boolean shouldEnable)
        -
        Enable the "enum" keyword
        -
      • -
      - - - -
        -
      • -

        isEnumEnabled

        -
        public boolean isEnumEnabled()
        -
        Query the "enum" keyword state
        -
      • -
      - - - -
        -
      • -

        nextToken

        -
        public Token nextToken()
        -                throws TokenStreamException
        -
        -
        Throws:
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mWS

        -
        public final void mWS(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSL_COMMENT

        -
        public final void mSL_COMMENT(boolean _createToken)
        -                       throws RecognitionException,
        -                              CharStreamException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mML_COMMENT

        -
        public final void mML_COMMENT(boolean _createToken)
        -                       throws RecognitionException,
        -                              CharStreamException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mWEBCOLOR_LITERAL

        -
        public final void mWEBCOLOR_LITERAL(boolean _createToken)
        -                             throws RecognitionException,
        -                                    CharStreamException,
        -                                    TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mQUESTION

        -
        public final void mQUESTION(boolean _createToken)
        -                     throws RecognitionException,
        -                            CharStreamException,
        -                            TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLPAREN

        -
        public final void mLPAREN(boolean _createToken)
        -                   throws RecognitionException,
        -                          CharStreamException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mRPAREN

        -
        public final void mRPAREN(boolean _createToken)
        -                   throws RecognitionException,
        -                          CharStreamException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLBRACK

        -
        public final void mLBRACK(boolean _createToken)
        -                   throws RecognitionException,
        -                          CharStreamException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mRBRACK

        -
        public final void mRBRACK(boolean _createToken)
        -                   throws RecognitionException,
        -                          CharStreamException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLCURLY

        -
        public final void mLCURLY(boolean _createToken)
        -                   throws RecognitionException,
        -                          CharStreamException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mRCURLY

        -
        public final void mRCURLY(boolean _createToken)
        -                   throws RecognitionException,
        -                          CharStreamException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mCOLON

        -
        public final void mCOLON(boolean _createToken)
        -                  throws RecognitionException,
        -                         CharStreamException,
        -                         TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mCOMMA

        -
        public final void mCOMMA(boolean _createToken)
        -                  throws RecognitionException,
        -                         CharStreamException,
        -                         TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mASSIGN

        -
        public final void mASSIGN(boolean _createToken)
        -                   throws RecognitionException,
        -                          CharStreamException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mEQUAL

        -
        public final void mEQUAL(boolean _createToken)
        -                  throws RecognitionException,
        -                         CharStreamException,
        -                         TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLNOT

        -
        public final void mLNOT(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBNOT

        -
        public final void mBNOT(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mNOT_EQUAL

        -
        public final void mNOT_EQUAL(boolean _createToken)
        -                      throws RecognitionException,
        -                             CharStreamException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mDIV

        -
        public final void mDIV(boolean _createToken)
        -                throws RecognitionException,
        -                       CharStreamException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mDIV_ASSIGN

        -
        public final void mDIV_ASSIGN(boolean _createToken)
        -                       throws RecognitionException,
        -                              CharStreamException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mPLUS

        -
        public final void mPLUS(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mPLUS_ASSIGN

        -
        public final void mPLUS_ASSIGN(boolean _createToken)
        -                        throws RecognitionException,
        -                               CharStreamException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mINC

        -
        public final void mINC(boolean _createToken)
        -                throws RecognitionException,
        -                       CharStreamException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mMINUS

        -
        public final void mMINUS(boolean _createToken)
        -                  throws RecognitionException,
        -                         CharStreamException,
        -                         TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mMINUS_ASSIGN

        -
        public final void mMINUS_ASSIGN(boolean _createToken)
        -                         throws RecognitionException,
        -                                CharStreamException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mDEC

        -
        public final void mDEC(boolean _createToken)
        -                throws RecognitionException,
        -                       CharStreamException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSTAR

        -
        public final void mSTAR(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSTAR_ASSIGN

        -
        public final void mSTAR_ASSIGN(boolean _createToken)
        -                        throws RecognitionException,
        -                               CharStreamException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mMOD

        -
        public final void mMOD(boolean _createToken)
        -                throws RecognitionException,
        -                       CharStreamException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mMOD_ASSIGN

        -
        public final void mMOD_ASSIGN(boolean _createToken)
        -                       throws RecognitionException,
        -                              CharStreamException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSR

        -
        public final void mSR(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSR_ASSIGN

        -
        public final void mSR_ASSIGN(boolean _createToken)
        -                      throws RecognitionException,
        -                             CharStreamException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBSR

        -
        public final void mBSR(boolean _createToken)
        -                throws RecognitionException,
        -                       CharStreamException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBSR_ASSIGN

        -
        public final void mBSR_ASSIGN(boolean _createToken)
        -                       throws RecognitionException,
        -                              CharStreamException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mGE

        -
        public final void mGE(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mGT

        -
        public final void mGT(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSL

        -
        public final void mSL(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSL_ASSIGN

        -
        public final void mSL_ASSIGN(boolean _createToken)
        -                      throws RecognitionException,
        -                             CharStreamException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLE

        -
        public final void mLE(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLT

        -
        public final void mLT(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBXOR

        -
        public final void mBXOR(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBXOR_ASSIGN

        -
        public final void mBXOR_ASSIGN(boolean _createToken)
        -                        throws RecognitionException,
        -                               CharStreamException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBOR

        -
        public final void mBOR(boolean _createToken)
        -                throws RecognitionException,
        -                       CharStreamException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBOR_ASSIGN

        -
        public final void mBOR_ASSIGN(boolean _createToken)
        -                       throws RecognitionException,
        -                              CharStreamException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLOR

        -
        public final void mLOR(boolean _createToken)
        -                throws RecognitionException,
        -                       CharStreamException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBAND

        -
        public final void mBAND(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mBAND_ASSIGN

        -
        public final void mBAND_ASSIGN(boolean _createToken)
        -                        throws RecognitionException,
        -                               CharStreamException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mLAND

        -
        public final void mLAND(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSEMI

        -
        public final void mSEMI(boolean _createToken)
        -                 throws RecognitionException,
        -                        CharStreamException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mCHAR_LITERAL

        -
        public final void mCHAR_LITERAL(boolean _createToken)
        -                         throws RecognitionException,
        -                                CharStreamException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mSTRING_LITERAL

        -
        public final void mSTRING_LITERAL(boolean _createToken)
        -                           throws RecognitionException,
        -                                  CharStreamException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mIDENT

        -
        public final void mIDENT(boolean _createToken)
        -                  throws RecognitionException,
        -                         CharStreamException,
        -                         TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mNUM_INT

        -
        public final void mNUM_INT(boolean _createToken)
        -                    throws RecognitionException,
        -                           CharStreamException,
        -                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        mAT

        -
        public final void mAT(boolean _createToken)
        -               throws RecognitionException,
        -                      CharStreamException,
        -                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        CharStreamException
        -
        TokenStreamException
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/mode/java/preproc/PdePartialTokenTypes.html b/build/javadoc/everything/processing/mode/java/preproc/PdePartialTokenTypes.html deleted file mode 100644 index 9eaf5b6e19..0000000000 --- a/build/javadoc/everything/processing/mode/java/preproc/PdePartialTokenTypes.html +++ /dev/null @@ -1,3195 +0,0 @@ - - - - - -PdePartialTokenTypes - - - - - - - - - - - -
-
processing.mode.java.preproc
-

Interface PdePartialTokenTypes

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    PdeRecognizer
    -
    -
    -
    -
    public interface PdePartialTokenTypes
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/mode/java/preproc/PdeRecognizer.html b/build/javadoc/everything/processing/mode/java/preproc/PdeRecognizer.html deleted file mode 100644 index 23dc1e017f..0000000000 --- a/build/javadoc/everything/processing/mode/java/preproc/PdeRecognizer.html +++ /dev/null @@ -1,3272 +0,0 @@ - - - - - -PdeRecognizer - - - - - - - - - - - -
-
processing.mode.java.preproc
-

Class PdeRecognizer

-
-
-
    -
  • Object
  • -
  • -
      -
    • LLkParser
    • -
    • -
        -
      • PdeRecognizer
      • -
      -
    • -
    -
  • -
-
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        _tokenNames

        -
        public static final String[] _tokenNames
        -
      • -
      - - - -
        -
      • -

        _tokenSet_0

        -
        public static final BitSet _tokenSet_0
        -
      • -
      - - - -
        -
      • -

        _tokenSet_1

        -
        public static final BitSet _tokenSet_1
        -
      • -
      - - - -
        -
      • -

        _tokenSet_2

        -
        public static final BitSet _tokenSet_2
        -
      • -
      - - - -
        -
      • -

        _tokenSet_3

        -
        public static final BitSet _tokenSet_3
        -
      • -
      - - - -
        -
      • -

        _tokenSet_4

        -
        public static final BitSet _tokenSet_4
        -
      • -
      - - - -
        -
      • -

        _tokenSet_5

        -
        public static final BitSet _tokenSet_5
        -
      • -
      - - - -
        -
      • -

        _tokenSet_6

        -
        public static final BitSet _tokenSet_6
        -
      • -
      - - - -
        -
      • -

        _tokenSet_7

        -
        public static final BitSet _tokenSet_7
        -
      • -
      - - - -
        -
      • -

        _tokenSet_8

        -
        public static final BitSet _tokenSet_8
        -
      • -
      - - - -
        -
      • -

        _tokenSet_9

        -
        public static final BitSet _tokenSet_9
        -
      • -
      - - - -
        -
      • -

        _tokenSet_10

        -
        public static final BitSet _tokenSet_10
        -
      • -
      - - - -
        -
      • -

        _tokenSet_11

        -
        public static final BitSet _tokenSet_11
        -
      • -
      - - - -
        -
      • -

        _tokenSet_12

        -
        public static final BitSet _tokenSet_12
        -
      • -
      - - - -
        -
      • -

        _tokenSet_13

        -
        public static final BitSet _tokenSet_13
        -
      • -
      - - - -
        -
      • -

        _tokenSet_14

        -
        public static final BitSet _tokenSet_14
        -
      • -
      - - - -
        -
      • -

        _tokenSet_15

        -
        public static final BitSet _tokenSet_15
        -
      • -
      - - - -
        -
      • -

        _tokenSet_16

        -
        public static final BitSet _tokenSet_16
        -
      • -
      - - - -
        -
      • -

        _tokenSet_17

        -
        public static final BitSet _tokenSet_17
        -
      • -
      - - - -
        -
      • -

        _tokenSet_18

        -
        public static final BitSet _tokenSet_18
        -
      • -
      - - - -
        -
      • -

        _tokenSet_19

        -
        public static final BitSet _tokenSet_19
        -
      • -
      - - - -
        -
      • -

        _tokenSet_20

        -
        public static final BitSet _tokenSet_20
        -
      • -
      - - - -
        -
      • -

        _tokenSet_21

        -
        public static final BitSet _tokenSet_21
        -
      • -
      - - - -
        -
      • -

        _tokenSet_22

        -
        public static final BitSet _tokenSet_22
        -
      • -
      - - - -
        -
      • -

        _tokenSet_23

        -
        public static final BitSet _tokenSet_23
        -
      • -
      - - - -
        -
      • -

        _tokenSet_24

        -
        public static final BitSet _tokenSet_24
        -
      • -
      - - - -
        -
      • -

        _tokenSet_25

        -
        public static final BitSet _tokenSet_25
        -
      • -
      - - - -
        -
      • -

        _tokenSet_26

        -
        public static final BitSet _tokenSet_26
        -
      • -
      - - - -
        -
      • -

        _tokenSet_27

        -
        public static final BitSet _tokenSet_27
        -
      • -
      - - - -
        -
      • -

        _tokenSet_28

        -
        public static final BitSet _tokenSet_28
        -
      • -
      - - - -
        -
      • -

        _tokenSet_29

        -
        public static final BitSet _tokenSet_29
        -
      • -
      - - - -
        -
      • -

        _tokenSet_30

        -
        public static final BitSet _tokenSet_30
        -
      • -
      - - - -
        -
      • -

        _tokenSet_31

        -
        public static final BitSet _tokenSet_31
        -
      • -
      - - - -
        -
      • -

        _tokenSet_32

        -
        public static final BitSet _tokenSet_32
        -
      • -
      - - - -
        -
      • -

        _tokenSet_33

        -
        public static final BitSet _tokenSet_33
        -
      • -
      - - - -
        -
      • -

        _tokenSet_34

        -
        public static final BitSet _tokenSet_34
        -
      • -
      - - - -
        -
      • -

        _tokenSet_35

        -
        public static final BitSet _tokenSet_35
        -
      • -
      - - - -
        -
      • -

        _tokenSet_36

        -
        public static final BitSet _tokenSet_36
        -
      • -
      - - - -
        -
      • -

        _tokenSet_37

        -
        public static final BitSet _tokenSet_37
        -
      • -
      - - - -
        -
      • -

        _tokenSet_38

        -
        public static final BitSet _tokenSet_38
        -
      • -
      - - - -
        -
      • -

        _tokenSet_39

        -
        public static final BitSet _tokenSet_39
        -
      • -
      - - - -
        -
      • -

        _tokenSet_40

        -
        public static final BitSet _tokenSet_40
        -
      • -
      - - - -
        -
      • -

        _tokenSet_41

        -
        public static final BitSet _tokenSet_41
        -
      • -
      - - - -
        -
      • -

        _tokenSet_42

        -
        public static final BitSet _tokenSet_42
        -
      • -
      - - - -
        -
      • -

        _tokenSet_43

        -
        public static final BitSet _tokenSet_43
        -
      • -
      - - - -
        -
      • -

        _tokenSet_44

        -
        public static final BitSet _tokenSet_44
        -
      • -
      - - - -
        -
      • -

        _tokenSet_45

        -
        public static final BitSet _tokenSet_45
        -
      • -
      - - - -
        -
      • -

        _tokenSet_46

        -
        public static final BitSet _tokenSet_46
        -
      • -
      - - - -
        -
      • -

        _tokenSet_47

        -
        public static final BitSet _tokenSet_47
        -
      • -
      - - - -
        -
      • -

        _tokenSet_48

        -
        public static final BitSet _tokenSet_48
        -
      • -
      - - - -
        -
      • -

        _tokenSet_49

        -
        public static final BitSet _tokenSet_49
        -
      • -
      - - - -
        -
      • -

        _tokenSet_50

        -
        public static final BitSet _tokenSet_50
        -
      • -
      - - - -
        -
      • -

        _tokenSet_51

        -
        public static final BitSet _tokenSet_51
        -
      • -
      - - - -
        -
      • -

        _tokenSet_52

        -
        public static final BitSet _tokenSet_52
        -
      • -
      - - - -
        -
      • -

        _tokenSet_53

        -
        public static final BitSet _tokenSet_53
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PdeRecognizer

        -
        public PdeRecognizer(PdePreprocessor pp,
        -                     TokenStream ts)
        -
      • -
      - - - -
        -
      • -

        PdeRecognizer

        -
        public PdeRecognizer(TokenBuffer tokenBuf)
        -
      • -
      - - - -
        -
      • -

        PdeRecognizer

        -
        public PdeRecognizer(TokenStream lexer)
        -
      • -
      - - - -
        -
      • -

        PdeRecognizer

        -
        public PdeRecognizer(ParserSharedInputState state)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        pdeProgram

        -
        public final void pdeProgram()
        -                      throws RecognitionException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        staticProgram

        -
        public final void staticProgram()
        -                         throws RecognitionException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        activeProgram

        -
        public final void activeProgram()
        -                         throws RecognitionException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        javaProgram

        -
        public final void javaProgram()
        -                       throws RecognitionException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        compilationUnit

        -
        public final void compilationUnit()
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        possiblyEmptyField

        -
        public final void possiblyEmptyField()
        -                              throws RecognitionException,
        -                                     TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        statement

        -
        public final void statement()
        -                     throws RecognitionException,
        -                            TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        constant

        -
        public final void constant()
        -                    throws RecognitionException,
        -                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        webcolor_literal

        -
        public final void webcolor_literal()
        -                            throws RecognitionException,
        -                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeArguments

        -
        public final void typeArguments()
        -                         throws RecognitionException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeArgument

        -
        public final void typeArgument()
        -                        throws RecognitionException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeParameters

        -
        public final void typeParameters()
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeParameter

        -
        public final void typeParameter()
        -                         throws RecognitionException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        builtInConsCastType

        -
        public final void builtInConsCastType()
        -                               throws RecognitionException,
        -                                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        builtInType

        -
        public final void builtInType()
        -                       throws RecognitionException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        constructorCast

        -
        public final void constructorCast()
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        consCastTypeSpec

        -
        public final void consCastTypeSpec(boolean addImagNode)
        -                            throws RecognitionException,
        -                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        expression

        -
        public final void expression()
        -                      throws RecognitionException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        builtInConsCastTypeSpec

        -
        public final void builtInConsCastTypeSpec(boolean addImagNode)
        -                                   throws RecognitionException,
        -                                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        colorMethodCall

        -
        public final void colorMethodCall()
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        argList

        -
        public final void argList()
        -                   throws RecognitionException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        primaryExpression

        -
        public final void primaryExpression()
        -                             throws RecognitionException,
        -                                    TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        identPrimary

        -
        public final void identPrimary()
        -                        throws RecognitionException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        newExpression

        -
        public final void newExpression()
        -                         throws RecognitionException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        assignmentExpression

        -
        public final void assignmentExpression()
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        variableDefinitions

        -
        public final void variableDefinitions(AST mods,
        -                                      AST t)
        -                               throws RecognitionException,
        -                                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        variableDeclarator

        -
        public final void variableDeclarator(AST mods,
        -                                     AST t)
        -                              throws RecognitionException,
        -                                     TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        varInitializer

        -
        public final void varInitializer()
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        explicitConstructorInvocation

        -
        public final void explicitConstructorInvocation()
        -                                         throws RecognitionException,
        -                                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        classDefinition

        -
        public final void classDefinition(AST modifiers)
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        superClassClause

        -
        public final void superClassClause()
        -                            throws RecognitionException,
        -                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        implementsClause

        -
        public final void implementsClause()
        -                            throws RecognitionException,
        -                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        classBlock

        -
        public final void classBlock()
        -                      throws RecognitionException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        classField

        -
        public final void classField()
        -                      throws RecognitionException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotations

        -
        public final void annotations()
        -                       throws RecognitionException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        packageDefinition

        -
        public final void packageDefinition()
        -                             throws RecognitionException,
        -                                    TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        importDefinition

        -
        public final void importDefinition()
        -                            throws RecognitionException,
        -                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeDefinition

        -
        public final void typeDefinition()
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        identifier

        -
        public final void identifier()
        -                      throws RecognitionException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        identifierStar

        -
        public final void identifierStar()
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        modifiers

        -
        public final void modifiers()
        -                     throws RecognitionException,
        -                            TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        interfaceDefinition

        -
        public final void interfaceDefinition(AST modifiers)
        -                               throws RecognitionException,
        -                                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        enumDefinition

        -
        public final void enumDefinition(AST modifiers)
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationDefinition

        -
        public final void annotationDefinition(AST modifiers)
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        declaration

        -
        public final void declaration()
        -                       throws RecognitionException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeSpec

        -
        public final void typeSpec(boolean addImagNode)
        -                    throws RecognitionException,
        -                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        classTypeSpec

        -
        public final void classTypeSpec(boolean addImagNode)
        -                         throws RecognitionException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        builtInTypeSpec

        -
        public final void builtInTypeSpec(boolean addImagNode)
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        classOrInterfaceType

        -
        public final void classOrInterfaceType(boolean addImagNode)
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeArgumentSpec

        -
        public final void typeArgumentSpec()
        -                            throws RecognitionException,
        -                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        builtInTypeArraySpec

        -
        public final void builtInTypeArraySpec(boolean addImagNode)
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        wildcardType

        -
        public final void wildcardType()
        -                        throws RecognitionException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeArgumentBounds

        -
        public final void typeArgumentBounds()
        -                              throws RecognitionException,
        -                                     TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        type

        -
        public final void type()
        -                throws RecognitionException,
        -                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        modifier

        -
        public final void modifier()
        -                    throws RecognitionException,
        -                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotation

        -
        public final void annotation()
        -                      throws RecognitionException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationArguments

        -
        public final void annotationArguments()
        -                               throws RecognitionException,
        -                                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationMemberValueInitializer

        -
        public final void annotationMemberValueInitializer()
        -                                            throws RecognitionException,
        -                                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        anntotationMemberValuePairs

        -
        public final void anntotationMemberValuePairs()
        -                                       throws RecognitionException,
        -                                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationMemberValuePair

        -
        public final void annotationMemberValuePair()
        -                                     throws RecognitionException,
        -                                            TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        conditionalExpression

        -
        public final void conditionalExpression()
        -                                 throws RecognitionException,
        -                                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationMemberArrayInitializer

        -
        public final void annotationMemberArrayInitializer()
        -                                            throws RecognitionException,
        -                                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationMemberArrayValueInitializer

        -
        public final void annotationMemberArrayValueInitializer()
        -                                                 throws RecognitionException,
        -                                                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        interfaceExtends

        -
        public final void interfaceExtends()
        -                            throws RecognitionException,
        -                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        interfaceBlock

        -
        public final void interfaceBlock()
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        enumBlock

        -
        public final void enumBlock()
        -                     throws RecognitionException,
        -                            TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationBlock

        -
        public final void annotationBlock()
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        typeParameterBounds

        -
        public final void typeParameterBounds()
        -                               throws RecognitionException,
        -                                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        interfaceField

        -
        public final void interfaceField()
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        annotationField

        -
        public final void annotationField()
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        enumConstant

        -
        public final void enumConstant()
        -                        throws RecognitionException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        declaratorBrackets

        -
        public final void declaratorBrackets(AST typ)
        -                              throws RecognitionException,
        -                                     TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        enumConstantBlock

        -
        public final void enumConstantBlock()
        -                             throws RecognitionException,
        -                                    TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        enumConstantField

        -
        public final void enumConstantField()
        -                             throws RecognitionException,
        -                                    TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        parameterDeclarationList

        -
        public final void parameterDeclarationList()
        -                                    throws RecognitionException,
        -                                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        throwsClause

        -
        public final void throwsClause()
        -                        throws RecognitionException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        compoundStatement

        -
        public final void compoundStatement()
        -                             throws RecognitionException,
        -                                    TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        ctorHead

        -
        public final void ctorHead()
        -                    throws RecognitionException,
        -                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        constructorBody

        -
        public final void constructorBody()
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        initializer

        -
        public final void initializer()
        -                       throws RecognitionException,
        -                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        arrayInitializer

        -
        public final void arrayInitializer()
        -                            throws RecognitionException,
        -                                   TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        parameterDeclaration

        -
        public final void parameterDeclaration()
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        variableLengthParameterDeclaration

        -
        public final void variableLengthParameterDeclaration()
        -                                              throws RecognitionException,
        -                                                     TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        parameterModifier

        -
        public final void parameterModifier()
        -                             throws RecognitionException,
        -                                    TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        forStatement

        -
        public final void forStatement()
        -                        throws RecognitionException,
        -                               TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        casesGroup

        -
        public final void casesGroup()
        -                      throws RecognitionException,
        -                             TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        tryBlock

        -
        public final void tryBlock()
        -                    throws RecognitionException,
        -                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        forInit

        -
        public final void forInit()
        -                   throws RecognitionException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        traditionalForClause

        -
        public final void traditionalForClause()
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        forEachClause

        -
        public final void forEachClause()
        -                         throws RecognitionException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        forCond

        -
        public final void forCond()
        -                   throws RecognitionException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        forIter

        -
        public final void forIter()
        -                   throws RecognitionException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        aCase

        -
        public final void aCase()
        -                 throws RecognitionException,
        -                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        caseSList

        -
        public final void caseSList()
        -                     throws RecognitionException,
        -                            TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        expressionList

        -
        public final void expressionList()
        -                          throws RecognitionException,
        -                                 TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        handler

        -
        public final void handler()
        -                   throws RecognitionException,
        -                          TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        finallyClause

        -
        public final void finallyClause()
        -                         throws RecognitionException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        logicalOrExpression

        -
        public final void logicalOrExpression()
        -                               throws RecognitionException,
        -                                      TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        logicalAndExpression

        -
        public final void logicalAndExpression()
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        inclusiveOrExpression

        -
        public final void inclusiveOrExpression()
        -                                 throws RecognitionException,
        -                                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        exclusiveOrExpression

        -
        public final void exclusiveOrExpression()
        -                                 throws RecognitionException,
        -                                        TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        andExpression

        -
        public final void andExpression()
        -                         throws RecognitionException,
        -                                TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        equalityExpression

        -
        public final void equalityExpression()
        -                              throws RecognitionException,
        -                                     TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        relationalExpression

        -
        public final void relationalExpression()
        -                                throws RecognitionException,
        -                                       TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        shiftExpression

        -
        public final void shiftExpression()
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        additiveExpression

        -
        public final void additiveExpression()
        -                              throws RecognitionException,
        -                                     TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        multiplicativeExpression

        -
        public final void multiplicativeExpression()
        -                                    throws RecognitionException,
        -                                           TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        unaryExpression

        -
        public final void unaryExpression()
        -                           throws RecognitionException,
        -                                  TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        unaryExpressionNotPlusMinus

        -
        public final void unaryExpressionNotPlusMinus()
        -                                       throws RecognitionException,
        -                                              TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        postfixExpression

        -
        public final void postfixExpression()
        -                             throws RecognitionException,
        -                                    TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      - - - -
        -
      • -

        newArrayDeclarator

        -
        public final void newArrayDeclarator()
        -                              throws RecognitionException,
        -                                     TokenStreamException
        -
        -
        Throws:
        -
        RecognitionException
        -
        TokenStreamException
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/mode/java/preproc/PdeTokenTypes.html b/build/javadoc/everything/processing/mode/java/preproc/PdeTokenTypes.html deleted file mode 100644 index a07a47a7e7..0000000000 --- a/build/javadoc/everything/processing/mode/java/preproc/PdeTokenTypes.html +++ /dev/null @@ -1,3195 +0,0 @@ - - - - - -PdeTokenTypes - - - - - - - - - - - -
-
processing.mode.java.preproc
-

Interface PdeTokenTypes

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    PdeLexer
    -
    -
    -
    -
    public interface PdeTokenTypes
    -
  • -
-
-
- -
-
- -
-
- - - - - - - diff --git a/build/javadoc/everything/processing/mode/java/preproc/package-frame.html b/build/javadoc/everything/processing/mode/java/preproc/package-frame.html deleted file mode 100644 index 59c1c3f508..0000000000 --- a/build/javadoc/everything/processing/mode/java/preproc/package-frame.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - -processing.mode.java.preproc - - - - -

processing.mode.java.preproc

- - - diff --git a/build/javadoc/everything/processing/mode/java/preproc/package-summary.html b/build/javadoc/everything/processing/mode/java/preproc/package-summary.html deleted file mode 100644 index a4cce6d9e4..0000000000 --- a/build/javadoc/everything/processing/mode/java/preproc/package-summary.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - - -processing.mode.java.preproc - - - - - - - - - - -
-

Package processing.mode.java.preproc

-
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    JavaTokenTypes 
    PdePartialTokenTypes 
    PdeTokenTypes 
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    JavaLexer 
    JavaRecognizer -
    Java 1.5 Recognizer -/** Java 1.5 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.
    -
    PdeLexer 
    PdeRecognizer 
    -
  • -
-
- - - - - - diff --git a/build/javadoc/everything/processing/mode/java/preproc/package-tree.html b/build/javadoc/everything/processing/mode/java/preproc/package-tree.html deleted file mode 100644 index 29ade84401..0000000000 --- a/build/javadoc/everything/processing/mode/java/preproc/package-tree.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - -processing.mode.java.preproc Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.mode.java.preproc

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Interface Hierarchy

- -
- - - - - - diff --git a/build/javadoc/everything/processing/opengl/FrameBuffer.html b/build/javadoc/everything/processing/opengl/FrameBuffer.html deleted file mode 100644 index 2c0a66aeb8..0000000000 --- a/build/javadoc/everything/processing/opengl/FrameBuffer.html +++ /dev/null @@ -1,619 +0,0 @@ - - - - - -FrameBuffer - - - - - - - - - - - -
-
processing.opengl
-

Class FrameBuffer

-
-
-
    -
  • Object
  • -
  • -
      -
    • FrameBuffer
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    -
    public class FrameBuffer
    -extends Object
    -implements PConstants
    -
    Encapsulates a Frame Buffer Object for offscreen rendering. - When created with onscreen == true, it represents the normal - framebuffer. Needed by the stack mechanism in OPENGL2 to return - to onscreen rendering after a sequence of pushFramebuffer calls. - It transparently handles the situations when the FBO extension is - not available. - - By Andres Colubri.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        glFbo

        -
        public int glFbo
        -
      • -
      - - - -
        -
      • -

        glDepth

        -
        public int glDepth
        -
      • -
      - - - -
        -
      • -

        glStencil

        -
        public int glStencil
        -
      • -
      - - - -
        -
      • -

        glDepthStencil

        -
        public int glDepthStencil
        -
      • -
      - - - -
        -
      • -

        glMultisample

        -
        public int glMultisample
        -
      • -
      - - - -
        -
      • -

        width

        -
        public int width
        -
      • -
      - - - -
        -
      • -

        height

        -
        public int height
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
      • -
      - - - -
        -
      • -

        copyColor

        -
        public void copyColor(FrameBuffer dest)
        -
      • -
      - - - -
        -
      • -

        copyDepth

        -
        public void copyDepth(FrameBuffer dest)
        -
      • -
      - - - -
        -
      • -

        copyStencil

        -
        public void copyStencil(FrameBuffer dest)
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(FrameBuffer dest,
        -                 int mask)
        -
      • -
      - - - -
        -
      • -

        bind

        -
        public void bind()
        -
      • -
      - - - -
        -
      • -

        disableDepthTest

        -
        public void disableDepthTest()
        -
      • -
      - - - -
        -
      • -

        finish

        -
        public void finish()
        -
      • -
      - - - -
        -
      • -

        readPixels

        -
        public void readPixels()
        -
      • -
      - - - -
        -
      • -

        getPixels

        -
        public void getPixels(int[] pixels)
        -
      • -
      - - - -
        -
      • -

        getPixelBuffer

        -
        public IntBuffer getPixelBuffer()
        -
      • -
      - - - -
        -
      • -

        hasDepthBuffer

        -
        public boolean hasDepthBuffer()
        -
      • -
      - - - -
        -
      • -

        hasStencilBuffer

        -
        public boolean hasStencilBuffer()
        -
      • -
      - - - -
        -
      • -

        setFBO

        -
        public void setFBO(int id)
        -
      • -
      - - - -
        -
      • -

        setColorBuffer

        -
        public void setColorBuffer(Texture tex)
        -
      • -
      - - - -
        -
      • -

        setColorBuffers

        -
        public void setColorBuffers(Texture[] textures)
        -
      • -
      - - - -
        -
      • -

        setColorBuffers

        -
        public void setColorBuffers(Texture[] textures,
        -                            int n)
        -
      • -
      - - - -
        -
      • -

        swapColorBuffers

        -
        public void swapColorBuffers()
        -
      • -
      - - - -
        -
      • -

        getDefaultReadBuffer

        -
        public int getDefaultReadBuffer()
        -
      • -
      - - - -
        -
      • -

        getDefaultDrawBuffer

        -
        public int getDefaultDrawBuffer()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/opengl/LinePath.PathIterator.html b/build/javadoc/everything/processing/opengl/LinePath.PathIterator.html deleted file mode 100644 index 642f430f9d..0000000000 --- a/build/javadoc/everything/processing/opengl/LinePath.PathIterator.html +++ /dev/null @@ -1,290 +0,0 @@ - - - - - -LinePath.PathIterator - - - - - - - - - - - -
-
processing.opengl
-

Class LinePath.PathIterator

-
-
-
    -
  • Object
  • -
  • -
      -
    • LinePath.PathIterator
    • -
    -
  • -
-
-
    -
  • -
    -
    Enclosing class:
    -
    LinePath
    -
    -
    -
    -
    public static class LinePath.PathIterator
    -extends Object
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        currentSegment

        -
        public int currentSegment(float[] coords)
        -
      • -
      - - - -
        -
      • -

        currentSegment

        -
        public int currentSegment(double[] coords)
        -
      • -
      - - - -
        -
      • -

        getWindingRule

        -
        public int getWindingRule()
        -
      • -
      - - - -
        -
      • -

        isDone

        -
        public boolean isDone()
        -
      • -
      - - - -
        -
      • -

        next

        -
        public void next()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/opengl/LinePath.html b/build/javadoc/everything/processing/opengl/LinePath.html deleted file mode 100644 index 471529e960..0000000000 --- a/build/javadoc/everything/processing/opengl/LinePath.html +++ /dev/null @@ -1,961 +0,0 @@ - - - - - -LinePath - - - - - - - - - - - -
-
processing.opengl
-

Class LinePath

-
-
- -
-
    -
  • -
    -
    -
    public class LinePath
    -extends Object
    -
    The LinePath class allows to represent polygonal paths, - potentially composed by several disjoint polygonal segments. - It can be iterated by the LinePath.PathIterator class including all - of its segment types and winding rules
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Nested Class Summary

      - - - - - - - - - - -
      Nested Classes 
      Modifier and TypeClass and Description
      static class LinePath.PathIterator 
      -
    • -
    - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      static intCAP_BUTT -
      Ends unclosed subpaths and dash segments with no added decoration.
      -
      static intCAP_ROUND -
      Ends unclosed subpaths and dash segments with a round decoration that has a - radius equal to half of the width of the pen.
      -
      static intCAP_SQUARE -
      Ends unclosed subpaths and dash segments with a square projection that - extends beyond the end of the segment to a distance equal to half of the - line width.
      -
      static intJOIN_BEVEL -
      Joins path segments by connecting the outer corners of their wide outlines - with a straight segment.
      -
      static intJOIN_MITER -
      Joins path segments by extending their outside edges until they meet.
      -
      static intJOIN_ROUND -
      Joins path segments by rounding off the corner at a radius of half the line - width.
      -
      static byteSEG_CLOSE -
      Closes segment at current position.
      -
      static byteSEG_LINETO -
      Extends segment by adding a line to a given position.
      -
      static byteSEG_MOVETO -
      Starts segment at a given position.
      -
      static intWIND_EVEN_ODD -
      The winding rule constant for specifying an even-odd rule - for determining the interior of a path.
      -
      static intWIND_NON_ZERO -
      The winding rule constant for specifying a non-zero rule - for determining the interior of a path.
      -
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      Constructor and Description
      LinePath() -
      Constructs a new empty single precision LinePath object with a - default winding rule of WIND_NON_ZERO.
      -
      LinePath(int rule) -
      Constructs a new empty single precision LinePath object with the - specified winding rule to control operations that require the interior of - the path to be defined.
      -
      LinePath(int rule, - int initialCapacity) -
      Constructs a new LinePath object from the given specified initial - values.
      -
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidclosePath() -
      Closes the current subpath by drawing a straight line back to the - coordinates of the last moveTo.
      -
      static byte[]copyOf(byte[] source, - int length) 
      static float[]copyOf(float[] source, - int length) 
      static int[]copyOf(int[] source, - int length) 
      static LinePathcreateStrokedPath(LinePath src, - float weight, - int caps, - int join) 
      static LinePathcreateStrokedPath(LinePath src, - float weight, - int caps, - int join, - float miterlimit) 
      static LinePathcreateStrokedPath(LinePath src, - float weight, - int caps, - int join, - float miterlimit, - PMatrix2D transform) -
      Constructs a solid LinePath with the specified attributes.
      -
      LinePath.PathIteratorgetPathIterator() -
      The iterator for this class is not multi-threaded safe, which means that - the LinePath class does not guarantee that modifications to the - geometry of this LinePath object do not affect any iterations of that - geometry that are already in process.
      -
      intgetWindingRule() -
      Returns the fill style winding rule.
      -
      static doublehypot(double x, - double y) 
      static inthypot(int x, - int y) 
      static longhypot(long x, - long y) 
      static intisqrt(int x) 
      voidlineTo(float x, - float y, - int c) -
      Adds a point to the path by drawing a straight line from the current - coordinates to the new specified coordinates specified in float precision.
      -
      static longlsqrt(long x) 
      voidmoveTo(float x, - float y, - int c) -
      Adds a point to the path by moving to the specified coordinates specified - in float precision.
      -
      voidreset() -
      Resets the path to empty.
      -
      voidsetWindingRule(int rule) -
      Sets the winding rule for this path to the specified value.
      -
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        WIND_EVEN_ODD

        -
        public static final int WIND_EVEN_ODD
        -
        The winding rule constant for specifying an even-odd rule - for determining the interior of a path. - The even-odd rule specifies that a point lies inside the - path if a ray drawn in any direction from that point to - infinity is crossed by path segments an odd number of times.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        WIND_NON_ZERO

        -
        public static final int WIND_NON_ZERO
        -
        The winding rule constant for specifying a non-zero rule - for determining the interior of a path. - The non-zero rule specifies that a point lies inside the - path if a ray drawn in any direction from that point to - infinity is crossed by path segments a different number - of times in the counter-clockwise direction than the - clockwise direction.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        SEG_MOVETO

        -
        public static final byte SEG_MOVETO
        -
        Starts segment at a given position.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        SEG_LINETO

        -
        public static final byte SEG_LINETO
        -
        Extends segment by adding a line to a given position.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        SEG_CLOSE

        -
        public static final byte SEG_CLOSE
        -
        Closes segment at current position.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        JOIN_MITER

        -
        public static final int JOIN_MITER
        -
        Joins path segments by extending their outside edges until they meet.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        JOIN_ROUND

        -
        public static final int JOIN_ROUND
        -
        Joins path segments by rounding off the corner at a radius of half the line - width.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        JOIN_BEVEL

        -
        public static final int JOIN_BEVEL
        -
        Joins path segments by connecting the outer corners of their wide outlines - with a straight segment.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        CAP_BUTT

        -
        public static final int CAP_BUTT
        -
        Ends unclosed subpaths and dash segments with no added decoration.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        CAP_ROUND

        -
        public static final int CAP_ROUND
        -
        Ends unclosed subpaths and dash segments with a round decoration that has a - radius equal to half of the width of the pen.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        CAP_SQUARE

        -
        public static final int CAP_SQUARE
        -
        Ends unclosed subpaths and dash segments with a square projection that - extends beyond the end of the segment to a distance equal to half of the - line width.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        LinePath

        -
        public LinePath()
        -
        Constructs a new empty single precision LinePath object with a - default winding rule of WIND_NON_ZERO.
        -
      • -
      - - - -
        -
      • -

        LinePath

        -
        public LinePath(int rule)
        -
        Constructs a new empty single precision LinePath object with the - specified winding rule to control operations that require the interior of - the path to be defined.
        -
        -
        Parameters:
        -
        rule - the winding rule
        -
        See Also:
        -
        WIND_EVEN_ODD, -WIND_NON_ZERO
        -
        -
      • -
      - - - -
        -
      • -

        LinePath

        -
        public LinePath(int rule,
        -                int initialCapacity)
        -
        Constructs a new LinePath object from the given specified initial - values. This method is only intended for internal use and should not be - made public if the other constructors for this class are ever exposed.
        -
        -
        Parameters:
        -
        rule - the winding rule
        -
        initialTypes - the size to make the initial array to store the path segment types
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        moveTo

        -
        public final void moveTo(float x,
        -                         float y,
        -                         int c)
        -
        Adds a point to the path by moving to the specified coordinates specified - in float precision. -

        - This method provides a single precision variant of the double precision - moveTo() method on the base LinePath class.

        -
        -
        Parameters:
        -
        x - the specified X coordinate
        -
        y - the specified Y coordinate
        -
        See Also:
        -
        moveTo(float, float, int)
        -
        -
      • -
      - - - -
        -
      • -

        lineTo

        -
        public final void lineTo(float x,
        -                         float y,
        -                         int c)
        -
        Adds a point to the path by drawing a straight line from the current - coordinates to the new specified coordinates specified in float precision. -

        - This method provides a single precision variant of the double precision - lineTo() method on the base LinePath class.

        -
        -
        Parameters:
        -
        x - the specified X coordinate
        -
        y - the specified Y coordinate
        -
        See Also:
        -
        lineTo(float, float, int)
        -
        -
      • -
      - - - -
        -
      • -

        getPathIterator

        -
        public LinePath.PathIterator getPathIterator()
        -
        The iterator for this class is not multi-threaded safe, which means that - the LinePath class does not guarantee that modifications to the - geometry of this LinePath object do not affect any iterations of that - geometry that are already in process.
        -
      • -
      - - - -
        -
      • -

        closePath

        -
        public final void closePath()
        -
        Closes the current subpath by drawing a straight line back to the - coordinates of the last moveTo. If the path is already closed then - this method has no effect.
        -
      • -
      - - - -
        -
      • -

        getWindingRule

        -
        public final int getWindingRule()
        -
        Returns the fill style winding rule.
        -
        -
        Returns:
        -
        an integer representing the current winding rule.
        -
        See Also:
        -
        WIND_EVEN_ODD, -WIND_NON_ZERO, -setWindingRule(int)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        reset

        -
        public final void reset()
        -
        Resets the path to empty. The append position is set back to the beginning - of the path and all coordinates and point types are forgotten.
        -
      • -
      - - - -
        -
      • -

        createStrokedPath

        -
        public static LinePath createStrokedPath(LinePath src,
        -                                         float weight,
        -                                         int caps,
        -                                         int join)
        -
      • -
      - - - -
        -
      • -

        createStrokedPath

        -
        public static LinePath createStrokedPath(LinePath src,
        -                                         float weight,
        -                                         int caps,
        -                                         int join,
        -                                         float miterlimit)
        -
      • -
      - - - -
        -
      • -

        createStrokedPath

        -
        public static LinePath createStrokedPath(LinePath src,
        -                                         float weight,
        -                                         int caps,
        -                                         int join,
        -                                         float miterlimit,
        -                                         PMatrix2D transform)
        -
        Constructs a solid LinePath with the specified attributes.
        -
        -
        Parameters:
        -
        src - the original path to be stroked
        -
        weight - the weight of the stroked path
        -
        cap - the decoration of the ends of the segments in the path
        -
        join - the decoration applied where path segments meet
        -
        miterlimit -
        -
        transform -
        -
        -
      • -
      - - - -
        -
      • -

        copyOf

        -
        public static float[] copyOf(float[] source,
        -                             int length)
        -
      • -
      - - - -
        -
      • -

        copyOf

        -
        public static byte[] copyOf(byte[] source,
        -                            int length)
        -
      • -
      - - - -
        -
      • -

        copyOf

        -
        public static int[] copyOf(int[] source,
        -                           int length)
        -
      • -
      - - - -
        -
      • -

        isqrt

        -
        public static int isqrt(int x)
        -
      • -
      - - - -
        -
      • -

        lsqrt

        -
        public static long lsqrt(long x)
        -
      • -
      - - - -
        -
      • -

        hypot

        -
        public static double hypot(double x,
        -                           double y)
        -
      • -
      - - - -
        -
      • -

        hypot

        -
        public static int hypot(int x,
        -                        int y)
        -
      • -
      - - - -
        -
      • -

        hypot

        -
        public static long hypot(long x,
        -                         long y)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/opengl/LineStroker.html b/build/javadoc/everything/processing/opengl/LineStroker.html deleted file mode 100644 index 260120d5b0..0000000000 --- a/build/javadoc/everything/processing/opengl/LineStroker.html +++ /dev/null @@ -1,428 +0,0 @@ - - - - - -LineStroker - - - - - - - - - - - -
-
processing.opengl
-

Class LineStroker

-
-
-
    -
  • Object
  • -
  • -
      -
    • LineStroker
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class LineStroker
    -extends Object
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        LineStroker

        -
        public LineStroker()
        -
        Empty constructor. setOutput and setParameters - must be called prior to calling any other methods.
        -
      • -
      - - - -
        -
      • -

        LineStroker

        -
        public LineStroker(LineStroker output,
        -                   int lineWidth,
        -                   int capStyle,
        -                   int joinStyle,
        -                   int miterLimit,
        -                   PMatrix2D transform)
        -
        Constructs a LineStroker.
        -
        -
        Parameters:
        -
        output - an output LineStroker.
        -
        lineWidth - the desired line width in pixels, in S15.16 format.
        -
        capStyle - the desired end cap style, one of CAP_BUTT, - CAP_ROUND or CAP_SQUARE.
        -
        joinStyle - the desired line join style, one of JOIN_MITER, - JOIN_ROUND or JOIN_BEVEL.
        -
        miterLimit - the desired miter limit, in S15.16 format.
        -
        transform - a Transform4 object indicating the transform that has - been previously applied to all incoming coordinates. This is - required in order to produce consistently shaped end caps and - joins.
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setOutput

        -
        public void setOutput(LineStroker output)
        -
        Sets the output LineStroker of this LineStroker.
        -
        -
        Parameters:
        -
        output - an output LineStroker.
        -
        -
      • -
      - - - -
        -
      • -

        setParameters

        -
        public void setParameters(int lineWidth,
        -                          int capStyle,
        -                          int joinStyle,
        -                          int miterLimit,
        -                          PMatrix2D transform)
        -
        Sets the parameters of this LineStroker.
        -
        -
        Parameters:
        -
        lineWidth - the desired line width in pixels, in S15.16 format.
        -
        capStyle - the desired end cap style, one of CAP_BUTT, - CAP_ROUND or CAP_SQUARE.
        -
        joinStyle - the desired line join style, one of JOIN_MITER, - JOIN_ROUND or JOIN_BEVEL.
        -
        miterLimit - the desired miter limit, in S15.16 format.
        -
        transform - a Transform4 object indicating the transform that has - been previously applied to all incoming coordinates. This is - required in order to produce consistently shaped end caps and - joins.
        -
        -
      • -
      - - - -
        -
      • -

        moveTo

        -
        public void moveTo(int x0,
        -                   int y0,
        -                   int c0)
        -
      • -
      - - - -
        -
      • -

        lineJoin

        -
        public void lineJoin()
        -
      • -
      - - - -
        -
      • -

        lineTo

        -
        public void lineTo(int x1,
        -                   int y1,
        -                   int c1)
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -
      • -
      - - - -
        -
      • -

        end

        -
        public void end()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/opengl/PGL.html b/build/javadoc/everything/processing/opengl/PGL.html deleted file mode 100644 index 182c59ccd1..0000000000 --- a/build/javadoc/everything/processing/opengl/PGL.html +++ /dev/null @@ -1,6199 +0,0 @@ - - - - - -PGL - - - - - - - - - - - -
-
processing.opengl
-

Class PGL

-
-
- -
-
    -
  • -
    -
    Direct Known Subclasses:
    -
    PJOGL
    -
    -
    -
    -
    public abstract class PGL
    -extends Object
    -
    Processing-OpenGL abstraction layer. Needs to be implemented by subclasses - using specific OpenGL-Java bindings. - - It includes a full GLES 2.0 interface.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        primaryPGL

        -
        public boolean primaryPGL
        -
        true if this is the GL interface for a primary surface PGraphics
        -
      • -
      - - - -
        -
      • -

        REQUESTED_DEPTH_BITS

        -
        public static int REQUESTED_DEPTH_BITS
        -
      • -
      - - - -
        -
      • -

        REQUESTED_STENCIL_BITS

        -
        public static int REQUESTED_STENCIL_BITS
        -
      • -
      - - - -
        -
      • -

        REQUESTED_ALPHA_BITS

        -
        public static int REQUESTED_ALPHA_BITS
        -
      • -
      - - - -
        -
      • -

        reqNumSamples

        -
        public int reqNumSamples
        -
      • -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        presentMode

        -
        public boolean presentMode
        -
      • -
      - - - -
        -
      • -

        offsetX

        -
        public float offsetX
        -
      • -
      - - - -
        -
      • -

        offsetY

        -
        public float offsetY
        -
      • -
      - - - -
        -
      • -

        FALSE

        -
        public static int FALSE
        -
      • -
      - - - -
        -
      • -

        TRUE

        -
        public static int TRUE
        -
      • -
      - - - -
        -
      • -

        INT

        -
        public static int INT
        -
      • -
      - - - -
        -
      • -

        BYTE

        -
        public static int BYTE
        -
      • -
      - - - -
        -
      • -

        SHORT

        -
        public static int SHORT
        -
      • -
      - - - -
        -
      • -

        FLOAT

        -
        public static int FLOAT
        -
      • -
      - - - -
        -
      • -

        BOOL

        -
        public static int BOOL
        -
      • -
      - - - -
        -
      • -

        UNSIGNED_INT

        -
        public static int UNSIGNED_INT
        -
      • -
      - - - -
        -
      • -

        UNSIGNED_BYTE

        -
        public static int UNSIGNED_BYTE
        -
      • -
      - - - -
        -
      • -

        UNSIGNED_SHORT

        -
        public static int UNSIGNED_SHORT
        -
      • -
      - - - -
        -
      • -

        RGB

        -
        public static int RGB
        -
      • -
      - - - -
        -
      • -

        RGBA

        -
        public static int RGBA
        -
      • -
      - - - -
        -
      • -

        ALPHA

        -
        public static int ALPHA
        -
      • -
      - - - -
        -
      • -

        LUMINANCE

        -
        public static int LUMINANCE
        -
      • -
      - - - -
        -
      • -

        LUMINANCE_ALPHA

        -
        public static int LUMINANCE_ALPHA
        -
      • -
      - - - -
        -
      • -

        UNSIGNED_SHORT_5_6_5

        -
        public static int UNSIGNED_SHORT_5_6_5
        -
      • -
      - - - -
        -
      • -

        UNSIGNED_SHORT_4_4_4_4

        -
        public static int UNSIGNED_SHORT_4_4_4_4
        -
      • -
      - - - -
        -
      • -

        UNSIGNED_SHORT_5_5_5_1

        -
        public static int UNSIGNED_SHORT_5_5_5_1
        -
      • -
      - - - -
        -
      • -

        RGBA4

        -
        public static int RGBA4
        -
      • -
      - - - -
        -
      • -

        RGB5_A1

        -
        public static int RGB5_A1
        -
      • -
      - - - -
        -
      • -

        RGB565

        -
        public static int RGB565
        -
      • -
      - - - -
        -
      • -

        RGB8

        -
        public static int RGB8
        -
      • -
      - - - -
        -
      • -

        RGBA8

        -
        public static int RGBA8
        -
      • -
      - - - -
        -
      • -

        ALPHA8

        -
        public static int ALPHA8
        -
      • -
      - - - -
        -
      • -

        READ_ONLY

        -
        public static int READ_ONLY
        -
      • -
      - - - -
        -
      • -

        WRITE_ONLY

        -
        public static int WRITE_ONLY
        -
      • -
      - - - -
        -
      • -

        READ_WRITE

        -
        public static int READ_WRITE
        -
      • -
      - - - -
        -
      • -

        TESS_WINDING_NONZERO

        -
        public static int TESS_WINDING_NONZERO
        -
      • -
      - - - -
        -
      • -

        TESS_WINDING_ODD

        -
        public static int TESS_WINDING_ODD
        -
      • -
      - - - -
        -
      • -

        GENERATE_MIPMAP_HINT

        -
        public static int GENERATE_MIPMAP_HINT
        -
      • -
      - - - -
        -
      • -

        FASTEST

        -
        public static int FASTEST
        -
      • -
      - - - -
        -
      • -

        NICEST

        -
        public static int NICEST
        -
      • -
      - - - -
        -
      • -

        DONT_CARE

        -
        public static int DONT_CARE
        -
      • -
      - - - -
        -
      • -

        VENDOR

        -
        public static int VENDOR
        -
      • -
      - - - -
        -
      • -

        RENDERER

        -
        public static int RENDERER
        -
      • -
      - - - -
        -
      • -

        VERSION

        -
        public static int VERSION
        -
      • -
      - - - -
        -
      • -

        EXTENSIONS

        -
        public static int EXTENSIONS
        -
      • -
      - - - -
        -
      • -

        SHADING_LANGUAGE_VERSION

        -
        public static int SHADING_LANGUAGE_VERSION
        -
      • -
      - - - -
        -
      • -

        MAX_SAMPLES

        -
        public static int MAX_SAMPLES
        -
      • -
      - - - -
        -
      • -

        SAMPLES

        -
        public static int SAMPLES
        -
      • -
      - - - -
        -
      • -

        ALIASED_LINE_WIDTH_RANGE

        -
        public static int ALIASED_LINE_WIDTH_RANGE
        -
      • -
      - - - -
        -
      • -

        ALIASED_POINT_SIZE_RANGE

        -
        public static int ALIASED_POINT_SIZE_RANGE
        -
      • -
      - - - -
        -
      • -

        DEPTH_BITS

        -
        public static int DEPTH_BITS
        -
      • -
      - - - -
        -
      • -

        STENCIL_BITS

        -
        public static int STENCIL_BITS
        -
      • -
      - - - -
        -
      • -

        CCW

        -
        public static int CCW
        -
      • -
      - - - -
        -
      • -

        CW

        -
        public static int CW
        -
      • -
      - - - -
        -
      • -

        VIEWPORT

        -
        public static int VIEWPORT
        -
      • -
      - - - -
        -
      • -

        ARRAY_BUFFER

        -
        public static int ARRAY_BUFFER
        -
      • -
      - - - -
        -
      • -

        ELEMENT_ARRAY_BUFFER

        -
        public static int ELEMENT_ARRAY_BUFFER
        -
      • -
      - - - -
        -
      • -

        MAX_VERTEX_ATTRIBS

        -
        public static int MAX_VERTEX_ATTRIBS
        -
      • -
      - - - -
        -
      • -

        STATIC_DRAW

        -
        public static int STATIC_DRAW
        -
      • -
      - - - -
        -
      • -

        DYNAMIC_DRAW

        -
        public static int DYNAMIC_DRAW
        -
      • -
      - - - -
        -
      • -

        STREAM_DRAW

        -
        public static int STREAM_DRAW
        -
      • -
      - - - -
        -
      • -

        BUFFER_SIZE

        -
        public static int BUFFER_SIZE
        -
      • -
      - - - -
        -
      • -

        BUFFER_USAGE

        -
        public static int BUFFER_USAGE
        -
      • -
      - - - -
        -
      • -

        POINTS

        -
        public static int POINTS
        -
      • -
      - - - -
        -
      • -

        LINE_STRIP

        -
        public static int LINE_STRIP
        -
      • -
      - - - -
        -
      • -

        LINE_LOOP

        -
        public static int LINE_LOOP
        -
      • -
      - - - -
        -
      • -

        LINES

        -
        public static int LINES
        -
      • -
      - - - -
        -
      • -

        TRIANGLE_FAN

        -
        public static int TRIANGLE_FAN
        -
      • -
      - - - -
        -
      • -

        TRIANGLE_STRIP

        -
        public static int TRIANGLE_STRIP
        -
      • -
      - - - -
        -
      • -

        TRIANGLES

        -
        public static int TRIANGLES
        -
      • -
      - - - -
        -
      • -

        CULL_FACE

        -
        public static int CULL_FACE
        -
      • -
      - - - -
        -
      • -

        FRONT

        -
        public static int FRONT
        -
      • -
      - - - -
        -
      • -

        BACK

        -
        public static int BACK
        -
      • -
      - - - -
        -
      • -

        FRONT_AND_BACK

        -
        public static int FRONT_AND_BACK
        -
      • -
      - - - -
        -
      • -

        POLYGON_OFFSET_FILL

        -
        public static int POLYGON_OFFSET_FILL
        -
      • -
      - - - -
        -
      • -

        UNPACK_ALIGNMENT

        -
        public static int UNPACK_ALIGNMENT
        -
      • -
      - - - -
        -
      • -

        PACK_ALIGNMENT

        -
        public static int PACK_ALIGNMENT
        -
      • -
      - - - -
        -
      • -

        TEXTURE_2D

        -
        public static int TEXTURE_2D
        -
      • -
      - - - -
        -
      • -

        TEXTURE_RECTANGLE

        -
        public static int TEXTURE_RECTANGLE
        -
      • -
      - - - -
        -
      • -

        TEXTURE_BINDING_2D

        -
        public static int TEXTURE_BINDING_2D
        -
      • -
      - - - -
        -
      • -

        TEXTURE_BINDING_RECTANGLE

        -
        public static int TEXTURE_BINDING_RECTANGLE
        -
      • -
      - - - -
        -
      • -

        MAX_TEXTURE_SIZE

        -
        public static int MAX_TEXTURE_SIZE
        -
      • -
      - - - -
        -
      • -

        TEXTURE_MAX_ANISOTROPY

        -
        public static int TEXTURE_MAX_ANISOTROPY
        -
      • -
      - - - -
        -
      • -

        MAX_TEXTURE_MAX_ANISOTROPY

        -
        public static int MAX_TEXTURE_MAX_ANISOTROPY
        -
      • -
      - - - -
        -
      • -

        MAX_VERTEX_TEXTURE_IMAGE_UNITS

        -
        public static int MAX_VERTEX_TEXTURE_IMAGE_UNITS
        -
      • -
      - - - -
        -
      • -

        MAX_TEXTURE_IMAGE_UNITS

        -
        public static int MAX_TEXTURE_IMAGE_UNITS
        -
      • -
      - - - -
        -
      • -

        MAX_COMBINED_TEXTURE_IMAGE_UNITS

        -
        public static int MAX_COMBINED_TEXTURE_IMAGE_UNITS
        -
      • -
      - - - -
        -
      • -

        NUM_COMPRESSED_TEXTURE_FORMATS

        -
        public static int NUM_COMPRESSED_TEXTURE_FORMATS
        -
      • -
      - - - -
        -
      • -

        COMPRESSED_TEXTURE_FORMATS

        -
        public static int COMPRESSED_TEXTURE_FORMATS
        -
      • -
      - - - -
        -
      • -

        NEAREST

        -
        public static int NEAREST
        -
      • -
      - - - -
        -
      • -

        LINEAR

        -
        public static int LINEAR
        -
      • -
      - - - -
        -
      • -

        LINEAR_MIPMAP_NEAREST

        -
        public static int LINEAR_MIPMAP_NEAREST
        -
      • -
      - - - -
        -
      • -

        LINEAR_MIPMAP_LINEAR

        -
        public static int LINEAR_MIPMAP_LINEAR
        -
      • -
      - - - -
        -
      • -

        CLAMP_TO_EDGE

        -
        public static int CLAMP_TO_EDGE
        -
      • -
      - - - -
        -
      • -

        REPEAT

        -
        public static int REPEAT
        -
      • -
      - - - -
        -
      • -

        TEXTURE0

        -
        public static int TEXTURE0
        -
      • -
      - - - -
        -
      • -

        TEXTURE1

        -
        public static int TEXTURE1
        -
      • -
      - - - -
        -
      • -

        TEXTURE2

        -
        public static int TEXTURE2
        -
      • -
      - - - -
        -
      • -

        TEXTURE3

        -
        public static int TEXTURE3
        -
      • -
      - - - -
        -
      • -

        TEXTURE_MIN_FILTER

        -
        public static int TEXTURE_MIN_FILTER
        -
      • -
      - - - -
        -
      • -

        TEXTURE_MAG_FILTER

        -
        public static int TEXTURE_MAG_FILTER
        -
      • -
      - - - -
        -
      • -

        TEXTURE_WRAP_S

        -
        public static int TEXTURE_WRAP_S
        -
      • -
      - - - -
        -
      • -

        TEXTURE_WRAP_T

        -
        public static int TEXTURE_WRAP_T
        -
      • -
      - - - -
        -
      • -

        TEXTURE_WRAP_R

        -
        public static int TEXTURE_WRAP_R
        -
      • -
      - - - -
        -
      • -

        TEXTURE_CUBE_MAP

        -
        public static int TEXTURE_CUBE_MAP
        -
      • -
      - - - -
        -
      • -

        TEXTURE_CUBE_MAP_POSITIVE_X

        -
        public static int TEXTURE_CUBE_MAP_POSITIVE_X
        -
      • -
      - - - -
        -
      • -

        TEXTURE_CUBE_MAP_POSITIVE_Y

        -
        public static int TEXTURE_CUBE_MAP_POSITIVE_Y
        -
      • -
      - - - -
        -
      • -

        TEXTURE_CUBE_MAP_POSITIVE_Z

        -
        public static int TEXTURE_CUBE_MAP_POSITIVE_Z
        -
      • -
      - - - -
        -
      • -

        TEXTURE_CUBE_MAP_NEGATIVE_X

        -
        public static int TEXTURE_CUBE_MAP_NEGATIVE_X
        -
      • -
      - - - -
        -
      • -

        TEXTURE_CUBE_MAP_NEGATIVE_Y

        -
        public static int TEXTURE_CUBE_MAP_NEGATIVE_Y
        -
      • -
      - - - -
        -
      • -

        TEXTURE_CUBE_MAP_NEGATIVE_Z

        -
        public static int TEXTURE_CUBE_MAP_NEGATIVE_Z
        -
      • -
      - - - -
        -
      • -

        VERTEX_SHADER

        -
        public static int VERTEX_SHADER
        -
      • -
      - - - -
        -
      • -

        FRAGMENT_SHADER

        -
        public static int FRAGMENT_SHADER
        -
      • -
      - - - -
        -
      • -

        INFO_LOG_LENGTH

        -
        public static int INFO_LOG_LENGTH
        -
      • -
      - - - -
        -
      • -

        SHADER_SOURCE_LENGTH

        -
        public static int SHADER_SOURCE_LENGTH
        -
      • -
      - - - -
        -
      • -

        COMPILE_STATUS

        -
        public static int COMPILE_STATUS
        -
      • -
      - - - -
        -
      • -

        LINK_STATUS

        -
        public static int LINK_STATUS
        -
      • -
      - - - -
        -
      • -

        VALIDATE_STATUS

        -
        public static int VALIDATE_STATUS
        -
      • -
      - - - -
        -
      • -

        SHADER_TYPE

        -
        public static int SHADER_TYPE
        -
      • -
      - - - -
        -
      • -

        DELETE_STATUS

        -
        public static int DELETE_STATUS
        -
      • -
      - - - -
        -
      • -

        FLOAT_VEC2

        -
        public static int FLOAT_VEC2
        -
      • -
      - - - -
        -
      • -

        FLOAT_VEC3

        -
        public static int FLOAT_VEC3
        -
      • -
      - - - -
        -
      • -

        FLOAT_VEC4

        -
        public static int FLOAT_VEC4
        -
      • -
      - - - -
        -
      • -

        FLOAT_MAT2

        -
        public static int FLOAT_MAT2
        -
      • -
      - - - -
        -
      • -

        FLOAT_MAT3

        -
        public static int FLOAT_MAT3
        -
      • -
      - - - -
        -
      • -

        FLOAT_MAT4

        -
        public static int FLOAT_MAT4
        -
      • -
      - - - -
        -
      • -

        INT_VEC2

        -
        public static int INT_VEC2
        -
      • -
      - - - -
        -
      • -

        INT_VEC3

        -
        public static int INT_VEC3
        -
      • -
      - - - -
        -
      • -

        INT_VEC4

        -
        public static int INT_VEC4
        -
      • -
      - - - -
        -
      • -

        BOOL_VEC2

        -
        public static int BOOL_VEC2
        -
      • -
      - - - -
        -
      • -

        BOOL_VEC3

        -
        public static int BOOL_VEC3
        -
      • -
      - - - -
        -
      • -

        BOOL_VEC4

        -
        public static int BOOL_VEC4
        -
      • -
      - - - -
        -
      • -

        SAMPLER_2D

        -
        public static int SAMPLER_2D
        -
      • -
      - - - -
        -
      • -

        SAMPLER_CUBE

        -
        public static int SAMPLER_CUBE
        -
      • -
      - - - -
        -
      • -

        LOW_FLOAT

        -
        public static int LOW_FLOAT
        -
      • -
      - - - -
        -
      • -

        MEDIUM_FLOAT

        -
        public static int MEDIUM_FLOAT
        -
      • -
      - - - -
        -
      • -

        HIGH_FLOAT

        -
        public static int HIGH_FLOAT
        -
      • -
      - - - -
        -
      • -

        LOW_INT

        -
        public static int LOW_INT
        -
      • -
      - - - -
        -
      • -

        MEDIUM_INT

        -
        public static int MEDIUM_INT
        -
      • -
      - - - -
        -
      • -

        HIGH_INT

        -
        public static int HIGH_INT
        -
      • -
      - - - -
        -
      • -

        CURRENT_VERTEX_ATTRIB

        -
        public static int CURRENT_VERTEX_ATTRIB
        -
      • -
      - - - -
        -
      • -

        VERTEX_ATTRIB_ARRAY_BUFFER_BINDING

        -
        public static int VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
        -
      • -
      - - - -
        -
      • -

        VERTEX_ATTRIB_ARRAY_ENABLED

        -
        public static int VERTEX_ATTRIB_ARRAY_ENABLED
        -
      • -
      - - - -
        -
      • -

        VERTEX_ATTRIB_ARRAY_SIZE

        -
        public static int VERTEX_ATTRIB_ARRAY_SIZE
        -
      • -
      - - - -
        -
      • -

        VERTEX_ATTRIB_ARRAY_STRIDE

        -
        public static int VERTEX_ATTRIB_ARRAY_STRIDE
        -
      • -
      - - - -
        -
      • -

        VERTEX_ATTRIB_ARRAY_TYPE

        -
        public static int VERTEX_ATTRIB_ARRAY_TYPE
        -
      • -
      - - - -
        -
      • -

        VERTEX_ATTRIB_ARRAY_NORMALIZED

        -
        public static int VERTEX_ATTRIB_ARRAY_NORMALIZED
        -
      • -
      - - - -
        -
      • -

        VERTEX_ATTRIB_ARRAY_POINTER

        -
        public static int VERTEX_ATTRIB_ARRAY_POINTER
        -
      • -
      - - - -
        -
      • -

        BLEND

        -
        public static int BLEND
        -
      • -
      - - - -
        -
      • -

        ONE

        -
        public static int ONE
        -
      • -
      - - - -
        -
      • -

        ZERO

        -
        public static int ZERO
        -
      • -
      - - - -
        -
      • -

        SRC_ALPHA

        -
        public static int SRC_ALPHA
        -
      • -
      - - - -
        -
      • -

        DST_ALPHA

        -
        public static int DST_ALPHA
        -
      • -
      - - - -
        -
      • -

        ONE_MINUS_SRC_ALPHA

        -
        public static int ONE_MINUS_SRC_ALPHA
        -
      • -
      - - - -
        -
      • -

        ONE_MINUS_DST_COLOR

        -
        public static int ONE_MINUS_DST_COLOR
        -
      • -
      - - - -
        -
      • -

        ONE_MINUS_SRC_COLOR

        -
        public static int ONE_MINUS_SRC_COLOR
        -
      • -
      - - - -
        -
      • -

        DST_COLOR

        -
        public static int DST_COLOR
        -
      • -
      - - - -
        -
      • -

        SRC_COLOR

        -
        public static int SRC_COLOR
        -
      • -
      - - - -
        -
      • -

        SAMPLE_ALPHA_TO_COVERAGE

        -
        public static int SAMPLE_ALPHA_TO_COVERAGE
        -
      • -
      - - - -
        -
      • -

        SAMPLE_COVERAGE

        -
        public static int SAMPLE_COVERAGE
        -
      • -
      - - - -
        -
      • -

        KEEP

        -
        public static int KEEP
        -
      • -
      - - - -
        -
      • -

        REPLACE

        -
        public static int REPLACE
        -
      • -
      - - - -
        -
      • -

        INCR

        -
        public static int INCR
        -
      • -
      - - - -
        -
      • -

        DECR

        -
        public static int DECR
        -
      • -
      - - - -
        -
      • -

        INVERT

        -
        public static int INVERT
        -
      • -
      - - - -
        -
      • -

        INCR_WRAP

        -
        public static int INCR_WRAP
        -
      • -
      - - - -
        -
      • -

        DECR_WRAP

        -
        public static int DECR_WRAP
        -
      • -
      - - - -
        -
      • -

        NEVER

        -
        public static int NEVER
        -
      • -
      - - - -
        -
      • -

        ALWAYS

        -
        public static int ALWAYS
        -
      • -
      - - - -
        -
      • -

        EQUAL

        -
        public static int EQUAL
        -
      • -
      - - - -
        -
      • -

        LESS

        -
        public static int LESS
        -
      • -
      - - - -
        -
      • -

        LEQUAL

        -
        public static int LEQUAL
        -
      • -
      - - - -
        -
      • -

        GREATER

        -
        public static int GREATER
        -
      • -
      - - - -
        -
      • -

        GEQUAL

        -
        public static int GEQUAL
        -
      • -
      - - - -
        -
      • -

        NOTEQUAL

        -
        public static int NOTEQUAL
        -
      • -
      - - - -
        -
      • -

        FUNC_ADD

        -
        public static int FUNC_ADD
        -
      • -
      - - - -
        -
      • -

        FUNC_MIN

        -
        public static int FUNC_MIN
        -
      • -
      - - - -
        -
      • -

        FUNC_MAX

        -
        public static int FUNC_MAX
        -
      • -
      - - - -
        -
      • -

        FUNC_REVERSE_SUBTRACT

        -
        public static int FUNC_REVERSE_SUBTRACT
        -
      • -
      - - - -
        -
      • -

        FUNC_SUBTRACT

        -
        public static int FUNC_SUBTRACT
        -
      • -
      - - - -
        -
      • -

        DITHER

        -
        public static int DITHER
        -
      • -
      - - - -
        -
      • -

        CONSTANT_COLOR

        -
        public static int CONSTANT_COLOR
        -
      • -
      - - - -
        -
      • -

        CONSTANT_ALPHA

        -
        public static int CONSTANT_ALPHA
        -
      • -
      - - - -
        -
      • -

        ONE_MINUS_CONSTANT_COLOR

        -
        public static int ONE_MINUS_CONSTANT_COLOR
        -
      • -
      - - - -
        -
      • -

        ONE_MINUS_CONSTANT_ALPHA

        -
        public static int ONE_MINUS_CONSTANT_ALPHA
        -
      • -
      - - - -
        -
      • -

        SRC_ALPHA_SATURATE

        -
        public static int SRC_ALPHA_SATURATE
        -
      • -
      - - - -
        -
      • -

        SCISSOR_TEST

        -
        public static int SCISSOR_TEST
        -
      • -
      - - - -
        -
      • -

        STENCIL_TEST

        -
        public static int STENCIL_TEST
        -
      • -
      - - - -
        -
      • -

        DEPTH_TEST

        -
        public static int DEPTH_TEST
        -
      • -
      - - - -
        -
      • -

        DEPTH_WRITEMASK

        -
        public static int DEPTH_WRITEMASK
        -
      • -
      - - - -
        -
      • -

        ALPHA_TEST

        -
        public static int ALPHA_TEST
        -
      • -
      - - - -
        -
      • -

        COLOR_BUFFER_BIT

        -
        public static int COLOR_BUFFER_BIT
        -
      • -
      - - - -
        -
      • -

        DEPTH_BUFFER_BIT

        -
        public static int DEPTH_BUFFER_BIT
        -
      • -
      - - - -
        -
      • -

        STENCIL_BUFFER_BIT

        -
        public static int STENCIL_BUFFER_BIT
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER

        -
        public static int FRAMEBUFFER
        -
      • -
      - - - -
        -
      • -

        COLOR_ATTACHMENT0

        -
        public static int COLOR_ATTACHMENT0
        -
      • -
      - - - -
        -
      • -

        COLOR_ATTACHMENT1

        -
        public static int COLOR_ATTACHMENT1
        -
      • -
      - - - -
        -
      • -

        COLOR_ATTACHMENT2

        -
        public static int COLOR_ATTACHMENT2
        -
      • -
      - - - -
        -
      • -

        COLOR_ATTACHMENT3

        -
        public static int COLOR_ATTACHMENT3
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER

        -
        public static int RENDERBUFFER
        -
      • -
      - - - -
        -
      • -

        DEPTH_ATTACHMENT

        -
        public static int DEPTH_ATTACHMENT
        -
      • -
      - - - -
        -
      • -

        STENCIL_ATTACHMENT

        -
        public static int STENCIL_ATTACHMENT
        -
      • -
      - - - -
        -
      • -

        READ_FRAMEBUFFER

        -
        public static int READ_FRAMEBUFFER
        -
      • -
      - - - -
        -
      • -

        DRAW_FRAMEBUFFER

        -
        public static int DRAW_FRAMEBUFFER
        -
      • -
      - - - -
        -
      • -

        DEPTH24_STENCIL8

        -
        public static int DEPTH24_STENCIL8
        -
      • -
      - - - -
        -
      • -

        DEPTH_COMPONENT

        -
        public static int DEPTH_COMPONENT
        -
      • -
      - - - -
        -
      • -

        DEPTH_COMPONENT16

        -
        public static int DEPTH_COMPONENT16
        -
      • -
      - - - -
        -
      • -

        DEPTH_COMPONENT24

        -
        public static int DEPTH_COMPONENT24
        -
      • -
      - - - -
        -
      • -

        DEPTH_COMPONENT32

        -
        public static int DEPTH_COMPONENT32
        -
      • -
      - - - -
        -
      • -

        STENCIL_INDEX

        -
        public static int STENCIL_INDEX
        -
      • -
      - - - -
        -
      • -

        STENCIL_INDEX1

        -
        public static int STENCIL_INDEX1
        -
      • -
      - - - -
        -
      • -

        STENCIL_INDEX4

        -
        public static int STENCIL_INDEX4
        -
      • -
      - - - -
        -
      • -

        STENCIL_INDEX8

        -
        public static int STENCIL_INDEX8
        -
      • -
      - - - -
        -
      • -

        DEPTH_STENCIL

        -
        public static int DEPTH_STENCIL
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_COMPLETE

        -
        public static int FRAMEBUFFER_COMPLETE
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_INCOMPLETE_ATTACHMENT

        -
        public static int FRAMEBUFFER_INCOMPLETE_ATTACHMENT
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT

        -
        public static int FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_INCOMPLETE_DIMENSIONS

        -
        public static int FRAMEBUFFER_INCOMPLETE_DIMENSIONS
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_INCOMPLETE_FORMATS

        -
        public static int FRAMEBUFFER_INCOMPLETE_FORMATS
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER

        -
        public static int FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_INCOMPLETE_READ_BUFFER

        -
        public static int FRAMEBUFFER_INCOMPLETE_READ_BUFFER
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_UNSUPPORTED

        -
        public static int FRAMEBUFFER_UNSUPPORTED
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE

        -
        public static int FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_ATTACHMENT_OBJECT_NAME

        -
        public static int FRAMEBUFFER_ATTACHMENT_OBJECT_NAME
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL

        -
        public static int FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL
        -
      • -
      - - - -
        -
      • -

        FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE

        -
        public static int FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_WIDTH

        -
        public static int RENDERBUFFER_WIDTH
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_HEIGHT

        -
        public static int RENDERBUFFER_HEIGHT
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_RED_SIZE

        -
        public static int RENDERBUFFER_RED_SIZE
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_GREEN_SIZE

        -
        public static int RENDERBUFFER_GREEN_SIZE
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_BLUE_SIZE

        -
        public static int RENDERBUFFER_BLUE_SIZE
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_ALPHA_SIZE

        -
        public static int RENDERBUFFER_ALPHA_SIZE
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_DEPTH_SIZE

        -
        public static int RENDERBUFFER_DEPTH_SIZE
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_STENCIL_SIZE

        -
        public static int RENDERBUFFER_STENCIL_SIZE
        -
      • -
      - - - -
        -
      • -

        RENDERBUFFER_INTERNAL_FORMAT

        -
        public static int RENDERBUFFER_INTERNAL_FORMAT
        -
      • -
      - - - -
        -
      • -

        MULTISAMPLE

        -
        public static int MULTISAMPLE
        -
      • -
      - - - -
        -
      • -

        POINT_SMOOTH

        -
        public static int POINT_SMOOTH
        -
      • -
      - - - -
        -
      • -

        LINE_SMOOTH

        -
        public static int LINE_SMOOTH
        -
      • -
      - - - -
        -
      • -

        POLYGON_SMOOTH

        -
        public static int POLYGON_SMOOTH
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setPrimary

        -
        public void setPrimary(boolean primary)
        -
      • -
      - - - -
        -
      • -

        requestFBOLayer

        -
        public void requestFBOLayer()
        -
      • -
      - - - -
        -
      • -

        threadIsCurrent

        -
        public boolean threadIsCurrent()
        -
      • -
      - - - -
        -
      • -

        setThread

        -
        public void setThread(Thread thread)
        -
      • -
      - - - -
        -
      • -

        drawTexture

        -
        public void drawTexture(int target,
        -                        int id,
        -                        int width,
        -                        int height,
        -                        int X0,
        -                        int Y0,
        -                        int X1,
        -                        int Y1)
        -
        Not an approved function, this will change or be removed in the future.
        -
      • -
      - - - -
        -
      • -

        drawTexture

        -
        public void drawTexture(int target,
        -                        int id,
        -                        int texW,
        -                        int texH,
        -                        int viewX,
        -                        int viewY,
        -                        int scrW,
        -                        int scrH,
        -                        int texX0,
        -                        int texY0,
        -                        int texX1,
        -                        int texY1,
        -                        int scrX0,
        -                        int scrY0,
        -                        int scrX1,
        -                        int scrY1)
        -
        Not an approved function, this will change or be removed in the future.
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public abstract void flush()
        -
      • -
      - - - -
        -
      • -

        finish

        -
        public abstract void finish()
        -
      • -
      - - - -
        -
      • -

        hint

        -
        public abstract void hint(int target,
        -                          int hint)
        -
      • -
      - - - -
        -
      • -

        enable

        -
        public abstract void enable(int value)
        -
      • -
      - - - -
        -
      • -

        disable

        -
        public abstract void disable(int value)
        -
      • -
      - - - -
        -
      • -

        getBooleanv

        -
        public abstract void getBooleanv(int value,
        -                                 IntBuffer data)
        -
      • -
      - - - -
        -
      • -

        getIntegerv

        -
        public abstract void getIntegerv(int value,
        -                                 IntBuffer data)
        -
      • -
      - - - -
        -
      • -

        getFloatv

        -
        public abstract void getFloatv(int value,
        -                               FloatBuffer data)
        -
      • -
      - - - -
        -
      • -

        isEnabled

        -
        public abstract boolean isEnabled(int value)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public abstract String getString(int name)
        -
      • -
      - - - -
        -
      • -

        getError

        -
        public abstract int getError()
        -
      • -
      - - - -
        -
      • -

        errorString

        -
        public abstract String errorString(int err)
        -
      • -
      - - - -
        -
      • -

        genBuffers

        -
        public abstract void genBuffers(int n,
        -                                IntBuffer buffers)
        -
      • -
      - - - -
        -
      • -

        deleteBuffers

        -
        public abstract void deleteBuffers(int n,
        -                                   IntBuffer buffers)
        -
      • -
      - - - -
        -
      • -

        bindBuffer

        -
        public abstract void bindBuffer(int target,
        -                                int buffer)
        -
      • -
      - - - -
        -
      • -

        bufferData

        -
        public abstract void bufferData(int target,
        -                                int size,
        -                                Buffer data,
        -                                int usage)
        -
      • -
      - - - -
        -
      • -

        bufferSubData

        -
        public abstract void bufferSubData(int target,
        -                                   int offset,
        -                                   int size,
        -                                   Buffer data)
        -
      • -
      - - - -
        -
      • -

        isBuffer

        -
        public abstract void isBuffer(int buffer)
        -
      • -
      - - - -
        -
      • -

        getBufferParameteriv

        -
        public abstract void getBufferParameteriv(int target,
        -                                          int value,
        -                                          IntBuffer data)
        -
      • -
      - - - -
        -
      • -

        mapBuffer

        -
        public abstract ByteBuffer mapBuffer(int target,
        -                                     int access)
        -
      • -
      - - - -
        -
      • -

        mapBufferRange

        -
        public abstract ByteBuffer mapBufferRange(int target,
        -                                          int offset,
        -                                          int length,
        -                                          int access)
        -
      • -
      - - - -
        -
      • -

        unmapBuffer

        -
        public abstract void unmapBuffer(int target)
        -
      • -
      - - - -
        -
      • -

        depthRangef

        -
        public abstract void depthRangef(float n,
        -                                 float f)
        -
      • -
      - - - -
        -
      • -

        viewport

        -
        public abstract void viewport(int x,
        -                              int y,
        -                              int w,
        -                              int h)
        -
      • -
      - - - -
        -
      • -

        readPixels

        -
        public void readPixels(int x,
        -                       int y,
        -                       int width,
        -                       int height,
        -                       int format,
        -                       int type,
        -                       Buffer buffer)
        -
      • -
      - - - -
        -
      • -

        vertexAttrib1f

        -
        public abstract void vertexAttrib1f(int index,
        -                                    float value)
        -
      • -
      - - - -
        -
      • -

        vertexAttrib2f

        -
        public abstract void vertexAttrib2f(int index,
        -                                    float value0,
        -                                    float value1)
        -
      • -
      - - - -
        -
      • -

        vertexAttrib3f

        -
        public abstract void vertexAttrib3f(int index,
        -                                    float value0,
        -                                    float value1,
        -                                    float value2)
        -
      • -
      - - - -
        -
      • -

        vertexAttrib4f

        -
        public abstract void vertexAttrib4f(int index,
        -                                    float value0,
        -                                    float value1,
        -                                    float value2,
        -                                    float value3)
        -
      • -
      - - - -
        -
      • -

        vertexAttrib1fv

        -
        public abstract void vertexAttrib1fv(int index,
        -                                     FloatBuffer values)
        -
      • -
      - - - -
        -
      • -

        vertexAttrib2fv

        -
        public abstract void vertexAttrib2fv(int index,
        -                                     FloatBuffer values)
        -
      • -
      - - - -
        -
      • -

        vertexAttrib3fv

        -
        public abstract void vertexAttrib3fv(int index,
        -                                     FloatBuffer values)
        -
      • -
      - - - -
        -
      • -

        vertexAttri4fv

        -
        public abstract void vertexAttri4fv(int index,
        -                                    FloatBuffer values)
        -
      • -
      - - - -
        -
      • -

        vertexAttribPointer

        -
        public abstract void vertexAttribPointer(int index,
        -                                         int size,
        -                                         int type,
        -                                         boolean normalized,
        -                                         int stride,
        -                                         int offset)
        -
      • -
      - - - -
        -
      • -

        vertexAttribPointer

        -
        public abstract void vertexAttribPointer(int index,
        -                                         int size,
        -                                         int type,
        -                                         boolean normalized,
        -                                         int stride,
        -                                         Buffer data)
        -
      • -
      - - - -
        -
      • -

        enableVertexAttribArray

        -
        public abstract void enableVertexAttribArray(int index)
        -
      • -
      - - - -
        -
      • -

        disableVertexAttribArray

        -
        public abstract void disableVertexAttribArray(int index)
        -
      • -
      - - - -
        -
      • -

        drawArrays

        -
        public abstract void drawArrays(int mode,
        -                                int first,
        -                                int count)
        -
      • -
      - - - -
        -
      • -

        drawElements

        -
        public abstract void drawElements(int mode,
        -                                  int count,
        -                                  int type,
        -                                  int offset)
        -
      • -
      - - - -
        -
      • -

        drawElements

        -
        public abstract void drawElements(int mode,
        -                                  int count,
        -                                  int type,
        -                                  Buffer indices)
        -
      • -
      - - - -
        -
      • -

        lineWidth

        -
        public abstract void lineWidth(float width)
        -
      • -
      - - - -
        -
      • -

        frontFace

        -
        public abstract void frontFace(int dir)
        -
      • -
      - - - -
        -
      • -

        cullFace

        -
        public abstract void cullFace(int mode)
        -
      • -
      - - - -
        -
      • -

        polygonOffset

        -
        public abstract void polygonOffset(float factor,
        -                                   float units)
        -
      • -
      - - - -
        -
      • -

        pixelStorei

        -
        public abstract void pixelStorei(int pname,
        -                                 int param)
        -
      • -
      - - - -
        -
      • -

        texImage2D

        -
        public abstract void texImage2D(int target,
        -                                int level,
        -                                int internalFormat,
        -                                int width,
        -                                int height,
        -                                int border,
        -                                int format,
        -                                int type,
        -                                Buffer data)
        -
      • -
      - - - -
        -
      • -

        copyTexImage2D

        -
        public abstract void copyTexImage2D(int target,
        -                                    int level,
        -                                    int internalFormat,
        -                                    int x,
        -                                    int y,
        -                                    int width,
        -                                    int height,
        -                                    int border)
        -
      • -
      - - - -
        -
      • -

        texSubImage2D

        -
        public abstract void texSubImage2D(int target,
        -                                   int level,
        -                                   int xOffset,
        -                                   int yOffset,
        -                                   int width,
        -                                   int height,
        -                                   int format,
        -                                   int type,
        -                                   Buffer data)
        -
      • -
      - - - -
        -
      • -

        copyTexSubImage2D

        -
        public abstract void copyTexSubImage2D(int target,
        -                                       int level,
        -                                       int xOffset,
        -                                       int yOffset,
        -                                       int x,
        -                                       int y,
        -                                       int width,
        -                                       int height)
        -
      • -
      - - - -
        -
      • -

        compressedTexImage2D

        -
        public abstract void compressedTexImage2D(int target,
        -                                          int level,
        -                                          int internalFormat,
        -                                          int width,
        -                                          int height,
        -                                          int border,
        -                                          int imageSize,
        -                                          Buffer data)
        -
      • -
      - - - -
        -
      • -

        compressedTexSubImage2D

        -
        public abstract void compressedTexSubImage2D(int target,
        -                                             int level,
        -                                             int xOffset,
        -                                             int yOffset,
        -                                             int width,
        -                                             int height,
        -                                             int format,
        -                                             int imageSize,
        -                                             Buffer data)
        -
      • -
      - - - -
        -
      • -

        texParameteri

        -
        public abstract void texParameteri(int target,
        -                                   int pname,
        -                                   int param)
        -
      • -
      - - - -
        -
      • -

        texParameterf

        -
        public abstract void texParameterf(int target,
        -                                   int pname,
        -                                   float param)
        -
      • -
      - - - -
        -
      • -

        texParameteriv

        -
        public abstract void texParameteriv(int target,
        -                                    int pname,
        -                                    IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        texParameterfv

        -
        public abstract void texParameterfv(int target,
        -                                    int pname,
        -                                    FloatBuffer params)
        -
      • -
      - - - -
        -
      • -

        generateMipmap

        -
        public abstract void generateMipmap(int target)
        -
      • -
      - - - -
        -
      • -

        genTextures

        -
        public abstract void genTextures(int n,
        -                                 IntBuffer textures)
        -
      • -
      - - - -
        -
      • -

        deleteTextures

        -
        public abstract void deleteTextures(int n,
        -                                    IntBuffer textures)
        -
      • -
      - - - -
        -
      • -

        getTexParameteriv

        -
        public abstract void getTexParameteriv(int target,
        -                                       int pname,
        -                                       IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        getTexParameterfv

        -
        public abstract void getTexParameterfv(int target,
        -                                       int pname,
        -                                       FloatBuffer params)
        -
      • -
      - - - -
        -
      • -

        isTexture

        -
        public abstract boolean isTexture(int texture)
        -
      • -
      - - - -
        -
      • -

        activeTexture

        -
        public void activeTexture(int texture)
        -
      • -
      - - - -
        -
      • -

        bindTexture

        -
        public void bindTexture(int target,
        -                        int texture)
        -
      • -
      - - - -
        -
      • -

        createShader

        -
        public abstract int createShader(int type)
        -
      • -
      - - - -
        -
      • -

        shaderSource

        -
        public abstract void shaderSource(int shader,
        -                                  String source)
        -
      • -
      - - - -
        -
      • -

        compileShader

        -
        public abstract void compileShader(int shader)
        -
      • -
      - - - -
        -
      • -

        releaseShaderCompiler

        -
        public abstract void releaseShaderCompiler()
        -
      • -
      - - - -
        -
      • -

        deleteShader

        -
        public abstract void deleteShader(int shader)
        -
      • -
      - - - -
        -
      • -

        shaderBinary

        -
        public abstract void shaderBinary(int count,
        -                                  IntBuffer shaders,
        -                                  int binaryFormat,
        -                                  Buffer binary,
        -                                  int length)
        -
      • -
      - - - -
        -
      • -

        createProgram

        -
        public abstract int createProgram()
        -
      • -
      - - - -
        -
      • -

        attachShader

        -
        public abstract void attachShader(int program,
        -                                  int shader)
        -
      • -
      - - - -
        -
      • -

        detachShader

        -
        public abstract void detachShader(int program,
        -                                  int shader)
        -
      • -
      - - - -
        -
      • -

        linkProgram

        -
        public abstract void linkProgram(int program)
        -
      • -
      - - - -
        -
      • -

        useProgram

        -
        public abstract void useProgram(int program)
        -
      • -
      - - - -
        -
      • -

        deleteProgram

        -
        public abstract void deleteProgram(int program)
        -
      • -
      - - - -
        -
      • -

        getActiveAttrib

        -
        public abstract String getActiveAttrib(int program,
        -                                       int index,
        -                                       IntBuffer size,
        -                                       IntBuffer type)
        -
      • -
      - - - -
        -
      • -

        getAttribLocation

        -
        public abstract int getAttribLocation(int program,
        -                                      String name)
        -
      • -
      - - - -
        -
      • -

        bindAttribLocation

        -
        public abstract void bindAttribLocation(int program,
        -                                        int index,
        -                                        String name)
        -
      • -
      - - - -
        -
      • -

        getUniformLocation

        -
        public abstract int getUniformLocation(int program,
        -                                       String name)
        -
      • -
      - - - -
        -
      • -

        getActiveUniform

        -
        public abstract String getActiveUniform(int program,
        -                                        int index,
        -                                        IntBuffer size,
        -                                        IntBuffer type)
        -
      • -
      - - - -
        -
      • -

        uniform1i

        -
        public abstract void uniform1i(int location,
        -                               int value)
        -
      • -
      - - - -
        -
      • -

        uniform2i

        -
        public abstract void uniform2i(int location,
        -                               int value0,
        -                               int value1)
        -
      • -
      - - - -
        -
      • -

        uniform3i

        -
        public abstract void uniform3i(int location,
        -                               int value0,
        -                               int value1,
        -                               int value2)
        -
      • -
      - - - -
        -
      • -

        uniform4i

        -
        public abstract void uniform4i(int location,
        -                               int value0,
        -                               int value1,
        -                               int value2,
        -                               int value3)
        -
      • -
      - - - -
        -
      • -

        uniform1f

        -
        public abstract void uniform1f(int location,
        -                               float value)
        -
      • -
      - - - -
        -
      • -

        uniform2f

        -
        public abstract void uniform2f(int location,
        -                               float value0,
        -                               float value1)
        -
      • -
      - - - -
        -
      • -

        uniform3f

        -
        public abstract void uniform3f(int location,
        -                               float value0,
        -                               float value1,
        -                               float value2)
        -
      • -
      - - - -
        -
      • -

        uniform4f

        -
        public abstract void uniform4f(int location,
        -                               float value0,
        -                               float value1,
        -                               float value2,
        -                               float value3)
        -
      • -
      - - - -
        -
      • -

        uniform1iv

        -
        public abstract void uniform1iv(int location,
        -                                int count,
        -                                IntBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniform2iv

        -
        public abstract void uniform2iv(int location,
        -                                int count,
        -                                IntBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniform3iv

        -
        public abstract void uniform3iv(int location,
        -                                int count,
        -                                IntBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniform4iv

        -
        public abstract void uniform4iv(int location,
        -                                int count,
        -                                IntBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniform1fv

        -
        public abstract void uniform1fv(int location,
        -                                int count,
        -                                FloatBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniform2fv

        -
        public abstract void uniform2fv(int location,
        -                                int count,
        -                                FloatBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniform3fv

        -
        public abstract void uniform3fv(int location,
        -                                int count,
        -                                FloatBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniform4fv

        -
        public abstract void uniform4fv(int location,
        -                                int count,
        -                                FloatBuffer v)
        -
      • -
      - - - -
        -
      • -

        uniformMatrix2fv

        -
        public abstract void uniformMatrix2fv(int location,
        -                                      int count,
        -                                      boolean transpose,
        -                                      FloatBuffer mat)
        -
      • -
      - - - -
        -
      • -

        uniformMatrix3fv

        -
        public abstract void uniformMatrix3fv(int location,
        -                                      int count,
        -                                      boolean transpose,
        -                                      FloatBuffer mat)
        -
      • -
      - - - -
        -
      • -

        uniformMatrix4fv

        -
        public abstract void uniformMatrix4fv(int location,
        -                                      int count,
        -                                      boolean transpose,
        -                                      FloatBuffer mat)
        -
      • -
      - - - -
        -
      • -

        validateProgram

        -
        public abstract void validateProgram(int program)
        -
      • -
      - - - -
        -
      • -

        isShader

        -
        public abstract boolean isShader(int shader)
        -
      • -
      - - - -
        -
      • -

        getShaderiv

        -
        public abstract void getShaderiv(int shader,
        -                                 int pname,
        -                                 IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        getAttachedShaders

        -
        public abstract void getAttachedShaders(int program,
        -                                        int maxCount,
        -                                        IntBuffer count,
        -                                        IntBuffer shaders)
        -
      • -
      - - - -
        -
      • -

        getShaderInfoLog

        -
        public abstract String getShaderInfoLog(int shader)
        -
      • -
      - - - -
        -
      • -

        getShaderSource

        -
        public abstract String getShaderSource(int shader)
        -
      • -
      - - - -
        -
      • -

        getShaderPrecisionFormat

        -
        public abstract void getShaderPrecisionFormat(int shaderType,
        -                                              int precisionType,
        -                                              IntBuffer range,
        -                                              IntBuffer precision)
        -
      • -
      - - - -
        -
      • -

        getVertexAttribfv

        -
        public abstract void getVertexAttribfv(int index,
        -                                       int pname,
        -                                       FloatBuffer params)
        -
      • -
      - - - -
        -
      • -

        getVertexAttribiv

        -
        public abstract void getVertexAttribiv(int index,
        -                                       int pname,
        -                                       IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        getVertexAttribPointerv

        -
        public abstract void getVertexAttribPointerv(int index,
        -                                             int pname,
        -                                             ByteBuffer data)
        -
      • -
      - - - -
        -
      • -

        getUniformfv

        -
        public abstract void getUniformfv(int program,
        -                                  int location,
        -                                  FloatBuffer params)
        -
      • -
      - - - -
        -
      • -

        getUniformiv

        -
        public abstract void getUniformiv(int program,
        -                                  int location,
        -                                  IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        isProgram

        -
        public abstract boolean isProgram(int program)
        -
      • -
      - - - -
        -
      • -

        getProgramiv

        -
        public abstract void getProgramiv(int program,
        -                                  int pname,
        -                                  IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        getProgramInfoLog

        -
        public abstract String getProgramInfoLog(int program)
        -
      • -
      - - - -
        -
      • -

        scissor

        -
        public abstract void scissor(int x,
        -                             int y,
        -                             int w,
        -                             int h)
        -
      • -
      - - - -
        -
      • -

        sampleCoverage

        -
        public abstract void sampleCoverage(float value,
        -                                    boolean invert)
        -
      • -
      - - - -
        -
      • -

        stencilFunc

        -
        public abstract void stencilFunc(int func,
        -                                 int ref,
        -                                 int mask)
        -
      • -
      - - - -
        -
      • -

        stencilFuncSeparate

        -
        public abstract void stencilFuncSeparate(int face,
        -                                         int func,
        -                                         int ref,
        -                                         int mask)
        -
      • -
      - - - -
        -
      • -

        stencilOp

        -
        public abstract void stencilOp(int sfail,
        -                               int dpfail,
        -                               int dppass)
        -
      • -
      - - - -
        -
      • -

        stencilOpSeparate

        -
        public abstract void stencilOpSeparate(int face,
        -                                       int sfail,
        -                                       int dpfail,
        -                                       int dppass)
        -
      • -
      - - - -
        -
      • -

        depthFunc

        -
        public abstract void depthFunc(int func)
        -
      • -
      - - - -
        -
      • -

        blendEquation

        -
        public abstract void blendEquation(int mode)
        -
      • -
      - - - -
        -
      • -

        blendEquationSeparate

        -
        public abstract void blendEquationSeparate(int modeRGB,
        -                                           int modeAlpha)
        -
      • -
      - - - -
        -
      • -

        blendFunc

        -
        public abstract void blendFunc(int src,
        -                               int dst)
        -
      • -
      - - - -
        -
      • -

        blendFuncSeparate

        -
        public abstract void blendFuncSeparate(int srcRGB,
        -                                       int dstRGB,
        -                                       int srcAlpha,
        -                                       int dstAlpha)
        -
      • -
      - - - -
        -
      • -

        blendColor

        -
        public abstract void blendColor(float red,
        -                                float green,
        -                                float blue,
        -                                float alpha)
        -
      • -
      - - - -
        -
      • -

        alphaFunc

        -
        public abstract void alphaFunc(int func,
        -                               float ref)
        -
      • -
      - - - -
        -
      • -

        colorMask

        -
        public abstract void colorMask(boolean r,
        -                               boolean g,
        -                               boolean b,
        -                               boolean a)
        -
      • -
      - - - -
        -
      • -

        depthMask

        -
        public abstract void depthMask(boolean mask)
        -
      • -
      - - - -
        -
      • -

        stencilMask

        -
        public abstract void stencilMask(int mask)
        -
      • -
      - - - -
        -
      • -

        stencilMaskSeparate

        -
        public abstract void stencilMaskSeparate(int face,
        -                                         int mask)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public abstract void clear(int buf)
        -
      • -
      - - - -
        -
      • -

        clearColor

        -
        public abstract void clearColor(float r,
        -                                float g,
        -                                float b,
        -                                float a)
        -
      • -
      - - - -
        -
      • -

        clearDepth

        -
        public abstract void clearDepth(float d)
        -
      • -
      - - - -
        -
      • -

        clearStencil

        -
        public abstract void clearStencil(int s)
        -
      • -
      - - - -
        -
      • -

        bindFramebuffer

        -
        public void bindFramebuffer(int target,
        -                            int framebuffer)
        -
      • -
      - - - -
        -
      • -

        deleteFramebuffers

        -
        public abstract void deleteFramebuffers(int n,
        -                                        IntBuffer framebuffers)
        -
      • -
      - - - -
        -
      • -

        genFramebuffers

        -
        public abstract void genFramebuffers(int n,
        -                                     IntBuffer framebuffers)
        -
      • -
      - - - -
        -
      • -

        bindRenderbuffer

        -
        public abstract void bindRenderbuffer(int target,
        -                                      int renderbuffer)
        -
      • -
      - - - -
        -
      • -

        deleteRenderbuffers

        -
        public abstract void deleteRenderbuffers(int n,
        -                                         IntBuffer renderbuffers)
        -
      • -
      - - - -
        -
      • -

        genRenderbuffers

        -
        public abstract void genRenderbuffers(int n,
        -                                      IntBuffer renderbuffers)
        -
      • -
      - - - -
        -
      • -

        renderbufferStorage

        -
        public abstract void renderbufferStorage(int target,
        -                                         int internalFormat,
        -                                         int width,
        -                                         int height)
        -
      • -
      - - - -
        -
      • -

        framebufferRenderbuffer

        -
        public abstract void framebufferRenderbuffer(int target,
        -                                             int attachment,
        -                                             int rendbuferfTarget,
        -                                             int renderbuffer)
        -
      • -
      - - - -
        -
      • -

        framebufferTexture2D

        -
        public abstract void framebufferTexture2D(int target,
        -                                          int attachment,
        -                                          int texTarget,
        -                                          int texture,
        -                                          int level)
        -
      • -
      - - - -
        -
      • -

        checkFramebufferStatus

        -
        public abstract int checkFramebufferStatus(int target)
        -
      • -
      - - - -
        -
      • -

        isFramebuffer

        -
        public abstract boolean isFramebuffer(int framebuffer)
        -
      • -
      - - - -
        -
      • -

        getFramebufferAttachmentParameteriv

        -
        public abstract void getFramebufferAttachmentParameteriv(int target,
        -                                                         int attachment,
        -                                                         int pname,
        -                                                         IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        isRenderbuffer

        -
        public abstract boolean isRenderbuffer(int renderbuffer)
        -
      • -
      - - - -
        -
      • -

        getRenderbufferParameteriv

        -
        public abstract void getRenderbufferParameteriv(int target,
        -                                                int pname,
        -                                                IntBuffer params)
        -
      • -
      - - - -
        -
      • -

        blitFramebuffer

        -
        public abstract void blitFramebuffer(int srcX0,
        -                                     int srcY0,
        -                                     int srcX1,
        -                                     int srcY1,
        -                                     int dstX0,
        -                                     int dstY0,
        -                                     int dstX1,
        -                                     int dstY1,
        -                                     int mask,
        -                                     int filter)
        -
      • -
      - - - -
        -
      • -

        renderbufferStorageMultisample

        -
        public abstract void renderbufferStorageMultisample(int target,
        -                                                    int samples,
        -                                                    int format,
        -                                                    int width,
        -                                                    int height)
        -
      • -
      - - - -
        -
      • -

        readBuffer

        -
        public abstract void readBuffer(int buf)
        -
      • -
      - - - -
        -
      • -

        drawBuffer

        -
        public abstract void drawBuffer(int buf)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/opengl/PGraphics2D.html b/build/javadoc/everything/processing/opengl/PGraphics2D.html deleted file mode 100644 index cba71ca9d3..0000000000 --- a/build/javadoc/everything/processing/opengl/PGraphics2D.html +++ /dev/null @@ -1,2238 +0,0 @@ - - - - - -PGraphics2D - - - - - - - - - - - -
-
processing.opengl
-

Class PGraphics2D

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PGraphics2D

        -
        public PGraphics2D()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        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 3D drawing. Defaults to false.
        -
        -
        Overrides:
        -
        is3D in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        hint

        -
        public void hint(int which)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from hint.xml ) - - Set various hints and hacks for the renderer. This is used to handle - obscure rendering features that cannot be implemented in a consistent - manner across renderers. Many options will often graduate to standard - features instead of hints over time. -

        - hint(ENABLE_OPENGL_4X_SMOOTH) - Enable 4x anti-aliasing for P3D. This - can help force anti-aliasing if it has not been enabled by the user. On - some graphics cards, this can also be set by the graphics driver's - control panel, however not all cards make this available. This hint must - be called immediately after the size() command because it resets the - renderer, obliterating any settings and anything drawn (and like size(), - re-running the code that came before it again). -

        - hint(DISABLE_OPENGL_2X_SMOOTH) - In Processing 1.0, Processing always - enables 2x smoothing when the P3D renderer is used. This hint disables - the default 2x smoothing and returns the smoothing behavior found in - earlier releases, where smooth() and noSmooth() could be used to enable - and disable smoothing, though the quality was inferior. -

        - hint(ENABLE_NATIVE_FONTS) - Use the native version fonts when they are - installed, rather than the bitmapped version from a .vlw file. This is - useful with the default (or JAVA2D) renderer setting, as it will improve - font rendering speed. This is not enabled by default, because it can be - misleading while testing because the type will look great on your - machine (because you have the font installed) but lousy on others' - machines if the identical font is unavailable. This option can only be - set per-sketch, and must be called before any use of textFont(). -

        - hint(DISABLE_DEPTH_TEST) - Disable the zbuffer, allowing you to draw on - top of everything at will. When depth testing is disabled, items will be - drawn to the screen sequentially, like a painting. This hint is most - often used to draw in 3D, then draw in 2D on top of it (for instance, to - draw GUI controls in 2D on top of a 3D interface). Starting in release - 0149, this will also clear the depth buffer. Restore the default with - hint(ENABLE_DEPTH_TEST), but note that with the depth buffer cleared, - any 3D drawing that happens later in draw() will ignore existing shapes - on the screen. -

        - hint(ENABLE_DEPTH_SORT) - Enable primitive z-sorting of triangles and - lines in P3D and OPENGL. This can slow performance considerably, and the - algorithm is not yet perfect. Restore the default with hint(DISABLE_DEPTH_SORT). -

        - hint(DISABLE_OPENGL_ERROR_REPORT) - Speeds up the P3D renderer setting - by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT). -

        - As of release 0149, unhint() has been removed in favor of adding - additional ENABLE/DISABLE constants to reset the default behavior. This - prevents the double negatives, and also reinforces which hints can be - enabled or disabled. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        hint in class PGraphicsOpenGL
        -
        Parameters:
        -
        which - name of the hint to be enabled or disabled
        -
        See Also:
        -
        PGraphics, -PApplet.createGraphics(int, int, String, String), -PApplet.size(int, int)
        -
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho()
        -
        Description copied from class: PGraphicsOpenGL
        -
        Calls ortho() with the proper parameters for Processing's standard - orthographic projection.
        -
        -
        Overrides:
        -
        ortho in class PGraphicsOpenGL
        -
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho(float left,
        -                  float right,
        -                  float bottom,
        -                  float top)
        -
        Description copied from class: PGraphicsOpenGL
        -
        Calls ortho() with the specified size of the viewing volume along - the X and Z directions.
        -
        -
        Overrides:
        -
        ortho in class PGraphicsOpenGL
        -
        Parameters:
        -
        left - left plane of the clipping volume
        -
        right - right plane of the clipping volume
        -
        bottom - bottom plane of the clipping volume
        -
        top - top plane of the clipping volume
        -
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho(float left,
        -                  float right,
        -                  float bottom,
        -                  float top,
        -                  float near,
        -                  float far)
        -
        Description copied from class: PGraphicsOpenGL
        -
        Sets an orthographic projection.
        -
        -
        Overrides:
        -
        ortho in class PGraphicsOpenGL
        -
        near - maximum distance from the origin to the viewer
        -
        far - maximum distance from the origin away from the viewer
        -
        -
      • -
      - - - -
        -
      • -

        perspective

        -
        public void perspective()
        -
        Description copied from class: PGraphicsOpenGL
        -
        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 PGraphicsOpenGL
        -
        -
      • -
      - - - -
        -
      • -

        perspective

        -
        public void perspective(float fov,
        -                        float aspect,
        -                        float zNear,
        -                        float zFar)
        -
        Description copied from class: PGraphicsOpenGL
        -
        Similar to gluPerspective(). Implementation based on Mesa's glu.c
        -
        -
        Overrides:
        -
        perspective in class PGraphicsOpenGL
        -
        Parameters:
        -
        fov - field-of-view angle (in radians) for vertical direction
        -
        aspect - ratio of width to height
        -
        zNear - z-position of nearest clipping plane
        -
        zFar - z-position of farthest clipping plane
        -
        -
      • -
      - - - -
        -
      • -

        frustum

        -
        public void frustum(float left,
        -                    float right,
        -                    float bottom,
        -                    float top,
        -                    float znear,
        -                    float zfar)
        -
        Description copied from class: PGraphicsOpenGL
        -
        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 PGraphicsOpenGL
        -
        Parameters:
        -
        left - left coordinate of the clipping plane
        -
        right - right coordinate of the clipping plane
        -
        bottom - bottom coordinate of the clipping plane
        -
        top - top coordinate of the clipping plane
        -
        znear - near component of the clipping plane; must be greater than zero
        -
        zfar - far component of the clipping plane; must be greater than the near value
        -
        See Also:
        -
        PGraphics.camera(float, float, float, float, float, float, float, float, float), -PGraphics.endCamera(), -PGraphics.perspective(float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        beginCamera

        -
        public void beginCamera()
        -
        Description copied from class: PGraphicsOpenGL
        -
        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 contains - the values of the modelview matrix immediatly after the latter was - initialized with ortho() or camera(), or the modelview matrix as result of - the operations applied between beginCamera()/endCamera(). -

        - 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 in - 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 PGraphicsOpenGL
        -
        See Also:
        -
        PGraphics.camera(), -PGraphics.endCamera(), -PGraphics.applyMatrix(PMatrix), -PGraphics.resetMatrix(), -PGraphics.translate(float, float, float), -PGraphics.scale(float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        camera

        -
        public void camera()
        -
        Description copied from class: PGraphicsOpenGL
        -
        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. -

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

        -
        -
        Overrides:
        -
        camera in class PGraphicsOpenGL
        -
        See Also:
        -
        PGraphics.endCamera(), -PGraphics.frustum(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        camera

        -
        public void camera(float eyeX,
        -                   float eyeY,
        -                   float eyeZ,
        -                   float centerX,
        -                   float centerY,
        -                   float centerZ,
        -                   float upX,
        -                   float upY,
        -                   float upZ)
        -
        Description copied from class: PGraphicsOpenGL
        -
        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 PGraphicsOpenGL
        -
        Parameters:
        -
        eyeX - x-coordinate for the eye
        -
        eyeY - y-coordinate for the eye
        -
        eyeZ - z-coordinate for the eye
        -
        centerX - x-coordinate for the center of the scene
        -
        centerY - y-coordinate for the center of the scene
        -
        centerZ - z-coordinate for the center of the scene
        -
        upX - usually 0.0, 1.0, or -1.0
        -
        upY - usually 0.0, 1.0, or -1.0
        -
        upZ - usually 0.0, 1.0, or -1.0
        -
        -
      • -
      - - - - - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float x,
        -                  float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shape.xml ) - - Displays shapes to the screen. The shapes must be in the sketch's "data" - directory to load correctly. Select "Add file..." from the "Sketch" menu - to add the shape. Processing currently works with SVG shapes only. The - sh parameter specifies the shape to display and the x and - y parameters define the location of the shape from its upper-left - corner. The shape is displayed at its original size unless the - width and height parameters specify a different size. The - shapeMode() function changes the way the parameters work. A call - to shapeMode(CORNERS), for example, will change the width and - height parameters to define the x and y values of the opposite corner of - the shape. -

        - Note complex shapes may draw awkwardly with P3D. This renderer does not - yet support shapes that have holes or complicated breaks. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shape in class PGraphics
        -
        Parameters:
        -
        shape - the shape to display
        -
        x - x-coordinate of the shape
        -
        y - y-coordinate of the shape
        -
        See Also:
        -
        PShape, -PApplet.loadShape(String), -Convenience method to draw at a particular location.
        -
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float a,
        -                  float b,
        -                  float c,
        -                  float d)
        -
        -
        Overrides:
        -
        shape in class PGraphics
        -
        a - x-coordinate of the shape
        -
        b - y-coordinate of the shape
        -
        c - width to display the shape
        -
        d - height to display the shape
        -
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float x,
        -                  float y,
        -                  float z)
        -
      • -
      - - - -
        -
      • -

        shape

        -
        public void shape(PShape shape,
        -                  float x,
        -                  float y,
        -                  float z,
        -                  float c,
        -                  float d,
        -                  float e)
        -
      • -
      - - - -
        -
      • -

        bezierVertex

        -
        public void bezierVertex(float x2,
        -                         float y2,
        -                         float z2,
        -                         float x3,
        -                         float y3,
        -                         float z3,
        -                         float x4,
        -                         float y4,
        -                         float z4)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves. Each call to - bezierVertex() defines the position of two control points and one - anchor point of a Bezier curve, adding a new segment to a line or shape. - The first time bezierVertex() is used within a - beginShape() call, it must be prefaced with a call to - vertex() to set the first anchor point. This function must be - used between beginShape() and endShape() and only when - there is no MODE parameter specified to beginShape(). Using the - 3D version requires rendering with P3D (see the Environment reference - for more information). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        bezierVertex in class PGraphicsOpenGL
        -
        Parameters:
        -
        x2 - the x-coordinate of the 1st control point
        -
        y2 - the y-coordinate of the 1st control point
        -
        z2 - the z-coordinate of the 1st control point
        -
        x3 - the x-coordinate of the 2nd control point
        -
        y3 - the y-coordinate of the 2nd control point
        -
        z3 - the z-coordinate of the 2nd control point
        -
        x4 - the x-coordinate of the anchor point
        -
        y4 - the y-coordinate of the anchor point
        -
        z4 - the z-coordinate of the anchor point
        -
        See Also:
        -
        PGraphics.curveVertex(float, float, float), -PGraphics.vertex(float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float x2,
        -                            float y2,
        -                            float z2,
        -                            float x4,
        -                            float y4,
        -                            float z4)
        -
        -
        Overrides:
        -
        quadraticVertex in class PGraphicsOpenGL
        -
        z2 - the z-coordinate of the control point
        -
        z4 - the z-coordinate of the anchor point
        -
        -
      • -
      - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
        -
        Overrides:
        -
        curveVertex in class PGraphicsOpenGL
        -
        z - the z-coordinate of the vertex
        -
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float w,
        -                float h,
        -                float d)
        -
        -
        Overrides:
        -
        box in class PGraphicsOpenGL
        -
        Parameters:
        -
        w - dimension of the box in the x-dimension
        -
        h - dimension of the box in the y-dimension
        -
        d - dimension of the box in the z-dimension
        -
        -
      • -
      - - - -
        -
      • -

        sphere

        -
        public void sphere(float r)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles. - - ( end auto-generated ) - -

        Advanced

        -

        - 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 PGraphicsOpenGL
        -
        Parameters:
        -
        r - the radius of the sphere
        -
        See Also:
        -
        PGraphics.sphereDetail(int)
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float z)
        -
        -
        Overrides:
        -
        vertex in class PGraphicsOpenGL
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float z,
        -                   float u,
        -                   float v)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices. - vertex() is used to specify the vertex coordinates for points, - lines, triangles, quads, and polygons and is used exclusively within the - beginShape() and endShape() function.
        -
        - Drawing a vertex in 3D using the z parameter requires the P3D - parameter in combination with size as shown in the above example.
        -
        - This function is also used to map a texture onto the geometry. The - texture() function declares the texture to apply to the geometry - and the u and v coordinates set define the mapping of this - texture to the form. By default, the coordinates used for u and - v are specified in relation to the image's size in pixels, but - this relation can be changed with textureMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        vertex in class PGraphicsOpenGL
        -
        Parameters:
        -
        x - x-coordinate of the vertex
        -
        y - y-coordinate of the vertex
        -
        z - z-coordinate of the vertex
        -
        u - horizontal coordinate for the texture mapping
        -
        v - vertical coordinate for the texture mapping
        -
        See Also:
        -
        PGraphics.beginShape(int), -PGraphics.endShape(int), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.texture(PImage)
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float tx,
        -                      float ty,
        -                      float tz)
        -
        -
        Overrides:
        -
        translate in class PGraphicsOpenGL
        -
        tz - forward/backward translation
        -
        -
      • -
      - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateX(PI/2) and then rotateX(PI/2) is the same - as rotateX(PI). If rotateX() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the example above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateX in class PGraphicsOpenGL
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateY(PI/2) and then rotateY(PI/2) is the same - as rotateY(PI). If rotateY() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateY in class PGraphicsOpenGL
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateZ(PI/2) and then rotateZ(PI/2) is the same - as rotateZ(PI). If rotateZ() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateZ in class PGraphicsOpenGL
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle,
        -                   float vx,
        -                   float vy,
        -                   float vz)
        -
        Description copied from class: PGraphicsOpenGL
        -
        Rotate around an arbitrary vector, similar to glRotate(), except that it - takes radians (instead of degrees).
        -
        -
        Overrides:
        -
        rotate in class PGraphicsOpenGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        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: PGraphicsOpenGL
        -
        Apply a 4x4 transformation matrix to the modelview stack.
        -
        -
        Overrides:
        -
        applyMatrix in class PGraphicsOpenGL
        -
        n03 - numbers which define the 4x4 matrix to be multiplied
        -
        n13 - numbers which define the 4x4 matrix to be multiplied
        -
        n20 - numbers which define the 4x4 matrix to be multiplied
        -
        n21 - numbers which define the 4x4 matrix to be multiplied
        -
        n22 - numbers which define the 4x4 matrix to be multiplied
        -
        n23 - numbers which define the 4x4 matrix to be multiplied
        -
        n30 - numbers which define the 4x4 matrix to be multiplied
        -
        n31 - numbers which define the 4x4 matrix to be multiplied
        -
        n32 - numbers which define the 4x4 matrix to be multiplied
        -
        n33 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float sx,
        -                  float sy,
        -                  float sz)
        -
        Description copied from class: PGraphicsOpenGL
        -
        Scale in three dimensions.
        -
        -
        Overrides:
        -
        scale in class PGraphicsOpenGL
        -
        sz - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenX in class PGraphicsOpenGL
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenY in class PGraphicsOpenGL
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenZ

        -
        public float screenZ(float x,
        -                     float y,
        -                     float z)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenZ in class PGraphicsOpenGL
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenY(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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 PGraphicsOpenGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        lights

        -
        public void lights()
        -
        Description copied from class: PGraphicsOpenGL
        -
        Sets up an ambient and directional light using OpenGL. API taken from - PGraphics3D. - -
        - 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 PGraphicsOpenGL
        -
        See Also:
        -
        PGraphics.ambientLight(float, float, float, float, float, float), -PGraphics.directionalLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float), -PGraphics.noLights()
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        ambientLight

        -
        public void ambientLight(float red,
        -                         float green,
        -                         float blue,
        -                         float x,
        -                         float y,
        -                         float z)
        -
        Description copied from class: PGraphicsOpenGL
        -
        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 PGraphicsOpenGL
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        -
      • -
      - - - -
        -
      • -

        directionalLight

        -
        public void directionalLight(float red,
        -                             float green,
        -                             float blue,
        -                             float nx,
        -                             float ny,
        -                             float nz)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from directionalLight.xml ) - - Adds a directional light. Directional light comes from one direction and - is stronger when hitting a surface squarely and weaker if it hits at a a - gentle angle. After hitting a surface, a directional lights scatters in - all directions. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The nx, ny, and nz parameters specify the - direction the light is facing. For example, setting ny to -1 will - cause the geometry to be lit from below (the light is facing directly upward). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        directionalLight in class PGraphicsOpenGL
        -
        Parameters:
        -
        red - red or hue value (depending on current color mode)
        -
        green - green or saturation value (depending on current color mode)
        -
        blue - blue or brightness value (depending on current color mode)
        -
        nx - direction along the x-axis
        -
        ny - direction along the y-axis
        -
        nz - direction along the z-axis
        -
        See Also:
        -
        PGraphics.lights(), -PGraphics.ambientLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        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)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from spotLight.xml ) - - Adds a spot light. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The x, y, and z parameters specify the - position of the light and nx, ny, nz specify the - direction or light. The angle parameter affects angle of the - spotlight cone. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        spotLight in class PGraphicsOpenGL
        -
        Parameters:
        -
        red - red or hue value (depending on current color mode)
        -
        green - green or saturation value (depending on current color mode)
        -
        blue - blue or brightness value (depending on current color mode)
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        nx - direction along the x axis
        -
        ny - direction along the y axis
        -
        nz - direction along the z axis
        -
        angle - angle of the spotlight cone
        -
        concentration - exponent determining the center bias of the cone
        -
        See Also:
        -
        PGraphics.lights(), -PGraphics.directionalLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.ambientLight(float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/opengl/PGraphics3D.html b/build/javadoc/everything/processing/opengl/PGraphics3D.html deleted file mode 100644 index 57461830c3..0000000000 --- a/build/javadoc/everything/processing/opengl/PGraphics3D.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - -PGraphics3D - - - - - - - - - - - -
-
processing.opengl
-

Class PGraphics3D

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PGraphics3D

        -
        public PGraphics3D()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        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 3D drawing. Defaults to false.
        -
        -
        Overrides:
        -
        is3D in class PGraphics
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/opengl/PGraphicsOpenGL.html b/build/javadoc/everything/processing/opengl/PGraphicsOpenGL.html deleted file mode 100644 index 844e16e9a2..0000000000 --- a/build/javadoc/everything/processing/opengl/PGraphicsOpenGL.html +++ /dev/null @@ -1,5795 +0,0 @@ - - - - - -PGraphicsOpenGL - - - - - - - - - - - -
-
processing.opengl
-

Class PGraphicsOpenGL

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        pgl

        -
        public PGL pgl
        -
        Interface between Processing and OpenGL
        -
      • -
      - - - -
        -
      • -

        initialized

        -
        public boolean initialized
        -
        Whether the PGraphics object is ready to render or not.
        -
      • -
      - - - -
        -
      • -

        glPolyVertex

        -
        public int glPolyVertex
        -
      • -
      - - - -
        -
      • -

        glPolyColor

        -
        public int glPolyColor
        -
      • -
      - - - -
        -
      • -

        glPolyNormal

        -
        public int glPolyNormal
        -
      • -
      - - - -
        -
      • -

        glPolyTexcoord

        -
        public int glPolyTexcoord
        -
      • -
      - - - -
        -
      • -

        glPolyAmbient

        -
        public int glPolyAmbient
        -
      • -
      - - - -
        -
      • -

        glPolySpecular

        -
        public int glPolySpecular
        -
      • -
      - - - -
        -
      • -

        glPolyEmissive

        -
        public int glPolyEmissive
        -
      • -
      - - - -
        -
      • -

        glPolyShininess

        -
        public int glPolyShininess
        -
      • -
      - - - -
        -
      • -

        glPolyIndex

        -
        public int glPolyIndex
        -
      • -
      - - - -
        -
      • -

        glLineVertex

        -
        public int glLineVertex
        -
      • -
      - - - -
        -
      • -

        glLineColor

        -
        public int glLineColor
        -
      • -
      - - - -
        -
      • -

        glLineAttrib

        -
        public int glLineAttrib
        -
      • -
      - - - -
        -
      • -

        glLineIndex

        -
        public int glLineIndex
        -
      • -
      - - - -
        -
      • -

        glPointVertex

        -
        public int glPointVertex
        -
      • -
      - - - -
        -
      • -

        glPointColor

        -
        public int glPointColor
        -
      • -
      - - - -
        -
      • -

        glPointAttrib

        -
        public int glPointAttrib
        -
      • -
      - - - -
        -
      • -

        glPointIndex

        -
        public int glPointIndex
        -
      • -
      - - - -
        -
      • -

        npotTexSupported

        -
        public static boolean npotTexSupported
        -
        Extensions used by Processing
        -
      • -
      - - - -
        -
      • -

        autoMipmapGenSupported

        -
        public static boolean autoMipmapGenSupported
        -
      • -
      - - - -
        -
      • -

        fboMultisampleSupported

        -
        public static boolean fboMultisampleSupported
        -
      • -
      - - - -
        -
      • -

        packedDepthStencilSupported

        -
        public static boolean packedDepthStencilSupported
        -
      • -
      - - - -
        -
      • -

        anisoSamplingSupported

        -
        public static boolean anisoSamplingSupported
        -
      • -
      - - - -
        -
      • -

        blendEqSupported

        -
        public static boolean blendEqSupported
        -
      • -
      - - - -
        -
      • -

        maxTextureSize

        -
        public static int maxTextureSize
        -
        Some hardware limits
        -
      • -
      - - - -
        -
      • -

        maxSamples

        -
        public static int maxSamples
        -
      • -
      - - - -
        -
      • -

        maxAnisoAmount

        -
        public static float maxAnisoAmount
        -
      • -
      - - - -
        -
      • -

        depthBits

        -
        public static int depthBits
        -
      • -
      - - - -
        -
      • -

        stencilBits

        -
        public static int stencilBits
        -
      • -
      - - - -
        -
      • -

        OPENGL_VENDOR

        -
        public static String OPENGL_VENDOR
        -
        OpenGL information strings
        -
      • -
      - - - -
        -
      • -

        OPENGL_RENDERER

        -
        public static String OPENGL_RENDERER
        -
      • -
      - - - -
        -
      • -

        OPENGL_VERSION

        -
        public static String OPENGL_VERSION
        -
      • -
      - - - -
        -
      • -

        OPENGL_EXTENSIONS

        -
        public static String OPENGL_EXTENSIONS
        -
      • -
      - - - -
        -
      • -

        GLSL_VERSION

        -
        public static String GLSL_VERSION
        -
      • -
      - - - -
        -
      • -

        cameraFOV

        -
        public float cameraFOV
        -
        Camera field of view.
        -
      • -
      - - - -
        -
      • -

        cameraX

        -
        public float cameraX
        -
        Default position of the camera.
        -
      • -
      - - - -
        -
      • -

        cameraY

        -
        public float cameraY
        -
        Default position of the camera.
        -
      • -
      - - - -
        -
      • -

        cameraZ

        -
        public float cameraZ
        -
        Default position of the camera.
        -
      • -
      - - - -
        -
      • -

        cameraNear

        -
        public float cameraNear
        -
        Distance of the near and far planes.
        -
      • -
      - - - -
        -
      • -

        cameraFar

        -
        public float cameraFar
        -
        Distance of the near and far planes.
        -
      • -
      - - - -
        -
      • -

        cameraAspect

        -
        public float cameraAspect
        -
        Aspect ratio of camera's view.
        -
      • -
      - - - -
        -
      • -

        projection

        -
        public PMatrix3D projection
        -
      • -
      - - - - - - - -
        -
      • -

        cameraInv

        -
        public PMatrix3D cameraInv
        -
      • -
      - - - -
        -
      • -

        modelview

        -
        public PMatrix3D modelview
        -
      • -
      - - - -
        -
      • -

        modelviewInv

        -
        public PMatrix3D modelviewInv
        -
      • -
      - - - -
        -
      • -

        projmodelview

        -
        public PMatrix3D projmodelview
        -
      • -
      - - - -
        -
      • -

        lights

        -
        public boolean lights
        -
      • -
      - - - -
        -
      • -

        lightCount

        -
        public int lightCount
        -
      • -
      - - - -
        -
      • -

        lightType

        -
        public int[] lightType
        -
        Light types
        -
      • -
      - - - -
        -
      • -

        lightPosition

        -
        public float[] lightPosition
        -
        Light positions
        -
      • -
      - - - -
        -
      • -

        lightNormal

        -
        public float[] lightNormal
        -
        Light direction (normalized vector)
        -
      • -
      - - - -
        -
      • -

        lightAmbient

        -
        public float[] lightAmbient
        -
        Ambient colors for lights.
        -
      • -
      - - - -
        -
      • -

        lightDiffuse

        -
        public float[] lightDiffuse
        -
        Diffuse colors for lights.
        -
      • -
      - - - -
        -
      • -

        lightSpecular

        -
        public float[] lightSpecular
        -
        Specular colors for lights. Internally these are stored as numbers between - 0 and 1.
        -
      • -
      - - - -
        -
      • -

        lightFalloffCoefficients

        -
        public float[] lightFalloffCoefficients
        -
        Light falloff
        -
      • -
      - - - -
        -
      • -

        lightSpotParameters

        -
        public float[] lightSpotParameters
        -
        Light spot parameters: Cosine of light spot angle - and concentration
        -
      • -
      - - - -
        -
      • -

        currentLightSpecular

        -
        public float[] currentLightSpecular
        -
        Current specular color for lighting
        -
      • -
      - - - -
        -
      • -

        currentLightFalloffConstant

        -
        public float currentLightFalloffConstant
        -
        Current light falloff
        -
      • -
      - - - -
        -
      • -

        currentLightFalloffLinear

        -
        public float currentLightFalloffLinear
        -
      • -
      - - - -
        -
      • -

        currentLightFalloffQuadratic

        -
        public float currentLightFalloffQuadratic
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PGraphicsOpenGL

        -
        public PGraphicsOpenGL()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setPrimary

        -
        public void setPrimary(boolean primary)
        -
        Description copied from class: PGraphics
        -
        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.
        -
        -
        Overrides:
        -
        setPrimary in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        setSize

        -
        public void setSize(int iwidth,
        -                    int iheight)
        -
        Description copied from class: PGraphics
        -
        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: this is ignored by the Methods task 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.
        -
        -
        Overrides:
        -
        setSize 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
        -
        -
      • -
      - - - - - - - -
        -
      • -

        setCache

        -
        public void setCache(PImage image,
        -                     Object storage)
        -
        Description copied from class: PGraphics
        -
        Store data of some kind for the 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.
        -
        -
        Overrides:
        -
        setCache in class PGraphics
        -
        storage - The metadata required by the renderer
        -
        -
      • -
      - - - -
        -
      • -

        getCache

        -
        public Object getCache(PImage image)
        -
        Description copied from class: PGraphics
        -
        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.
        -
        -
        Overrides:
        -
        getCache in class PGraphics
        -
        Returns:
        -
        metadata stored for the specified renderer
        -
        -
      • -
      - - - -
        -
      • -

        removeCache

        -
        public void removeCache(PImage image)
        -
        Description copied from class: PGraphics
        -
        Remove information associated with this renderer from the cache, if any.
        -
        -
        Overrides:
        -
        removeCache in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        getPixelScale

        -
        public float getPixelScale()
        -
      • -
      - - - -
        -
      • -

        beginDraw

        -
        public void beginDraw()
        -
        OpenGL cannot draw until a proper native peer is available, so this - returns the value of PApplet.isDisplayable() (inherited from Component).
        -
        -
        Overrides:
        -
        beginDraw in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        endDraw

        -
        public void endDraw()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from PGraphics_endDraw.xml ) - - Finalizes the rendering of a PGraphics object so that it can be shown on screen. - - ( end auto-generated ) -

        Advanced

        -

        - When creating your own PGraphics, you should call this when - you're finished drawing.

        -
        -
        Overrides:
        -
        endDraw in class PGraphics
        -
        -
      • -
      - - - - - - - -
        -
      • -

        endPGL

        -
        public void endPGL()
        -
        -
        Overrides:
        -
        endPGL in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        updateProjmodelview

        -
        public void updateProjmodelview()
        -
      • -
      - - - -
        -
      • -

        hint

        -
        public void hint(int which)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from hint.xml ) - - Set various hints and hacks for the renderer. This is used to handle - obscure rendering features that cannot be implemented in a consistent - manner across renderers. Many options will often graduate to standard - features instead of hints over time. -

        - hint(ENABLE_OPENGL_4X_SMOOTH) - Enable 4x anti-aliasing for P3D. This - can help force anti-aliasing if it has not been enabled by the user. On - some graphics cards, this can also be set by the graphics driver's - control panel, however not all cards make this available. This hint must - be called immediately after the size() command because it resets the - renderer, obliterating any settings and anything drawn (and like size(), - re-running the code that came before it again). -

        - hint(DISABLE_OPENGL_2X_SMOOTH) - In Processing 1.0, Processing always - enables 2x smoothing when the P3D renderer is used. This hint disables - the default 2x smoothing and returns the smoothing behavior found in - earlier releases, where smooth() and noSmooth() could be used to enable - and disable smoothing, though the quality was inferior. -

        - hint(ENABLE_NATIVE_FONTS) - Use the native version fonts when they are - installed, rather than the bitmapped version from a .vlw file. This is - useful with the default (or JAVA2D) renderer setting, as it will improve - font rendering speed. This is not enabled by default, because it can be - misleading while testing because the type will look great on your - machine (because you have the font installed) but lousy on others' - machines if the identical font is unavailable. This option can only be - set per-sketch, and must be called before any use of textFont(). -

        - hint(DISABLE_DEPTH_TEST) - Disable the zbuffer, allowing you to draw on - top of everything at will. When depth testing is disabled, items will be - drawn to the screen sequentially, like a painting. This hint is most - often used to draw in 3D, then draw in 2D on top of it (for instance, to - draw GUI controls in 2D on top of a 3D interface). Starting in release - 0149, this will also clear the depth buffer. Restore the default with - hint(ENABLE_DEPTH_TEST), but note that with the depth buffer cleared, - any 3D drawing that happens later in draw() will ignore existing shapes - on the screen. -

        - hint(ENABLE_DEPTH_SORT) - Enable primitive z-sorting of triangles and - lines in P3D and OPENGL. This can slow performance considerably, and the - algorithm is not yet perfect. Restore the default with hint(DISABLE_DEPTH_SORT). -

        - hint(DISABLE_OPENGL_ERROR_REPORT) - Speeds up the P3D renderer setting - by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT). -

        - As of release 0149, unhint() has been removed in favor of adding - additional ENABLE/DISABLE constants to reset the default behavior. This - prevents the double negatives, and also reinforces which hints can be - enabled or disabled. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        hint in class PGraphics
        -
        Parameters:
        -
        which - name of the hint to be enabled or disabled
        -
        See Also:
        -
        PGraphics, -PApplet.createGraphics(int, int, String, String), -PApplet.size(int, int)
        -
        -
      • -
      - - - -
        -
      • -

        beginShape

        -
        public void beginShape(int kind)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from beginShape.xml ) - - Using the beginShape() and endShape() functions allow - creating more complex forms. beginShape() begins recording - vertices for a shape and endShape() stops recording. The value of - the MODE parameter tells it which types of shapes to create from - the provided vertices. With no mode specified, the shape can be any - irregular polygon. The parameters available for beginShape() are POINTS, - LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, and QUAD_STRIP. - After calling the beginShape() function, a series of - vertex() commands must follow. To stop drawing the shape, call - endShape(). The vertex() function with two parameters - specifies a position in 2D and the vertex() function with three - parameters specifies a position in 3D. Each shape will be outlined with - the current stroke color and filled with the fill color. -

        - Transformations such as translate(), rotate(), and - scale() do not work within beginShape(). It is also not - possible to use other shapes, such as ellipse() or rect() - within beginShape(). -

        - The P3D renderer settings allow stroke() and fill() - settings to be altered per-vertex, however the default P2D renderer does - not. Settings such as strokeWeight(), strokeCap(), and - strokeJoin() cannot be changed while inside a - beginShape()/endShape() block with any renderer. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        beginShape in class PGraphics
        -
        Parameters:
        -
        kind - Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIP
        -
        See Also:
        -
        PShape, -PGraphics.endShape(), -PGraphics.vertex(float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape(int mode)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from endShape.xml ) - - The endShape() function is the companion to beginShape() - and may only be called after beginShape(). When endshape() - is called, all of image data defined since the previous call to - beginShape() is written into the image buffer. The constant CLOSE - as the value for the MODE parameter to close the shape (to connect the - beginning and the end). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        endShape in class PGraphics
        -
        Parameters:
        -
        mode - use CLOSE to close the shape
        -
        See Also:
        -
        PShape, -PGraphics.beginShape(int)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textureSampling

        -
        public void textureSampling(int sampling)
        -
      • -
      - - - - - - - -
        -
      • -

        endContour

        -
        public void endContour()
        -
        -
        Overrides:
        -
        endContour in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

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

        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)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from vertex.xml ) - - All shapes are constructed by connecting a series of vertices. - vertex() is used to specify the vertex coordinates for points, - lines, triangles, quads, and polygons and is used exclusively within the - beginShape() and endShape() function.
        -
        - Drawing a vertex in 3D using the z parameter requires the P3D - parameter in combination with size as shown in the above example.
        -
        - This function is also used to map a texture onto the geometry. The - texture() function declares the texture to apply to the geometry - and the u and v coordinates set define the mapping of this - texture to the form. By default, the coordinates used for u and - v are specified in relation to the image's size in pixels, but - this relation can be changed with textureMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        vertex in class PGraphics
        -
        Parameters:
        -
        x - x-coordinate of the vertex
        -
        y - y-coordinate of the vertex
        -
        z - z-coordinate of the vertex
        -
        u - horizontal coordinate for the texture mapping
        -
        v - vertical coordinate for the texture mapping
        -
        See Also:
        -
        PGraphics.beginShape(int), -PGraphics.endShape(int), -PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.curveVertex(float, float, float), -PGraphics.texture(PImage)
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   float... values)
        -
        -
        Overrides:
        -
        attrib in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   int... values)
        -
        -
        Overrides:
        -
        attrib in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   boolean... values)
        -
        -
        Overrides:
        -
        attrib in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        noClip

        -
        public void noClip()
        -
        -
        Overrides:
        -
        noClip in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public void flush()
        -
        -
        Overrides:
        -
        flush in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        bezierVertex

        -
        public void bezierVertex(float x2,
        -                         float y2,
        -                         float x3,
        -                         float y3,
        -                         float x4,
        -                         float y4)
        -
        -
        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)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from bezierVertex.xml ) - - Specifies vertex coordinates for Bezier curves. Each call to - bezierVertex() defines the position of two control points and one - anchor point of a Bezier curve, adding a new segment to a line or shape. - The first time bezierVertex() is used within a - beginShape() call, it must be prefaced with a call to - vertex() to set the first anchor point. This function must be - used between beginShape() and endShape() and only when - there is no MODE parameter specified to beginShape(). Using the - 3D version requires rendering with P3D (see the Environment reference - for more information). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        bezierVertex in class PGraphics
        -
        Parameters:
        -
        x2 - the x-coordinate of the 1st control point
        -
        y2 - the y-coordinate of the 1st control point
        -
        z2 - the z-coordinate of the 1st control point
        -
        x3 - the x-coordinate of the 2nd control point
        -
        y3 - the y-coordinate of the 2nd control point
        -
        z3 - the z-coordinate of the 2nd control point
        -
        x4 - the x-coordinate of the anchor point
        -
        y4 - the y-coordinate of the anchor point
        -
        z4 - the z-coordinate of the anchor point
        -
        See Also:
        -
        PGraphics.curveVertex(float, float, float), -PGraphics.vertex(float, float, float, float, float), -PGraphics.quadraticVertex(float, float, float, float, float, float), -PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float cx,
        -                            float cy,
        -                            float cz,
        -                            float x3,
        -                            float y3,
        -                            float z3)
        -
        -
        Overrides:
        -
        quadraticVertex in class PGraphics
        -
        cz - the z-coordinate of the control point
        -
        z3 - the z-coordinate of the anchor point
        -
        -
      • -
      - - - - - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
        -
        Overrides:
        -
        curveVertex in class PGraphics
        -
        z - the z-coordinate of the vertex
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from point.xml ) - - Draws a point, a coordinate in space at the dimension of one pixel. The - first parameter is the horizontal value for the point, the second value - is the vertical value for the point, and the optional third value is the - depth value. Drawing this shape in 3D with the z parameter - requires the P3D parameter in combination with size() as shown in - the above example. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        point in class PGraphics
        -
        Parameters:
        -
        x - x-coordinate of the point
        -
        y - y-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        point

        -
        public void point(float x,
        -                  float y,
        -                  float z)
        -
        -
        Overrides:
        -
        point in class PGraphics
        -
        z - z-coordinate of the point
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from line.xml ) - - Draws a line (a direct path between two points) to the screen. The - version of line() with four parameters draws the line in 2D. To - color a line, use the stroke() function. A line cannot be filled, - therefore the fill() function will not affect the color of a - line. 2D lines are drawn with a width of one pixel by default, but this - can be changed with the strokeWeight() function. The version with - six parameters allows the line to be placed anywhere within XYZ space. - Drawing this shape in 3D with the z parameter requires the P3D - parameter in combination with size() as shown in the above example. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        line in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        See Also:
        -
        PGraphics.strokeWeight(float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int), -PGraphics.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        line

        -
        public void line(float x1,
        -                 float y1,
        -                 float z1,
        -                 float x2,
        -                 float y2,
        -                 float z2)
        -
        -
        Overrides:
        -
        line in class PGraphics
        -
        z1 - z-coordinate of the first point
        -
        z2 - z-coordinate of the second point
        -
        -
      • -
      - - - -
        -
      • -

        triangle

        -
        public void triangle(float x1,
        -                     float y1,
        -                     float x2,
        -                     float y2,
        -                     float x3,
        -                     float y3)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from triangle.xml ) - - A triangle is a plane created by connecting three points. The first two - arguments specify the first point, the middle two arguments specify the - second point, and the last two arguments specify the third point. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        triangle in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first point
        -
        y1 - y-coordinate of the first point
        -
        x2 - x-coordinate of the second point
        -
        y2 - y-coordinate of the second point
        -
        x3 - x-coordinate of the third point
        -
        y3 - y-coordinate of the third point
        -
        See Also:
        -
        PApplet.beginShape()
        -
        -
      • -
      - - - -
        -
      • -

        quad

        -
        public void quad(float x1,
        -                 float y1,
        -                 float x2,
        -                 float y2,
        -                 float x3,
        -                 float y3,
        -                 float x4,
        -                 float y4)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from quad.xml ) - - A quad is a quadrilateral, a four sided polygon. It is similar to a - rectangle, but the angles between its edges are not constrained to - ninety degrees. The first pair of parameters (x1,y1) sets the first - vertex and the subsequent pairs should proceed clockwise or - counter-clockwise around the defined shape. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        quad in class PGraphics
        -
        Parameters:
        -
        x1 - x-coordinate of the first corner
        -
        y1 - y-coordinate of the first corner
        -
        x2 - x-coordinate of the second corner
        -
        y2 - y-coordinate of the second corner
        -
        x3 - x-coordinate of the third corner
        -
        y3 - y-coordinate of the third corner
        -
        x4 - x-coordinate of the fourth corner
        -
        y4 - y-coordinate of the fourth corner
        -
        -
      • -
      - - - -
        -
      • -

        ellipseImpl

        -
        public void ellipseImpl(float a,
        -                        float b,
        -                        float c,
        -                        float d)
        -
      • -
      - - - -
        -
      • -

        box

        -
        public void box(float w,
        -                float h,
        -                float d)
        -
        -
        Overrides:
        -
        box in class PGraphics
        -
        Parameters:
        -
        w - dimension of the box in the x-dimension
        -
        h - dimension of the box in the y-dimension
        -
        d - dimension of the box in the z-dimension
        -
        -
      • -
      - - - -
        -
      • -

        sphere

        -
        public void sphere(float r)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from sphere.xml ) - - A sphere is a hollow ball made from tessellated triangles. - - ( end auto-generated ) - -

        Advanced

        -

        - 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
        -
        Parameters:
        -
        r - the radius of the sphere
        -
        See Also:
        -
        PGraphics.sphereDetail(int)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        textAscent

        -
        public float textAscent()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from textAscent.xml ) - - Returns ascent of the current font at its current size. This information - is useful for determining the height of the font above the baseline. For - example, adding the textAscent() and textDescent() values - will give you the total height of the line. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        textAscent in class PGraphics
        -
        See Also:
        -
        PGraphics.textDescent()
        -
        -
      • -
      - - - -
        -
      • -

        textDescent

        -
        public float textDescent()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from textDescent.xml ) - - Returns descent of the current font at its current size. This - information is useful for determining the height of the font below the - baseline. For example, adding the textAscent() and - textDescent() values will give you the total height of the line. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        textDescent in class PGraphics
        -
        See Also:
        -
        PGraphics.textAscent()
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        popMatrix

        -
        public void popMatrix()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from popMatrix.xml ) - - Pops the current transformation matrix off the matrix stack. - Understanding pushing and popping requires understanding the concept of - a matrix stack. The pushMatrix() function saves the current - coordinate system to the stack and popMatrix() restores the prior - coordinate system. pushMatrix() and popMatrix() are used - in conjuction with the other transformation functions and may be - embedded to control the scope of the transformations. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        popMatrix in class PGraphics
        -
        See Also:
        -
        PGraphics.pushMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float tx,
        -                      float ty)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from translate.xml ) - - Specifies an amount to displace objects within the display window. The - x parameter specifies left/right translation, the y - parameter specifies up/down translation, and the z parameter - specifies translations toward/away from the screen. Using this function - with the z parameter requires using P3D as a parameter in - combination with size as shown in the above example. Transformations - apply to everything that happens after and subsequent calls to the - function accumulates the effect. For example, calling translate(50, - 0) and then translate(20, 0) is the same as translate(70, - 0). If translate() is called within draw(), the - transformation is reset when the loop begins again. This function can be - further controlled by the pushMatrix() and popMatrix(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        translate in class PGraphics
        -
        Parameters:
        -
        tx - left/right translation
        -
        ty - up/down translation
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float tx,
        -                      float ty,
        -                      float tz)
        -
        -
        Overrides:
        -
        translate in class PGraphics
        -
        tz - forward/backward translation
        -
        -
      • -
      - - - - - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateX(PI/2) and then rotateX(PI/2) is the same - as rotateX(PI). If rotateX() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the example above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateX in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateY(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateY(PI/2) and then rotateY(PI/2) is the same - as rotateY(PI). If rotateY() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateY in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateZ(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always rotated around their relative position to - the origin and positive numbers rotate objects in a counterclockwise - direction. Transformations apply to everything that happens after and - subsequent calls to the function accumulates the effect. For example, - calling rotateZ(PI/2) and then rotateZ(PI/2) is the same - as rotateZ(PI). If rotateZ() is called within the - draw(), the transformation is reset when the loop begins again. - This function requires using P3D as a third parameter to size() - as shown in the examples above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateZ in class PGraphics
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.rotate(float), -PGraphics.rotateX(float), -PGraphics.rotateY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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 sx,
        -                  float sy)
        -
        Same as scale(sx, sy, 1).
        -
        -
        Overrides:
        -
        scale in class PGraphics
        -
        Parameters:
        -
        sx - percentage to scale the object in the x-axis
        -
        sy - percentage to scale the object in the y-axis
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float sx,
        -                  float sy,
        -                  float sz)
        -
        Scale in three dimensions.
        -
        -
        Overrides:
        -
        scale in class PGraphics
        -
        sz - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - -
        -
      • -

        shearX

        -
        public void shearX(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shearX.xml ) - - Shears a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearX(PI/2) and then shearX(PI/2) is the same as - shearX(PI). If shearX() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearX() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shearX in class PGraphics
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearY(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - -
        -
      • -

        shearY

        -
        public void shearY(float angle)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shearY.xml ) - - Shears a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to PI*2) or converted to radians with the radians() - function. Objects are always sheared around their relative position to - the origin and positive numbers shear objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the function accumulates the effect. For example, calling - shearY(PI/2) and then shearY(PI/2) is the same as - shearY(PI). If shearY() is called within the - draw(), the transformation is reset when the loop begins again. -

        - Technically, shearY() multiplies the current transformation - matrix by a rotation matrix. This function can be further controlled by - the pushMatrix() and popMatrix() functions. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shearY in class PGraphics
        -
        Parameters:
        -
        angle - angle of shear specified in radians
        -
        See Also:
        -
        PGraphics.popMatrix(), -PGraphics.pushMatrix(), -PGraphics.shearX(float), -PGraphics.scale(float, float, float), -PGraphics.translate(float, float, float), -PApplet.radians(float)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(float n00,
        -                        float n01,
        -                        float n02,
        -                        float n10,
        -                        float n11,
        -                        float n12)
        -
        -
        Overrides:
        -
        applyMatrix in class PGraphics
        -
        Parameters:
        -
        n00 - numbers which define the 4x4 matrix to be multiplied
        -
        n01 - numbers which define the 4x4 matrix to be multiplied
        -
        n02 - numbers which define the 4x4 matrix to be multiplied
        -
        n10 - numbers which define the 4x4 matrix to be multiplied
        -
        n11 - numbers which define the 4x4 matrix to be multiplied
        -
        n12 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - - - - - -
        -
      • -

        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 to the modelview stack.
        -
        -
        Overrides:
        -
        applyMatrix in class PGraphics
        -
        n03 - numbers which define the 4x4 matrix to be multiplied
        -
        n13 - numbers which define the 4x4 matrix to be multiplied
        -
        n20 - numbers which define the 4x4 matrix to be multiplied
        -
        n21 - numbers which define the 4x4 matrix to be multiplied
        -
        n22 - numbers which define the 4x4 matrix to be multiplied
        -
        n23 - numbers which define the 4x4 matrix to be multiplied
        -
        n30 - numbers which define the 4x4 matrix to be multiplied
        -
        n31 - numbers which define the 4x4 matrix to be multiplied
        -
        n32 - numbers which define the 4x4 matrix to be multiplied
        -
        n33 - numbers which define the 4x4 matrix to be multiplied
        -
        -
      • -
      - - - - - - - -
        -
      • -

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

        pushProjection

        -
        public void pushProjection()
        -
      • -
      - - - -
        -
      • -

        popProjection

        -
        public void popProjection()
        -
      • -
      - - - -
        -
      • -

        resetProjection

        -
        public void resetProjection()
        -
      • -
      - - - -
        -
      • -

        applyProjection

        -
        public void applyProjection(PMatrix3D mat)
        -
      • -
      - - - -
        -
      • -

        applyProjection

        -
        public void applyProjection(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)
        -
      • -
      - - - -
        -
      • -

        setProjection

        -
        public void setProjection(PMatrix3D mat)
        -
      • -
      - - - -
        -
      • -

        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 contains - the values of the modelview matrix immediatly after the latter was - initialized with ortho() or camera(), or the modelview matrix as result of - the operations applied between beginCamera()/endCamera(). -

        - 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 in - 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
        -
        See Also:
        -
        PGraphics.camera(), -PGraphics.endCamera(), -PGraphics.applyMatrix(PMatrix), -PGraphics.resetMatrix(), -PGraphics.translate(float, float, float), -PGraphics.scale(float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

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

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

        -
        -
        Overrides:
        -
        camera in class PGraphics
        -
        See Also:
        -
        PGraphics.endCamera(), -PGraphics.frustum(float, float, float, float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        Parameters:
        -
        eyeX - x-coordinate for the eye
        -
        eyeY - y-coordinate for the eye
        -
        eyeZ - z-coordinate for the eye
        -
        centerX - x-coordinate for the center of the scene
        -
        centerY - y-coordinate for the center of the scene
        -
        centerZ - z-coordinate for the center of the scene
        -
        upX - usually 0.0, 1.0, or -1.0
        -
        upY - usually 0.0, 1.0, or -1.0
        -
        upZ - usually 0.0, 1.0, or -1.0
        -
        -
      • -
      - - - - - - - -
        -
      • -

        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)
        -
        Calls ortho() with the specified size of the viewing volume along - the X and Z directions.
        -
        -
        Overrides:
        -
        ortho in class PGraphics
        -
        Parameters:
        -
        left - left plane of the clipping volume
        -
        right - right plane of the clipping volume
        -
        bottom - bottom plane of the clipping volume
        -
        top - top plane of the clipping volume
        -
        -
      • -
      - - - -
        -
      • -

        ortho

        -
        public void ortho(float left,
        -                  float right,
        -                  float bottom,
        -                  float top,
        -                  float near,
        -                  float far)
        -
        Sets an orthographic projection.
        -
        -
        Overrides:
        -
        ortho in class PGraphics
        -
        near - maximum distance from the origin to the viewer
        -
        far - maximum distance from the origin away from the viewer
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        Parameters:
        -
        fov - field-of-view angle (in radians) for vertical direction
        -
        aspect - ratio of width to height
        -
        zNear - z-position of nearest clipping plane
        -
        zFar - z-position of farthest clipping plane
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        Parameters:
        -
        left - left coordinate of the clipping plane
        -
        right - right coordinate of the clipping plane
        -
        bottom - bottom coordinate of the clipping plane
        -
        top - top coordinate of the clipping plane
        -
        znear - near component of the clipping plane; must be greater than zero
        -
        zfar - far component of the clipping plane; must be greater than the near value
        -
        See Also:
        -
        PGraphics.camera(float, float, float, float, float, float, float, float, float), -PGraphics.endCamera(), -PGraphics.perspective(float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenX.xml ) - - Takes a three-dimensional X, Y, Z position and returns the X value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenX in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenY(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenY.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Y value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenY in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        screenX

        -
        public float screenX(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenX in class PGraphics
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenY

        -
        public float screenY(float x,
        -                     float y,
        -                     float z)
        -
        -
        Overrides:
        -
        screenY in class PGraphics
        -
        z - 3D z-coordinate to be mapped
        -
        -
      • -
      - - - -
        -
      • -

        screenZ

        -
        public float screenZ(float x,
        -                     float y,
        -                     float z)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from screenZ.xml ) - - Takes a three-dimensional X, Y, Z position and returns the Z value for - where it will appear on a (two-dimensional) screen. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        screenZ in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.screenX(float, float, float), -PGraphics.screenY(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelX

        -
        public float modelX(float x,
        -                    float y,
        -                    float z)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from modelX.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the X value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The X value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use. -

        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        modelX in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.modelY(float, float, float), -PGraphics.modelZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelY

        -
        public float modelY(float x,
        -                    float y,
        -                    float z)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from modelY.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the Y value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The Y value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use.
        -
        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        modelY in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.modelX(float, float, float), -PGraphics.modelZ(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        modelZ

        -
        public float modelZ(float x,
        -                    float y,
        -                    float z)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from modelZ.xml ) - - Returns the three-dimensional X, Y, Z position in model space. This - returns the Z value for a given coordinate based on the current set of - transformations (scale, rotate, translate, etc.) The Z value can be used - to place an object in space relative to the location of the original - point once the transformations are no longer in use.
        -
        - In the example, the modelX(), modelY(), and - modelZ() functions record the location of a box in space after - being placed using a series of translate and rotate commands. After - popMatrix() is called, those transformations no longer apply, but the - (x, y, z) coordinate returned by the model functions is used to place - another box in the same location. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        modelZ in class PGraphics
        -
        Parameters:
        -
        x - 3D x-coordinate to be mapped
        -
        y - 3D y-coordinate to be mapped
        -
        z - 3D z-coordinate to be mapped
        -
        See Also:
        -
        PGraphics.modelX(float, float, float), -PGraphics.modelY(float, float, float)
        -
        -
      • -
      - - - -
        -
      • -

        popStyle

        -
        public void popStyle()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from popStyle.xml ) - - The pushStyle() function saves the current style settings and - popStyle() restores the prior settings; these functions are - always used together. They allow you to change the style settings and - later return to what you had. When a new style is started with - pushStyle(), it builds on the current style information. The - pushStyle() and popStyle() functions can be embedded to - provide more control (see the second example above for a demonstration.) - - ( end auto-generated )
        -
        -
        Overrides:
        -
        popStyle in class PGraphics
        -
        See Also:
        -
        PGraphics.pushStyle()
        -
        -
      • -
      - - - -
        -
      • -

        strokeWeight

        -
        public void strokeWeight(float weight)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from strokeWeight.xml ) - - Sets the width of the stroke used for lines, points, and the border - around shapes. All widths are set in units of pixels. -

        - When drawing with P3D, series of connected lines (such as the stroke - around a polygon, triangle, or ellipse) produce unattractive results - when a thick stroke weight is set (see - Issue 123). With P3D, the minimum and maximum values for - strokeWeight() are controlled by the graphics card and the - operating system's OpenGL implementation. For instance, the thickness - may not go higher than 10 pixels. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        strokeWeight in class PGraphics
        -
        Parameters:
        -
        weight - the weight (in pixels) of the stroke
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeJoin(int), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - -
        -
      • -

        strokeJoin

        -
        public void strokeJoin(int join)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from strokeJoin.xml ) - - Sets the style of the joints which connect line segments. These joints - are either mitered, beveled, or rounded and specified with the - corresponding parameters MITER, BEVEL, and ROUND. The default joint is - MITER. -

        - This function is not available with the P3D renderer, (see - Issue 123). More information about the renderers can be found in the - size() reference. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        strokeJoin in class PGraphics
        -
        Parameters:
        -
        join - either MITER, BEVEL, ROUND
        -
        See Also:
        -
        PGraphics.stroke(int, float), -PGraphics.strokeWeight(float), -PGraphics.strokeCap(int)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        lights

        -
        public void lights()
        -
        Sets up an ambient and directional light using OpenGL. API taken from - PGraphics3D. - -
        - 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
        -
        See Also:
        -
        PGraphics.ambientLight(float, float, float, float, float, float), -PGraphics.directionalLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float), -PGraphics.noLights()
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        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
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        -
      • -
      - - - -
        -
      • -

        directionalLight

        -
        public void directionalLight(float r,
        -                             float g,
        -                             float b,
        -                             float dx,
        -                             float dy,
        -                             float dz)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from directionalLight.xml ) - - Adds a directional light. Directional light comes from one direction and - is stronger when hitting a surface squarely and weaker if it hits at a a - gentle angle. After hitting a surface, a directional lights scatters in - all directions. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The nx, ny, and nz parameters specify the - direction the light is facing. For example, setting ny to -1 will - cause the geometry to be lit from below (the light is facing directly upward). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        directionalLight in class PGraphics
        -
        Parameters:
        -
        r - red or hue value (depending on current color mode)
        -
        g - green or saturation value (depending on current color mode)
        -
        b - blue or brightness value (depending on current color mode)
        -
        dx - direction along the x-axis
        -
        dy - direction along the y-axis
        -
        dz - direction along the z-axis
        -
        See Also:
        -
        PGraphics.lights(), -PGraphics.ambientLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        spotLight

        -
        public void spotLight(float r,
        -                      float g,
        -                      float b,
        -                      float x,
        -                      float y,
        -                      float z,
        -                      float dx,
        -                      float dy,
        -                      float dz,
        -                      float angle,
        -                      float concentration)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from spotLight.xml ) - - Adds a spot light. Lights need to be included in the draw() to - remain persistent in a looping program. Placing them in the - setup() of a looping program will cause them to only have an - effect the first time through the loop. The affect of the v1, - v2, and v3 parameters is determined by the current color - mode. The x, y, and z parameters specify the - position of the light and nx, ny, nz specify the - direction or light. The angle parameter affects angle of the - spotlight cone. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        spotLight in class PGraphics
        -
        Parameters:
        -
        r - red or hue value (depending on current color mode)
        -
        g - green or saturation value (depending on current color mode)
        -
        b - blue or brightness value (depending on current color mode)
        -
        x - x-coordinate of the light
        -
        y - y-coordinate of the light
        -
        z - z-coordinate of the light
        -
        dx - direction along the x axis
        -
        dy - direction along the y axis
        -
        dz - direction along the z axis
        -
        angle - angle of the spotlight cone
        -
        concentration - exponent determining the center bias of the cone
        -
        See Also:
        -
        PGraphics.lights(), -PGraphics.directionalLight(float, float, float, float, float, float), -PGraphics.pointLight(float, float, float, float, float, float), -PGraphics.ambientLight(float, float, float, float, float, float)
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        isGL

        -
        public boolean isGL()
        -
        Description copied from class: PGraphics
        -
        Return true if this renderer does rendering through OpenGL. Defaults to false.
        -
        -
        Overrides:
        -
        isGL in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        loadPixels

        -
        public void loadPixels()
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_loadPixels.xml ) - - Loads the pixel data for the image into its pixels[] array. This - function must always be called before reading from or writing to pixels[]. -

        renderers may or may not seem to require loadPixels() - or updatePixels(). However, the rule is that any time you want to - manipulate the pixels[] array, you must first call - loadPixels(), and after changes have been made, call - updatePixels(). Even if the renderer may not seem to use this - function in the current Processing release, this will always be subject - to change. - - ( end auto-generated ) - -

        Advanced

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

        get

        -
        public int get(int x,
        -               int y)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_get.xml ) - - Reads the color of any pixel or grabs a section of an image. If no - parameters are specified, the entire image is returned. Use the x - and y parameters to get the value of one pixel. Get a section of - the display window by specifying an additional width and - height parameter. When getting an image, the x and - y parameters define the coordinates for the upper-left corner of - the image, regardless of the current imageMode().
        -
        - If the pixel requested is outside of the image window, black is - returned. The numbers returned are scaled according to the current color - ranges, but only RGB values are returned by this function. For example, - even though you may have drawn a shape with colorMode(HSB), the - numbers returned will be in RGB format.
        -
        - Getting the color of a single pixel with get(x, y) is easy, but - not as fast as grabbing the data directly from pixels[]. The - equivalent statement to get(x, y) using pixels[] is - pixels[y*width+x]. See the reference for pixels[] for more information. - - ( end auto-generated ) - -

        Advanced

        - 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
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        See Also:
        -
        PApplet.set(int, int, int), -PApplet.pixels, -PApplet.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int x,
        -                int y,
        -                int argb)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_set.xml ) - - Changes the color of any pixel or writes an image directly into the - display window.
        -
        - The x and y parameters specify the pixel to change and the - color parameter specifies the color value. The color parameter is - affected by the current color mode (the default is RGB values from 0 to - 255). When setting an image, the x and y parameters define - the coordinates for the upper-left corner of the image, regardless of - the current imageMode(). -

        - Setting the color of a single pixel with set(x, y) is easy, but - not as fast as putting the data directly into pixels[]. The - equivalent statement to set(x, y, #000000) using pixels[] - is pixels[y*width+x] = #000000. See the reference for - pixels[] for more information. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        set in class PImage
        -
        Parameters:
        -
        x - x-coordinate of the pixel
        -
        y - y-coordinate of the pixel
        -
        argb - any value of the color datatype
        -
        See Also:
        -
        PImage.get(int, int, int, int), -PImage.pixels, -PImage.copy(PImage, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        save

        -
        public boolean save(String filename)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_save.xml ) - - Saves the image into a file. Images are saved in TIFF, TARGA, JPEG, and - PNG format depending on the extension within the filename - parameter. For example, "image.tif" will have a TIFF image and - "image.png" will save a PNG image. If no extension is included in the - filename, the image will save in TIFF format and .tif will be - added to the name. These files are saved to the sketch's folder, which - may be opened by selecting "Show sketch folder" from the "Sketch" menu. - It is not possible to use save() while running the program in a - web browser.

        To save an image created within the code, rather - than through loading, it's necessary to make the image with the - createImage() function so it is aware of the location of the - program and can therefore save the file to the right place. See the - createImage() reference for more information. - - ( end auto-generated ) -

        Advanced

        - 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
        -
        Parameters:
        -
        filename - a sequence of letters and numbers
        -
        -
      • -
      - - - -
        -
      • -

        loadTexture

        -
        public void loadTexture()
        -
      • -
      - - - -
        -
      • -

        updateTexture

        -
        public void updateTexture()
        -
      • -
      - - - -
        -
      • -

        updateTexture

        -
        public void updateTexture(int x,
        -                          int y,
        -                          int w,
        -                          int h)
        -
      • -
      - - - -
        -
      • -

        updateDisplay

        -
        public void updateDisplay()
        -
      • -
      - - - -
        -
      • -

        mask

        -
        public void mask(PImage alpha)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_mask.xml ) - - Masks part of an image from displaying by loading another image and - using it as an alpha channel. This mask image should only contain - grayscale data, but only the blue color channel is used. The mask image - needs to be the same size as the image to which it is applied.
        -
        - In addition to using a mask image, an integer array containing the alpha - channel data can be specified directly. This method is useful for - creating dynamically generated alpha masks. This array must be of the - same length as the target image's pixels array and should contain only - grayscale data of values between 0-255. - - ( end auto-generated ) - -

        Advanced

        - - 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" grayscale by - performing a proper luminance-based conversion.

        -
        -
        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
        -
        Parameters:
        -
        kind - Either THRESHOLD, GRAY, OPAQUE, INVERT, POSTERIZE, BLUR, ERODE, or DILATE
        -
        param - unique for each, see above
        -
        -
      • -
      - - - -
        -
      • -

        filter

        -
        public void filter(PShader shader)
        -
        -
        Overrides:
        -
        filter in class PGraphics
        -
        Parameters:
        -
        shader - the fragment shader to apply
        -
        -
      • -
      - - - -
        -
      • -

        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
        -
        ( begin auto-generated from PImage_copy.xml ) - - Copies a region of pixels from one image into another. If the source and - destination regions aren't the same size, it will automatically resize - source pixels to fit the specified target region. No alpha information - is used in the process, however if the source image has an alpha channel - set, it will be copied as well. -

        - As of release 0149, this function ignores imageMode(). - - ( end auto-generated )
        -
        -
        Overrides:
        -
        copy in class PImage
        -
        Parameters:
        -
        sx - X coordinate of the source's upper left corner
        -
        sy - Y coordinate of the source's upper left corner
        -
        sw - source image width
        -
        sh - source image height
        -
        dx - X coordinate of the destination's upper left corner
        -
        dy - Y coordinate of the destination's upper left corner
        -
        dw - destination image width
        -
        dh - destination image height
        -
        See Also:
        -
        PGraphics.alpha(int), -PImage.blend(PImage, int, int, int, int, int, int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public void copy(PImage src,
        -                 int sx,
        -                 int sy,
        -                 int sw,
        -                 int sh,
        -                 int dx,
        -                 int dy,
        -                 int dw,
        -                 int dh)
        -
        -
        Overrides:
        -
        copy in class PImage
        -
        Parameters:
        -
        src - an image variable referring to the source image.
        -
        -
      • -
      - - - -
        -
      • -

        getTexture

        -
        public Texture getTexture()
        -
        Not an approved function, this will change or be removed in the future. - This utility method returns the texture associated to the renderer's. - drawing surface, making sure is updated to reflect the current contents - off the screen (or offscreen drawing surface).
        -
      • -
      - - - -
        -
      • -

        getTexture

        -
        public Texture getTexture(boolean load)
        -
        Not an approved function either, don't use it.
        -
      • -
      - - - -
        -
      • -

        getTexture

        -
        public Texture getTexture(PImage img)
        -
        Not an approved function, this will change or be removed in the future. - This utility method returns the texture associated to the image. - creating and/or updating it if needed.
        -
        -
        Parameters:
        -
        img - the image to have a texture metadata associated to it
        -
        -
      • -
      - - - -
        -
      • -

        getFrameBuffer

        -
        public FrameBuffer getFrameBuffer()
        -
        Not an approved function, test its use in libraries to grab the FB objects - for offscreen PGraphics.
        -
      • -
      - - - -
        -
      • -

        getFrameBuffer

        -
        public FrameBuffer getFrameBuffer(boolean multi)
        -
      • -
      - - - -
        -
      • -

        resize

        -
        public void resize(int wide,
        -                   int high)
        -
        Description copied from class: PImage
        -
        ( begin auto-generated from PImage_resize.xml ) - - Resize the image to a new width and height. To make the image scale - proportionally, use 0 as the value for the wide or high - parameter. For instance, to make the width of an image 150 pixels, and - change the height using the same proportion, use resize(150, 0).
        -
        - Even though a PGraphics is technically a PImage, it is not possible to - rescale the image data found in a PGraphics. (It's simply not possible - to do this consistently across renderers: technically infeasible with - P3D, or what would it even do with PDF?) If you want to resize PGraphics - content, first get a copy of its image data using the get() - method, and call resize() on the PImage that is returned. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        resize in class PImage
        -
        Parameters:
        -
        wide - the resized image width
        -
        high - the resized image height
        -
        See Also:
        -
        PImage.get(int, int, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        loadShader

        -
        public PShader loadShader(String fragFilename)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from loadShader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        loadShader in class PGraphics
        -
        Parameters:
        -
        fragFilename - name of fragment shader file
        -
        -
      • -
      - - - - - - - -
        -
      • -

        shader

        -
        public void shader(PShader shader)
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from shader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        shader in class PGraphics
        -
        Parameters:
        -
        shader - name of shader file
        -
        -
      • -
      - - - -
        -
      • -

        shader

        -
        public void shader(PShader shader,
        -                   int kind)
        -
        -
        Overrides:
        -
        shader in class PGraphics
        -
        kind - type of shader, either POINTS, LINES, or TRIANGLES
        -
        -
      • -
      - - - -
        -
      • -

        resetShader

        -
        public void resetShader()
        -
        Description copied from class: PGraphics
        -
        ( begin auto-generated from resetShader.xml ) - - This is a new reference entry for Processing 2.0. It will be updated shortly. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        resetShader in class PGraphics
        -
        -
      • -
      - - - -
        -
      • -

        resetShader

        -
        public void resetShader(int kind)
        -
        -
        Overrides:
        -
        resetShader in class PGraphics
        -
        Parameters:
        -
        kind - type of shader, either POINTS, LINES, or TRIANGLES
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/opengl/PJOGL.html b/build/javadoc/everything/processing/opengl/PJOGL.html deleted file mode 100644 index c614c3d03d..0000000000 --- a/build/javadoc/everything/processing/opengl/PJOGL.html +++ /dev/null @@ -1,3492 +0,0 @@ - - - - - -PJOGL - - - - - - - - - - - -
-
processing.opengl
-

Class PJOGL

-
-
- -
-
    -
  • -
    -
    -
    public class PJOGL
    -extends PGL
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        PROFILE

        -
        public static int PROFILE
        -
      • -
      - - - -
        -
      • -

        RETINA

        -
        public static boolean RETINA
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        gl

        -
        public GL gl
        -
        Basic GL functionality, common to all profiles
        -
      • -
      - - - -
        -
      • -

        glu

        -
        public GLU glu
        -
        GLU interface
        -
      • -
      - - - -
        -
      • -

        context

        -
        public GLContext context
        -
        The rendering context (holds rendering state info)
        -
      • -
      - - - -
        -
      • -

        canvas

        -
        public Canvas canvas
        -
        The canvas where OpenGL rendering takes place
        -
      • -
      - - - -
        -
      • -

        profile

        -
        public static GLProfile profile
        -
        Selected GL profile
        -
      • -
      -
    • -
    - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        flush

        -
        public void flush()
        -
        -
        Specified by:
        -
        flush in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        finish

        -
        public void finish()
        -
        -
        Specified by:
        -
        finish in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        hint

        -
        public void hint(int target,
        -                 int hint)
        -
        -
        Specified by:
        -
        hint in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        enable

        -
        public void enable(int value)
        -
        -
        Specified by:
        -
        enable in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        disable

        -
        public void disable(int value)
        -
        -
        Specified by:
        -
        disable in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getBooleanv

        -
        public void getBooleanv(int value,
        -                        IntBuffer data)
        -
        -
        Specified by:
        -
        getBooleanv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getIntegerv

        -
        public void getIntegerv(int value,
        -                        IntBuffer data)
        -
        -
        Specified by:
        -
        getIntegerv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getFloatv

        -
        public void getFloatv(int value,
        -                      FloatBuffer data)
        -
        -
        Specified by:
        -
        getFloatv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        isEnabled

        -
        public boolean isEnabled(int value)
        -
        -
        Specified by:
        -
        isEnabled in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public String getString(int name)
        -
        -
        Specified by:
        -
        getString in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getError

        -
        public int getError()
        -
        -
        Specified by:
        -
        getError in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        errorString

        -
        public String errorString(int err)
        -
        -
        Specified by:
        -
        errorString in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        genBuffers

        -
        public void genBuffers(int n,
        -                       IntBuffer buffers)
        -
        -
        Specified by:
        -
        genBuffers in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        deleteBuffers

        -
        public void deleteBuffers(int n,
        -                          IntBuffer buffers)
        -
        -
        Specified by:
        -
        deleteBuffers in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        bindBuffer

        -
        public void bindBuffer(int target,
        -                       int buffer)
        -
        -
        Specified by:
        -
        bindBuffer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        bufferData

        -
        public void bufferData(int target,
        -                       int size,
        -                       Buffer data,
        -                       int usage)
        -
        -
        Specified by:
        -
        bufferData in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        bufferSubData

        -
        public void bufferSubData(int target,
        -                          int offset,
        -                          int size,
        -                          Buffer data)
        -
        -
        Specified by:
        -
        bufferSubData in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        isBuffer

        -
        public void isBuffer(int buffer)
        -
        -
        Specified by:
        -
        isBuffer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getBufferParameteriv

        -
        public void getBufferParameteriv(int target,
        -                                 int value,
        -                                 IntBuffer data)
        -
        -
        Specified by:
        -
        getBufferParameteriv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        mapBuffer

        -
        public ByteBuffer mapBuffer(int target,
        -                            int access)
        -
        -
        Specified by:
        -
        mapBuffer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        mapBufferRange

        -
        public ByteBuffer mapBufferRange(int target,
        -                                 int offset,
        -                                 int length,
        -                                 int access)
        -
        -
        Specified by:
        -
        mapBufferRange in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        unmapBuffer

        -
        public void unmapBuffer(int target)
        -
        -
        Specified by:
        -
        unmapBuffer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        depthRangef

        -
        public void depthRangef(float n,
        -                        float f)
        -
        -
        Specified by:
        -
        depthRangef in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        viewport

        -
        public void viewport(int x,
        -                     int y,
        -                     int w,
        -                     int h)
        -
        -
        Specified by:
        -
        viewport in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        vertexAttrib1f

        -
        public void vertexAttrib1f(int index,
        -                           float value)
        -
        -
        Specified by:
        -
        vertexAttrib1f in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        vertexAttrib2f

        -
        public void vertexAttrib2f(int index,
        -                           float value0,
        -                           float value1)
        -
        -
        Specified by:
        -
        vertexAttrib2f in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        vertexAttrib3f

        -
        public void vertexAttrib3f(int index,
        -                           float value0,
        -                           float value1,
        -                           float value2)
        -
        -
        Specified by:
        -
        vertexAttrib3f in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        vertexAttrib4f

        -
        public void vertexAttrib4f(int index,
        -                           float value0,
        -                           float value1,
        -                           float value2,
        -                           float value3)
        -
        -
        Specified by:
        -
        vertexAttrib4f in class PGL
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        vertexAttribPointer

        -
        public void vertexAttribPointer(int index,
        -                                int size,
        -                                int type,
        -                                boolean normalized,
        -                                int stride,
        -                                int offset)
        -
        -
        Specified by:
        -
        vertexAttribPointer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        vertexAttribPointer

        -
        public void vertexAttribPointer(int index,
        -                                int size,
        -                                int type,
        -                                boolean normalized,
        -                                int stride,
        -                                Buffer data)
        -
        -
        Specified by:
        -
        vertexAttribPointer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        enableVertexAttribArray

        -
        public void enableVertexAttribArray(int index)
        -
        -
        Specified by:
        -
        enableVertexAttribArray in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        disableVertexAttribArray

        -
        public void disableVertexAttribArray(int index)
        -
        -
        Specified by:
        -
        disableVertexAttribArray in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        drawArrays

        -
        public void drawArrays(int mode,
        -                       int first,
        -                       int count)
        -
        -
        Specified by:
        -
        drawArrays in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        drawElements

        -
        public void drawElements(int mode,
        -                         int count,
        -                         int type,
        -                         int offset)
        -
        -
        Specified by:
        -
        drawElements in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        drawElements

        -
        public void drawElements(int mode,
        -                         int count,
        -                         int type,
        -                         Buffer indices)
        -
        -
        Specified by:
        -
        drawElements in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        lineWidth

        -
        public void lineWidth(float width)
        -
        -
        Specified by:
        -
        lineWidth in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        frontFace

        -
        public void frontFace(int dir)
        -
        -
        Specified by:
        -
        frontFace in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        cullFace

        -
        public void cullFace(int mode)
        -
        -
        Specified by:
        -
        cullFace in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        polygonOffset

        -
        public void polygonOffset(float factor,
        -                          float units)
        -
        -
        Specified by:
        -
        polygonOffset in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        pixelStorei

        -
        public void pixelStorei(int pname,
        -                        int param)
        -
        -
        Specified by:
        -
        pixelStorei in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        texImage2D

        -
        public void texImage2D(int target,
        -                       int level,
        -                       int internalFormat,
        -                       int width,
        -                       int height,
        -                       int border,
        -                       int format,
        -                       int type,
        -                       Buffer data)
        -
        -
        Specified by:
        -
        texImage2D in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        copyTexImage2D

        -
        public void copyTexImage2D(int target,
        -                           int level,
        -                           int internalFormat,
        -                           int x,
        -                           int y,
        -                           int width,
        -                           int height,
        -                           int border)
        -
        -
        Specified by:
        -
        copyTexImage2D in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        texSubImage2D

        -
        public void texSubImage2D(int target,
        -                          int level,
        -                          int xOffset,
        -                          int yOffset,
        -                          int width,
        -                          int height,
        -                          int format,
        -                          int type,
        -                          Buffer data)
        -
        -
        Specified by:
        -
        texSubImage2D in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        copyTexSubImage2D

        -
        public void copyTexSubImage2D(int target,
        -                              int level,
        -                              int xOffset,
        -                              int yOffset,
        -                              int x,
        -                              int y,
        -                              int width,
        -                              int height)
        -
        -
        Specified by:
        -
        copyTexSubImage2D in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        compressedTexImage2D

        -
        public void compressedTexImage2D(int target,
        -                                 int level,
        -                                 int internalFormat,
        -                                 int width,
        -                                 int height,
        -                                 int border,
        -                                 int imageSize,
        -                                 Buffer data)
        -
        -
        Specified by:
        -
        compressedTexImage2D in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        compressedTexSubImage2D

        -
        public void compressedTexSubImage2D(int target,
        -                                    int level,
        -                                    int xOffset,
        -                                    int yOffset,
        -                                    int width,
        -                                    int height,
        -                                    int format,
        -                                    int imageSize,
        -                                    Buffer data)
        -
        -
        Specified by:
        -
        compressedTexSubImage2D in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        texParameteri

        -
        public void texParameteri(int target,
        -                          int pname,
        -                          int param)
        -
        -
        Specified by:
        -
        texParameteri in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        texParameterf

        -
        public void texParameterf(int target,
        -                          int pname,
        -                          float param)
        -
        -
        Specified by:
        -
        texParameterf in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        texParameteriv

        -
        public void texParameteriv(int target,
        -                           int pname,
        -                           IntBuffer params)
        -
        -
        Specified by:
        -
        texParameteriv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        texParameterfv

        -
        public void texParameterfv(int target,
        -                           int pname,
        -                           FloatBuffer params)
        -
        -
        Specified by:
        -
        texParameterfv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        generateMipmap

        -
        public void generateMipmap(int target)
        -
        -
        Specified by:
        -
        generateMipmap in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        genTextures

        -
        public void genTextures(int n,
        -                        IntBuffer textures)
        -
        -
        Specified by:
        -
        genTextures in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        deleteTextures

        -
        public void deleteTextures(int n,
        -                           IntBuffer textures)
        -
        -
        Specified by:
        -
        deleteTextures in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getTexParameteriv

        -
        public void getTexParameteriv(int target,
        -                              int pname,
        -                              IntBuffer params)
        -
        -
        Specified by:
        -
        getTexParameteriv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getTexParameterfv

        -
        public void getTexParameterfv(int target,
        -                              int pname,
        -                              FloatBuffer params)
        -
        -
        Specified by:
        -
        getTexParameterfv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        isTexture

        -
        public boolean isTexture(int texture)
        -
        -
        Specified by:
        -
        isTexture in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        createShader

        -
        public int createShader(int type)
        -
        -
        Specified by:
        -
        createShader in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        shaderSource

        -
        public void shaderSource(int shader,
        -                         String source)
        -
        -
        Specified by:
        -
        shaderSource in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        compileShader

        -
        public void compileShader(int shader)
        -
        -
        Specified by:
        -
        compileShader in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        releaseShaderCompiler

        -
        public void releaseShaderCompiler()
        -
        -
        Specified by:
        -
        releaseShaderCompiler in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        deleteShader

        -
        public void deleteShader(int shader)
        -
        -
        Specified by:
        -
        deleteShader in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        shaderBinary

        -
        public void shaderBinary(int count,
        -                         IntBuffer shaders,
        -                         int binaryFormat,
        -                         Buffer binary,
        -                         int length)
        -
        -
        Specified by:
        -
        shaderBinary in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        createProgram

        -
        public int createProgram()
        -
        -
        Specified by:
        -
        createProgram in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        attachShader

        -
        public void attachShader(int program,
        -                         int shader)
        -
        -
        Specified by:
        -
        attachShader in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        detachShader

        -
        public void detachShader(int program,
        -                         int shader)
        -
        -
        Specified by:
        -
        detachShader in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        linkProgram

        -
        public void linkProgram(int program)
        -
        -
        Specified by:
        -
        linkProgram in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        useProgram

        -
        public void useProgram(int program)
        -
        -
        Specified by:
        -
        useProgram in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        deleteProgram

        -
        public void deleteProgram(int program)
        -
        -
        Specified by:
        -
        deleteProgram in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getAttribLocation

        -
        public int getAttribLocation(int program,
        -                             String name)
        -
        -
        Specified by:
        -
        getAttribLocation in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        bindAttribLocation

        -
        public void bindAttribLocation(int program,
        -                               int index,
        -                               String name)
        -
        -
        Specified by:
        -
        bindAttribLocation in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getUniformLocation

        -
        public int getUniformLocation(int program,
        -                              String name)
        -
        -
        Specified by:
        -
        getUniformLocation in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        uniform1i

        -
        public void uniform1i(int location,
        -                      int value)
        -
        -
        Specified by:
        -
        uniform1i in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform2i

        -
        public void uniform2i(int location,
        -                      int value0,
        -                      int value1)
        -
        -
        Specified by:
        -
        uniform2i in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform3i

        -
        public void uniform3i(int location,
        -                      int value0,
        -                      int value1,
        -                      int value2)
        -
        -
        Specified by:
        -
        uniform3i in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform4i

        -
        public void uniform4i(int location,
        -                      int value0,
        -                      int value1,
        -                      int value2,
        -                      int value3)
        -
        -
        Specified by:
        -
        uniform4i in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform1f

        -
        public void uniform1f(int location,
        -                      float value)
        -
        -
        Specified by:
        -
        uniform1f in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform2f

        -
        public void uniform2f(int location,
        -                      float value0,
        -                      float value1)
        -
        -
        Specified by:
        -
        uniform2f in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform3f

        -
        public void uniform3f(int location,
        -                      float value0,
        -                      float value1,
        -                      float value2)
        -
        -
        Specified by:
        -
        uniform3f in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform4f

        -
        public void uniform4f(int location,
        -                      float value0,
        -                      float value1,
        -                      float value2,
        -                      float value3)
        -
        -
        Specified by:
        -
        uniform4f in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform1iv

        -
        public void uniform1iv(int location,
        -                       int count,
        -                       IntBuffer v)
        -
        -
        Specified by:
        -
        uniform1iv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform2iv

        -
        public void uniform2iv(int location,
        -                       int count,
        -                       IntBuffer v)
        -
        -
        Specified by:
        -
        uniform2iv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform3iv

        -
        public void uniform3iv(int location,
        -                       int count,
        -                       IntBuffer v)
        -
        -
        Specified by:
        -
        uniform3iv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform4iv

        -
        public void uniform4iv(int location,
        -                       int count,
        -                       IntBuffer v)
        -
        -
        Specified by:
        -
        uniform4iv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform1fv

        -
        public void uniform1fv(int location,
        -                       int count,
        -                       FloatBuffer v)
        -
        -
        Specified by:
        -
        uniform1fv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform2fv

        -
        public void uniform2fv(int location,
        -                       int count,
        -                       FloatBuffer v)
        -
        -
        Specified by:
        -
        uniform2fv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform3fv

        -
        public void uniform3fv(int location,
        -                       int count,
        -                       FloatBuffer v)
        -
        -
        Specified by:
        -
        uniform3fv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniform4fv

        -
        public void uniform4fv(int location,
        -                       int count,
        -                       FloatBuffer v)
        -
        -
        Specified by:
        -
        uniform4fv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniformMatrix2fv

        -
        public void uniformMatrix2fv(int location,
        -                             int count,
        -                             boolean transpose,
        -                             FloatBuffer mat)
        -
        -
        Specified by:
        -
        uniformMatrix2fv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniformMatrix3fv

        -
        public void uniformMatrix3fv(int location,
        -                             int count,
        -                             boolean transpose,
        -                             FloatBuffer mat)
        -
        -
        Specified by:
        -
        uniformMatrix3fv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        uniformMatrix4fv

        -
        public void uniformMatrix4fv(int location,
        -                             int count,
        -                             boolean transpose,
        -                             FloatBuffer mat)
        -
        -
        Specified by:
        -
        uniformMatrix4fv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        validateProgram

        -
        public void validateProgram(int program)
        -
        -
        Specified by:
        -
        validateProgram in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        isShader

        -
        public boolean isShader(int shader)
        -
        -
        Specified by:
        -
        isShader in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getShaderiv

        -
        public void getShaderiv(int shader,
        -                        int pname,
        -                        IntBuffer params)
        -
        -
        Specified by:
        -
        getShaderiv in class PGL
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getShaderSource

        -
        public String getShaderSource(int shader)
        -
        -
        Specified by:
        -
        getShaderSource in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getVertexAttribfv

        -
        public void getVertexAttribfv(int index,
        -                              int pname,
        -                              FloatBuffer params)
        -
        -
        Specified by:
        -
        getVertexAttribfv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getVertexAttribiv

        -
        public void getVertexAttribiv(int index,
        -                              int pname,
        -                              IntBuffer params)
        -
        -
        Specified by:
        -
        getVertexAttribiv in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getUniformfv

        -
        public void getUniformfv(int program,
        -                         int location,
        -                         FloatBuffer params)
        -
        -
        Specified by:
        -
        getUniformfv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getUniformiv

        -
        public void getUniformiv(int program,
        -                         int location,
        -                         IntBuffer params)
        -
        -
        Specified by:
        -
        getUniformiv in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        isProgram

        -
        public boolean isProgram(int program)
        -
        -
        Specified by:
        -
        isProgram in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        getProgramiv

        -
        public void getProgramiv(int program,
        -                         int pname,
        -                         IntBuffer params)
        -
        -
        Specified by:
        -
        getProgramiv in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        scissor

        -
        public void scissor(int x,
        -                    int y,
        -                    int w,
        -                    int h)
        -
        -
        Specified by:
        -
        scissor in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        sampleCoverage

        -
        public void sampleCoverage(float value,
        -                           boolean invert)
        -
        -
        Specified by:
        -
        sampleCoverage in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        stencilFunc

        -
        public void stencilFunc(int func,
        -                        int ref,
        -                        int mask)
        -
        -
        Specified by:
        -
        stencilFunc in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        stencilFuncSeparate

        -
        public void stencilFuncSeparate(int face,
        -                                int func,
        -                                int ref,
        -                                int mask)
        -
        -
        Specified by:
        -
        stencilFuncSeparate in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        stencilOp

        -
        public void stencilOp(int sfail,
        -                      int dpfail,
        -                      int dppass)
        -
        -
        Specified by:
        -
        stencilOp in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        stencilOpSeparate

        -
        public void stencilOpSeparate(int face,
        -                              int sfail,
        -                              int dpfail,
        -                              int dppass)
        -
        -
        Specified by:
        -
        stencilOpSeparate in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        depthFunc

        -
        public void depthFunc(int func)
        -
        -
        Specified by:
        -
        depthFunc in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        blendEquation

        -
        public void blendEquation(int mode)
        -
        -
        Specified by:
        -
        blendEquation in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        blendEquationSeparate

        -
        public void blendEquationSeparate(int modeRGB,
        -                                  int modeAlpha)
        -
        -
        Specified by:
        -
        blendEquationSeparate in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        blendFunc

        -
        public void blendFunc(int src,
        -                      int dst)
        -
        -
        Specified by:
        -
        blendFunc in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        blendFuncSeparate

        -
        public void blendFuncSeparate(int srcRGB,
        -                              int dstRGB,
        -                              int srcAlpha,
        -                              int dstAlpha)
        -
        -
        Specified by:
        -
        blendFuncSeparate in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        blendColor

        -
        public void blendColor(float red,
        -                       float green,
        -                       float blue,
        -                       float alpha)
        -
        -
        Specified by:
        -
        blendColor in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        alphaFunc

        -
        public void alphaFunc(int func,
        -                      float ref)
        -
        -
        Specified by:
        -
        alphaFunc in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        colorMask

        -
        public void colorMask(boolean r,
        -                      boolean g,
        -                      boolean b,
        -                      boolean a)
        -
        -
        Specified by:
        -
        colorMask in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        depthMask

        -
        public void depthMask(boolean mask)
        -
        -
        Specified by:
        -
        depthMask in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        stencilMask

        -
        public void stencilMask(int mask)
        -
        -
        Specified by:
        -
        stencilMask in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        stencilMaskSeparate

        -
        public void stencilMaskSeparate(int face,
        -                                int mask)
        -
        -
        Specified by:
        -
        stencilMaskSeparate in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear(int buf)
        -
        -
        Specified by:
        -
        clear in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        clearColor

        -
        public void clearColor(float r,
        -                       float g,
        -                       float b,
        -                       float a)
        -
        -
        Specified by:
        -
        clearColor in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        clearDepth

        -
        public void clearDepth(float d)
        -
        -
        Specified by:
        -
        clearDepth in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        clearStencil

        -
        public void clearStencil(int s)
        -
        -
        Specified by:
        -
        clearStencil in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        genFramebuffers

        -
        public void genFramebuffers(int n,
        -                            IntBuffer framebuffers)
        -
        -
        Specified by:
        -
        genFramebuffers in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        bindRenderbuffer

        -
        public void bindRenderbuffer(int target,
        -                             int renderbuffer)
        -
        -
        Specified by:
        -
        bindRenderbuffer in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        genRenderbuffers

        -
        public void genRenderbuffers(int n,
        -                             IntBuffer renderbuffers)
        -
        -
        Specified by:
        -
        genRenderbuffers in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        renderbufferStorage

        -
        public void renderbufferStorage(int target,
        -                                int internalFormat,
        -                                int width,
        -                                int height)
        -
        -
        Specified by:
        -
        renderbufferStorage in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        framebufferRenderbuffer

        -
        public void framebufferRenderbuffer(int target,
        -                                    int attachment,
        -                                    int rendbuferfTarget,
        -                                    int renderbuffer)
        -
        -
        Specified by:
        -
        framebufferRenderbuffer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        framebufferTexture2D

        -
        public void framebufferTexture2D(int target,
        -                                 int attachment,
        -                                 int texTarget,
        -                                 int texture,
        -                                 int level)
        -
        -
        Specified by:
        -
        framebufferTexture2D in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        checkFramebufferStatus

        -
        public int checkFramebufferStatus(int target)
        -
        -
        Specified by:
        -
        checkFramebufferStatus in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        isFramebuffer

        -
        public boolean isFramebuffer(int framebuffer)
        -
        -
        Specified by:
        -
        isFramebuffer in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        isRenderbuffer

        -
        public boolean isRenderbuffer(int renderbuffer)
        -
        -
        Specified by:
        -
        isRenderbuffer in class PGL
        -
        -
      • -
      - - - - - - - -
        -
      • -

        blitFramebuffer

        -
        public void blitFramebuffer(int srcX0,
        -                            int srcY0,
        -                            int srcX1,
        -                            int srcY1,
        -                            int dstX0,
        -                            int dstY0,
        -                            int dstX1,
        -                            int dstY1,
        -                            int mask,
        -                            int filter)
        -
        -
        Specified by:
        -
        blitFramebuffer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        renderbufferStorageMultisample

        -
        public void renderbufferStorageMultisample(int target,
        -                                           int samples,
        -                                           int format,
        -                                           int width,
        -                                           int height)
        -
        -
        Specified by:
        -
        renderbufferStorageMultisample in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        readBuffer

        -
        public void readBuffer(int buf)
        -
        -
        Specified by:
        -
        readBuffer in class PGL
        -
        -
      • -
      - - - -
        -
      • -

        drawBuffer

        -
        public void drawBuffer(int buf)
        -
        -
        Specified by:
        -
        drawBuffer in class PGL
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/opengl/PShader.html b/build/javadoc/everything/processing/opengl/PShader.html deleted file mode 100644 index ed0a098bd1..0000000000 --- a/build/javadoc/everything/processing/opengl/PShader.html +++ /dev/null @@ -1,974 +0,0 @@ - - - - - -PShader - - - - - - - - - - - -
-
processing.opengl
-

Class PShader

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    -
    public class PShader
    -extends Object
    -implements PConstants
    -
    This class encapsulates a GLSL shader program, including a vertex - and a fragment shader. Based on the GLSLShader class from GLGraphics, which - in turn was originally based in the code by JohnG: - http://processing.org/discourse/beta/num_1159494801.html
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        glProgram

        -
        public int glProgram
        -
      • -
      - - - -
        -
      • -

        glVertex

        -
        public int glVertex
        -
      • -
      - - - -
        -
      • -

        glFragment

        -
        public int glFragment
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PShader

        -
        public PShader()
        -
      • -
      - - - -
        -
      • -

        PShader

        -
        public PShader(PApplet parent)
        -
      • -
      - - - -
        -
      • -

        PShader

        -
        public PShader(PApplet parent,
        -               String vertFilename,
        -               String fragFilename)
        -
        Creates a shader program using the specified vertex and fragment - shaders.
        -
        -
        Parameters:
        -
        parent - the parent program
        -
        vertFilename - name of the vertex shader
        -
        fragFilename - name of the fragment shader
        -
        -
      • -
      - - - -
        -
      • -

        PShader

        -
        public PShader(PApplet parent,
        -               URL vertURL,
        -               URL fragURL)
        -
        -
        Parameters:
        -
        vertURL - network location of the vertex shader
        -
        fragURL - network location of the fragment shader
        -
        -
      • -
      - - - -
        -
      • -

        PShader

        -
        public PShader(PApplet parent,
        -               String[] vertSource,
        -               String[] fragSource)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setVertexShader

        -
        public void setVertexShader(String vertFilename)
        -
      • -
      - - - -
        -
      • -

        setVertexShader

        -
        public void setVertexShader(URL vertURL)
        -
      • -
      - - - -
        -
      • -

        setVertexShader

        -
        public void setVertexShader(String[] vertSource)
        -
      • -
      - - - -
        -
      • -

        setFragmentShader

        -
        public void setFragmentShader(String fragFilename)
        -
      • -
      - - - -
        -
      • -

        setFragmentShader

        -
        public void setFragmentShader(URL fragURL)
        -
      • -
      - - - -
        -
      • -

        setFragmentShader

        -
        public void setFragmentShader(String[] fragSource)
        -
      • -
      - - - -
        -
      • -

        bind

        -
        public void bind()
        -
        Initializes (if needed) and binds the shader program.
        -
      • -
      - - - -
        -
      • -

        unbind

        -
        public void unbind()
        -
        Unbinds the shader program.
        -
      • -
      - - - -
        -
      • -

        bound

        -
        public boolean bound()
        -
        Returns true if the shader is bound, false otherwise.
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                int x)
        -
        -
        Parameters:
        -
        name - the name of the uniform variable to modify
        -
        x - first component of the variable to modify
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                int x,
        -                int y)
        -
        -
        Parameters:
        -
        y - second component of the variable to modify. The variable has to be declared with an array/vector type in the shader (i.e.: int[2], vec2)
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                int x,
        -                int y,
        -                int z)
        -
        -
        Parameters:
        -
        z - third component of the variable to modify. The variable has to be declared with an array/vector type in the shader (i.e.: int[3], vec3)
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                int x,
        -                int y,
        -                int z,
        -                int w)
        -
        -
        Parameters:
        -
        w - fourth component of the variable to modify. The variable has to be declared with an array/vector type in the shader (i.e.: int[4], vec4)
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                float x)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                float x,
        -                float y)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                float x,
        -                float y,
        -                float z)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                float x,
        -                float y,
        -                float z,
        -                float w)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                PVector vec)
        -
        -
        Parameters:
        -
        vec - modifies all the components of an array/vector uniform variable. PVector can only be used if the type of the variable is vec3.
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                boolean x)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                boolean x,
        -                boolean y)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                boolean x,
        -                boolean y,
        -                boolean z)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                boolean x,
        -                boolean y,
        -                boolean z,
        -                boolean w)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                int[] vec)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                int[] vec,
        -                int ncoords)
        -
        -
        Parameters:
        -
        ncoords - number of coordinates per element, max 4
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                float[] vec)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                float[] vec,
        -                int ncoords)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                boolean[] vec)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                boolean[] boolvec,
        -                int ncoords)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                PMatrix2D mat)
        -
        -
        Parameters:
        -
        mat - matrix of values
        -
        -
      • -
      - - - - - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                PMatrix3D mat,
        -                boolean use3x3)
        -
        -
        Parameters:
        -
        use3x3 - enforces the matrix is 3 x 3
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(String name,
        -                PImage tex)
        -
        -
        Parameters:
        -
        tex - sets the sampler uniform variable to read from this image texture
        -
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/opengl/PShapeOpenGL.html b/build/javadoc/everything/processing/opengl/PShapeOpenGL.html deleted file mode 100644 index 556ff32517..0000000000 --- a/build/javadoc/everything/processing/opengl/PShapeOpenGL.html +++ /dev/null @@ -1,2899 +0,0 @@ - - - - - -PShapeOpenGL - - - - - - - - - - - -
-
processing.opengl
-

Class PShapeOpenGL

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    -
    public class PShapeOpenGL
    -extends PShape
    -
    This class holds a 3D model composed of vertices, normals, colors - (per vertex) and texture coordinates (also per vertex). All this data is - stored in Vertex Buffer Objects (VBO) in GPU memory for very fast access. - OBJ loading implemented using code from Saito's OBJLoader library: - http://code.google.com/p/saitoobjloader/ - and OBJReader from Ahmet Kizilay - http://www.openprocessing.org/visuals/?visualID=191 - By Andres Colubri - - - Other formats to consider: - AMF: http://en.wikipedia.org/wiki/Additive_Manufacturing_File_Format - STL: http://en.wikipedia.org/wiki/STL_(file_format) - OFF: http://people.sc.fsu.edu/~jburkardt/data/off/off.html(file_format) - DXF: http://en.wikipedia.org/wiki/AutoCAD_DXF
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • -

        glPolyVertex

        -
        public int glPolyVertex
        -
      • -
      - - - -
        -
      • -

        glPolyColor

        -
        public int glPolyColor
        -
      • -
      - - - -
        -
      • -

        glPolyNormal

        -
        public int glPolyNormal
        -
      • -
      - - - -
        -
      • -

        glPolyTexcoord

        -
        public int glPolyTexcoord
        -
      • -
      - - - -
        -
      • -

        glPolyAmbient

        -
        public int glPolyAmbient
        -
      • -
      - - - -
        -
      • -

        glPolySpecular

        -
        public int glPolySpecular
        -
      • -
      - - - -
        -
      • -

        glPolyEmissive

        -
        public int glPolyEmissive
        -
      • -
      - - - -
        -
      • -

        glPolyShininess

        -
        public int glPolyShininess
        -
      • -
      - - - -
        -
      • -

        glPolyIndex

        -
        public int glPolyIndex
        -
      • -
      - - - -
        -
      • -

        glLineVertex

        -
        public int glLineVertex
        -
      • -
      - - - -
        -
      • -

        glLineColor

        -
        public int glLineColor
        -
      • -
      - - - -
        -
      • -

        glLineAttrib

        -
        public int glLineAttrib
        -
      • -
      - - - -
        -
      • -

        glLineIndex

        -
        public int glLineIndex
        -
      • -
      - - - -
        -
      • -

        glPointVertex

        -
        public int glPointVertex
        -
      • -
      - - - -
        -
      • -

        glPointColor

        -
        public int glPointColor
        -
      • -
      - - - -
        -
      • -

        glPointAttrib

        -
        public int glPointAttrib
        -
      • -
      - - - -
        -
      • -

        glPointIndex

        -
        public int glPointIndex
        -
      • -
      - - - -
        -
      • -

        glUsage

        -
        public int glUsage
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PShapeOpenGL

        -
        public PShapeOpenGL(PGraphicsOpenGL pg,
        -                    int family)
        -
      • -
      - - - -
        -
      • -

        PShapeOpenGL

        -
        public PShapeOpenGL(PGraphicsOpenGL pg,
        -                    int kind,
        -                    float... p)
        -
        Create a shape from the PRIMITIVE family, using this kind and these params
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        addChild

        -
        public void addChild(PShape who,
        -                     int idx)
        -
        -
        Overrides:
        -
        addChild in class PShape
        -
        idx - the layer position in which to insert the new child
        -
        -
      • -
      - - - -
        -
      • -

        removeChild

        -
        public void removeChild(int idx)
        -
        Description copied from class: PShape
        -
        Remove the child shape with index idx.
        -
        -
        Overrides:
        -
        removeChild in class PShape
        -
        -
      • -
      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        getWidth

        -
        public float getWidth()
        -
        Description copied from class: PShape
        -
        Get the width of the drawing area (not necessarily the shape boundary).
        -
        -
        Overrides:
        -
        getWidth in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getHeight

        -
        public float getHeight()
        -
        Description copied from class: PShape
        -
        Get the height of the drawing area (not necessarily the shape boundary).
        -
        -
        Overrides:
        -
        getHeight in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getDepth

        -
        public float getDepth()
        -
        Description copied from class: PShape
        -
        Get the depth of the shape area (not necessarily the shape boundary). Only makes sense for 3D PShape subclasses, - such as PShape3D.
        -
        -
        Overrides:
        -
        getDepth in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setTextureMode

        -
        public void setTextureMode(int mode)
        -
        -
        Overrides:
        -
        setTextureMode in class PShape
        -
        -
      • -
      - - - - - - - -
        -
      • -

        solid

        -
        public void solid(boolean solid)
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y)
        -
        -
        Overrides:
        -
        vertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float u,
        -                   float v)
        -
        -
        Overrides:
        -
        vertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float z)
        -
        -
        Overrides:
        -
        vertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        vertex

        -
        public void vertex(float x,
        -                   float y,
        -                   float z,
        -                   float u,
        -                   float v)
        -
        -
        Overrides:
        -
        vertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        normal

        -
        public void normal(float nx,
        -                   float ny,
        -                   float nz)
        -
        -
        Overrides:
        -
        normal in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   float... values)
        -
        -
        Overrides:
        -
        attrib in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   int... values)
        -
        -
        Overrides:
        -
        attrib in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        attrib

        -
        public void attrib(String name,
        -                   boolean... values)
        -
        -
        Overrides:
        -
        attrib in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        endShape

        -
        public void endShape(int mode)
        -
        -
        Overrides:
        -
        endShape in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setParams

        -
        public void setParams(float[] source)
        -
      • -
      - - - -
        -
      • -

        setPath

        -
        public void setPath(int vcount,
        -                    float[][] verts,
        -                    int ccount,
        -                    int[] codes)
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float tx,
        -                      float ty)
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_translate.xml ) - - Specifies an amount to displace the shape. The x parameter - specifies left/right translation, the y parameter specifies - up/down translation, and the z parameter specifies translations - toward/away from the screen. Subsequent calls to the method accumulates - the effect. For example, calling translate(50, 0) and then - translate(20, 0) is the same as translate(70, 0). This - transformation is applied directly to the shape, it's not refreshed each - time draw() is run. -

        - Using this method with the z parameter requires using the P3D - parameter in combination with size. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        translate in class PShape
        -
        See Also:
        -
        PShape.rotate(float), -PShape.scale(float), -PShape.resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        translate

        -
        public void translate(float tx,
        -                      float ty,
        -                      float tz)
        -
        -
        Overrides:
        -
        translate in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle)
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_rotate.xml ) - - Rotates a shape the amount specified by the angle parameter. - Angles should be specified in radians (values from 0 to TWO_PI) or - converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Transformations apply to everything that happens after and subsequent - calls to the method accumulates the effect. For example, calling - rotate(HALF_PI) and then rotate(HALF_PI) is the same as - rotate(PI). This transformation is applied directly to the shape, - it's not refreshed each time draw() is run. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotate in class PShape
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PShape.rotateX(float), -PShape.rotateY(float), -PShape.rotateZ(float), -PShape.scale(float), -PShape.translate(float, float), -PShape.resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotateX

        -
        public void rotateX(float angle)
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_rotateX.xml ) - - Rotates a shape around the x-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to TWO_PI) or converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Subsequent calls to the method accumulates the effect. For example, - calling rotateX(HALF_PI) and then rotateX(HALF_PI) is the - same as rotateX(PI). This transformation is applied directly to - the shape, it's not refreshed each time draw() is run. -

        - This method requires a 3D renderer. You need to use P3D as a third - parameter for the size() function as shown in the example above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateX in class PShape
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PShape.rotate(float), -PShape.rotateY(float), -PShape.rotateZ(float), -PShape.scale(float), -PShape.translate(float, float), -PShape.resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotateY

        -
        public void rotateY(float angle)
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_rotateY.xml ) - - Rotates a shape around the y-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to TWO_PI) or converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Subsequent calls to the method accumulates the effect. For example, - calling rotateY(HALF_PI) and then rotateY(HALF_PI) is the - same as rotateY(PI). This transformation is applied directly to - the shape, it's not refreshed each time draw() is run. -

        - This method requires a 3D renderer. You need to use P3D as a third - parameter for the size() function as shown in the example above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateY in class PShape
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PShape.rotate(float), -PShape.rotateX(float), -PShape.rotateZ(float), -PShape.scale(float), -PShape.translate(float, float), -PShape.resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotateZ

        -
        public void rotateZ(float angle)
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_rotateZ.xml ) - - Rotates a shape around the z-axis the amount specified by the - angle parameter. Angles should be specified in radians (values - from 0 to TWO_PI) or converted to radians with the radians() method. -

        - Shapes are always rotated around the upper-left corner of their bounding - box. Positive numbers rotate objects in a clockwise direction. - Subsequent calls to the method accumulates the effect. For example, - calling rotateZ(HALF_PI) and then rotateZ(HALF_PI) is the - same as rotateZ(PI). This transformation is applied directly to - the shape, it's not refreshed each time draw() is run. -

        - This method requires a 3D renderer. You need to use P3D as a third - parameter for the size() function as shown in the example above. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        rotateZ in class PShape
        -
        Parameters:
        -
        angle - angle of rotation specified in radians
        -
        See Also:
        -
        PShape.rotate(float), -PShape.rotateX(float), -PShape.rotateY(float), -PShape.scale(float), -PShape.translate(float, float), -PShape.resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        rotate

        -
        public void rotate(float angle,
        -                   float v0,
        -                   float v1,
        -                   float v2)
        -
        -
        Overrides:
        -
        rotate in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float s)
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_scale.xml ) - - Increases or decreases the size of a shape by expanding and contracting - vertices. Shapes always scale from the relative origin of their bounding - box. Scale values are specified as decimal percentages. For example, the - method call scale(2.0) increases the dimension of a shape by - 200%. Subsequent calls to the method multiply the effect. For example, - calling scale(2.0) and then scale(1.5) is the same as - scale(3.0). This transformation is applied directly to the shape, - it's not refreshed each time draw() is run. -

        - Using this method with the z parameter requires using the P3D - parameter in combination with size. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        scale in class PShape
        -
        Parameters:
        -
        s - percentate to scale the object
        -
        See Also:
        -
        PShape.rotate(float), -PShape.translate(float, float), -PShape.resetMatrix()
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y)
        -
        -
        Overrides:
        -
        scale in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public void scale(float x,
        -                  float y,
        -                  float z)
        -
        -
        Overrides:
        -
        scale in class PShape
        -
        Parameters:
        -
        x - percentage to scale the object in the x-axis
        -
        y - percentage to scale the object in the y-axis
        -
        z - percentage to scale the object in the z-axis
        -
        -
      • -
      - - - - - - - -
        -
      • -

        applyMatrix

        -
        public void applyMatrix(float n00,
        -                        float n01,
        -                        float n02,
        -                        float n10,
        -                        float n11,
        -                        float n12)
        -
        -
        Overrides:
        -
        applyMatrix in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        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)
        -
        -
        Overrides:
        -
        applyMatrix in class PShape
        -
        -
      • -
      - - - - - - - -
        -
      • -

        bezierDetail

        -
        public void bezierDetail(int detail)
        -
        -
        Overrides:
        -
        bezierDetail in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        bezierVertex

        -
        public void bezierVertex(float x2,
        -                         float y2,
        -                         float x3,
        -                         float y3,
        -                         float x4,
        -                         float y4)
        -
        -
        Overrides:
        -
        bezierVertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        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 PShape
        -
        -
      • -
      - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float cx,
        -                            float cy,
        -                            float x3,
        -                            float y3)
        -
        -
        Overrides:
        -
        quadraticVertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        quadraticVertex

        -
        public void quadraticVertex(float cx,
        -                            float cy,
        -                            float cz,
        -                            float x3,
        -                            float y3,
        -                            float z3)
        -
        -
        Overrides:
        -
        quadraticVertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        curveDetail

        -
        public void curveDetail(int detail)
        -
        -
        Overrides:
        -
        curveDetail in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        curveTightness

        -
        public void curveTightness(float tightness)
        -
        -
        Overrides:
        -
        curveTightness in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y)
        -
        -
        Overrides:
        -
        curveVertex in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        curveVertex

        -
        public void curveVertex(float x,
        -                        float y,
        -                        float z)
        -
        -
        Overrides:
        -
        curveVertex in class PShape
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getVertex

        -
        public PVector getVertex(int index,
        -                         PVector vec)
        -
        -
        Overrides:
        -
        getVertex in class PShape
        -
        vec - PVector to assign the data to
        -
        -
      • -
      - - - -
        -
      • -

        getVertexX

        -
        public float getVertexX(int index)
        -
        -
        Overrides:
        -
        getVertexX in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getVertexY

        -
        public float getVertexY(int index)
        -
        -
        Overrides:
        -
        getVertexY in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getVertexZ

        -
        public float getVertexZ(int index)
        -
        -
        Overrides:
        -
        getVertexZ in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setVertex

        -
        public void setVertex(int index,
        -                      float x,
        -                      float y)
        -
        -
        Overrides:
        -
        setVertex in class PShape
        -
        Parameters:
        -
        index - the location of the vertex
        -
        x - the x value for the vertex
        -
        y - the y value for the vertex
        -
        See Also:
        -
        PShape.getVertex(int), -PShape.getVertexCount()
        -
        -
      • -
      - - - -
        -
      • -

        setVertex

        -
        public void setVertex(int index,
        -                      float x,
        -                      float y,
        -                      float z)
        -
        -
        Overrides:
        -
        setVertex in class PShape
        -
        z - the z value for the vertex
        -
        -
      • -
      - - - -
        -
      • -

        setVertex

        -
        public void setVertex(int index,
        -                      PVector vec)
        -
        -
        Overrides:
        -
        setVertex in class PShape
        -
        vec - the PVector to define the x, y, z coordinates
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getNormalX

        -
        public float getNormalX(int index)
        -
        -
        Overrides:
        -
        getNormalX in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getNormalY

        -
        public float getNormalY(int index)
        -
        -
        Overrides:
        -
        getNormalY in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getNormalZ

        -
        public float getNormalZ(int index)
        -
        -
        Overrides:
        -
        getNormalZ in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setNormal

        -
        public void setNormal(int index,
        -                      float nx,
        -                      float ny,
        -                      float nz)
        -
        -
        Overrides:
        -
        setNormal in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setAttrib

        -
        public void setAttrib(String name,
        -                      int index,
        -                      float... values)
        -
        -
        Overrides:
        -
        setAttrib in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setAttrib

        -
        public void setAttrib(String name,
        -                      int index,
        -                      int... values)
        -
        -
        Overrides:
        -
        setAttrib in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setAttrib

        -
        public void setAttrib(String name,
        -                      int index,
        -                      boolean... values)
        -
        -
        Overrides:
        -
        setAttrib in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getTextureU

        -
        public float getTextureU(int index)
        -
        -
        Overrides:
        -
        getTextureU in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getTextureV

        -
        public float getTextureV(int index)
        -
        -
        Overrides:
        -
        getTextureV in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setTextureUV

        -
        public void setTextureUV(int index,
        -                         float u,
        -                         float v)
        -
        -
        Overrides:
        -
        setTextureUV in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getFill

        -
        public int getFill(int index)
        -
        -
        Overrides:
        -
        getFill in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setFill

        -
        public void setFill(boolean fill)
        -
        -
        Overrides:
        -
        setFill in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setFill

        -
        public void setFill(int fill)
        -
        -
        Overrides:
        -
        setFill in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setFill

        -
        public void setFill(int index,
        -                    int fill)
        -
        -
        Overrides:
        -
        setFill in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getTint

        -
        public int getTint(int index)
        -
        -
        Overrides:
        -
        getTint in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setTint

        -
        public void setTint(boolean tint)
        -
        -
        Overrides:
        -
        setTint in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setTint

        -
        public void setTint(int tint)
        -
        -
        Overrides:
        -
        setTint in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setTint

        -
        public void setTint(int index,
        -                    int tint)
        -
        -
        Overrides:
        -
        setTint in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getStroke

        -
        public int getStroke(int index)
        -
        -
        Overrides:
        -
        getStroke in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setStroke

        -
        public void setStroke(boolean stroke)
        -
        -
        Overrides:
        -
        setStroke in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setStroke

        -
        public void setStroke(int stroke)
        -
        -
        Overrides:
        -
        setStroke in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setStroke

        -
        public void setStroke(int index,
        -                      int stroke)
        -
        -
        Overrides:
        -
        setStroke in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getStrokeWeight

        -
        public float getStrokeWeight(int index)
        -
        -
        Overrides:
        -
        getStrokeWeight in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setStrokeWeight

        -
        public void setStrokeWeight(float weight)
        -
        -
        Overrides:
        -
        setStrokeWeight in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setStrokeWeight

        -
        public void setStrokeWeight(int index,
        -                            float weight)
        -
        -
        Overrides:
        -
        setStrokeWeight in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setStrokeJoin

        -
        public void setStrokeJoin(int join)
        -
        -
        Overrides:
        -
        setStrokeJoin in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setStrokeCap

        -
        public void setStrokeCap(int cap)
        -
        -
        Overrides:
        -
        setStrokeCap in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getAmbient

        -
        public int getAmbient(int index)
        -
        -
        Overrides:
        -
        getAmbient in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setAmbient

        -
        public void setAmbient(int ambient)
        -
        -
        Overrides:
        -
        setAmbient in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setAmbient

        -
        public void setAmbient(int index,
        -                       int ambient)
        -
        -
        Overrides:
        -
        setAmbient in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getSpecular

        -
        public int getSpecular(int index)
        -
        -
        Overrides:
        -
        getSpecular in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setSpecular

        -
        public void setSpecular(int specular)
        -
        -
        Overrides:
        -
        setSpecular in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setSpecular

        -
        public void setSpecular(int index,
        -                        int specular)
        -
        -
        Overrides:
        -
        setSpecular in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getEmissive

        -
        public int getEmissive(int index)
        -
        -
        Overrides:
        -
        getEmissive in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setEmissive

        -
        public void setEmissive(int emissive)
        -
        -
        Overrides:
        -
        setEmissive in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setEmissive

        -
        public void setEmissive(int index,
        -                        int emissive)
        -
        -
        Overrides:
        -
        setEmissive in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getShininess

        -
        public float getShininess(int index)
        -
        -
        Overrides:
        -
        getShininess in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setShininess

        -
        public void setShininess(float shininess)
        -
        -
        Overrides:
        -
        setShininess in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        setShininess

        -
        public void setShininess(int index,
        -                         float shine)
        -
        -
        Overrides:
        -
        setShininess in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        getVertexCodes

        -
        public int[] getVertexCodes()
        -
        -
        Overrides:
        -
        getVertexCodes in class PShape
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getVertexCode

        -
        public int getVertexCode(int index)
        -
        One of VERTEX, BEZIER_VERTEX, CURVE_VERTEX, or BREAK.
        -
        -
        Overrides:
        -
        getVertexCode in class PShape
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getTessellation

        -
        public float[] getTessellation(int kind,
        -                               int data)
        -
      • -
      - - - -
        -
      • -

        contains

        -
        public boolean contains(float x,
        -                        float y)
        -
        -
        Overrides:
        -
        contains in class PShape
        -
        -
      • -
      - - - -
        -
      • -

        disableStyle

        -
        public void disableStyle()
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_disableStyle.xml ) - - Disables the shape's style data and uses Processing's current styles. - Styles include attributes such as colors, stroke weight, and stroke - joints. - - ( end auto-generated ) -

        Advanced

        - Overrides this shape's style information and uses PGraphics styles and - colors. Identical to ignoreStyles(true). Also disables styles for all - child shapes.
        -
        -
        Overrides:
        -
        disableStyle in class PShape
        -
        See Also:
        -
        PShape.enableStyle()
        -
        -
      • -
      - - - -
        -
      • -

        enableStyle

        -
        public void enableStyle()
        -
        Description copied from class: PShape
        -
        ( begin auto-generated from PShape_enableStyle.xml ) - - Enables the shape's style data and ignores Processing's current styles. - Styles include attributes such as colors, stroke weight, and stroke - joints. - - ( end auto-generated )
        -
        -
        Overrides:
        -
        enableStyle in class PShape
        -
        See Also:
        -
        PShape.disableStyle()
        -
        -
      • -
      - - - -
        -
      • -

        draw

        -
        public void draw()
        -
      • -
      - - - -
        -
      • -

        draw

        -
        public void draw(PGraphics g)
        -
        Description copied from class: PShape
        -
        Called by the following (the shape() command adds the g) - PShape s = loadShape("blah.svg"); - shape(s);
        -
        -
        Overrides:
        -
        draw in class PShape
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/opengl/PSurfaceJOGL.html b/build/javadoc/everything/processing/opengl/PSurfaceJOGL.html deleted file mode 100644 index c1ab9a092b..0000000000 --- a/build/javadoc/everything/processing/opengl/PSurfaceJOGL.html +++ /dev/null @@ -1,727 +0,0 @@ - - - - - -PSurfaceJOGL - - - - - - - - - - - -
-
processing.opengl
-

Class PSurfaceJOGL

-
-
-
    -
  • Object
  • -
  • -
      -
    • PSurfaceJOGL
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PSurface
    -
    -
    -
    -
    public class PSurfaceJOGL
    -extends Object
    -implements PSurface
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        profile

        -
        public static GLProfile profile
        -
        Selected GL profile
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PSurfaceJOGL

        -
        public PSurfaceJOGL(PGraphics graphics)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - - - - - -
        -
      • -

        setTitle

        -
        public void setTitle(String title)
        -
        Description copied from interface: PSurface
        -
        Set the window (and dock, or whatever necessary) title.
        -
        -
        Specified by:
        -
        setTitle in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setVisible

        -
        public void setVisible(boolean visible)
        -
        Description copied from interface: PSurface
        -
        Show or hide the window.
        -
        -
        Specified by:
        -
        setVisible in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setResizable

        -
        public void setResizable(boolean resizable)
        -
        Description copied from interface: PSurface
        -
        Set true if we want to resize things (default is not resizable)
        -
        -
        Specified by:
        -
        setResizable in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        placeWindow

        -
        public void placeWindow(int[] location,
        -                        int[] editorLocation)
        -
        -
        Specified by:
        -
        placeWindow in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        placePresent

        -
        public void placePresent(int stopColor)
        -
        -
        Specified by:
        -
        placePresent in interface PSurface
        -
        -
      • -
      - - - - - - - -
        -
      • -

        startThread

        -
        public void startThread()
        -
        Description copied from interface: PSurface
        -
        Start the animation thread
        -
        -
        Specified by:
        -
        startThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        pauseThread

        -
        public void pauseThread()
        -
        Description copied from interface: PSurface
        -
        On the next trip through the animation thread, things should go sleepy-bye. - Does not pause the thread immediately because that needs to happen on the - animation thread itself, so fires on the next trip through draw().
        -
        -
        Specified by:
        -
        pauseThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        resumeThread

        -
        public void resumeThread()
        -
        -
        Specified by:
        -
        resumeThread in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        stopThread

        -
        public boolean stopThread()
        -
        Description copied from interface: PSurface
        -
        Stop the animation thread (set it null)
        -
        -
        Specified by:
        -
        stopThread in interface PSurface
        -
        Returns:
        -
        false if already stopped
        -
        -
      • -
      - - - -
        -
      • -

        isStopped

        -
        public boolean isStopped()
        -
        -
        Specified by:
        -
        isStopped in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setSize

        -
        public void setSize(int width,
        -                    int height)
        -
        -
        Specified by:
        -
        setSize in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        getPixelScale

        -
        public float getPixelScale()
        -
      • -
      - - - -
        -
      • -

        getComponent

        -
        public Component getComponent()
        -
      • -
      - - - -
        -
      • -

        setSmooth

        -
        public void setSmooth(int level)
        -
        Description copied from interface: PSurface
        -
        Sometimes smoothing must be set at the drawing surface level - not just inside the renderer itself.
        -
        -
        Specified by:
        -
        setSmooth in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setFrameRate

        -
        public void setFrameRate(float fps)
        -
        -
        Specified by:
        -
        setFrameRate in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        requestFocus

        -
        public void requestFocus()
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        public void setCursor(int kind)
        -
        -
        Specified by:
        -
        setCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        public void setCursor(PImage image,
        -                      int hotspotX,
        -                      int hotspotY)
        -
        -
        Specified by:
        -
        setCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        showCursor

        -
        public void showCursor()
        -
        -
        Specified by:
        -
        showCursor in interface PSurface
        -
        -
      • -
      - - - -
        -
      • -

        hideCursor

        -
        public void hideCursor()
        -
        -
        Specified by:
        -
        hideCursor in interface PSurface
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/opengl/Texture.Parameters.html b/build/javadoc/everything/processing/opengl/Texture.Parameters.html deleted file mode 100644 index 0830e376eb..0000000000 --- a/build/javadoc/everything/processing/opengl/Texture.Parameters.html +++ /dev/null @@ -1,513 +0,0 @@ - - - - - -Texture.Parameters - - - - - - - - - - - -
-
processing.opengl
-

Class Texture.Parameters

-
-
-
    -
  • Object
  • -
  • -
      -
    • Texture.Parameters
    • -
    -
  • -
-
-
    -
  • -
    -
    Enclosing class:
    -
    Texture
    -
    -
    -
    -
    public static class Texture.Parameters
    -extends Object
    -
    This class stores the parameters for a texture: target, internal format, - minimization filter and magnification filter.
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        target

        -
        public int target
        -
        Texture target.
        -
      • -
      - - - -
        -
      • -

        format

        -
        public int format
        -
        Texture internal format.
        -
      • -
      - - - -
        -
      • -

        sampling

        -
        public int sampling
        -
        Texture filtering (POINT, LINEAR, BILINEAR or TRILINEAR).
        -
      • -
      - - - -
        -
      • -

        mipmaps

        -
        public boolean mipmaps
        -
        Use mipmaps or not.
        -
      • -
      - - - -
        -
      • -

        wrapU

        -
        public int wrapU
        -
        Wrapping mode along U.
        -
      • -
      - - - -
        -
      • -

        wrapV

        -
        public int wrapV
        -
        Wrapping mode along V.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Parameters

        -
        public Parameters()
        -
        Sets all the parameters to default values.
        -
      • -
      - - - -
        -
      • -

        Parameters

        -
        public Parameters(int format)
        -
      • -
      - - - -
        -
      • -

        Parameters

        -
        public Parameters(int format,
        -                  int sampling)
        -
      • -
      - - - -
        -
      • -

        Parameters

        -
        public Parameters(int format,
        -                  int sampling,
        -                  boolean mipmaps)
        -
      • -
      - - - -
        -
      • -

        Parameters

        -
        public Parameters(int format,
        -                  int sampling,
        -                  boolean mipmaps,
        -                  int wrap)
        -
      • -
      - - - - -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        set

        -
        public void set(int format)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int format,
        -                int sampling)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int format,
        -                int sampling,
        -                boolean mipmaps)
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/opengl/Texture.html b/build/javadoc/everything/processing/opengl/Texture.html deleted file mode 100644 index 17a9911a7e..0000000000 --- a/build/javadoc/everything/processing/opengl/Texture.html +++ /dev/null @@ -1,1463 +0,0 @@ - - - - - -Texture - - - - - - - - - - - -
-
processing.opengl
-

Class Texture

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    PConstants
    -
    -
    -
    -
    public class Texture
    -extends Object
    -implements PConstants
    -
    This class wraps an OpenGL texture. - By Andres Colubri
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        width

        -
        public int width
        -
      • -
      - - - -
        -
      • -

        height

        -
        public int height
        -
      • -
      - - - -
        -
      • -

        glName

        -
        public int glName
        -
      • -
      - - - -
        -
      • -

        glTarget

        -
        public int glTarget
        -
      • -
      - - - -
        -
      • -

        glFormat

        -
        public int glFormat
        -
      • -
      - - - -
        -
      • -

        glMinFilter

        -
        public int glMinFilter
        -
      • -
      - - - -
        -
      • -

        glMagFilter

        -
        public int glMagFilter
        -
      • -
      - - - -
        -
      • -

        glWrapS

        -
        public int glWrapS
        -
      • -
      - - - -
        -
      • -

        glWrapT

        -
        public int glWrapT
        -
      • -
      - - - -
        -
      • -

        glWidth

        -
        public int glWidth
        -
      • -
      - - - -
        -
      • -

        glHeight

        -
        public int glHeight
        -
      • -
      - - - -
        -
      • -

        MAX_BUFFER_CACHE_SIZE

        -
        public static final int MAX_BUFFER_CACHE_SIZE
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - - - - - -
        -
      • -

        Texture

        -
        public Texture(PGraphicsOpenGL pg,
        -               int width,
        -               int height)
        -
        Creates an instance of PTexture with size width x height. The texture is - initialized (empty) to that size.
        -
        -
        Parameters:
        -
        width - int
        -
        height - int
        -
        -
      • -
      - - - -
        -
      • -

        Texture

        -
        public Texture(PGraphicsOpenGL pg,
        -               int width,
        -               int height,
        -               Object params)
        -
        Creates an instance of PTexture with size width x height and with the - specified parameters. The texture is initialized (empty) to that size.
        -
        -
        Parameters:
        -
        width - int
        -
        height - int
        -
        params - Parameters
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        init

        -
        public void init(int width,
        -                 int height)
        -
        Sets the size of the image and texture to width x height. If the texture is - already initialized, it first destroys the current OpenGL texture object - and then creates a new one with the specified size.
        -
        -
        Parameters:
        -
        width - int
        -
        height - int
        -
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init(int width,
        -                 int height,
        -                 Texture.Parameters params)
        -
        Sets the size of the image and texture to width x height, and the - parameters of the texture to params. If the texture is already initialized, - it first destroys the current OpenGL texture object and then creates a new - one with the specified size.
        -
        -
        Parameters:
        -
        width - int
        -
        height - int
        -
        params - GLTextureParameters
        -
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init(int width,
        -                 int height,
        -                 int glName,
        -                 int glTarget,
        -                 int glFormat,
        -                 int glWidth,
        -                 int glHeight,
        -                 int glMinFilter,
        -                 int glMagFilter,
        -                 int glWrapS,
        -                 int glWrapT)
        -
        Initializes the texture using GL parameters
        -
      • -
      - - - -
        -
      • -

        resize

        -
        public void resize(int wide,
        -                   int high)
        -
      • -
      - - - -
        -
      • -

        available

        -
        public boolean available()
        -
        Returns true if the texture has been initialized.
        -
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(Texture tex)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(Texture tex,
        -                int x,
        -                int y,
        -                int w,
        -                int h)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int texTarget,
        -                int texName,
        -                int texWidth,
        -                int texHeight,
        -                int w,
        -                int h)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int texTarget,
        -                int texName,
        -                int texWidth,
        -                int texHeight,
        -                int target,
        -                int tex,
        -                int x,
        -                int y,
        -                int w,
        -                int h)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int[] pixels)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int[] pixels,
        -                int format)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int[] pixels,
        -                int x,
        -                int y,
        -                int w,
        -                int h)
        -
      • -
      - - - -
        -
      • -

        set

        -
        public void set(int[] pixels,
        -                int x,
        -                int y,
        -                int w,
        -                int h,
        -                int format)
        -
      • -
      - - - -
        -
      • -

        setNative

        -
        public void setNative(int[] pixels)
        -
      • -
      - - - -
        -
      • -

        setNative

        -
        public void setNative(int[] pixels,
        -                      int x,
        -                      int y,
        -                      int w,
        -                      int h)
        -
      • -
      - - - -
        -
      • -

        setNative

        -
        public void setNative(IntBuffer pixBuf,
        -                      int x,
        -                      int y,
        -                      int w,
        -                      int h)
        -
      • -
      - - - -
        -
      • -

        get

        -
        public void get(int[] pixels)
        -
        Copy texture to pixels. Involves video memory to main memory transfer (slow).
        -
      • -
      - - - -
        -
      • -

        put

        -
        public void put(Texture tex)
        -
      • -
      - - - -
        -
      • -

        put

        -
        public void put(Texture tex,
        -                int x,
        -                int y,
        -                int w,
        -                int h)
        -
      • -
      - - - -
        -
      • -

        put

        -
        public void put(int texTarget,
        -                int texName,
        -                int texWidth,
        -                int texHeight,
        -                int w,
        -                int h)
        -
      • -
      - - - -
        -
      • -

        put

        -
        public void put(int texTarget,
        -                int texName,
        -                int texWidth,
        -                int texHeight,
        -                int target,
        -                int tex,
        -                int x,
        -                int y,
        -                int w,
        -                int h)
        -
      • -
      - - - -
        -
      • -

        usingMipmaps

        -
        public boolean usingMipmaps()
        -
        Returns true or false whether or not the texture is using mipmaps.
        -
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        usingMipmaps

        -
        public void usingMipmaps(boolean mipmaps,
        -                         int sampling)
        -
      • -
      - - - -
        -
      • -

        usingRepeat

        -
        public boolean usingRepeat()
        -
        Returns true or false whether or not the texture is using repeat wrap mode - along either U or V directions.
        -
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        usingRepeat

        -
        public void usingRepeat(boolean repeat)
        -
      • -
      - - - -
        -
      • -

        maxTexcoordU

        -
        public float maxTexcoordU()
        -
        Returns the maximum possible value for the texture coordinate U - (horizontal).
        -
        -
        Returns:
        -
        float
        -
        -
      • -
      - - - -
        -
      • -

        maxTexcoordV

        -
        public float maxTexcoordV()
        -
        Returns the maximum possible value for the texture coordinate V (vertical).
        -
        -
        Returns:
        -
        float
        -
        -
      • -
      - - - -
        -
      • -

        invertedX

        -
        public boolean invertedX()
        -
        Returns true if the texture is inverted along the horizontal direction.
        -
        -
        Returns:
        -
        boolean;
        -
        -
      • -
      - - - -
        -
      • -

        invertedX

        -
        public void invertedX(boolean v)
        -
        Sets the texture as inverted or not along the horizontal direction.
        -
        -
        Parameters:
        -
        v - boolean;
        -
        -
      • -
      - - - -
        -
      • -

        invertedY

        -
        public boolean invertedY()
        -
        Returns true if the texture is inverted along the vertical direction.
        -
        -
        Returns:
        -
        boolean;
        -
        -
      • -
      - - - -
        -
      • -

        invertedY

        -
        public void invertedY(boolean v)
        -
        Sets the texture as inverted or not along the vertical direction.
        -
        -
        Parameters:
        -
        v - boolean;
        -
        -
      • -
      - - - -
        -
      • -

        currentSampling

        -
        public int currentSampling()
        -
      • -
      - - - -
        -
      • -

        bind

        -
        public void bind()
        -
      • -
      - - - -
        -
      • -

        unbind

        -
        public void unbind()
        -
      • -
      - - - -
        -
      • -

        bound

        -
        public boolean bound()
        -
      • -
      - - - -
        -
      • -

        isModified

        -
        public boolean isModified()
        -
      • -
      - - - -
        -
      • -

        setModified

        -
        public void setModified()
        -
      • -
      - - - -
        -
      • -

        setModified

        -
        public void setModified(boolean m)
        -
      • -
      - - - -
        -
      • -

        getModifiedX1

        -
        public int getModifiedX1()
        -
      • -
      - - - -
        -
      • -

        getModifiedX2

        -
        public int getModifiedX2()
        -
      • -
      - - - -
        -
      • -

        getModifiedY1

        -
        public int getModifiedY1()
        -
      • -
      - - - -
        -
      • -

        getModifiedY2

        -
        public int getModifiedY2()
        -
      • -
      - - - -
        -
      • -

        updateTexels

        -
        public void updateTexels()
        -
      • -
      - - - -
        -
      • -

        updateTexels

        -
        public void updateTexels(int x,
        -                         int y,
        -                         int w,
        -                         int h)
        -
      • -
      - - - -
        -
      • -

        setBufferSource

        -
        public void setBufferSource(Object source)
        -
      • -
      - - - -
        -
      • -

        copyBufferFromSource

        -
        public void copyBufferFromSource(Object natRef,
        -                                 ByteBuffer byteBuf,
        -                                 int w,
        -                                 int h)
        -
      • -
      - - - -
        -
      • -

        disposeSourceBuffer

        -
        public void disposeSourceBuffer()
        -
      • -
      - - - -
        -
      • -

        getBufferPixels

        -
        public void getBufferPixels(int[] pixels)
        -
      • -
      - - - -
        -
      • -

        hasBufferSource

        -
        public boolean hasBufferSource()
        -
      • -
      - - - -
        -
      • -

        hasBuffers

        -
        public boolean hasBuffers()
        -
      • -
      - - - -
        -
      • -

        colorBuffer

        -
        public void colorBuffer(boolean value)
        -
      • -
      - - - -
        -
      • -

        colorBuffer

        -
        public boolean colorBuffer()
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/build/javadoc/everything/processing/opengl/package-frame.html b/build/javadoc/everything/processing/opengl/package-frame.html deleted file mode 100644 index ae081f9501..0000000000 --- a/build/javadoc/everything/processing/opengl/package-frame.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - -processing.opengl - - - - -

processing.opengl

- - - diff --git a/build/javadoc/everything/processing/opengl/package-summary.html b/build/javadoc/everything/processing/opengl/package-summary.html deleted file mode 100644 index bea5b68906..0000000000 --- a/build/javadoc/everything/processing/opengl/package-summary.html +++ /dev/null @@ -1,211 +0,0 @@ - - - - - -processing.opengl - - - - - - - - - - -
-

Package processing.opengl

-
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    FrameBuffer -
    Encapsulates a Frame Buffer Object for offscreen rendering.
    -
    LinePath -
    The LinePath class allows to represent polygonal paths, - potentially composed by several disjoint polygonal segments.
    -
    LinePath.PathIterator 
    LineStroker 
    PGL -
    Processing-OpenGL abstraction layer.
    -
    PGraphics2D 
    PGraphics3D 
    PGraphicsOpenGL -
    OpenGL renderer.
    -
    PJOGL 
    PShader -
    This class encapsulates a GLSL shader program, including a vertex - and a fragment shader.
    -
    PShapeOpenGL -
    This class holds a 3D model composed of vertices, normals, colors - (per vertex) and texture coordinates (also per vertex).
    -
    PSurfaceJOGL 
    Texture -
    This class wraps an OpenGL texture.
    -
    Texture.Parameters -
    This class stores the parameters for a texture: target, internal format, - minimization filter and magnification filter.
    -
    -
  • -
-
- - - - - - diff --git a/build/javadoc/everything/processing/opengl/package-tree.html b/build/javadoc/everything/processing/opengl/package-tree.html deleted file mode 100644 index 4b3a41bfbd..0000000000 --- a/build/javadoc/everything/processing/opengl/package-tree.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - -processing.opengl Class Hierarchy - - - - - - - - - - -
-

Hierarchy For Package processing.opengl

-Package Hierarchies: - -
-
-

Class Hierarchy

- -
- - - - - - diff --git a/build/javadoc/everything/script.js b/build/javadoc/everything/script.js deleted file mode 100644 index b346356931..0000000000 --- a/build/javadoc/everything/script.js +++ /dev/null @@ -1,30 +0,0 @@ -function show(type) -{ - count = 0; - for (var key in methods) { - var row = document.getElementById(key); - if ((methods[key] & type) != 0) { - row.style.display = ''; - row.className = (count++ % 2) ? rowColor : altColor; - } - else - row.style.display = 'none'; - } - updateTabs(type); -} - -function updateTabs(type) -{ - for (var value in tabs) { - var sNode = document.getElementById(tabs[value][0]); - var spanNode = sNode.firstChild; - if (value == type) { - sNode.className = activeTableTab; - spanNode.innerHTML = tabs[value][1]; - } - else { - sNode.className = tableTab; - spanNode.innerHTML = "" + tabs[value][1] + ""; - } - } -} diff --git a/build/javadoc/everything/serialized-form.html b/build/javadoc/everything/serialized-form.html deleted file mode 100644 index def4280d00..0000000000 --- a/build/javadoc/everything/serialized-form.html +++ /dev/null @@ -1,1353 +0,0 @@ - - - - - -Serialized Form - - - - - - - - - - -
-

Serialized Form

-
-
-
    -
  • -

    Package processing.app

    -
      -
    • - - -

      Class About extends Window implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          image

          -
          Image image
          -
        • -
        • -

          width

          -
          int width
          -
        • -
        • -

          height

          -
          int height
          -
        • -
        -
      • -
      -
    • -
    • - - -

      Class ColorChooser.ColorRange extends JComponent implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          lastX

          -
          int lastX
          -
        • -
        • -

          lastY

          -
          int lastY
          -
        • -
        -
      • -
      -
    • -
    • - - -

      Class ColorChooser.ColorSlider extends JComponent implements Serializable

      -
    • -
    • - - -

      Class Editor extends JFrame implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          base

          -
          Base base
          -
        • -
        • -

          state

          -
          EditorState state
          -
        • -
        • -

          mode

          -
          Mode mode
          -
        • -
        • -

          pageFormat

          -
          PageFormat pageFormat
          -
          true if this file has not yet been given a name by the user
          -
        • -
        • -

          printerJob

          -
          PrinterJob printerJob
          -
        • -
        • -

          fileMenu

          -
          JMenu fileMenu
          -
        • -
        • -

          sketchMenu

          -
          JMenu sketchMenu
          -
        • -
        • -

          header

          -
          EditorHeader header
          -
        • -
        • -

          toolbar

          -
          EditorToolbar toolbar
          -
        • -
        • -

          textarea

          -
          JEditTextArea textarea
          -
        • -
        • -

          status

          -
          EditorStatus status
          -
        • -
        • -

          splitPane

          -
          JSplitPane splitPane
          -
        • -
        • -

          footer

          -
          EditorFooter footer
          -
        • -
        • -

          console

          -
          EditorConsole console
          -
        • -
        • -

          sketch

          -
          Sketch sketch
          -
        • -
        • -

          sketchWindowLocation

          -
          Point sketchWindowLocation
          -
        • -
        • -

          undoItem

          -
          JMenuItem undoItem
          -
        • -
        • -

          redoItem

          -
          JMenuItem redoItem
          -
        • -
        • -

          copyItems

          -
          JMenuItem copyItems
          -
        • -
        • -

          cutItems

          -
          JMenuItem cutItems
          -
        • -
        • -

          undoAction

          -
          Editor.UndoAction undoAction
          -
        • -
        • -

          redoAction

          -
          Editor.RedoAction redoAction
          -
        • -
        • -

          copyAction

          -
          Editor.CopyAction copyAction
          -
          the currently selected tab's undo manager
          -
        • -
        • -

          cutAction

          -
          Editor.CutAction cutAction
          -
        • -
        • -

          undo

          -
          UndoManager undo
          -
        • -
        • -

          compoundEdit

          -
          CompoundEdit compoundEdit
          -
        • -
        • -

          timer

          -
          Timer timer
          -
        • -
        • -

          endUndoEvent

          -
          TimerTask endUndoEvent
          -
        • -
        • -

          isInserting

          -
          boolean isInserting
          -
        • -
        • -

          caretUndoStack

          -
          Stack<E> caretUndoStack
          -
        • -
        • -

          caretRedoStack

          -
          Stack<E> caretRedoStack
          -
        • -
        • -

          find

          -
          FindReplace find
          -
        • -
        • -

          toolsMenu

          -
          JMenu toolsMenu
          -
        • -
        • -

          modeMenu

          -
          JMenu modeMenu
          -
        • -
        • -

          coreTools

          -
          List<E> coreTools
          -
        • -
        • -

          contribTools

          -
          List<E> contribTools
          -
        • -
        • -

          backgroundGradient

          -
          Image backgroundGradient
          -
        • -
        -
      • -
      -
    • -
    • - - -

      Class EditorButton extends JComponent implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          title

          -
          String title
          -
          Button's description.
          -
        • -
        • -

          titleShift

          -
          String titleShift
          -
          Description of alternate behavior when shift is down.
          -
        • -
        • -

          titleAlt

          -
          String titleAlt
          -
          Description of alternate behavior when alt is down.
          -
        • -
        • -

          pressed

          -
          boolean pressed
          -
        • -
        • -

          selected

          -
          boolean selected
          -
        • -
        • -

          rollover

          -
          boolean rollover
          -
        • -
        • -

          rolloverLabel

          -
          JLabel rolloverLabel
          -
        • -
        • -

          shift

          -
          boolean shift
          -
        • -
        • -

          enabledImage

          -
          Image enabledImage
          -
        • -
        • -

          disabledImage

          -
          Image disabledImage
          -
        • -
        • -

          selectedImage

          -
          Image selectedImage
          -
        • -
        • -

          rolloverImage

          -
          Image rolloverImage
          -
        • -
        • -

          pressedImage

          -
          Image pressedImage
          -
        • -
        • -

          gradient

          -
          Image gradient
          -
        • -
        • -

          mode

          -
          Mode mode
          -
        • -
        -
      • -
      -
    • -
    • - - -

      Class EditorConsole extends JScrollPane implements Serializable

      - -
    • -
    • - - -

      Class EditorFooter extends Box implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          textColor

          -
          Color[] textColor
          -
        • -
        • -

          tabColor

          -
          Color[] tabColor
          -
        • -
        • -

          errorColor

          -
          Color errorColor
          -
        • -
        • -

          editor

          -
          Editor editor
          -
        • -
        • -

          tabs

          -
          List<E> tabs
          -
        • -
        • -

          font

          -
          Font font
          -
        • -
        • -

          fontAscent

          -
          int fontAscent
          -
        • -
        • -

          menu

          -
          JMenu menu
          -
        • -
        • -

          popup

          -
          JPopupMenu popup
          -
        • -
        • -

          offscreen

          -
          Image offscreen
          -
        • -
        • -

          sizeW

          -
          int sizeW
          -
        • -
        • -

          sizeH

          -
          int sizeH
          -
        • -
        • -

          imageW

          -
          int imageW
          -
        • -
        • -

          imageH

          -
          int imageH
          -
        • -
        • -

          gradient

          -
          Image gradient
          -
        • -
        • -

          cardPanel

          -
          JPanel cardPanel
          -
        • -
        • -

          cardLayout

          -
          CardLayout cardLayout
          -
        • -
        • -

          controller

          -
          EditorFooter.Controller controller
          -
        • -
        -
      • -
      -
    • -
    • - - -

      Class EditorHeader extends JComponent implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          textColor

          -
          Color[] textColor
          -
        • -
        • -

          tabColor

          -
          Color[] tabColor
          -
        • -
        • -

          modifiedColor

          -
          Color modifiedColor
          -
        • -
        • -

          arrowColor

          -
          Color arrowColor
          -
        • -
        • -

          editor

          -
          Editor editor
          -
        • -
        • -

          tabs

          -
          EditorHeader.Tab[] tabs
          -
        • -
        • -

          visitOrder

          -
          EditorHeader.Tab[] visitOrder
          -
        • -
        • -

          font

          -
          Font font
          -
        • -
        • -

          fontAscent

          -
          int fontAscent
          -
        • -
        • -

          menu

          -
          JMenu menu
          -
        • -
        • -

          popup

          -
          JPopupMenu popup
          -
        • -
        • -

          menuLeft

          -
          int menuLeft
          -
        • -
        • -

          menuRight

          -
          int menuRight
          -
        • -
        • -

          offscreen

          -
          Image offscreen
          -
        • -
        • -

          sizeW

          -
          int sizeW
          -
        • -
        • -

          sizeH

          -
          int sizeH
          -
        • -
        • -

          imageW

          -
          int imageW
          -
        • -
        • -

          imageH

          -
          int imageH
          -
        • -
        • -

          lastNoticeName

          -
          String lastNoticeName
          -
        • -
        • -

          gradient

          -
          Image gradient
          -
        • -
        -
      • -
      -
    • -
    • - - -

      Class EditorStatus extends BasicSplitPaneDivider implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          bgcolor

          -
          Color[] bgcolor
          -
        • -
        • -

          fgcolor

          -
          Color[] fgcolor
          -
        • -
        • -

          editor

          -
          Editor editor
          -
        • -
        • -

          mode

          -
          int mode
          -
        • -
        • -

          message

          -
          String message
          -
        • -
        • -

          font

          -
          Font font
          -
        • -
        • -

          metrics

          -
          FontMetrics metrics
          -
        • -
        • -

          ascent

          -
          int ascent
          -
        • -
        • -

          offscreen

          -
          Image offscreen
          -
        • -
        • -

          sizeW

          -
          int sizeW
          -
        • -
        • -

          sizeH

          -
          int sizeH
          -
        • -
        • -

          response

          -
          int response
          -
        • -
        • -

          indeterminate

          -
          boolean indeterminate
          -
        • -
        • -

          thread

          -
          Thread thread
          -
        • -
        -
      • -
      -
    • -
    • - - -

      Class EditorToolbar extends JPanel implements Serializable

      - -
    • -
    • - - -

      Class FindReplace extends JFrame implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          editor

          -
          Editor editor
          -
        • -
        • -

          findField

          -
          JTextField findField
          -
        • -
        • -

          replaceField

          -
          JTextField replaceField
          -
        • -
        • -

          replaceButton

          -
          JButton replaceButton
          -
        • -
        • -

          replaceAllButton

          -
          JButton replaceAllButton
          -
        • -
        • -

          replaceAndFindButton

          -
          JButton replaceAndFindButton
          -
        • -
        • -

          previousButton

          -
          JButton previousButton
          -
        • -
        • -

          findButton

          -
          JButton findButton
          -
        • -
        • -

          ignoreCaseBox

          -
          JCheckBox ignoreCaseBox
          -
        • -
        • -

          allTabsBox

          -
          JCheckBox allTabsBox
          -
        • -
        • -

          wrapAroundBox

          -
          JCheckBox wrapAroundBox
          -
        • -
        -
      • -
      -
    • -
    • - - -

      Class ProgressFrame extends JFrame implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          progressBar

          -
          JProgressBar progressBar
          -
        • -
        • -

          label

          -
          JLabel label
          -
        • -
        • -

          copyItems

          -
          File[] copyItems
          -
        • -
        • -

          newFolder

          -
          File newFolder
          -
        • -
        • -

          addFile

          -
          File addFile
          -
        • -
        • -

          sourceFile

          -
          File sourceFile
          -
        • -
        • -

          editor

          -
          Editor editor
          -
        • -
        -
      • -
      -
    • -
    • - - -

      Class SketchException extends Exception implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          message

          -
          String message
          -
        • -
        • -

          codeIndex

          -
          int codeIndex
          -
        • -
        • -

          codeLine

          -
          int codeLine
          -
        • -
        • -

          codeColumn

          -
          int codeColumn
          -
        • -
        • -

          showStackTrace

          -
          boolean showStackTrace
          -
        • -
        -
      • -
      -
    • -
    -
  • -
  • -

    Package processing.app.contrib

    -
      -
    • - - -

      Class ContributionListPanel extends JPanel implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          contribManager

          -
          ContributionManagerDialog contribManager
          -
        • -
        • -

          panelByContribution

          -
          TreeMap<K,V> panelByContribution
          -
        • -
        • -

          selectedPanel

          -
          ContributionPanel selectedPanel
          -
        • -
        • -

          status

          -
          StatusPanel status
          -
        • -
        • -

          filter

          -
          ContributionFilter filter
          -
        • -
        • -

          contribListing

          -
          ContributionListing contribListing
          -
        • -
        -
      • -
      -
    • -
    • - - -

      Class LocalContribution.IgnorableException extends Exception implements Serializable

      -
    • -
    -
  • -
  • -

    Package processing.app.syntax

    -
      -
    • - - -

      Class JEditTextArea extends JComponent implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          inputMethodSupport

          -
          InputMethodSupport inputMethodSupport
          -
        • -
        • -

          bracketHelper

          -
          Brackets bracketHelper
          -
        • -
        • -

          caretTimer

          -
          Timer caretTimer
          -
        • -
        • -

          DISABLE_CARET

          -
          boolean DISABLE_CARET
          -
        • -
        • -

          painter

          -
          TextAreaPainter painter
          -
        • -
        • -

          popup

          -
          JPopupMenu popup
          -
        • -
        • -

          eventListenerList

          -
          EventListenerList eventListenerList
          -
        • -
        • -

          caretEvent

          -
          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

          -
          JScrollBar vertical
          -
        • -
        • -

          horizontal

          -
          JScrollBar horizontal
          -
        • -
        • -

          scrollBarsInitialized

          -
          boolean scrollBarsInitialized
          -
        • -
        • -

          inputHandler

          -
          InputHandler inputHandler
          -
        • -
        • -

          document

          -
          SyntaxDocument document
          -
        • -
        • -

          documentHandler

          -
          JEditTextArea.DocumentHandler documentHandler
          -
        • -
        • -

          lineSegment

          -
          Segment lineSegment
          -
        • -
        • -

          selectionStart

          -
          int selectionStart
          -
        • -
        • -

          selectionStartLine

          -
          int selectionStartLine
          -
        • -
        • -

          selectionEnd

          -
          int selectionEnd
          -
        • -
        • -

          selectionEndLine

          -
          int selectionEndLine
          -
        • -
        • -

          biasLeft

          -
          boolean biasLeft
          -
        • -
        • -

          newSelectionStart

          -
          int newSelectionStart
          -
        • -
        • -

          newSelectionEnd

          -
          int newSelectionEnd
          -
        • -
        • -

          selectWord

          -
          boolean selectWord
          -
        • -
        • -

          selectLine

          -
          boolean selectLine
          -
        • -
        • -

          selectionAncorStart

          -
          int selectionAncorStart
          -
        • -
        • -

          selectionAncorEnd

          -
          int selectionAncorEnd
          -
        • -
        • -

          bracketPosition

          -
          int bracketPosition
          -
        • -
        • -

          bracketLine

          -
          int bracketLine
          -
        • -
        • -

          magicCaret

          -
          int magicCaret
          -
        • -
        • -

          overwrite

          -
          boolean overwrite
          -
        • -
        • -

          rectSelect

          -
          boolean rectSelect
          -
        • -
        -
      • -
      -
    • -
    • - - -

      Class SyntaxDocument extends PlainDocument implements Serializable

      -
        -
      • -

        Serialized Fields

        - -
      • -
      -
    • -
    • - - -

      Class TextAreaPainter extends JComponent implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          printing

          -
          boolean printing
          -
          True if inside printing, will handle disabling the highlight
          -
        • -
        • -

          compositionTextPainter

          -
          CompositionTextPainter compositionTextPainter
          -
          A specific painter composed by the InputMethod.
          -
        • -
        • -

          textArea

          -
          JEditTextArea textArea
          -
        • -
        • -

          defaults

          -
          TextAreaDefaults defaults
          -
        • -
        • -

          plainFont

          -
          Font plainFont
          -
        • -
        • -

          boldFont

          -
          Font boldFont
          -
        • -
        • -

          antialias

          -
          boolean antialias
          -
        • -
        • -

          tabSize

          -
          int tabSize
          -
        • -
        • -

          fm

          -
          FontMetrics fm
          -
        • -
        • -

          highlights

          -
          TextAreaPainter.Highlight highlights
          -
        • -
        • -

          currentLineIndex

          -
          int currentLineIndex
          -
        • -
        • -

          currentLineTokens

          -
          Token currentLineTokens
          -
        • -
        • -

          currentLine

          -
          Segment currentLine
          -
        • -
        -
      • -
      -
    • -
    -
  • -
  • -

    Package processing.app.tools

    -
      -
    • - - -

      Class CreateFont extends JFrame implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          editor

          -
          Editor editor
          -
        • -
        • -

          fontSelector

          -
          JList<E> fontSelector
          -
        • -
        • -

          sizeSelector

          -
          JTextField sizeSelector
          -
        • -
        • -

          charsetButton

          -
          JButton charsetButton
          -
        • -
        • -

          smoothBox

          -
          JCheckBox smoothBox
          -
        • -
        • -

          sample

          -
          JComponent sample
          -
        • -
        • -

          okButton

          -
          JButton okButton
          -
        • -
        • -

          filenameField

          -
          JTextField filenameField
          -
        • -
        • -

          table

          -
          HashMap<K,V> table
          -
        • -
        • -

          smooth

          -
          boolean smooth
          -
        • -
        • -

          font

          -
          Font font
          -
        • -
        • -

          list

          -
          String[] list
          -
        • -
        • -

          selection

          -
          int selection
          -
        • -
        • -

          charSelector

          -
          CharacterSelector charSelector
          -
        • -
        -
      • -
      -
    • -
    -
  • -
  • -

    Package processing.core

    -
      -
    • - - -

      Class PVector extends Object implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          x

          -
          float x
          -
          ( begin auto-generated from PVector_x.xml ) - - The x component of the vector. This field (variable) can be used to both - get and set the value (see above example.) - - ( end auto-generated )
          -
        • -
        • -

          y

          -
          float y
          -
          ( begin auto-generated from PVector_y.xml ) - - The y component of the vector. This field (variable) can be used to both - get and set the value (see above example.) - - ( end auto-generated )
          -
        • -
        • -

          z

          -
          float z
          -
          ( begin auto-generated from PVector_z.xml ) - - The z component of the vector. This field (variable) can be used to both - get and set the value (see above example.) - - ( end auto-generated )
          -
        • -
        -
      • -
      -
    • -
    -
  • -
  • -

    Package processing.data

    -
      -
    • - - -

      Class XML extends Object implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          node

          -
          Node node
          -
          The internal representation, a DOM node.
          -
        • -
        • -

          parent

          -
          XML parent
          -
          The parent element.
          -
        • -
        • -

          children

          -
          XML[] children
          -
          Child elements, once loaded.
          -
        • -
        -
      • -
      -
    • -
    -
  • -
  • -

    Package processing.opengl

    -
      -
    • - - -

      Class PGraphicsOpenGL.AttributeMap extends HashMap<String,PGraphicsOpenGL.VertexAttribute> implements Serializable

      -
        -
      • -

        Serialized Fields

        -
          -
        • -

          names

          -
          ArrayList<E> names
          -
        • -
        • -

          numComp

          -
          int numComp
          -
        • -
        -
      • -
      -
    • -
    -
  • -
-
- - - - - - diff --git a/build/javadoc/everything/stylesheet.css b/build/javadoc/everything/stylesheet.css deleted file mode 100644 index cebb4fd8d5..0000000000 --- a/build/javadoc/everything/stylesheet.css +++ /dev/null @@ -1,574 +0,0 @@ -/* Javadoc style sheet */ -/* -Overall document style -*/ - -@import url('resources/fonts/dejavu.css'); - -body { - background-color:#ffffff; - color:#353833; - font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; - font-size:14px; - margin:0; -} -a:link, a:visited { - text-decoration:none; - color:#4A6782; -} -a:hover, a:focus { - text-decoration:none; - color:#bb7a2a; -} -a:active { - text-decoration:none; - color:#4A6782; -} -a[name] { - color:#353833; -} -a[name]:hover { - text-decoration:none; - color:#353833; -} -pre { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; -} -h1 { - font-size:20px; -} -h2 { - font-size:18px; -} -h3 { - font-size:16px; - font-style:italic; -} -h4 { - font-size:13px; -} -h5 { - font-size:12px; -} -h6 { - font-size:11px; -} -ul { - list-style-type:disc; -} -code, tt { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - padding-top:4px; - margin-top:8px; - line-height:1.4em; -} -dt code { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - padding-top:4px; -} -table tr td dt code { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - vertical-align:top; - padding-top:4px; -} -sup { - font-size:8px; -} -/* -Document title and Copyright styles -*/ -.clear { - clear:both; - height:0px; - overflow:hidden; -} -.aboutLanguage { - float:right; - padding:0px 21px; - font-size:11px; - z-index:200; - margin-top:-9px; -} -.legalCopy { - margin-left:.5em; -} -.bar a, .bar a:link, .bar a:visited, .bar a:active { - color:#FFFFFF; - text-decoration:none; -} -.bar a:hover, .bar a:focus { - color:#bb7a2a; -} -.tab { - background-color:#0066FF; - color:#ffffff; - padding:8px; - width:5em; - font-weight:bold; -} -/* -Navigation bar styles -*/ -.bar { - background-color:#4D7A97; - color:#FFFFFF; - padding:.8em .5em .4em .8em; - height:auto;/*height:1.8em;*/ - font-size:11px; - margin:0; -} -.topNav { - background-color:#4D7A97; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; - font-size:12px; -} -.bottomNav { - margin-top:10px; - background-color:#4D7A97; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; - font-size:12px; -} -.subNav { - background-color:#dee3e9; - float:left; - width:100%; - overflow:hidden; - font-size:12px; -} -.subNav div { - clear:left; - float:left; - padding:0 0 5px 6px; - text-transform:uppercase; -} -ul.navList, ul.subNavList { - float:left; - margin:0 25px 0 0; - padding:0; -} -ul.navList li{ - list-style:none; - float:left; - padding: 5px 6px; - text-transform:uppercase; -} -ul.subNavList li{ - list-style:none; - float:left; -} -.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { - color:#FFFFFF; - text-decoration:none; - text-transform:uppercase; -} -.topNav a:hover, .bottomNav a:hover { - text-decoration:none; - color:#bb7a2a; - text-transform:uppercase; -} -.navBarCell1Rev { - background-color:#F8981D; - color:#253441; - margin: auto 5px; -} -.skipNav { - position:absolute; - top:auto; - left:-9999px; - overflow:hidden; -} -/* -Page header and footer styles -*/ -.header, .footer { - clear:both; - margin:0 20px; - padding:5px 0 0 0; -} -.indexHeader { - margin:10px; - position:relative; -} -.indexHeader span{ - margin-right:15px; -} -.indexHeader h1 { - font-size:13px; -} -.title { - color:#2c4557; - margin:10px 0; -} -.subTitle { - margin:5px 0 0 0; -} -.header ul { - margin:0 0 15px 0; - padding:0; -} -.footer ul { - margin:20px 0 5px 0; -} -.header ul li, .footer ul li { - list-style:none; - font-size:13px; -} -/* -Heading styles -*/ -div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { - background-color:#dee3e9; - border:1px solid #d0d9e0; - margin:0 0 6px -8px; - padding:7px 5px; -} -ul.blockList ul.blockList ul.blockList li.blockList h3 { - background-color:#dee3e9; - border:1px solid #d0d9e0; - margin:0 0 6px -8px; - padding:7px 5px; -} -ul.blockList ul.blockList li.blockList h3 { - padding:0; - margin:15px 0; -} -ul.blockList li.blockList h2 { - padding:0px 0 20px 0; -} -/* -Page layout container styles -*/ -.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { - clear:both; - padding:10px 20px; - position:relative; -} -.indexContainer { - margin:10px; - position:relative; - font-size:12px; -} -.indexContainer h2 { - font-size:13px; - padding:0 0 3px 0; -} -.indexContainer ul { - margin:0; - padding:0; -} -.indexContainer ul li { - list-style:none; - padding-top:2px; -} -.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { - font-size:12px; - font-weight:bold; - margin:10px 0 0 0; - color:#4E4E4E; -} -.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { - margin:5px 0 10px 0px; - font-size:14px; - font-family:'DejaVu Sans Mono',monospace; -} -.serializedFormContainer dl.nameValue dt { - margin-left:1px; - font-size:1.1em; - display:inline; - font-weight:bold; -} -.serializedFormContainer dl.nameValue dd { - margin:0 0 0 1px; - font-size:1.1em; - display:inline; -} -/* -List styles -*/ -ul.horizontal li { - display:inline; - font-size:0.9em; -} -ul.inheritance { - margin:0; - padding:0; -} -ul.inheritance li { - display:inline; - list-style:none; -} -ul.inheritance li ul.inheritance { - margin-left:15px; - padding-left:15px; - padding-top:1px; -} -ul.blockList, ul.blockListLast { - margin:10px 0 10px 0; - padding:0; -} -ul.blockList li.blockList, ul.blockListLast li.blockList { - list-style:none; - margin-bottom:15px; - line-height:1.4; -} -ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { - padding:0px 20px 5px 10px; - border:1px solid #ededed; - background-color:#f8f8f8; -} -ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { - padding:0 0 5px 8px; - background-color:#ffffff; - border:none; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { - margin-left:0; - padding-left:0; - padding-bottom:15px; - border:none; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { - list-style:none; - border-bottom:none; - padding-bottom:0; -} -table tr td dl, table tr td dl dt, table tr td dl dd { - margin-top:0; - margin-bottom:1px; -} -/* -Table styles -*/ -.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { - width:100%; - border-left:1px solid #EEE; - border-right:1px solid #EEE; - border-bottom:1px solid #EEE; -} -.overviewSummary, .memberSummary { - padding:0px; -} -.overviewSummary caption, .memberSummary caption, .typeSummary caption, -.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { - position:relative; - text-align:left; - background-repeat:no-repeat; - color:#253441; - font-weight:bold; - clear:none; - overflow:hidden; - padding:0px; - padding-top:10px; - padding-left:1px; - margin:0px; - white-space:pre; -} -.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, -.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, -.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, -.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, -.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, -.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, -.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, -.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { - color:#FFFFFF; -} -.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, -.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - padding-bottom:7px; - display:inline-block; - float:left; - background-color:#F8981D; - border: none; - height:16px; -} -.memberSummary caption span.activeTableTab span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - margin-right:3px; - display:inline-block; - float:left; - background-color:#F8981D; - height:16px; -} -.memberSummary caption span.tableTab span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - margin-right:3px; - display:inline-block; - float:left; - background-color:#4D7A97; - height:16px; -} -.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { - padding-top:0px; - padding-left:0px; - padding-right:0px; - background-image:none; - float:none; - display:inline; -} -.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, -.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { - display:none; - width:5px; - position:relative; - float:left; - background-color:#F8981D; -} -.memberSummary .activeTableTab .tabEnd { - display:none; - width:5px; - margin-right:3px; - position:relative; - float:left; - background-color:#F8981D; -} -.memberSummary .tableTab .tabEnd { - display:none; - width:5px; - margin-right:3px; - position:relative; - background-color:#4D7A97; - float:left; - -} -.overviewSummary td, .memberSummary td, .typeSummary td, -.useSummary td, .constantsSummary td, .deprecatedSummary td { - text-align:left; - padding:0px 0px 12px 10px; - width:100%; -} -th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, -td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ - vertical-align:top; - padding-right:0px; - padding-top:8px; - padding-bottom:3px; -} -th.colFirst, th.colLast, th.colOne, .constantsSummary th { - background:#dee3e9; - text-align:left; - padding:8px 3px 3px 7px; -} -td.colFirst, th.colFirst { - white-space:nowrap; - font-size:13px; -} -td.colLast, th.colLast { - font-size:13px; -} -td.colOne, th.colOne { - font-size:13px; -} -.overviewSummary td.colFirst, .overviewSummary th.colFirst, -.overviewSummary td.colOne, .overviewSummary th.colOne, -.memberSummary td.colFirst, .memberSummary th.colFirst, -.memberSummary td.colOne, .memberSummary th.colOne, -.typeSummary td.colFirst{ - width:25%; - vertical-align:top; -} -td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { - font-weight:bold; -} -.tableSubHeadingColor { - background-color:#EEEEFF; -} -.altColor { - background-color:#FFFFFF; -} -.rowColor { - background-color:#EEEEEF; -} -/* -Content styles -*/ -.description pre { - margin-top:0; -} -.deprecatedContent { - margin:0; - padding:10px 0; -} -.docSummary { - padding:0; -} - -ul.blockList ul.blockList ul.blockList li.blockList h3 { - font-style:normal; -} - -div.block { - font-size:14px; - font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; -} - -td.colLast div { - padding-top:0px; -} - - -td.colLast a { - padding-bottom:3px; -} -/* -Formatting effect styles -*/ -.sourceLineNo { - color:green; - padding:0 30px 0 0; -} -h1.hidden { - visibility:hidden; - overflow:hidden; - font-size:10px; -} -.block { - display:block; - margin:3px 10px 2px 0px; - color:#474747; -} -.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, -.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, -.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { - font-weight:bold; -} -.deprecationComment, .emphasizedPhrase, .interfaceName { - font-style:italic; -} - -div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, -div.block div.block span.interfaceName { - font-style:normal; -} - -div.contentContainer ul.blockList li.blockList h2{ - padding-bottom:0px; -} diff --git a/build/jre/build.xml b/build/jre/build.xml index afbf0caced..c12776eff2 100644 --- a/build/jre/build.xml +++ b/build/jre/build.xml @@ -3,31 +3,45 @@ - - + + + + + + + + + + + + + - + - + - - + - + diff --git a/build/jre/src/Downloader.java b/build/jre/src/Downloader.java index 5c989684ec..0eab58acee 100644 --- a/build/jre/src/Downloader.java +++ b/build/jre/src/Downloader.java @@ -8,25 +8,28 @@ /** * Ant Task for downloading the latest JRE or JDK from Oracle. + * This was used to set a cookie properly to retrieve a JRE. + * Nowadays the older versions have been removed from Oracle's site, + * so this is hard wired it to use download.processing.org instead. */ public class Downloader extends Task { + static final boolean ORACLE_SUCKS = true; // that's final + static final String COOKIE = - "gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; " + "oraclelicense=accept-securebackup-cookie"; private int version; // Java 8 - private int update; // Update 31 - private int build; // Build 13 + private int update; // Update 131 + private int build; // Build 11 + // https://gist.github.com/P7h/9741922 + // http://stackoverflow.com/q/10268583 + private String hash; // d54c1d3a095b4ff2b6607d096fa80163 private boolean jdk; // false if JRE -// private String platform; // macosx, windows, linux -// private String bits; // i586 or x64 private String flavor; - + private String path; // target path -// private File baseDir; -// private boolean includeRecorder; public Downloader() { } @@ -47,119 +50,99 @@ public void setBuild(int build) { } + public void setHash(String hash) { + this.hash = hash; + } + + public void setJDK(boolean jdk) { this.jdk = jdk; } - - -// public void setPlatform(String platform) { -// this.platform = platform; -// } - - -// public void setBits(String bits) { -// this.bits = bits; -// } - + + public void setFlavor(String flavor) { this.flavor = flavor; } - - + + public void setPath(String path) { this.path = path; } public void execute() throws BuildException { - //if (baseDir == null) { - // throw new BuildException("dir parameter must be set!"); - //} - if (version == 0) { - throw new BuildException("version (i.e. 7 or 8) must be set"); + throw new BuildException("Version (i.e. 7 or 8) must be set"); } - + if (build == 0) { - throw new BuildException("build number must be set"); + throw new BuildException("Build number must be set"); } - + if (flavor == null) { - throw new BuildException("you've gotta choose a flavor (macosx-x64.dmg, windows-x64.exe..."); + throw new BuildException("You've gotta choose a flavor (macosx-x64.dmg, windows-x64.exe...)"); + } + + if (update >= 121 && hash == null) { + throw new BuildException("Starting with 8u121, a hash is required, see https://gist.github.com/P7h/9741922"); } -// if (bits == null) { -// throw new BuildException("bits must be set (x64 or i586)"); -// } - //download(path, jdk, platform, bits, version, update, build); try { download(); } catch (IOException e) { throw new BuildException(e); } - - /* - downloadJRE("linux-i586.tar.gz"); - downloadJRE("linux-x64.tar.gz"); - downloadJRE("windows-i586.tar.gz"); - downloadJRE("windows-x64.tar.gz"); - downloadJRE("windows-i586.exe"); - downloadJRE("windows-x64.exe"); - downloadJRE("macosx-x64.dmg"); - downloadJRE("macosx-x64.tar.gz"); - - downloadJDK("linux-i586.tar.gz"); - downloadJDK("linux-x64.tar.gz"); - downloadJDK("windows-i586.exe"); - downloadJDK("windows-x64.exe"); - downloadJDK("macosx-x64.dmg"); - */ } -// static void download(String path, //File folder, String filename, -// boolean jdk, String platform, String bits, -// int version, int update, int build) { void download() throws IOException { - //HttpURLConnection.setFollowRedirects(true); String filename = (jdk ? "jdk" : "jre") + (update == 0 ? String.format("-%d-%s", version, flavor) : String.format("-%du%d-%s", version, update, flavor)); - + if (path == null) { - path = filename; //System.getProperty("user.dir"); + path = filename; } - //String url = "http://download.oracle.com/otn-pub/java/jdk/" + - // https://edelivery.oracle.com/otn-pub/java/jdk/7u45-b18/jre-7u45-linux-i586.tar.gz - String url = "https://edelivery.oracle.com/otn-pub/java/jdk/" + - //String url = "https://download.oracle.com/otn-pub/java/jdk/" + + String url = "http://download.oracle.com/otn-pub/java/jdk/" + (update == 0 ? String.format("%d-b%02d/", version, build) : - String.format("%du%d-b%02d/", version, update, build)) + filename; -// System.out.println(url); + String.format("%du%d-b%02d/", version, update, build)); + + // URL format changed starting with 8u121 + if (update >= 121) { + url += hash + "/"; + } + + if (ORACLE_SUCKS) { + url = "https://download.processing.org/java/"; + } + + // Finally, add the filename to the end + url += filename; HttpURLConnection conn = - (HttpURLConnection) new URL(url).openConnection(); - //conn.setRequestProperty("Cookie", "name1=value1; name2=value2"); + (HttpURLConnection) new URL(url).openConnection(); conn.setRequestProperty("Cookie", COOKIE); - //conn.setRequestProperty("Cookie", "gpw_e24=http://www.oracle.com/"); //printHeaders(conn); //conn.connect(); - if (conn.getResponseCode() == 302) { + while (conn.getResponseCode() == 302 || conn.getResponseCode() == 301) { Map> headers = conn.getHeaderFields(); List location = headers.get("Location"); if (location.size() == 1) { url = location.get(0); + System.out.println("Redirecting to " + url); } else { throw new BuildException("Got " + location.size() + " locations."); } List cookies = headers.get("Set-Cookie"); conn = (HttpURLConnection) new URL(url).openConnection(); - for (String cookie : cookies) { - conn.setRequestProperty("Cookie", cookie); + if (cookies != null) { + for (String cookie : cookies) { + conn.setRequestProperty("Cookie", cookie); + } } conn.setRequestProperty("Cookie", COOKIE); conn.connect(); @@ -190,8 +173,8 @@ void download() throws IOException { } } if (!tempFile.renameTo(outputFile)) { - throw new BuildException(String.format("Could not rename %s to %s", - tempFile.getAbsolutePath(), + throw new BuildException(String.format("Could not rename %s to %s", + tempFile.getAbsolutePath(), outputFile.getAbsolutePath())); } } else { diff --git a/build/linux/.gitignore b/build/linux/.gitignore index 2cf458e239..fb7b3db738 100644 --- a/build/linux/.gitignore +++ b/build/linux/.gitignore @@ -1 +1,3 @@ -jre-*.tgz \ No newline at end of file +jre-*.tgz +/processing-*-*.deb +/processing-*-*.tgz diff --git a/build/linux/appdata.xml b/build/linux/appdata.xml new file mode 100644 index 0000000000..612d40d0e7 --- /dev/null +++ b/build/linux/appdata.xml @@ -0,0 +1,48 @@ + + + + org.processing.processingide.desktop + CC0-1.0 + GPL-2.0 + Processing Foundation + + Processing IDE + Open-source software prototyping platform + + +

+ Processing is the first easy-to-use software sketching platform + created by C. Reas and B. Fry and supported by the Processing + Foundation. +

+

+ Included is an integrated development environment that can be used + to develop interactive applications using different programming + languages but mainly Java, Android, Python, and Javascript. +

+
+ + + + https://upload.wikimedia.org/wikipedia/commons/6/6b/Processing_screen_shot.png + The Processing IDE showing a simple example program + + + + + + + + + + + + + http://www.processing.org/ + https://processing.org/reference/ + https://github.com/processing/processing/issues?q=is%3Aopen + https://github.com/processing/processing/tree/master/build/shared/lib/languages + https://processing.org/download/support.html + + foundation@processing.org +
diff --git a/build/linux/desktop.template b/build/linux/desktop.template new file mode 100644 index 0000000000..f8cf6d9624 --- /dev/null +++ b/build/linux/desktop.template @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Application +Name=Processing IDE +GenericName=Processing IDE +Comment=Open-source software prototyping platform +Exec= +Icon= +Terminal=false +Categories=Development;IDE;Programming; +MimeType=text/x-processing; +Keywords=sketching;software;animation;programming;coding; +StartupWMClass=processing-app-Base diff --git a/build/linux/install.sh b/build/linux/install.sh new file mode 100755 index 0000000000..bbe488f890 --- /dev/null +++ b/build/linux/install.sh @@ -0,0 +1,252 @@ +#!/bin/sh + +# This script adds a menu item, icons and mime type for Processing for +# the current user. If possible, it will use the xdg-utils - or fall back +# to just creating and copying a desktop file to the user's directory. +# If called with the "-u" option, it will uninstall. + +# Resource name to use (including vendor prefix) +RESOURCE_NAME=processing-pde + +# Get absolute path from which this script file was executed +# (Could be changed to "pwd -P" to resolve symlinks to their target) +SCRIPT_PATH=$( cd $(dirname $0) ; pwd ) +cd "${SCRIPT_PATH}" + +# Default mode is to install. +UNINSTALL=false + +# If possible, get location of the desktop folder. Default to ~/Desktop +XDG_DESKTOP_DIR="${HOME}/Desktop" +if [ -f "${XDG_CONFIG_HOME:-${HOME}/.config}/user-dirs.dirs" ]; then + . "${XDG_CONFIG_HOME:-${HOME}/.config}/user-dirs.dirs" +fi + +# Install using xdg-utils +xdg_install_f() { + + # Create a temp dir accessible by all users + TMP_DIR=`mktemp --directory` + + # Create *.desktop file using the existing template file + sed -e "s,,${SCRIPT_PATH}/processing,g" \ + -e "s,,${RESOURCE_NAME},g" "${SCRIPT_PATH}/lib/desktop.template" > "${TMP_DIR}/${RESOURCE_NAME}.desktop" + + # Install the icon files using name and resolutions + xdg-icon-resource install --context mimetypes --size 16 "${SCRIPT_PATH}/lib/icons/pde-16.png" $RESOURCE_NAME + xdg-icon-resource install --context mimetypes --size 32 "${SCRIPT_PATH}/lib/icons/pde-32.png" $RESOURCE_NAME + xdg-icon-resource install --context mimetypes --size 48 "${SCRIPT_PATH}/lib/icons/pde-48.png" $RESOURCE_NAME + xdg-icon-resource install --context mimetypes --size 64 "${SCRIPT_PATH}/lib/icons/pde-64.png" $RESOURCE_NAME + xdg-icon-resource install --context mimetypes --size 128 "${SCRIPT_PATH}/lib/icons/pde-128.png" $RESOURCE_NAME + xdg-icon-resource install --context mimetypes --size 256 "${SCRIPT_PATH}/lib/icons/pde-256.png" $RESOURCE_NAME + xdg-icon-resource install --context mimetypes --size 512 "${SCRIPT_PATH}/lib/icons/pde-512.png" $RESOURCE_NAME + xdg-icon-resource install --context mimetypes --size 1024 "${SCRIPT_PATH}/lib/icons/pde-1024.png" $RESOURCE_NAME + + # Install the created *.desktop file + xdg-desktop-menu install "${TMP_DIR}/${RESOURCE_NAME}.desktop" + + # Create icon on the desktop + xdg-desktop-icon install "${TMP_DIR}/${RESOURCE_NAME}.desktop" + + # Install Processing mime type + xdg-mime install "${SCRIPT_PATH}/lib/${RESOURCE_NAME}.xml" + + # Install icons for mime type + xdg-icon-resource install --context mimetypes --size 16 "${SCRIPT_PATH}/lib/icons/pde-16.png" text-x-processing + xdg-icon-resource install --context mimetypes --size 32 "${SCRIPT_PATH}/lib/icons/pde-32.png" text-x-processing + xdg-icon-resource install --context mimetypes --size 48 "${SCRIPT_PATH}/lib/icons/pde-48.png" text-x-processing + xdg-icon-resource install --context mimetypes --size 64 "${SCRIPT_PATH}/lib/icons/pde-64.png" text-x-processing + xdg-icon-resource install --context mimetypes --size 128 "${SCRIPT_PATH}/lib/icons/pde-128.png" text-x-processing + xdg-icon-resource install --context mimetypes --size 256 "${SCRIPT_PATH}/lib/icons/pde-256.png" text-x-processing + xdg-icon-resource install --context mimetypes --size 512 "${SCRIPT_PATH}/lib/icons/pde-512.png" text-x-processing + xdg-icon-resource install --context mimetypes --size 1024 "${SCRIPT_PATH}/lib/icons/pde-1024.png" text-x-processing + + # Make the Processing Development Environment the default app for *.pde files + xdg-mime default ${RESOURCE_NAME}.desktop text/x-processing + + # Clean up + rm "${TMP_DIR}/${RESOURCE_NAME}.desktop" + rmdir "$TMP_DIR" + +} + +# Install by simply copying desktop file (fallback) +simple_install_f() { + + # Create a temp dir accessible by all users + TMP_DIR=`mktemp --directory` + + # Create *.desktop file using the existing template file + sed -e "s,,${SCRIPT_PATH}/processing,g" \ + -e "s,,${SCRIPT_PATH}/lib/icons/pde-128.png,g" "${SCRIPT_PATH}/lib/desktop.template" > "${TMP_DIR}/${RESOURCE_NAME}.desktop" + + mkdir -p "${HOME}/.local/share/applications" + cp "${TMP_DIR}/${RESOURCE_NAME}.desktop" "${HOME}/.local/share/applications/" + + mkdir -p "${HOME}/.local/share/metainfo" + cp "${SCRIPT_PATH}/lib/appdata.xml" "${HOME}/.local/share/metainfo/${RESOURCE_NAME}.appdata.xml" + + # Copy desktop icon if desktop dir exists (was found) + if [ -d "${XDG_DESKTOP_DIR}" ]; then + cp "${TMP_DIR}/${RESOURCE_NAME}.desktop" "${XDG_DESKTOP_DIR}/" + # Altering file permissions to avoid "Untrusted Application Launcher" error on Ubuntu + chmod u+x "${XDG_DESKTOP_DIR}/${RESOURCE_NAME}.desktop" + fi + + # Clean up temp dir + rm "${TMP_DIR}/${RESOURCE_NAME}.desktop" + rmdir "${TMP_DIR}" + +} + +# Uninstall using xdg-utils +xdg_uninstall_f() { + + # Remove *.desktop file + xdg-desktop-menu uninstall ${RESOURCE_NAME}.desktop + + # Remove icon from desktop + xdg-desktop-icon uninstall ${RESOURCE_NAME}.desktop + + # Remove icons + xdg-icon-resource uninstall --size 16 $RESOURCE_NAME + xdg-icon-resource uninstall --size 32 $RESOURCE_NAME + xdg-icon-resource uninstall --size 48 $RESOURCE_NAME + xdg-icon-resource uninstall --size 64 $RESOURCE_NAME + xdg-icon-resource uninstall --size 128 $RESOURCE_NAME + xdg-icon-resource uninstall --size 256 $RESOURCE_NAME + xdg-icon-resource uninstall --size 512 $RESOURCE_NAME + xdg-icon-resource uninstall --size 1024 $RESOURCE_NAME + + # Remove MIME type icons + xdg-icon-resource uninstall --size 16 text-x-processing + xdg-icon-resource uninstall --size 32 text-x-processing + xdg-icon-resource uninstall --size 48 text-x-processing + xdg-icon-resource uninstall --size 64 text-x-processing + xdg-icon-resource uninstall --size 128 text-x-processing + xdg-icon-resource uninstall --size 256 text-x-processing + xdg-icon-resource uninstall --size 512 text-x-processing + xdg-icon-resource uninstall --size 1024 text-x-processing + + # Remove MIME type + xdg-mime uninstall "${SCRIPT_PATH}/lib/${RESOURCE_NAME}.xml" + +} + +# Uninstall by simply removing desktop files (fallback), incl. old one +simple_uninstall_f() { + + # delete legacy cruft .desktop file + if [ -f "${HOME}/.local/share/applications/processing.desktop" ]; then + rm "${HOME}/.local/share/applications/processing.desktop" + fi + + # delete another legacy .desktop file + if [ -f "${HOME}/.local/share/applications/processing-processingide.desktop" ]; then + rm "${HOME}/.local/share/applications/processing-processingide.desktop" + fi + + if [ -f "${HOME}/.local/share/applications/${RESOURCE_NAME}.desktop" ]; then + rm "${HOME}/.local/share/applications/${RESOURCE_NAME}.desktop" + fi + + if [ -f "${HOME}/.local/share/metainfo/${RESOURCE_NAME}.appdata.xml" ]; then + rm "${HOME}/.local/share/metainfo/${RESOURCE_NAME}.appdata.xml" + fi + + if [ -f "${XDG_DESKTOP_DIR}/processing.desktop" ]; then + rm "${XDG_DESKTOP_DIR}/processing.desktop" + fi + + if [ -f "${XDG_DESKTOP_DIR}/${RESOURCE_NAME}.desktop" ]; then + rm "${XDG_DESKTOP_DIR}/${RESOURCE_NAME}.desktop" + fi + +} + +# Update desktop file and mime databases (if possible) +updatedbs_f() { + + if [ -d "${HOME}/.local/share/applications" ]; then + if command -v update-desktop-database > /dev/null; then + update-desktop-database "${HOME}/.local/share/applications" + fi + fi + + if [ -d "${HOME}/.local/share/mime" ]; then + if command -v update-mime-database > /dev/null; then + update-mime-database "${HOME}/.local/share/mime" + fi + fi + +} + +# Check availability of xdg-utils +xdg_exists_f() { + + if ! command -v xdg-icon-resource > /dev/null; then return 1; fi + if ! command -v xdg-desktop-menu > /dev/null; then return 1; fi + if ! command -v xdg-desktop-icon > /dev/null; then return 1; fi + if ! command -v xdg-mime > /dev/null; then return 1; fi + return 0 + +} + +# Shows a description of the available options +display_help_f() { + printf "\nThis script will add a Processing desktop shortcut, menu item,\n" + printf "icons and file associations for the current user.\n" + if ! xdg_exists_f; then + printf "\nxdg-utils are recommended to be installed, so this script can use them.\n" + fi + printf "\nOptional arguments are:\n\n" + printf "\t-u, --uninstall\t\tRemoves shortcut, menu item and icons.\n\n" + printf "\t-h, --help\t\tShows this help again.\n\n" +} + +# Check for provided arguments +while [ $# -gt 0 ] ; do + ARG="${1}" + case $ARG in + -u|--uninstall) + UNINSTALL=true + shift + ;; + -h|--help) + display_help_f + exit 0 + ;; + *) + printf "\nInvalid option -- '${ARG}'\n" + display_help_f + exit 1 + ;; + esac +done + +# If possible, use xdg-utils, if not, use a more basic approach +if xdg_exists_f; then + if [ ${UNINSTALL} = true ]; then + printf "Removing desktop shortcut and menu item for Processing..." + xdg_uninstall_f + simple_uninstall_f + else + printf "Adding desktop shortcut, menu item and file associations for Processing..." + xdg_uninstall_f + simple_uninstall_f + xdg_install_f + fi +else + if [ ${UNINSTALL} = true ]; then + printf "Removing desktop shortcut and menu item for Processing..." + simple_uninstall_f + else + printf "Adding desktop shortcut and menu item for Processing..." + simple_uninstall_f + simple_install_f + fi +fi +updatedbs_f +printf " done!\n" + +exit 0 diff --git a/build/linux/processing b/build/linux/processing index 3d5d59a41b..078b2428b5 100755 --- a/build/linux/processing +++ b/build/linux/processing @@ -104,7 +104,7 @@ cmd_name='processing-java' if [ $current_name = $cmd_name ] then - java -Djna.nosys=true -Xmx256m processing.mode.java.Commander "$@" + java -Djna.nosys=true -Djava.ext.dirs="$APPDIR"/java/lib/ext -Xmx256m processing.mode.java.Commander "$@" exit $? else # Start Processing in the same directory as this script @@ -115,5 +115,5 @@ else fi cd "$APPDIR" - java -splash:lib/about.jpg -Djna.nosys=true -Xmx256m processing.app.Base "$SKETCH" & + java -splash:lib/about-1x.png -Djna.nosys=true -Djava.ext.dirs="$APPDIR"/java/lib/ext -Xmx256m processing.app.Base "$SKETCH" & fi diff --git a/build/linux/processing-pde.xml b/build/linux/processing-pde.xml new file mode 100644 index 0000000000..3b8a6837be --- /dev/null +++ b/build/linux/processing-pde.xml @@ -0,0 +1,42 @@ + + + + Processing source code + شفرة مصدر Processing + Kryničny kod Processing + Изходен код на Processing + codi font en Processing + Processingkildekode + Processing-Quelltext + πηγαίος κώδικας Processing + Processing source code + Processing-fontkodo + código fuente en Processing + Processing iturburu-kodea + Processing-lähdekoodi + code source Processing + cód foinseach Processing + Processing-forráskód + Kode program Processing + Codice sorgente Processing + Processing ソースコード + Processing pradinis kodas + Processing pirmkods + Kod sumber Processing + Processing-kildekode + Processing-broncode + Processing-kjeldekode + Kod źródłowy Processing + código fonte Processing + Código fonte Processing + исходный код Processing + Kod burues Processing + Processing-källkod + Вихідний код на мові Processing + Mã nguồn Processing + Processing 源代码 + Processing 源代碼 + + + + diff --git a/build/linux/processing.desktop b/build/linux/processing.desktop index 1e5bde573e..b7c0ef9b16 100644 --- a/build/linux/processing.desktop +++ b/build/linux/processing.desktop @@ -1,7 +1,7 @@ [Desktop Entry] Version=@version@ Name=Processing -Comment=graphics and animation language +Comment=Software sketchbook Exec=processing %F Icon=/opt/processing/lib/icons/pde-256.png Terminal=false diff --git a/build/linux/uninstall.sh b/build/linux/uninstall.sh new file mode 100644 index 0000000000..d92eeada48 --- /dev/null +++ b/build/linux/uninstall.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +SCRIPT_PATH=$( cd $(dirname $0) ; pwd ) +cd "$SCRIPT_PATH" + +./install.sh -u diff --git a/build/macosx/appbundler.jar b/build/macosx/appbundler.jar index 0102f306a9..42cc8f18cd 100644 Binary files a/build/macosx/appbundler.jar and b/build/macosx/appbundler.jar differ diff --git a/build/macosx/appbundler/.settings/org.eclipse.jdt.core.prefs b/build/macosx/appbundler/.settings/org.eclipse.jdt.core.prefs index 7341ab1683..3a21537071 100644 --- a/build/macosx/appbundler/.settings/org.eclipse.jdt.core.prefs +++ b/build/macosx/appbundler/.settings/org.eclipse.jdt.core.prefs @@ -1,11 +1,11 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.compliance=1.8 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.7 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/build/macosx/appbundler/build.xml b/build/macosx/appbundler/build.xml index 9b48b2bb5c..4d02204175 100644 --- a/build/macosx/appbundler/build.xml +++ b/build/macosx/appbundler/build.xml @@ -33,8 +33,8 @@ questions. version=1.0ea --> - - + + @@ -73,7 +73,8 @@ questions.
- + + @@ -87,10 +88,10 @@ questions. - - + + diff --git a/build/macosx/appbundler/src/com/oracle/appbundler/AppBundlerTask.java b/build/macosx/appbundler/src/com/oracle/appbundler/AppBundlerTask.java index 8009c78b25..df4c26bc73 100644 --- a/build/macosx/appbundler/src/com/oracle/appbundler/AppBundlerTask.java +++ b/build/macosx/appbundler/src/com/oracle/appbundler/AppBundlerTask.java @@ -458,6 +458,7 @@ private void copyResources(File resourcesDirectory) throws IOException { } finally { outputStream.close(); } + file.setLastModified(zipEntry.getTime()); } zipEntry = zipInputStream.getNextEntry(); } @@ -729,7 +730,9 @@ private static void delete(File file) throws IOException { private static void copy(URL location, File file) throws IOException { try (InputStream in = location.openStream()) { - Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING); + Files.copy(in, file.toPath(), + // can't do attributes when coming from URL + StandardCopyOption.REPLACE_EXISTING); } } @@ -740,13 +743,15 @@ private static void copy(File source, File destination) throws IOException { destination.getParentFile().mkdirs(); - Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING, LinkOption.NOFOLLOW_LINKS); + Files.copy(sourcePath, destinationPath, + StandardCopyOption.REPLACE_EXISTING, + StandardCopyOption.COPY_ATTRIBUTES, + LinkOption.NOFOLLOW_LINKS); if (Files.isDirectory(sourcePath, LinkOption.NOFOLLOW_LINKS)) { String[] files = source.list(); - for (int i = 0; i < files.length; i++) { - String file = files[i]; + for (String file : files) { copy(new File(source, file), new File(destination, file)); } } diff --git a/build/macosx/appbundler/src/com/oracle/appbundler/BundleDocument.java b/build/macosx/appbundler/src/com/oracle/appbundler/BundleDocument.java index 94fdde05ec..7e26d4391c 100644 --- a/build/macosx/appbundler/src/com/oracle/appbundler/BundleDocument.java +++ b/build/macosx/appbundler/src/com/oracle/appbundler/BundleDocument.java @@ -18,7 +18,7 @@ * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * + * */ package com.oracle.appbundler; @@ -32,90 +32,94 @@ * Represent a CFBundleDocument. */ public class BundleDocument { - private String name = "editor"; - private String role = ""; - private File icon = null; - private String[] extensions; - private boolean isPackage = false; - - static private String capitalizeFirst(String string) { - char[] stringArray = string.toCharArray(); - stringArray[0] = Character.toUpperCase(stringArray[0]); - return new String(stringArray); - } - - public void setExtensions(String extensionsList) { - if(extensionsList == null) { - throw new BuildException("Extensions can't be null"); - } - - extensions = extensionsList.split(","); - for (String extension : extensions) { - extension.trim().toLowerCase(); - } - } - - public void setIcon(File icon) { - this.icon = icon; - } - - public void setName(String name) { - this.name = name; - } + private String name = "editor"; + private String role = ""; + private File icon = null; + private String[] extensions; + private boolean isPackage = false; - public void setRole(String role) { - this.role = capitalizeFirst(role); - } - - public void setIsPackage(String isPackageString) { - if(isPackageString.trim().equalsIgnoreCase("true")) { - this.isPackage = true; - } else { - this.isPackage = false; - } - } - -// public String getIcon() { -// return icon; -// } - - public String getIconName() { - return icon.getName(); - } - - - public File getIconFile() { - return icon; - } - - public String getName() { - return name; - } - public String getRole() { - return role; - } - - public String[] getExtensions() { - return extensions; - } - - public boolean hasIcon() { - return icon != null; + static private String capitalizeFirst(String string) { + char[] stringArray = string.toCharArray(); + stringArray[0] = Character.toUpperCase(stringArray[0]); + return new String(stringArray); + } + + + public void setExtensions(String extensionsList) { + if (extensionsList == null) { + throw new BuildException("Extensions can't be null"); } - - public boolean isPackage() { - return isPackage; + + extensions = extensionsList.split(","); + for (int i = 0; i < extensions.length; i++) { + extensions[i] = extensions[i].trim().toLowerCase(); } + } + + + public void setIcon(File icon) { + this.icon = icon; + } + + + public void setName(String name) { + this.name = name; + } + + + public void setRole(String role) { + this.role = capitalizeFirst(role); + } + + + public void setIsPackage(String isPackageString) { + this.isPackage = isPackageString.trim().equalsIgnoreCase("true"); + } + + + public String getIconName() { + return icon.getName(); + } + + + public File getIconFile() { + return icon; + } + + + public String getName() { + return name; + } + + + public String getRole() { + return role; + } + + + public String[] getExtensions() { + return extensions; + } + + + public boolean hasIcon() { + return icon != null; + } + + + public boolean isPackage() { + return isPackage; + } + - @Override - public String toString() { - StringBuilder s = new StringBuilder(getName()); - s.append(" ").append(getRole()).append(" ").append(getIconName()). append(" "); - for(String extension : extensions) { - s.append(extension).append(" "); - } - - return s.toString(); + @Override + public String toString() { + StringBuilder s = new StringBuilder(getName()); + s.append(" ").append(getRole()).append(" ").append(getIconName()).append(" "); + for (String extension : extensions) { + s.append(extension).append(" "); } + return s.toString(); + } } diff --git a/build/macosx/language_gen.py b/build/macosx/language_gen.py index 463d28fd63..5b216ee4f8 100755 --- a/build/macosx/language_gen.py +++ b/build/macosx/language_gen.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import os, re diff --git a/build/shared/lib/about-1x.png b/build/shared/lib/about-1x.png new file mode 100644 index 0000000000..4224ee4e66 Binary files /dev/null and b/build/shared/lib/about-1x.png differ diff --git a/build/shared/lib/about-2x.jpg b/build/shared/lib/about-2x.jpg deleted file mode 100644 index f871848d0d..0000000000 Binary files a/build/shared/lib/about-2x.jpg and /dev/null differ diff --git a/build/shared/lib/about-2x.png b/build/shared/lib/about-2x.png new file mode 100644 index 0000000000..4da84d41c9 Binary files /dev/null and b/build/shared/lib/about-2x.png differ diff --git a/build/shared/lib/about.jpg b/build/shared/lib/about.jpg deleted file mode 100644 index e096708ce5..0000000000 Binary files a/build/shared/lib/about.jpg and /dev/null differ diff --git a/build/shared/lib/defaults.txt b/build/shared/lib/defaults.txt index 87abd7ebbf..97381d81c9 100644 --- a/build/shared/lib/defaults.txt +++ b/build/shared/lib/defaults.txt @@ -1,3 +1,4 @@ + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -73,8 +74,6 @@ recent.count = 10 # Default to the native (AWT) file selector where possible chooser.files.native = true -# native Linux file chooser is atrocious, use Swing instead -chooser.files.native.linux = false # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -101,6 +100,13 @@ editor.window.height.min = 500 editor.window.height.min.macosx = 450 # tested to be 515 on Windows XP, this leaves some room editor.window.height.min.windows = 530 +# tested with Raspberry Pi display +editor.window.height.min.linux = 480 + +# scaling for the interface (to handle Windows and Linux HiDPI displays) +editor.zoom = 100% +# automatically set based on system dpi (only helps on Windows) +editor.zoom.auto = true # font size for editor #editor.font = Monospaced,plain,12 @@ -156,6 +162,13 @@ editor.indent = true # Whether to check files to see if they've been modified externally editor.watcher = true +# Set true to enable debugging, since this is quirky on others' machines +editor.watcher.debug = false +# The window of time (in milliseconds) in which a change won't be counted +editor.watcher.window = 1500 + +# Format and search engine to use for online queries +search.format = https://google.com/search?q=%s # font choice and size for the console #console.font = Monospaced,plain,11 @@ -172,7 +185,8 @@ 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 +console.scrollback.lines = 500 +console.scrollback.chars = 40000 # Any additional Java options when running. # If you change this and can't run things, it's your own durn fault. @@ -293,9 +307,6 @@ 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. @@ -340,6 +351,8 @@ proxy.socks.port= # Example of usage (replace 'http' with 'https' or 'socks' as needed) #proxy.http.host=proxy.example.com #proxy.http.port=8080 +# Whether to use the system proxy by default +proxy.system=true # PDE X pdex.autoSave.autoSaveByDefault=true @@ -351,7 +364,11 @@ pdex.errorCheckEnabled=true pdex.warningsEnabled=true pdex.writeErrorLogs=false +# Set to false to disable ctrl/cmd-click jump to definition +pdex.inspectMode.hotkey=true # Enable auto-completion when hitting ctrl-space pdex.completion = false # Trigger happy version of completion that fires more often pdex.completion.trigger = false +# Suggest libraries to import when a class is undefined/unavailable +pdex.suggest.imports = true diff --git a/build/shared/lib/fonts/AnonymousPro-Bold.ttf b/build/shared/lib/fonts/AnonymousPro-Bold.ttf deleted file mode 100644 index 985bd4002d..0000000000 Binary files a/build/shared/lib/fonts/AnonymousPro-Bold.ttf and /dev/null differ diff --git a/build/shared/lib/fonts/AnonymousPro-Regular.ttf b/build/shared/lib/fonts/AnonymousPro-Regular.ttf deleted file mode 100644 index 06aafc0673..0000000000 Binary files a/build/shared/lib/fonts/AnonymousPro-Regular.ttf and /dev/null differ diff --git a/build/shared/lib/fonts/Carlito-Bold.ttf b/build/shared/lib/fonts/Carlito-Bold.ttf deleted file mode 100644 index b29a590511..0000000000 Binary files a/build/shared/lib/fonts/Carlito-Bold.ttf and /dev/null differ diff --git a/build/shared/lib/fonts/Carlito-LICENSE.txt b/build/shared/lib/fonts/Carlito-LICENSE.txt deleted file mode 100644 index e999b31837..0000000000 --- a/build/shared/lib/fonts/Carlito-LICENSE.txt +++ /dev/null @@ -1,95 +0,0 @@ -Copyright (c) 2010-2013 by tyPoland Lukasz Dziedzic with Reserved Font Name "Carlito". - -This Font Software is licensed under the SIL Open Font License, -Version 1.1 as shown below. - -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 - -PREAMBLE The goals of the Open Font License (OFL) are to stimulate -worldwide development of collaborative font projects, to support the font -creation efforts of academic and linguistic communities, and to provide -a free and open framework in which fonts may be shared and improved in -partnership with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. -The fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply to -any document created using the fonts or their derivatives. - - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. -This may include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software components -as distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting ? in part or in whole ? -any of the components of the Original Version, by changing formats or -by porting the Font Software to a new environment. - -"Author" refers to any designer, engineer, programmer, technical writer -or other person who contributed to the Font Software. - - -PERMISSION & CONDITIONS - -Permission is hereby granted, free of charge, to any person obtaining a -copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font -Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components,in - Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, - redistributed and/or sold with any software, provided that each copy - contains the above copyright notice and this license. These can be - included either as stand-alone text files, human-readable headers or - in the appropriate machine-readable metadata fields within text or - binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font - Name(s) unless explicit written permission is granted by the - corresponding Copyright Holder. This restriction only applies to the - primary font name as presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font - Software shall not be used to promote, endorse or advertise any - Modified Version, except to acknowledge the contribution(s) of the - Copyright Holder(s) and the Author(s) or with their explicit written - permission. - -5) The Font Software, modified or unmodified, in part or in whole, must - be distributed entirely under this license, and must not be distributed - under any other license. The requirement for fonts to remain under - this license does not apply to any document created using the Font - Software. - - - -TERMINATION -This license becomes null and void if any of the above conditions are not met. - - - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER -DEALINGS IN THE FONT SOFTWARE. - diff --git a/build/shared/lib/fonts/Carlito-Regular.ttf b/build/shared/lib/fonts/Carlito-Regular.ttf deleted file mode 100644 index 6b7e0e38e9..0000000000 Binary files a/build/shared/lib/fonts/Carlito-Regular.ttf and /dev/null differ diff --git a/build/shared/lib/fonts/AnonymousPro-LICENSE.txt b/build/shared/lib/fonts/ProcessingSansPro-LICENSE.txt similarity index 90% rename from build/shared/lib/fonts/AnonymousPro-LICENSE.txt rename to build/shared/lib/fonts/ProcessingSansPro-LICENSE.txt index 5ca1911b95..caaf349732 100644 --- a/build/shared/lib/fonts/AnonymousPro-LICENSE.txt +++ b/build/shared/lib/fonts/ProcessingSansPro-LICENSE.txt @@ -1,9 +1,13 @@ -Copyright (c) 2009, Mark Simonson (http://www.ms-studio.com, mark@marksimonson.com), -with Reserved Font Name Anonymous Pro. +"Processing Sans" fonts are just "Source Sans", but renamed to +prevent conflicts on Windows with other versions of Source Sans. +https://github.com/processing/processing/issues/4747 + + +Copyright 2010, 2012, 2014 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. This Font Software is licensed under the SIL Open Font License, Version 1.1. -This license is copied below, and is also available with a FAQ at: -http://scripts.sil.org/OFL + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL ----------------------------------------------------------- diff --git a/build/shared/lib/fonts/ProcessingSansPro-Regular.ttf b/build/shared/lib/fonts/ProcessingSansPro-Regular.ttf new file mode 100644 index 0000000000..c7862f39af Binary files /dev/null and b/build/shared/lib/fonts/ProcessingSansPro-Regular.ttf differ diff --git a/build/shared/lib/fonts/ProcessingSansPro-Semibold.ttf b/build/shared/lib/fonts/ProcessingSansPro-Semibold.ttf new file mode 100644 index 0000000000..10465b81a5 Binary files /dev/null and b/build/shared/lib/fonts/ProcessingSansPro-Semibold.ttf differ diff --git a/build/shared/lib/fonts/SourceCodePro-Bold.ttf b/build/shared/lib/fonts/SourceCodePro-Bold.ttf index a56f1fa5dd..e0c576f1b0 100644 Binary files a/build/shared/lib/fonts/SourceCodePro-Bold.ttf and b/build/shared/lib/fonts/SourceCodePro-Bold.ttf differ diff --git a/build/shared/lib/fonts/SourceCodePro-Regular.ttf b/build/shared/lib/fonts/SourceCodePro-Regular.ttf index b2cff928e4..437f47280b 100644 Binary files a/build/shared/lib/fonts/SourceCodePro-Regular.ttf and b/build/shared/lib/fonts/SourceCodePro-Regular.ttf differ diff --git a/build/shared/lib/fonts/SourceSansPro-Regular.ttf b/build/shared/lib/fonts/SourceSansPro-Regular.ttf deleted file mode 100644 index 24962c7c87..0000000000 Binary files a/build/shared/lib/fonts/SourceSansPro-Regular.ttf and /dev/null differ diff --git a/build/shared/lib/fonts/SourceSansPro-Semibold.ttf b/build/shared/lib/fonts/SourceSansPro-Semibold.ttf deleted file mode 100644 index 96be817427..0000000000 Binary files a/build/shared/lib/fonts/SourceSansPro-Semibold.ttf and /dev/null differ diff --git a/build/shared/lib/footer/console-enabled-1x.png b/build/shared/lib/footer/console-enabled-1x.png index c545378923..aafc8499ff 100644 Binary files a/build/shared/lib/footer/console-enabled-1x.png and b/build/shared/lib/footer/console-enabled-1x.png differ diff --git a/build/shared/lib/footer/console-enabled-2x.png b/build/shared/lib/footer/console-enabled-2x.png index 6d78d1d16b..d89d1d3efc 100644 Binary files a/build/shared/lib/footer/console-enabled-2x.png and b/build/shared/lib/footer/console-enabled-2x.png differ diff --git a/build/shared/lib/footer/console-selected-1x.png b/build/shared/lib/footer/console-selected-1x.png index ad94bc6caf..c0733d356d 100644 Binary files a/build/shared/lib/footer/console-selected-1x.png and b/build/shared/lib/footer/console-selected-1x.png differ diff --git a/build/shared/lib/footer/console-selected-2x.png b/build/shared/lib/footer/console-selected-2x.png index a297d5e1a9..969b4cf653 100644 Binary files a/build/shared/lib/footer/console-selected-2x.png and b/build/shared/lib/footer/console-selected-2x.png differ diff --git a/build/shared/lib/footer/error-enabled-1x.png b/build/shared/lib/footer/error-enabled-1x.png index 60fee5cc3e..22836efefb 100644 Binary files a/build/shared/lib/footer/error-enabled-1x.png and b/build/shared/lib/footer/error-enabled-1x.png differ diff --git a/build/shared/lib/footer/error-enabled-2x.png b/build/shared/lib/footer/error-enabled-2x.png index 21d173fe02..36fd6ce7c3 100644 Binary files a/build/shared/lib/footer/error-enabled-2x.png and b/build/shared/lib/footer/error-enabled-2x.png differ diff --git a/build/shared/lib/footer/error-selected-1x.png b/build/shared/lib/footer/error-selected-1x.png index 529577c3f8..6ffe814679 100644 Binary files a/build/shared/lib/footer/error-selected-1x.png and b/build/shared/lib/footer/error-selected-1x.png differ diff --git a/build/shared/lib/footer/error-selected-2x.png b/build/shared/lib/footer/error-selected-2x.png index bf9d2e5b62..637519fd79 100644 Binary files a/build/shared/lib/footer/error-selected-2x.png and b/build/shared/lib/footer/error-selected-2x.png differ diff --git a/build/shared/lib/icons/foundation-16.png b/build/shared/lib/icons/foundation-16.png new file mode 100644 index 0000000000..d2f1ee2d2a Binary files /dev/null and b/build/shared/lib/icons/foundation-16.png differ diff --git a/build/shared/lib/icons/foundation-32.png b/build/shared/lib/icons/foundation-32.png new file mode 100644 index 0000000000..2f874f6e6f Binary files /dev/null and b/build/shared/lib/icons/foundation-32.png differ diff --git a/build/shared/lib/icons/foundation-64.png b/build/shared/lib/icons/foundation-64.png new file mode 100644 index 0000000000..b3f094e4d6 Binary files /dev/null and b/build/shared/lib/icons/foundation-64.png differ diff --git a/build/shared/lib/languages/PDE.properties b/build/shared/lib/languages/PDE.properties index 1412923046..0f312730fd 100644 --- a/build/shared/lib/languages/PDE.properties +++ b/build/shared/lib/languages/PDE.properties @@ -31,6 +31,9 @@ menu.file.quit = Quit menu.edit = Edit menu.edit.undo = Undo menu.edit.redo = Redo +menu.edit.redo.keystroke.macosx = shift meta pressed Z +menu.edit.redo.keystroke.windows = ctrl pressed Y +menu.edit.redo.keystroke.linux = shift ctrl pressed Z menu.edit.action.addition = addition menu.edit.action.deletion = deletion menu.edit.cut = Cut @@ -40,8 +43,17 @@ menu.edit.paste = Paste menu.edit.select_all = Select All menu.edit.auto_format = Auto Format menu.edit.comment_uncomment = Comment/Uncomment -menu.edit.increase_indent = Increase Indent -menu.edit.decrease_indent = Decrease Indent +menu.edit.comment_uncomment.keystroke.macosx = meta pressed SLASH +menu.edit.comment_uncomment.keystroke.windows = ctrl pressed SLASH +menu.edit.comment_uncomment.keystroke.linux = ctrl pressed SLASH +menu.edit.increase_indent = → Increase Indent +menu.edit.increase_indent.keystroke.macosx = meta pressed CLOSE_BRACKET +menu.edit.increase_indent.keystroke.windows = ctrl pressed CLOSE_BRACKET +menu.edit.increase_indent.keystroke.linux = ctrl pressed CLOSE_BRACKET +menu.edit.decrease_indent = ← Decrease Indent +menu.edit.decrease_indent.keystroke.macosx = meta pressed OPEN_BRACKET +menu.edit.decrease_indent.keystroke.windows = ctrl pressed OPEN_BRACKET +menu.edit.decrease_indent.keystroke.linux = ctrl pressed OPEN_BRACKET menu.edit.find = Find... menu.edit.find_next = Find Next menu.edit.find_previous = Find Previous @@ -77,8 +89,17 @@ menu.debug.toggle_breakpoint = Toggle Breakpoint # --- # used for both menus and toolbars menu.debug.step = Step +menu.debug.step.keystroke.macosx = meta pressed J +menu.debug.step.keystroke.windows = ctrl pressed J +menu.debug.step.keystroke.linux = ctrl pressed J menu.debug.step_into = Step Into +menu.debug.step_into.keystroke.macosx = shift meta pressed J +menu.debug.step_into.keystroke.windows = shift ctrl pressed J +menu.debug.step_into.keystroke.linux = shift ctrl pressed J menu.debug.step_out = Step Out +menu.debug.step_out.keystroke.macosx = meta alt pressed J +menu.debug.step_out.keystroke.windows = ctrl alt pressed J +menu.debug.step_out.keystroke.linux = ctrl alt pressed J menu.debug.continue = Continue # --- #menu.debug.print_stack_trace = Print Stack Trace @@ -106,6 +127,7 @@ menu.tools.add_tool = Add Tool... # | File | Edit | Sketch | Debug | Tools | Help | # | Help | menu.help = Help +menu.help.welcome = Welcome to Processing 3 menu.help.about = About Processing menu.help.environment = Environment menu.help.reference = Reference @@ -115,15 +137,15 @@ menu.help.tools_reference = Tools Reference menu.help.empty = (empty) menu.help.online = Online menu.help.getting_started = Getting Started -menu.help.getting_started.url = http://processing.org/learning/gettingstarted/ +menu.help.getting_started.url = https://processing.org/tutorials/gettingstarted/ menu.help.troubleshooting = Troubleshooting -menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting +menu.help.troubleshooting.url = https://github.com/processing/processing/wiki/troubleshooting menu.help.faq = Frequently Asked Questions -menu.help.faq.url = http://wiki.processing.org/w/FAQ +menu.help.faq.url = https://github.com/processing/processing/wiki/FAQ menu.help.foundation = The Processing Foundation -menu.help.foundation.url = http://processing.org/foundation/ +menu.help.foundation.url = https://processing.foundation/ menu.help.visit = Visit Processing.org -menu.help.visit.url = http://processing.org/ +menu.help.visit.url = https://processing.org/ # --------------------------------------- @@ -165,6 +187,8 @@ preferences.editor_and_console_font = Editor and Console font preferences.editor_and_console_font.tip = Select the font used in the Editor and the Console.
Only monospaced (fixed-width) fonts may be used,
though the list may be imperfect. preferences.editor_font_size = Editor font size preferences.console_font_size = Console font size +preferences.zoom = Interface scale +preferences.zoom.auto = Automatic preferences.background_color = Background color when Presenting preferences.background_color.tip = Select the background color used when using Present.
Present is used to present a sketch in full-screen,
accessible from the Sketch menu. preferences.use_smooth_text = Use smooth text in editor window @@ -306,10 +330,21 @@ editor.header.new_tab = New Tab editor.header.rename = Rename editor.header.delete = Delete editor.header.previous_tab = Previous Tab +editor.header.previous_tab.keystroke.macosx = meta alt pressed LEFT +editor.header.previous_tab.keystroke.windows = ctrl pressed PAGE_UP +editor.header.previous_tab.keystroke.linux = ctrl pressed PAGE_UP editor.header.next_tab = Next Tab +editor.header.next_tab.keystroke.macosx = meta alt pressed RIGHT +editor.header.next_tab.keystroke.windows = ctrl pressed PAGE_DOWN +editor.header.next_tab.keystroke.linux = ctrl pressed PAGE_DOWN editor.header.delete.warning.title = Yeah, no. editor.header.delete.warning.text = You cannot delete the main tab of the only open sketch. +# PopUp menu +editor.popup.jump_to_declaration = Jump to Declaration +editor.popup.show_usage = Show Usage... +editor.popup.rename = Rename... + # Tabs editor.tab.new = New Name editor.tab.new.description = Name for new file @@ -336,7 +371,7 @@ editor.status.printing.canceled = Printing canceled. editor.status.copy_as_html = Code formatted as HTML has been copied to the clipboard. editor.status.debug.busy = Debugger busy... editor.status.debug.halt = Debugger halted. -editor.status.archiver.create = Created archive "%s". +editor.status.archiver.create = Created archive "%s". editor.status.archiver.cancel = Archive sketch canceled. # Errors @@ -352,6 +387,7 @@ editor.status.missing.right_paren = Missing right parenthesis ")" editor.status.missing.left_curly_bracket = Missing left curly bracket "{" editor.status.missing.right_curly_bracket = Missing right curly bracket "}" editor.status.missing.add = Consider adding "%s" +editor.status.bad_curly_quote = Curly quotes like %s don't work. Use straight quotes. Ctrl-T to autocorrect. editor.status.reserved_words = "color" and "int" are reserved words & cannot be used as variable names editor.status.undefined_method = The function "%s(%s)" does not exist editor.status.undefined_constructor = The constructor "%s(%s)" does not exist @@ -361,10 +397,12 @@ editor.status.undef_global_var = The global variable "%s" does not exist editor.status.undef_class = The class "%s" does not exist editor.status.undef_var = The variable "%s" does not exist editor.status.undef_name = The name "%s" cannot be recognized +editor.status.unterm_string_curly = String literal is not closed by a straight double quote. Curly quotes like %s won't help. editor.status.type_mismatch = Type mismatch, "%s" does not match with "%s" editor.status.unused_variable = The value of the local variable "%s" is not used editor.status.uninitialized_variable = The local variable "%s" may not have been initialized editor.status.no_effect_assignment = The assignment to variable "%s" has no effect +editor.status.hiding_enclosing_type = The class "%s" cannot have the same name as your sketch or its enclosing class # Footer buttons editor.footer.errors = Errors @@ -439,6 +477,18 @@ ensure_exist.messages.unrecoverable.description = Could not properly re-save the # Check name check_name.messages.is_name_modified = The sketch name had to be modified. Sketch names can only consist\nof ASCII characters and numbers (but cannot start with a number).\nThey should also be less than 64 characters long. +# External changes detector +change_detect.reload.title=Tab modified externally +change_detect.reload.question="%s" was modified by another program. +change_detect.reload.comment=Would you like to keep this version or load the new changes?\nEither way, the version you discard will be saved to your sketch folder. +change_detect.button.keep=Keep +change_detect.button.load_new=Load changes +change_detect.delete.title=Tab deleted externally +change_detect.delete.question="%s" has disappeared from the sketch folder. +change_detect.delete.comment=Would you like to re-save it or remove it from your sketch? +change_detect.button.discard=Remove permanently +change_detect.button.resave=Re-save + # --------------------------------------- # Contributions @@ -523,6 +573,8 @@ contrib.import.errors.link = Error: The library %s has a strange looking downloa warn.delete = Delete warn.delete.sketch = Are you sure you want to delete this sketch? warn.delete.file = Are you sure you want to delete "%s"? +warn.cannot_change_mode.title = Cannot change mode +warn.cannot_change_mode.body = Cannot change mode,\nbecause "%s" mode is not compatible with current mode. # --------------------------------------- diff --git a/build/shared/lib/languages/PDE_ar.properties b/build/shared/lib/languages/PDE_ar.properties new file mode 100644 index 0000000000..008f027517 --- /dev/null +++ b/build/shared/lib/languages/PDE_ar.properties @@ -0,0 +1,590 @@ + + +# --------------------------------------- +# Language: Arabic (ar) | العربية +# --------------------------------------- + + +# --------------------------------------- +# Menu + +# | File | Edit | Sketch | Debug | Tools | Help | +# | File | +menu.file = ملف +menu.file.new = جديد +menu.file.open = افتح... +menu.file.recent = فتح من الملفات الأخيرة +menu.file.sketchbook = دفتر المخطوطات... +menu.file.sketchbook.empty = دفتر مخطوطات فارغ +menu.file.examples = أمثلة... +menu.file.close = إغلاق +menu.file.save = حفظ +menu.file.save_as = حفظ ك... +menu.file.export_application = تصدير التطبيق... +menu.file.page_setup = إعدادات الصفحة +menu.file.print = طباعة +menu.file.preferences = إعدادات... +menu.file.quit = خروج + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Edit | +menu.edit = تعديل +menu.edit.undo = تراجع +menu.edit.redo = إعادة +menu.edit.action.addition = إضافة +menu.edit.action.deletion = حذف +menu.edit.cut = قص +menu.edit.copy = نسخ +menu.edit.copy_as_html = نسخ ك HTML +menu.edit.paste = لصق +menu.edit.select_all = تحديد الكل +menu.edit.auto_format = فرمتة تلقائية +menu.edit.comment_uncomment = تعليق/إلغاء التعليق +menu.edit.increase_indent = زيادة المسافة البادئة → +menu.edit.decrease_indent = انقاص المسافة البادئة ← +menu.edit.find = بحث... +menu.edit.find_next = النتيجة التالية +menu.edit.find_previous = النتيجة السابقة +menu.edit.use_selection_for_find = ابحث عن المحدد + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Sketch | +menu.sketch.run = تشغيل +menu.sketch.present = تقديم +menu.sketch.tweak = تعديل +menu.sketch.stop = إيقاف +# --- +menu.library = استيراد مكتبة... +menu.library.add_library = إضافة مكتبة... +menu.library.contributed = مساهمات +menu.library.no_core_libraries = لا يوجد مكتبات أساسية لهذا الوضع +# --- +menu.sketch = المخطوط +menu.sketch.show_sketch_folder = إظهار ملف المخطوطات +menu.sketch.add_file = إضافة ملف.. + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Debug | +menu.debug = تنقيح +menu.debug.enable = تفعيل أداة التنقيح +menu.debug.disable = تعطيل أداة التنقيح +#menu.debug.show_debug_toolbar = إظهار شريط أدواة التنقيح +#menu.debug.debug = تنقيح +#menu.debug.stop = توقف +# --- +menu.debug.toggle_breakpoint = تبديل حالة نقطة الوقوف +#menu.debug.list_breakpoints = قائمة نقاط الوقوف +# --- +# used for both menus and toolbars +menu.debug.step = تقدم +menu.debug.step_into = تقدم إلى الأمام +menu.debug.step_out = تقدم إلى الخلف +menu.debug.continue = استمر +# --- +#menu.debug.print_stack_trace = طباعة أثر المكدس +#menu.debug.print_locals = طباعة المتغيرات المحلية +#menu.debug.print_fields = طباعة الحقول +#menu.debug.print_source_location = طباعة مكان المصدر +#menu.debug.print_threads = طباعة شرط التعليمات +# --- +#menu.debug.variable_inspector = مظهر المتغيرات +menu.debug.show_variables = إظهار المتغيرات +menu.debug.hide_variables = إخفاء المتغيرات +#menu.debug.show_sketch_outline = إظهار موجز المخطوط +#menu.debug.show_tabs_list = إظهار قائمة علامات التبويب + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Tools | +menu.tools = أدوات +menu.tools.color_selector = أداة اختيار الألوان... +menu.tools.create_font = أداة صناعة الخطوط +menu.tools.archive_sketch = أرشفة المخطوط +menu.tools.fix_the_serial_lbrary = إصلاح مكتبة الاتصالات التسلسلية +menu.tools.install_processing_java = تثبيت"processing-java" +menu.tools.add_tool = أضف أداة + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Help | +menu.help = مساعدة +menu.help.welcome = مرحباً بكم في Processing 3 +menu.help.about = عن Processing +menu.help.environment = البيئة +menu.help.reference = مراجع +menu.help.find_in_reference = إبحث في مرجع +menu.help.libraries_reference = مرجع المكتبات +menu.help.tools_reference = مرجع الأدوات +menu.help.empty = (فارغ) +menu.help.online = متصل +menu.help.getting_started = البدء +menu.help.getting_started.url = http://processing.org/learning/gettingstarted/ +menu.help.troubleshooting = اكتشاف الأخطاء وإصلاحها +menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting +menu.help.faq = الأسئلة الشائعة +menu.help.faq.url = http://wiki.processing.org/w/FAQ +menu.help.foundation = Processing مؤسسة +menu.help.foundation.url = http://processing.org/foundation/ +menu.help.visit = Processing.org زيارة +menu.help.visit.url = http://processing.org/ + + +# --------------------------------------- +# Basics + +# Buttons +prompt.yes = نعم +prompt.no = لا +prompt.cancel = إلغاء +prompt.ok = موافق +prompt.browse = تصفح +prompt.export = تصدير + + +# --------------------------------------- +# Frames + +# Open (Frame) +open = فتح مخطوط بروسسنج... + +# Save (Frame) +save = حفظ ملف المخطوطات ك... +save.title = هل تريد حفظ التغييرات على %s
قبل الإغلاق؟ +save.hint = في حال عدم الحفظ, ستفقد كل التغييرات على الملف +save.btn.save = حفظ +save.btn.dont_save = عدم الحفظ + +# Close (Frame) also used to prompt on non-OS X machines +close.unsaved_changes = ؟%s هل تريد حفظ التغييرات على + +# Preferences (Frame) +preferences = الإعدادات +preferences.button.width = 80 +preferences.requires_restart = تلزم إعادة تشغيل Processing +preferences.sketchbook_location = موقع دفتر المخطوطات +preferences.sketchbook_location.popup = موقع دفتر المخطوطات +preferences.language = اللغة +preferences.editor_and_console_font = خط المحرر ووحدة الأوامر +preferences.editor_and_console_font.tip = .اختر خطاً لاستخدامه في المحرر ووحدة الأوامر.
يمكن استخدام الخطوط ذات الفراغات الموحدة فقط +preferences.editor_font_size = حجم خط المحرر +preferences.console_font_size = حجم خط وحدة الأوامر +preferences.zoom = حجم الواجهة +preferences.zoom.auto = تلقائي +preferences.background_color = لون الخلفية خلال وضعية التقديم +preferences.background_color.tip = اختر لون خلفية لاستخدامها في وضعية التقديم.
وضعية التقديم تقوم بعرض المخطوطة على ملء الشاشة.
يمكن تشغيل وضعية التقديم من نافذة المخطوط. +preferences.use_smooth_text = استخدام خط سلس في نافذة المحرر +preferences.enable_complex_text_input = تفعيل وضعية الإدخال المعقدة +preferences.enable_complex_text_input_example = يقصد هنا اللغة اليابانية +preferences.continuously_check = تحقق من الأخطاء بشكل دائم +preferences.show_warnings = أظهر التحذيرات +preferences.code_completion = إكمال شفرة المصدر باستخدام +preferences.trigger_with = تفعيل باستخدام +preferences.cmd_space = فراغ +preferences.suggest_imports = اقتراح أوامر استيراد المكتبات +preferences.increase_max_memory = زيادة الذاكرة المتاحة إلى +preferences.delete_previous_folder_on_export = حذف الملف السابق بعد التصدير +preferences.check_for_updates_on_startup = السماح بالبحث التلقائي عن التحديثات (راجع الأسئلة الشائعة لتفاصيل عن المعلومات المشاركة) +preferences.run_sketches_on_display = تشغيل المخطوط على الشاشة. +preferences.run_sketches_on_display.tip = لتحديد الشاشة التي ستستخدم لعرض المخطوط.
كالعادة, إذا تم تحريك النافذة, سيعاد فتحها في المرة القادمة
في نفس هذا المكان. لكن في حال تشغيل المخطوط في وضعية
العرض (الشاشة الملئة), سيتم استخدام هذه الشاشة المحددة للعرض. +preferences.automatically_associate_pde_files = تلقائياً مع بروسسنج .pde ربط الملفات بلاحقة +preferences.launch_programs_in = بدء البرنامج في +preferences.launch_programs_in.mode = الوضع +preferences.file = يمكن تعديل المزيد من الإعدادات في الملف +preferences.file.hint = قم بالتعديل عندما يكون Processing غير مفعل + +# Sketchbook Location (Frame) +sketchbook_location = اختر مكان جديد لكتاب المخطوطات + +# Sketchbook (Frame) +sketchbook = كتاب مخطوطات +sketchbook.tree = كتاب مخطوطات + +# Examples (Frame) +examples.title = أمثلة %s +examples.add_examples = أضف أمثلة... +examples.libraries = المكتبات المشاركة +examples.core_libraries = المكتبات +examples.contributed = الأمثلة المشاركة + +# Export (Frame) +export = خيارات التصدير +export.platforms = المنصات +export.options = الخيارات +export.options.present = وضعية التقديم +export.options.show_stop_button = إظهار زر التوقف +export.description.line1 = خيار "التصدير إلى تطبيق" ينتج برامج قابلة للتنفيذ, +export.description.line2 = برنامج منفصل لمنصات محددة. +export.unsaved_changes = حفظ التغييرات قبل التصدير؟ +export.notice.cancel.unsaved_changes = تم إلغاء التصدير. يجب حفظ التغييرات أولاً. +export.notice.exporting = يتم تصدير التطبيق +export.notice.exporting.done = تم التصدير. +export.notice.exporting.error = حصل خطأ خلال التصدير. +export.notice.exporting.cancel = تم إلغاء عملية التصدير. +export.tooltip.macosx = Mac OS X متاح فقط على Mac OS X التصدير ل +export.full_screen = ملء الشاشة +export.embed_java = تضمين جافا +export.embed_java.for = تضمين جافا ل +export.code_signing = توقيع الشفرة المصدرية +export.messages.is_read_only = هذا المخطوط للقراءة فقط +export.messages.is_read_only.description = بعض الملفات محددة ك "للقراءة فقط", \nستحتاج لإعادة حفظ المخطوطات في مكان آخر, \nوالمحاولة لاحقاً. +export.messages.cannot_export = لا يمكن التصدير +export.messages.cannot_export.description = لا يمكنك تصدير مخطوط لم يحفظ بعد. + +# Find (Frame) +find = البحث +find.find = ابحث عن: +find.replace_with = استبدل ب: +find.ignore_case = تجاهل الحالة (لا يلزم للغة العربية) +find.all_tabs = جميع علامات التبويب +find.wrap_around = طي النص حول +find.btn.replace_all = استبدال الكل +find.btn.replace = استبدال +find.btn.replace_and_find = استبدال وبحث +find.btn.previous = سابق +find.btn.find = ابحث + +# Find in reference (Frame) +find_in_reference = البحث في المرجع + +# File (Frame) +file = اختر صورة أو ملفات بيانات أخرى ليتم نسخها إلى مخطوطتك + +# Create Font (Frame) +create_font = اصنع خط جديد +create_font.label = استخدم هذه الأداة لتوليد خطوط لبرنامحك. \nاختر الخط والحجم المطلوب, وانقر على موافق لتوليد الخط. \nستتم إضافة الخط إلى ملف البيانات الخاص بالمخطوط الحالي. +create_font.size = الحجم +create_font.smooth = سلس +create_font.characters = الأحرف... +create_font.character_selector = أداة اختيار الأحرف +create_font.character_selector.label = الرموز الافتراضية ستتضمن أغلب الأشكال اللاتينية اللازمة لنظم تشغيل وينودوز وماك. \nتضمين جميع الرموز سيتطلب مساحة ذاكرة أكبر. \nلمزيد من التحكم, يمكنك اختيار أقسام معينة من تشفير يونيكود. +create_font.default_characters = الأحرف الافتراضية +create_font.all_characters = كل الأحرف +create_font.specific_unicode = مجموعات يونيكود محددة +create_font.filename = اسم الملف + +# Color Selector (Frame) +color_selector = أداة اختيار الألوان + +# Archive Sketch (Frame) +archive_sketch = أرشف المخطوط بإسم... + +# Tweak Mode +tweak_mode = وضع التعديل +tweak_mode.save_before_tweak = يرجى حفظ التغييرات قبل تفعيل وضع التعديل. +tweak_mode.keep_changes.line1 = هل تريد اللإبقاء على التغييرات؟ +tweak_mode.keep_changes.line2 = لقد تم تغيير بعض القيم في مخطوطتك. هل تريد حفظ التغييرات؟ + +# DebugTray +debugger.name = الإسم +debugger.value = القيمة +debugger.type = النوع + +# --------------------------------------- +# Toolbars + +# [Run/Present] [Stop] [New] [Open] [Save] +toolbar.run = تشغيل +toolbar.present = عرض +toolbar.stop = توقف +toolbar.debug = تنقيح +# --- +toolbar.new = جديد +toolbar.open = فتح +toolbar.save = حفظ +# toolbar.export_application = تصدير التطبيق +toolbar.add_mode = إضافة وضع جديد... + +# [Debug] [Continue] [Step] [Stop] [Toggle Breakpoints] [Variable Inspector] +#toolbar.debug.continue = الاستمرار +#toolbar.debug.step = خطوة +#toolbar.debug.step_into = تقدم نحو +#toolbar.debug.stop = توقف +#toolbar.debug.toggle_breakpoints = تبديل حالة نقطة التوقف +#toolbar.debug.variable_inspector = مظهر المتغيرات + + +# --------------------------------------- +# Editor + +# [Tab1] [Tab2] [v] +editor.header.new_tab = علامة تبويب حديدة +editor.header.rename = إعادة تسمية +editor.header.delete = حذف +editor.header.previous_tab = علامة التبويب السابقة +editor.header.next_tab = علامة التبويب اللاحقة +editor.header.delete.warning.title = هممم, لا. +editor.header.delete.warning.text = لا يمكنك حذف علامة التبويت الخاصة بالمخطوط الوحيد المفتوح. + +# PopUp menu +editor.popup.jump_to_declaration = القفز إلى التعريف. +editor.popup.show_usage = أظهر الاستخدام +editor.popup.rename = إعادة تسمية + +# Tabs +editor.tab.new = إسم جديد +editor.tab.new.description = إسم الملف الجديد +editor.tab.rename = إسم جديد +editor.tab.rename.description = إسم الملف الجديد + +# Sketch +editor.sketch.rename.description = إسم المخطوط الجديد + +editor.status.autoformat.no_changes = لم تلزم أية تغييرات من الفرمتة التلقائية +editor.status.autoformat.finished = إنتهت الفرمتة التلقائية. +editor.status.find_reference.select_word_first = اختر كلمة ليتم البحث عنها. +editor.status.find_reference.not_available = تعذر العثور على "%s" في المراجع. +editor.status.drag_and_drop.files_added.0 = لم تتم إضافة أية مخطوطات إلى الملف. +editor.status.drag_and_drop.files_added.1 = تم إضافة ملف واحد إلى المخطوط +editor.status.drag_and_drop.files_added.n = تم إضافة %d ملف إلى المخطوط. +editor.status.saving = يتم الحفظ... +editor.status.saving.done = تم الحفظ... +editor.status.saving.canceled = تم إلغاء الحفظ. +editor.status.printing = تتم الطباعة... +editor.status.printing.done = تمت الطباعة. +editor.status.printing.error = حدث خطأ خلال الطباعة. +editor.status.printing.canceled = تم إلغاء الطباعة. +editor.status.copy_as_html = تم نسخ شفرة مصدرية بتشفير HTML إلى لوح المقصوصات. +editor.status.debug.busy = أداة التنقيح مشغولة. +editor.status.debug.halt = أداة التنقيح متوقفة. +editor.status.archiver.create = ."%s" تم إنشاء الأرشيف +editor.status.archiver.cancel = تم إلغاء أرشفة المخطوط. + +# Errors +editor.status.warning = تحذير +editor.status.error = خطأ +editor.status.error_on = "%s" خطأ في +editor.status.missing.default = "%c" ينقص +editor.status.missing.semicolon = ";" تنقص فاصلة منقوطة +editor.status.missing.left_sq_bracket = يوجد قوص مربع يساري ناقص "[" +editor.status.missing.right_sq_bracket = يوجد قوص مربع يميني ناقص "]" +editor.status.missing.left_paren = يوجد قوص يساري ناقص "(" +editor.status.missing.right_paren = يوجد قوص يميني ناقص ")" +editor.status.missing.left_curly_bracket = يوجد قوص مجعد يساري ناقص "{" +editor.status.missing.right_curly_bracket = يوجد قوص مجعد يميني ناقص "}" +editor.status.missing.add = قد تحتاج لإضافة "%s" +editor.status.reserved_words = "color" و "int" من الكلمات المحجوزة ولا يمكن استخدامهما كأسماء متغيرات +editor.status.undefined_method = الدالة "%s(%s)" غير معرفة +editor.status.undefined_constructor = الباني "%s(%s)" غير معرف +editor.status.empty_param = الدالة "%s()" لا تحتاج لأية معطيات +editor.status.wrong_param = "%s(%s)" الدالة "%s()" تحتاج معطيات بشكل +editor.status.undef_global_var = المتغير العالمي "%s" غير موجود +editor.status.undef_class = الصنف "%s" غير موجود +editor.status.undef_var = المتغير "%s" غير موجود +editor.status.undef_name = تعذر العثور على الإسم "%s" +editor.status.type_mismatch = الأنواع غير متطابقة. "%s" لا يطابق "%s". +editor.status.unused_variable = قيمة المتغير المحلي "%s" غير مستخدمة +editor.status.uninitialized_variable = لم يتم تعريف المتغير المحلي "%s" +editor.status.no_effect_assignment = الإسناد للمتغير "%s" ليس لديه أي مفعول +editor.status.hiding_enclosing_type = لا يمكن أن يكون إسم الصنف "%s" كإسم المخطوط أو إسم الصنف المحتوي + +# Footer buttons +editor.footer.errors = أخطاء +editor.footer.errors.problem = مشاكل +editor.footer.errors.tab = علامات تبويب +editor.footer.errors.line = سطر +editor.footer.console = لوحة أوامر + +# New handler +new.messages.is_read_only = المخطوط للقراءة فقط. +new.messages.is_read_only.description = بعض الملفات للقراءة فقط. ستحتاج \nلإعادة حفظ الملف في مكان آخر, \nثم المحاولة لاحقاً. + +# Rename handler +rename.messages.is_untitled = المخطوط غير مسمى +rename.messages.is_untitled.description = ألا تريد حفظ المخطوط قبل إعادة التسمية؟ +rename.messages.is_modified = يرجى حفظ المخطوط قبل إعادة التسمية. +rename.messages.is_read_only = المخطوط للقراءة فقط. +rename.messages.is_read_only.description = بعض الملفات للقراءة فقط. ستحتاج \nلإعادة حفظ الملف في مكان آخر, \nثم المحاولة لاحقاً. + +# Naming handler +name.messages.problem_renaming = حدثت مشكلة خلال إعادة التسمية +name.messages.starts_with_dot.description = لا يمكن أن يبدأ الإسم بنقطة. +name.messages.invalid_extension.description = اللاحقة ".%s" غير صالحة +name.messages.main_java_extension.description = .%s علامة التبويب الأولى لا يمكن أن تكون لملف من نوع +name.messages.new_sketch_exists = لا +name.messages.new_sketch_exists.description = يوجد ملف بإسم "%s" في المكان المستهدف "%s" نفسه +name.messages.new_folder_exists = لا يمكن إعادة التسمية +name.messages.new_folder_exists.description = عفواً, يوجد ملف (أو مجلد) بنفس الإسم "%s" من قبل. +name.messages.error = خطأ +name.messages.no_rename_folder.description = تعذرت إعادة تسمية ملف المخطوطات +name.messages.no_rename_file.description = تعذرت إعادة تسمية "%s" إلى "%s". +name.messages.no_create_file.description = تعذر استحداث الملف "%s"\nفي "%s" + +# Delete handler +delete.messages.cannot_delete = لا يمكن الحذف +delete.messages.cannot_delete.description = لا يمكنك حذف مخطوط قبل حفظه +delete.messages.cannot_delete.file = لم أستطع فعل هذا +delete.messages.cannot_delete.file.description = تعذر الحذف +delete.messages.is_read_only = المخطوط للقراءة فقط. +delete.messages.is_read_only.description = بعض الملفات للقراءة فقط. ستحتاج \nلإعادة حفظ الملف في مكان آخر, \nثم المحاولة لاحقاً. + +# Save handler +save_file.messages.is_read_only = المخطوط للقراءة فقط. +save_file.messages.is_read_only.description = بعض الملفات للقراءة فقط. ستحتاج \nلإعادة حفظ الملف في مكان آخر. +save_file.messages.sketch_exists = تعذر الحفظ +save_file.messages.sketch_exists.description = يوجد ملف بإسم “%s” سلفاُ. +save_file.messages.tab_exists = نوب +save_file.messages.tab_exists.description = تعذر حفظ المخطوط بإسم "%s" ,لأن المخطوط فيه علامة تبويب بهذا الإسم حالياً. +save_file.messages.recursive_save = نوب نوب نوب +save_file.messages.recursive_save.description = لا يمكنك حفظ مخطوط في ملف داخل نفسه, هذا سيحدث العديد من المشاكل. + +# Add handler +add_file.messages.is_read_only = المخطوط للقراءة فقط. +add_file.messages.is_read_only.description = بعض الملفات للقراءة فقط. ستحتاج \nلإعادة حفظ الملف في مكان آخر, \nثم المحاولة لاحقاً. +add_file.messages.confirm_replace = هل تريد استبدال النسخة الحالية من %s؟ +add_file.messages.error_adding = حدث خطأ خلال إضافة الملف +add_file.messages.cannot_delete.description = تعذر حذف ملف '%s' +add_file.messages.cannot_add.description = فشلت إضافة '%s' إلى المخطوط +add_file.messages.same_file = لا يمكنك خداعي +add_file.messages.same_file.description = تم سابقاُ نسخ هذا الملف إلى نفس المكان المستهدف. + +# Temp folder creator +temp_dir.messages.bad_build_folder = ملف بناء المخطوط غير صالح +temp_dir.messages.bad_build_folder.description = تعذر العثور على مكان لبناء المخطوط. + +# Ensure Existance +ensure_exist.messages.missing_sketch = اختفى المخطوط +ensure_exist.messages.missing_sketch.description = تعذر العثور على ملف المخطوط. \nسيتم إعادة حفظ المخطوط في نفس المكان المحدد, \nلكن كل شيء عدا الشفرة المصدرية سيضيع. +ensure_exist.messages.unrecoverable = تعذرت إعادة الحفظ +ensure_exist.messages.unrecoverable.description = تعذرت إعادة حفظ المخطوط. لتجنب خسارة كل جهد حياتك على هذا الملف, \nقم بنسخ الشفرة المصدرية ولصقها في محرر نصوص آخر, إحتياطاً. + +# Check name +check_name.messages.is_name_modified = يجب تعديل اسم المخطوط. يمكن أن تحتوي الأسماء على \nرموز وأرقام بتشفير ASCII (بشرط أن لا تبدأ برقم). \nيجب أن يكون طول الإسم أقل من 64 رمزاً. + +# --------------------------------------- +# Contributions + +# Contribution Panel +contrib = مدير المشاركات +contrib.manager_title.update = مدير التحديثات +contrib.manager_title.mode = مدير الأوضاع +contrib.manager_title.tool = مدير الأدوات +contrib.manager_title.library = مدير المكتبات +contrib.manager_title.examples = مدير الأمثلة +contrib.category = الفئة: +contrib.filter_your_search = فلترة نتائج البحث.. +contrib.show_only_compatible.mode = إظهار الأوضاع المتوافقة فقط. +contrib.show_only_compatible.tool = إظهار الأدوات المتوافقة فقط. +contrib.show_only_compatible.library = إظهار المكتبات المتوافقة فقط. +contrib.show_only_compatible.examples = إظهار الأمثلة المتوافقة فقط. +contrib.show_only_compatible.update = إظهار التحديثات المتوافقة فقط. +contrib.restart = إعادة تشغيل Processing +contrib.unsaved_changes = يوجد تغييرات غير محفوظة +contrib.unsaved_changes.prompt = هل انت متأكد انك تريد إعادة تشغيل البرنامج قبل حفظ التغييرات أولاً؟ +contrib.messages.remove_restart = يرجى إعادة تشغيل البرنامح لإنهاء حذف هذا العنصر. +contrib.messages.install_restart = يرجى إعادة تشغيل البرنامح لإنهاء تثبيت هذا العنصر. +contrib.messages.update_restart = يرجى إعادة تشغيل البرنامح لإنهاء تحديث هذا العنصر. +contrib.errors.list_download = فشل تحميل قائمة المشاركات المتوفرة. +contrib.errors.list_download.timeout = حدث خطأ خلال تحميل قائمة المشاركات. +contrib.errors.download_and_install = . %s حدث خطأ خلال تحميل وتنزيل +contrib.errors.description_unavailable = لا يوجد وصف. +contrib.errors.malformed_url = الرابط الذي تم تحميله من Processing.org لا يعمل. \nبإمكانك تثبيت المكتبة بشكل يدوي عن طريق زيارة موقع المكتبة الإلكتروني. +contrib.errors.needs_repackage = يجب إعادة حزم %s وفقاً لشروط %s. +contrib.errors.no_contribution_found = تعذر العثور على %s في الملف المحمل. +contrib.errors.overwriting_properties = .properties حصل خلل خلال استبدال محتوى ملف +contrib.errors.install_failed = فشل التثبيت. +contrib.errors.update_on_restart_failed = فشل تحديث %s بعد إعادة التشغيل. +contrib.errors.temporary_directory = فشلت الكتابة في الملف المؤقت. +contrib.errors.contrib_download.timeout = حصلت مشكلة في اتصال الانترنت خلال تحميل %s. +contrib.errors.no_internet_connection = يبدو أنك غير متصل بالإنترنت... +contrib.status.downloading_list = يتم تحميل قائمة المشاركات... +contrib.status.connecting = يتم الاتصال... +contrib.status.done = تم الانتهاء +contrib.all = الكل +contrib.undo = تراجع +contrib.remove = إزالة +contrib.install = تثبيت +contrib.progress.installing = يتم تثبيت +contrib.progress.starting = يتم بدأ +contrib.progress.downloading = يتم تنزيل +contrib.download_error = حدث خطأ خلال تنزيل المشاركات +contrib.unsupported_operating_system = يبدو أن نظام التشغيل الخاص بك غير مدعوم. يرجى زيارة %s\ المكتبة للمزيد من المعلومات. +contrib.category.3d = 3D +contrib.category.animation = رسوم متحركة +contrib.category.data = بيانات ومعطيات +contrib.category.geometry = هندسيات +contrib.category.gui = واجهات مستخدم رسومية +contrib.category.hardware = عتاد مادي +contrib.category.i_o = مدخلات ومخرجات +contrib.category.math = رياضيات +contrib.category.simulation = محاكاة +contrib.category.sound = صوتيات +contrib.category.typography = تخطيط +contrib.category.utilities = خدمات +contrib.category.video_vision = فيديو ورؤية رقمية +contrib.category.other = آخر + +# Install on Startup +contrib.startup.errors.download_install = %s حدث خطأ خلال تحميل وتثبيت +contrib.startup.errors.temp_dir = فشل النسخ إلى ملف مؤقت خلال عملية تحميل وتنزيل %s +contrib.startup.errors.new_marker = يبدو أن هنالك مشكلة بين مؤشر المشاركات الغير محدثة و %s. قد تحتاج إلى تحديث المشاركة بشكل يدوي. + +# Install on Import +contrib.import.dialog.title = المكتبات المفقودة المتوفرة +contrib.import.dialog.primary_text = المكتبات المستوردة التالية متوفرة للتحميل, لكن لم يتم تثبيتها بعد. +contrib.import.dialog.secondary_text = هل تود تثبيتهم الآن؟ +contrib.import.progress.download = ...%s يتم تحميل +contrib.import.progress.install = ...%s يتم تثبيت +contrib.import.progress.done = .%s تم تثبيت +contrib.import.progress.final_list = تم تثبيت المكتبات التالية: +contrib.import.errors.link = يبدو أن رابط التحميل للمكتبة %s لا يعمل. + +# --------------------------------------- +# Warnings + +warn.delete = حذف +warn.delete.sketch = هل أنت متأكد انك تريد حذف هذا المخطوط؟ +warn.delete.file = هل انت متأكد أنك تود حذف "%s"؟ +warn.cannot_change_mode.title = لا يمكن تغيير الوضع +warn.cannot_change_mode.body = لا يمكنك تغيير الوضع, لأن وضع "%s" غير متوافق مع الوضع الحالي. + + +# --------------------------------------- +# Update Check + +update_check = تحديث +update_check.updates_available.core = يوجد نسخة جديدة من بروسسنج جاهزة للتحميل. \nهل تود زيارة الموقع الرسمي لتحميلها؟ +update_check.updates_available.contributions = يوجد تحديثات متوفرة لبعض المشاركات المثبتة. \nهل تريد الذهاب إلى مدير المشاركات الآن؟ + + +# --------------------------------------- +# Color Chooser + +color_chooser = أداة اختيار الألوان +color_chooser.select = تحديد + +# --------------------------------------- +# Movie Maker + +movie_maker = صانع الأفلام +movie_maker.title = QuickTime صانع أفلام +movie_maker.blurb = This tool creates a QuickTime movie from a sequence of images.

To avoid artifacts caused by re-compressing images as video,
use TIFF, TGA (from Processing), or PNG images as the source.

TIFF and TGA images will write more quickly, but require more disk:
saveFrame("frames/####.tif");
saveFrame("frames/####.tga");

PNG images are smaller, but your sketch will run more slowly:
saveFrame("frames/####.png");

This code is based on QuickTime Movie Maker 1.5.1 2011-01-17.
Copyright © 2010-2011 Werner Randelshofer. All rights reserved.
+movie_maker.image_folder_help_label = اسحب ملف يحتوي على الصور إلى الحقل السفلي: +movie_maker.choose_button = اختر... +movie_maker.select_image_folder = اختر ملف الصور... +movie_maker.sound_file_help_label = إلى الحقل السفلي: (.au, .aiff, .wav, .mp3) اسحب ملف يحتوي على ملفات صوت بصيغة +movie_maker.select_sound_file = اختر ملف الصوت... + +movie_maker.create_movie_button = فلم جديد... +movie_maker.save_dialog_prompt = حفظ الفلم ك... +movie_maker.width = العرض +movie_maker.height = الارتفاع +movie_maker.compression = الضغط +movie_maker.compression.animation = رسوم متحركة +movie_maker.compression.jpeg = JPEG +movie_maker.compression.png = PNG +movie_maker.framerate = تردد الأطر: +movie_maker.orig_size_button = نفس الحجم الأصلي +movie_maker.orig_size_tooltip = قم باختيار هذا المربع إذا كان الملف يحتوي على أطر فيديو بالتشفير والحجم المطلوب. + +movie_maker.error.avoid_tiff = حاول باستخدام صور بلاحقة TGA أو PNG بدل TIFF. +movie_maker.error.badnumbers = يجب أن تكون قيم الطول والعرض أعداد حقيقية أكبر من الصفر, ويحب أن يكون تردد الأطر أكبر من الصفر. +movie_maker.error.cannot_read = .%s تعذرت قراءة +movie_maker.error.cannot_read_maybe_bad = تعذرت قراءة %s, قد يكون الملف سيئاً. +movie_maker.error.movie_failed = .QuickTime فشل انتاج فلم من نوع +movie_maker.error.need_input = يجب عليك تحديد ملف يحتوي على ملفات صوتية, ملفات صور, أو كلاهما. +movie_maker.error.no_images_found = لم يتم العثور على ملفات صور هنا. +movie_maker.error.sorry = عذراً +movie_maker.error.unknown_tga_format = لاحقة الملف %s من نوع .tga غير معروفة. + +movie_maker.progress.creating_file_name = .%s يتم الآن إنتاج +movie_maker.progress.creating_output_file = يتم الآن إنتاج الملف +movie_maker.progress.initializing = بدء العملية... +movie_maker.progress.processing = .%s يتم معالجة diff --git a/build/shared/lib/languages/PDE_de.properties b/build/shared/lib/languages/PDE_de.properties index 978f69e34d..21d057439e 100644 --- a/build/shared/lib/languages/PDE_de.properties +++ b/build/shared/lib/languages/PDE_de.properties @@ -40,8 +40,8 @@ menu.edit.paste = Einfügen menu.edit.select_all = Alle auswählen menu.edit.auto_format = Autoformatierung menu.edit.comment_uncomment = Ein- und Auskommentieren -menu.edit.increase_indent = Ausrücken -menu.edit.decrease_indent = Einrücken +menu.edit.increase_indent = → Ausrücken +menu.edit.decrease_indent = ← Einrücken menu.edit.find = Suchen ... menu.edit.find_next = Weiter suchen menu.edit.find_previous = Vorher suchen @@ -267,7 +267,7 @@ toolbar.debug.variable_inspector = Variable-Inspector anzeigen/ausblenden # [Tab1] [Tab2] [v] editor.header.new_tab = Neuer Tab -editor.header.rename = Unbenennen +editor.header.rename = Umbenennen editor.header.delete = Löschen editor.header.previous_tab = Nächster Tab editor.header.next_tab = Vorheriger Tab @@ -310,7 +310,7 @@ new.messages.is_read_only = Sketch ist Read-Only new.messages.is_read_only.description = Einige Dateien sind als "read-only" markiert,\naus dem Grund musst du das Sketch an einer neuer\nStelle abspeichern, und es noch mal ausprobieren. # Rename handler -rename.messages.is_untitled = Unbenennen abgebrochen +rename.messages.is_untitled = Umbenennen abgebrochen rename.messages.is_untitled.description = Sketch muss zuvor abgespeichert werden\nbevor es unbenannt werden kann. rename.messages.is_modified = Speichere Sketch vor dem Umbenennen. rename.messages.is_read_only = Sketch ist Read-Only diff --git a/build/shared/lib/languages/PDE_el.properties b/build/shared/lib/languages/PDE_el.properties index dbdefe7b93..07c348ab2e 100644 --- a/build/shared/lib/languages/PDE_el.properties +++ b/build/shared/lib/languages/PDE_el.properties @@ -40,8 +40,8 @@ menu.edit.paste = Επικόλληση menu.edit.select_all = Επιλογή Όλων menu.edit.auto_format = Αυτόματη Μορφοποίηση menu.edit.comment_uncomment = Σχολιασμός/Αποσχολιασμός -menu.edit.increase_indent = Αύξηση Εσοχής -menu.edit.decrease_indent = Μείωση Εσοχής +menu.edit.increase_indent = → Αύξηση Εσοχής +menu.edit.decrease_indent = ← Μείωση Εσοχής menu.edit.find = Αναζήτηση... menu.edit.find_next = Αναζήτηση Επόμενου menu.edit.find_previous = Αναζήτηση Προηγούμενου @@ -215,7 +215,7 @@ export.tooltip.macosx = Η εξαγωγή Mac OS X είναι διαθέσιμη export.full_screen = Πλήρης Οθόνη export.embed_java = Ενσωματωμένη Java export.embed_java.for = Ενσωματωμένη Java για -export.code_signing = Υπογραφή Κώδικα +export.code_signing = Υπογραφή Κώδικα # Find (Frame) find = Αναζήτηση @@ -373,14 +373,14 @@ editor.footer.console = Κονσόλα # New handler new.messages.is_read_only = Το Σχέδιο είναι Μόνο για Ανάγνωση -new.messages.is_read_only.description = Μερικά αρχεία είναι σημειωμένα "Μόνο για Ανάγνωση", οπότε θα χρειαστεί να ξανα-αποθηκεύσεις το Σχέδιο σε διαφορετική θέση,\nκαι να προσπαθήσεις ξανά. +new.messages.is_read_only.description = Μερικά αρχεία είναι σημειωμένα "Μόνο για Ανάγνωση", οπότε θα χρειαστεί να ξανα-αποθηκεύσεις το Σχέδιο σε διαφορετική θέση,\nκαι να προσπαθήσεις ξανά. # Rename handler rename.messages.is_untitled = Το Σχέδιο Δεν έχει Τίτλο rename.messages.is_untitled.description = Τι θα έλεγες να αποθηκεύσεις το Σχέδιο\nπριν προσπαθήσεις να το μετονομάσεις; rename.messages.is_modified = Παρακαλώ αποθήκευσε το Σχέδιο πριν το μετονομάσεις. -rename.messages.is_read_only = Το Σχέδιο είναι Μόνο για Ανάγνωση -rename.messages.is_read_only.description = Μερικά αρχεία είναι σημειωμένα "Μόνο για Ανάγνωση", οπότε θα χρειαστεί να ξανα-αποθηκεύσεις το Σχέδιο σε διαφορετική θέση,\nκαι να προσπαθήσεις ξανά. +rename.messages.is_read_only = Το Σχέδιο είναι Μόνο για Ανάγνωση +rename.messages.is_read_only.description = Μερικά αρχεία είναι σημειωμένα "Μόνο για Ανάγνωση", οπότε θα χρειαστεί να ξανα-αποθηκεύσεις το Σχέδιο σε διαφορετική θέση,\nκαι να προσπαθήσεις ξανά. # Delete handler delete.messages.cannot_delete = Αποτυχία Διαγραφής @@ -409,7 +409,7 @@ contrib.show_only_compatible.library = Εμφάνιση Μόνο Συμβατώ contrib.show_only_compatible.examples = Εμφάνιση Μόνο Συμβατών Παραδειγμάτων contrib.show_only_compatible.update = Εμφάνιση Μόνο Συμβατών Ενημερώσεων contrib.restart = Επανεκκίνηση Processing -contrib.unsaved_changes = Βρέθηκαν μη αποθηκευμένες ενημερώσεις +contrib.unsaved_changes = Βρέθηκαν μη αποθηκευμένες ενημερώσεις contrib.unsaved_changes.prompt = Είσαι σίγουρος ότι θέλεις να κάνεις επανεκκίνηση της Processing χωρίς να αποθηκεύσεις τις αλλαγές; contrib.messages.remove_restart = Παρακαλώ κάνε επανεκκίνηση της Processing για να ολοκληρωθεί η αφαίρεση αυτού του αντικειμένου. contrib.messages.install_restart = Παρακαλώ κάνε επανεκκίνηση της Processing για να ολοκληρωθεί η εγκατάσταση αυτού του αντικειμένου. @@ -445,7 +445,7 @@ contrib.category.animation = Animation contrib.category.data = Δεδομένα contrib.category.geometry = Γεωμετρία contrib.category.gui = GUI -contrib.category.hardware = Υλικό +contrib.category.hardware = Υλικό contrib.category.i_o = Ε/Ε contrib.category.math = Μαθηματικά contrib.category.simulation = Προσομοίωση diff --git a/build/shared/lib/languages/PDE_es.properties b/build/shared/lib/languages/PDE_es.properties index 272a0235d3..8752a1bd0f 100644 --- a/build/shared/lib/languages/PDE_es.properties +++ b/build/shared/lib/languages/PDE_es.properties @@ -40,8 +40,8 @@ menu.edit.paste = Pegar menu.edit.select_all = Seleccionar todo menu.edit.auto_format = Autoformato menu.edit.comment_uncomment = Comentar/Descomentar -menu.edit.increase_indent = Aumentar indentación -menu.edit.decrease_indent = Reducir indentación +menu.edit.increase_indent = → Aumentar indentación +menu.edit.decrease_indent = ← Reducir indentación menu.edit.find = Buscar... menu.edit.find_next = Buscar siguiente menu.edit.find_previous = Buscar anterior @@ -60,7 +60,7 @@ menu.library.contributed = Contribuidas menu.library.no_core_libraries = el modo no tiene bibliotecas incluidas # --- menu.sketch = Sketch -menu.sketch.show_sketch_folder = Mostrar carpeta de sketches +menu.sketch.show_sketch_folder = Mostrar carpeta del sketch menu.sketch.add_file = Añadir archivo # | File | Edit | Sketch | Debug | Tools | Help | @@ -104,13 +104,14 @@ menu.tools.add_tool = Añadir herramienta... # | File | Edit | Sketch | Debug | Tools | Help | # | Help | menu.help = Ayuda +menu.help.welcome = Bienvenida a Processing 3 menu.help.about = Acerca de Processing menu.help.environment = Entorno menu.help.reference = Referencia menu.help.find_in_reference = Buscar en la referencia menu.help.libraries_reference = Referencia de Bibliotecas menu.help.tools_reference = Referencia de Herramientas -menu.help.empty = (empty) +menu.help.empty = (vacío) menu.help.online = Online menu.help.getting_started = Primeros Pasos menu.help.getting_started.url = http://processing.org/learning/gettingstarted/ @@ -201,7 +202,7 @@ sketchbook = Sketchbook sketchbook.tree = Sketchbook # Examples (Frame) -examples = Ejemplos +examples.title = Ejemplos para %s examples.add_examples = Añadir ejemplos... examples.libraries = Bibliotecas examples.core_libraries = Bibliotecas principales @@ -226,6 +227,10 @@ export.full_screen = Pantalla completa export.embed_java = Incrustar Java export.embed_java.for = Incrustar Java para export.code_signing = Firma de código +export.messages.is_read_only = El sketch es de sólo lectura +export.messages.is_read_only.description = Algunos archivos han sido marcados como de sólo lectura\npor lo que necesitarás guardar el sketch\n en otra ubicación e intentar nuevamente. +export.messages.cannot_export = No se puede exportar +export.messages.cannot_export.description = No puede exportar un sketch que no haya sido guardado. # Find (Frame) find = Buscar @@ -315,6 +320,10 @@ editor.header.next_tab = Pestaña siguiente editor.header.delete.warning.title = No editor.header.delete.warning.text = No puedes eliminar la última pestaña del último sketch abierto +# PopUp menu +editor.popup.show_usage = Mostrar uso... +editor.popup.rename = Renombrar... + # Tabs editor.tab.new = Nuevo nombre editor.tab.new.description = Nombre para el archivo nuevo @@ -370,6 +379,7 @@ editor.status.type_mismatch = Discrepancia de tipos, "%s" no coincide con "%s" editor.status.unused_variable = El valor de la variable local "%s" no se utiliza editor.status.uninitialized_variable = Puede que la variable local "%s" no haya sido inicializada editor.status.no_effect_assignment = La asignación a la variable "%s" no tiene ningún efecto +editor.status.hiding_enclosing_type = Las clase "%s" no puede tener el mismo nombre que el sketch o su clase envolvente # Footer buttons editor.footer.errors = Errores @@ -396,10 +406,10 @@ name.messages.invalid_extension.description = ".%s" no es una extensión válida name.messages.main_java_extension.description = La primera pestaña no puede ser un archivo .%s.\n(Puede que sea tiempo de graduarse\na un entorno de programación "real") name.messages.new_sketch_exists = No name.messages.new_sketch_exists.description = Un archivo llamado "%s" ya existe en\n"%s" -name.messages.new_folder_exists = No se puede cambiar de nombre +name.messages.new_folder_exists = No se puede cambiar de nombre name.messages.new_folder_exists.description = Un sketch (o directorio) con nombre "%s" ya existe. name.messages.error = Error -name.messages.no_rename_folder.description = No se pudo renombrar el directorio del sketch. +name.messages.no_rename_folder.description = No se pudo renombrar el directorio del sketch. name.messages.no_rename_file.description = No se pudo renombrar "%s" a "%s" name.messages.no_create_file.description = No se pudo crear el archivo "%s"\nen "%s" @@ -425,7 +435,7 @@ save_file.messages.recursive_save.description = No puedes guardar un sketch en u add_file.messages.is_read_only = El sketch es de sólo-lectura add_file.messages.is_read_only.description = Algunos archivos están marcados como de sólo-lectura, por\nlo que vas a tener que guardar el sketch en otra ubicación,\ne intentar de nuevo. add_file.messages.confirm_replace = ¿Reemplzara la versión existente de %s? -add_file.messages.error_adding = Error al añadir el archivo +add_file.messages.error_adding = Error al añadir el archivo add_file.messages.cannot_delete.description = No se pudo eliminar el archivo existente '%s'. add_file.messages.cannot_add.description = No se pudo añadir '%s' al sketch. add_file.messages.same_file = No puedes engañarme @@ -495,17 +505,17 @@ contrib.unsupported_operating_system = Tu sistema operativo no está soportado. contrib.category.3d = 3D contrib.category.animation = Animación contrib.category.data = Datos -contrib.category.geometry = Geometría +contrib.category.geometry = Geometría contrib.category.gui = Interfaz gráfica -contrib.category.hardware = Hardware +contrib.category.hardware = Hardware contrib.category.i_o = Entrada/Salida contrib.category.math = Matemáticas contrib.category.simulation = Simulación -contrib.category.sound = Sonido -contrib.category.typography = Tipografía -contrib.category.utilities = Utilidades +contrib.category.sound = Sonido +contrib.category.typography = Tipografía +contrib.category.utilities = Utilidades contrib.category.video_vision = Visión de video -contrib.category.other = Otros +contrib.category.other = Otros # Install on Startup contrib.startup.errors.download_install = Ocurrió un error al descargar e instalar %s @@ -528,6 +538,8 @@ contrib.import.errors.link = Error: La biblioteca %s tiene un enlace de descarga warn.delete = Eliminar warn.delete.sketch = ¿Seguro que deseas eliminar este sketch? warn.delete.file = ¿Seguro que deseas eliminar "%s"? +warn.cannot_change_mode.title = No se puede cambiar el modo +warn.cannot_change_mode.body = No se puede cambiar el modo porque\nel modo "%s" no es compatible con el modo actual. # --------------------------------------- @@ -568,8 +580,8 @@ movie_maker.orig_size_tooltip = Marca esta casilla si el directorio ya contiene movie_maker.error.avoid_tiff = Prueba usar imagenes TGA o PNG en lugar de TIFF. movie_maker.error.badnumbers = El ancho y alto deben ser números enteros mayores que cero; las imagenes por segundo deben ser un número mayor a cero. -movie_maker.error.cant_read = No se pudo leer %s. -movie_maker.error.cant_read_maybe_bad = No se pudo leer %s; puede que esté corrupto. +movie_maker.error.cannot_read = No se pudo leer %s. +movie_maker.error.cannot_read_maybe_bad = No se pudo leer %s; puede que esté corrupto. movie_maker.error.movie_failed = Falló la creación de la película QuickTime. movie_maker.error.need_input = Debes especificar el directorio con los archivos de imagen, el archivo de sonido, o ambos. movie_maker.error.no_images_found = No se encontraron archivos de imagen. diff --git a/build/shared/lib/languages/PDE_fr.properties b/build/shared/lib/languages/PDE_fr.properties index e09a33e075..37209e9991 100644 --- a/build/shared/lib/languages/PDE_fr.properties +++ b/build/shared/lib/languages/PDE_fr.properties @@ -40,8 +40,8 @@ menu.edit.paste = Coller menu.edit.select_all = Selectionner tout menu.edit.auto_format = Mise en forme automatique menu.edit.comment_uncomment = Commenter/Décommenter -menu.edit.increase_indent = Augmenter l'indentation -menu.edit.decrease_indent = Diminuer l'indentation +menu.edit.increase_indent = → Augmenter l'indentation +menu.edit.decrease_indent = ← Diminuer l'indentation menu.edit.find = Rechercher... menu.edit.find_next = Rechercher suivant menu.edit.find_previous = Rechercher précédent diff --git a/build/shared/lib/languages/PDE_it.properties b/build/shared/lib/languages/PDE_it.properties new file mode 100644 index 0000000000..4a1334e82d --- /dev/null +++ b/build/shared/lib/languages/PDE_it.properties @@ -0,0 +1,589 @@ +Annulla + +# --------------------------------------- +# Language: Italiano (Italian) (it) +# --------------------------------------- + + +# --------------------------------------- +# Menu + +# | File | Edit | Sketch | Debug | Tools | Help | +# | File | +menu.file = File +menu.file.new = Nuovo +menu.file.open = Apri... +menu.file.recent = Apri Recenti +menu.file.sketchbook = Cartelle degli Sketch... +menu.file.sketchbook.empty = Cartella degli Sketch vuota +menu.file.examples = Esempi... +menu.file.close = Chiudi +menu.file.save = Salva +menu.file.save_as = Salva con nome... +menu.file.export_application = Esporta Applicazione... +menu.file.page_setup = Imposta Pagina +menu.file.print = Stampa... +menu.file.preferences = Preferenze... +menu.file.quit = Esci + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Edit | +menu.edit = Modifica +menu.edit.undo = Annulla +menu.edit.redo = Ripeti +menu.edit.action.addition = addizione +menu.edit.action.deletion = cancellazione +menu.edit.cut = Taglia +menu.edit.copy = Copia +menu.edit.copy_as_html = Copia come HTML +menu.edit.paste = Incolla +menu.edit.select_all = Seleziona Tutto +menu.edit.auto_format = Formattazione Automatica +menu.edit.comment_uncomment = Commenta/Rimuovi commento +menu.edit.increase_indent = → Aumenta Indentazione +menu.edit.decrease_indent = ← Diminuisci Indentazione +menu.edit.find = Trova... +menu.edit.find_next = Trova Successivo +menu.edit.find_previous = Trova Puccessivo +menu.edit.use_selection_for_find = Trova Testo Selezionato + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Sketch | +menu.sketch.run = Esegui +menu.sketch.present = Presenta +menu.sketch.tweak = Tweak +menu.sketch.stop = Stop +# --- +menu.library = Importa Libreria... +menu.library.add_library = Aggiungi Libreria... +menu.library.contributed = Librerie di terze parti +menu.library.no_core_libraries = modalità senza librerie di default +# --- +menu.sketch = Sketch +menu.sketch.show_sketch_folder = Apri cartella dello Sketch +menu.sketch.add_file = Aggiungi File... + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Debug | +menu.debug = Debug +menu.debug.enable = Abilitare Debugger +menu.debug.disable = Disabilitare Debugger +#menu.debug.show_debug_toolbar = Show Debug Toolbar +#menu.debug.debug = Debug +#menu.debug.stop = Stop +# --- +menu.debug.toggle_breakpoint = Toggle Breakpoint +#menu.debug.list_breakpoints = List breakpoints +# --- +# used for both menus and toolbars +menu.debug.step = Step +menu.debug.step_into = Step Avanti +menu.debug.step_out = Step Indietro +menu.debug.continue = Continua +# --- +#menu.debug.print_stack_trace = Print Stack Trace +#menu.debug.print_locals = Print Locals +#menu.debug.print_fields = Print Fields +#menu.debug.print_source_location = Print Source Location +#menu.debug.print_threads = Print Threads +# --- +#menu.debug.variable_inspector = Variable Inspector +menu.debug.show_variables = Mostra Variabili +menu.debug.hide_variables = Nascondi Variabili +#menu.debug.show_sketch_outline = Show Sketch Outline +#menu.debug.show_tabs_list = Show Tabs List + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Tools | +menu.tools = Strumenti +menu.tools.color_selector = Selezionatore dei colori... +menu.tools.create_font = Crea Font... +menu.tools.archive_sketch = Archivia Sketch +menu.tools.fix_the_serial_lbrary = Ripara la "Serial Library" +menu.tools.install_processing_java = Installa "processing-java" +menu.tools.add_tool = Aggiungi Strumento... + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Help | +menu.help = Aiuto +menu.help.welcome = Benvenuto in Processing 3 +menu.help.about = Riguardo a Processing +menu.help.environment = Ambiente di Sviluppo +menu.help.reference = Guida di Riferimento +menu.help.find_in_reference = Cerca nella Guida +menu.help.libraries_reference = Guida delle Librerie +menu.help.tools_reference = Guida degli Strumenti +menu.help.empty = (vuoto) +menu.help.online = Online +menu.help.getting_started = Primi Passi +menu.help.getting_started.url = http://processing.org/learning/gettingstarted/ +menu.help.troubleshooting = Risoluzione dei Problemi +menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting +menu.help.faq = Domande Frequenti +menu.help.faq.url = http://wiki.processing.org/w/FAQ +menu.help.foundation = La Processing Foundation +menu.help.foundation.url = http://processing.org/foundation/ +menu.help.visit = Visita Processing.org +menu.help.visit.url = http://processing.org/ + + +# --------------------------------------- +# Basics + +# Buttons +prompt.yes = Si +prompt.no = No +prompt.cancel = Cancella +prompt.ok = Ok +prompt.browse = Naviga +prompt.export = Esporta + + +# --------------------------------------- +# Frames + +# Open (Frame) +open = Apri uno sketch di Processing... + +# Save (Frame) +save = Salva la cartella degli sketch con nome... +save.title = Vuoi salvare le modifiche di %s
prima di chiudere? +save.hint = Se non salverai, le tue modifiche verranno perse. +save.btn.save = Salva +save.btn.dont_save = Non salvare + +# Close (Frame) also used to prompt on non-OS X machines +close.unsaved_changes = Salvare le modifiche di %s? + +# Preferences (Frame) +preferences = Preferenze +preferences.button.width = 80 +preferences.requires_restart = richiede il riavvio di Processing +preferences.sketchbook_location = Percorso della cartella degli sketch +preferences.sketchbook_location.popup = Percorso della cartella degli sketch +preferences.language = Lingua +preferences.editor_and_console_font = Font dell'Editor e della Console +preferences.editor_and_console_font.tip = Scegli il font usato dall'Editor e dalla Console.
Solo font monospaced (larghezza fissa) possono essere usati,
sebbene la lista possa essere imperfetta. +preferences.editor_font_size = Dimensione del font dell'Editor +preferences.console_font_size = Dimensione del font della Console +preferences.zoom = Scala dell'interfaccia +preferences.zoom.auto = Automatica +preferences.background_color = Colore di sfondo durante la modalità "Presenta" +preferences.background_color.tip = Scegli il colore di sfondo durante la modalità "Presenta".
Questa modalità è utilizzata per mostrare uno sketch a tutto schermo;
è accessibile dal menù Sketch. +preferences.use_smooth_text = Usa un font semplice nell'Editor +preferences.enable_complex_text_input = Abilita la possibilità di usare caratteri complessi +preferences.enable_complex_text_input_example = per esempio Giapponese +preferences.continuously_check = Controlla continuamente la presenza di errori +preferences.show_warnings = Mostra Avvisi +preferences.code_completion = Completamento del codice con +preferences.trigger_with = Abilita con +preferences.cmd_space = spazio +preferences.suggest_imports = Suggerisci il codice di import +preferences.increase_max_memory = Aumenta la massima memoria disponibile a +preferences.delete_previous_folder_on_export = Elimina le cartelle precedenti dopo l'export +preferences.check_for_updates_on_startup = Consenti di controllare la presenza di aggiornamenti (vedi le FAQ per le informazioni condivise) +preferences.run_sketches_on_display = Esegui Sketch nel monitor +preferences.run_sketches_on_display.tip = Stabilisce il monitor nel quale gli sketch vengono inizalmente visualizzati.
Come al solito, se la finestra dello sketch viene spostata, si riaprirà nella
stessa posizione, tuttavia quando si esegue nella modalità "Presenta"
(tutto schermo), questo monitor verrà sempre utilizzato. +preferences.automatically_associate_pde_files = Associa automaticamente i file .pde con Processing +preferences.launch_programs_in = Lancia programmi in +preferences.launch_programs_in.mode = modalità +preferences.file = Più preferenze possono essere modificate nel file +preferences.file.hint = modificalo solo quando Processing non è aperto + +# Sketchbook Location (Frame) +sketchbook_location = Seleziona la nuova posizione della cartella degli Sketch + +# Sketchbook (Frame) +sketchbook = Cartella degli Sketch +sketchbook.tree = Cartella degli Sketch + +# Examples (Frame) +examples.title = %s Esempi +examples.add_examples = Aggiungi Esempi... +examples.libraries = Librerie di terze parti +examples.core_libraries = Librerie +examples.contributed = Esempi di terze parti + +# Export (Frame) +export = Opzioni di esportazione +export.platforms = Piattaforme +export.options = Opzioni +export.options.present = Modalità "Presenta" +export.options.show_stop_button = Mostra il bottone di Stop +export.description.line1 = Esporta come applicazione creerà +export.description.line2 = delle applicazioni esegubili per la piattaforma scelta. +export.unsaved_changes = Salvare le modifiche prima di esportare? +export.notice.cancel.unsaved_changes = Esportazione cancellata, prima di eseguirlo è necessario salvare. +export.notice.exporting = Esportando l'applicazione +export.notice.exporting.done = Esportazione eseguita. +export.notice.exporting.error = Errore durante l'esportazione. +export.notice.exporting.cancel = Esportazione come applicazione cancellata. +export.tooltip.macosx = L'esportazione per Mac OS X è disponibile solo su Mac OS X +export.full_screen = Tutto Schermo +export.embed_java = Embed Java +export.embed_java.for = Embed Java for +export.code_signing = Code Signing +export.messages.is_read_only = Sketch è in modalità di sola lettura +export.messages.is_read_only.description = Alcuni files sono in modalità sola lettura, quindi dovrai\nsalvare lo Sketch in un'altra posizione\ne provare di nuovo. +export.messages.cannot_export = Non è possibile esportare +export.messages.cannot_export.description = Non puoi esportare uno Sketch che non è ancora stato salvato. + +# Find (Frame) +find = Trova +find.find = Trova: +find.replace_with = Sostituisci con: +find.ignore_case = Ignora maiuscole / minuscole +find.all_tabs = Cerca in tutte le schede +find.wrap_around = Prosegui dall'inizio +find.btn.replace_all = Sostituisci tutto +find.btn.replace = Sostituisci +find.btn.replace_and_find = Trova e sostituisci +find.btn.previous = Trova precedente +find.btn.find = Trova + +# Find in reference (Frame) +find_in_reference = Trova nella guida + +# File (Frame) +file = Seleziona un'immagine o un altro file da copiare nel tuo sketch + +# Create Font (Frame) +create_font = Crea un Font +create_font.label = Usa questo strumento per creare dei font bitmap per il tuo programma.\nSeleziona un font e la dimensione, poi clicca su 'Ok' per generare il font.\nSarà aggiunto alla cartella dei dati del tuo sketch. +create_font.size = Dimensione +create_font.smooth = Caratteri semplici +create_font.characters = Caratteri... +create_font.character_selector = Selezionatore dei caratteri +create_font.character_selector.label = I caratteri di default includono gran parte dei caratteri bitmap per Mac OS\ne Windows Latin scripts. Includere tutti i caratteri può\nrichiedere una grande quantità di memoria per tutti i bitmap.\nPEr un controllo maggiore puoi selezionare ogni specifico blocco Unicode. +create_font.default_characters = Caratteri di default +create_font.all_characters = Tutti i caratteri +create_font.specific_unicode = Blocchi specifici Unicode +create_font.filename = Nome del file + +# Color Selector (Frame) +color_selector = Selezionatore dei colori + +# Archive Sketch (Frame) +archive_sketch = Archivia sketch come... + +# Tweak Mode +tweak_mode = Modalità Tweak +tweak_mode.save_before_tweak = Per favore salva lo sketch prima di avviare la modalità Tweak. +tweak_mode.keep_changes.line1 = Salvare le modifiche? +tweak_mode.keep_changes.line2 = Hai cambiato alcuni valori nello sketch. Vuoi salvare le modifiche? + +# DebugTray +debugger.name = Nome +debugger.value = Valore +debugger.type = Tipo + +# --------------------------------------- +# Toolbars + +# [Run/Present] [Stop] [New] [Open] [Save] +toolbar.run = Esegui +toolbar.present = Presenta +toolbar.stop = Stop +toolbar.debug = Debug +# --- +toolbar.new = Nuovo +toolbar.open = Apri +toolbar.save = Salva +# toolbar.export_application = Export Application +toolbar.add_mode = Aggiungi modalità... + +# [Debug] [Continue] [Step] [Stop] [Toggle Breakpoints] [Variable Inspector] +#toolbar.debug.continue = Continue +#toolbar.debug.step = Step +#toolbar.debug.step_into = Step Into +#toolbar.debug.stop = Stop +#toolbar.debug.toggle_breakpoints = Toggle Breakpoint +#toolbar.debug.variable_inspector = Variable Inspector + + +# --------------------------------------- +# Editor + +# [Tab1] [Tab2] [v] +editor.header.new_tab = Nuova scheda +editor.header.rename = Rinomina +editor.header.delete = Elimina +editor.header.previous_tab = Scheda precedente +editor.header.next_tab = Scheda successiva +editor.header.delete.warning.title = No. +editor.header.delete.warning.text = Non puoi eliminare la scheda principale del tuo unico sketch aperto.. + +# PopUp menu +editor.popup.jump_to_declaration = Vai alla Dichiarazione +editor.popup.show_usage = Mostra utilizzo... +editor.popup.rename = Rinomina... + +# Tabs +editor.tab.new = Nuovo Nome +editor.tab.new.description = Nome del nuovo file +editor.tab.rename = Nuovo Nome +editor.tab.rename.description = Nuovo nome del file + +# Sketch +editor.sketch.rename.description = Nuovo nome dello scketch + +editor.status.autoformat.no_changes = Nessuna modifica necessaria per l'Auto Format. +editor.status.autoformat.finished = Auto Format terminato. +editor.status.find_reference.select_word_first = Per prima cosa selezionare una parola da trovare nella guida. +editor.status.find_reference.not_available = Nessuna referenza disponibile per "%s". +editor.status.drag_and_drop.files_added.0 = Nessun file aggiunto allo sketch. +editor.status.drag_and_drop.files_added.1 = Un file aggiunto allo sketch. +editor.status.drag_and_drop.files_added.n = %d file aggiunti allo sketch. +editor.status.saving = Salvataggio... +editor.status.saving.done = Salvataggio eseguito. +editor.status.saving.canceled = Salvataggio annullato. +editor.status.printing = Stampa in corso... +editor.status.printing.done = Stampa eseguita. +editor.status.printing.error = Errore durante la stampa. +editor.status.printing.canceled = Stampa annullata. +editor.status.copy_as_html = Il codice formattato in HTML è stato copiato. +editor.status.debug.busy = Debugger occupato... +editor.status.debug.halt = Debugger bloccato. +editor.status.archiver.create = Creato archivio "%s". +editor.status.archiver.cancel = Archivio sketch annullato. + +# Errors +editor.status.warning = Avviso +editor.status.error = Errore +editor.status.error_on = Errore su "%s" +editor.status.missing.default = Manca "%c" +editor.status.missing.semicolon = Manca un punto e virgola ";" +editor.status.missing.left_sq_bracket = Manca parentesi quadra sinistra "[" +editor.status.missing.right_sq_bracket = Manca parentesi quadra destra "]" +editor.status.missing.left_paren = Manca parentesi sinistra "(" +editor.status.missing.right_paren = Manca parentesi destra ")" +editor.status.missing.left_curly_bracket = Manca parentesi graffa sinistra "{" +editor.status.missing.right_curly_bracket = Manca parentesi graffa destra "}" +editor.status.missing.add = Considera di aggiungere "%s" +editor.status.reserved_words = "color" e "int" sono parole riservate e non possono essere usate come nome di una variabile +editor.status.undefined_method = La funzione "%s(%s)" non esiste +editor.status.undefined_constructor = Il costruttore "%s(%s)" non esiste +editor.status.empty_param = La funzione "%s()" non richiede alcun parametro +editor.status.wrong_param = La funzione "%s()" si aspetta dei parametri come: "%s(%s)" +editor.status.undef_global_var = La variabile globale "%s" non esiste +editor.status.undef_class = La classe "%s" non esiste +editor.status.undef_var = La variabile "%s" non esiste +editor.status.undef_name = Il nome "%s" non può essere riconosciuto +editor.status.type_mismatch = Errore di battitura, "%s" non combacia con "%s" +editor.status.unused_variable = Il valore della variabile locale "%s" non è usato +editor.status.uninitialized_variable = La variabile locale "%s" potrebbe non essere stata inizializzata +editor.status.no_effect_assignment = L'assegnazione alla variabile "%s" non ha effetto +editor.status.hiding_enclosing_type = La classe "%s" non può avere lo stesso nome del tuo sketch o della classe che la contiene + +# Footer buttons +editor.footer.errors = Errori +editor.footer.errors.problem = Problemi +editor.footer.errors.tab = Tab +editor.footer.errors.line = Linea +editor.footer.console = Console + +# New handler +new.messages.is_read_only = Lo sketch è in modalità sola lettura. +new.messages.is_read_only.description = Alcuni files sono in sola lettura, quindi devi\nsalvare lo sketch in un'altra cartella,\ne provare di nuovo. + +# Rename handler +rename.messages.is_untitled = Sketch senza nome +rename.messages.is_untitled.description = Che ne dici di salvare lo sketch\nprima di provare a rinominarlo? +rename.messages.is_modified = Per favore salva lo sketch prima di rinominarlo. +rename.messages.is_read_only = Lo sketch è in modalità sola lettura. +rename.messages.is_read_only.description = Alcuni files sono in sola lettura, quindi devi\nsalvare lo sketch in un'altra cartella,\ne provare di nuovo. + +# Naming handler +name.messages.problem_renaming = Problema con nuovo nome +name.messages.starts_with_dot.description = Il nome non può iniziare con un punto. +name.messages.invalid_extension.description = ".%s" non è un'estensione valida. +name.messages.main_java_extension.description = La prima tab non può essere un file .%s.\n(Potrebbe essere il caso che tu passi a un\n"vero" ambiente di sviluppo.) +name.messages.new_sketch_exists = No +name.messages.new_sketch_exists.description = Un file chiamato "%s" esiste già in\n"%s" +name.messages.new_folder_exists = Impossibile rinominare +name.messages.new_folder_exists.description = Putroppo uno sketch (o cartella) chiamato "%s" esiste già. +name.messages.error = Errore +name.messages.no_rename_folder.description = Impossibile rinominare la cartella dello sketch. +name.messages.no_rename_file.description = Impossibile rinominare "%s" in "%s" +name.messages.no_create_file.description = Impossibile creare il file "%s"\nin "%s" + +# Delete handler +delete.messages.cannot_delete = Impossibile eliminare +delete.messages.cannot_delete.description = Non puoi eliminare uno sketch che non è stato salvato. +delete.messages.cannot_delete.file = Impossibile +delete.messages.cannot_delete.file.description = Impossibile eliminare +delete.messages.is_read_only = Lo sketch è in modalità sola lettura. +delete.messages.is_read_only.description = Alcuni files sono in sola lettura, quindi devi\nsalvare lo sketch in un'altra cartella,\ne provare di nuovo. + +# Save handler +save_file.messages.is_read_only = Lo sketch è in modalità sola lettura. +save_file.messages.is_read_only.description = Alcuni files sono in sola lettura, quindi devi\nsalvare questo sketch in un'altra cartella. +save_file.messages.sketch_exists = Impossibile salvare +save_file.messages.sketch_exists.description = Uno sketch con il nome\n“%s” esiste già. +save_file.messages.tab_exists = No +save_file.messages.tab_exists.description = Non puoi salvare lo sketch come "%s"\npoichè lo sketch ha già una tab con quel nome. +save_file.messages.recursive_save = Sei amico di Borges +save_file.messages.recursive_save.description = Non puoi salvare lo sketch in una cartella\ndentro se stessa: andrebbe avanti all'infinito. + +# Add handler +add_file.messages.is_read_only = Lo sketch è in modalità sola lettura. +add_file.messages.is_read_only.description = Alcuni files sono in sola lettura, quindi devi\nsalvare lo sketch in un'altra cartella,\ne provare di nuovo. +add_file.messages.confirm_replace = Sostituire l'esitente versione di %s? +add_file.messages.error_adding = Errore aggiungendo il file +add_file.messages.cannot_delete.description = Impossibile eliminare il corrente file '%s'. +add_file.messages.cannot_add.description = Impossibile aggiungere '%s' allo sketch. +add_file.messages.same_file = Non puoi fregarmi +add_file.messages.same_file.description = Questo file è già stato copiato nella\nquale tu stavic cercando di aggiugnerlo.\nNon lo farò. + +# Temp folder creator +temp_dir.messages.bad_build_folder = Errore nella compilazione della cartella +temp_dir.messages.bad_build_folder.description = Impossibile trovare una cartella dove compilare lo sketch. + +# Ensure Existance +ensure_exist.messages.missing_sketch = Sketch scomparso. +ensure_exist.messages.missing_sketch.description = Cartella dello sketch scomparsa.\nProverò a ri-salvarla nella stessa location,\nma qualsiasi cosa eccetto il codice verrà persa. +ensure_exist.messages.unrecoverable = Impossibile ri-salvare lo sketch. +ensure_exist.messages.unrecoverable.description = Impossibile ri-salvare correttamente lo sketch. Potresti incontrare qualche problema,\ne potrebbe essere l'ora di copiare e incollare il codice in un altro editor di testo. + +# Check name +check_name.messages.is_name_modified = Il nome dello sketch deve essere modificato. Il nome può consistere solo di\ncaratteri e numeri ASCII (ma non può cominciare con un numero).\nInoltre devono essere di lunghezza inferiore ai 64 caratteri. + +# --------------------------------------- +# Contributions + +# Contribution Panel +contrib = Manager dei Contributi +contrib.manager_title.update = Manager degli Aggiornamenti +contrib.manager_title.mode = Manager delle Modalità +contrib.manager_title.tool = Manager degli Strumenti +contrib.manager_title.library = Manager della Libreria +contrib.manager_title.examples = Manager degli esempi +contrib.category = Categoria: +contrib.filter_your_search = Filtra la tua ricerca... +contrib.show_only_compatible.mode = Mostra solo modalità compatibili +contrib.show_only_compatible.tool = Mostra solo strumenti compatibili +contrib.show_only_compatible.library = Mostra solo librerie compatibili +contrib.show_only_compatible.examples = Mostra solo esempi compatibili +contrib.show_only_compatible.update = Mostra solo aggiornamenti compatibili +contrib.restart = Riavvia Processing +contrib.unsaved_changes = Sono presenti modifiche non salvate +contrib.unsaved_changes.prompt = Sei sicuro di voler riavviare Processing senza salvare le modifiche? +contrib.messages.remove_restart = Per favore riavvia Processing per finire di rimuovere questo componente. +contrib.messages.install_restart = Per favore riavvia Processing per finire di installare questo componente. +contrib.messages.update_restart = Per favore riavvia Processing per finire di aggiornare questo componente. +contrib.errors.list_download = Impossibile scaricare la lista dei contributi disponibili. +contrib.errors.list_download.timeout = Connessione interrotta durante il download della lista dei contributi. +contrib.errors.download_and_install = Errore durante il download e l'installazione di %s. +contrib.errors.description_unavailable = Descrizione non disponibile. +contrib.errors.malformed_url = Il link ottenuto da Processing.org non è valido.\nPuoi comunque installare la libreria manualmente visitando\nil suo sito web. +contrib.errors.needs_repackage = %s necessita di ricreare il suo pacchetto secondo le %s lineeguida. +contrib.errors.no_contribution_found = Impossibile trovare un %s nel file scaricato. +contrib.errors.overwriting_properties = Errore sovrascrivendo il file .properties. +contrib.errors.install_failed = Installazione fallita +contrib.errors.update_on_restart_failed = L'aggiornamento al riavvio di %s è fallito. +contrib.errors.temporary_directory = Impossibile scrivere nella cartella temporanea. +contrib.errors.contrib_download.timeout = Connessione interrotta durante il download di %s. +contrib.errors.no_internet_connection = Sembra che tu non sia connesso a Internet. +contrib.status.downloading_list = Scaricando la lista dei contributi... +contrib.status.connecting = Connettendosi... +contrib.status.done = Fatto. +contrib.all = Tutti +contrib.undo = Annulla +contrib.remove = Rimuovi +contrib.install = Installa +contrib.progress.installing = Installando +contrib.progress.starting = Inizializzando +contrib.progress.downloading = Scaricando +contrib.download_error = Errore durante il download del contributo. +contrib.unsupported_operating_system = Il tuo sistema operativo sembra non essere supportato. Dovresti visitare %s della libreria per maggiori informazioni. +contrib.category.3d = 3D +contrib.category.animation = Animazione +contrib.category.data = Dati +contrib.category.geometry = Geometria +contrib.category.gui = GUI +contrib.category.hardware = Hardware +contrib.category.i_o = I/O +contrib.category.math = Matematica +contrib.category.simulation = Simulazione +contrib.category.sound = Suono +contrib.category.typography = Tipografia +contrib.category.utilities = Utilità +contrib.category.video_vision = Video & Grafica +contrib.category.other = Altro + +# Install on Startup +contrib.startup.errors.download_install = Errore durante il download e installazione di %s +contrib.startup.errors.temp_dir = Impossibile scrivere nella cartella temporanea durante il download e installazione di %s +contrib.startup.errors.new_marker = Il selezionatore dei contributi non aggiornato sembra non essere compatibile con %s. Dovresti installarlo manualmente per poterlo aggiornare... + +# Install on Import +contrib.import.dialog.title = Librerie mancanti disponibili +contrib.import.dialog.primary_text = Le seguenti librerie importate sono disponibili per il download, ma non sono state installate. +contrib.import.dialog.secondary_text = Vorresti installarle ora? +contrib.import.progress.download = Scaricando %s... +contrib.import.progress.install = Installando %s... +contrib.import.progress.done = %s è stato installato. +contrib.import.progress.final_list = LE seguenti librerie sono state installate: +contrib.import.errors.link = Errore: la libreria %s ha uno strano link di download. + +# --------------------------------------- +# Warnings + +warn.delete = Elimina +warn.delete.sketch = Sei sicuro di voler eliminare questo sketch? +warn.delete.file = Sei sicuro di voler eliminare "%s"? +warn.cannot_change_mode.title = Impossibile cambiare modalità +warn.cannot_change_mode.body = Impossibile cambiare modalità,\npoichè la modalità "%s" non è compatibile con quella corrente. + + +# --------------------------------------- +# Update Check + +update_check = Aggiorna +update_check.updates_available.core = Una nuova versione di Processing è disponibile,\nvuoi visitare la pagina di download del sito di Processing? +update_check.updates_available.contributions = Ci sono aggiornamenti disponibili per alcuni dei contributi installati,\nvorresti aprire il gestore dei contributi ora? + +# --------------------------------------- +# Color Chooser + +color_chooser = Selezionatore dei colori +color_chooser.select = Seleziona + +# --------------------------------------- +# Movie Maker + +movie_maker = Creatore di filmati +movie_maker.title = QuickTime Movie Maker +movie_maker.blurb = Questo strumento crea un filmato QuickTime a partire da una sequenza di immagini.

Per evitare artifatti causati dalla ri-compressone di immagini in video,
usa immagini TIFF, TGA (da Processing), o PNG come sorgenti.

Immagini TIFF e TGA verranno scritte più rapidamente, ma richiederanno più memoria:
saveFrame("frames/####.tif");
saveFrame("frames/####.tga");

Le immagini PNG sono più piccole, ma il tuo sketch verrà eseguito più lentamente:
saveFrame("frames/####.png");

This codice è basato su QuickTime Movie Maker 1.5.1 2011-01-17.
Copyright © 2010-2011 Werner Randelshofer. Tutti i diritti riservati
+movie_maker.image_folder_help_label = Trascina una cartella con immagini dentro il campo qui sotto: +movie_maker.choose_button = Scegli... +movie_maker.select_image_folder = Seleziona la cartella con le immagini... +movie_maker.sound_file_help_label = Trascina un file audio nel campo qui sotto (.au, .aiff, .wav, .mp3): +movie_maker.select_sound_file = Seleziona un file audio... + +movie_maker.create_movie_button = Crea filmato... +movie_maker.save_dialog_prompt = Salva filmato come... +movie_maker.width = Larghezza: +movie_maker.height = Altezza: +movie_maker.compression = Compressione: +movie_maker.compression.animation = Animazione +movie_maker.compression.jpeg = JPEG +movie_maker.compression.png = PNG +movie_maker.framerate = Fotogrammi al secondo: +movie_maker.orig_size_button = Stessa dimensione degli originali +movie_maker.orig_size_tooltip = Seleziona questa opzione se la cartalla contiene già fotogrammi della dimensione desiderata. + +movie_maker.error.avoid_tiff = Prova immagini TGA o PNG al posto di TIFF. +movie_maker.error.badnumbers = Larghezza e altezza devono essere numeri interi positivi; il numero di fotogrammi al secondo deve essere un numero positivo. +movie_maker.error.cannot_read = Impossibile leggere %s. +movie_maker.error.cannot_read_maybe_bad = Impossibile leggere %s; potrebbe non andare bene. +movie_maker.error.movie_failed = Creazione del filmato QuickTime fallita. +movie_maker.error.need_input = Dovresti specificare la cartella con i file delle immagini o dei suoni, o entrambe. +movie_maker.error.no_images_found = Nessun file immagine trovato. +movie_maker.error.sorry = Mi dispiace +movie_maker.error.unknown_tga_format = Sconosciuto formato di file .tga per %s. + +movie_maker.progress.creating_file_name = Creando %s. +movie_maker.progress.creating_output_file = Creando il file di output +movie_maker.progress.initializing = Inizializzando... +movie_maker.progress.processing = Processando %s. diff --git a/build/shared/lib/languages/PDE_ja.properties b/build/shared/lib/languages/PDE_ja.properties index d0435669ab..f0bc510298 100644 --- a/build/shared/lib/languages/PDE_ja.properties +++ b/build/shared/lib/languages/PDE_ja.properties @@ -1,7 +1,7 @@ # --------------------------------------- -# JAPANESE (ja) +# Language: Japanese (日本語) (ja) # --------------------------------------- @@ -13,32 +13,35 @@ menu.file = ファイル menu.file.new = 新規 menu.file.open = 開く... -menu.file.sketchbook = スケッチブック menu.file.recent = 最近開いたファイル +menu.file.sketchbook = スケッチブック... +menu.file.sketchbook.empty = 空のスケッチブック menu.file.examples = サンプル... menu.file.close = 閉じる menu.file.save = 保存 menu.file.save_as = 名前を付けて保存... -menu.file.export_application = エクスポート +menu.file.export_application = アプリケーションとしてエクスポート... menu.file.page_setup = ページ設定 -menu.file.print = プリント -menu.file.preferences = 設定 +menu.file.print = 印刷... +menu.file.preferences = 設定... menu.file.quit = 終了 # | File | Edit | Sketch | Debug | Tools | Help | # | Edit | menu.edit = 編集 -menu.edit.undo = 戻す +menu.edit.undo = 元に戻す menu.edit.redo = やり直し +menu.edit.action.addition = addition +menu.edit.action.deletion = deletion menu.edit.cut = 切り取り -menu.edit.copy = 複製 +menu.edit.copy = コピー menu.edit.copy_as_html = HTMLとしてコピー menu.edit.paste = 貼り付け menu.edit.select_all = すべて選択 menu.edit.auto_format = 自動フォーマット menu.edit.comment_uncomment = コメント/アンコメント -menu.edit.increase_indent = インデントを上げる -menu.edit.decrease_indent = インデントを下げる +menu.edit.increase_indent = → インデントを増やす +menu.edit.decrease_indent = ← インデントを減らす menu.edit.find = 検索... menu.edit.find_next = 次を探す menu.edit.find_previous = 前を探す @@ -46,41 +49,71 @@ menu.edit.use_selection_for_find = 選択を検索 # | File | Edit | Sketch | Debug | Tools | Help | # | Sketch | -menu.sketch.run = Run -menu.sketch.present = Present +menu.sketch.run = 実行 +menu.sketch.present = プレゼンテーション menu.sketch.tweak = Tweak -menu.sketch.stop = Stop +menu.sketch.stop = 停止 # --- -menu.library = ライブラリのインポート... -menu.library.add_library = ライブラリの追加... -menu.library.contributed = 貢献 +menu.library = ライブラリをインポート... +menu.library.add_library = ライブラリを追加... +menu.library.contributed = Contributed menu.library.no_core_libraries = モードにコアライブラリがありません # --- menu.sketch = スケッチ -menu.sketch.show_sketch_folder = スケッチフォルダを開く +menu.sketch.show_sketch_folder = スケッチフォルダーを開く menu.sketch.add_file = ファイルを追加... # | File | Edit | Sketch | Debug | Tools | Help | # | Debug | -# ... +menu.debug = デバッグ +menu.debug.enable = デバッガを有効化 +menu.debug.disable = デバッガを無効化 +#menu.debug.show_debug_toolbar = Show Debug Toolbar +#menu.debug.debug = Debug +#menu.debug.stop = Stop +# --- +menu.debug.toggle_breakpoint = ブレークポイントを切り替え +#menu.debug.list_breakpoints = List breakpoints +# --- +# used for both menus and toolbars +menu.debug.step = ステップ +menu.debug.step_into = ステップイン +menu.debug.step_out = ステップアウト +menu.debug.continue = 続行 +# --- +#menu.debug.print_stack_trace = Print Stack Trace +#menu.debug.print_locals = Print Locals +#menu.debug.print_fields = Print Fields +#menu.debug.print_source_location = Print Source Location +#menu.debug.print_threads = Print Threads +# --- +#menu.debug.variable_inspector = Variable Inspector +menu.debug.show_variables = 変数を表示 +menu.debug.hide_variables = 変数を隠す +#menu.debug.show_sketch_outline = Show Sketch Outline +#menu.debug.show_tabs_list = Show Tabs List # | File | Edit | Sketch | Debug | Tools | Help | # | Tools | menu.tools = ツール +menu.tools.color_selector = 色選択... menu.tools.create_font = フォント作成... -menu.tools.color_selector = 色選択 menu.tools.archive_sketch = スケッチをアーカイブ menu.tools.fix_the_serial_lbrary = シリアルライブラリを修正 -menu.tools.install_processing_java = "processing-java"をインストール +menu.tools.install_processing_java = "processing-java" をインストール menu.tools.add_tool = ツールを追加... # | File | Edit | Sketch | Debug | Tools | Help | # | Help | menu.help = ヘルプ -menu.help.about = About Processing +menu.help.welcome = Processing 3 へようこそ +menu.help.about = Processing について menu.help.environment = 環境 -menu.help.reference = 参照 -menu.help.find_in_reference = 参照から探す +menu.help.reference = リファレンス +menu.help.find_in_reference = リファレンスから探す +menu.help.libraries_reference = ライブラリ・リファレンス +menu.help.tools_reference = ツール・リファレンス +menu.help.empty = (空) menu.help.online = オンライン menu.help.getting_started = はじめの一歩 menu.help.getting_started.url = http://processing.org/learning/gettingstarted/ @@ -88,9 +121,9 @@ menu.help.troubleshooting = 問題解決 menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting menu.help.faq = よくある質問 menu.help.faq.url = http://wiki.processing.org/w/FAQ -menu.help.foundation = The Processing Foundation +menu.help.foundation = Processing Foundation menu.help.foundation.url = http://processing.org/foundation/ -menu.help.visit = Processing.orgを訪ねる +menu.help.visit = Processing.org にアクセスする menu.help.visit.url = http://processing.org/ @@ -98,83 +131,113 @@ menu.help.visit.url = http://processing.org/ # Basics # Buttons -prompt.yes = Yes -prompt.no = No -prompt.cancel = Cancel +prompt.yes = はい +prompt.no = いいえ +prompt.cancel = キャンセル prompt.ok = OK -prompt.browse = Browse -prompt.export = Export +prompt.browse = 参照 +prompt.export = エクスポート # --------------------------------------- # Frames # Open (Frame) -open = Open a Processing sketch... +open = Processing スケッチを開く... # Save (Frame) -save = Save sketch folder as... -save.title = Do you want to save changes to this sketch
before closing? -save.hint = If you don't save, your changes will be lost. -save.btn.save = Save -save.btn.dont_save = Don't Save +save = スケッチフォルダーを名前を付けて保存... +save.title = 閉じる前に %s
への変更を保存しますか? +save.hint = 保存しなければ、変更は失われます。 +save.btn.save = 保存する +save.btn.dont_save = 保存しない + +# Close (Frame) also used to prompt on non-OS X machines +close.unsaved_changes = %s への変更を保存しますか? # Preferences (Frame) preferences = 設定 -preferences.button.width = 80 +preferences.button.width = 120 preferences.requires_restart = Processingの再起動が必要です preferences.sketchbook_location = スケッチブックの場所 +preferences.sketchbook_location.popup = スケッチブックの場所 preferences.language = 言語 -preferences.editor_and_console_font = エディタ・コンソールフォント +preferences.editor_and_console_font = エディタとコンソールのフォント +preferences.editor_and_console_font.tip = Select the font used in the Editor and the Console.
Only monospaced (fixed-width) fonts may be used,
though the list may be imperfect. preferences.editor_font_size = エディタフォントサイズ preferences.console_font_size = コンソールフォントサイズ +preferences.zoom = インターフェース拡大率 +preferences.zoom.auto = 自動 preferences.background_color = プレゼンテーションの背景色 +preferences.background_color.tip = Select the background color used when using Present.
Present is used to present a sketch in full-screen,
accessible from the Sketch menu. preferences.use_smooth_text = エディタウィンドウでスムーズテキストを使う preferences.enable_complex_text_input = 複雑なテキスト入力を有効にする preferences.enable_complex_text_input_example = 例:日本語 preferences.continuously_check = エラーのために継続的にチェックする -preferences.show_warnings = ワーニングを表示する +preferences.show_warnings = 警告を表示する preferences.code_completion = コード補完 preferences.trigger_with = 起動 -preferences.cmd_space = スペース +preferences.cmd_space = space +preferences.suggest_imports = import 宣言をサジェストする preferences.increase_max_memory = 有効な最大メモリを増やす -preferences.delete_previous_folder_on_export = エクスポート時に以前のフォルダを削除する -preferences.hide_toolbar_background_image = タブ/ツールバーの背景画像を隠す -preferences.check_for_updates_on_startup = 起動時にアップデートをチェックする -preferences.run_sketches_on_display = ディスプレイでスケッチを実行する -preferences.run_sketches_on_display.tip = \ -スケッチが最初に置かれるディスプレイをセットして下さい
\ -通常、スケッチウィンドウを動かすと、同じ位置に
\ -再び開かれますが、プレゼント(フルスクリーン)モードで
\ -実行している場合、このディスプレイが常に使用されます。 -preferences.automatically_associate_pde_files = 自動的に.pdeファイルをProcessingに関連付ける +preferences.delete_previous_folder_on_export = エクスポート時に以前のフォルダーを削除する +preferences.check_for_updates_on_startup = 起動時に更新をチェックする +preferences.run_sketches_on_display = スケッチを実行するディスプレイ +preferences.run_sketches_on_display.tip = スケッチが最初に置かれるディスプレイをセットして下さい。
通常、スケッチウィンドウを動かすと、同じ位置に再び開かれますが、
プレゼンテーション(フルスクリーン)モードで実行している場合、
このディスプレイが常に使用されます。 +preferences.automatically_associate_pde_files = 自動的に .pde ファイルを Processing に関連付ける preferences.launch_programs_in = プログラムを起動する preferences.launch_programs_in.mode = モード -preferences.file = さらなる設定は次のファイルを直接編集することで可能です -preferences.file.hint = Processingが起動していない時のみ編集できます +preferences.file = 詳細な設定は次のファイルを直接編集することで可能です +preferences.file.hint = Processing が起動していない時のみ編集できます # Sketchbook Location (Frame) -preferences.sketchbook_location = スケッチブックの場所 +sketchbook_location = 新規スケッチブックの場所を選択 + +# Sketchbook (Frame) +sketchbook = スケッチブック +sketchbook.tree = スケッチブック + +# Examples (Frame) +examples.title = %s サンプル +examples.add_examples = サンプルを追加... +examples.libraries = Contributed Libraries +examples.core_libraries = ライブラリ +examples.contributed = Contributed Examples # Export (Frame) export = エクスポートオプション export.platforms = プラットフォーム export.options = オプション -export.options.fullscreen = フルスクリーン(プレゼンテーションモード) +export.options.present = プレゼンテーションモード export.options.show_stop_button = 停止ボタンを表示する export.description.line1 = 選択されたプラットフォーム用のスタンドアロンの -export.description.line2 = アプリケーションとしてエクスポートします +export.description.line2 = アプリケーションとして書き出します。 +export.unsaved_changes = エクスポートの前に変更を保存しますか? +export.notice.cancel.unsaved_changes = Export canceled, changes must first be saved. +export.notice.exporting = アプリケーションとしてエクスポートしています... +export.notice.exporting.done = エクスポートが完了しました。 +export.notice.exporting.error = エクスポート中にエラーが発生しました。 +export.notice.exporting.cancel = アプリケーションへのエクスポートがキャンセルされました。 +export.tooltip.macosx = Mac OS X 用のエクスポートは Mac OS X でのみ利用可能です +export.full_screen = フルスクリーン +export.embed_java = Java の埋め込み +export.embed_java.for = Embed Java for +export.code_signing = Code Signing +export.messages.is_read_only = スケッチが読込み専用です +export.messages.is_read_only.description = Some files are marked "read-only", so you will\nneed to re-save the sketch in another location,\nand try again. +export.messages.cannot_export = エクスポートできません +export.messages.cannot_export.description = 保存されていないスケッチをエクスポートすることはできません。 # Find (Frame) find = 検索 find.find = 検索: -find.replace_with = 置き換える: -find.ignore_case = ケースを無視 +find.replace_with = 置換: +find.ignore_case = 大文字小文字を区別しない find.all_tabs = すべてのタブ find.wrap_around = 折り返し find.btn.replace_all = すべて置換 find.btn.replace = 置換 -find.btn.find_and_replace = 検索&置換 +find.btn.replace_and_find = 置換&検索 find.btn.previous = 前 find.btn.find = 検索 @@ -186,44 +249,341 @@ file = スケッチにコピーする画像やその他のデータファイル # Create Font (Frame) create_font = フォント作成 +create_font.label = Use this tool to create bitmap fonts for your program.\nSelect a font and size, and click 'OK' to generate the font.\nIt will be added to the data folder of the current sketch. +create_font.size = サイズ +create_font.smooth = スムーズ +create_font.characters = 文字... +create_font.character_selector = 文字選択 +create_font.character_selector.label = Default characters will include most bitmaps for Mac OS\nand Windows Latin scripts. Including all characters may\nrequire large amounts of memory for all of the bitmaps.\nFor greater control, you can select specific Unicode blocks. +create_font.default_characters = デフォルトの文字 +create_font.all_characters = すべての文字 +create_font.specific_unicode = 特定のUnicodeブロック +create_font.filename = ファイル名 # Color Selector (Frame) color_selector = 色選択 # Archive Sketch (Frame) -archive_sketch = スケッチをアーカイブする... +archive_sketch = スケッチを名前を付けてアーカイブする... + +# Tweak Mode +tweak_mode = Tweak モード +tweak_mode.save_before_tweak = Tweak モードで実行する前にスケッチを保存して下さい。 +tweak_mode.keep_changes.line1 = 変更を保持しますか? +tweak_mode.keep_changes.line2 = このスケッチで値を変更しました。変更を保持しますか? +# DebugTray +debugger.name = 名前 +debugger.value = 値 +debugger.type = 型 # --------------------------------------- -# Toolbar +# Toolbars # [Run/Present] [Stop] [New] [Open] [Save] -# スケッチのメニュー部分は日本語が表示できないため、英語のままにする -toolbar.run = Run -toolbar.present = Present -toolbar.stop = Stop +toolbar.run = 実行 +toolbar.present = プレゼンテーション +toolbar.stop = 停止 +toolbar.debug = デバッグ # --- -toolbar.new = New -toolbar.open = Open -toolbar.save = Save +toolbar.new = 新規 +toolbar.open = 開く +toolbar.save = 保存 + toolbar.export_application = Export Application toolbar.add_mode = モードの追加... +# [Debug] [Continue] [Step] [Stop] [Toggle Breakpoints] [Variable Inspector] +#toolbar.debug.continue = Continue +#toolbar.debug.step = Step +#toolbar.debug.step_into = Step Into +#toolbar.debug.stop = Stop +#toolbar.debug.toggle_breakpoints = Toggle Breakpoint +#toolbar.debug.variable_inspector = Variable Inspector + # --------------------------------------- # Editor # [Tab1] [Tab2] [v] editor.header.new_tab = 新規タブ -editor.header.rename = リネーム +editor.header.rename = 名前の変更 editor.header.delete = 削除 editor.header.previous_tab = 前のタブ editor.header.next_tab = 次のタブ -editor.header.delete.warning.title = Yeah, no. -editor.header.delete.warning.text = 最後に開いたスケッチの最後のタブは削除できません - +editor.header.delete.warning.title = いや、うん。 +editor.header.delete.warning.text = 開いただけのスケッチのメインタブは削除できません。 + +# PopUp menu +editor.popup.jump_to_declaration = 宣言に移動 +editor.popup.show_usage = 用法の表示... +editor.popup.rename = 名前の変更... + +# Tabs +editor.tab.new = 新規名 +editor.tab.new.description = 新しいファイルの名前 +editor.tab.rename = 新規名 +editor.tab.rename.description = ファイルの新しい名前 + +# Sketch +editor.sketch.rename.description = スケッチの新しい名前 + +editor.status.autoformat.no_changes = No changes necessary for Auto Format. +editor.status.autoformat.finished = 自動フォーマットが完了しました。 +editor.status.find_reference.select_word_first = First select a word to find in the reference. +editor.status.find_reference.not_available = "%s" のリファレンスは利用できません。 +editor.status.drag_and_drop.files_added.0 = スケッチに追加されたファイルはありませんでした。 +editor.status.drag_and_drop.files_added.1 = 1 個のファイルがスケッチに追加されました。 +editor.status.drag_and_drop.files_added.n = %d 個のファイルがスケッチに追加されました。 +editor.status.saving = 保存しています... +editor.status.saving.done = 保存が完了しました。 +editor.status.saving.canceled = 保存がキャンセルされました。 +editor.status.printing = 印刷しています... +editor.status.printing.done = 印刷が完了しました。 +editor.status.printing.error = 印刷中にエラーが発生しました。 +editor.status.printing.canceled = 印刷がキャンセルされました。 +editor.status.copy_as_html = HTMLとしてフォーマットされたコードがクリップボードにコピーされました。 +editor.status.debug.busy = Debugger busy... +editor.status.debug.halt = Debugger halted. +editor.status.archiver.create = アーカイブ "%s" を作成しました。 +editor.status.archiver.cancel = スケッチのアーカイブがキャンセルされました。 + +# Errors +editor.status.warning = 警告 +editor.status.error = エラー +editor.status.error_on = "%s" でエラー +editor.status.missing.default = "%c" がありません +editor.status.missing.semicolon = セミコロン ";" がありません +editor.status.missing.left_sq_bracket = Missing left square bracket "[" +editor.status.missing.right_sq_bracket = Missing right square bracket "]" +editor.status.missing.left_paren = Missing left parenthesis "(" +editor.status.missing.right_paren = Missing right parenthesis ")" +editor.status.missing.left_curly_bracket = Missing left curly bracket "{" +editor.status.missing.right_curly_bracket = Missing right curly bracket "}" +editor.status.missing.add = "%s" の追加を考えてください +editor.status.reserved_words = "color" and "int" are reserved words & cannot be used as variable names +editor.status.undefined_method = 関数 "%s(%s)" は存在しません +editor.status.undefined_constructor = コンストラクター "%s(%s)" は存在しません +editor.status.empty_param = The function "%s()" does not expect any parameters +editor.status.wrong_param = The function "%s()" expects parameters like: "%s(%s)" +editor.status.undef_global_var = グローバル変数 "%s" は存在しません +editor.status.undef_class = クラス "%s" は存在しません +editor.status.undef_var = 変数 "%s" は存在しません +editor.status.undef_name = The name "%s" cannot be recognized +editor.status.type_mismatch = Type mismatch, "%s" does not match with "%s" +editor.status.unused_variable = ローカル変数 "%s" の値は使われていません +editor.status.uninitialized_variable = The local variable "%s" may not have been initialized +editor.status.no_effect_assignment = The assignment to variable "%s" has no effect + +# Footer buttons +editor.footer.errors = エラー +editor.footer.errors.problem = 問題 +editor.footer.errors.tab = タブ +editor.footer.errors.line = 行 +editor.footer.console = コンソール + +# New handler +new.messages.is_read_only = スケッチが読込み専用です +new.messages.is_read_only.description = Some files are marked "read-only", so you will\nneed to re-save the sketch in another location,\nand try again. + +# Rename handler +rename.messages.is_untitled = スケッチが無題です +rename.messages.is_untitled.description = How about saving the sketch first\nbefore trying to rename it? +rename.messages.is_modified = 名前の変更の前にスケッチを保存して下さい。 +rename.messages.is_read_only = スケッチが読込み専用です +rename.messages.is_read_only.description = Some files are marked "read-only", so you will\nneed to re-save the sketch in another location,\nand try again. + +# Naming handler +name.messages.problem_renaming = 名前の変更中に問題が起きました +name.messages.starts_with_dot.description = 名前をピリオドで始めることはできません。 +name.messages.invalid_extension.description = ".%s" is not a valid extension. +name.messages.main_java_extension.description = The first tab cannot be a .%s file.\n(It may be time for you to graduate to a\n"real" programming environment, hotshot.) +name.messages.new_sketch_exists = Nope +name.messages.new_sketch_exists.description = A file named "%s" already exists at\n"%s" +name.messages.new_folder_exists = 名前を変更できません +name.messages.new_folder_exists.description = Sorry, a sketch (or folder) named "%s" already exists. +name.messages.error = エラー +name.messages.no_rename_folder.description = スケッチフォルダー名を変更できませんでした。 +name.messages.no_rename_file.description = Could not rename "%s" to "%s" +name.messages.no_create_file.description = Could not create the file "%s"\nin "%s" + +# Delete handler +delete.messages.cannot_delete = 削除できません +delete.messages.cannot_delete.description = 保存されていないスケッチを削除することはできません。 +delete.messages.cannot_delete.file = Could not do it +delete.messages.cannot_delete.file.description = 削除できませんでした +delete.messages.is_read_only = スケッチが読込み専用です +delete.messages.is_read_only.description = Some files are marked "read-only", so you will\nneed to re-save the sketch in another location,\nand try again. + +# Save handler +save_file.messages.is_read_only = スケッチが読込み専用です +save_file.messages.is_read_only.description = Some files are marked "read-only", so you will\nneed to re-save this sketch to another location. +save_file.messages.sketch_exists = 保存できません +save_file.messages.sketch_exists.description = A sketch with the cleaned name\n“%s” already exists. +save_file.messages.tab_exists = Nope +save_file.messages.tab_exists.description = You cannot save the sketch as "%s"\nbecause the sketch already has a tab with that name. +save_file.messages.recursive_save = How very Borges of you +save_file.messages.recursive_save.description = You cannot save the sketch into a folder\ninside itself. This would go on forever. + +# Add handler +add_file.messages.is_read_only = スケッチが読込み専用です +add_file.messages.is_read_only.description = Some files are marked "read-only", so you will\nneed to re-save the sketch in another location,\nand try again. +add_file.messages.confirm_replace = Replace the existing version of %s? +add_file.messages.error_adding = ファイルの追加中にエラーが発生しました +add_file.messages.cannot_delete.description = Could not delete the existing '%s' file. +add_file.messages.cannot_add.description = Could not add '%s' to the sketch. +add_file.messages.same_file = You can't fool me +add_file.messages.same_file.description = This file has already been copied to the\nlocation from which where you're trying to add it.\nI ain't not doin nuthin'. + +# Temp folder creator +temp_dir.messages.bad_build_folder = Build folder bad +temp_dir.messages.bad_build_folder.description = Could not find a place to build the sketch. + +# Ensure Existance +ensure_exist.messages.missing_sketch = Sketch Disappeared +ensure_exist.messages.missing_sketch.description = The sketch folder has disappeared.\nWill attempt to re-save in the same location,\nbut anything besides the code will be lost. +ensure_exist.messages.unrecoverable = Could not re-save sketch +ensure_exist.messages.unrecoverable.description = Could not properly re-save the sketch. You may be in trouble at this point,\nand it might be time to copy and paste your code to another text editor. + +# Check name +check_name.messages.is_name_modified = The sketch name had to be modified. Sketch names can only consist\nof ASCII characters and numbers (but cannot start with a number).\nThey should also be less than 64 characters long. # --------------------------------------- -# Contribution Panel +# Contributions +# Contribution Panel +contrib = Contribution Manager +contrib.manager_title.update = アップデートマネージャー +contrib.manager_title.mode = モードマネージャー +contrib.manager_title.tool = ツールマネージャー +contrib.manager_title.library = ライブラリマネージャー +contrib.manager_title.examples = サンプルマネージャー contrib.category = カテゴリ: contrib.filter_your_search = 検索をフィルタ... +contrib.show_only_compatible.mode = Show Only Compatible Modes +contrib.show_only_compatible.tool = Show Only Compatible Tools +contrib.show_only_compatible.library = Show Only Compatible Libraries +contrib.show_only_compatible.examples = Show Only Compatible Examples +contrib.show_only_compatible.update = Show Only Compatible Updates +contrib.restart = Restart Processing +contrib.unsaved_changes = Unsaved changes have been found +contrib.unsaved_changes.prompt = Are you sure you want to restart Processing without saving first? +contrib.messages.remove_restart = Please restart Processing to finish removing this item. +contrib.messages.install_restart = Please restart Processing to finish installing this item. +contrib.messages.update_restart = Please restart Processing to finish updating this item. +contrib.errors.list_download = Could not download the list of available contributions. +contrib.errors.list_download.timeout = Connection timed out while downloading the contribution list. +contrib.errors.download_and_install = Error during download and install of %s. +contrib.errors.description_unavailable = Description unavailable. +contrib.errors.malformed_url = The link fetched from Processing.org is not valid.\nYou can still install this library manually by visiting\nthe library\'s website. +contrib.errors.needs_repackage = %s needs to be repackaged according to the %s guidelines. +contrib.errors.no_contribution_found = Could not find a %s in the downloaded file. +contrib.errors.overwriting_properties = Error overwriting .properties file. +contrib.errors.install_failed = インストールに失敗しました。 +contrib.errors.update_on_restart_failed = Update on restart of %s failed. +contrib.errors.temporary_directory = 一時ディレクトリに書き込めませんでした。 +contrib.errors.contrib_download.timeout = %sをダウンロード中に接続がタイムアウトしました。 +contrib.errors.no_internet_connection = インターネットに接続されていないようです。 +contrib.status.downloading_list = Downloading contribution list... +contrib.status.connecting = 接続しています... +contrib.status.done = Done. +contrib.all = すべて +contrib.undo = 元に戻す +contrib.remove = 削除 +contrib.install = インストール +contrib.progress.installing = インストール中 +contrib.progress.starting = 開始中 +contrib.progress.downloading = ダウンロード中 +contrib.download_error = An error occured while downloading the contribution. +contrib.unsupported_operating_system = Your operating system does not appear to be supported. You should visit the %s\'s library for more info. +contrib.category.3d = 3D +contrib.category.animation = Animation +contrib.category.data = Data +contrib.category.geometry = Geometry +contrib.category.gui = GUI +contrib.category.hardware = Hardware +contrib.category.i_o = I/O +contrib.category.math = Math +contrib.category.simulation = Simulation +contrib.category.sound = Sound +contrib.category.typography = Typography +contrib.category.utilities = Utilities +contrib.category.video_vision = Video & Vision +contrib.category.other = Other + +# Install on Startup +contrib.startup.errors.download_install = Error during download and install of %s +contrib.startup.errors.temp_dir = Could not write to temporary directory during download and install of %s +contrib.startup.errors.new_marker = The unupdated contribution marker seems to not like %s. You may have to install it manually to update... + +# Install on Import +contrib.import.dialog.title = Missing Libraries Available +contrib.import.dialog.primary_text = The following imported libraries are available for download, but have not been installed. +contrib.import.dialog.secondary_text = Would you like to install them now? +contrib.import.progress.download = %sをダウンロードしています... +contrib.import.progress.install = %sをインストールしています... +contrib.import.progress.done = %sがインストールされました。 +contrib.import.progress.final_list = The following libraries have been installed: +contrib.import.errors.link = Error: The library %s has a strange looking download link. + +# --------------------------------------- +# Warnings + +warn.delete = 削除 +warn.delete.sketch = このスケッチを削除してもよろしいですか? +warn.delete.file = "%s"を削除してもよろしいですか? +warn.cannot_change_mode.title = モード変更失敗 +warn.cannot_change_mode.body = 互換性がないため、"%s"モードに切り替えられません。 + + +# --------------------------------------- +# Update Check + +update_check = 更新 +update_check.updates_available.core = 新しいバージョンのProcessingが利用可能です。\nProcessingのダウンロードページにアクセスしますか? +update_check.updates_available.contributions = There are updates available for some of the installed contributions,\nwould you like to open the the Contribution Manager now? + + +# --------------------------------------- +# Color Chooser + +color_chooser = カラーセレクター +color_chooser.select = 選択 + +# --------------------------------------- +# Movie Maker + +movie_maker = ムービーメーカー +movie_maker.title = QuickTime ムービーメーカー +movie_maker.blurb = This tool creates a QuickTime movie from a sequence of images.

To avoid artifacts caused by re-compressing images as video,
use TIFF, TGA (from Processing), or PNG images as the source.

TIFF and TGA images will write more quickly, but require more disk:
saveFrame("frames/####.tif");
saveFrame("frames/####.tga");

PNG images are smaller, but your sketch will run more slowly:
saveFrame("frames/####.png");

This code is based on QuickTime Movie Maker 1.5.1 2011-01-17.
Copyright © 2010-2011 Werner Randelshofer. All rights reserved.
+movie_maker.image_folder_help_label = Drag a folder with image files into the field below: +movie_maker.choose_button = 選択... +movie_maker.select_image_folder = 画像フォルダーを選択... +movie_maker.sound_file_help_label = Drag a sound file into the field below (.au, .aiff, .wav, .mp3): +movie_maker.select_sound_file = 音声ファイルを選択... + +movie_maker.create_movie_button = 動画を作成... +movie_maker.save_dialog_prompt = Save movie as... +movie_maker.width = 幅: +movie_maker.height = 高さ: +movie_maker.compression = 圧縮: +movie_maker.compression.animation = Animation +movie_maker.compression.jpeg = JPEG +movie_maker.compression.png = PNG +movie_maker.framerate = フレームレート: +movie_maker.orig_size_button = オリジナルと同じサイズ +movie_maker.orig_size_tooltip = Check this box if the folder contains already encoded video frames in the desired size. + +movie_maker.error.avoid_tiff = Try TGA or PNG images instead of TIFF. +movie_maker.error.badnumbers = Width and height must be whole numbers greater than zero; framerate must be a number greater than zero. +movie_maker.error.cannot_read = Could not read %s. +movie_maker.error.cannot_read_maybe_bad = Could not read %s; it may be bad. +movie_maker.error.movie_failed = Creating the QuickTime movie failed. +movie_maker.error.need_input = You need to specify the folder with image files, the sound file, or both. +movie_maker.error.no_images_found = No image files found. +movie_maker.error.sorry = Sorry +movie_maker.error.unknown_tga_format = Unknown .tga file format for %s. + +movie_maker.progress.creating_file_name = Creating %s. +movie_maker.progress.creating_output_file = Creating output file +movie_maker.progress.initializing = Initializing... +movie_maker.progress.processing = Processing %s. diff --git a/build/shared/lib/languages/PDE_ko.properties b/build/shared/lib/languages/PDE_ko.properties index 9043303ec4..e60e088be7 100644 --- a/build/shared/lib/languages/PDE_ko.properties +++ b/build/shared/lib/languages/PDE_ko.properties @@ -15,7 +15,7 @@ menu.file.new = 새 스케치 menu.file.open = 열기... menu.file.recent = 최근 스케치 menu.file.sketchbook = 스케치북 -menu.file.sketchbook.empty = 빈 스케치북 +menu.file.sketchbook.empty = 빈 스케치북 menu.file.examples = 예제... menu.file.close = 닫기 menu.file.save = 저장 @@ -38,8 +38,8 @@ menu.edit.paste = 붙이기 menu.edit.select_all = 전체선택 menu.edit.auto_format = 자동 정렬 menu.edit.comment_uncomment = 주석 처리/해제 -menu.edit.increase_indent = 들여쓰기 -menu.edit.decrease_indent = 내어쓰기 +menu.edit.increase_indent = → 들여쓰기 +menu.edit.decrease_indent = ← 내어쓰기 menu.edit.find = 찾기... menu.edit.find_next = 다음 찾기 menu.edit.find_previous = 이전 찾기 @@ -49,8 +49,8 @@ menu.edit.use_selection_for_find = 선택영역으로 찾기 # | Sketch | menu.sketch.run = 실행하기 menu.sketch.present = 전체화면 보기 -menu.sketch.tweak = 변수 조정하기 -menu.sketch.stop = 정지하기 +menu.sketch.tweak = 변수 조정하기 +menu.sketch.stop = 정지하기 # --- menu.library = 내부 라이브러리... menu.library.add_library = 라이브러리 추가하기... @@ -127,7 +127,7 @@ preferences.requires_restart = 프로세싱 재실행 시 적용 preferences.sketchbook_location = 스케치 폴더 위치 preferences.sketchbook_location.popup = 스케치 폴더 위치 preferences.language = 언어 -preferences.editor_and_console_font = 스케치 에디터와 콘솔 글꼴 선택 +preferences.editor_and_console_font = 스케치 에디터와 콘솔 글꼴 선택 preferences.editor_and_console_font.tip = \ 에디터와 콘솔에서 사용할 폰트 선택하기.
\ Monospaced (fixed-width) 폰트만 리스트에 나타나며,
\ @@ -153,7 +153,7 @@ preferences.check_for_updates_on_startup = 프로그램 시작 시 버전 업데 preferences.run_sketches_on_display = 실행 시 스케치창 디스플레이의 장치 설정 preferences.run_sketches_on_display.tip = \ 멀티스크린 사용 시 실행된 스케치 창을 보여줄 스크린 선택하기.
\ -일반적으로, 스케치 창을 커서로 드래그하여 이동하면 재 실행 시에는 해당 스크린에서 실행되지만
\ +일반적으로, 스케치 창을 커서로 드래그하여 이동하면 재 실행 시에는 해당 스크린에서 실행되지만
\ 전체화면 모드로 실행하는 경우에 설정된 스크린에서만 실행됩니다. preferences.automatically_associate_pde_files = .pde 파일 실행 시 프로세싱으로 자동 연결 preferences.launch_programs_in = 프로그램 실행 @@ -237,13 +237,13 @@ editor.header.delete.warning.title = Yeah, no. editor.header.delete.warning.text = 스케치의 마지막 탭은 삭제할 수 없습니다. # Tabs -editor.tab.new = 새 탭 이름 -editor.tab.new.description = 파일의 새 탭 이름 -editor.tab.rename = 새 탭 이름 -editor.tab.rename.description = 파일의 새 탭 이름 +editor.tab.new = 새 탭 이름 +editor.tab.new.description = 파일의 새 탭 이름 +editor.tab.rename = 새 탭 이름 +editor.tab.rename.description = 파일의 새 탭 이름 # Sketch -editor.sketch.rename.description = 새 스케치 이름 +editor.sketch.rename.description = 새 스케치 이름 editor.status.autoformat.no_changes = 변경할 서식이 없습니다. editor.status.autoformat.finished = 자동 서식 적용 완료 @@ -264,10 +264,10 @@ editor.status.printing.canceled = 인쇄 취소. # --------------------------------------- # Contribution Panel -contrib = 컨트리뷰션 매니저 +contrib = 컨트리뷰션 매니저 contrib.category = 카테고리: contrib.filter_your_search = 검색 필터... -contrib.restart = 프로세싱 다시 시작하기 +contrib.restart = 프로세싱 다시 시작하기 contrib.unsaved_changes = 저장되지 않은 변경 사항이 발견되었습니다. contrib.unsaved_changes.prompt = 정말 변경 사항을 저장하지 않고 프로세싱을 다시 시작하시겠습니까? contrib.messages.remove_restart = 해당 아이템이 완전히 삭제된 후 프로세싱을 다시 시작해 주세요. @@ -282,13 +282,13 @@ contrib.errors.needs_repackage = %s 라이브러리는 해당 프로세싱 버 contrib.errors.no_contribution_found = %s 파일을 다운로드 경로에서 찾을 수 없습니다. contrib.errors.overwriting_properties = .properties 파일 덮어쓰기에 실패하였습니다. contrib.errors.install_failed = 설치 오류 발생. -contrib.errors.update_on_restart_failed = %s 파일은 알 수 없는 오류로 재실행 후에도 사용할 수 없습니다. +contrib.errors.update_on_restart_failed = %s 파일은 알 수 없는 오류로 재실행 후에도 사용할 수 없습니다. contrib.errors.temporary_directory = 임시 디렉터리에 업데이트할 수 없습니다. contrib.all = All contrib.undo = 입력 취소 contrib.remove = 삭제 contrib.install = 설치 -contrib.progress.installing = 설치 중 +contrib.progress.installing = 설치 중 contrib.progress.starting = 시작 중 contrib.progress.downloading = 다운로드 중 contrib.download_error = 해당 파일 다운로드 중 에러 발생하였습니다. @@ -297,18 +297,18 @@ contrib.unsupported_operating_system = 해당 파일 해당 컴퓨터의 운영 # --------------------------------------- # Warnings -warn.delete = 삭제 +warn.delete = 삭제 warn.delete.sketch = 정말 해당 스케치를 삭제하시겠습니까? warn.delete.file = 정말 "%s"를 삭제하시겠습니까? # --------------------------------------- # Update Check -update_check = 업데이트 +update_check = 업데이트 update_check.updates_available.core = 새 버전의 프로세싱 설치가 가능합니다. \n해당 다운로드 페이지로 지금 이동하시겠습니까? update_check.updates_available.contributions = 설치된 컨트리뷰션(도구, 라이브러리, 모드, 예제) 중 일부가 업데이트되었습니다,\n 컨트리뷰션 매니저로 이동하여 확인하시겠습니까? # --------------------------------------- # Color Chooser -color_chooser = 색상 선택 \ No newline at end of file +color_chooser = 색상 선택 \ No newline at end of file diff --git a/build/shared/lib/languages/PDE_nl.properties b/build/shared/lib/languages/PDE_nl.properties index fb2634241a..ee753069f1 100644 --- a/build/shared/lib/languages/PDE_nl.properties +++ b/build/shared/lib/languages/PDE_nl.properties @@ -38,8 +38,8 @@ menu.edit.paste = Plakken menu.edit.select_all = Alles Selecteren menu.edit.auto_format = Automatische Opmaak menu.edit.comment_uncomment = Commentaar Aan/Uit -menu.edit.increase_indent = Inspringen Vergroten -menu.edit.decrease_indent = Inspringen Verkleinen +menu.edit.increase_indent = → Inspringen Vergroten +menu.edit.decrease_indent = ← Inspringen Verkleinen menu.edit.find = Zoeken... menu.edit.find_next = Volgende Zoeken menu.edit.find_previous = Vorige Zoeken diff --git a/build/shared/lib/languages/PDE_pt.properties b/build/shared/lib/languages/PDE_pt.properties index 7842a71830..e8f34420af 100644 --- a/build/shared/lib/languages/PDE_pt.properties +++ b/build/shared/lib/languages/PDE_pt.properties @@ -37,8 +37,8 @@ menu.edit.paste = Colar menu.edit.select_all = Seleccionar Tudo menu.edit.auto_format = Auto Formatar menu.edit.comment_uncomment = Comentar/Descomentar -menu.edit.increase_indent = Aumentar Indentação -menu.edit.decrease_indent = Diminuir Indentação +menu.edit.increase_indent = → Aumentar Indentação +menu.edit.decrease_indent = ← Diminuir Indentação menu.edit.find = Procurar... menu.edit.find_next = Procurar Seguinte menu.edit.find_previous = Procurar Anterior @@ -67,7 +67,7 @@ menu.sketch.add_file = Adicionar Ficheiro... # | File | Edit | Sketch | Debug | Tools | Help | # | Tools | menu.tools = Ferramentas -menu.tools.color_selector = Selector de Côr... +menu.tools.color_selector = Selector de Cor... menu.tools.create_font = Criar Fonte... menu.tools.archive_sketch = Arquivar Sketch menu.tools.fix_the_serial_lbrary = Corrijir a Biblioteca Serial @@ -204,7 +204,7 @@ toolbar.stop = Parar # --- toolbar.new = Novo toolbar.open = Abrir -toolbar.save = Guardr +toolbar.save = Guardar # toolbar.export_application = Exportar Aplicação toolbar.add_mode = Adicionar modo... @@ -218,14 +218,14 @@ editor.header.rename = Renomear editor.header.delete = Apagar editor.header.previous_tab = Aba Anterior editor.header.next_tab = Aba Seguinte -editor.header.delete.warning.title = Yah, não. -editor.header.delete.warning.text = Não pode apagar a última aba do último sketch aberto. +editor.header.delete.warning.title = Ah, não. +editor.header.delete.warning.text = Não se pode apagar a última aba do último sketch aberto. editor.status.autoformat.no_changes = Não foram necessárias alterações para a Auto Formatação. editor.status.autoformat.finished = Auto Formatação completa. editor.status.find_reference.select_word_first = Primeiro escolha uma palavra para procurar na referência. editor.status.find_reference.not_available = Não existe refrência disponivel para "%s". -editor.status.drag_and_drop.files_added.0 = Nenhuns ficheiros foram adicionados ao sketch. +editor.status.drag_and_drop.files_added.0 = Nenhum dos ficheiros foram adicionados ao sketch. editor.status.drag_and_drop.files_added.1 = Um ficheiro adicionado ao sketch. editor.status.drag_and_drop.files_added.n = %d ficheiros adicionados ao sketch. editor.status.saving = A Guardar... @@ -247,5 +247,5 @@ contrib.remove = Refazer contrib.install = Instalar contrib.progress.starting = A iniciar contrib.progress.downloading = A descarregar -contrib.download_error = Ocorreu um erro a descarregar a contribuição. +contrib.download_error = Ocorreu um erro ao descarregar a contribuição. contrib.unsupported_operating_system = O seu sistema operativo não parece ser suportado. Deve visitar a biblioteca %s para mais informação. diff --git a/build/shared/lib/languages/PDE_ru.properties b/build/shared/lib/languages/PDE_ru.properties new file mode 100644 index 0000000000..4995272df2 --- /dev/null +++ b/build/shared/lib/languages/PDE_ru.properties @@ -0,0 +1,604 @@ + + +# --------------------------------------- +# Language: Russian (Русский) (ru) +# --------------------------------------- + + +# --------------------------------------- +# Menu + +# | File | Edit | Sketch | Debug | Tools | Help | +# | File | +menu.file = Файл +menu.file.new = Создать +menu.file.open = Открыть... +menu.file.recent = Недавние +menu.file.sketchbook = Рабочая папка... +menu.file.sketchbook.empty = Пустая рабочая папка +menu.file.examples = Примеры... +menu.file.close = Закрыть +menu.file.save = Сохранить +menu.file.save_as = Сохранить как... +menu.file.export_application = Экспорт приложения... +menu.file.page_setup = Настройка страницы +menu.file.print = Печать... +menu.file.preferences = Параметры... +menu.file.quit = Выход + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Edit | +menu.edit = Правка +menu.edit.undo = Отменить +menu.edit.redo = Повторить +menu.edit.action.addition = добавление +menu.edit.action.deletion = удаление +menu.edit.cut = Вырезать +menu.edit.copy = Копировать +menu.edit.copy_as_html = Скопировать как HTML +menu.edit.paste = Вставить +menu.edit.select_all = Выделить всё +menu.edit.auto_format = Автоформатирование +menu.edit.comment_uncomment = Закомментировать/Раскомментировать +menu.edit.increase_indent = → Увеличить отступ +menu.edit.decrease_indent = ← Уменьшить отступ +menu.edit.find = Найти... +menu.edit.find_next = Найти следущее +menu.edit.find_previous = Найти предыдущее +menu.edit.use_selection_for_find = Найти выделенное + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Sketch | +menu.sketch.run = Запустить +menu.sketch.present = Режим презентации +menu.sketch.tweak = Изменить +menu.sketch.stop = Остановить +# --- +menu.library = Импортировать библиотеку... +menu.library.add_library = Добавить библиотеку... +menu.library.contributed = Вклад сообщества +menu.library.no_core_libraries = отсутствуют основные библиотеки +# --- +menu.sketch = Набросок +menu.sketch.show_sketch_folder = Показать папку с набросками +menu.sketch.add_file = Добавить файл... + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Debug | +menu.debug = Отладка +menu.debug.enable = Включить отладку +menu.debug.disable = Отключить отладку +#menu.debug.show_debug_toolbar = Показать панель отладки +#menu.debug.debug = Начать отладку +#menu.debug.stop = Остановить отладку +# --- +menu.debug.toggle_breakpoint = Поставить/снять точку останова +#menu.debug.list_breakpoints = Список точек останова +# --- +# used for both menus and toolbars +menu.debug.step = Шаг +menu.debug.step_into = Зайти в +menu.debug.step_out = Выйти из +menu.debug.continue = Продолжить +# --- +#menu.debug.print_stack_trace = Печать стека вызовов +#menu.debug.print_locals = Печать локальных переменных +#menu.debug.print_fields = Печать полей +#menu.debug.print_source_location = Печатать расположение источника +#menu.debug.print_threads = Друкувати потоки +# --- +#menu.debug.variable_inspector = Инспектор переменных +menu.debug.show_variables = Показать переменные +menu.debug.hide_variables = Спрятать переменные +#menu.debug.show_sketch_outline = Показать рамку наброска +#menu.debug.show_tabs_list = Показать список вкладок + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Tools | +menu.tools = Инструменты +menu.tools.color_selector = Выбрать цвет... +menu.tools.create_font = Создать шрифты... +menu.tools.archive_sketch = Архивировать набросок +menu.tools.fix_the_serial_lbrary = Исправить библиотеку Serial +menu.tools.install_processing_java = Установить "processing-java" +menu.tools.add_tool = Добавить инструмент... + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Help | +menu.help = Помощь +menu.help.welcome = Добро пожаловать в Processing 3 +menu.help.about = О Processing +menu.help.environment = Среда +menu.help.reference = Документация +menu.help.find_in_reference = Найти в документации +menu.help.libraries_reference = Документация библиотек +menu.help.tools_reference = Документация инструментов +menu.help.empty = (пусто) +menu.help.online = Онлайн +menu.help.getting_started = Начало работы (англ.) +menu.help.getting_started.url = http://processing.org/learning/gettingstarted/ +menu.help.troubleshooting = Решение проблем (англ.) +menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting +menu.help.faq = Часто задаваемые вопросы (англ.) +menu.help.faq.url = http://wiki.processing.org/w/FAQ +menu.help.foundation = The Processing Foundation (англ.) +menu.help.foundation.url = http://processing.org/foundation/ +menu.help.visit = Постетить Processing.org (англ.) +menu.help.visit.url = http://processing.org/ + + +# --------------------------------------- +# Basics + +# Buttons +prompt.yes = Да +prompt.no = Нет +prompt.cancel = Отменить +prompt.ok = ОК +prompt.browse = Просмотр +prompt.export = Экспорт + + +# --------------------------------------- +# Frames + +# Open (Frame) +open = Открыть в Processing... + +# Save (Frame) +save = Сохранить папку как... +save.title = Сохранить изменения %s
перед закрытием? +save.hint = Несохранённые изменения будут потеряны. +save.btn.save = Сохранить +save.btn.dont_save = Не сохранять + +# Close (Frame) also used to prompt on non-OS X machines +close.unsaved_changes = Сохранить изменения в %s? + +# Preferences (Frame) +preferences = Параметры +preferences.button.width = 95 +preferences.requires_restart = требуется перезапуск Processing +preferences.sketchbook_location = Расположение рабочей папки +preferences.sketchbook_location.popup = Расположение рабочей папки +preferences.language = Язык +preferences.editor_and_console_font = Шрифт редактора и консоли +preferences.editor_and_console_font.tip = Выбрать шрифт для использовании в редакторе и консоли.
Возможно использование только моноширинных шрифтов. +preferences.editor_font_size = Размер шрифта редактора +preferences.console_font_size = Размер шрифта консоли +preferences.zoom = Масштабирование интерфейса +preferences.zoom.auto = По умолчанию +preferences.background_color = Цвет фона в режиме презентации +preferences.background_color.tip = Выбрать фоновый цвет для режима презентации.
Режим презентации используется для полноэкранного просмотра
из меню набросок. +preferences.use_smooth_text = Рисовать сглаженный текст в окне редактора +preferences.enable_complex_text_input = Включить расширенное редактирование текста +preferences.enable_complex_text_input_example = напр. японский +preferences.continuously_check = Проверять на ошибки +preferences.show_warnings = Показать предупреждения +preferences.code_completion = Автодополнение кода +preferences.trigger_with = Запуск с помощью +preferences.cmd_space = Пробел +preferences.suggest_imports = Предлагать импорт +preferences.increase_max_memory = Увеличить лимит памяти для наброска +preferences.delete_previous_folder_on_export = Удалять предыдущую папку при экспорте +preferences.check_for_updates_on_startup = Разрешать проверку обновлений (см. ЧаВо для получения информации о используемых данных) +preferences.run_sketches_on_display = Запускать набросок на мониторе +preferences.run_sketches_on_display.tip = Задаёт монитор, на котором будут запускаться наброски.
Обычно, если окно перемещается, то оно будет перезапущено
на том месте, тем не менее при запуске в полноэкранном режиме
всегда используется выбранный монитор. +preferences.automatically_associate_pde_files = Автоматически ассоциировать файлы .pde с Processing +preferences.launch_programs_in = Запускать программы в +preferences.launch_programs_in.mode = Режим +preferences.file = В файле настроек можно найти больше параметров для настройки +preferences.file.hint = не редактируйте его при запущенном Processing + +# Sketchbook Location (Frame) +sketchbook_location = Выбрать новое раположение рабочей папки + +# Sketchbook (Frame) +sketchbook = Рабочая папка +sketchbook.tree = Рабочая папка + +# Examples (Frame) +examples.title = Примеры %s +examples.add_examples = Добавить... +examples.libraries = Библиотеки сообщества +examples.core_libraries = Библиотеки +examples.contributed = Примеры сообщества + +# Export (Frame) +export = Настройка экспорта +export.platforms = Платформы +export.options = Настройки +export.options.present = Режим презентации +export.options.show_stop_button = Показывать кнопку остановки +export.description.line1 = "Экспорт в приложение" создаёт интерактивное, +export.description.line2 = самостоятельное приложение для выбранных платформ. +export.unsaved_changes = Сохранить изменения перед экспортом? +export.notice.cancel.unsaved_changes = Экспорт отменён, сохраните сперва сделанные изменения. +export.notice.exporting = Экспорт приложения... +export.notice.exporting.done = Экспорт завершён. +export.notice.exporting.error = Ошибка при экспорте. +export.notice.exporting.cancel = Экспорт в приложение отменён. +export.tooltip.macosx = Экспорт для Mac OS X доступен только на Mac OS X +export.full_screen = Во весь экран +export.embed_java = Встроенная Java +export.embed_java.for = Встроить Java для +export.code_signing = Цифровая подпись +export.messages.is_read_only = Скетч доступен только для чтения +export.messages.is_read_only.description = Некоторые файлы помечены "только для чтения".\nНужно сперва сохранить их в другом месте\nа затем попробовать заново. +export.messages.cannot_export = Экспорт невозможен +export.messages.cannot_export.description = Нельзя экспортировать несохранённый набросок. + +# Find (Frame) +find = Поиск +find.find = Найти: +find.replace_with = Заменить на: +find.ignore_case = Игнорировать регистр +find.all_tabs = Во всех вкладках +find.wrap_around = По всему документу +find.btn.replace_all = Заменить всё +find.btn.replace = Заменить +find.btn.replace_and_find = Найти и заменить +find.btn.previous = Предыдущий +find.btn.find = Найти + +# Find in reference (Frame) +find_in_reference = Найти в документации + +# File (Frame) +file = Выбрать + +# Create Font (Frame) +create_font = Создать шрифт +create_font.label = Этот инструмент предназначен для создания пользовательских шрифтов.\nВыберите шрифт, его размер и нажмите "ОК", для создания шрифта.\nОн будет сохранён в папке с наброском. +create_font.size = Размер +create_font.smooth = Сглаживание +create_font.characters = Символы... +create_font.character_selector = Выбор символа +create_font.character_selector.label = В стандартные набор символов включены bitmap-ы для Mac OS\nи Windows Latin. Включение всех символов увеличивает потребление памяти.\nДля улучшения ситуации подключайте необходимые блоки Unicode. +create_font.default_characters = Стандартные символы +create_font.all_characters = Все символы +create_font.specific_unicode = Определённые блоки Unicode +create_font.filename = Имя файла + +# Color Selector (Frame) +color_selector = Выбрать цвет + +# Archive Sketch (Frame) +archive_sketch = Архивировать скетч в... + +# Tweak Mode +tweak_mode = Режим редактирования +tweak_mode.save_before_tweak = Сохраните набросок перед переходом в режим редактирования. +tweak_mode.keep_changes.line1 = Сохранить изменения? +tweak_mode.keep_changes.line2 = Вы изменили настройки наброска. Желаете сохранить? + +# DebugTray +debugger.name = Имя +debugger.value = Значения +debugger.type = Тип + +# --------------------------------------- +# Toolbars + +# [Run/Present] [Stop] [New] [Open] [Save] +toolbar.run = Запустить +toolbar.present = Показать +toolbar.stop = Остановить +toolbar.debug = Отладить +# --- +toolbar.new = Новый +toolbar.open = Открыть +toolbar.save = Сохранить +# toolbar.export_application = Экспорт приложения +toolbar.add_mode = Добавить режим... + +# [Debug] [Continue] [Step] [Stop] [Toggle Breakpoints] [Variable Inspector] +#toolbar.debug.continue = Продолжить +#toolbar.debug.step = Шаг +#toolbar.debug.step_into = Зайти в +#toolbar.debug.stop = Остановить +#toolbar.debug.toggle_breakpoints = Поставить/Убрать точку останова +#toolbar.debug.variable_inspector = Экран переменных + + +# --------------------------------------- +# Editor + +# [Tab1] [Tab2] [v] +editor.header.new_tab = Новая вкладка +editor.header.rename = Переименовать +editor.header.delete = Удалить +editor.header.previous_tab = Предыдущая вкладка +editor.header.next_tab = Следующая вкладка +editor.header.delete.warning.title = Да, нет. +editor.header.delete.warning.text = Нельзя удалить основную вкладку открытого наброска. + +# PopUp menu +editor.popup.jump_to_declaration = Перейти к определению +editor.popup.show_usage = Найти использование... +editor.popup.rename = Переименовать... + +# Tabs +editor.tab.new = Новое имя +editor.tab.new.description = Имя нового файла +editor.tab.rename = Новое имя +editor.tab.rename.description = Новое имя файла + +# Sketch +editor.sketch.rename.description = Имя нового наброска + +editor.status.autoformat.no_changes = Автоформатирования не требуется. +editor.status.autoformat.finished = Автоформатирование завершено. +editor.status.find_reference.select_word_first = Сначала выделите слово для поиска в документации. +editor.status.find_reference.not_available = Документация для "%s" недоступна. +editor.status.drag_and_drop.files_added.0 = В скетч не добавлено файлов. +editor.status.drag_and_drop.files_added.1 = Файл добавлен в скетч. +editor.status.drag_and_drop.files_added.n = В скетч добавлено %d файла(-ов). +editor.status.saving = Сохранение... +editor.status.saving.done = Сохранение завершено. +editor.status.saving.canceled = Сохранение отменено. +editor.status.printing = Печать... +editor.status.printing.done = Печать завершена. +editor.status.printing.error = Ошибка печати. +editor.status.printing.canceled = Печать отменена. +editor.status.copy_as_html = Код, форматированный в HTML, скопирован в буфер обмена. +editor.status.debug.busy = Отладчик занят... +editor.status.debug.halt = Отладчик остановлен. +editor.status.archiver.create = "%s" создан. +editor.status.archiver.cancel = Архивирование отменено. + +# Errors +editor.status.warning = Предупреждение +editor.status.error = Ошибка +editor.status.error_on = Ошибка в "%s" +editor.status.missing.default = Пропущен "%c" +editor.status.missing.semicolon = Пропущена ";" +editor.status.missing.left_sq_bracket = Пропущена "[" +editor.status.missing.right_sq_bracket = Пропущена "]" +editor.status.missing.left_paren = Пропущена "(" +editor.status.missing.right_paren = Пропущена ")" +editor.status.missing.left_curly_bracket = Пропущена "{" +editor.status.missing.right_curly_bracket = Пропущена "}" +editor.status.missing.add = Добавьте "%s" +editor.status.bad_curly_quote = Косые кавычки %s не работают. Используйте прямые. Ctrl-T для автозамены. +editor.status.reserved_words = "color" и "int" - зарезервированы и не могут быть использованы в качестве имён переменных +editor.status.undefined_method = Функция "%s(%s)" не определена +editor.status.undefined_constructor = Конструктор "%s(%s)" не определён +editor.status.empty_param = Функция "%s()" не имеет параметров +editor.status.wrong_param = Функция "%s()" ожидает параметры: "%s(%s)" +editor.status.undef_global_var = Глобальная переменная "%s" не определена +editor.status.undef_class = Класс "%s" не определён +editor.status.undef_var = Переменная "%s" не определена +editor.status.undef_name = Имя "%s" не может быть распознано +editor.status.unterm_string_curly = Строковый литерал не заключён в двойные кавычки. Косые кавычки %s не применимы. +editor.status.type_mismatch = Несовпадение типов "%s" и "%s" +editor.status.unused_variable = Локальная переменная "%s" нигде не используется +editor.status.uninitialized_variable = Локальная переменная "%s" не инициализирована +editor.status.no_effect_assignment = Присвоение переменной "%s" не имеет эффекта +editor.status.hiding_enclosing_type = Класс "%s" не может иметь имя наброска + +# Footer buttons +editor.footer.errors = Ошибки +editor.footer.errors.problem = Проблема +editor.footer.errors.tab = Вкладка +editor.footer.errors.line = Строка +editor.footer.console = Консоль + +# New handler +new.messages.is_read_only = Набросок только для чтения +new.messages.is_read_only.description = Некоторые файлы помечены "только для чтения".\nСохраните их в другом месте и попробуйте снова. + +# Rename handler +rename.messages.is_untitled = Набросок без названия +rename.messages.is_untitled.description = Сперва сохраните набросок, перед\n тем как его переименовывать +rename.messages.is_modified = Сохраните набросок, перед его переименованием. +rename.messages.is_read_only = Набросок только для чтения +rename.messages.is_read_only.description = Некоторые файлы помечены "только для чтения".\nСохраните их в другом месте и попробуйте снова. + +# Naming handler +name.messages.problem_renaming = Проблема переименования +name.messages.starts_with_dot.description = Имя не может начинаться с точки +name.messages.invalid_extension.description = ".%s" не допустимое расширениие. +name.messages.main_java_extension.description = Первая вкладка не может быть %s файлом.\n(Воспользуйтесь другой, "правильной" средой\nпрограммирования?) +name.messages.new_sketch_exists = Переименование невозможно +name.messages.new_sketch_exists.description = Файл "%s" уже существует в\n"%s" +name.messages.new_folder_exists = Переименование невозможно +name.messages.new_folder_exists.description = Набросок(или папка) "%s" уже существует. +name.messages.error = Ошибка +name.messages.no_rename_folder.description = Не удалось переименовать папку наброска. +name.messages.no_rename_file.description = Не удалось переименовать "%s" на "%s" +name.messages.no_create_file.description = Не удалось создать файл "%s"\nв "%s" + +# Delete handler +delete.messages.cannot_delete = Нельзя удалить +delete.messages.cannot_delete.description = Нельзя удалить несохранённый набросок. +delete.messages.cannot_delete.file = Не удалось +delete.messages.cannot_delete.file.description = Не получилось удалить +delete.messages.is_read_only = Набросок открыт "только для чтения" +delete.messages.is_read_only.description = Некоторые файлы помечены "только для чтения".\nСохраните их в другом месте и попробуйте снова. + +# Save handler +save_file.messages.is_read_only = Набросок только для чтения +save_file.messages.is_read_only.description = Некоторые файлы помечены "только для чтения".\nСохраните их в другом месте и попробуйте снова. +save_file.messages.sketch_exists = Набросок уже существует +save_file.messages.sketch_exists.description = Набросок с очищенным именем\n“%s” уже существует. +save_file.messages.tab_exists = Не удалось сохранить +save_file.messages.tab_exists.description = Нельзя сохранить набросок "%s"\n. Вкладка с таким именем уже открыта +save_file.messages.recursive_save = Сохранение в стиле Боргеса +save_file.messages.recursive_save.description = Нельзя сохранить набросок в папку внутри\nсамого себя. Будет циклическая зависимость. + +# Add handler +add_file.messages.is_read_only = Набросок "только для чтения" +add_file.messages.is_read_only.description = Некоторые файлы помечены "только для чтения".\nСохраните их в другом месте и попробуйте снова. +add_file.messages.confirm_replace = Заменить существующюю версию %s? +add_file.messages.error_adding = Ошибка при добавлении файла +add_file.messages.cannot_delete.description = Не получилось удалить существующий файл '%s'. +add_file.messages.cannot_add.description = Не удалось добавить '%s' в набросок. +add_file.messages.same_file = Меня не обдуришь +add_file.messages.same_file.description = Этот файл уже был скопирован в то место\nкуда вы пытаетесь его скопировать.\nНичего не будет сделано. + +# Temp folder creator +temp_dir.messages.bad_build_folder = Плохая папка сборки +temp_dir.messages.bad_build_folder.description = Не удалось найти место для сборки. + +# Ensure Existance +ensure_exist.messages.missing_sketch = Набросок не найден +ensure_exist.messages.missing_sketch.description = Папка с наброском не найдена.\nПопробуем сохранить заново, некоторые\nизменения возможно будут утрачены. +ensure_exist.messages.unrecoverable = Не удалось востановить набросок +ensure_exist.messages.unrecoverable.description = Не удалось повторно сохранить набросок. У вас могут возникнуть трудности,\nпри редактировании в внешнем текстовом редакторе. + +# Check name +check_name.messages.is_name_modified = Имя наброска было изменено. Имена набросков могут состоять\nтолько из ASCII-символов и цифр (но не могут начинаться с цифры).\nТакже имя не должно быть больше 64-ёх + +# External changes detector +change_detect.reload.title=Вкладка изменена вне приложения +change_detect.reload.question="%s" изменена другим приложением. +change_detect.reload.comment=Оставить или перезагрузить изменения?\nВ любом случае файл будет сохранён в папке с наброском. +change_detect.button.keep=Оставить +change_detect.button.load_new=Перезагрузить +change_detect.delete.title=Вкладка удалена вне программы +change_detect.delete.question="%s" пропала из папки с работами. +change_detect.delete.comment=Хотите пересохранить или удалить набросок? +change_detect.button.discard=Удалить +change_detect.button.resave=Пересохранить + +# --------------------------------------- +# Contributions + +# Contribution Panel +contrib = Управление расширениями +contrib.manager_title.update = Управление обновлениями +contrib.manager_title.mode = Управление режимами +contrib.manager_title.tool = Управление инструментами +contrib.manager_title.library = Управление библиотеками +contrib.manager_title.examples = Управление примерами +contrib.category = Категория: +contrib.filter_your_search = Фильтр поиска... +contrib.show_only_compatible.mode = Показать только совместимые режимы +contrib.show_only_compatible.tool = Показать только совместимые инструменты +contrib.show_only_compatible.library = Показать только совместимые библиотеки +contrib.show_only_compatible.examples = Показать только совместимые примеры +contrib.show_only_compatible.update = Показать только совместимые обновления +contrib.restart = Перезапустить Processing +contrib.unsaved_changes = Остались несохранённые изменения +contrib.unsaved_changes.prompt = Вы уверены, что хотите перезапустить Processing, не сохранив изменений? +contrib.messages.remove_restart = Перезапустите Processing, для завершения удаления расширения. +contrib.messages.install_restart = Перезапустите Processing, для завершения установки расширения. +contrib.messages.update_restart = Перезапустите Processing, для завершения обновления расширения. +contrib.errors.list_download = Ну удалось загрузить список доступных расширений. +contrib.errors.list_download.timeout = Тайм-аут соединения при загрузке списка расширений. +contrib.errors.download_and_install = Ошибка при загрузке и установке %s. +contrib.errors.description_unavailable = Описание недоступно. +contrib.errors.malformed_url = Ссылка полученная с Processing.org, не рабочая.\nЭту библиотеку всё ещё можно установить вручную\nзагрузив её с сайта. +contrib.errors.needs_repackage = %s требует правильной пересборки %s. +contrib.errors.no_contribution_found = Не удалось найти %s в загруженном файле. +contrib.errors.overwriting_properties = Ошибка сохранения файла .properties. +contrib.errors.install_failed = Установка не удалась. +contrib.errors.update_on_restart_failed = Не удалась установка обновления %s при перезапуске. +contrib.errors.temporary_directory = Не удалась запись во временную папку. +contrib.errors.contrib_download.timeout = Тайм-аут соединения при загрузке %s. +contrib.errors.no_internet_connection = Нет подключения к сети. +contrib.status.downloading_list = Список загрузок расширений... +contrib.status.connecting = Соединение... +contrib.status.done = Готово. +contrib.all = Всё +contrib.undo = Отменить +contrib.remove = Удалить +contrib.install = Установить +contrib.progress.installing = Установка +contrib.progress.starting = Начинаем +contrib.progress.downloading = Загрузка +contrib.download_error = Произошла ошибка при загрузке расширений. +contrib.unsupported_operating_system = Ваша система не поддерживается. Посетите %s для получения подробной информации. +contrib.category.3d = 3D +contrib.category.animation = Анимация +contrib.category.data = Данные +contrib.category.geometry = Геометрия +contrib.category.gui = Интерфейс +contrib.category.hardware = Аппаратное обеспечение +contrib.category.i_o = Ввод/Вывод +contrib.category.math = Математика +contrib.category.simulation = Симуляция +contrib.category.sound = Звук +contrib.category.typography = Типография +contrib.category.utilities = Утилиты +contrib.category.video_vision = Видео +contrib.category.other = Остальное + +# Install on Startup +contrib.startup.errors.download_install = Ошибка при загрузке и установке %s +contrib.startup.errors.temp_dir = Не удалась запись во временную папку при загрузке и установке %s +contrib.startup.errors.new_marker = Метка не обновлённых расширений не похожа на %s. Возможно потребуется обновление вручную... + +# Install on Import +contrib.import.dialog.title = Пропущены доступные бибиотеки +contrib.import.dialog.primary_text = Для следующие импортированных библиотек доступны обновления, которые ещё не установлены. +contrib.import.dialog.secondary_text = Хотите установить их сейчас? +contrib.import.progress.download = Загрузка %s... +contrib.import.progress.install = Установка %s... +contrib.import.progress.done = %s было установлено. +contrib.import.progress.final_list = Были устновлены следующие библиотеки: +contrib.import.errors.link = Ошибка: у библиотеки %s странная ссылка для загрузки. + +# --------------------------------------- +# Warnings + +warn.delete = Удалить +warn.delete.sketch = Вы уверены, что хотите удалить эскиз? +warn.delete.file = Вы уверены, что хотите удалить "%s"? +warn.cannot_change_mode.title = Нельзя сменить режим +warn.cannot_change_mode.body = Не получается изменить режим,\nтак как "%s" не совместим с текущим режимом. + + +# --------------------------------------- +# Update Check + +update_check = Обновить +update_check.updates_available.core = Доступна новая версия Processing,\nхотите перейти на страницу загрузки Processing? +update_check.updates_available.contributions = Доступны обновления сообщества,\nхотите перейти в менеджер обновлений сообщества? + + +# --------------------------------------- +# Color Chooser + +color_chooser = Выбрать цвет +color_chooser.select = Выбрать + +# --------------------------------------- +# Movie Maker + +movie_maker = Генератор видео +movie_maker.title = Генератор QuickTime +movie_maker.blurb = Этот инструмент делает QuickTime видео из последовательности изображений.

Для недопущения появления артефактов от пересжатеия изобажений в видео
используйте TIFF, TGA (из Processing) или PNG форматы.

Изображения TIFF и TGA обработаются быстрее, но получившееся видео будет занимать больше места на диске:
saveFrame("frames/####.tif");
saveFrame("frames/####.tga");

PNG изображения меньше, но набросок будет работать медленно:
saveFrame("frames/####.png");

Код на основе QuickTime Movie Maker 1.5.1 2011-01-17.
Copyright © 2010-2011 Werner Randelshofer. Все права защищены.
+movie_maker.image_folder_help_label = Перетяните папку с изображениями в поле ниже: +movie_maker.choose_button = Выбрать... +movie_maker.select_image_folder = Выбрать папку с изображениями... +movie_maker.sound_file_help_label = Перенесите файл (.au, .aiff, .wav, .mp3) в поле ниже: +movie_maker.select_sound_file = Выбрать звуковой файл... + +movie_maker.create_movie_button = Создать видео... +movie_maker.save_dialog_prompt = Сохранить видео как... +movie_maker.width = Ширина: +movie_maker.height = Высота: +movie_maker.compression = Сжатие: +movie_maker.compression.animation = Анимация +movie_maker.compression.jpeg = JPEG +movie_maker.compression.png = PNG +movie_maker.framerate = Частота кадров: +movie_maker.orig_size_button = Размер, как у оригинала +movie_maker.orig_size_tooltip = Отметьте флажок, если папка уже содержит видео правильного размера. + +movie_maker.error.avoid_tiff = Попробуйте TGA или PNG вместо TIFF. +movie_maker.error.badnumbers = Ширина и высота должны быть натуральными числами; частота кадров должна быть больше нуля. +movie_maker.error.cannot_read = Не удалось прочитать %s. +movie_maker.error.cannot_read_maybe_bad = Не удалось прочитать %s; файл может быть повреждён. +movie_maker.error.movie_failed = Не удалось создать видео QuickTime. +movie_maker.error.need_input = Нужно сначала выбрать папку с изображениями, звуковыми файлами или всем сразу. +movie_maker.error.no_images_found = Не найдены файлы изображений. +movie_maker.error.sorry = Извините +movie_maker.error.unknown_tga_format = Неизвестный формат .tga для %s. + +movie_maker.progress.creating_file_name = Создаётся %s. +movie_maker.progress.creating_output_file = Создаётся выходной файл +movie_maker.progress.initializing = Инициализация... +movie_maker.progress.processing = Обработка %s. diff --git a/build/shared/lib/languages/PDE_tr.properties b/build/shared/lib/languages/PDE_tr.properties index c7229aed60..8773b8860a 100644 --- a/build/shared/lib/languages/PDE_tr.properties +++ b/build/shared/lib/languages/PDE_tr.properties @@ -19,8 +19,8 @@ menu.file.sketchbook.empty = Boş Sketchbook menu.file.examples = Örnekler... menu.file.close = Kapat menu.file.save = Kaydet -menu.file.save_as = ... olarak Kaydet -menu.file.export_application = Aktar +menu.file.save_as = Farklı Kaydet +menu.file.export_application = Dışa Aktar menu.file.page_setup = Sayfa Yapısı menu.file.print = Yazdır menu.file.preferences = Tercihler @@ -38,8 +38,8 @@ menu.edit.paste = Yapıştır menu.edit.select_all = Tümünü Seç menu.edit.auto_format = Otomatik Biçimlendir menu.edit.comment_uncomment = Yorumla/Yorumu Kaldır -menu.edit.increase_indent = Girintiyi Artır -menu.edit.decrease_indent = Girintiyi Azalt +menu.edit.increase_indent = → Girintiyi Artır +menu.edit.decrease_indent = ← Girintiyi Azalt menu.edit.find = Bul.. menu.edit.find_next = Sonrakini Bul menu.edit.find_previous = Öncekini Bul @@ -48,8 +48,8 @@ menu.edit.use_selection_for_find = Seçimi Bul # | File | Edit | Sketch | Debug | Tools | Help | # | Sketch | menu.sketch.run = Çalıştır -menu.sketch.present = Sürmekte -menu.sketch.tweak = Tweak +menu.sketch.present = Sunum Yap +menu.sketch.tweak = Ayar Çek menu.sketch.stop = Durdur # --- menu.library = Kütüphane... @@ -104,7 +104,7 @@ prompt.no = Hayır prompt.cancel = İptal prompt.ok = Tamam prompt.browse = Gözat -prompt.export = Aktar +prompt.export = Dışa Aktar # --------------------------------------- @@ -201,7 +201,7 @@ archive_sketch = ... olarak Arşivle # [Run/Present] [Stop] [New] [Open] [Save] toolbar.run = Çalıştır -toolbar.present = Sürmekte +toolbar.present = Sunum Yap toolbar.stop = Durdur # --- toolbar.new = Yeni diff --git a/build/shared/lib/languages/PDE_uk.properties b/build/shared/lib/languages/PDE_uk.properties new file mode 100644 index 0000000000..9eb9050fbb --- /dev/null +++ b/build/shared/lib/languages/PDE_uk.properties @@ -0,0 +1,635 @@ + + +# --------------------------------------- +# Language: Ukrainian (Українська) (uk) +# --------------------------------------- + + +# --------------------------------------- +# Menu + +# | File | Edit | Sketch | Debug | Tools | Help | +# | File | +menu.file = Файл +menu.file.new = Створити +menu.file.open = Відкрити... +menu.file.recent = Відкрити останні +menu.file.sketchbook = Ескізник... +menu.file.sketchbook.empty = Очистити ескізник +menu.file.examples = Приклади... +menu.file.close = Закрити +menu.file.save = Зберегти +menu.file.save_as = Зберегти як... +menu.file.export_application = Експортувати застосунок... +menu.file.page_setup = Параметри сторінки +menu.file.print = Друк... +menu.file.preferences = Налаштування... +menu.file.quit = Вийти + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Edit | +menu.edit = Редагування +menu.edit.undo = Скасувати +menu.edit.redo = Повторити +menu.edit.redo.keystroke.macosx = shift meta pressed Z +menu.edit.redo.keystroke.windows = ctrl pressed Y +menu.edit.redo.keystroke.linux = shift ctrl pressed Z +menu.edit.action.addition = додавання +menu.edit.action.deletion = видалення +menu.edit.cut = Вирізати +menu.edit.copy = Копіювати +menu.edit.copy_as_html = Копіювати як HTML +menu.edit.paste = Вставити +menu.edit.select_all = Виділити все +menu.edit.auto_format = Автоформатування +menu.edit.comment_uncomment = Коментувати/Розкоментувати +menu.edit.comment_uncomment.keystroke.macosx = meta pressed SLASH +menu.edit.comment_uncomment.keystroke.windows = ctrl pressed SLASH +menu.edit.comment_uncomment.keystroke.linux = ctrl pressed SLASH +menu.edit.increase_indent = → Збільшити відступ +menu.edit.increase_indent.keystroke.macosx = meta pressed CLOSE_BRACKET +menu.edit.increase_indent.keystroke.windows = ctrl pressed CLOSE_BRACKET +menu.edit.increase_indent.keystroke.linux = ctrl pressed CLOSE_BRACKET +menu.edit.decrease_indent = ← Зменшити відступ +menu.edit.decrease_indent.keystroke.macosx = meta pressed OPEN_BRACKET +menu.edit.decrease_indent.keystroke.windows = ctrl pressed OPEN_BRACKET +menu.edit.decrease_indent.keystroke.linux = ctrl pressed OPEN_BRACKET +menu.edit.find = Знайти... +menu.edit.find_next = Знайти наступне +menu.edit.find_previous = Знайти попереднє +menu.edit.use_selection_for_find = Шукати виділене + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Sketch | +menu.sketch.run = Запустити +menu.sketch.present = Режим презентації +menu.sketch.tweak = Модифікувати +menu.sketch.stop = Зупинити +# --- +menu.library = Імпортувати бібліотеку... +menu.library.add_library = Додати бібліотеку... +menu.library.contributed = Користувацькі +menu.library.no_core_libraries = у режиму немає основних бібліотек +# --- +menu.sketch = Ескіз +menu.sketch.show_sketch_folder = Показати папку ескізу +menu.sketch.add_file = Додати файл... + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Debug | +menu.debug = Налагодження +menu.debug.enable = Увімкнути налагоджувач +menu.debug.disable = Вимкнути налагоджувач +#menu.debug.show_debug_toolbar = Показати панель налагодження +#menu.debug.debug = Почати налагодження +#menu.debug.stop = Зупинити налагодження +# --- +menu.debug.toggle_breakpoint = Додати / вилучити точку зупинки +#menu.debug.list_breakpoints = Показати список точок зупинки +# --- +# used for both menus and toolbars +menu.debug.step = Крок +menu.debug.step.keystroke.macosx = meta pressed J +menu.debug.step.keystroke.windows = ctrl pressed J +menu.debug.step.keystroke.linux = ctrl pressed J +menu.debug.step_into = Крок із заходом +menu.debug.step_into.keystroke.macosx = shift meta pressed J +menu.debug.step_into.keystroke.windows = shift ctrl pressed J +menu.debug.step_into.keystroke.linux = shift ctrl pressed J +menu.debug.step_out = Крок із виходом +menu.debug.step_out.keystroke.macosx = meta alt pressed J +menu.debug.step_out.keystroke.windows = ctrl alt pressed J +menu.debug.step_out.keystroke.linux = ctrl alt pressed J +menu.debug.continue = Продовжити +# --- +#menu.debug.print_stack_trace = Друкувати стек викликів +#menu.debug.print_locals = Друкувати локальні змінні +#menu.debug.print_fields = Друкувати поля +#menu.debug.print_source_location = Друкувати розташування джерела +#menu.debug.print_threads = Друкувати потоки +# --- +#menu.debug.variable_inspector = Інспектор змінних +menu.debug.show_variables = Показати змінні +menu.debug.hide_variables = Приховати змінні +#menu.debug.show_sketch_outline = Показати начерк ескізу +#menu.debug.show_tabs_list = Показати список вкладок + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Tools | +menu.tools = Інструменти +menu.tools.color_selector = Вибрати колір... +menu.tools.create_font = Створити шрифт... +menu.tools.archive_sketch = Архівувати ескіз +menu.tools.fix_the_serial_lbrary = Виправити Serial Library +menu.tools.install_processing_java = Встановити "processing-java" +menu.tools.add_tool = Додати інструмент... + +# | File | Edit | Sketch | Debug | Tools | Help | +# | Help | +menu.help = Довідка +menu.help.welcome = Ласкаво просимо до Processing 3 +menu.help.about = Про Processing +menu.help.environment = Середовище +menu.help.reference = Документація +menu.help.find_in_reference = Знайти у документації +menu.help.libraries_reference = Документація бібліотек +menu.help.tools_reference = Документація інструментів +menu.help.empty = (порожньо) +menu.help.online = Онлайн +menu.help.getting_started = Перші кроки (англ.) +menu.help.getting_started.url = http://processing.org/learning/gettingstarted/ +menu.help.troubleshooting = Вирішення проблем (англ.) +menu.help.troubleshooting.url = http://wiki.processing.org/w/Troubleshooting +menu.help.faq = Часті питання (англ.) +menu.help.faq.url = http://wiki.processing.org/w/FAQ +menu.help.foundation = The Processing Foundation (англ.) +menu.help.foundation.url = http://processing.org/foundation/ +menu.help.visit = Відвідати Processing.org (англ.) +menu.help.visit.url = http://processing.org/ + + +# --------------------------------------- +# Basics + +# Buttons +prompt.yes = Так +prompt.no = Ні +prompt.cancel = Скасувати +prompt.ok = ОК +prompt.browse = Огляд +prompt.export = Експортувати + + +# --------------------------------------- +# Frames + +# Open (Frame) +open = Відкрити ескіз Processing... + +# Save (Frame) +save = Зберегти папку ескізу як... +save.title = Зберегти зміни до %s
перед закриттям? +save.hint = Якщо не зберегти зміни, їх буде втрачено. +save.btn.save = Зберегти +save.btn.dont_save = Не зберігати + +# Close (Frame) also used to prompt on non-OS X machines +close.unsaved_changes = Зберегти зміни до %s? + +# Preferences (Frame) +preferences = Налаштування +preferences.button.width = 95 +preferences.requires_restart = потрібен перезапуск Processing +preferences.sketchbook_location = Місцезнаходження ескізника +preferences.sketchbook_location.popup = Місцезнаходження ескізника +preferences.language = Мова +preferences.editor_and_console_font = Шрифт редактора і консолі +preferences.editor_and_console_font.tip = Виберіть шрифт, що використовуватиметься у редакторі та консолі.
Можна використовувати лише моноширинні шрифти. +preferences.editor_font_size = Розмір шрифту редактора +preferences.console_font_size = Розмір шрифту консолі +preferences.zoom = Розмір інтерфейсу +preferences.zoom.auto = Автоматичний +preferences.background_color = Колір фону в режимі презентації +preferences.background_color.tip = Виберіть фоновий колір для режиму презентації.
Режим презентації використовується для повноекранної презентації ескізу
і доступний з меню Ескіз. +preferences.use_smooth_text = Використовувати згладжений текст у вікні редактора +preferences.enable_complex_text_input = Увімкнути введення складного тексту +preferences.enable_complex_text_input_example = напр. японська +preferences.continuously_check = Постійно перевіряти на помилки +preferences.show_warnings = Показувати попередження +preferences.code_completion = Доповнення коду за допомогою +preferences.trigger_with = Запуск за допомогою +preferences.cmd_space = Пробіл +preferences.suggest_imports = Пропонувати інструкції import +preferences.increase_max_memory = Збільшити максимальну доступну пам’ять до +preferences.delete_previous_folder_on_export = Видаляти попередню папку при експортуванні +preferences.check_for_updates_on_startup = Дозволяти перевірку на оновлення (див. ЧаПи щодо інформації, яка передається) +preferences.run_sketches_on_display = Запускати ескізи на моніторі +preferences.run_sketches_on_display.tip = Задає монітор, де спочатку розміщені ескізи.
Якщо вікно ескізу буде переміщено, воно відкриється у тому ж
місці, але у режимі презентації (на повний екран) завжди
використовуватиметься цей монітор. +preferences.automatically_associate_pde_files = Автоматично асоціювати файли .pde з Processing +preferences.launch_programs_in = Запускати програми у режимі + +# Intentionally left blank +# In Ukrainian "launch programs in mode X" looks nicer than "launch programs in X mode" +preferences.launch_programs_in.mode = + +preferences.file = Інші налаштування можна вручну редагувати у файлі +preferences.file.hint = не редагувати, коли Processing запущено! + +# Sketchbook Location (Frame) +sketchbook_location = Виберіть нове місцезнаходження ескізника + +# Sketchbook (Frame) +sketchbook = Ескізник +sketchbook.tree = Ескізник + +# Examples (Frame) +examples.title = Приклади %s +examples.add_examples = Додати приклади... +examples.libraries = Користувацькі бібліотеки +examples.core_libraries = Бібліотеки +examples.contributed = Користувацькі приклади + +# Export (Frame) +export = Налаштування експортування +export.platforms = Платформи +export.options = Налаштування +export.options.present = Режим презентації +export.options.show_stop_button = Показувати кнопку зупинки +export.description.line1 = "Експортування застосунку" створює інтерактивні, +export.description.line2 = незалежні застосунки для обраних платформ. +export.unsaved_changes = Зберегти зміни перед тим, як експортувати? +export.notice.cancel.unsaved_changes = Експортування скасовано, спершу потрібно зберегти зміни. +export.notice.exporting = Експортую застосунок... +export.notice.exporting.done = Експортування завершено. +export.notice.exporting.error = Помилка експортування. +export.notice.exporting.cancel = Експортування застосунку скасовано. +export.tooltip.macosx = Експорт для Mac OS X доступний лише на Mac OS X +export.full_screen = Повний екран +export.embed_java = Вбудувати Java +export.embed_java.for = Вбудувати Java для +export.code_signing = Цифровий підпис +export.messages.is_read_only = Ескіз лише для читання +export.messages.is_read_only.description = Деякі файли позначено як "лише для читання".\nЗбережіть ескіз у іншому розташуванні та\nспробуйте знову. +export.messages.cannot_export = Експортування неможливе +export.messages.cannot_export.description = Не можна експортувати ескіз, який не було збережено. + +# Find (Frame) +find = Знайти +find.find = Знайти: +find.replace_with = Замінити на: +find.ignore_case = Не враховувати регістр +find.all_tabs = По всіх вкладках +find.wrap_around = По всьому документу +find.btn.replace_all = Замінити все +find.btn.replace = Замінити +find.btn.replace_and_find = Замінити і знайти далі +find.btn.previous = Назад +find.btn.find = Знайти + +# Find in reference (Frame) +find_in_reference = Знайти у документації + +# File (Frame) +file = Виберіть зображення або інший файл з даними, щоб скопіювати його у ескіз + +# Create Font (Frame) +create_font = Створити шрифт +create_font.label = Цей інструмент призначений для створення растрових шрифтів для вашої програми.\nВиберіть шрифт та розмір і натисніть "ОК", щоб згенерувати шрифт.\nЙого буде додано до папки даних поточного ескізу. +create_font.size = Розмір +create_font.smooth = Згладжений +create_font.characters = Символи... +create_font.character_selector = Вибирач символів +create_font.character_selector.label = У стандартні символи включено більшість bitmap-ів для Mac OS\nі Windows Latin. Включення усіх символів вимагає великого\nобсягу пам’яті.\nДля кращої навігації можна обрати конкретні блоки Unicode. +create_font.default_characters = Стандартні символи +create_font.all_characters = Усі символи +create_font.specific_unicode = Конкретні блоки Unicode +create_font.filename = Ім’я файлу + +# Color Selector (Frame) +color_selector = Вибирач кольору + +# Archive Sketch (Frame) +archive_sketch = Архівувати ескіз як... + +# Tweak Mode +tweak_mode = Режим модифікування +tweak_mode.save_before_tweak = Будь ласка, збережіть ескіз перед тим, як запускати його у режимі модифікування. +tweak_mode.keep_changes.line1 = Зберегти змінні? +tweak_mode.keep_changes.line2 = Ви змінили деякі параметри у вашому ескізі. Бажаєте зберегти зміни? + +# DebugTray +debugger.name = Ім’я +debugger.value = Значення +debugger.type = Тип + +# --------------------------------------- +# Toolbars + +# [Run/Present] [Stop] [New] [Open] [Save] +toolbar.run = Запустити +toolbar.present = Презентувати +toolbar.stop = Зупинити +toolbar.debug = Налагоджувати +# --- +toolbar.new = Створити +toolbar.open = Відкрити +toolbar.save = Зберегти +# toolbar.export_application = Експортувати застосунок +toolbar.add_mode = Додати режим... + +# [Debug] [Continue] [Step] [Stop] [Toggle Breakpoints] [Variable Inspector] +#toolbar.debug.continue = Продовжити +#toolbar.debug.step = Крок +#toolbar.debug.step_into = Крок із заходом +#toolbar.debug.stop = Зупинити +#toolbar.debug.toggle_breakpoints = Додати / вилучити точку зупинки +#toolbar.debug.variable_inspector = Інспектор змінних + + +# --------------------------------------- +# Editor + +# [Tab1] [Tab2] [v] +editor.header.new_tab = Нова вкладка +editor.header.rename = Перейменувати +editor.header.delete = Видалити +editor.header.previous_tab = Попередня вкладка +editor.header.previous_tab.keystroke.macosx = meta alt pressed LEFT +editor.header.previous_tab.keystroke.windows = ctrl pressed PAGE_UP +editor.header.previous_tab.keystroke.linux = ctrl pressed PAGE_UP +editor.header.next_tab = Наступна вкладка +editor.header.next_tab.keystroke.macosx = meta alt pressed RIGHT +editor.header.next_tab.keystroke.windows = ctrl pressed PAGE_DOWN +editor.header.next_tab.keystroke.linux = ctrl pressed PAGE_DOWN +editor.header.delete.warning.title = Хех, ні. +editor.header.delete.warning.text = Не можна видалити головну вкладку єдиного відкритого ескізу. + +# PopUp menu +editor.popup.jump_to_declaration = Перейти до визначення +editor.popup.show_usage = Показати використання... +editor.popup.rename = Перейменувати... + +# Tabs +editor.tab.new = Нове ім’я +editor.tab.new.description = Ім’я нового файлу +editor.tab.rename = Нове ім’я +editor.tab.rename.description = Нове ім’я файлу + +# Sketch +editor.sketch.rename.description = Ім’я нового ескізу + +editor.status.autoformat.no_changes = Не потрібно нічого змінювати для автоформатування. +editor.status.autoformat.finished = Автоформатування завершено. +editor.status.find_reference.select_word_first = Спершу виберіть слово, яке потрібно знайти у документації. +editor.status.find_reference.not_available = Документація для "%s" недоступна. +editor.status.drag_and_drop.files_added.0 = До ескізу не додано жодного файлу. +editor.status.drag_and_drop.files_added.1 = До ескізу додано один файл. +editor.status.drag_and_drop.files_added.n = До ескізу додано %d файли(-ів). +editor.status.saving = Зберігаю... +editor.status.saving.done = Збереження завершено. +editor.status.saving.canceled = Збереження скасовано. +editor.status.printing = Друкую... +editor.status.printing.done = Друк завершено. +editor.status.printing.error = Помилка під час друку. +editor.status.printing.canceled = Друк скасовано. +editor.status.copy_as_html = Код, форматований як HTML, скопійовано до буферу обміну. +editor.status.debug.busy = Налагоджувач зайнятий... +editor.status.debug.halt = Налагоджувач зупинено. +editor.status.archiver.create = Архів "%s" створено. +editor.status.archiver.cancel = Архівування ескізу скасовано. + +# Errors +editor.status.warning = Попередження +editor.status.error = Помилка +editor.status.error_on = Помилка на "%s" +editor.status.missing.default = Відсутні "%c" +editor.status.missing.semicolon = Відсутня ";" +editor.status.missing.left_sq_bracket = Відсутня "[" +editor.status.missing.right_sq_bracket = Відсутня "]" +editor.status.missing.left_paren = Відсутня "(" +editor.status.missing.right_paren = Відсутня ")" +editor.status.missing.left_curly_bracket = Відсутня "{" +editor.status.missing.right_curly_bracket = Відсутня "}" +editor.status.missing.add = Спробуйте додати "%s" +editor.status.bad_curly_quote = Фігурні лапки %s не працюють. Використовуйте прямі лапки. Ctrl-T для автозаміни. +editor.status.reserved_words = "color" і "int" - зарезервовані ідентифікатори і не можуть бути назвами змінних +editor.status.undefined_method = Функція "%s(%s)" не існує +editor.status.undefined_constructor = Конструктор "%s(%s)" не існує +editor.status.empty_param = Функція "%s()" не очікує параметрів +editor.status.wrong_param = Функція "%s()" очікує такі параметри: "%s(%s)" +editor.status.undef_global_var = Глобальна змінна "%s" не існує +editor.status.undef_class = Клас "%s" не існує +editor.status.undef_var = Змінна "%s" не існує +editor.status.undef_name = Ім’я "%s" не може бути розпізнано +editor.status.unterm_string_curly = Рядковий літерал не оточений прямими лапками. Фігурні лапки %s не працюють. +editor.status.type_mismatch = Неспівпадіння типів "%s" та "%s" +editor.status.unused_variable = Локальна змінна "%s" ніде не використовується +editor.status.uninitialized_variable = Локальна змінна "%s" може бути не ініціалізована +editor.status.no_effect_assignment = Присвоєння змінної "%s" не має чинності +editor.status.hiding_enclosing_type = Клас "%s" не може мати ім'я ескізу або батьківського класу. + +# Footer buttons +editor.footer.errors = Помилки +editor.footer.errors.problem = Проблема +editor.footer.errors.tab = Вкладка +editor.footer.errors.line = Рядок +editor.footer.console = Консоль + +# New handler +new.messages.is_read_only = Ескіз лише для читання +new.messages.is_read_only.description = Деякі файли позначено як "лише для читання".\nЗбережіть ескіз у іншому розташуванні та\nспробуйте знову. + +# Rename handler +rename.messages.is_untitled = Ескіз безіменний +rename.messages.is_untitled.description = Варто зберегти ескіз\nперед тим, як перейменовувати його +rename.messages.is_modified = Будь ласка, збережіть ескіз перед перейменування. +rename.messages.is_read_only = Ескіз лише для читання +rename.messages.is_read_only.description = Деякі файли позначено як "лише для читання".\nЗбережіть ескіз у іншому розташуванні та\nспробуйте знову. + +# Naming handler +name.messages.problem_renaming = Помилка перейменовування +name.messages.starts_with_dot.description = Ім’я не може починатись з крапки. +name.messages.invalid_extension.description = ".%s" не є допустимим розширенням. +name.messages.main_java_extension.description = Перша вкладка не може бути файлом .%s.\n(А не пора тобі перейти на\n"справжнє" середовище програмування?) +name.messages.new_sketch_exists = Перейменування неможливе +name.messages.new_sketch_exists.description = Файл з назвою "%s" вже існує у\n"%s" +name.messages.new_folder_exists = Перейменування неможливе +name.messages.new_folder_exists.description = Ескіз (чи папка) з назвою "%s" вже існує. +name.messages.error = Помилка +name.messages.no_rename_folder.description = Не вдалось перейменувати папку ескізу. +name.messages.no_rename_file.description = Не вдалось перейменувати "%s" на "%s" +name.messages.no_create_file.description = Не вдалось створити файл "%s"\nу "%s" + +# Delete handler +delete.messages.cannot_delete = Видалення неможливе +delete.messages.cannot_delete.description = Не можна видалити ескіз, який не було збережено. +delete.messages.cannot_delete.file = Не вдалось це зробити +delete.messages.cannot_delete.file.description = Не вдалось видалити +delete.messages.is_read_only = Ескіз лише для читання +delete.messages.is_read_only.description = Деякі файли позначено як "лише для читання".\nЗбережіть ескіз у іншому розташуванні та\nспробуйте знову. + +# Save handler +save_file.messages.is_read_only = Ескіз лише для читання +save_file.messages.is_read_only.description = Деякі файли позначено як "лише для читання".\nЗбережіть ескіз у іншому розташуванні. +save_file.messages.sketch_exists = Не вдалось зберегти +save_file.messages.sketch_exists.description = Ескіз з очищеним іменем\n“%s” вже існує. +save_file.messages.tab_exists = Не вдалось зберегти +save_file.messages.tab_exists.description = Не можна зберегти ескіз як "%s"\nбо він вже має вкладку з таким іменем. +save_file.messages.recursive_save = Збереження в стилі Боргеса +save_file.messages.recursive_save.description = Не можна зберегти ескіз всередині\nсамого себе. Це викличе нескінченну рекурсію. + +# Add handler +add_file.messages.is_read_only = Ескіз лише для читання +add_file.messages.is_read_only.description = Деякі файли позначено як "лише для читання".\nЗбережіть ескіз у іншому розташуванні та\nспробуйте знову. +add_file.messages.confirm_replace = Замінити існуюче розширення %s? +add_file.messages.error_adding = Помилка при додаванні файлу +add_file.messages.cannot_delete.description = Не вдалось видалити існуючий файл '%s'. +add_file.messages.cannot_add.description = Не вдалось додати '%s' до ескізу. +add_file.messages.same_file = Мене не надуриш +add_file.messages.same_file.description = Цей файл уже скопійовано у\nрозташування, куди ви його копіюєте.\nЯ ніц не зроблю. + +# Temp folder creator +temp_dir.messages.bad_build_folder = Погана папка збірки +temp_dir.messages.bad_build_folder.description = Не вдалось знайти розташування для збірки ескізу. + +# Ensure Existance +ensure_exist.messages.missing_sketch = Ескіз зник +ensure_exist.messages.missing_sketch.description = Папка ескізу зникла.\nСпробую зберегти у тому ж розташуванні,\nале все, крім коду, зникне. +ensure_exist.messages.unrecoverable = Не вдалось зберегти ескіз +ensure_exist.messages.unrecoverable.description = Не вдалось повторно зберегти ескіз. У вас можуть бути проблеми,\nпора копіювати і вставляти код у інший текстовий редактор. + +# Check name +check_name.messages.is_name_modified = Ім’я ескізу потрібно було змінити. Імена ескізів можуть містити\nтільки ASCII-символи і числа (але не можуть починатися з числа).\nКрім того, вони мають бути не довшими за 64 символи. + +# External changes detector +change_detect.reload.title=Вкладка змінена ззовні +change_detect.reload.question="%s" була змінена іншою програмою. +change_detect.reload.comment=Бажаєте залишити цю версію чи завантажити зміни ззовні?\nТак чи інакше, файл буде збережено в папці з ескізами. +change_detect.button.keep=Залишити +change_detect.button.load_new=Завантажити зміни ззовні +change_detect.delete.title=Вкладка видалена +change_detect.delete.question="%s" зникла з папки з ескізами. +change_detect.delete.comment=Бажаєте повторно її зберегти чи видалити зі свого ескізу? +change_detect.button.discard=Видалити назавжди +change_detect.button.resave=Повторно зберегти + +# --------------------------------------- +# Contributions + +# Contribution Panel +contrib = Керування внесками +contrib.manager_title.update = Керування оновленнями +contrib.manager_title.mode = Керування режимами +contrib.manager_title.tool = Керування інструментами +contrib.manager_title.library = Керування бібліотеками +contrib.manager_title.examples = Керування прикладами +contrib.category = Категорія: +contrib.filter_your_search = Фільтр пошуку... +contrib.show_only_compatible.mode = Показати лише сумісні режими +contrib.show_only_compatible.tool = Показати лише сумісні інструменти +contrib.show_only_compatible.library = Показати лише сумісні бібліотеки +contrib.show_only_compatible.examples = Показати лише сумісні приклади +contrib.show_only_compatible.update = Показати лише сумісні оновлення +contrib.restart = Перезапустити Processing +contrib.unsaved_changes = Зміни не було збережено +contrib.unsaved_changes.prompt = Ви впевнені, що хочете перезапустити Processing, не зберігаючи зміни? +contrib.messages.remove_restart = Будь ласка, перезапустіть Processing, щоб завершити видалення цього внеску. +contrib.messages.install_restart = Будь ласка, перезапустіть Processing, щоб завершити встановлення цього внеску. +contrib.messages.update_restart = Будь ласка, перезапустіть Processing, щоб завершити оновлення цього внеску. +contrib.errors.list_download = Не вдалось завантажити список встановлених внесків. +contrib.errors.list_download.timeout = Тайм-аут з’єднання під час завантаження списку внесків. +contrib.errors.download_and_install = Помилка при завантаженні чи встановленні %s. +contrib.errors.description_unavailable = Опису немає. +contrib.errors.malformed_url = Посилання, отримане з Processing.org, недійсне.\nЦю бібліотеку все ще можна встановити, відвідавши\nїї сайт. +contrib.errors.needs_repackage = %s потрібно перепакувати за правилами %s. +contrib.errors.no_contribution_found = Не вдалось знайти %s у завантаженому файлі. +contrib.errors.overwriting_properties = Помилка при перезаписуванні файлу .properties. +contrib.errors.install_failed = Встановлення не вдалось. +contrib.errors.update_on_restart_failed = Помилка оновлення під час перезапуску %s. +contrib.errors.temporary_directory = Не вдалось записати у тимчасову папку. +contrib.errors.contrib_download.timeout = Тайм-аут з’єднання під час завантаження %s. +contrib.errors.no_internet_connection = Здається, ви не під’єднані до мережі Інтернет. +contrib.status.downloading_list = Завантаження списку внесків... +contrib.status.connecting = З’єднання... +contrib.status.done = Готово. +contrib.all = Усе +contrib.undo = Скасувати +contrib.remove = Видалити +contrib.install = Встановити +contrib.progress.installing = Встановлюю +contrib.progress.starting = Починаю +contrib.progress.downloading = Завантажую +contrib.download_error = Сталась помилка під час завантаження внеску. +contrib.unsupported_operating_system = Здається, ваша операційна система не підтримується. Відвідайте бібліотеку %s для детальнішої інформації. +contrib.category.3d = 3D +contrib.category.animation = Анімація +contrib.category.data = Дані +contrib.category.geometry = Геометрія +contrib.category.gui = Інтерфейс +contrib.category.hardware = Апаратне забезпечення +contrib.category.i_o = Введення/виведення +contrib.category.math = Математика +contrib.category.simulation = Симуляція +contrib.category.sound = Звук +contrib.category.typography = Типографія +contrib.category.utilities = Утиліти +contrib.category.video_vision = Відео +contrib.category.other = Інше + +# Install on Startup +contrib.startup.errors.download_install = Помилка під час завантаження чи встановлення %s +contrib.startup.errors.temp_dir = Не вдалось записати у тимчасову папку під час завантаження чи встановлення %s +contrib.startup.errors.new_marker = Здається, старому маркеру внеску не подобається %s. Можливо, потрібно оновити вручну... + +# Install on Import +contrib.import.dialog.title = Доступні відсутні бібліотеки +contrib.import.dialog.primary_text = Ці імпортовані бібліотеки доступні для завантаження, але не були встановлені. +contrib.import.dialog.secondary_text = Бажаєте встановити їх зараз? +contrib.import.progress.download = Завантаження %s... +contrib.import.progress.install = Встановлення %s... +contrib.import.progress.done = %s було встановлено. +contrib.import.progress.final_list = Було встановлено такі бібліотеки: +contrib.import.errors.link = Помилка: У бібліотеки %s недійсне посилання завантаження. + +# --------------------------------------- +# Warnings + +warn.delete = Видалення +warn.delete.sketch = Ви впевнені, що хочете видалити цей ескіз? +warn.delete.file = Ви впевнені, що хочете видалити "%s"? +warn.cannot_change_mode.title = Зміна режиму неможлива +warn.cannot_change_mode.body = Зміна режиму неможлива,\nоскільки режим "%s" несумісний з поточним режимом. + + +# --------------------------------------- +# Update Check + +update_check = Оновлення +update_check.updates_available.core = Доступна нова версія Processing,\nбажаєте відвідати сторінку завантаження Processing? +update_check.updates_available.contributions = Доступні оновлення для деяких встановлених внесків,\nбажаєте відкрити меню керування внесками зараз? + + +# --------------------------------------- +# Color Chooser + +color_chooser = Вибирач кольору +color_chooser.select = Вибрати + +# --------------------------------------- +# Movie Maker + +movie_maker = Генератор відео +movie_maker.title = Генератор відео QuickTime +movie_maker.blurb = Цей інструмент створює відео QuickTime з послідовності зображень.

Для уникнення артефактів від повторного стиснення зображень у відео
використовуйте зображення TIFF, TGA (з Processing) або PNG.

Зображення TIFF та TGA записуватимуться швидше, але вимагають більше місця на диску:
saveFrame("frames/####.tif");
saveFrame("frames/####.tga");

Зображення PNG менші, але записуватимуться повільніше:
saveFrame("frames/####.png");

Код базується на QuickTime Movie Maker 1.5.1 2011-01-17.
Copyright © 2010-2011 Werner Randelshofer. Всі права захищені.
+movie_maker.image_folder_help_label = Перетягніть папку з файлами зображень у поле внизу: +movie_maker.choose_button = Вибрати... +movie_maker.select_image_folder = Вибрати папку зображень... +movie_maker.sound_file_help_label = Перетягніть звуковий файл (.au, .aiff, .wav, .mp3) у поле внизу: +movie_maker.select_sound_file = Вибрати звуковий файл... + +movie_maker.create_movie_button = Створити відео... +movie_maker.save_dialog_prompt = Зберегти відео як... +movie_maker.width = Ширина: +movie_maker.height = Висота: +movie_maker.compression = Стиснення: +movie_maker.compression.animation = Анімація +movie_maker.compression.jpeg = JPEG +movie_maker.compression.png = PNG +movie_maker.framerate = Частота кадрів: +movie_maker.orig_size_button = Розмір, як в оригіналі +movie_maker.orig_size_tooltip = Відмітьте це, якщо папка вже містить закодовані кадри відео бажаного розміру. + +movie_maker.error.avoid_tiff = Спробуйте зображення TGA чи PNG замість TIFF. +movie_maker.error.badnumbers = Ширина та висота мають бути цілими додатніми числами; частота кадрів має бути додатнім числом. +movie_maker.error.cannot_read = Не вдалось прочитати %s. +movie_maker.error.cannot_read_maybe_bad = Не вдалось прочитати %s; файл може бути недійсним. +movie_maker.error.movie_failed = Не вдалось створити відео QuickTime. +movie_maker.error.need_input = Потрібно зазначити папку з файлами зображень, звуковими файлами, або і тим, і іншим. +movie_maker.error.no_images_found = Не знайдено файлів зображень. +movie_maker.error.sorry = Вибачте +movie_maker.error.unknown_tga_format = Невідомий формат файлу .tga для %s. + +movie_maker.progress.creating_file_name = Створюю %s. +movie_maker.progress.creating_output_file = Створюю вихідний файл +movie_maker.progress.initializing = Ініціалізація... +movie_maker.progress.processing = Обробляю %s. diff --git a/build/shared/lib/languages/PDE_zh.properties b/build/shared/lib/languages/PDE_zh.properties index 6e97ee4188..8cf6da2166 100644 --- a/build/shared/lib/languages/PDE_zh.properties +++ b/build/shared/lib/languages/PDE_zh.properties @@ -37,8 +37,8 @@ menu.edit.paste = 黏贴 menu.edit.select_all = 全部选择 menu.edit.auto_format = 自动对齐 menu.edit.comment_uncomment = 注释/取消注释 -menu.edit.increase_indent = 增加缩进量 -menu.edit.decrease_indent = 减少缩进量 +menu.edit.increase_indent = → 增加缩进量 +menu.edit.decrease_indent = ← 减少缩进量 menu.edit.find = 查找... menu.edit.find_next = 查找下一个 menu.edit.find_previous = 查找上一个 @@ -48,7 +48,7 @@ menu.edit.use_selection_for_find = 使用当前选定查找 # | Sketch | menu.sketch.run = 运行 menu.sketch.present = 展示模式 -menu.sketch.tweak = Tweak +menu.sketch.tweak = 调整 menu.sketch.stop = 停止 # --- menu.library = 引用库文件... @@ -62,7 +62,23 @@ menu.sketch.add_file = 添加文件... # | File | Edit | Sketch | Debug | Tools | Help | # | Debug | -# ... +# | File | Edit | Sketch | Debug | Tools | Help | +# | Debug | +menu.debug = 调试 +menu.debug.enable = 启用调试器 +menu.debug.disable = 禁用调试器 +# --- +menu.debug.toggle_breakpoint = 切换断点 +# --- +# used for both menus and toolbars +menu.debug.step = 单步 (Step) +menu.debug.step_into = 单步进入 (Step Into) +menu.debug.step_out = 单步跳出 (Step Out) +menu.debug.continue = 继续 +# --- +#menu.debug.variable_inspector = Variable Inspector +menu.debug.show_variables = 显示变量 +menu.debug.hide_variables = 隐藏变量 # | File | Edit | Sketch | Debug | Tools | Help | # | Tools | @@ -129,8 +145,8 @@ preferences.language = 语言 preferences.editor_and_console_font = 编辑器和控制台字体 preferences.editor_and_console_font.tip = \ 为编辑器和控制台选择字体.
\ -Only monospaced (fixed-width) fonts may be used,
\ -though the list may be imperfect. +只允许使用等宽字体,
\ +此列表可能不完全。 preferences.editor_font_size = 编辑器字体大小 preferences.console_font_size = 控制台字体大小 preferences.background_color = 展示模式时的背景颜色 @@ -140,27 +156,27 @@ preferences.background_color.tip = \ 可从速写本菜单中访问. preferences.use_smooth_text = 在编辑器窗口中使用平滑字体 preferences.enable_complex_text_input = 启用复杂字体输入 -preferences.enable_complex_text_input_example = i.e. Japanese +preferences.enable_complex_text_input_example = 例如日文 preferences.continuously_check = 不断检查错误 preferences.show_warnings = 显示警告 -preferences.code_completion = Code completion -preferences.trigger_with = Trigger with -preferences.cmd_space = space +preferences.code_completion = 代码补全 +preferences.trigger_with = 触发开关 +preferences.cmd_space = 空格 preferences.increase_max_memory = 增加最大内存至 preferences.delete_previous_folder_on_export = 当导出时删除先前的文件夹 preferences.hide_toolbar_background_image = 隐藏标签/工具栏背景图片 preferences.check_for_updates_on_startup = 在启动时检查有无更新 -preferences.run_sketches_on_display = Run sketches on display +preferences.run_sketches_on_display = 在此显示器中运行速写本 preferences.run_sketches_on_display.tip = \ Sets the display where sketches are initially placed.
\ As usual, if the sketch window is moved, it will re-open
\ at the same location, however when running in present
\ (full screen) mode, this display will always be used. preferences.automatically_associate_pde_files = 自动关联 .pde 文件通过 Processing -preferences.launch_programs_in = Launch programs in +preferences.launch_programs_in = 加载程序的模式 preferences.launch_programs_in.mode = 模式 preferences.file = 更多选项可直接编辑该文件 -preferences.file.hint = 请在Processing不在运行时编辑该文件 +preferences.file.hint = 请在 Processing 未运行时编辑该文件 # Sketchbook Location (Frame) sketchbook_location = 选择新速写本位置 @@ -187,7 +203,7 @@ find.find = 搜索: find.replace_with = 替换为: find.ignore_case = 忽略大小写 find.all_tabs = 所有标签 -find.wrap_around = Wrap Around +find.wrap_around = 循环遍历 find.btn.replace_all = 全部替换 find.btn.replace = 替换 find.btn.find_and_replace = 搜索 & 替换 @@ -238,8 +254,8 @@ editor.header.rename = 重命名 editor.header.delete = 删除 editor.header.previous_tab = 前一个标签 editor.header.next_tab = 后一个标签 -editor.header.delete.warning.title = Yeah, no. -editor.header.delete.warning.text = You can't delete the last tab of the last open sketch. +editor.header.delete.warning.title = 这样不行 +editor.header.delete.warning.text = 无法删除最后一个速写本的最后一个标签 # Tabs editor.tab.new = 新文件名 @@ -248,15 +264,15 @@ editor.tab.rename = 新文件名 editor.tab.rename.description = 新文件名称 # Sketch -editor.sketch.rename.description = New name for sketch - -editor.status.autoformat.no_changes = No changes necessary for Auto Format. -editor.status.autoformat.finished = Auto Format finished. -editor.status.find_reference.select_word_first = First select a word to find in the reference. -editor.status.find_reference.not_available = No reference available for "%s". -editor.status.drag_and_drop.files_added.0 = No files were added to the sketch. -editor.status.drag_and_drop.files_added.1 = One file added to the sketch. -editor.status.drag_and_drop.files_added.n = %d files added to the sketch. +editor.sketch.rename.description = 速写本的新名称 + +editor.status.autoformat.no_changes = 自动格式化不需要做更改。 +editor.status.autoformat.finished = 自动格式化完成。 +editor.status.find_reference.select_word_first = 请首先选择要查找的关键字。 +editor.status.find_reference.not_available = 没有找到 "%s" 的引用。 +editor.status.drag_and_drop.files_added.0 = 未将任何文件添加到速写本。 +editor.status.drag_and_drop.files_added.1 = 将 1 个文件添加到速写本。 +editor.status.drag_and_drop.files_added.n = 将 %d 个文件添加到速写本。 editor.status.saving = 保存中... editor.status.saving.done = 保存完成. editor.status.saving.canceled = 取消保存. @@ -275,7 +291,7 @@ contrib.install = 安装 contrib.progress.starting = 开始 contrib.progress.downloading = 下载 contrib.download_error = 下载时出现问题. -contrib.unsupported_operating_system = 你当前的操作系统似乎不被支持. 你应该访问 %s's 该库文件地址得到更多信息. +contrib.unsupported_operating_system = 你当前的操作系统似乎不被支持. 你应该访问 %s 获取更多信息. # --------------------------------------- diff --git a/build/shared/lib/languages/languages.txt b/build/shared/lib/languages/languages.txt index 60701853e8..27ca7a6e8a 100644 --- a/build/shared/lib/languages/languages.txt +++ b/build/shared/lib/languages/languages.txt @@ -2,16 +2,21 @@ # http://en.wikipedia.org/wiki/ISO_639-1 # http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes -# Add new languages in alphabetical order to (slightly) +# Add new languages in alphabetical order to (slightly) # reduce the risk of merge conflicts +ar # Arabic de # German, Deutsch en # English, English el # Greek es # Spanish fr # French, Français, Langue française +it # Italiano, Italian ja # Japanese ko # Korean nl # Dutch, Nederlands pt # Portuguese -zh # Chinese \ No newline at end of file +ru # Russian +tr # Turkish +uk # Ukrainian +zh # Chinese diff --git a/build/shared/lib/manager/close-1x.png b/build/shared/lib/manager/close-1x.png new file mode 100644 index 0000000000..02ab4cc4e1 Binary files /dev/null and b/build/shared/lib/manager/close-1x.png differ diff --git a/build/shared/lib/manager/close-2x.png b/build/shared/lib/manager/close-2x.png new file mode 100644 index 0000000000..3f3202da79 Binary files /dev/null and b/build/shared/lib/manager/close-2x.png differ diff --git a/build/shared/lib/manager/downloading-1x.png b/build/shared/lib/manager/downloading-1x.png new file mode 100644 index 0000000000..87003e77ba Binary files /dev/null and b/build/shared/lib/manager/downloading-1x.png differ diff --git a/build/shared/lib/manager/downloading-2x.png b/build/shared/lib/manager/downloading-2x.png new file mode 100644 index 0000000000..4146727b17 Binary files /dev/null and b/build/shared/lib/manager/downloading-2x.png differ diff --git a/build/shared/lib/manager/incompatible-1x.png b/build/shared/lib/manager/incompatible-1x.png new file mode 100644 index 0000000000..4af170c0b4 Binary files /dev/null and b/build/shared/lib/manager/incompatible-1x.png differ diff --git a/build/shared/lib/manager/incompatible-2x.png b/build/shared/lib/manager/incompatible-2x.png new file mode 100644 index 0000000000..d91a68ce70 Binary files /dev/null and b/build/shared/lib/manager/incompatible-2x.png differ diff --git a/build/shared/lib/manager/incompatible.png b/build/shared/lib/manager/incompatible.png deleted file mode 100644 index 009512883a..0000000000 Binary files a/build/shared/lib/manager/incompatible.png and /dev/null differ diff --git a/build/shared/lib/manager/install-1x.png b/build/shared/lib/manager/install-1x.png new file mode 100644 index 0000000000..17caf48588 Binary files /dev/null and b/build/shared/lib/manager/install-1x.png differ diff --git a/build/shared/lib/manager/install-2x.png b/build/shared/lib/manager/install-2x.png new file mode 100644 index 0000000000..1a7c43d251 Binary files /dev/null and b/build/shared/lib/manager/install-2x.png differ diff --git a/build/shared/lib/manager/install.png b/build/shared/lib/manager/install.png deleted file mode 100644 index bca954cb26..0000000000 Binary files a/build/shared/lib/manager/install.png and /dev/null differ diff --git a/build/shared/lib/manager/notification-1x.png b/build/shared/lib/manager/notification-1x.png new file mode 100644 index 0000000000..6d907226ed Binary files /dev/null and b/build/shared/lib/manager/notification-1x.png differ diff --git a/build/shared/lib/manager/notification-2x.png b/build/shared/lib/manager/notification-2x.png new file mode 100644 index 0000000000..ec0850c3fc Binary files /dev/null and b/build/shared/lib/manager/notification-2x.png differ diff --git a/build/shared/lib/manager/notification.png b/build/shared/lib/manager/notification.png deleted file mode 100644 index 8f605cf0b5..0000000000 Binary files a/build/shared/lib/manager/notification.png and /dev/null differ diff --git a/build/shared/lib/manager/remove-1x.png b/build/shared/lib/manager/remove-1x.png new file mode 100644 index 0000000000..dcfdb1b42d Binary files /dev/null and b/build/shared/lib/manager/remove-1x.png differ diff --git a/build/shared/lib/manager/remove-2x.png b/build/shared/lib/manager/remove-2x.png new file mode 100644 index 0000000000..6857de36c9 Binary files /dev/null and b/build/shared/lib/manager/remove-2x.png differ diff --git a/build/shared/lib/manager/remove.png b/build/shared/lib/manager/remove.png deleted file mode 100644 index 4cbf446d9e..0000000000 Binary files a/build/shared/lib/manager/remove.png and /dev/null differ diff --git a/build/shared/lib/manager/search-1x.png b/build/shared/lib/manager/search-1x.png new file mode 100644 index 0000000000..1c29f1725f Binary files /dev/null and b/build/shared/lib/manager/search-1x.png differ diff --git a/build/shared/lib/manager/search-2x.png b/build/shared/lib/manager/search-2x.png new file mode 100644 index 0000000000..e65ceae592 Binary files /dev/null and b/build/shared/lib/manager/search-2x.png differ diff --git a/build/shared/lib/manager/search.png b/build/shared/lib/manager/search.png deleted file mode 100644 index 7838154627..0000000000 Binary files a/build/shared/lib/manager/search.png and /dev/null differ diff --git a/build/shared/lib/manager/up-to-date-1x.png b/build/shared/lib/manager/up-to-date-1x.png new file mode 100644 index 0000000000..d19e289f28 Binary files /dev/null and b/build/shared/lib/manager/up-to-date-1x.png differ diff --git a/build/shared/lib/manager/up-to-date-2x.png b/build/shared/lib/manager/up-to-date-2x.png new file mode 100644 index 0000000000..abfe369a50 Binary files /dev/null and b/build/shared/lib/manager/up-to-date-2x.png differ diff --git a/build/shared/lib/manager/up-to-date.png b/build/shared/lib/manager/up-to-date.png deleted file mode 100644 index 2e6c98f23a..0000000000 Binary files a/build/shared/lib/manager/up-to-date.png and /dev/null differ diff --git a/build/shared/lib/manager/update-1x.png b/build/shared/lib/manager/update-1x.png new file mode 100644 index 0000000000..525aaf37db Binary files /dev/null and b/build/shared/lib/manager/update-1x.png differ diff --git a/build/shared/lib/manager/update-2x.png b/build/shared/lib/manager/update-2x.png new file mode 100644 index 0000000000..75dfdbe072 Binary files /dev/null and b/build/shared/lib/manager/update-2x.png differ diff --git a/build/shared/lib/manager/update-available-1x.png b/build/shared/lib/manager/update-available-1x.png new file mode 100644 index 0000000000..b8b16d92b9 Binary files /dev/null and b/build/shared/lib/manager/update-available-1x.png differ diff --git a/build/shared/lib/manager/update-available-2x.png b/build/shared/lib/manager/update-available-2x.png new file mode 100644 index 0000000000..a8e74c43d9 Binary files /dev/null and b/build/shared/lib/manager/update-available-2x.png differ diff --git a/build/shared/lib/manager/update-available.png b/build/shared/lib/manager/update-available.png deleted file mode 100644 index 81598e319a..0000000000 Binary files a/build/shared/lib/manager/update-available.png and /dev/null differ diff --git a/build/shared/lib/manager/update.png b/build/shared/lib/manager/update.png deleted file mode 100644 index da77474783..0000000000 Binary files a/build/shared/lib/manager/update.png and /dev/null differ diff --git a/build/shared/lib/status/error.png b/build/shared/lib/status/error.png new file mode 100644 index 0000000000..60e083677b Binary files /dev/null and b/build/shared/lib/status/error.png differ diff --git a/build/shared/lib/status/notice.png b/build/shared/lib/status/notice.png new file mode 100644 index 0000000000..ed1b995d90 Binary files /dev/null and b/build/shared/lib/status/notice.png differ diff --git a/build/shared/lib/status/warning.png b/build/shared/lib/status/warning.png new file mode 100644 index 0000000000..eeb52d7688 Binary files /dev/null and b/build/shared/lib/status/warning.png differ diff --git a/build/shared/lib/theme.txt b/build/shared/lib/theme.txt index 2b93032171..88083bd240 100644 --- a/build/shared/lib/theme.txt +++ b/build/shared/lib/theme.txt @@ -3,13 +3,16 @@ status.notice.fgcolor = #000000 status.notice.bgcolor = #818b95 status.error.fgcolor = #ffffff -#status.error.bgcolor = #662000 -status.error.bgcolor = #9e1916 -status.edit.fgcolor = #000000 -status.edit.bgcolor = #cc9900 +status.error.bgcolor = #9E0A0A +status.warning.bgcolor = #EF8115 +status.warning.fgcolor = #FFFFFF +status.url.fgcolor = #cccccc status.font = processing.sans,plain,13 +# For the clipboard icon, needs to be a little larger on macOS +status.emoji.font = Dialog,plain,19 +status.emoji.font.macosx = Dialog,plain,22 -# TABS +# HEADER TABS # Settings for the tab area at the top. header.text.font = processing.sans,bold,14 header.text.selected.color = #000000 @@ -19,34 +22,33 @@ header.gradient.top = #132638 header.gradient.bottom = #122535 header.tab.selected.color = #e0fffd header.tab.unselected.color = #2d4251 +header.tab.modified.color = #ef8115 -# LOWER TABS +# FOOTER TABS footer.text.font = processing.sans,bold,12 -footer.text.selected.color = #ffffff -footer.text.unselected.color = #000000 +footer.text.selected.color = #e0fffd +footer.text.unselected.color = #95adb0 footer.tab.arrow.color = #ffffff footer.gradient.top = #132638 footer.gradient.bottom = #122535 -footer.tab.selected.color = #3D5362 -footer.tab.unselected.color = #2d4251 +footer.tab.selected.color = #2d4251 +footer.tab.unselected.color = #1f3241 # updates orange #eb7f15 +footer.updates.color = #ed7f15 # CONSOLE # The font is handled by preferences, so its size/etc are modifiable. console.color = #000000 console.output.color = #cccccc -#console.error.color = #ff3000 -# too dark! -#console.error.color = #9e1916 -# brightened version +# text color for errors printed in the console console.error.color = #d9211e # TOOLBAR BUTTONS buttons.bgcolor = #000000 # for the debug and mode buttons -reversed.gradient.top = #10212f -reversed.gradient.bottom = #122637 +#reversed.gradient.top = #10212f +#reversed.gradient.bottom = #122637 ## size of divider between editing area and the console #divider.size = 0 @@ -61,10 +63,6 @@ divider.dot.diameter = 3 divider.dot.color = #505050 # TOOLBAR BUTTON TEXT -#buttons.status.font = processing.sans,bold,13 -#buttons.status.color = #ffffff -#toolbar.sketch.font = processing.sans,plain,24 -#toolbar.sketch.color = #ffffff toolbar.rollover.font = processing.sans,plain,12 toolbar.rollover.color = #ffffff toolbar.gradient.top = #142a3e @@ -83,13 +81,6 @@ mode.title.color = #ffffff mode.background.color = #132638 mode.outline.color = #3a505e -# LINE STATUS -# The editor line number status bar at the bottom of the screen -#linestatus.color = #ffffff -#linestatus.bgcolor = #29333d -#linestatus.font = processing.sans,plain,13 -#linestatus.height = 20 - # EDITOR - DETAILS @@ -98,7 +89,7 @@ editor.fgcolor = #000000 editor.bgcolor = #ffffff editor.gradient.top = #122535 -editor.gradient.bottom = #020408 +editor.gradient.bottom = #010305 # highlight for the current line #editor.linehighlight.color=#e2e2e2 @@ -124,4 +115,62 @@ editor.gutter.text.font = processing.mono,plain,11 #editor.gutter.text.color = #657d87 #editor.gutter.text.color = #587478 editor.gutter.text.color = #bbd6d5 + +# marker for breakpointed lines in left hand gutter (2 ascii characters) +#editor.gutter.breakpoint.marker = <> +#editor.gutter.breakpoint.marker.color = #4a545e + +# marker for the current line in left hand gutter (2 ascii characters) +#editor.gutter.currentline.marker = -> +#editor.gutter.currentline.marker.color = #e27500 + +# bgcolor for the current (highlighted) line editor.gutter.linehighlight.color=#587478 + +# left- and right-hand gutter color +editor.gutter.bgcolor = #122535 + +# color of vertical separation line +#gutter.linecolor = #e9e9e9 +# space (in px) added to left and right of gutter markers +editor.gutter.padding = 3 + +# squiggly line underneath errors in the editor +editor.error.underline.color = #C40E0E +# squiggly line underneath warnings +editor.warning.underline.color = #ffc30e +# lines next to the scrollbar showing where errors are located +editor.column.error.color = #9F1613 +editor.column.warning.color = #ffc30e + +# not in use? +#breakpoint.bgcolor = #f0f0f0 +#currentline.bgcolor = #ffff96 + +errors.header.font = processing.sans,plain,12 +errors.header.bgcolor = #EBEBEB +errors.header.fgcolor = #484848 +errors.row.font = processing.sans,plain,12 +errors.row.fgcolor = #484848 +errors.row.bgcolor = #FFFFFF +errors.selection.fgcolor = #242424 +errors.selection.bgcolor = #E5E5E5 +errors.selection.error.bgcolor = #F5E6E6 +errors.selection.warning.bgcolor = #FDF2E7 +#errors.indicator.size = 3 +errors.indicator.error.color = #9E0A0A +errors.indicator.warning.color = #EF8115 + +manager.tab.selected.color = #e0fffd +manager.tab.unselected.color = #2d4251 +manager.tab.text.font = processing.sans,bold,14 +manager.tab.text.selected.color = #000000 +manager.tab.text.unselected.color = #ffffff +# orange circle for updates +manager.tab.update.color = #ed7f15 +manager.tab.gradient.top = #132638 +manager.tab.gradient.bottom = #122535 +manager.tab.background = #132638 + +# tree for Examples and Sketchbook windows +tree.font = processing.sans,plain,12 diff --git a/build/shared/lib/welcome/generic.html b/build/shared/lib/welcome/generic.html index 27a62070d6..798a129f51 100644 --- a/build/shared/lib/welcome/generic.html +++ b/build/shared/lib/welcome/generic.html @@ -1,97 +1,31 @@ Welcome to Processing 3 - + - -
- - - - - - - - -
- - -

Welcome to Processing 3

-
- -

- Read about what’s new in 3.0 → -

- -

- Note that some sketches from Processing 2 may not be compatible. - What has changed? -

- - - - - - - -
- - - Show this welcome
message each time -
- -
- -
+ + + + + + +
+ + +

Welcome to Processing 3

+
+ +

+ Read about what’s new in 3.0 → +

+ +

+ Note that some sketches from Processing 2 may not be compatible. + What has changed? +

- diff --git a/build/shared/lib/welcome/sketchbook.html b/build/shared/lib/welcome/sketchbook.html index 796daa9cbd..7d27e78380 100644 --- a/build/shared/lib/welcome/sketchbook.html +++ b/build/shared/lib/welcome/sketchbook.html @@ -1,121 +1,50 @@ Welcome to Processing 3 - + - -
- - - - - - - -
- - -

Welcome to Processing 3

-
- + + + + + + +
+ + +

Welcome to Processing 3

+
+ +

+ Read about what’s new in 3.0 → +

+ +

+ Note that some sketches from Processing 2 may not be compatible. + What has changed? +

+ +

- Read about what’s new in 3.0 → + Since older sketches may not be compatible, we recommend creating a new sketchbook folder, so Processing 2 and 3 can happily coexist. This is a one-time process. Read more about it.

-

- Note that some sketches from Processing 2 may not be compatible. - What has changed? -

- -
-

- Since older sketches may not be compatible, we recommend creating a new sketchbook folder, so Processing 2 and 3 can happily coexist. This is a one-time process. Read more about it. -

- - - - - - - - - - -
- - - Create a new sketchbook folder for use with Processing 3 sketches (recommended!) -
- - - Use the existing sketchbook folder for both old and new sketches (may cause conflicts with installed libraries) -
- -
- - +
- + +
- - - Show this welcome
message each time + Click here to create a new sketchbook folder for Processing 3 (recommended!)
- + Otherwise, your existing sketchbook folder will be used for both old and new sketches (may cause conflicts with installed libraries)
- - - +
+ diff --git a/build/shared/lib/welcome/style.css b/build/shared/lib/welcome/style.css new file mode 100644 index 0000000000..231f277437 --- /dev/null +++ b/build/shared/lib/welcome/style.css @@ -0,0 +1,43 @@ +* { + margin: 0; + padding: 0; +} + +body { + padding-left: 20px; + padding-right: 20px; + font-family: "Processing Sans Pro", sans-serif; +} + +h1 { + margin-bottom: 0; + /* can't get the Semibold to work properly */ + font-family: "Processing Sans Pro", sans-serif; + font-size: 18px; + font-weight: normal; +} + +p, td { + margin-bottom: 0; + font-size: 11px; + line-height: 12px; +} + +table { + margin-top: 10px; + margin-bottom: 0; +} + +p.inset, table.inset { + padding: 10px; + background-color: rgb(224, 253, 251); +} + +a { + color: #2c7bb5; + text-decoration: none; +} + +#startButton { + margin-left: 50px; +} \ No newline at end of file diff --git a/build/shared/revisions.txt b/build/shared/revisions.txt index 9fc72cf430..5ed6ba5914 100644 --- a/build/shared/revisions.txt +++ b/build/shared/revisions.txt @@ -1,9 +1,2961 @@ +PROCESSING 3.5.4 (REV 0270) - 17 January 2020 + +This release has several bug fixes to improve the Contribution Manager, +get Tweak Mode working again, and so on. + + +[ changes ] + ++ Don't remove entries from Recent menu on Save As + https://github.com/processing/processing/issues/5902 + ++ Use ctrl-page up/down for changing tabs on Windows + https://github.com/processing/processing/issues/5794 + ++ Show error when .properties file is missing from a Library/Mode/Tool. + + +[ fixes ] + ++ Tweak Mode working again (fix from Gal Sasson) + https://github.com/processing/processing/issues/5805 + https://github.com/processing/processing/pull/5909 + ++ Fix potential highlighting issue that wasn't selecting portions of text + ++ Names in the contribution listing are no longer case sensitive + (It was placing lowercase names at the bottom of the list.) + ++ Clean up a lot of bad temp file handling in the contrib manager + https://github.com/processing/processing/issues/5845 + https://github.com/processing/processing/issues/5960 + ++ Fix NullPointerException in installPreviouslyFailed() on startup + https://github.com/processing/processing/issues/5482 + https://github.com/processing/processing/issues/5916 + + +[ internal ] + ++ Ignore subfolders in the "libraries" directory. This was causing some + nasty startup issues for folks, and other hard-to-track bugs. Hopefully + there aren't any installs that relied on this behavior. + ++ Update AppBundler to use newer SDK, recompile + ++ Edit build.xml files and appbundler to preserve more attributes + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.5.3 (REV 0269) - 3 February 2019 + +This fixes a typo that left the "Redo" command with the wrong +key shortcut on Windows in the last release, adds updated reference, +and includes a handful of other smaller fixes. + + +[ fixes ] + ++ "Redo" key shortcut for Windows screwed up + https://github.com/processing/processing/issues/5773 + ++ Fix an editor problem with plain text (css, etc) files + https://github.com/processing/processing/issues/5628 + ++ Default to using java.awt.Desktop methods for URLs/files when available + on Linux. Also cover a few weird cases that were failing silently. + ++ Ignore .class files found in the META-INF folder for imported JARs + https://github.com/processing/processing/issues/5778 + ++ Get rid of errant 'Could not parse -1 for display' message. + ++ Fix up and clean a few file i/o issues that were causing resource + leaks with loadXxxx() commands, and intermediate folders not being + created for temporary files used by the saveXxxx() commands. + + +[ additions ] + ++ Added reference for circle(), square(), push(), pop() + + +[ contributions ] + ++ Updated translation of the word "sketch" for Russian speakers + https://github.com/processing/processing/pull/5673 + ++ Update missing @Deprecated tags in PApplet.java + https://github.com/processing/processing/pull/5686 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.5.2 (REV 0268) - 22 January 2019 + +Fixed a pair of nasty regressions, and adding a couple key shortcuts +to the preferences file. + +Also: please help us localize the menu shortcuts that have been causing +trouble on non-US keyboards. See the Localization wiki for more details: +https://github.com/processing/processing/wiki/Localization#shortcuts-and-key-bindings + + +[ more regressions! ] + ++ Some Linux/Windows menu shortcuts were mapped to META instead of CTRL + https://github.com/processing/processing/issues/5763 + ++ Ctrl-click on Mac OS X result in all subsequent clicks reported as right-click + https://github.com/processing/processing/issues/5765 + https://github.com/processing/processing/pull/5766 + + +[ and a new feature! ] + ++ The nine menu shortcuts that can be localized can now also be overridden + by users in preferences.txt. Information is on the Localization page. + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.5.1 (REV 0267) - 21 January 2019 + +Should have known better than to try to fix a bug connnected to +something as fundamental as the size() command. This release just +fixes one major regression in 3.5. + +Please see the release notes for 3.5 for the major changes since 3.4: +https://github.com/processing/processing/releases/tag/processing-0266-3.5 + + +[ oops, sorry ] + ++ size() command not working properly + https://github.com/processing/processing/issues/5759 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.5 (REV 0266) - 20 January 2019 + +Hello from the flight back from Processing Community Day 2019 in LA! +How about a new release? Lots of bug fixes and updates for you. + +We're rolling the minor version from 3.4 to 3.5 because of the additions +to the API and a minor (breaking) change to remove() in the Dict classes. + + +[ api changes and additions ] + ++ Added circle() and square() methods. + ++ Added push() and pop() for parity with p5.js + ++ Non-US keyboards have trouble with a couple of shortcuts, + so their implementation has been moved to the language files. + Please help us update the defaults for your language. More here: + https://github.com/processing/processing/wiki/Localization#shortcuts-and-key-bindings + https://github.com/processing/processing/issues/2199 + https://github.com/processing/processing/issues/3538 + ++ Make JSONObject.quote() (both versions) public + ++ Change behavior of the remove() method in IntDict, FloatDict, etc. + It now returns the value removed, for consistency with the other + remove functions (and most usefulness). In some cases, was returning + the index, which isn't as useful. If remove() is called on a value that + does not exist, an runtime exception will be thrown because there's no + sensible way to indicate that nothing was removed. This is also more + consistent with removeIndex() throwing and exception when the specified + index is not available. + + +[ contributed fixes ] + ++ Extended SVG support for fonts and text + https://github.com/processing/processing/pull/4168 + ++ Updated Russian translation, now can choose Russian in preferences + https://github.com/processing/processing/pull/5619 + ++ Turkish translation updates + https://github.com/processing/processing/pull/5636 + ++ Examples dialog was causing high CPU load + https://github.com/processing/processing/issues/5246 + https://github.com/processing/processing/pull/5654 + ++ Show a warning when a font isn't what the user expected + https://github.com/processing/processing/issues/5481 + https://github.com/processing/processing/pull/5605 + ++ Add a button to hide the console + https://github.com/processing/processing/pull/5115 + ++ Fix NullPointerException in Contribution Manager when installing + https://github.com/processing/processing/issues/5524 + https://github.com/processing/processing/pull/5742 + ++ Improvements to appdata.xml for Linux + https://github.com/processing/processing/pull/5604 + ++ Fix javaPlatform variable for newer JDK versions + https://github.com/processing/processing/pull/5626 + ++ Fix blend mode not being set correctly + https://github.com/processing/processing/issues/5645 + https://github.com/processing/processing/pull/5647 + ++ Profile GL3bc is not available on X11GraphicsDevice + https://github.com/processing/processing/issues/5476 + https://github.com/processing/processing/pull/5652 + + +[ jakub fixes ] + ++ Prevent "could not find sketch size" message from freezing the app + https://github.com/processing/processing/issues/4893 + https://github.com/processing/processing/pull/5708 + https://github.com/processing/processing/issues/5030 (duplicate) + ++ Prevent sketch exceptions from being hidden by a warning + https://github.com/processing/processing/pull/5486 + https://github.com/processing/processing/issues/5412 + ++ size(0, 0) just freezes instead of showing an error + https://github.com/processing/processing/issues/5233 (duplicate) + ++ Fix freeze when restarting sketch with variables in size + https://github.com/processing/processing/pull/5708 + ++ Make sure Ctrl+Left Mouse on MacOS is consistent + https://github.com/processing/processing/issues/5672 + https://github.com/processing/processing/pull/5674 + ++ Stop frame rate counter from exaggerating + https://github.com/processing/processing/pull/5697 + ++ Fix vertex buffer initialized with wrong number of components + https://github.com/processing/processing/pull/5698 + ++ Recreate FBOs when offscreen PGraphicsOpenGL is resized + https://github.com/processing/processing/pull/5699 + + +[ andres with the updates ] + ++ Silence TIS/TSM warning message with P2D/P3D/OPENGL since macOS 10.13.4 + https://github.com/processing/processing/issues/5462 + ++ Improve matrix performance in P2D/P3D + https://github.com/processing/processing/issues/5685 + ++ Initializing textures loads the pixels array, even if not needed aferwards + https://github.com/processing/processing/issues/5748 + ++ Improve startup time by skipping the Android SDK folder when listing sketches + https://github.com/processing/processing/issues/5707 + ++ PShape.attrib() and PShape.setAttrib() are not working + https://github.com/processing/processing/issues/5560 + + +[ still more bug fixes and improvements ] + ++ Improve startup time when user-specified fonts are not used. + The default font will be faster, using ttf/otf is fine. + Only load font list when createFont("The Font Name") is used, + or PFont.list() is called. + ++ "Sketch disappeared" infinite pop up dialogs + https://github.com/processing/processing/pull/4808 + https://github.com/processing/processing/issues/4805 + ++ If settings() present but pixelDensity() is in setup(), no error message + https://github.com/processing/processing/issues/4703 + ++ Fix several out of date links in the Help menu + https://github.com/processing/processing/issues/5729 + ++ Update the About screen to 2019 + ++ Update to Java 8u192, then to 8u202 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.4 (REV 0265) - 26 July 2018 + +Kind of a huge batch of bug fixes and updates. + +We've had trouble on Windows when MS Security Essentials or Windows Defender +decides to defend your machine from our software, removing files from the +download and making Processing unusable. A few extra checks have been added +so that more helpful warnings can be conveyed when this happens. + +The other important fix is better handling in the Contributions Manager +for sites that use https. This fixes Python Mode installation, and many +others that have recently started reporting "Could not find a ... in the +downloaded file" when installing a Library, Mode, Tool, or Example set. + +We're also bumping the release to 3.4 because of a lot of additions, +plus some internal changes that have an impact on API. + + +[ the big ones ] + ++ Show alternate error message on Windows when jnidispatch.dll or core.jar + have been removed by Windows Defender or Microsoft Security Essentials. + https://github.com/processing/processing/issues/5537 + https://github.com/processing/processing/issues/4929 + https://github.com/processing/processing/issues/5442 + This has been a huge headache for us. We've repeatedly submitted the + software and asked Microsoft for help, but haven't had any luck. + If you run into this issue and would like to help, please submit the files + to Microsoft here: https://www.microsoft.com/en-us/wdsi/filesubmission + Perhaps if there are enough reports, they'll understand this is affecting + a lot of people. + ++ Contributed libraries/examples/etc that redirect to https URLs now working. + https://github.com/processing/processing/issues/5554 + + +[ new features ] + ++ It's now possible to make your own theme file for Processing. Copy the + theme.txt file from inside the Processing folder to your sketchbook + folder, and then edit away. For instance, to make a dark theme: + https://github.com/processing/processing/wiki/Dark-Theme-for-PDE + ++ It's now possible to copy the text of the status bar. Click the clipboard + icon at the right-hand side to copy the text to the clipboard. To search + immediately, use shift-click. + https://github.com/processing/processing/issues/5271 + https://github.com/processing/processing/pull/5345 + The default search engine is Google, but you can modify that by altering + the 'search.format' line in preferences.txt + ++ Added pyde as a supported extension, so double-clicking + on Python sketches will launch the PDE. + https://github.com/jdf/processing.py/issues/284 + + +[ do you like data? ] + ++ Added Double and Long versions of the data classes. Not sure if we'll + keep these, but we're trying them out. + ++ Also add subset(long) and subset(double) to PApplet + ++ Changed the internal Sort class to use int for comparisons for better + accuracy, especially when working with double and long values. + ++ Consistently implemented write(PrintWriter) in the List and Dict classes + ++ Added save(File) to the List and Dict classes + ++ Prevent Table.sort() from throwing NullPointerException with empty cells + + +[ updates ] + ++ Fixed up the Welcome dialog. When closing the window or hitting ESC, + the "show this" selection is recorded. Also clicking that text will + toggle the checkbox on/off, as users would expect. + https://github.com/processing/processing/issues/3911 + https://github.com/processing/processing/issues/3912 + ++ Redesigned the Rename window to be less ugly. Now closes when ESC is + pressed, and the default action is set so hitting Enter will work properly. + https://github.com/processing/processing/issues/5391 + https://github.com/processing/processing/issues/5400 + ++ Rewrite exec() to do threads, also handle fast/excessive output cases + ++ Rewrite requestImage() to fix errors/slowness/concurrency problems + ++ Refactoring inside the completion code + https://github.com/processing/processing/commit/7e3661e9f7a6df1569c8bebc683e7742f50caa25 + https://github.com/processing/processing/commit/20c6f86c0d600806c991962eb208548ac45e9e2a + https://github.com/processing/processing/commit/8dda8a4d02bc9a1d15e81fee3e6c183e4076a40e + https://github.com/processing/processing/commit/ff7dc4d5094ccf1cc35189c9412adda93153b436 + ++ Now using Java 8u181. + https://github.com/processing/processing/pull/5586 + ++ Change lack of blendMode() to a warning rather than an error in PDF + ++ Updated the copyright and year in the launch and About screen. + + +[ give gohai a hand, because he's all arm ] + ++ A large number of changes and fixes for ARM submitted by Gottfried, + who also posted 3.3.7.1 and 3.3.7.2 interim releases with some of these + changes already present. Now we're back on track with 3.4. + ++ Additional I/O improvements + https://github.com/processing/processing/pull/5581 + ++ Fix regressions in 3.3.7.1 + https://github.com/processing/processing/issues/5582 + ++ OpenGL ES: Fix GLSL version number for 1.00 + https://github.com/processing/processing/pull/5583 + ++ Add ADS1X15 Analog-to-Digital converter example + https://github.com/processing/processing/pull/5590 + ++ IO: pinMode() can now set pull-up and pull-down resistors on Raspbian + thanks to @xranby for 64-bit help + ++ Several new examples + https://github.com/processing/processing/pull/5566 + ++ IO: New example sketch showing how to use a MPR121 capacitive touch sensor + fun tutorial by @msurguy forthcoming + ++ IO: New example sketch showing how to use a BME280 environmental sensor + IO: New example sketch showing how to use a TSL2561 light sensor + IO: New example sketch showing how to use a PCA9685 Servo & PWM controller + ...all contributed by @OlivierLD + ++ IO: pinMode() got faster + https://github.com/processing/processing/pull/5557 + ++ IO: I2C now supports talking to slower devices, such as Arduino boards + https://github.com/processing/processing/pull/5567 + ++ Support for ARM Mali graphics was added to P2D/P3D + Thanks to seongwook from the forums for his help during bringup + https://github.com/processing/processing/pull/5485 + ++ P3D now supports up to 4 lights on Pi using their OpenGL driver + ++ Serial library now supports Raspbian's port naming (such as "/dev/serial0") + ++ Enable exporting of Windows applications on ARM + https://github.com/processing/processing/pull/5488 + https://github.com/processing/processing/issues/5287 + ++ Clarify SimpleInput example + https://github.com/processing/processing/pull/5558 + ++ Various ARM-related updates + https://github.com/processing/processing/pull/5440 + ++ Make P3D work on Linux SBCs using ARM Mali graphics and their ES 3.1 driver + https://github.com/processing/processing/pull/5475 + + +[ contributed by the community ] + ++ Updates to Japanese translation + https://github.com/processing/processing/pull/5263 + ++ Added Russian translation + https://github.com/processing/processing/pull/5451 + ++ Make "loadXML(String)" handle "file not found" + https://github.com/processing/processing/pull/5144 + ++ Update java.lang.UnsupportedClassVersionError message + https://github.com/processing/processing/pull/5459 + ++ Semi-transparent colors do not display properly in PGraphics + https://github.com/processing/processing/issues/5519 + https://github.com/processing/processing/pull/5522 + ++ Fixed a crash occuring while loading certain SVGs exported from Illustrator + https://github.com/processing/processing/pull/5526 + ++ Support PShape.contains() on GROUP objects + https://github.com/processing/processing/pull/5550 + ++ Improve implementation of PShape.contains() to take the CTM into account + https://github.com/processing/processing/pull/5549 + + +[ bug fixes ] + ++ Make sure the editor is updated after reloading changes (from Jakub) + https://github.com/processing/processing/pull/5487 + https://github.com/processing/processing/issues/5466 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.3.7 (REV 0264) - 13 March 2018 + +A rollup of several fixes from the last few months. + + +[ changes most likely to be noticed ] + ++ Windows Defender blocks Processing 3.3.6. Not sure why this was happening, + but hopefully a new release should be all that's necessary to fix it. + https://github.com/processing/processing/issues/5329 + ++ Lots of fixes for the Net Library by Jakub + https://github.com/processing/processing/pull/5378 + https://github.com/processing/processing/issues/4419 + https://github.com/processing/processing/issues/5360 + https://github.com/processing/processing/issues/3970 + https://github.com/processing/processing/pull/5389 + ++ Include newlines at end of files (i.e. when saving .pde files) + https://github.com/processing/processing/issues/5327 + Why do this? https://stackoverflow.com/a/729795 + ++ Rename (refactor) dialog is unusable on high density screen + https://github.com/processing/processing/issues/5368 + ++ Detect errors from curved quotation marks (a headache when copying/pasting) + https://github.com/processing/processing/issues/5133 + https://github.com/processing/processing/pull/5152 + ++ NullPointerException on close button with P3D and noLoop + https://github.com/processing/processing/issues/5214 + https://github.com/processing/processing/pull/5384 + ++ Fix exception due to version parsing in Java 9 + https://github.com/processing/processing/issues/5275 + ++ Fix line joins on triangles + https://github.com/processing/processing/issues/5353 + https://github.com/processing/processing/pull/5354 + + +[ somewhere in the middle ] + ++ Fix NullPointerException in ContributionManager.deleteFlagged() + https://github.com/processing/processing/issues/5342 + ++ Fix scrub comments for empty block comment /**/ + https://github.com/processing/processing/pull/5265 + https://github.com/processing/processing/issues/5219 + ++ Fix error checker crash when className contains [ or ] + https://github.com/processing/processing/pull/5304 + ++ Table.insertRow() causes ArrayIndexOutOfBoundsException (with fix) + https://github.com/processing/processing/issues/5406 + ++ blendMode() with PDF isn't showing the warning about it not being available + https://github.com/processing/processing/issues/5105 + ++ textureWrap() not updating when changed during draw() + https://github.com/processing/processing/issues/5322 + ++ Cap frameRate() to 1000 in OpenGL + https://github.com/processing/processing/issues/5404 + ++ ARM tweaks for shaders on the Raspberry Pi + https://github.com/processing/processing/pull/5297 + ++ Fix 3D on contemporary versions of Linux + https://github.com/processing/processing/pull/5428 + https://github.com/processing/processing/issues/5308 + ++ cursor() don't work after void noCursor() in P2D and P3D + https://github.com/processing/processing/issues/5330 + https://github.com/processing/processing/pull/5340 + + +[ changes least likely to be noticed ] + ++ Fix JRE download issues + https://github.com/processing/processing/issues/5284 + ++ Update to Java 8u162 + ++ PdePreprocessor change is breaking current source + https://github.com/processing/processing/issues/5413 + ++ Output .java files in UTF-8 and force compiler to use UTF-8 + https://github.com/processing/processing/pull/5436 + ++ Refactor to use a few Java 8 features + https://github.com/processing/processing/pull/5134 + ++ Remove "Pipe Organ" from exec() docs + https://github.com/processing/processing/pull/5282 + ++ Fix typo in Italian translation + https://github.com/processing/processing/issues/5365 + ++ Remove useless deprecation on PImage.mask(int[]) + ++ Make un/registering methods in PApplet thread-safe + https://github.com/processing/processing/pull/5379 + ++ set colorModeDefault to true by default + ++ Minor bezierPoint() rewrite for performance + https://github.com/processing/processing/pull/5251 + + +[ additions! new features! ] + ++ Added setIndex() method to IntDict, FloatDict, StringDict + ++ Added resize() to IntDict, FloatDict, StringDict + ++ Fix entries() Iterator in IntDict, FloatDict, StringDict + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.3.6 (REV 0263) - 4 September 2017 + +A collection of mostly minor bug fixes that have accreted +since the last release back in June. + + +[ contributions, we love 'em ] + ++ Add Italian translation + https://github.com/processing/processing/pull/5169 + ++ Wrong tab for missing brace + https://github.com/processing/processing/pull/5180 + https://github.com/processing/processing/issues/5165 + ++ Fix typo in German translation + https://github.com/processing/processing/pull/5195 + https://github.com/processing/processing/issues/5187 + ++ Movie Maker only works once + https://github.com/processing/processing/issues/5168 + https://github.com/processing/processing/pull/5230 + ++ Add more build products to linux/.gitignore + https://github.com/processing/processing/pull/5229 + ++ Add issue template to the repo + https://github.com/processing/processing/issues/5239 + https://github.com/processing/processing/pull/5245 + ++ Add workaround for window size = 0 crash + https://github.com/processing/processing/pull/5234 + https://github.com/processing/processing/issues/5052 + + +[ jakub, we love him ] + ++ Fix comment/uncomment adding slashes at wrong indent + https://github.com/processing/processing/issues/5171 + https://github.com/processing/processing/pull/5185 + ++ Add JavaFX runtime to error checker class path + https://github.com/processing/processing/pull/5186 + + +[ gottfried, with gusto ] + ++ Ironing out the new shell() command + https://github.com/processing/processing/pull/5082 + ++ Workaround issues with August 2017 release of Raspbian + https://github.com/processing/processing/pull/5222 + ++ Fix bugs in line vert shader + https://github.com/processing/processing/pull/5184 + https://github.com/processing/processing/issues/5181 + https://github.com/processing/processing/issues/5182 + https://github.com/processing/processing/issues/5183 + https://github.com/processing/processing/issues/5194 + + +[ behind the scenes ] + ++ Updated to Java 8u144 + ++ Fixed issue with call to remove value instead of key in mode contrib hash + (this was only in the code used by the command line mode loader) + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.3.5 (REV 0262) - 23 June 2017 + +Fixes for a couple problems introduced in the last release. + + +[ everything that went bad ] + ++ Console window was only remembering two lines of text + because of a name collision in the preferences handling. + https://github.com/processing/processing/issues/5110 + ++ Something went wrong with the 64-bit Linux release: + "libjli.so: cannot open shared object file: No such file or directory" + https://github.com/processing/processing/issues/5111 + ++ "Could not parse -1 for --display" message on some Windows machines + https://github.com/processing/processing/issues/5118 + https://github.com/processing/processing/pull/5141 + + +[ some new things hopefully going good ] + ++ Fix a NullPointerException that showed up with textWidth() and OpenGL + https://github.com/processing/processing/issues/5137 + https://github.com/processing/processing/pull/5138 + ++ Per request, use native file choosers by default on Linux. I'm told + that the default Linux file choosers have grown up in the last decade. + I'm trusting the person who is making that claim and making them default. + https://github.com/processing/processing/issues/5122 + To get the old behavior in the Editor, change preferences.txt to say: + chooser.files.native = false + Or in your code, add this line: + useNativeSelect = false; + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.3.4 (REV 0261) - 3 June 2017 + +Several useful bug fixes and improvements. Some big, many small. + + +[ fixes you'll notice ] + ++ Exported applications no longer report as "Damaged" on macOS Sierra + https://github.com/processing/processing/issues/4705 + ++ Prevent the console from freezing up when print() and println() + are used to print thousands of lines of output. + https://github.com/processing/processing/pull/4935 + https://github.com/processing/processing/issues/4825 + ++ Apple broke key repeat in macOS Sierra, here's how to fix it: + https://github.com/processing/processing/wiki/Troubleshooting#key-repeat-on-macos-sierra + ++ Fix the keyPressed variable when multiple keys are pressed + https://github.com/processing/processing/pull/5050 + https://github.com/processing/processing/issues/5049 + + +[ some you probably won't ] + ++ Clarify wording of error message regarding sketchbook location + https://github.com/processing/processing/issues/4942 + ++ Remove 'run sketches on display' error text that showed up even + when using Processing for the first time + ++ Implement alternate 'ant app' target for macOS application debugging + ++ Added a null check to sketch loading to prevent some issues such as + https://github.com/processing/processing/issues/4980 + ++ Handle edge case for set() being called with a 2D vector, on a 3D vector + https://github.com/processing/processing/issues/5092 + + +[ incomplete additions ] + ++ Add exec() with StringList options (documentation coming soon) + ++ Begin work on a shell() function to do exec() via a shell + + +[ other contributions - thank you! ] + ++ Add install/uninstall scripts for Linux and correct mime types for the PDE + https://github.com/processing/processing/pull/5106 + ++ IO library updates for ARM + https://github.com/processing/processing/pull/5044 + ++ Check $SUDO_USER on Linux for locating the sketchbook folder + https://github.com/processing/processing/pull/5055 + https://github.com/processing/processing/pull/5054 + ++ Debugging the "files changed" detector in the Editor + https://github.com/processing/processing/issues/4713 + https://github.com/processing/processing/pull/5021 + https://github.com/processing/processing/pull/4849 + ++ Still more updates to the change detector + https://github.com/processing/processing/pull/5075 + ++ Warn user to use L when creating a number constant that won't fit into an int + https://github.com/processing/processing/issues/4878 + https://github.com/processing/processing/pull/5077 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.3.3 (REV 0260) - 2 May 2017 + +Happy birthday to my Dad and baby brother! + +Let's celebrate with a couple of bug fixes: + ++ keyPressed not returning false once a key is released + https://github.com/processing/processing/issues/5033 + ++ Image tint() was broken in 3.3.x + https://github.com/processing/processing/issues/5040 + https://github.com/processing/processing/pull/5042 + ++ Deal with loadBytes() regressions introduced by their rewrite + (was breaking p5jsMode because of its use of loadBytes(File) + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.3.2 (REV 0259) - 25 April 2017 + +Broke a few eggs with that last omelette, and left a little eggshell behind. +This version takes care of a handful of revisions. + +[ bug fixes, mostly for regressions in 3.3.1 ] + ++ ArrayIndexOutOfBoundsException when using tint() or loadFont() + https://github.com/processing/processing/issues/5028 + https://github.com/processing/processing/pull/5029 + ++ createInput() wasn't returning null for files that were not found + https://github.com/processing/processing/issues/5026 + ++ Assigning Pixels Vertically Flipped in P2D + https://github.com/processing/processing/issues/5013 + + +[ useful updates, that hopefully aren't regressions ] + ++ Improve loadBytes() performance + https://github.com/processing/processing/pull/5027 + ++ Add (far) more efficient file loading for loadBytes(File) + ++ Add loadBytes(URL) variant that uses content length header for array size + ++ keyPressed is false if one key is released while multiple keys are pressed + https://github.com/processing/processing/issues/4993 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.3.1 (REV 0258) - 23 April 2017 + +With Casey and Ben together in Boston for a conference, we managed to +wrap up a few things and prepare a new release. Highlights include: + ++ The UI now supports Arabic with a new translation provided by Omar Hommos + ++ Several bug fixes have been implemented for high-res display support + on Windows and Linux + ++ Several updates from Gottfried for ARM devices like Raspberry Pi and CHIP + ++ Lots of pixelDensity() and sketch scaling work has been developed by + Jakub Valtar and is in the current release, though we've not yet + activated these features entirely. Expect those in the 3.4 release. + +And now on with the countdown: + + +[ bug fixes ] + ++ Fix gap between tab headers and text area at 125% and 150% scaling on Windows + https://github.com/processing/processing/issues/4902 + ++ Some line heights were wrong on hi-dpi displays + https://github.com/processing/processing/issues/4936 + https://github.com/processing/processing/issues/5007 + ++ Fix small tooltip text on high-dpi screens + https://github.com/processing/processing/issues/4914 + ++ Ugly button images at 125% and 150% scaling on Windows + https://github.com/processing/processing/issues/4901 + https://github.com/processing/processing/pull/4906 + ++ Get rid of error message when exporting sketches with the video library + https://github.com/processing/processing/issues/4971 + ++ Fix preprocessing of code with double backslash in string or char literal + https://github.com/processing/processing/issues/4903 + https://github.com/processing/processing/pull/4907 + ++ Fix breakpoints in inner classes + https://github.com/processing/processing/pull/5008 + https://github.com/processing/processing/issues/2946 + ++ Fix preprocessor skipping one char after a block comment + https://github.com/processing/processing/issues/4995 + https://github.com/processing/processing/pull/4999 + ++ Synchronize input event processing + https://github.com/processing/processing/pull/4998 + ++ Scrub comments: skip the second chracter in the escape sequence + https://github.com/processing/processing/pull/5019 + https://github.com/processing/processing/issues/5016 + + +[ additions & changes ] + ++ Added Arabic translation + https://github.com/processing/processing/pull/4970 + ++ Added Jump to Declaration + https://github.com/processing/processing/pull/4707 + https://github.com/processing/processing/issues/4668 + ++ Fix the JRE downloader and upgrade to Java 8 update 131 + ++ Add another warning for yet another a bad NVIDIA driver + https://github.com/processing/processing/issues/4997 + ++ Make the Error Table extend white to the bottom + ++ Use built-in font for any non-Roman or CJK language + + +[ graphics & the core ] + ++ Major work on window placement and pixel density by Jakub + https://github.com/processing/processing/pull/5011 + ++ Improve sum() functions in processing.data + Add sum() to IntDict and FloatDict + Add sumLong() to IntList, IntDict (to handle cases outside integer range) + Add sumDouble() to FloatList, FloatDict (to handle outside float range) + Throw exception when using sum() with numbers that are too large or small + ++ createInput() and createOutput() now both use buffered streams by default + createInputRaw() does not, however + ++ Don't derive the font again if the size is unchanged + https://github.com/processing/processing/issues/4956 + ++ fix temporary file handling for saveBytes(), saveStream(), etc + wasn't handling gzip output properly + also could have problems w/ names under length 3 + + +[ gottfried's arms ] + ++ Add support for 64-bit ARM boards + https://github.com/processing/processing/pull/5002 + ++ Hardware I/O updates for ARM + https://github.com/processing/processing/pull/4931 + ++ Fix MeshTweening vertex shader + https://github.com/processing/processing-docs/issues/523 + https://github.com/processing/processing-docs/pull/524 + ++ ARM: Allow Raspberry Pi's Mesa GL driver to use up to 8 lights + https://github.com/processing/processing/pull/4915 + ...and revert it back again + https://github.com/processing/processing/pull/4922 + ++ Retry with multisampling disabled if creating a framebuffer + fails because of INCOMPLETE_MULTISAMPLE + https://github.com/processing/processing/pull/4921 + ++ Report more error conditions in validateFramebuffer + https://github.com/processing/processing/pull/4920 + ++ Add more Raspberry Pi related fixes to JOGL + https://github.com/processing/processing/pull/4911 + ++ Unblock hardware-accelerated P3D on ARM Mali devices + https://github.com/processing/processing/pull/5014 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.3 (REV 0257) - 12 February 2017 + +This release adds the ability to the scale the UI or high-resolution +(known as HiDPI) screens on Windows and Linux. Sketches don't scale yet, +but this will at least make the Editor and Contribution Manager usable +again on more recent Windows and Linux laptops. + +Note: the scaling feature is only meant to patch up problems on HiDPI +devices, it does not provide an all-purpose means for scaling UI elements +independent of the OS. + +This release also attempts to fix several other Windows bugs, detailed +below. The "unconfirmed" fixes section is a handful of issues that I've +never been able to reproduce, but that should now be fixed. Please +confirm at the links listed to let me know if it's working. + +This is release 3.3 instead of 3.2.5 due to the huge change to the PDE +for scaling, as well as minor API modifications (see below). + + +[ big fixes ] + ++ PDE was too small on high-res Windows and Linux machines. If you're + having trouble with this, change the "Interface scaling" option in + the Preferences window. On Windows, it will attempt to auto-detect. + https://github.com/processing/processing/issues/2411 + https://github.com/processing/processing/issues/4183 + + +[ unconfirmed fixes ] + ++ Visual artifacts on Windows 10 when using menus + https://github.com/processing/processing/issues/4700 + ++ Broken characters in the Welcome Page and the Contribution Manager + https://github.com/processing/processing/issues/4747 + ++ Add a dialog box to warn Windows users about NVIDIA driver problems + https://github.com/processing/processing/issues/4853 + ++ Blank window on startup where the "Welcome" screen should be + https://github.com/processing/processing/issues/3933 + + +[ minor fixes ] + ++ Prevent unnecessary 'file not found' errors in the console during Export + + +[ fixed earlier ] + ++ Contribution Manager does not show all libraries until filter cleared + https://github.com/processing/processing/issues/4840 + + +[ changes to core ] + ++ StringDict(TableRow) constructor to create a dictionary from a table row + ++ Allow lone double quotes in the midst of CSV strings. This improves + compatibility with spreadsheets exported from Google Sheets. + ++ Return null (rather than NullPointerException) for PApplet.trim(null) + ++ Make trim() work on column titles as well + ++ Make Table.trim() also remove unused rows and columns. This will remove + extra rows or columns at the beginning as well, since that's what trim() + does to whitespace on strings. + ++ Consume Unicode BOM (0xFEFF) in createReader() and Table parser + ++ Return null for getString(), getJSONObject(), and getJSONArray() + when key is not present, more in line w/ other API + ++ Several fixes for memory leaks from jdf + https://github.com/processing/processing/pull/4862 + https://github.com/jdf/processing.py/issues/233 + https://github.com/processing/processing/pull/4873 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.2.4 (REV 0256) - 29 January 2017 + +Just getting in as many bug fixes as we can before the end of days. + +The majority of these are from Jakub Valtar, plus a handful of other +contributors are noted below. Read all the way to the end for fun +new features. + + +[ the pde & the editor ] + ++ Detect changes to 'hosts' file in case users modify/remove localhost. + No sketch window would open after hitting Run if someone had monkeyed + with their /etc/hosts file. + https://github.com/processing/processing/issues/4738 + https://github.com/processing/processing/issues/1868 + https://github.com/processing/processing/issues/3123 + https://github.com/processing/processing/issues/4735 + ++ Ctrl-J (for debugger) is inserting newline + https://github.com/processing/processing/issues/3830 + https://github.com/processing/processing/pull/4806 + https://github.com/processing/processing/issues/4804 + ++ Spaces not handled correctly in when installing "processing-java" on macOS + https://github.com/processing/processing/issues/4779 + ++ println(int(byte(245))) throwing error + https://github.com/processing/processing/issues/4652 + https://github.com/processing/processing/pull/4744 + ++ 'web colors' next to each other fail to parse in certain situations + https://github.com/processing/processing/issues/4752 + https://github.com/processing/processing/pull/4753 + ++ Pasting code from editor to empty editor produces Exception + https://github.com/processing/processing/issues/4522 + https://github.com/processing/processing/pull/4761 + ++ possible infinite loop on modified externally + https://github.com/processing/processing/issues/3965 + https://github.com/processing/processing/pull/4762 + ++ Report missing brace in correct tab, suppress other errors until fixed + https://github.com/processing/processing/pull/4777 + ++ Improvements to sketch launching and stopping + https://github.com/processing/processing/pull/4848 + ++ Syntax highlighting issues (fixed with #4761) + https://github.com/processing/processing/issues/4286 + ++ Sketchbook window wasn't updating when sketches added, renamed, etc + https://github.com/processing/processing/issues/2944 + https://github.com/processing/processing/pull/4842 + + +[ contribution manager ] + ++ Set text style properly for Contribution Manager error message + ++ Added the remove filter feature (Akarshit) + https://github.com/processing/processing/pull/3890 + ++ Several Contribution Manager fixes + https://github.com/processing/processing/pull/4844 + ++ Add missing equals() and hashCode() to Contribution + https://github.com/processing/processing/pull/4843 + ++ Contribution Manager does not show all libraries until filter cleared + https://github.com/processing/processing/pull/4843 + https://github.com/processing/processing/issues/4840 + ++ Mode, requiring update, appears in Updates tab but not in Modes tab + https://github.com/processing/processing/issues/4822 + also fixed w/ https://github.com/processing/processing/pull/4843 + + +[ internal changes ] + ++ Only require reference.zip to be present for build + ++ Move the DEBUG flag into an external file or preferences.txt. + Replace java.util.logging code with built-in logging. + ++ Split GUI and non-GUI portions of console for earlier startup. + (Otherwise System.err/out not going to a file unless we have a GUI, + which means we couldn't debug before the GUI shows up) + ++ Fix JRE download failure during ant build due to Oracle change + https://github.com/processing/processing/issues/4823 + + +[ the core ] + ++ Write exec() documentation + https://github.com/processing/processing/issues/4740 + ++ XML fixes for getChild() producing valid XML. Add xmlns to + elements procured from getChild(), and making sure newline + is added after XML header when formatting. + ++ Adding missing docs and keywords for TableRow + https://github.com/processing/processing/pull/4333 + ++ PShape in Java2D wasn't respecting 'kind' + https://github.com/processing/processing/issues/4826 + https://github.com/processing/processing/pull/4834 + ++ Sketches still running in the background after closing + https://github.com/processing/processing/issues/4831 + (needed to allow JAVA2D to terminate when animation thread dies) + https://github.com/processing/processing/pull/4839 + + +[ closing bugs in opengl ] + ++ PShape array index out of bounds when using P3D + https://github.com/processing/processing/issues/4773 + ++ Disable modelX/Y/Z() in P2D because they don't exist in 2D + https://github.com/processing/processing/issues/4813 + ++ Fix typo in GLSL preprocessor + https://github.com/processing/processing/issues/4810 + https://github.com/processing/processing/pull/4816 + ++ Keep Windows timer resolution high for OpenGL sketches. + Prevents frame rate in OpenGL hovering around 30 instead of 60. + https://github.com/processing/processing/pull/4847 + https://github.com/processing/processing/issues/4846 + + +[ the jakubfx renderer ] + ++ FX: Prevent matrix stack overflow + https://github.com/processing/processing/pull/4799 + https://github.com/processing/processing/issues/4206 + ++ FX: Reset transform to identity before drawing background + https://github.com/processing/processing/pull/4795 + ++ FX: Implement mouse wheel event + https://github.com/processing/processing/issues/4169 + https://github.com/processing/processing/pull/4796 + ++ FX: Fix curveVertex drawing all curves together as one long curve + https://github.com/processing/processing/pull/4800 + https://github.com/processing/processing/issues/4382 + ++ FX: Add exception handler which reports exceptions from user code + https://github.com/processing/processing/pull/4798 + https://github.com/processing/processing/issues/4339 + ++ Unify mouse pressed/released events across renderers + https://github.com/processing/processing/issues/4361 + https://github.com/processing/processing/pull/4797 + + +[ new features ] + ++ Add listPaths(), listFiles() + https://github.com/processing/processing/issues/4622 + ++ Add increment() method that takes IntDict to merge another dictionary. + Calling this increment() since it doesn't make sense in practice for + the other dictionary types, even though it's technically an add(). + ++ Added Entry class for iterating StringDict, IntDict, FloatDict + ++ Added XML.print() method (prints with indent of 2) + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.2.3 (REV 0255) - 7 November 2016 + +Lots of fixes to the Contribution Manager and a couple OpenGL tweaks. + + +[ contributions manager ] + ++ If prettyVersion isn't present, just use version number + ++ Ensure that update.id is set before checking for contrib updates + ++ Clicking "Update" button in contrib manager shows non-retina version of icon + https://github.com/processing/processing/issues/4715 + Other instances of the double-size icon found, should be fixed now + ++ Fix the library reporting scripts on the server + ++ Missing version number putting 'null' in the UI + https://github.com/processing/processing-docs/issues/478 + https://github.com/processing/processing/issues/4696 + https://github.com/processing/processing/pull/4712 + ++ Major clean-ups to the Contribution Manager code + + +[ contributions to the manager ] + ++ Up-to-date status disappears after filter is removed (contributed) + https://github.com/processing/processing/issues/4084 + ++ Updates tab blank after adding, removing, updating a contribution + https://github.com/processing/processing/issues/4082 + https://github.com/processing/processing/issues/4704 + ++ Fixes the removal of redundant contribution and update related issues + https://github.com/processing/processing/pull/4086 + + +[ another fix ] + ++ Warn user to restart browser when it hangs on macOS + https://github.com/fathominfo/processing-p5js-mode/issues/4 + + +[ opengl improvements ] + ++ Automatic detection of POINT and LINE shaders fails + https://github.com/processing/processing/issues/4725 + ++ Show warning when frameRate() less than 1 is called with P2D and P3D + https://github.com/processing/processing/issues/4716 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.2.2 (REV 0254) - 30 October 2016 + +Lots of bug fixes. + + +[ fixes ] + ++ Find in reference for size() opens StringList.size() + https://github.com/processing/processing/issues/4224 + https://github.com/processing/processing/issues/4655 + ++ Limit rollovers on EditorStatus to the text portion. Clicking the status + area when a URL was showing was problematic because it's also the separator + used to adjust the relative size of the two panels. + ++ Switch to Java 8u111. Not using 8u112 because the build numbers are + different depending on the platform, and no 112 fixes are known useful. + ++ Errant "Could not open the URL" when clicking on error messages + https://github.com/processing/processing/issues/4695 + ++ Fix extensions handling in CFBundleDocument code from appbundler + https://github.com/processing/processing/issues/4615 + ++ Update launch4j to 3.9, fixing a problem with exported applications + on Windows reporting "This application requires a Java Runtime Environment + 1.8.0_74", when 1.8.0_101 or later were installed. + https://github.com/processing/processing/issues/4682 + ++ Minor String comparison fix for Tweak mode + https://github.com/processing/processing/issues/4670 + ++ Fix quoting problem in IntDict.toJSON() + ++ Add getRenderer() to SurfaceInfo for Andres + https://github.com/processing/processing/issues/4441 + ++ Exceptions thrown in OpenGL apps when hitting the window's close box + https://github.com/processing/processing/issues/4690 + ++ Add getRowMap() function to Table + ++ Go back to textMode(MODEL) is native font not available for textMode(SHAPE) + https://github.com/processing/processing/issues/4680 + ++ NPE thrown when using textMode(SHAPE) with a .vlw font + https://github.com/processing/processing/issues/4680 + ++ Add toJSON() method to the data classes (IntDict, FloatDict, StringDict, + IntList, FloatList, and StringList). Returns an object of one of those + six types as a JSON-formatted String. For something more like the old + toString() behavior, use print(). + + +[ gottfried's goodness ] + ++ Simplify font situation to make it possible to use vanilla JRE trees + https://github.com/processing/processing/pull/4639 + https://github.com/processing/processing/pull/4641 + ++ Updates for ARM + https://github.com/processing/processing/pull/4640 + + +[ andres can do anything ] + ++ Automatic handling of screen FBOs breaks readPixels() for user-provided FBO + https://github.com/processing/processing/issues/4643 + ++ PGraphicsOpenGL: camera info not updated + https://github.com/processing/processing/issues/4609 + ++ Fix PShape, updateTessellation, matrix transformations + https://github.com/processing/processing/issues/4662 + ++ QUAD_STRIP as child shape draws extra lines + https://github.com/processing/processing/issues/4656 + ++ Remove extra glClear() calls + https://github.com/processing/processing/issues/4694 + ++ PShapes do not show up in PDF with P2D renderer + https://github.com/processing/processing/issues/4647 + ++ Some semi-transparent edges of sphere() meshes rendered in higher density + https://github.com/processing/processing/issues/4720 + ++ P2D and P3D not stopping with empty draw() blocks + https://github.com/processing/processing/issues/4722 + + +[ other contributed fixes ] + ++ Chinese translation updates + https://github.com/processing/processing/pull/4661 + ++ Spanish translation updates + https://github.com/processing/processing/pull/4697 + ++ Spanish "open sketch folder" fix + https://github.com/processing/processing/pull/4710 + ++ Contribution Manager showing 'null' for PeasyCam version + https://github.com/processing/processing/pull/4712 + https://github.com/processing/processing/issues/4696 + ++ Call glGetProgramiv to retrieve program log length + https://github.com/processing/processing/issues/4659 + https://github.com/processing/processing/pull/4660 + ++ JSONObject get() method is private + https://github.com/processing/processing/issues/4334 + https://github.com/processing/processing/pull/4336 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.2.1 (REV 0253) - 19 August 2016 + +Fixes for a couple major bugs that showed up in the last release. + + +[ fixes ] + ++ "Could not replace preferences.old" error message on startup + when using Processing for the first time. + https://github.com/processing/processing/issues/4626 + ++ Version 3.2 won't run from paths with spaces on Windows + https://github.com/processing/processing/issues/4623 + ++ Python Mode was crashing on startup + + +[ additions ] + ++ When quitting an OS X sketch, sometimes it was necessary to quit + twice. Added some code to work around this; we'll see how it goes. + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.2 (REV 0252) - 16 August 2016 + +This release includes a handful of fixes to deal with startup bugs, +plus several internal changes for how Modes are implemented. + +For those semantic versioning enthusiasts keeping track at home, the version +has been bumped from 3.1.x to 3.2.x to denote the internal API changes. + + +[ bug fixes ] + ++ Processing .jar files in CLASSPATH can cause startup crash + https://github.com/processing/processing/issues/4128 + ++ Remove java.ext.dirs on startup to avoid conflicts and startup errors + https://github.com/processing/processing/issues/4608 + https://github.com/processing/processing/issues/4470 + https://github.com/processing/processing/issues/4566 + https://github.com/processing/processing/issues/4492 + https://github.com/processing/processing/issues/4128 + https://github.com/processing/processing/issues/4503 + ++ Add 2016 to the About screen. + ++ Write preferences.txt using a temporary file (and save the previous + version as preferences.old) + https://github.com/processing/processing/issues/4614 + ++ Some Table cleanup based on other CSV parsing work + ++ Can't render PGraphics object using image() within a PDF + https://github.com/processing/processing/issues/4473 + + +[ contributed fixes ] + ++ Use HTML to print (a contributed fix for a handful of printing issues) + https://github.com/processing/processing/pull/4369 + https://github.com/processing/processing/issues/213 + https://github.com/processing/processing/issues/50 + ++ NullPointerException in SketchCode.getDocumentText() + https://github.com/processing/processing/issues/4555 + https://github.com/processing/processing/pull/4547 + https://github.com/processing/processing/pull/4596 + ++ Error checker now adds 'public' to all default access methods + https://github.com/processing/processing/pull/4597 + https://github.com/processing/processing/issues/4583 + ++ Fix resizing targets for async save + https://github.com/processing/processing/pull/4607 + https://github.com/processing/processing/issues/4578 + ++ Make loadStrings() and loadJSONObject/loadJSONArray() error msgs consistent + https://github.com/processing/processing/issues/4265 + https://github.com/processing/processing/pull/4268 + + +[ changes ] + ++ Implement template sketches + https://github.com/processing/processing/wiki/Templates + https://github.com/processing/processing/issues/4306 + https://github.com/processing/processing/issues/4352 + ++ PApplet.main(Blah.class) now works (for easy refactoring) + ++ Rewrite Util.listFiles() because it wasn't working properly + ++ Add printStackTrace() method in PApplet that can be overridden + https://github.com/processing/processing/issues/222 + + +[ depeche modes ] + ++ Add template support for Modes + ++ Added getSketchbookTemplatesFolder() to Base + ++ Move general PDE code out of JavaMode and into general base classes + https://github.com/processing/processing/issues/4606 + ++ Change default PdeInputHandler constructor slightly (added another + copy so that older Modes will still work properly) + ++ Change PdeKeywords to PdeTokenMarker (please notify us if this + breaks anything). + ++ Added Mode.requireExampleCompatibility() so that Modes can specify + whether example packages should specifically mention their Mode + in order to be visible when that Mode is in use. + ++ Mode.getTokenMarker(SketchCode code) passes through to + no arg version if not overridden. + + +[ input method work from Tsuyoshi Fukuda (tyfkda) ] + ++ Enable input method support by default on Japanese/Korean/Chinese systems + https://github.com/processing/processing/pull/4598 + ++ Set text color for InputMethod + https://github.com/processing/processing/pull/4593 + ++ Set sketch as modified when any character committed using input method + https://github.com/processing/processing/pull/4599 + ++ Insert characters by InputMethod at one time + https://github.com/processing/processing/pull/4594 + ++ Insert string when it is committed + https://github.com/processing/processing/pull/4602 + ++ Simplify conditional branch + https://github.com/processing/processing/pull/4589 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.1.2 (REV 0251) - 29 July 2016 + +Happy Fathom Fiesta Day! We'll be taking the afternoon off to enjoy +the summer, maybe you should take the afternoon off and dive into +a new Processing release? + + +[ pde fixes ] + ++ NullPointerException in LanguageBundle.read() on startup that prevented + Processing from starting up on Windows machines. Network drive issue. + https://github.com/processing/processing/issues/4417 + https://github.com/processing/processing/pull/4582 + https://github.com/processing/processing/issues/4476 + ++ Bring back preference to hide the error checking. Error checking will + continue in the background because it's needed for parsing/preprocessing, + but some were complaining about the error checker messages. + https://github.com/processing/processing/pull/4491 + https://github.com/processing/processing/issues/4485 + ++ Updates to Japanese translation + https://github.com/processing/processing/pull/4564 + ++ Make preferences button wider for Japanese + https://github.com/processing/processing/pull/4558 + ++ Fix logic for warning message when the Mode cannot be changed + https://github.com/processing/processing/pull/4559 + ++ Update to Java 8u102 build 14 + + +[ api fixes ] + ++ Rewrite CSV handling to take care of some parsing bugs and improve + performance. Note that the 'newlines' option is no longer necessary + when loading files that contain newline characters mid-field. + ++ Prevent random(low, high) from returning 'high' + https://github.com/processing/processing/issues/4551 + ++ Fixed iterator remove() methods so they don't skip container elements + https://github.com/processing/processing/pull/4519 + ++ Added a check for length 0 arrays in expand() + https://github.com/processing/processing/pull/4520 + + +[ graphics ] + ++ Disable asynchronous saveFrame() by default. This can really improve + performance, but can cause weird glitches. Bring it back by using + hint(ENABLE_ASYNC_SAVEFRAME) in your code to blissfully and speedily + create image sequences. + https://github.com/processing/processing/issues/4578 + ++ Prevent NPE in loadImage() when called before setup() + https://github.com/processing/processing/pull/4505 + ++ Fix crash when calling getUniformLoc() called in PShader.set() + https://github.com/processing/processing/issues/4542 + + +[ raspberry pi ] + ++ IO: Fix drawing for SPIAnalogDigital examples + https://github.com/processing/processing/pull/4480 + ++ Update JVM warning text on Linux + https://github.com/processing/processing/pull/4512 + ++ Undo the 8u91 workaround, add Mesa warning for ARM + https://github.com/processing/processing/pull/4508 + ++ IO: We want motors, they said (implements SoftwareServo) + https://github.com/processing/processing/pull/4546 + ++ Add a temporary workaround for the CHIP to deal with cursor problems + https://github.com/processing/processing/pull/4554 + ++ Fix GLExceptions on Raspberry Pi when using offscreen PGraphics + https://github.com/processing/processing/pull/4524 + + +[ fixed earlier ] + ++ Debugger deadlocks when choosing "Step Into" on println() + https://github.com/processing/processing/issues/3923 + ++ Suggestions switch scope to first import + https://github.com/processing/processing/issues/4016 + ++ loadImage() immediately after saveFrame() foiled by async default + https://github.com/processing/processing/issues/4218 + the hint() mostly works, but gross to use a hint frequently + ++ Fix the Downloader so that builds work again + https://github.com/processing/processing/issues/4496 + https://github.com/processing/processing/pull/4511 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.1.1 (REV 0250) - 16 May 2016 + +Happy Day-after-my-Mother-in-Law's-birthday! (After the last two releases +happened on holidays, I'm just gonna keep pushing the festive thing. Hard.) + +Most importantly, this release fixes a handful of bug fixes for regressions +(a smart-sounding word for making dumb mistakes) in the last release, +plus a handful of other improvements we picked up along the way. + + +[ the big ones ] + ++ Fix InvocationTargetException when using the command line + https://github.com/processing/processing/issues/4452 + https://github.com/processing/processing/pull/4453 + ++ Block loadImage() and requestImage() while images still being saved + https://github.com/processing/processing/issues/4218 + https://github.com/processing/processing/pull/4465 + + +[ the editor ] + ++ Out of date Modes no longer hand Processing 3 on startup, + and will cause less trouble when changing Modes + https://github.com/processing/processing/issues/4467 + ++ Undo is a little "jerky" in insert mode + https://github.com/processing/processing/issues/4302 + https://github.com/processing/processing/pull/4310 + ++ "Replace" and "Replace All" do not undo in a single step + https://github.com/processing/processing/issues/4303 + https://github.com/processing/processing/pull/4310 + ++ Comment/uncomment removes indenting + https://github.com/processing/processing/issues/4249 + https://github.com/processing/processing/pull/4313 + ++ Remove poorly implemented "rectangular selection" support from the editor + https://github.com/processing/processing/pull/4462 + https://github.com/processing/processing/pull/4326 + https://github.com/processing/processing/issues/4250 + ++ Loader is not visible when opening the Updates tab + https://github.com/processing/processing/issues/4088 + https://github.com/processing/processing/pull/4089 + ++ Make Comment/Uncomment trigger on numpad slash + https://github.com/processing/processing/pull/4457 + ++ Hex values throwing errors in 3.1 + https://github.com/processing/processing/issues/4458 + https://github.com/processing/processing/pull/4460 + ++ Fix up cmd-click/ctrl-click behavior, add preference to disable it + https://github.com/processing/processing/issues/4466 + https://github.com/processing/processing/pull/4472 + ++ Make undo/redo mark all affected tabs as modified + https://github.com/processing/processing/pull/4479 + ++ Switch back to JRE 8u77 on ARM to fix GL video library performance + https://github.com/processing/processing/pull/4454 + + +[ the core ] + ++ Implement support for encoding= option in loadTable() + ++ PShapeOBJ error String for missing MTL texture file + https://github.com/processing/processing/issues/3990 + https://github.com/processing/processing/commit/49a4c815557214fc1bf92e381ffaa398f262361a + ++ Shape (OBJ) import texture data is 0.0 + https://github.com/processing/processing/issues/3156 + https://github.com/processing/processing/commit/9f1d2988dc80ca7d5ee861b944cb59020ff771c5 + + +[ you'll never notice ] + ++ Fix 'ant clean' so that it actually... cleans. + ++ Fix error messages from Javadocs + https://github.com/processing/processing/pull/4191 + https://github.com/processing/processing/issues/1492 + + +[ fixed but forgot to tell you ] + ++ Complex text input issues (fixed in 3.0.2) + https://github.com/processing/processing/issues/3860 + https://github.com/processing/processing/issues/3475 + ++ Allow Movie Maker to cope with bad files (fixed prior to 3.0?) + https://github.com/processing/processing/issues/2727 + https://github.com/processing/processing/pull/3635 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.1 (REV 0249) - 8 May 2016 + +Happy Mother's Day! I celebrated by kicking off a Processing release +while my beautiful wife and daughter took a well-deserved nap. + +This release includes several bug fixes, while some of your donation dollars +were fed through Jakub Valtar to produce bug fixes and code improvements, +including some serious reworking of the error checker. Meanwhile, the rest +of the community pitched in with several additional fixes to keep this +caravan rolling, and Gottfried brought up the rear with fistfuls of +improvements for Raspberry Pi and ARM support. + + +[ contributed pde fixes ] + ++ Grab bag of smaller, mainly ARM-related updates + https://github.com/processing/processing/pull/4300 + ++ IDE code disappearing due to a concurrency bug + https://github.com/processing/processing/issues/4322 + https://github.com/processing/processing/pull/4325 + ++ Fix non-ARM Linux deb build process + https://github.com/processing/processing/issues/4308 + https://github.com/processing/processing/pull/4309 + ++ Sketchbook window shows "Empty sketchbook" when sketchbook is... empty + https://github.com/processing/processing/pull/4311 + ++ Change the command line version on Windows to use the default encoding + https://github.com/processing/processing/issues/1633 + https://github.com/processing/processing/pull/4350 + ++ Add support for symlinks to exported applications in Linux + https://github.com/processing/processing/issues/4318 + https://github.com/processing/processing/pull/4319 + ++ Added Ukrainian localization + https://github.com/processing/processing/pull/4343 + ++ Load fallback font for Chinese, Japanese and Korean + https://github.com/processing/processing/pull/4348 + ++ Fix hint text for toolbar buttons when Chinese, Japanese, Korean in use + https://github.com/processing/processing/issues/2886 + ++ Added readBytes(max) to net library + https://github.com/processing/processing/pull/4320 + ++ Added readBytes(max) to serial library + https://github.com/processing/processing/pull/4321 + ++ Improve error message "The nested type cannot hide an enclosing type" + https://github.com/processing/processing/issues/4228 + https://github.com/processing/processing/pull/4337 + https://github.com/processing/processing/pull/4451 + ++ Multi-line comments ending in '**/' cause ArrayIndexOutOfBoundsException + https://github.com/processing/processing/issues/4397 + https://github.com/processing/processing/pull/4402 + + +[ jakub edits the editor ] + ++ Update app to Java 8 + https://github.com/processing/processing/pull/4383 + ++ More Java 8 updates + https://github.com/processing/processing/pull/4388 + ++ Update minimum JRE version for Windows + https://github.com/processing/processing/pull/4389 + ++ Update JDT to 4.5.2 + https://github.com/processing/processing/pull/4387 + ++ Java Mode cleanup + https://github.com/processing/processing/pull/4390 + ++ Several bugs with tabs not working properly + https://github.com/processing/processing/issues/3975 + https://github.com/processing/processing/pull/4410 + ++ File paths not decoding properly, causing a NullPointerException + in LanguageBundle.read() on startup for some people + https://github.com/processing/processing/issues/4417 + https://github.com/processing/processing/pull/4426 + ++ Java Mode refactoring + https://github.com/processing/processing/pull/4440 + ++ Fix jump to variable declaration + https://github.com/processing/processing/issues/4287 + ++ Numbers in scientific notation not recognized as floats in 3.0 + https://github.com/processing/processing/issues/4190 + ++ Adding .java files to sketch causes the Error Checker to weird out + https://github.com/processing/processing/issues/4368 + ++ "Show usage..." does not locate keywords on correct line + https://github.com/processing/processing/issues/3988 + ++ Threading fixes + https://github.com/processing/processing/pull/4442 + ++ Move PDEX listeners from JavaEditor to PDEX + https://github.com/processing/processing/pull/4446 + https://github.com/processing/processing/pull/4447 + ++ control-clicks misbehaving + https://github.com/processing/processing/issues/4281 + ++ Fix listeners not firing on first preprocessing run + https://github.com/processing/processing/pull/4450 + ++ Remove some unnecessary calls from rename + https://github.com/processing/processing/pull/4449 + + +[ gohaiv6 ] + ++ Add automatic mipmap support to GLES2 + https://github.com/processing/processing/pull/4416 + ++ Add a few IO library examples + https://github.com/processing/processing/pull/4384 + ++ Be more verbose with drawExceptions with cause null + https://github.com/processing/processing/pull/4432 + ++ Ignore memory options when exporting for ARM + https://github.com/processing/processing/pull/4406 + ++ Update JNA to 4.2.0 + https://github.com/processing/processing/pull/4443 + ++ Add two Raspberry Pi related fixes to JOGL + https://github.com/processing/processing/pull/4379 + https://github.com/sgothel/jogl/pull/96 + https://github.com/sgothel/jogl/pull/97 + + +[ core ] + ++ Float/IntDict: minIndex() and maxIndex() return -1 when count is zero, + rather than throwing an exception + ++ Couple bug fixes for sorting Float/IntDict + ++ Add optional "stable" parameter to the Float/IntDict sort methods + ++ Drastic (2x) performance increas for sorting Float/IntDict + ++ Added print() and write(PrintWriter) methods to Table/TableRow + https://github.com/processing/processing/issues/4396 + ++ Several JavaFX fixes + https://github.com/processing/processing/pull/4411 + ++ cursor() and noCursor() not working on FX2D + https://github.com/processing/processing/issues/4405 + ++ Make sure PImage.parent is set in loadImage() + https://github.com/processing/processing/pull/4412 + ++ Change convention for directional lights in OpenGL-Binding for GLSL + https://github.com/processing/processing/issues/4275 + ++ Internal texture copy does not update immediately in GL + https://github.com/processing/processing/issues/4404 + ++ Font corruption issue in OpenGL + https://github.com/processing/processing/issues/4392 + ++ setStroke() does not work with imported OBJ Pshapes + https://github.com/processing/processing/issues/4377 + ++ blendMode() resetting with getGraphics() + https://github.com/processing/processing/issues/4019 + https://github.com/processing/processing/pull/4341 + https://github.com/processing/processing/issues/4376 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.0.2 (REV 0248) - 13 February 2016 + +Happy Valentine's Day! Nothing says "I LOVE YOU" like a bouquet of bug fixes. +And nothing says, "I LOVE YOU TOO" like the sampler box of contributed fixes +and pull requests that the community has put together for me since 3.0.1. + + +[ editor contributions ] + ++ Add "full screen" option to the Editor on OS X + https://github.com/processing/processing/issues/3993 + https://github.com/processing/processing/pull/4078 + ++ Add install script for site for ARM + https://github.com/processing/processing/pull/4110 + ++ Search/replace shouldn't include the string being replaced, + otherwise it can get into an infinite loop. + https://github.com/processing/processing/issues/4270 + https://github.com/processing/processing/pull/4271 + ++ 'Background Color when Presenting' not visible on Preferences window + https://github.com/processing/processing/issues/4272 + https://github.com/processing/processing/pull/4278 + ++ Fix minor autoformatter bugs (enums not working) + https://github.com/processing/processing/issues/4185 + https://github.com/processing/processing/pull/4200 + ++ Update Source Code Pro and Source Sans Pro fonts to the latest versions + https://github.com/processing/processing/pull/4150 + https://github.com/processing/processing/issues/3836 + ++ Minor fixes for Java Mode + https://github.com/processing/processing/pull/4114 + ++ Add i18n support for the PopUp menu + https://github.com/processing/processing/pull/4060 + ++ Add Turkish to the list of languages + https://github.com/processing/processing/pull/4073 + ++ Make the error message for stack overflows clearer + https://github.com/processing/processing/pull/4152 + ++ Get rid of dt_socket message, making command line run a little better + https://github.com/processing/processing/issues/4098 + https://github.com/processing/processing/pull/4103 + ++ Message when reference is find out on nothing selected + https://github.com/processing/processing/pull/4296 + ++ Better handling of quotes in command line args + https://github.com/processing/processing/pull/4145 + https://github.com/processing/processing/issues/3996 + https://github.com/processing/processing/issues/4119 + ++ Fix crashing bugs when user's name has non-ASCII characters + https://github.com/processing/processing/pull/4204 + ++ ARM updates to include GPIO numbers and images of wiring diagrams + https://github.com/processing/processing/pull/4297 + https://github.com/processing/processing/pull/4298 + ++ Icon instead of an "X" for the "could not connect" message + https://github.com/processing/processing/issues/3706 + https://github.com/processing/processing/pull/4096 + https://github.com/processing/processing/pull/4055 + ++ Several fixes for Chinese/Japanese/Korean InputMethod support + https://github.com/processing/processing/pull/4293 + https://github.com/processing/processing/issues/2968 + https://github.com/processing/processing/issues/3475 + https://github.com/processing/processing/issues/3860 + ++ Add 'downloading' indicator to the Contribution Manager + https://github.com/processing/processing/pull/4154 + https://github.com/processing/processing/issues/4105 + + +[ more editor ] + ++ Move to Java 8u74, also fixes JavaFX issue. + ++ Actually require OS X 10.8.5 (was set to 10.7). The Wiki said 10.8.3 + was required for 3.0 (it is), but has since been updated to 10.8.5. + If you're gonna run Mountain Lion, at least make sure he's patched. + + +[ graphics contributions ] + ++ Fill out the Javadoc for PMatrix + https://github.com/processing/processing/pull/4155 + ++ Have PSurfaceFX pay attention to the setVisible argument + https://github.com/processing/processing/pull/4210 + ++ Use xdg-open in PApplet#launch(String) + https://github.com/processing/processing/pull/4171 + + +[ moar graphics ] + ++ Fix another "Zero length string passed to TextLayout constructor" error + ++ Add additional clarification for IDE users on where to call smooth() + https://github.com/processing/processing/issues/4211 + ++ Flipped Y-axis in JavaFX is now repaired (the JDK bug now fixed) + https://github.com/processing/processing/issues/3795 + + +[ Andres fires an arrow of love into the cold heart of OpenGL ] + ++ Stop button in OpenGL exported applications does not use preference settings + https://github.com/processing/processing/issues/4064 + ++ Export without a stop button using P3D or P2D + https://github.com/processing/processing/issues/4056 + ++ glClearDepthf() not available on older hardware + https://github.com/processing/processing/issues/4106 + ++ Drawing a sphere with shape() first changes sphereDetail from default + https://github.com/processing/processing/issues/4192 + ++ PShape.scale() affects strokeWeight differently in P2D and P3D + https://github.com/processing/processing/issues/4231 + ++ createShape(GROUP) + textured child + non-textured child = P3D render problems + https://github.com/processing/processing/issues/4176 + ++ pixelDensity() and createGraphics() with P3D + https://github.com/processing/processing/issues/4039 + ++ Friendlier message when running drawing commands outside animation thread + https://github.com/processing/processing/issues/4196 + ++ strokeWeight() not working properly with point() in P2D and P3D + https://github.com/processing/processing/issues/4188 + ++ exit() is not called in P2D/P3D + https://github.com/processing/processing/issues/4156 + ++ attrib*() function does not work well with PShape + https://github.com/processing/processing/issues/4048 + + +[ "Jakub" is just Czech for "cupid" ] + ++ Initialize sketch args before calling settings() + https://github.com/processing/processing/issues/4219 + https://github.com/processing/processing/pull/4220 + ++ Workaround for JRE bug freezing the PDE during code completion + https://github.com/processing/processing/pull/4079 + ++ Prevent NPE because editor UI was not updated on AWT + https://github.com/processing/processing/pull/4117 + ++ Fix NPE when stepping into static method + https://github.com/processing/processing/issues/3590 + ++ Step button works correctly when SHIFT or ALT is pressed + https://github.com/processing/processing/issues/4116 + ++ More editor fixes + https://github.com/processing/processing/pull/4113 + ++ Tooltip over variable decl has wrong style and content + https://github.com/processing/processing/issues/3940 + ++ May have fixed this NullPointerException in initiateToolTip() + https://github.com/processing/processing/issues/3286 + ++ "String index out of range" error with bracket handling in the editor + https://github.com/processing/processing/issues/1940 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.0.1 (REV 0247) - 23 October 2015 + +Lots and lots of bug fixes. + + +[ graphics fixes ] + ++ curveVertex() does not work with FX2D renderer + https://github.com/processing/processing/issues/3960 + ++ Hide menu bar on OS X when FX2D is running full screen + ++ Add quotes to the necessary parameters in the size() error messages + ++ Editor menu is outside the visible screen with 800x480 display + https://github.com/processing/processing/issues/3913 + https://github.com/processing/processing/pull/3999 + https://github.com/processing/processing/pull/3992 + ++ Add a patch for FX2D menubar not hiding, root cause not sorted out + ++ Fix depth sorter ordering when two triangles in a plane share vertices + https://github.com/processing/processing/pull/4010 + ++ Turn off fixed rate scheduling in OpenGL + https://github.com/processing/processing/pull/4004 + ++ Fix GLSL preprocessing issues with variable name mangling + https://github.com/processing/processing/pull/4052 + https://github.com/processing/processing/issues/3961 + https://github.com/processing/processing/issues/3968 + ++ cursor() fails to work as expected with P2D/P3D + https://github.com/processing/processing/issues/3955 + ++ Topics/Shader/Convay broken + https://github.com/processing/processing/issues/3947 + https://github.com/processing/processing/issues/3973 + ++ Regressions wrt GLES2 support between b4 and b7 + https://github.com/processing/processing/issues/3976 + ++ stroke glitches in P3D + https://github.com/processing/processing/issues/4007 + https://github.com/processing/processing/issues/4027 + https://github.com/processing/processing/issues/4012 + ++ Line loops incorrectly closed in P3D + https://github.com/processing/processing/issues/4031 + ++ pixelDensity() not working with createGraphics() and OpenGL + https://github.com/processing/processing/issues/4039 + ++ GL related crashes when closing the display window on Ubuntu (Intel) + https://github.com/processing/processing/issues/4041 + ++ GL related crashes when closing window on MacBook Air (Intel) running 10.9.5 + https://github.com/processing/processing/issues/3977 + ++ Update to JogAmp JOGL 2.3.2 + https://github.com/processing/processing/issues/3979 + ++ Output window cannot be set as non-resizable with the P2D or P3D renderers + https://jogamp.org/bugzilla/show_bug.cgi?id=1188 + https://github.com/processing/processing/issues/3952 + ++ setAlwaysOnTop() does not work in P2D and P3D on Mac + https://github.com/processing/processing/issues/3793 + ++ P2D and P3D windows behave strangely when larger than the screen size + https://github.com/processing/processing/issues/3401 + ++ Remove Gluegen & JOGL sources + https://github.com/processing/processing/pull/3982 + + +[ not graphics fixes ] + ++ NullPointerException in ContributionManager.deleteTemp() + https://github.com/processing/processing/issues/4026 + ++ Tweak Mode sometimes freezes while running, require a force quit + https://github.com/processing/processing/issues/3928 + https://github.com/processing/processing/pull/4014 + ++ Tweak Mode: Some numbers ignored in second tab + https://github.com/processing/processing/issues/4017 + https://github.com/processing/processing/pull/4023 + ++ Update Japanese translation + https://github.com/processing/processing/pull/3956 + https://github.com/processing/processing/pull/3971 + ++ processing-java stealing focus even with --build flag + https://github.com/processing/processing/issues/3996 + https://github.com/processing/processing/pull/3998 + ++ Documentation updates and other serial fixes + https://github.com/processing/processing/pull/4015 + ++ Include Example packs into update count + https://github.com/processing/processing/pull/3932 + ++ Editor objects are staying in memory + https://github.com/processing/processing/issues/3930 + https://github.com/processing/processing/pull/3934 + https://github.com/processing/processing/issues/3929 + ++ Library path for Error Checker and Suggestions + https://github.com/processing/processing/pull/3989 + https://github.com/processing/processing/issues/3924 + ++ A serious error occurred while trying to create a new editor window + https://github.com/processing/processing/issues/3974 + https://github.com/processing/processing/pull/4001 + ++ Export - fix Java not being embedded on 64bit + https://github.com/processing/processing/pull/4005 + ++ Add error checker document listeners to all tabs + https://github.com/processing/processing/pull/4009 + ++ Fix memory leak in Recent menu + https://github.com/processing/processing/pull/4044 + ++ Error checker update (also enables switch on String objects) + https://github.com/processing/processing/issues/4034 + https://github.com/processing/processing/pull/4042 + ++ Fix occasional exception while editing text + https://github.com/processing/processing/pull/4043 + ++ Prevent preprocessor from crashing when setup() has no body + https://github.com/processing/processing/pull/4045 + ++ I/O library implementation and fixes for ARM + https://github.com/processing/processing/pull/3997 + https://github.com/processing/processing/pull/3985 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.0 (REV 0246) - 30 September 2015, 3pm ET + +This one is huge. + +This document covers (in detail) the individual changes between releases. +For an overview abut what's new, different, and exceptional in 3.0, read: +https://github.com/processing/processing/wiki/Changes-in-3.0 + +Most of the changes from the previous beta involve the final beautification +of the GUI, and the beatification of the error checker and auto-completion +features. + + +[ gui updates and fixes ] + ++ "Saving" messages never clear on "Save As" + https://github.com/processing/processing/issues/3861 + ++ Show number of updates available in the footer + https://github.com/processing/processing/issues/3518 + https://github.com/processing/processing/pull/3896 + https://github.com/processing/processing/pull/3901 + ++ Click the "Updates" item in the footer to open the Contribution Manager + ++ Make breakpoints more prominent + https://github.com/processing/processing/issues/3307 + ++ Implement the side gradient on the Editor + ++ Replace startup/about screen (1x and 2x versions) + https://github.com/processing/processing/issues/3665 + ++ Implement splash screen on OS X. Shout out to this article: + http://www.randelshofer.ch/oop/javasplash/javasplash.html + ++ Make the left edge of the Console match the Error List + https://github.com/processing/processing/issues/3904 + ++ Windows suggests "Documents" as a new location for the 3.0 sketchbook + https://github.com/processing/processing/issues/3920 + + +[ errors and warnings: the checking and completion story ] + ++ error checker/suggestions fixes + https://github.com/processing/processing/pull/3871 + https://github.com/processing/processing/pull/3879 + ++ Hide useless error in error checker + https://github.com/processing/processing/pull/3887 + ++ Error checker updates for toggle and listeners + https://github.com/processing/processing/pull/3915 + ++ If fewer lines in sketch than can be shown in window, show ticks adjacent + https://github.com/processing/processing/pull/3903 + ++ Distinguish errors and warnings in the error list + https://github.com/processing/processing/issues/3406 + ++ Clicking an error or warning should give the focus back to the editor + https://github.com/processing/processing/pull/3905 + ++ Fix placement and visual design when showing error on hover + https://github.com/processing/processing/issues/3173 + ++ Fix the design of the completions window, new icons, etc + https://github.com/processing/processing/issues/3906 + ++ Update status error/warning when changing the line + https://github.com/processing/processing/pull/3907 + + +[ contribution manager ] + ++ Contributions filter ignored after clicking Install + https://github.com/processing/processing/issues/3826 + https://github.com/processing/processing/pull/3872 + https://github.com/processing/processing/pull/3883 + ++ Exception in thread "Contribution List Downloader" + https://github.com/processing/processing/issues/3882 + https://github.com/processing/processing/pull/3884 + ++ Grab bag of Contribution Manager fixes + https://github.com/processing/processing/issues/3895 + https://github.com/processing/processing/pull/3897 + ++ ArrayIndexOutOfBoundsException freak out when clicking the header line + + +[ plumbing ] + ++ Fix nasty file counting problem in the change detector + https://github.com/processing/processing/pull/3917 + https://github.com/processing/processing/issues/3898 + https://github.com/processing/processing/issues/3387 + ++ Clean up delete dir function + https://github.com/processing/processing/pull/3910 + ++ Don't follow symlinks when deleting directories + https://github.com/processing/processing/pull/3916 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.0b7 (REV 0245) - 22 September 2015 + +It's 8:57pm and Jakub and Ben are still holed up at Fathom's studio in Boston. +Ben is wishing he was Jakub's age, as his wrists, neck, and back all feel +like a bag of broken pretzels after several hours/days/weeks/months of coding. +A bleary-eyed Jakub emerges from deep inside the error checker and completion +code, removes his headphones and grunts, "I think it's working." + + +[ changes and additions ] + ++ Changed the Tool API to pass Base instead of Editor + https://github.com/processing/processing/wiki/Tool-Basics + + +[ error checking and auto-completion fixes ] + ++ Huge rewrite of auto-complete and error checking code + https://github.com/processing/processing/issues/3812 + https://github.com/processing/processing/pull/3845 + https://github.com/processing/processing/pull/3856 + ++ Make preprocessor scope-aware + https://github.com/processing/processing/issues/3799 + https://github.com/processing/processing/pull/3810 + ++ Red error underline is sometimes at wrong location + https://github.com/processing/processing/issues/3759 + https://github.com/processing/processing/pull/3848 + ++ Using "new color()" instead of "color()" results in "color type detected" + https://github.com/processing/processing/issues/3739 + https://github.com/processing/processing/pull/3850 + ++ Code editor wrongly detects errors for libraries in code folder + https://github.com/processing/processing/issues/3732 + + +[ watcher bug fixes ] + ++ "Your sketch has been modified externally" with encrypted OS X volumes + https://github.com/processing/processing/issues/3650 + ++ sketch modified externally with FAT32 volumes on OS X + https://github.com/processing/processing/issues/3387 + ++ Prevent re-prompting users when they say "no" to "sketch modified" message + ++ Add more preferences for editor.watcher to help with debugging + ++ Cleaning up the logic in the watcher + + +[ contribution manager fixes ] + ++ Contributions Manager UI design + https://github.com/processing/processing/issues/3482 + ++ CM selected tabs are too tall + https://github.com/processing/processing/issues/3598 + ++ CM: Clicking item in Libraries list throws exception + https://github.com/processing/processing/issues/3667 + ++ CM: Libraries missing descriptions and Foundation credit + https://github.com/processing/processing/issues/3688 + ++ Clean up the header for the scrolling lists + ++ Use real version of bold font, rather than the fake version, + in several locations. + ++ Remove the "v" from the version numbers in the updates tab + ++ Set the frame title + ++ Remove tooltip that repeats the contents of the tab labels + ++ Fix spacing of buttons relative to the scroll bar + https://github.com/processing/processing/issues/3643 + ++ Updates tab has ugly horizontal line at top + ++ Get rid of fake italic subheads on the Updates page + ++ Remove extra component borders and focus quirks + ++ Don't focus the window on the search box on opening + ++ Prevent "updating" to a still-incompatible version of a contrib + https://github.com/processing/processing/issues/3801 + https://github.com/processing/processing/pull/3805 + ++ Tools are getting redundantly added when installing new Tool + https://github.com/processing/processing/issues/3818 + https://github.com/processing/processing/pull/3820 + ++ After clicking 'install' it's still possible to click it again + https://github.com/processing/processing/issues/3806 + https://github.com/processing/processing/pull/3817 + ++ CM list should be sortable by status and author name + https://github.com/processing/processing/issues/3608 + ++ "Update All" button appears to do nothing in library manager + https://github.com/processing/processing/issues/3837 + https://github.com/processing/processing/pull/3842 + + +[ miscellaneous bug fixes ] + ++ JNA errors on startup when run from an account w/ non-ASCII characters + https://github.com/processing/processing/issues/3624 + ++ UnsatisfiedLinkError on startup "Access is denied" on Windows 10 + https://github.com/processing/processing/issues/3800 + ++ SVG not highlighting as a keyword + https://github.com/processing/processing/issues/3752 + ++ Implement retina (2x) versions of all Contribution Manager icons + https://github.com/processing/processing/issues/3478 + ++ Show hover text when the mouse is over the 'debug' button + ++ Update rollover label for buttons when pressing shift or alt + ++ Replace the coffee cup icon for the Welcome window + ++ ctrl-space first inserts space, then deletes it, with completion + https://github.com/processing/processing/issues/3847 + ++ Fix the bold text in the welcome window to not use fake bold + + +[ we still care about graphics, too ] + ++ FX2D display is inverted in 3.0b6 + https://github.com/processing/processing/issues/3795 + ++ surface.setLocation(x,y) not working with the default renderer + https://github.com/processing/processing/issues/3821 + ++ Make the PApplet regex cache LRU + https://github.com/processing/processing/pull/3815 + ++ Minor OpenGL improvements + https://github.com/processing/processing/pull/3849 + ++ Cannot re-enable stroke or fill of a PShape with P2D + https://github.com/processing/processing/issues/3808 + ++ setResizable() with OpenGL broke in 3.0b6 + https://github.com/processing/processing/issues/3825 + https://github.com/processing/processing/commit/42c0150da0f400637de916db1f94a687a7bc4288 + ++ surface.setLocation() with OpenGL causing a freeze on Windows + https://github.com/processing/processing/commit/4c0f9234c0a48f62363233cafc9c9951ee351d3e + ++ selectInput/Output() is behind the drawing window (Windows) + https://github.com/processing/processing/issues/3775 + ++ MouseWheel count wrong (backwards) in P2D and P3D + https://github.com/processing/processing/issues/3840 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.0b6 (REV 0244) - 11 September 2015 + +And I beheld when he had released the sixth beta, and, lo, there was +a great earthquake; and the sun became black as sackcloth of hair, +and the moon became as blood. + +Aside from bug fixes, the FX2D renderer has received a lot of attention. +On the plus side, it's working really well. On the minus side, we're giving +up on making it the default for 3.0. The underlying JavaFX technology it uses +is just not ready for our use. It is, however, super fast and makes great +looking 2D sketches on retina devices. But it can be a little balky so we +don't want it to be the first experience that beginners have with Processing. +Especially if you're doing 2D on a retina Mac, you should definitely try FX2D. +We're at the limit of what we can do performance-wise with the default +(JAVA2D) renderer, so if you're having performance problems, try FX2D. + + +[ bug fixes and improvements ] + ++ Deal with ConcurrentModificationException in Editor + "Error repainting line range" and ConcurrentModificationException + https://github.com/processing/processing/issues/3726 + ++ Major surgery performed to drastically reduce the memory footprint + and startup time for individual editor windows. + ++ Remove old versions of processing-java when installing on OS X + https://github.com/processing/processing/issues/3786 + ++ Confusion when // tweak was used accidentally, changed to /// tweak + https://github.com/processing/processing/issues/3742 + ++ Don't allow breakpoints to be set on blank lines + https://github.com/processing/processing/issues/3765 + ++ Fixed a couple hard crashes back in alpha 10: + EXC_BAD_ACCESS inside AppleIntelHD5000GraphicsGLDriver when starting 3.0a8+ + https://github.com/processing/processing/issues/3359 + Hard crash on startup inside strlen call when using 3.0a8+ on OS X + https://github.com/processing/processing/issues/3360 + Though the workaround re-introduces issues that had been fixed earlier: + https://github.com/processing/processing/issues/3790 + ++ Add the Contents/Java folder to java.library.path on OS X to fix + exported applications that use native libraries (i.e. Sound) + ++ Add surface.setAlwaysOnTop(boolean) + https://github.com/processing/processing/issues/3718 + ++ Implement standard cursor types in OpenGL + https://github.com/processing/processing/issues/3554 + ++ Change value of constants PRIMITIVE, PATH, and GEOMETRY constants in PShape + This avoids a collision with entries in PConstants which causes + confusing errors or no errors to be thrown at all + https://github.com/processing/processing/issues/3776 + ++ Fix flickering cursor regression with Java2D on Windows introduced by + https://github.com/processing/processing/issues/3472 + + +[ Jakub won't be here forever, but his contributions are eternal ] + ++ Error/warning location visualisation not updating when editor resizes + https://github.com/processing/processing/issues/3619 + https://github.com/processing/processing/pull/3778 + ++ "unexpected token" on anonymous instance of parameterized Comparator + https://github.com/processing/processing/issues/533 + https://github.com/processing/processing/pull/3780 + ++ Incomplete text rendering of strings with consecutive line breaks + https://github.com/processing/processing/issues/3736 + https://github.com/processing/processing/pull/3737 + https://github.com/processing/processing/issues/3761 + ++ FX - fix transformation stack NPE + https://github.com/processing/processing/pull/3710 + ++ FX - fix rad-deg conversion in rotate() + https://github.com/processing/processing/pull/3711 + ++ FX - basic pixel operations (get, set, load, update) + https://github.com/processing/processing/pull/3709 + ++ FX - align to pixel grid when drawing 1 px strokes + https://github.com/processing/processing/pull/3712 + ++ FX - keyChar and keyCode are super wonky and unlike AWT + https://github.com/processing/processing/issues/3290 + ++ FX - arc - infamous deg-rad conversion strikes again + https://github.com/processing/processing/pull/3713 + ++ FX - paths, contours, curves + https://github.com/processing/processing/pull/3715 + ++ FX - fix AIOOBE when pressing ESC on Mac + https://github.com/processing/processing/pull/3719 + ++ FX - framerate fix + https://github.com/processing/processing/pull/3724 + ++ FX - loadPixels, updatePixels, get and set optimizations + https://github.com/processing/processing/pull/3725 + ++ FX - keep track of whether pixels are up to date + https://github.com/processing/processing/pull/3716 + ++ FX - improve key events + https://github.com/processing/processing/pull/3729 + ++ FX - add FX2D keyword, remove JFX keyword + https://github.com/processing/processing/pull/3731 + +X JOGL - normalize enter key + https://github.com/processing/processing/pull/3735 + ++ FX - normalize enter key + https://github.com/processing/processing/pull/3730 + ++ Render text starting with space properly + https://github.com/processing/processing/pull/3746 + ++ FX - smooth for the main surface + https://github.com/processing/processing/pull/3749 + ++ OpenGL - clean up loaded and modified for pixels + https://github.com/processing/processing/pull/3768 + ++ FX - text stuff, move createFont() into PGraphics + https://github.com/processing/processing/pull/3766 + ++ FX - fix bug where fonts would share a tint cache + https://github.com/processing/processing/pull/3771 + ++ textFont() and textSize() are each calling one another + ++ move createFont() to PGraphics + ++ Fix PShape creation in P3D + https://github.com/processing/processing/pull/3781 + ++ keyTyped() not firing with P2D and P3D + https://github.com/processing/processing/issues/3582 + https://github.com/processing/processing/pull/3652 + ++ Implement a way to disable automatic key repeat + implemented for OpenGL, where key repeat is now disabled by default + hint(ENABLE_KEY_REPEAT) will turn it back on + https://github.com/processing/processing/issues/1622 + ++ With the P2D and P3D renderers, a generic set of cursors are + used because the OpenGL renderer doesn't have access to the + default cursor images for each platform. + https://github.com/processing/processing/issues/3791 + + +[ Manindra re-emerges ] + ++ Code auto-complete not working with imported libraries + https://github.com/processing/processing/issues/3720 + + +[ Google Summer of Contribution Manager ] + ++ CM: Category dropdown alignment + https://github.com/processing/processing/issues/3644 + https://github.com/processing/processing/pull/3666 + https://github.com/processing/processing/pull/3669 + ++ finalize CM tab order + https://github.com/processing/processing/issues/3613 + https://github.com/processing/processing/pull/3714 + ++ Several of those below were in beta 5... + ++ CM - Focus is shifted out of the filter field when something is searched + https://github.com/processing/processing/issues/3682 + https://github.com/processing/processing/pull/3701 + ++ CM - info panel text color + https://github.com/processing/processing/issues/3642 + https://github.com/processing/processing/pull/3695 + https://github.com/processing/processing/pull/3696 + ++ CM - Filter field display + https://github.com/processing/processing/issues/3689 + https://github.com/processing/processing/pull/3698 + ++ Update buttom enabled when updates are present and background is set + https://github.com/processing/processing/issues/3614 + https://github.com/processing/processing/pull/3694 + ++ Fix info panel text color and alignment in CM + https://github.com/processing/processing/issues/3642 + https://github.com/processing/processing/pull/3684 + ++ Ready to add contributed example packages? + https://github.com/processing/processing/issues/2953 + + +[ Dr. Colubri, I presume? ] + ++ P2D: error calling surface.setTitle() + https://github.com/processing/processing/issues/3721 + https://github.com/processing/processing/commit/a384cbf0890a49dbf6e0fdd80e048de80e5d78d2 + ++ Error message with noLoop() and P2D renderer + https://github.com/processing/processing/issues/3558 + ++ Concurrency issues in OpenGL renderer prevent proper garbage collection + https://github.com/processing/processing/issues/3384 + ++ In P2D/P3D the background is cleared to black on each frame + https://github.com/processing/processing/issues/3559 + ++ cursor() command with PImage stopped working in 3.0 with P2D + https://github.com/processing/processing/issues/3769 + ++ Demos/Graphics/Wiggling regressed from 17 fps to 8.3 fps between a11 and b1 + https://github.com/processing/processing/issues/3561 + ++ "Library not installed properly" message inconsistent in P2D/P3D vs. JAVA2D + https://github.com/processing/processing/issues/3453 + ++ PShape 3D: strange extra lines (another fix) + https://github.com/processing/processing/issues/3006 + ++ Line direction vectors are incorrectly transformed + https://github.com/processing/processing/issues/3779 + ++ Strokes in 3D PShapes are not properly connected + https://github.com/processing/processing/issues/3756 + ++ Setting surface properties hangs OpenGL sketches + https://github.com/processing/processing/issues/3789 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 3.0b5 (REV 0243) - 24 August 2015 + +Fixing a handful of regressions in beta 4, and clearing out some of the +nooks and crannies as people report issues with the default download. + + +[ changes ] + ++ Removed support for fixed-function pipeline in OpenGL. I'm told + this "brings us out of the 90s" and gets things a bit more up-to-date + and compatible across many platforms and varying device types. + https://github.com/processing/processing/issues/3505 + If you're a beginPGL() and endPGL() fan, see the updated docs: + https://github.com/processing/processing/wiki/Advanced-OpenGL + ++ Remove legacy GL functions from PGL + https://github.com/processing/processing/issues/3674 + https://github.com/processing/processing/pull/3691 + https://github.com/processing/processing/issues/3671 + https://github.com/processing/processing/issues/3621 + ++ Update LowLevelGL to use VBOs + https://github.com/processing/processing-docs/pull/289 + + +[ bug fixes ] + ++ Line selected for errors is off by one or two + https://github.com/processing/processing/issues/3654 + ++ NullPointerException in selectFolder() on OS X + https://github.com/processing/processing/issues/3661 + ++ Wrong positioning of circles in SVG shapes (regression from 2) + https://github.com/processing/processing/issues/3685 + ++ setFill() on PShape in Java2D throws ArrayIndexOutOfBoundsException + https://github.com/processing/processing/issues/3677 + ++ saveJSONObject() doesn't close the file + https://github.com/processing/processing/issues/3705 + ++ processing-java fixed for OS X 10.11 El Capitan + https://github.com/processing/processing/issues/3497 + ++ Prevent a prompt to install Xcode coming up on Export to Application + ++ Live error checker complains about F instead of f after floats + https://github.com/processing/processing/issues/3707 + ++ NoClassDefError with CLibrary and getenv when switching to Android Mode + https://github.com/processing/processing/issues/3704 + + +[ foundation $$ = bug fixe$ + improvement$ ] + ++ keyTyped() not firing with P2D and P3D + https://github.com/processing/processing/issues/3582 + https://github.com/processing/processing/pull/3652 + ++ rect() sizing in JavaFX + https://github.com/processing/processing/pull/3656 + ++ FX - Proper sketch sizing + https://github.com/processing/processing/pull/3658 + ++ FX - implement frameRate() + ++ FX - Fix key typed + https://github.com/processing/processing/pull/3672 + ++ FX - Make key events little bit more sane + https://github.com/processing/processing/pull/3686 + ++ "Internal graphics not initialized yet" + https://github.com/processing/processing/issues/3690 + https://github.com/processing/processing/pull/3692 + ++ NullPointerException in Demos > Graphics > Planets + https://github.com/processing/processing/issues/3551 + ++ PDE window leaks undisposed Timer objects even when closed + https://github.com/processing/processing/issues/3655 + + +[ contributed fixes ] + ++ Undo does not move to the correct location in the editor window + https://github.com/processing/processing/issues/707 + https://github.com/processing/processing/pull/3660 + ++ Undo sometimes causes the editor to go blank + https://github.com/processing/processing/issues/3003 + https://github.com/processing/processing/pull/3693 + https://github.com/processing/processing/pull/3702 + ++ Miscellaneous language improvements + https://github.com/processing/processing/pull/3700 + + +[ google summer of code ] + ++ Foundation libraries disapear from CM after restart + https://github.com/processing/processing/issues/3659 + https://github.com/processing/processing/pull/3663 + ++ CM blue bar missing + https://github.com/processing/processing/issues/3599 + https://github.com/processing/processing/pull/3636 + ++ CM column widths change with selection + https://github.com/processing/processing/issues/3609 + https://github.com/processing/processing/pull/3675 + ++ Remove category dropdown from CM except when viewing libraries + https://github.com/processing/processing/issues/3668 + https://github.com/processing/processing/pull/3676 + ++ Right-clicking popup menu closes instead of shifting its location + https://github.com/processing/processing/issues/3649 + ++ Use 1x or 2x icons in the CM + https://github.com/processing/processing/pull/3681 + ++ Shifted the text right a little bit + https://github.com/processing/processing/pull/3696 + ++ No underline and no blue color + https://github.com/processing/processing/pull/3695 + ++ Make auto-format into a compund edit + https://github.com/processing/processing/pull/3693 + ++ Focus is shifted out of the filter field after CM search + https://github.com/processing/processing/issues/3682 + https://github.com/processing/processing/pull/3701 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + PROCESSING 3.0b4 (REV 0242) - 17 August 2015 -Fixes for several long-standing bugs, plus some internal changes -to make the code slightly more usable by contributors. +Fixes for several long-standing bugs, plus some internal changes +to make the code slightly more usable by contributors. -For Tool and Mode developers, several functions have moved out of +For Tool and Mode developers, several functions have moved out of processing.app.Base and into the Messages and Platform classes. For instance, Base.isWindows() has moved to Platform.isWindows() (seems almost logical, right?) We're not keeping deprecated versions @@ -18,7 +2970,7 @@ Meanwhile, Jakub Valtar is holed up at Fathom in Boston, fixing all of the bugs. See "your contributions are funding graphics fixes," below. -[ bug fixes ] +[ bug fixes ] + Fix NullPointerException with some sketches that have no size() command https://github.com/processing/processing/issues/3585 @@ -49,7 +3001,7 @@ the bugs. See "your contributions are funding graphics fixes," below. https://github.com/processing/processing/issues/3623 -[ api/implementation changes ] +[ api/implementation changes ] + Several platform-oriented features have moved to Platform i.e. Platform.isWindows(), Platform.openURL(), Platform.getJavaPath() @@ -81,10 +3033,10 @@ the bugs. See "your contributions are funding graphics fixes," below. + Contribution Manager GUI updates https://github.com/processing/processing/pull/3596 - + + Sorting CM by the author name inplemented https://github.com/processing/processing/pull/3615 - + + CM needs minimum window size enforced https://github.com/processing/processing/issues/3600 https://github.com/processing/processing/pull/3607 @@ -125,7 +3077,7 @@ the bugs. See "your contributions are funding graphics fixes," below. + Export unsaved sketch > agree to save prompt > export doesn't finish https://github.com/processing/processing/issues/2724 -+ Add disconnectEvent() to Server ++ Add disconnectEvent() to Server https://github.com/processing/processing/issues/2133 + False positive for mixing active/static mode in Tweak Mode 3.0 alpha 5 @@ -183,7 +3135,7 @@ PROCESSING 3.0b3 (REV 0241) - 11 August 2015 You get a beta! YOU get a beta! *YOU* get a beta! Everybody gets a beta! -[ bug fixes & changes ] +[ bug fixes & changes ] + Prevent 'examples' from showing as a folder in the sketchbook window (instead only show it in the Examples window) @@ -203,7 +3155,7 @@ You get a beta! YOU get a beta! *YOU* get a beta! Everybody gets a beta! + Library names not showing up correctly ("pdf" instead of "PDF Export") https://github.com/processing/processing/issues/3574 -+ Contributed Examples were using their folder name, not the 'name' field ++ Contributed Examples were using their folder name, not the 'name' field from their properties file when shown in the Examples window. + Include name of sketch when asking user "Save sketch before closing?" @@ -250,7 +3202,7 @@ beta release. Please keep the reports & code coming and help us get to 3.0. + Make size(displayWidth, displayHeight) still run in a window. Fixes "fullScreen() cannot be used here" message on startup. https://github.com/processing/processing/issues/3545 - In the past we were auto-detecting if it was the screen size, + In the past we were auto-detecting if it was the screen size, and switching to full screen mode. But that's now removed because fullScreen() is so easy, and full screen may not be wanted. @@ -262,14 +3214,14 @@ beta release. Please keep the reports & code coming and help us get to 3.0. + Remove "pair is" debug messages from Welcome screen + Save Export to Application settings between uses - + + Fix NullPointerException in setVertex() https://github.com/processing/processing/pull/3553 https://github.com/processing/processing/issues/3550 + Toggling between noLights and PointLight in draw() behaving strangely https://github.com/processing/processing/issues/3546 - + + NullPointerException in Planets demo https://github.com/processing/processing/issues/3551 @@ -290,7 +3242,7 @@ beta release. Please keep the reports & code coming and help us get to 3.0. it would report "done exporting!" but nothing had actually happened. + Prevent Export with examples and untitled/unsaved sketches - + + Links in error bar are not selectable nor clickable https://github.com/processing/processing/issues/3471 @@ -303,7 +3255,7 @@ beta release. Please keep the reports & code coming and help us get to 3.0. https://github.com/processing/processing/issues/3433 + Cleaned up the advanced OpenGL wiki page - + + cursor(CROSS) breaks when using surface.setTitle() https://github.com/processing/processing/issues/3472 @@ -333,11 +3285,11 @@ an author of these, see the notes in the link above. We're also planning some sort of online Q & A / office hours / talk to Ben about what's changed session to help folks along. We want to help, we just need to find the time. -And for those into the nitty gritty, or who enjoy lame jokes about esoteric +And for those into the nitty gritty, or who enjoy lame jokes about esoteric technical details, the detailed changes since 3.0 alpha 11 are below. -[ bug fixes ] +[ bug fixes ] + The new Welcome screen! was... completely broken https://github.com/processing/processing/issues/3474 @@ -373,7 +3325,7 @@ technical details, the detailed changes since 3.0 alpha 11 are below. https://github.com/processing/processing/pull/3514 -[ changes, because not everything is a bug ] +[ changes, because not everything is a bug ] + Add new console/errors icons to the tabs in the footer @@ -386,7 +3338,7 @@ technical details, the detailed changes since 3.0 alpha 11 are below. is coming soon that will be better-integrated with the editor. -[ internal changes you'll probably never notice ] +[ internal changes you'll probably never notice ] + Add message that says it's safe to ignore the tools.jar warning @@ -395,7 +3347,7 @@ technical details, the detailed changes since 3.0 alpha 11 are below. + Update to launch4j 3.8 -[ contributions by our fine community ] +[ contributions by our fine community ] + Fix contribution compatibility check https://github.com/processing/processing/pull/3479 @@ -425,10 +3377,10 @@ technical details, the detailed changes since 3.0 alpha 11 are below. https://github.com/processing/processing/pull/3522 -[ Jakub joins Andres in a battle of wits and test of wills against OpenGL ] +[ Jakub joins Andres in a battle of wits and test of wills against OpenGL ] + Implement depth sorting! Use hint(ENABLE_DEPTH_SORT) and say goobye - to your 3D transparency woes! + to your 3D transparency woes! https://github.com/processing/processing/issues/90 https://github.com/processing/processing/issues/2235 https://github.com/processing/processing/pull/3507 @@ -495,7 +3447,7 @@ technical details, the detailed changes since 3.0 alpha 11 are below. PROCESSING 3.0a11 (REV 0238) - 16 July 2015 -Hopefully the last release before we go to beta. +Hopefully the last release before we go to beta. [ new additions ] @@ -513,11 +3465,11 @@ Hopefully the last release before we go to beta. Our hope is that this will be the last round of changes for the 3.x series, and that it's now safe to update your Modes and Tools to be compatible with the final 3.x release. Changes in this release: - + - Several classes have been moved to a new processing.app.ui package. The processing.app package was much too unwieldy and made it difficult for people to hack on the PDE code. - + - Several functions have moved out of Base and into Util (or Toolkit). Most of these are file-related (removeDir() and others), but the Base class had simply grown to a ridiculous size. It remains enormous @@ -535,10 +3487,10 @@ Hopefully the last release before we go to beta. + Resize children[] so that getChildren() returns a correctly-sized array https://github.com/processing/processing/issues/3347 - + + clear() was broken (maybe related to #3317) https://github.com/processing/processing/issues/3378 - + + PGraphic ignores PNG transparency (regression from 3.0a5, same as #3378) https://github.com/processing/processing/issues/3317 @@ -548,16 +3500,16 @@ Hopefully the last release before we go to beta. + Sketches with new fullScreen() method should grab focus by default https://github.com/processing/processing/issues/3380 - + + Sketches not getting focus with Java2D https://github.com/processing/processing/issues/3389 - + + draw() executes twice when noLoop() called in setup() https://github.com/processing/processing/issues/3310 + displayDensity() not functioning properly https://github.com/processing/processing/issues/3436 - + + surface.setXxx() handling https://github.com/processing/processing/issues/3388 Methods for setResizable(), setVisible(), setTitle(), setIconImage() @@ -566,31 +3518,31 @@ Hopefully the last release before we go to beta. + ArithmeticException: / by zero when using fonts opened with loadFont() https://github.com/processing/processing/issues/3413 - + + SVG briefly broken for Java2D https://github.com/processing/processing/issues/3417 - + + Change how font metrics are pulled to fix text width issues + Check alpha when image extension is "unknown" https://github.com/processing/processing/issues/3442 - + + Add support for more Image types (BGR) with PImage(java.awt.Image) + Move Java2D and JavaFX classes to their own packages -[ multithreading is hard ] +[ multithreading is hard ] + Sketch not always showing with empty draw() https://github.com/processing/processing/issues/3363 - + + Static mode broken with Java2D on Windows and Linux https://github.com/processing/processing/issues/3315 - + + Sketch sometimes doesn't show with noLoop() on Linux https://github.com/processing/processing/issues/3316 - + + Window never shows with exported application on 64-bit Linux https://github.com/processing/processing/issues/3303 @@ -601,13 +3553,13 @@ Hopefully the last release before we go to beta. + sketch.isReadOnly returns false for examples coming from multiple modes https://github.com/processing/processing/issues/773 - + + Drag and Drop & "Add File" broken for .pde files in 3.0a10 https://github.com/processing/processing/issues/3383 + Show "not compatible" error message in the manager https://github.com/processing/processing/issues/3386 - + + Add more code for handling low-level errors on startup + Update the "Supported Platforms" wiki page with current status @@ -617,14 +3569,14 @@ Hopefully the last release before we go to beta. + Error message caused by curly bracket in a println string https://github.com/processing/processing/issues/3394 - + + Tweak mode broken (re: new settings() function) https://github.com/processing/processing/issues/3435 + Add build.xml prompt for OS X developers to download the JDK update -[ contribution manager ] +[ contribution manager ] + Change the .properties file syntax a little bit: compatibleModesList -> modes @@ -633,7 +3585,7 @@ Hopefully the last release before we go to beta. + Send list of installed Libraries, Modes, Tools, and Examples on update https://github.com/processing/processing/issues/3365 - + + Disable contrib manager updates when "check for updates" is turned off in Preferences. Also updated the FAQ to cover the changes. @@ -642,11 +3594,11 @@ Hopefully the last release before we go to beta. + Use correct localized strings in JavaEditor.java https://github.com/processing/processing/pull/3376 - + + Dim edit menus as appropriate during selection/no selection/etc https://github.com/processing/processing/issues/53 https://github.com/processing/processing/pull/3419 - + + Internationalize MovieMaker.java https://github.com/processing/processing/pull/3424 @@ -656,24 +3608,24 @@ Hopefully the last release before we go to beta. + Re-enable export to application with command line https://github.com/processing/processing/pull/3451 https://github.com/processing/processing/issues/2760 - + + Change undefined constructor error message for clarity https://github.com/processing/processing/issues/3434 + Mode problems window wasn't doing line breaks https://github.com/processing/processing/issues/3369 https://github.com/processing/processing/pull/3370 - + + Add missing internationalization in app/Sketch.java https://github.com/processing/processing/pull/3392 + Examples window shows contributed examples https://github.com/processing/processing/pull/3421 https://github.com/processing/processing/pull/3421 - + + Reworking the Contribution Manager according to Scott's redesign https://github.com/processing/processing/pull/3423 - + + Finish adding 'examples' contribs https://github.com/processing/processing/issues/2953 @@ -694,7 +3646,7 @@ Hopefully the last release before we go to beta. https://github.com/processing/processing/pull/3410 -[ retina/hidpi fixes ] +[ retina/hidpi fixes ] + Make g.pixelDensity public inside PApplet (so accessible by sketches) @@ -705,22 +3657,22 @@ Hopefully the last release before we go to beta. + Text not getting the correct font in Retina2D https://github.com/processing/processing/issues/2617 - + + Text is half size in PGraphicsRetina2D https://github.com/processing/processing/issues/2738 -[ andres loves opengl ] +[ andres loves opengl ] + Add attrib() method https://github.com/processing/processing/issues/2963 + The ortho() function seems broken https://github.com/processing/processing/issues/1278 - + + Errors with loading SVGs in P3D/P2D https://github.com/processing/processing/issues/3379 - + + Sketch window briefly appears on top left corner when using OpenGL https://github.com/processing/processing/issues/3308 @@ -732,16 +3684,16 @@ Hopefully the last release before we go to beta. + Sketch window is not placed at correct location when running a second time https://github.com/processing/processing/issues/3125 - + + Full screen needs to ignore prev location setting for frame? https://github.com/processing/processing/issues/3305 - + + save() and saveFrame() with 2X renderers fails https://github.com/processing/processing/issues/3255 - + + NPE when using image() created with createGraphics(PGraphicsRetina2D) https://github.com/processing/processing/issues/2510 - + + Closing OpenGL sketch from the PDE doesn't stop java.exe process https://github.com/processing/processing/issues/2335 @@ -752,13 +3704,13 @@ Hopefully the last release before we go to beta. PROCESSING 3.0a10 (REV 0237) - 9 June 2015 Huge release! Knocking on the door for beta, this includes many changes -and improvements for how displays of all kinds (single, multiple, retina, -high dpi) are handled, plus smoothing, full screen, etc etc. +and improvements for how displays of all kinds (single, multiple, retina, +high dpi) are handled, plus smoothing, full screen, etc etc. -[ breaking things for the future ] +[ breaking things for the future ] -+ Added fullScreen() method to make it far easier to run sketches ++ Added fullScreen() method to make it far easier to run sketches using the full screen. Reference notes and explanation here: https://github.com/processing/processing-docs/issues/250 https://github.com/processing/processing/issues/3296 @@ -770,14 +3722,14 @@ high dpi) are handled, plus smoothing, full screen, etc etc. + Re-opened the Gates of Hell by adding chaining operations to PVector https://github.com/processing/processing/issues/257 - + + Changed exec() and open() to use varargs. Changed open() to launch() to prevent problems with Python Mode. + Replaced --full-screen command line option with --present to untangle full screen versus the "Present" command that places blanks the rest of the screen around a sketch. - + + ortho() function is being reworked to make it compliant https://github.com/processing/processing/issues/1278 @@ -808,7 +3760,7 @@ high dpi) are handled, plus smoothing, full screen, etc etc. + Full screen doesn't work on second window w/o present mode https://github.com/processing/processing/issues/3271 - + + Full screen on OS X 10.9 has incorrect placement https://github.com/processing/processing/issues/3305 @@ -817,19 +3769,19 @@ high dpi) are handled, plus smoothing, full screen, etc etc. + Comments influencing code (preproc issues in parsing) https://github.com/processing/processing/issues/3326 - + + Sketch not appearing depending on arangement of external display on OS X https://github.com/processing/processing/issues/3118 - + + Sketch launching on second display that's not currently in use https://github.com/processing/processing/issues/3082 - + + strokeWeight() in setup() not working for default renderer https://github.com/processing/processing/issues/3331 + Retain original java.awt.Frame when it's available from PSurfaceAWT -+ Set frame icon images for Java2D (dock and cmd-tab) ++ Set frame icon images for Java2D (dock and cmd-tab) https://github.com/processing/processing/issues/257 + Debug message showing up in 3.0a9 when dragging and dropping files @@ -837,7 +3789,7 @@ high dpi) are handled, plus smoothing, full screen, etc etc. + Rolled back to 3.0a5 version of appbundler due to crash on startup https://github.com/processing/processing/issues/3359 https://github.com/processing/processing/issues/3360 - This re-introduces a few bugs related to the serial library and + This re-introduces a few bugs related to the serial library and scrolling and any other changes later than 16 November 2015 https://github.com/processing/processing/commits/master/build/macosx/appbundler.jar https://github.com/processing/processing/commits/master/build/macosx/appbundler/native/main.m @@ -847,39 +3799,39 @@ high dpi) are handled, plus smoothing, full screen, etc etc. + set(0, 0, image) does not set alpha channel to opaque in P2D/P3D https://github.com/processing/processing/issues/2125 - + + GROUP shapes are broken in 3.0a9 https://github.com/processing/processing/issues/3336 - + + Only a quarter of the sketch is appearing in 2x mode https://github.com/processing/processing/issues/3332 https://github.com/processing/processing/issues/3327 - + + Single transparent pixel at end of textures in OpenGL https://github.com/processing/processing/issues/115 - + + Implement setImpl() instead of set() inside PGraphicsOpenGL https://github.com/processing/processing/issues/160 https://github.com/processing/processing/issues/3012 - + + Strange extra lines with PShape 3D https://github.com/processing/processing/issues/3006 - + + BACKSPACE key is identified as DELETE in OpenGL renderers https://github.com/processing/processing/issues/3338 -+ More key issues in OpenGL ++ More key issues in OpenGL https://github.com/processing/processing/issues/3352 + Set icon for OpenGL windows https://github.com/processing/processing/issues/3348 - + + save() and saveFrame() with OPENGL renderer fails https://github.com/processing/processing/issues/3334 - + + Errors in glsl code are only caught when set() is used https://github.com/processing/processing/issues/2268 - + + Strips when rendering spheres with lights and anti-aliasing https://github.com/processing/processing/issues/1185 @@ -894,7 +3846,7 @@ high dpi) are handled, plus smoothing, full screen, etc etc. + Add i18n for Archiver Tool and missing text https://github.com/processing/processing/pull/3349 - + + Fix case-related bugs in Toolkit.setMenuMnemonics() https://github.com/processing/processing/pull/3366 @@ -906,27 +3858,27 @@ high dpi) are handled, plus smoothing, full screen, etc etc. https://github.com/processing/processing/pull/3319 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 3.0a9 (REV 0236) - 19 May 2015 -More work as we head toward beta. Mostly improvements to the GUI +More work as we head toward beta. Mostly improvements to the GUI and fixes for many bugs. So close to beta I can practically smell it. -[ changes ] +[ changes ] + Implement more of the bottom half of the editor window GUI + Show screen dimensions in the Preferences window for display selector -+ Change how the variables/debug window works. Automatically ++ Change how the variables/debug window works. Automatically show the window when debugging, hide when not. https://github.com/processing/processing/issues/3298 https://github.com/processing/processing/issues/3091 -+ Enabling and disabling the debugger toggles the Step/Continue ++ Enabling and disabling the debugger toggles the Step/Continue buttons in the toolbar + Remove techie options from the Debug menu @@ -937,7 +3889,7 @@ and fixes for many bugs. So close to beta I can practically smell it. + Lots of internal cleaning -[ bug fixes ] +[ bug fixes ] + Implement Cmd-Q handler on Mac OS X to shut down sketches properly https://github.com/processing/processing/issues/3301 @@ -965,7 +3917,7 @@ and fixes for many bugs. So close to beta I can practically smell it. https://github.com/processing/processing/issues/3293 -[ fixed in 3.0a8, confirmed later ] +[ fixed in 3.0a8, confirmed later ] + "Step" not working properly https://github.com/processing/processing/issues/3266 @@ -977,7 +3929,7 @@ and fixes for many bugs. So close to beta I can practically smell it. https://github.com/processing/processing/issues/3271 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 3.0a8 (REV 0235) - 17 May 2015 @@ -991,7 +3943,7 @@ section below, for a change in how the size() command works. [ fixes ] -+ size() sometimes erratic (i.e default size used) This was often ++ size() sometimes erratic (i.e default size used) This was often seen with large setup() functions, or on more esoteric platforms. https://github.com/processing/processing/issues/1672 @@ -1001,8 +3953,8 @@ section below, for a change in how the size() command works. + Sketchbook window requires restart of Processing before updating after sketchbook location change. https://github.com/processing/processing/issues/3214 - -+ Replace & Find was reading "Find & Replace" + ++ Replace & Find was reading "Find & Replace" https://github.com/processing/processing/issues/3247 + "One file added to sketch" message when two files added @@ -1026,12 +3978,12 @@ section below, for a change in how the size() command works. setup() and is the only place where size() can be used. If using Processing without the PDE (i.e. with another IDE like Eclipse), remove the size() method from setup() and instead place it like so: - + public void settings() { size(400, 400, P3D); // your size() command here } - - The rest of your code remains unchanged. The PDE does this + + The rest of your code remains unchanged. The PDE does this transparently, so 99% of people won't even notice this change. However, it allows us to fix (and avoid) a lot of really nasty complications that come from how Processing lets you switch @@ -1046,7 +3998,7 @@ section below, for a change in how the size() command works. implementation of the settings() method is a simpler solution. + Added SVG Export library (works like PDF Export). This has not - been tested heavily yet. + been tested heavily yet. + Replace Tweak Mode ColorSelector with JComponent version https://github.com/processing/processing/issues/3209 @@ -1070,8 +4022,8 @@ section below, for a change in how the size() command works. thiList.append(value); } -+ Inside main(), don't set 'args' to a zero-length array if no args - were passed in, instead leave 'args' null. ++ Inside main(), don't set 'args' to a zero-length array if no args + were passed in, instead leave 'args' null. [ debugger ] @@ -1081,10 +4033,10 @@ section below, for a change in how the size() command works. + Change "method" to "function" in a few error messages https://github.com/processing/processing/issues/3225 - + + Error message for incorrect function arguments is wonky https://github.com/processing/processing/issues/3268 - + + String concatenation mistakes produce odd error messages https://github.com/processing/processing/issues/3253 @@ -1094,7 +4046,7 @@ section below, for a change in how the size() command works. + Window size not passing into Tweak Mode https://github.com/processing/processing/issues/3208 https://github.com/processing/processing/pull/3227 - + + Keep the tab menu at the right-hand side https://github.com/processing/processing/pull/3236 @@ -1103,7 +4055,7 @@ section below, for a change in how the size() command works. + Prevent breakpoints from causing a reload prompt https://github.com/processing/processing/pull/3263 - + + Added buffer to file detection time https://github.com/processing/processing/pull/3262 @@ -1113,15 +4065,15 @@ section below, for a change in how the size() command works. + Preferences window fixes for Linux https://github.com/processing/processing/pull/3232 https://github.com/processing/processing/issues/3231 - + + Clear error message in Contribution Manager after retrying https://github.com/processing/processing/pull/3240 https://github.com/processing/processing/issues/3239 - + + Add SOCKS proxy support to the PDE https://github.com/processing/processing/issues/2643 https://github.com/processing/processing/pull/3260 - + + Use system proxy by default https://github.com/processing/processing/issues/1476 https://github.com/processing/processing/pull/3251 @@ -1134,18 +4086,18 @@ section below, for a change in how the size() command works. + OpenGL sketches work only after running a sketch with default renderer https://github.com/processing/processing/issues/3218 - + + static mode - no setup() / draw() - broken in OpenGL https://github.com/processing/processing/issues/3163 - + + Deal with some performance issues https://github.com/processing/processing/issues/3210 - + + Can't run sketches with offscreen PGraphics https://github.com/processing/processing/issues/3259 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 3.0a7 (REV 0234) - 26 April 2015 @@ -1154,7 +4106,7 @@ Read the notes in 3.0a6 for major changes! This is only a minor bug fix release to take care of a few things that were broken in 3.0a6. -[ fixes ] +[ fixes ] + Fix bug that prevented the Preferences window from opening https://github.com/processing/processing/issues/3215 @@ -1174,9 +4126,9 @@ release to take care of a few things that were broken in 3.0a6. + Avoid minor memory leak in StringList.pop() -[ known issues ] +[ known issues ] -+ OpenGL sketches work on Windows (32- and 64-bit) only after running ++ OpenGL sketches work on Windows (32- and 64-bit) only after running a sketch that uses the default renderer https://github.com/processing/processing/issues/3218 @@ -1187,14 +4139,14 @@ release to take care of a few things that were broken in 3.0a6. https://github.com/processing/processing/issues?q=is%3Aopen+label%3Ahigh+-label%3Aenhancement -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 3.0a6 (REV 0233) - 25 April 2015 This is the big one! We've jettisoned PApplet as the base class so that we can improve performance, reduce flicker, and have a better base from -which to build better, more modern graphics rendering. More of the +which to build better, more modern graphics rendering. More of the gory details for the PApplet/PGraphics changes can be found here: https://github.com/processing/processing/tree/master/core @@ -1203,26 +4155,26 @@ https://github.com/processing/processing/issues/3072 and that means all Modes and some Tools will need to be updated: https://github.com/processing/processing/issues/3080 -We've also made major changes to better integrate PDE X, Tweak Mode, +We've also made major changes to better integrate PDE X, Tweak Mode, and other nice features for the default "Java" Mode. These will be the -center of the changes for 3.x, which is focused on improving the editing -and debugging experience in general. +center of the changes for 3.x, which is focused on improving the editing +and debugging experience in general. Suffice to say, this is truly an ALPHA quality release. We're pushing it out so that we can get more people testing it. If you want something more -stable, we recommend 3.0a5 (not 2.2.1, that thing is old!) +stable, we recommend 3.0a5 (not 2.2.1, that thing is old!) Library/Mode/Tool authors: Please help us get 3.0 ready by getting your code ready for 3.0! Because 2.x and 3.x contributions are separate, you -can maintain separate versions if you like (or only support 3.x). You -can also specify the earliest and latest revisions of Processing that -your code supports, so that it's only installed with the correct version. +can maintain separate versions if you like (or only support 3.x). You +can also specify the earliest and latest revisions of Processing that +your code supports, so that it's only installed with the correct version. If anything is unclear, please file an issue. I've not had time to write up all the changes yet (and some are still in progress), but what you see in this release is representative of where we're headed for 3.0. -[ known issues ] +[ known issues ] The full list is here: https://github.com/processing/processing/issues/ but a few that you might be likely to run across: @@ -1237,11 +4189,11 @@ but a few that you might be likely to run across: https://github.com/processing/processing/issues/3125 -[ general fixes and changes ] +[ general fixes and changes ] + Merge experimental into the main Java mode, move Java Mode to its own area -+ Deal with ctrl-alt-n regression ++ Deal with ctrl-alt-n regression https://github.com/processing/processing/issues/2979 + Don't add a ^M to files when writing @@ -1305,7 +4257,7 @@ but a few that you might be likely to run across: https://github.com/processing/processing/pull/2922 -[ who loves pull requests? I do. ] +[ who loves pull requests? I do. ] + Splash screen for Linux https://github.com/processing/processing/pull/3005 @@ -1387,7 +4339,7 @@ but a few that you might be likely to run across: + Fix ColorChooser cursor https://github.com/processing/processing/pull/3186 -+ Improve Spanish localization ++ Improve Spanish localization https://github.com/processing/processing/pull/3185 + Internationalization of editor error messages and Greek translations @@ -1481,13 +4433,13 @@ but a few that you might be likely to run across: https://github.com/processing/processing/pull/3102 -[ processing.core ] +[ processing.core ] -+ Remove Applet as the base class. ++ Remove Applet as the base class. https://github.com/processing/processing/tree/master/core + Replaced JOGL with LWJGL. Ongoing JOGL support is unclear and LWJGL - seems to be more consistently maintained. Unfortunately, it trades + seems to be more consistently maintained. Unfortunately, it trades one set of quirks for another. + Renamed 2x (hidpi/retina) versions of renderers to JAVA2D_2X, P3D_2X, etc. @@ -1513,7 +4465,7 @@ but a few that you might be likely to run across: https://github.com/processing/processing/issues/2925 -[ more contributions! ] +[ more contributions! ] + saveFrame() doesn't save opaque PNG files https://github.com/processing/processing/issues/3031 @@ -1538,7 +4490,7 @@ but a few that you might be likely to run across: https://github.com/processing/processing/issues/3114 -[ processing.data ] +[ processing.data ] + Ensure # of columns and titles lines up with Table(iterator) constructor @@ -1557,11 +4509,11 @@ but a few that you might be likely to run across: [ sketch ] -+ Added E2D, an experimental/enhanced renderer that draws directly - to the Graphics context without an intermediate image. This greatly - speeds up performance (especially on retina/hidpi displays), but - prevents pixel access (no save(), saveFrame(), loadPixels(), etc). - It also causes some rendering hiccups (frame rate is not as smooth), ++ Added E2D, an experimental/enhanced renderer that draws directly + to the Graphics context without an intermediate image. This greatly + speeds up performance (especially on retina/hidpi displays), but + prevents pixel access (no save(), saveFrame(), loadPixels(), etc). + It also causes some rendering hiccups (frame rate is not as smooth), but that's why it's experimental. + Remove isGL(), is2D(), is3D(), displayable() from PApplet @@ -1594,27 +4546,27 @@ but a few that you might be likely to run across: https://github.com/processing/processing/issues/2641 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 3.0a5 (REV 0232) - 16 November 2014 -Hello from the University of Denver! I'm here with Casey, Dan, Andres, -and Manindra working on 3.0. Chris Coleman and Laleh Mehran have been +Hello from the University of Denver! I'm here with Casey, Dan, Andres, +and Manindra working on 3.0. Chris Coleman and Laleh Mehran have been hosting us on behalf of the EDP program. It all looks a bit like this: https://twitter.com/digitalcoleman/status/533784122179596288 [ changes ] -+ Removed the sound library. It's now available as its own library ++ Removed the sound library. It's now available as its own library from the Library Manager. + Change how languages are loaded, adding a local override. + Update to use JRE/JDK 7u72 -+ Implement the active() method for Serial and Server ++ Implement the active() method for Serial and Server https://github.com/processing/processing/issues/2364 https://github.com/processing/processing/pull/2588 @@ -1645,7 +4597,7 @@ https://twitter.com/digitalcoleman/status/533784122179596288 [ bug fixes ] -+ Remove debug message printed to the console when the control key ++ Remove debug message printed to the console when the control key is pressed, when using the new editor. + size(640,360 , P3D) doesn't work properly (strange spacing) @@ -1666,7 +4618,7 @@ https://twitter.com/digitalcoleman/status/533784122179596288 https://github.com/processing/processing/issues/2930 -[ contributed fixes ] +[ contributed fixes ] + Cmd + H runs sketch instead of hiding the PDE (OS X) https://github.com/processing/processing/issues/2881 @@ -1765,7 +4717,7 @@ https://twitter.com/digitalcoleman/status/533784122179596288 https://github.com/processing/processing/pull/2958 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 3.0a4 (REV 0231) - 12 September 2014 @@ -1775,17 +4727,17 @@ The next alpha release will contain major changes and break a few libraries and tools, so this is an attempt at a final "stable" alpha that can be used until all those issues are sorted out. -[ changes ] +[ changes ] + Contributions (Libraries, Modes, Tools) are now read from their own listing that's specific to Processing 3. https://github.com/processing/processing/issues/2850 https://github.com/processing/processing/issues/2849 -+ Made the new editor the default. ++ Made the new editor the default. + The OS X default File menu (shown when no windows are open) now has the - order/naming changes found in the sketch window File menu. + order/naming changes found in the sketch window File menu. + Turning off file watching because of errant "this sketch has changed" messages. Hopefully this will return soon. @@ -1794,7 +4746,7 @@ until all those issues are sorted out. + Turned off code completion by default and reset its preference name. -[ bug fixes ] +[ bug fixes ] + TGAs from saveFrame() create transparent/black movies with Movie Maker https://github.com/processing/processing/issues/2851 @@ -1811,7 +4763,7 @@ until all those issues are sorted out. https://github.com/processing/processing/issues/2831 -[ internal tweaks ] +[ internal tweaks ] + Optimize creation of boxed primitives https://github.com/processing/processing/pull/2826 @@ -1823,14 +4775,14 @@ until all those issues are sorted out. https://github.com/processing/processing/pull/2844 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 3.0a3 (REV 0230) - 26 August 2014 -The 3.0 process continues as we've wrapped up a very successful +The 3.0 process continues as we've wrapped up a very successful Google Summer of Code, and have also been integrating contributions -(internationalization!) from some helpful community members. +(internationalization!) from some helpful community members. In particular, Jakub Valtar, Darius M, and Frederico Bond are my heroes: https://github.com/processing/processing/commits/master?author=jakubvaltar @@ -1848,7 +4800,7 @@ https://github.com/processing/processing/commits/master?author=voidplus [ fixes and updates ] -+ The sound library is now available for 64-bit Windows and Linux. ++ The sound library is now available for 64-bit Windows and Linux. 32-bit versions are still in the works. + Don't write sketch.properties unless it's a non-default mode @@ -1993,7 +4945,7 @@ https://github.com/processing/processing/commits/master?author=voidplus + Call applet.exit() instead of System.exit() from Present Mode's 'stop' https://github.com/processing/processing/pull/2680 - + + Drawing RECT PShape with rounded corners crashes the sketch https://github.com/processing/processing/issues/2648 @@ -2013,7 +4965,7 @@ https://github.com/processing/processing/commits/master?author=voidplus https://github.com/processing/processing/issues/2679 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 3.0a2 (REV 0229) - 31 July 2014 @@ -2021,25 +4973,25 @@ PROCESSING 3.0a2 (REV 0229) - 31 July 2014 The 3.0 train gains steam and continues to hurtle down the track. -[ changes ] +[ changes ] + Added a new sketchbook location, so that you can have separate sketchbooks - with 2.0 and 3.0 releases. The downside is that they won't stay in sync, + with 2.0 and 3.0 releases. The downside is that they won't stay in sync, but the upside is that sketches that haven't been updated, or conflicting - Libraries, Modes, or Tools won't cause trouble with the other version. + Libraries, Modes, or Tools won't cause trouble with the other version. The new preference is called sketchbook.location.three (the old preference was sketchbook.location). If you already have a 2.0 sketchbook, that will be used by default with 3.0 until you change it in the Preferences window. + Neglected to mention with the previous release that the video library has been removed from the default download. This decreases the size of the - Processing download by about 20%. In addition, it was only the video + Processing download by about 20%. In addition, it was only the video library for the platform being downloaded, and with the return of cross- platform application export, that could cause sadness. To use the video library, use the "Add Library..." menu and select it from the list. + Added a new preference for the 3.0 sketchbook location, so that a separate - sketchbook (and with it, different Modes, Tools, and Libraries) can be + sketchbook (and with it, different Modes, Tools, and Libraries) can be used with Processing 3.0 versus older versions of 2.x. + Remove default menu bar hack for OS X @@ -2047,11 +4999,11 @@ The 3.0 train gains steam and continues to hurtle down the track. + Move to native OS X full screen (supported in 10.7 and later) https://github.com/processing/processing/issues/2641 - This allows us to remove native code for hiding the menu bar. + This allows us to remove native code for hiding the menu bar. But it may introduce more quirks, we'll have to test it out. -[ fixes ] +[ fixes ] + The Examples weren't included in 3.0a1. Oops. https://github.com/processing/processing/issues/2652 @@ -2080,7 +5032,7 @@ The 3.0 train gains steam and continues to hurtle down the track. https://github.com/processing/processing/issues/2208 -[ the data classes ] +[ the data classes ] + Add copy() method to Table @@ -2125,12 +5077,12 @@ X Fixed issue where the browser wasn't opening the reference properly https://github.com/processing/processing/pull/2657 -[ you request, we pull ] +[ you request, we pull ] + Insert tabs properly when prefs set for tabs mode https://github.com/processing/processing/pull/2607 -+ Improve the appearance when using the Nimbus LAF ++ Improve the appearance when using the Nimbus LAF https://github.com/processing/processing/pull/2671 + Implement A and a (elliptical arcs) @@ -2147,7 +5099,7 @@ X Fixed issue where the browser wasn't opening the reference properly https://github.com/processing/processing/pull/2324 -[ fixed in earlier releases ] +[ fixed in earlier releases ] + maxHeapSize typo in the build scripts https://github.com/processing/processing/issues/2603 @@ -2169,7 +5121,7 @@ X Fixed issue where the browser wasn't opening the reference properly https://github.com/processing/processing/issues/5 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 3.0a1 (REV 0228) - 26 July 2014 @@ -2178,14 +5130,14 @@ Kicking off the 3.0 release process. The focus for Processing 3 is improving the editor and the coding process, so we'll be integrating what was formerly PDE X as the main editor. -This release also includes a number of bug fixes and changes, based on +This release also includes a number of bug fixes and changes, based on in-progress Google Summer of Code projects and a few helpful souls on Github. Please contribute to the Processing 3 release by testing and reporting bugs. Or better yet, helping us fix them and submitting pull requests. -[ contributed fixes! ] +[ contributed fixes! ] + Fix blendMode() problems in the default renderer (thanks Jakub Valtar!) https://github.com/processing/processing/issues/2012 @@ -2216,7 +5168,7 @@ Or better yet, helping us fix them and submitting pull requests. https://github.com/processing/processing/issues/2630 -[ summer of code ] +[ summer of code ] + Line coloring incorrect for filtered contribution listings https://github.com/processing/processing/issues/2583 @@ -2240,7 +5192,7 @@ Or better yet, helping us fix them and submitting pull requests. + Add preference to set the present color https://github.com/processing/processing/pull/2568 -+ Fix a problem where mode menu selection would change even if ++ Fix a problem where mode menu selection would change even if the change was canceled due to the sketch being modified https://github.com/processing/processing/issues/2615 @@ -2248,12 +5200,12 @@ Or better yet, helping us fix them and submitting pull requests. https://github.com/processing/processing/pull/2651 -[ more bug fixes ] +[ more bug fixes ] + Prevent the current Mode from being de-selected https://github.com/processing/processing/issues/2545 -+ Prevent ArrayIndexOutOfBoundsException when calling min/maxValue() ++ Prevent ArrayIndexOutOfBoundsException when calling min/maxValue() on a FloatDict that only contains NaN values + Last row was being skipped on tables with the 'newlines' option set @@ -2270,10 +5222,10 @@ Or better yet, helping us fix them and submitting pull requests. Formerly, this was throwing a NullPointerException. -[ changes ] +[ changes ] + A new sound library has been added, and Minim has been removed. Minim - will now available via the Contributions Manager. + will now available via the Contributions Manager. + Add copy() method to PVector @@ -2282,13 +5234,13 @@ Or better yet, helping us fix them and submitting pull requests. + add getColumnTitle(int) and getColumnTitles() to TableRow interface -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.2.1 (REV 0227) - 19 May 2014 A handful of bug fixes, the most prominent rolls back a change that broke -PDE X and other Modes and Tools. +PDE X and other Modes and Tools. + Bring back setIcon(Frame) for PDE X and others https://github.com/processing/processing-experimental/issues/64 @@ -2296,7 +5248,7 @@ PDE X and other Modes and Tools. + Add additional code for crashing when the Mode is changed or new editor windows opened. -+ Use mouseReleased() instead of mousePressed() in the color selector, ++ Use mouseReleased() instead of mousePressed() in the color selector, otherwise it registers the release as a click in the color window https://github.com/processing/processing/issues/2514 @@ -2326,7 +5278,7 @@ PDE X and other Modes and Tools. + Updated reference files included in the download. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.2 (REV 0226) - 12 May 2014 @@ -2335,7 +5287,7 @@ Major changes to, and improvements upon, how "Export to Application" works. Plus dozens of bug fixes for all manner of atrocities. -[ bug fixes and additions ] +[ bug fixes and additions ] + Sketches only starting once, or half-starting and hanging on Mac OS X. A major problem on OS X, thanks to David Fokkema for tracking down a fix. @@ -2381,7 +5333,7 @@ Plus dozens of bug fixes for all manner of atrocities. [ export to application ] + The return of multi-platform export! Create applications for Windows - and Linux while using OS X. Create a Linux application from Windows. + and Linux while using OS X. Create a Linux application from Windows. Against my better judgement, we're supporting it again. It's extremely difficult, but was disappointing to remove it earlier. @@ -2389,7 +5341,7 @@ Plus dozens of bug fixes for all manner of atrocities. https://github.com/processing/processing/issues/2349 + Change Windows export to use launch4j instead of our custom launcher. - This will fix many, many problems, but may introduce some new ones. + This will fix many, many problems, but may introduce some new ones. + Windows (64-bit) now creates a proper .exe instead of a .bat file https://github.com/processing/processing/issues/923 @@ -2430,7 +5382,7 @@ Plus dozens of bug fixes for all manner of atrocities. + Bug in relative moveto commands for SVG https://github.com/processing/processing/issues/2377 -+ Add a constructor to bind Server to a specific address ++ Add a constructor to bind Server to a specific address https://github.com/processing/processing/issues/2356 + Fonts from loadFont() show up as blocks in P3D (regression) @@ -2440,16 +5392,16 @@ Plus dozens of bug fixes for all manner of atrocities. https://github.com/processing/processing/issues/2493 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.1.2 (REV 0225) - 15 April 2014 -Lots of small bug fixes plus some additional changes to support +Lots of small bug fixes plus some additional changes to support the new Python Mode, coming soon: https://github.com/jdf/processing.py -[ the pde ] +[ the pde ] + The PDE was using 15% of CPU while just sitting idle. Thanks to David Fokkema for the fix (and pull request). @@ -2476,7 +5428,7 @@ the new Python Mode, coming soon: https://github.com/jdf/processing.py https://github.com/processing/processing/issues/2453 -[ the core ] +[ the core ] + sketchPath() was returning user.home in exported apps on OS X https://github.com/processing/processing/issues/2181 @@ -2491,15 +5443,15 @@ the new Python Mode, coming soon: https://github.com/jdf/processing.py + PGraphics.colorCalcARGB(int, float) wasn't properly capping alpha values https://github.com/processing/processing/issues/2439 -+ Make sure that the window background color isn't the same as the default - sketch background color (otherwise the sketch area isn't clear). ++ Make sure that the window background color isn't the same as the default + sketch background color (otherwise the sketch area isn't clear). https://github.com/processing/processing/issues/2297 + Fix for occasional NullPointerException in paint() https://github.com/processing/processing/issues/2354 -[ andres vs opengl, episode 225 ] +[ andres vs opengl, episode 225 ] + copy() under OPENGL uses upside-down coordinates for cropping https://github.com/processing/processing/issues/2345 @@ -2533,7 +5485,7 @@ the new Python Mode, coming soon: https://github.com/jdf/processing.py https://github.com/processing/processing/issues/2424 -[ fixed in earlier releases ] +[ fixed in earlier releases ] + draw() called again before finishing on OS X (retina issue) https://github.com/processing/processing/issues/1709 @@ -2545,7 +5497,7 @@ the new Python Mode, coming soon: https://github.com/jdf/processing.py https://github.com/processing/processing/issues/2252 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.1.1 (REV 0224) - 21 January 2014 @@ -2569,7 +5521,7 @@ Still a number of known issues, but this cleans up several of the biggies. https://github.com/processing/processing/issues/2202 -[ windows ] +[ windows ] + Export to Application was broken on Windows https://github.com/processing/processing/issues/2219 @@ -2615,7 +5567,7 @@ Still a number of known issues, but this cleans up several of the biggies. https://github.com/processing/processing/pull/2266 -[ core fixes ] +[ core fixes ] + PImage resize() causes PImage not to be rendered in JAVA2D https://github.com/processing/processing/issues/2179 @@ -2662,24 +5614,24 @@ Still a number of known issues, but this cleans up several of the biggies. https://github.com/processing/processing/issues/2233 -[ missing in the 2.1 release notes ] +[ missing in the 2.1 release notes ] -+ init() not called on tools until later ++ init() not called on tools until later https://github.com/processing/processing/issues/1859 + Finish changes so the PDE can use an unmodified JRE https://github.com/processing/processing/issues/1840 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.1 (REV 0223) - 27 October 2013 -There have been major changes since 2.0.3, most of them are outlined in +There have been major changes since 2.0.3, most of them are outlined in the release notes for 2.1 beta 1 (look down a few dozen lines). -This release includes a few updates to fix problems introduced in the beta +This release includes a few updates to fix problems introduced in the beta release, as well as additional general bug fixes, especially for OpenGL. + Added an option to not embed the Java runtime into an exported application. @@ -2687,8 +5639,8 @@ release, as well as additional general bug fixes, especially for OpenGL. Java 7u45 or later. Details on the same page that nobody read last time: http://wiki.processing.org/w/Export_Info_and_Tips -+ The new println() (see the beta 1 notes) makes some old code behave a - little differently. In the past, println() with an array would write ++ The new println() (see the beta 1 notes) makes some old code behave a + little differently. In the past, println() with an array would write out the array, one element per line, with the index in the front. i.e.: PFont.list()) would write something like this to the console: @@ -2705,18 +5657,18 @@ release, as well as additional general bug fixes, especially for OpenGL. Serif SansSerif Monospaced Dialog DialogInput ACaslonPro-Bold... - To get the old behavior, use printArray(). It's the price of progress, + To get the old behavior, use printArray(). It's the price of progress, and shouldn't really "break" anyone's code since it's just writing to the - console. We think the new syntax outweighs the downside of the change. + console. We think the new syntax outweighs the downside of the change. With arrays of primitive types (int[], float[], anything that's not an object), we've added code so that println() works as before. But we - can't do the same for arrays of objects, such as String. + can't do the same for arrays of objects, such as String. + The preference for font smoothing (anti-aliasing) in the editor has been - reset in this release. Fonts are unusably gross on OS X (and Linux) + reset in this release. Fonts are unusably gross on OS X (and Linux) without smoothing and Oracle's version of Java (now in use with 2.1), - and many longtime users have anti-aliasing turned off. You can still + and many longtime users have anti-aliasing turned off. You can still turn off smoothing in the Preferences window, but the results may be poor. https://github.com/processing/processing/issues/2164 https://github.com/processing/processing/issues/2160 @@ -2739,7 +5691,7 @@ release, as well as additional general bug fixes, especially for OpenGL. https://github.com/processing/processing/issues/2135 -[ OpenGL updates ] +[ OpenGL updates ] + Using sketchQuality() does not work properly with P3D, OPENGL, P2D https://github.com/processing/processing/pull/2157 @@ -2772,21 +5724,21 @@ release, as well as additional general bug fixes, especially for OpenGL. https://github.com/processing/processing/commit/cca2f08a24ef892c494f5a75aa0e4b01de7e5d8a -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.1 beta 1 (REV 0222) - 20 October 2013 This release contains major changes. The big ones: -+ Java 7 is now used across all platforms. On Mac OS X, ++ Java 7 is now used across all platforms. On Mac OS X, we're now embedding Java 7u45. More info here: http://wiki.processing.org/w/Supported_Platforms#Java_Versions -+ Major changes have been made to Export to Application. ++ Major changes have been made to Export to Application. Read here: http://wiki.processing.org/w/Export_Info_and_Tips -+ print() and println() now make debugging fun! They can now take any ++ print() and println() now make debugging fun! They can now take any number of parameters, which means that code like: println(x, y, mouseX, mouseY); will print out @@ -2797,13 +5749,13 @@ This release contains major changes. The big ones: + A new serial library has been added! The results of Gottfried Haider's Google Summer of Code project now replaces the old serial library. -And everyone should wish Casey Reas happy birthday today! +And everyone should wish Casey Reas happy birthday today! This release is my birthday present for him. What did you get him? Here's a more detailed rundown of what else is in this release: -[ new features and additions ] +[ new features and additions ] + For people using Eclipse, the new print() and println() methods add some quirks because of how println() works for arrays in previous @@ -2814,9 +5766,9 @@ Here's a more detailed rundown of what else is in this release: https://github.com/processing/processing/issues/2056 + Update the JavaDoc, remove java.* package prefix ugliness. Also link - out to the online version of the Oracle documentation. + out to the online version of the Oracle documentation. -+ Major work on the source and the build scripts as we completed the ++ Major work on the source and the build scripts as we completed the transition to Java 7, and away from Apple's deprecated Java 6. http://wiki.processing.org/w/Supported_Platforms#Mac_OS_X @@ -2829,7 +5781,7 @@ Here's a more detailed rundown of what else is in this release: + Remove unused/outdated 'Mangler' Tool example -+ Remove video library for other platforms in download. This saves ++ Remove video library for other platforms in download. This saves significant space because we're not doing cross-platform export anymore. + Update apple.jar file with new version @@ -2849,7 +5801,7 @@ Here's a more detailed rundown of what else is in this release: Java 7 on OS X only supports 64-bit, so 32-bit is no longer available. -[ editor fixes ] +[ editor fixes ] + Deal with null/missing folders for Tools and Modes https://github.com/processing/processing/issues/2068 @@ -2889,8 +5841,8 @@ Here's a more detailed rundown of what else is in this release: + Java2D images crash after being resized https://github.com/processing/processing/issues/2113 -+ Constrain lerpColor() between 0 and 1. Unlike lerp(), where it might - make mathematical sense, going outside the boundary colors produces ++ Constrain lerpColor() between 0 and 1. Unlike lerp(), where it might + make mathematical sense, going outside the boundary colors produces really messy results. + JSONObject/Array.format(-1) not working on embedded JSONObjects @@ -2936,7 +5888,7 @@ Here's a more detailed rundown of what else is in this release: https://github.com/processing/processing/issues/2151 -[ new serial library ] +[ new serial library ] + Incorporate the new serial library. Woohoo! https://github.com/processing/processing/pull/2093 @@ -2954,9 +5906,9 @@ Here's a more detailed rundown of what else is in this release: https://github.com/processing/processing/issues/1374 -[ font fixes and changes ] +[ font fixes and changes ] -+ Add ability to change the editor (and console) font from a menu ++ Add ability to change the editor (and console) font from a menu in the Preferences window. https://github.com/processing/processing/issues/2078 @@ -2966,9 +5918,9 @@ Here's a more detailed rundown of what else is in this release: + Allow editor and console font changes without restart. -+ Anti-aliasing fix for the editor line status. ++ Anti-aliasing fix for the editor line status. -+ Change to bold instead of semibold version of Source Code Pro. ++ Change to bold instead of semibold version of Source Code Pro. The semibold wasn't mapping properly as the same family. + Use the same font in the console as the editor. @@ -2989,12 +5941,12 @@ Here's a more detailed rundown of what else is in this release: + Add support for many other image file types to Movie Maker -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0.3 (REV 0221) - 5 September 2013 -Lots of bug fixes, primarily a ton of work by Andres to improve +Lots of bug fixes, primarily a ton of work by Andres to improve OpenGL rendering with P2D and P3D. @@ -3003,7 +5955,7 @@ OpenGL rendering with P2D and P3D. + blendMode() change causes OpenGL renderer to be very slow https://github.com/processing/processing/issues/2021 -+ Serious OpenGL performance issues on OS X, this was fixed ++ Serious OpenGL performance issues on OS X, this was fixed with the JOGL update in 2.0.2, but we neglected to note it. https://github.com/processing/processing/issues/1714 @@ -3058,7 +6010,7 @@ OpenGL rendering with P2D and P3D. https://github.com/processing/processing/issues/2061 -[ other bug fixes ] +[ other bug fixes ] + Fix options parsing on loadTable() to handle spaces. @@ -3067,18 +6019,18 @@ OpenGL rendering with P2D and P3D. https://github.com/processing/processing/pull/2046 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0.2 (REV 0220) - 14 August 2013 -Many small bug fixes and lots of work on the Library/Tool/Mode Manager. +Many small bug fixes and lots of work on the Library/Tool/Mode Manager. Full screen is back for Windows, and lots more. -[ bug fixes ] +[ bug fixes ] -+ Fix Windows issues with associating .pde files ++ Fix Windows issues with associating .pde files https://github.com/processing/processing/issues/286 http://code.google.com/p/processing/issues/detail?id=247 @@ -3094,7 +6046,7 @@ Full screen is back for Windows, and lots more. + Setting an INT4 uniform in PShader causes an out of bounds exception https://github.com/processing/processing/issues/1994 -+ Fix "less less" typo ++ Fix "less less" typo https://github.com/processing/processing/issues/1928 + Slash breaks syntax highlighting when spaces are involved @@ -3121,7 +6073,7 @@ Full screen is back for Windows, and lots more. https://github.com/processing/processing/issues/1962 -[ contribution managers ] +[ contribution managers ] + Support multiple categories for libraries https://github.com/processing/processing/issues/1970 @@ -3136,7 +6088,7 @@ Full screen is back for Windows, and lots more. + Restrict library categories to the ones in the document. If it's not correct, shows up as 'other'. -+ Catch Errors (not just Exceptions) when loading libraries, modes, ++ Catch Errors (not just Exceptions) when loading libraries, modes, and tools. Handles UnsupportedClassVersionError and other quirks. + Redo handling of "old" versions of contributions. @@ -3146,7 +6098,7 @@ Full screen is back for Windows, and lots more. https://github.com/processing/processing/pull/1925 -[ data, data, data ] +[ data, data, data ] + Error in IntList and FloatList insert() https://github.com/processing/processing/issues/1929 @@ -3165,7 +6117,7 @@ Full screen is back for Windows, and lots more. https://github.com/processing/processing/issues/1893 + When using increment() on IntList, make sure the index exists and - automatically resize the list if necessary. This is more in keeping + automatically resize the list if necessary. This is more in keeping with increment() in the Dict classes. + getSubset() broken in IntList, StringList, and missing from FloatList @@ -3182,7 +6134,7 @@ Full screen is back for Windows, and lots more. https://github.com/processing/processing/issues/2007 -[ internal changes you'll never notice... unless I broke something ] +[ internal changes you'll never notice... unless I broke something ] + Add an exception wrapper for startup, hopefully we can catch/debug more "Processing can't start!" issues with this. @@ -3210,17 +6162,17 @@ Full screen is back for Windows, and lots more. https://github.com/processing/processing/issues/2010 -[ changes ] +[ changes ] -+ Experimental Mode has been removed from the default download, - so that it can be updated more frequently. Install it and help us ++ Experimental Mode has been removed from the default download, + so that it can be updated more frequently. Install it and help us test what will become the 3.0 release of Processing! + Add "Processing Foundation" to the Help menu. https://github.com/processing/processing/issues/1908 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0.1 (REV 0219) - 21 June 2013 @@ -3228,7 +6180,7 @@ PROCESSING 2.0.1 (REV 0219) - 21 June 2013 Bug fixes for some of what ailed the Processing 2.0 release, including two contributed from Josh Giesbrecht. Thanks Josh! -[ bug fixes ] +[ bug fixes ] + Modes, Tools, Libraries not moving properly on Windows https://github.com/processing/processing/issues/1781 @@ -3237,7 +6189,7 @@ two contributed from Josh Giesbrecht. Thanks Josh! https://github.com/processing/processing/issues/707 http://code.google.com/p/processing/issues/detail?id=668 -+ Fix a problem with exporting Windows applications from OS X and Linux. ++ Fix a problem with exporting Windows applications from OS X and Linux. https://github.com/processing/processing/issues/1890 + getVertex() trying to get three values when no Z-coord is available @@ -3247,7 +6199,7 @@ two contributed from Josh Giesbrecht. Thanks Josh! + Fix typo in default printProjection() method https://github.com/processing/processing/issues/1863 -[ additions ] +[ additions ] + Add error message for that reports what line was bad while parsing a table. (Otherwise confusing ArrayIndexOutOfBoundsException while parsing bad CSV.) @@ -3255,19 +6207,19 @@ two contributed from Josh Giesbrecht. Thanks Josh! + Added option to remove the background image at the top of the window. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0 (REV 0218) - 3 June 2013 -And just like that, here we are at 2.0. +And just like that, here we are at 2.0. -[ bug fixes ] +[ bug fixes ] + Example window has the Java application icon https://github.com/processing/processing/issues/1800 -+ The update checker sometimes insisted there were updates, ++ The update checker sometimes insisted there were updates, even though there were not, due to a build problem. https://github.com/processing/processing/issues/1792 @@ -3298,33 +6250,33 @@ And just like that, here we are at 2.0. + P2D/P3D sketches don't get focus until clicked https://github.com/processing/processing/issues/1700 -[ changes ] +[ changes ] -+ A handful of tweaks to smooth out the 2.0 user interface. - Incorporates some of the feedback suggested here: ++ A handful of tweaks to smooth out the 2.0 user interface. + Incorporates some of the feedback suggested here: https://github.com/processing/processing/pull/1822 while trying to preserve the look & feel of our PDE design. + Added built-in fonts (Source Sans and Source Code from Adobe) - as the default font for the UI and editor. As usual, the editor - font can be changed in preferences.txt. And if you already have + as the default font for the UI and editor. As usual, the editor + font can be changed in preferences.txt. And if you already have a preferences.txt file, the new font won't override it. Fonts for GUI elements can be modified in lib/theme.txt, but be careful with those, and don't complain if/when they break. -+ Added several additional functions for data classes. More details ++ Added several additional functions for data classes. More details in the reference and coming soon. + Changed how null values were handled with binary tables. If anyone - was using the (undocument) .bin format for Table, you'll need to + was using the (undocument) .bin format for Table, you'll need to re-save your data. -+ Changed XML.toString() (what's called when you print() or println() - an XML object) to just send a single line of text instead of a full ++ Changed XML.toString() (what's called when you print() or println() + an XML object) to just send a single line of text instead of a full XML document with a header. Use format(numSpaces) if you want a properly formatted document with declaration at the top. -[ andres on the attack ] +[ andres on the attack ] + PImage not drawn after resize()/get() in P2D/P3D https://github.com/processing/processing/issues/1830 @@ -3369,17 +6321,17 @@ And just like that, here we are at 2.0. https://github.com/processing/processing/issues/1515 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0b9 (REV 0217) - 18 May 2013 The 2.0 interface has arrived! Mmm... pretty. -We've removed Android and JavaScript modes from the default download. You +We've removed Android and JavaScript modes from the default download. You can easily install them by selected "Add Mode" from the Mode menu. They've -been removed because the changes have not kept pace with the rest of -Processing, and it was holding up the release of 2.0. As separate projects, +been removed because the changes have not kept pace with the rest of +Processing, and it was holding up the release of 2.0. As separate projects, we hope it'll be easier for volunteers to get involved, rather than our tiny, worn out development team. View the projects here: https://github.com/fjenett/javascript-mode-processing @@ -3392,13 +6344,13 @@ inside Processing. More documentation coming soon! We're hoping this is the last beta before 2.0, but we're still haggling with one or two issues that could require a beta 10. That's a lot of beta. -[ fixes ] +[ fixes ] + Major OutOfMemoryError problem with images fixed by Andres! http://code.google.com/p/processing/issues/detail?id=1353 https://github.com/processing/processing/issues/1391 -+ Lots of fixes for the library/mode/tool manager. ++ Lots of fixes for the library/mode/tool manager. Repairing colors, layout, etc. along with lots of internal fixes. + Fix MovieMaker, it was completely broken @@ -3407,7 +6359,7 @@ with one or two issues that could require a beta 10. That's a lot of beta. + processing-java dialog window was huge https://github.com/processing/processing/issues/1748 -+ Library with bad version number in version causes stack trace to print. ++ Library with bad version number in version causes stack trace to print. Added warning message about it with a pointer to the remedy. + "New version available" mesage is showing HTML tags around it @@ -3441,7 +6393,7 @@ with one or two issues that could require a beta 10. That's a lot of beta. + New images for modes. New design! -+ Added loadJSONArray(), loadJSONObject. ++ Added loadJSONArray(), loadJSONObject. + Hundreds of changes to the new data classes, sorting out their API, etc. @@ -3454,11 +6406,11 @@ with one or two issues that could require a beta 10. That's a lot of beta. + Change error message for libraries (especially serial) for 32- vs 64-bit to clarify that the 32- or 64-bit version of Processing can be used instead. -+ Rebuilt the internal Runner to use SocketAttach... This may bring up ++ Rebuilt the internal Runner to use SocketAttach... This may bring up a firewall message on some machines. Don't worry, it's safe (as long as the message is showing up when you hit Run, that's expected). -+ Add set(x, y) to PVector. ++ Add set(x, y) to PVector. + Removed div() and mult() from PVector, since not a legit math operation. https://code.google.com/p/processing/issues/detail?id=1506 @@ -3482,16 +6434,16 @@ with one or two issues that could require a beta 10. That's a lot of beta. only requires a JRE (and is therefore much smaller!) -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0b8 (REV 0216) - 24 February 2013 -Dead bugs on the windscreen as we head down the road to 2.0. +Dead bugs on the windscreen as we head down the road to 2.0. (The fact that we're still in bad metaphor territory suggests we're still a little ways off from 2.0 final.) -[ bugs fixed ] +[ bugs fixed ] + "Find in Reference" broken in 2.0b7 http://code.google.com/p/processing/issues/detail?id=1456 @@ -3513,7 +6465,7 @@ we're still a little ways off from 2.0 final.) + Color coding for if/else in Processing IDE doesn't match http://code.google.com/p/processing/issues/detail?id=1457 -+ Ignore ArrayIndexOutOfBoundsException in JEditTextArea.xToOffset() ++ Ignore ArrayIndexOutOfBoundsException in JEditTextArea.xToOffset() + Fix IllegalStateException on Windows/Linux in Save prompt happened when hitting ESC or otherwise closing the window @@ -3530,7 +6482,7 @@ we're still a little ways off from 2.0 final.) http://code.google.com/p/processing/issues/detail?id=1533 + Fix "Bounds out of range" when outdenting a block of text - Exception in thread "AWT-EventQueue-0" + Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Bounds out of range: 5374,5376 [5375] at processing.app.syntax.JEditTextArea.select(JEditTextArea.java:1214) at processing.app.Editor.handleIndentOutdent(Editor.java:1819) @@ -3545,7 +6497,7 @@ we're still a little ways off from 2.0 final.) + Fix table loading quirk with extensions -+ PImage.resize() greater than image size hangs ++ PImage.resize() greater than image size hangs http://code.google.com/p/processing/issues/detail?id=1463 + loadBytes() does not close input stream @@ -3562,11 +6514,11 @@ we're still a little ways off from 2.0 final.) [ improvements, updates, and changes ] -+ Add basic retina support (text/labels, buttons not yet updated) ++ Add basic retina support (text/labels, buttons not yet updated) to the Mac OS X version. + Clean up the code and interface for the Movie Maker tool - http://code.google.com/p/processing/issues/detail?id=836 + http://code.google.com/p/processing/issues/detail?id=836 + Suggest possible import statements for common Java classes http://code.google.com/p/processing/issues/detail?id=1550 @@ -3593,7 +6545,7 @@ we're still a little ways off from 2.0 final.) + Add clear() to replace background(0, 0, 0, 0) http://code.google.com/p/processing/issues/detail?id=1446 -+ Change heading2D() to just heading() ++ Change heading2D() to just heading() http://code.google.com/p/processing/issues/detail?id=987 + Remove hint(ENABLE_NATIVE_FONTS) @@ -3612,7 +6564,7 @@ we're still a little ways off from 2.0 final.) + Miscellaneous XML fixes and cleanups -[ tool/mode/library manager ] +[ tool/mode/library manager ] + General cleanup of the visuals/layout @@ -3635,7 +6587,7 @@ we're still a little ways off from 2.0 final.) https://github.com/processing/processing/issues/1425 http://code.google.com/p/processing/issues/detail?id=1387 -[ android ] +[ android ] + Update documentation and tools for Android SDK Tools revision 21 http://code.google.com/p/processing/issues/detail?id=1398 @@ -3650,7 +6602,7 @@ we're still a little ways off from 2.0 final.) + Remove mouseEvent and keyEvent variables (deprecated on desktop) -[ table ] +[ table ] + Added lastRowIndex() @@ -3671,7 +6623,7 @@ we're still a little ways off from 2.0 final.) + Added getColumnCount() to TableRow -[ andres assault ] +[ andres assault ] + P3D sketches failing to run http://code.google.com/p/processing/issues/detail?id=1500 @@ -3746,7 +6698,7 @@ we're still a little ways off from 2.0 final.) + P2D, P3D drawing errors in static mode, gray screen https://github.com/processing/processing/issues/1648 - Still seeing a few of these in some cases, but hopefully + Still seeing a few of these in some cases, but hopefully this is fixed for the most part. [ manindra magic ] @@ -3764,24 +6716,24 @@ we're still a little ways off from 2.0 final.) http://code.google.com/p/processing/issues/detail?id=1504 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0b7 (REV 0215) - 7 December 2012 -475,382 bug fixes in this release as we work on finalizing 2.0. +475,382 bug fixes in this release as we work on finalizing 2.0. -[ changes ] +[ changes ] -+ Removed all imports that aren't covered in the Processing reference. ++ Removed all imports that aren't covered in the Processing reference. If you use java.awt, java.util, or other classes in your sketch, you will need to add an import line to the beginning of your sketch. - Only the classes that are covered in the reference (HashMap, ArrayList, + Only the classes that are covered in the reference (HashMap, ArrayList, and some others) are now imported by default. This has been done to improve - overall cross-platform parity and to avoid users unknowingly adding + overall cross-platform parity and to avoid users unknowingly adding Java classes, and then the sadness that comes when switching to Android - or JavaScript modes. + or JavaScript modes. The list of imports is now hard-coded (no longer read from preferences.txt) and includes the following: @@ -3793,11 +6745,11 @@ PROCESSING 2.0b7 (REV 0215) - 7 December 2012 import java.io.OutputStream; import java.io.IOException; - If we're missing anything that's covered in the reference, please let us + If we're missing anything that's covered in the reference, please let us know via the bugs database. + A new "experimental" mode has been added. It's the start of combining two - of our Google Summer of Code projects (DebugMode and XQMode) to enable + of our Google Summer of Code projects (DebugMode and XQMode) to enable a debugger and on-the-fly error checking. We're including it in the release so that folks can test it out and let us know how it's doing. The interface still needs work and its innards may be a bit buggy, but it represents @@ -3819,16 +6771,16 @@ PROCESSING 2.0b7 (REV 0215) - 7 December 2012 http://code.google.com/p/processing/issues/detail?id=1354 http://guides.macrumors.com/Keyboard_shortcuts§ion=10#Text_Shortcuts -+ Set quality level higher when exporting JPEG images. This will result - in larger JPEG files with save() and saveFrame(), but the default quality - setting in the past was unacceptable for many/most projects. ++ Set quality level higher when exporting JPEG images. This will result + in larger JPEG files with save() and saveFrame(), but the default quality + setting in the past was unacceptable for many/most projects. http://code.google.com/p/processing/issues/detail?id=58 - See the bug report link for how to implement in case you want to set + See the bug report link for how to implement in case you want to set the quality lower (or even higher) than the new default. + Table row iterating syntax has changed. This code: for (TableRow row : table) { ... } - has now changed to + has now changed to for (TableRow row : table.getRows()) { ... } (This may change to rows() on the next round, pending other API tweaks) @@ -3869,10 +6821,10 @@ PROCESSING 2.0b7 (REV 0215) - 7 December 2012 + Change output from processing-java to be UTF-8 encoded. http://code.google.com/p/processing/issues/detail?id=1418 -+ Disable Quartz renderer to fix line blending problem on OS X. ++ Disable Quartz renderer to fix line blending problem on OS X. This older renderer was faster but had some bugs, like one that - caused lines to composite incorrectly when alpha was used. - Add "PApplet.useQuartz = true;" into your PApplet.main() + caused lines to composite incorrectly when alpha was used. + Add "PApplet.useQuartz = true;" into your PApplet.main() function to switch back to the old method: http://processing.googlecode.com/svn/trunk/processing/build/javadoc/core/processing/core/PApplet.html#useQuartz @@ -3880,7 +6832,7 @@ PROCESSING 2.0b7 (REV 0215) - 7 December 2012 http://code.google.com/p/processing/issues/detail?id=613 -[ bug fixes ] +[ bug fixes ] + mouseButton not being set properly in mouseClicked. http://code.google.com/p/processing/issues/detail?id=1350 @@ -3891,17 +6843,17 @@ PROCESSING 2.0b7 (REV 0215) - 7 December 2012 + mousePressed() coloring now different from mousePressed http://code.google.com/p/processing/issues/detail?id=41 Still not necessarily perfect, but it's a big improvement. - Note for people implementing their own Modes: FUNCTION1 and + Note for people implementing their own Modes: FUNCTION1 and FUNCTION2 have now been added for functions with parens. + 32-bit mode / 64-bit mode preference was ignored on OS X. http://code.google.com/p/processing/issues/detail?id=1426 -+ Prevent errors on first line of a new tab from highlighting the last - line of the previous tab. In particular, a single letter on a new tab ++ Prevent errors on first line of a new tab from highlighting the last + line of the previous tab. In particular, a single letter on a new tab was highlighting the last line of the tab to its left. -+ Android debug information wasn't being passed through to the console. ++ Android debug information wasn't being passed through to the console. In addition, on Windows, error reporting wasn't working properly (couldn't find the right line or report the error correctly). http://code.google.com/p/processing/issues/detail?id=1440 @@ -3914,7 +6866,7 @@ PROCESSING 2.0b7 (REV 0215) - 7 December 2012 + P2D/P3D PGraphics buffer failing to draw if larger than main surface. http://code.google.com/p/processing/issues/detail?id=1255 -+ Fix double error report when textMode(SCREEN) was used: ++ Fix double error report when textMode(SCREEN) was used: textMode(SCREEN) has been removed from Processing 2.0. textMode(256) is not supported by this renderer. @@ -4007,7 +6959,7 @@ PROCESSING 2.0b7 (REV 0215) - 7 December 2012 + Using a PGraphics as a texture produces visual artifacts. http://code.google.com/p/processing/issues/detail?id=1420 -[ android ] +[ android ] + Like the desktop release, removed default imports. This includes: android.view.MotionEvent, android.view.KeyEvent,android.graphics.Bitmap @@ -4015,17 +6967,17 @@ PROCESSING 2.0b7 (REV 0215) - 7 December 2012 cross-platform compatibility between Java, JavaScript, and Android modes. + Changed event handling to hopefully clean up some inconsistencies. - Removed motionX/Y/Pressure... these need to be handled separately. + Removed motionX/Y/Pressure... these need to be handled separately. More here: http://wiki.processing.org/w/Android -+ mouseX/Y no longer include history with moves, which reduces fidelity ++ mouseX/Y no longer include history with moves, which reduces fidelity a bit, but will hopefully prevent us overdoing it for future releases. + Fix how pmouseX/Y are set. http://code.google.com/p/processing/issues/detail?id=238 http://code.google.com/p/processing/issues/detail?id=1018 -[ fixed earlier / cleaning ] +[ fixed earlier / cleaning ] + When turning smoothing on, internal lines of shapes are visible. http://code.google.com/p/processing/issues/detail?id=53 @@ -4094,15 +7046,15 @@ PROCESSING 2.0b7 (REV 0215) - 7 December 2012 http://code.google.com/p/processing/issues/detail?id=929 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0b6 (REV 0214) - 2 November 2012 -Patching up command line issues that went backwards in the last release, -a number of OpenGL fixes, and more internal changes and updates. +Patching up command line issues that went backwards in the last release, +a number of OpenGL fixes, and more internal changes and updates. -[ bug fixes ] +[ bug fixes ] + Command line support was broken in 2.0b5, with an error about processing-java ClassNotFoundException: BatchCompiler @@ -4116,31 +7068,31 @@ a number of OpenGL fixes, and more internal changes and updates. http://code.google.com/p/processing/issues/detail?id=911 + Editor not responding properly if the "External Editor" preference - had been enabled with a previous release. + had been enabled with a previous release. http://code.google.com/p/processing/issues/detail?id=1355 + A number of OpenGL fixes to better handle older chipsets, like the - GMA 950 (found on lots of older Mac Minis and similar hardware). + GMA 950 (found on lots of older Mac Minis and similar hardware). + Reverted back to an older version of the JOGL library to prevent - issues with sketches locking up. In particular, this should fix - sketches that use the video library: + issues with sketches locking up. In particular, this should fix + sketches that use the video library: http://code.google.com/p/processing/issues/detail?id=1338 http://code.google.com/p/processing/issues/detail?id=1364 + Icon loading was causing an error if you used a package for your code. http://code.google.com/p/processing/issues/detail?id=1346 -+ No longer using --request on OS X 10.6, since it's not available. ++ No longer using --request on OS X 10.6, since it's not available. Avoids a harmless warning message on the console when running a sketch. -[ changes/additions ] +[ changes/additions ] + Added an option to Preferences to enable/disable advanced input method support to handle complex scripts like Japanese, Korean, or Chinese. http://code.google.com/p/processing/issues/detail?id=526 -+ Add option for blinking and/or block caret in the editor. To disable ++ Add option for blinking and/or block caret in the editor. To disable caret blinking in the text editor, add this line to preferences.txt: editor.caret.blink = true Or to just a block caret, use this: @@ -4149,7 +7101,7 @@ a number of OpenGL fixes, and more internal changes and updates. [ internal ] -+ Removed applet-related preferences, and the 'applet' subfolder in the ++ Removed applet-related preferences, and the 'applet' subfolder in the source/distribution. + Removed the old 'cmd' folder from the source/distribution @@ -4157,11 +7109,11 @@ a number of OpenGL fixes, and more internal changes and updates. + Preferences are now written in sorted order to make it easier to handle comparisons or other debugging. -+ Major change to handle how the 'lib' folder is found, hopefully does a ++ Major change to handle how the 'lib' folder is found, hopefully does a better job with command line support. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0b5 (REV 0213) - 22 October 2012 @@ -4169,7 +7121,7 @@ PROCESSING 2.0b5 (REV 0213) - 22 October 2012 Fixes for a few regressions that showed up in 2.0b4, plus some internal changes to simplify how modes are handled. -[ bug fixes ] +[ bug fixes ] + Libraries not installed through IDE had blank names. http://code.google.com/p/processing/issues/detail?id=1331 @@ -4180,17 +7132,17 @@ changes to simplify how modes are handled. + Console disappearing with increased editor font size. http://code.google.com/p/processing/issues/detail?id=1275 -[ changes/internal ] +[ changes/internal ] + Change how modes are set up so that XQMode, our Google Summer of Code project can work properly. -+ Implement multiple sizes of icons for PDE and core. This improves ++ Implement multiple sizes of icons for PDE and core. This improves the quality of the icon seen on Windows and Linux attached to frames. http://code.google.com/p/processing/issues/detail?id=632 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0b4 (REV 0212) - 21 October 2012 @@ -4198,11 +7150,11 @@ PROCESSING 2.0b4 (REV 0212) - 21 October 2012 Command line support is back! Find and Replace works over multiple tabs! The Mac OS X version should work again in spite of Apple's best efforts! -[ additions & removals ] +[ additions & removals ] -+ Command line support is now available for Java mode. On Windows and Linux, - use the processing-java program. On Mac OS X, there's an option in the - Tools menu to install the command line tool. ++ Command line support is now available for Java mode. On Windows and Linux, + use the processing-java program. On Mac OS X, there's an option in the + Tools menu to install the command line tool. http://code.google.com/p/processing/issues/detail?id=142 Build and export options should even work in headless mode when enabled @@ -4212,21 +7164,21 @@ The Mac OS X version should work again in spite of Apple's best efforts! Android and JavaScript mode are not supported, contributions are welcome: http://code.google.com/p/processing/issues/detail?id=1323 -+ Added a Tool for Mac OS X to help set up serial port. Using serial on ++ Added a Tool for Mac OS X to help set up serial port. Using serial on OS X requires some incantations on the command line, and this prompts for an administrator password and takes care of them for you. The commands - involve creating a folder and setting a few permissions. If everything + involve creating a folder and setting a few permissions. If everything is already set properly, the Tool will not be present in the Tools menu. + With the arrival of command line support, the misunderstood and sometimes - maligned "Use External Editor" option has been removed. + maligned "Use External Editor" option has been removed. http://code.google.com/p/processing/issues/detail?id=515 + Fix several problems introduced by Apple's recent Java "update". Apple's most recent Java update may render older versions of Processing - completely unusable, it's not quite clear yet. + completely unusable, it's not quite clear yet. -[ bug fixes ] +[ bug fixes ] + Fix the exceptionally slow startup (a 5 second delay) in recent releases. @@ -4248,30 +7200,30 @@ The Mac OS X version should work again in spite of Apple's best efforts! + mouseButton wasn't getting set on mouseReleased() http://code.google.com/p/processing/issues/detail?id=1294 -[ technical updates ] +[ technical updates ] + JOGL has been updated, which may help iron out some GL quirks. + Change all build.xml files to use Java 6 as both source and target (avoids Java 7 warnings during build). -+ Updated ecj.jar to use jdt-core.jar... This is a larger file but were ++ Updated ecj.jar to use jdt-core.jar... This is a larger file but were hoping that this would get our GSoC project "XQMode" working without the need for patches. Sadly that's not the case, but stay tuned. -[ known issues ] +[ known issues ] + Fewer exclamation points will be used to introduce future releases. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0b3 (REV 0211) - 10 September 2012 Shaking out the beta bugs. -[ major fixes ] +[ major fixes ] + registerMethod("keyEvent", ...) not calling key event methods. http://code.google.com/p/processing/issues/detail?id=1225 @@ -4281,13 +7233,13 @@ Shaking out the beta bugs. http://code.google.com/p/processing/issues/detail?id=1226 + Restore deprecated versions of getFont() and getImage() to address - library compatibility issues. The similar getBitmap() and getTypeface() + library compatibility issues. The similar getBitmap() and getTypeface() methods on Android will not be restored. http://code.google.com/p/processing/issues/detail?id=1223 -[ minor fixes ] +[ minor fixes ] -+ Changing the default display in Preferences does not reset editor ++ Changing the default display in Preferences does not reset editor location, so it appears to have no effect. http://code.google.com/p/processing/issues/detail?id=1162 @@ -4296,7 +7248,7 @@ Shaking out the beta bugs. + Make Mode menu into a radio button, so it cannot be de-selected http://code.google.com/p/processing/issues/detail?id=1227 -[ changes and additions ] +[ changes and additions ] + Show error message when using createGraphics() with P2D, P3D, or OPENGL and the main drawing surface is not an OpenGL renderer. @@ -4313,19 +7265,19 @@ Shaking out the beta bugs. Fingers crossed that these don't give us last-minute regressions. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0b2 (REV 0210) - 7 September 2012 -One major fix for libraries that use key events, and a number of minor -fixes that we've found along the way. +One major fix for libraries that use key events, and a number of minor +fixes that we've found along the way. -[ fixes and updates ] +[ fixes and updates ] + Libraries with using key events were reporting: "java.lang.IllegalArgumentException: argument type mismatch" - in beta 1, this is now fixed. + in beta 1, this is now fixed. + Added hint(ENABLE_STROKE_PURE) to deal with Java 2D regression. http://code.google.com/p/processing/issues/detail?id=1137 @@ -4333,13 +7285,13 @@ fixes that we've found along the way. + Fix for stroke with beginShape(TRIANGLE_FAN) http://code.google.com/p/processing/issues/detail?id=1137 -+ hint() documentation now updated (except for the hint above). ++ hint() documentation now updated (except for the hint above). http://code.google.com/p/processing/issues/detail?id=1144 + Using ortho() breaks stroke rendering http://code.google.com/p/processing/issues/detail?id=1207 -[ fixed earlier ] +[ fixed earlier ] + POINTS mode vertices are huge http://code.google.com/p/processing/issues/detail?id=1037 @@ -4347,7 +7299,7 @@ fixes that we've found along the way. + Potentially insufficient ellipse detail with P3D/OPENGL when scaled http://code.google.com/p/processing/issues/detail?id=87 -+ Implement support for complex shapes when using the OpenGL renderer ++ Implement support for complex shapes when using the OpenGL renderer http://code.google.com/p/processing/issues/detail?id=122 + modelX/Y/Z broken when aiming a camera @@ -4362,18 +7314,18 @@ fixes that we've found along the way. + Memory improvements for updatePixels() with OpenGL (P2D and P3D) http://code.google.com/p/processing/issues/detail?id=77 -+ Text characters showing up as opaque rectangles ++ Text characters showing up as opaque rectangles http://code.google.com/p/processing/issues/detail?id=80 + Changing framerate causes program to crash with P2D in 2.0a6 http://code.google.com/p/processing/issues/detail?id=1116 -[ android ] +[ android ] + Updated examples from Andres and categories in the examples browser. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0b1 (REV 0209) - 3 September 2012 @@ -4381,16 +7333,16 @@ PROCESSING 2.0b1 (REV 0209) - 3 September 2012 Bug fixes, new registered methods for libraries, updated keywords, and we're beta! -[ changes ] +[ changes ] -+ Require 10.6.8 as minimum Mac OS X system version. ++ Require 10.6.8 as minimum Mac OS X system version. + Change name from "Standard" to "Java" mode. + Save opened/closed state of entries in the examples browser http://code.google.com/p/processing/issues/detail?id=827 -+ Lots of internal changes to loadShape() and PShape. ++ Lots of internal changes to loadShape() and PShape. + Work on making API more generic and consistent for cross-platform use. Font PFont.getFont() -> Object PFont.getNative() @@ -4398,15 +7350,15 @@ and we're beta! Image PImage.getImage() -> Object PImage.getNative() Bitmap PImage.getBitmap() -> Object PImage.getNative() -+ beginGL() and endGL() are gone, and beginPGL() and endPGL() exist - in their place. The PGL class is a layer that lets us talk to ++ beginGL() and endGL() are gone, and beginPGL() and endPGL() exist + in their place. The PGL class is a layer that lets us talk to OpenGL in a way that's cross-platform and consistent. It also has many GL calls for people who want to access GL directly. -+ New syntax introduced for libraries and registered methods. ++ New syntax introduced for libraries and registered methods. Documentation coming soon. -[ bug fixes ] +[ bug fixes ] + Handle dimming the Find/Replace buttons. http://code.google.com/p/processing/issues/detail?id=1056 @@ -4427,33 +7379,33 @@ and we're beta! + GL Android sketches halting after rotation. http://code.google.com/p/processing/issues/detail?id=1146 -[ known issues ] +[ known issues ] + createShape() is not implemented with the default 2D renderer. -+ See the Changes page on the Wiki for more. ++ See the Changes page on the Wiki for more. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0a9 (REV 0208) - 1 September 2012 -As we inch closer to beta, a quick release for testing. +As we inch closer to beta, a quick release for testing. Plenty of video and OpenGL graphics fixes from Andres, and some functions -disappearing due to cleanups by Ben. (Andres giveth, Ben taketh away). +disappearing due to cleanups by Ben. (Andres giveth, Ben taketh away). -Consider this one to be 'nightly build' quality. +Consider this one to be 'nightly build' quality. -[ general ] +[ general ] + Help menu broken when Processing has spaces in its path name in 2.0a8 http://code.google.com/p/processing/issues/detail?id=1164 + We now have repeating textures. Use textureWrap(CLAMP) (the usual version) or textureWrap(REPEAT). If this feature is used for evil - and cheesiness, it will be removed in future releases. + and cheesiness, it will be removed in future releases. http://code.google.com/p/processing/issues/detail?id=94 + Fix lights in GL renderers on low-end android devices. @@ -4462,7 +7414,7 @@ Consider this one to be 'nightly build' quality. + Pixels for createGraphics() now transparent for P2D, P3D. http://code.google.com/p/processing/issues/detail?id=1156 -[ video ] +[ video ] + GettingStartedCapture in 2.0a8 launches X11 in Mountain Lion http://code.google.com/p/processing/issues/detail?id=1191 @@ -4485,7 +7437,7 @@ Consider this one to be 'nightly build' quality. + Wrong resolutions reported by Capture.list() http://code.google.com/p/processing/issues/detail?id=1192 -[ advanced ] +[ advanced ] + Several constants moved out of PConstants and into PGraphics. @@ -4496,16 +7448,16 @@ Consider this one to be 'nightly build' quality. + Removed several video functions that weren't approved. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0a8 (REV 0207) - 5 August 2012 -A handful of bug fixes. Not as large a release as 2.0a7, but I decided +A handful of bug fixes. Not as large a release as 2.0a7, but I decided it best to get the updates out there and in use rather than waiting for -beta 1 since I'm not sure when we'll be able to get that out. +beta 1 since I'm not sure when we'll be able to get that out. -[ miscellaneous ] +[ miscellaneous ] + Make sure smooth() is the default with both renderers http://code.google.com/p/processing/issues/detail?id=1157 @@ -4527,10 +7479,10 @@ beta 1 since I'm not sure when we'll be able to get that out. + Added 'empty sketchbook' indicator when the sketchbook menus are empty -+ Prevent users from deleting the last tab on the only sketch that is - currently open on Windows and Linux. ++ Prevent users from deleting the last tab on the only sketch that is + currently open on Windows and Linux. -[ serial ] +[ serial ] + Added 64-bit RXTX for Mac OS X serial from this page: http://blog.iharder.net/2009/08/18/rxtx-java-6-and-librxtxserial-jnilib-on-intel-mac-os-x/ @@ -4542,7 +7494,7 @@ beta 1 since I'm not sure when we'll be able to get that out. + bufferUntil() with values above 127 do not work properly http://code.google.com/p/processing/issues/detail?id=1079 -[ plumbing ] +[ plumbing ] + Switch to using java.awt.Desktop classes for opening folders, links, etc. @@ -4557,31 +7509,31 @@ beta 1 since I'm not sure when we'll be able to get that out. + Added notes about "color(0, 0, 0, 0) produces black" to the Wiki. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0a7 (REV 0206) - 29 July 2012 -Hopefully the last alpha before we hit 2.0 beta. +Hopefully the last alpha before we hit 2.0 beta. The big change is that we're dropping support for applets in 2.0, and in this release. See the Changes section of the Wiki for details. We've not updated all of the documentation to reflect this yet. -OS X 10.8 Mountain Lion support has also been added, by virtue of our +OS X 10.8 Mountain Lion support has also been added, by virtue of our paying $99/year for the privilege of releasing our free and open source application on OS X. When run on 10.8, versions prior to 2.0a7 would report -that they were corrupt, invalid, or not trusted. Which is definitely us. +that they were corrupt, invalid, or not trusted. Which is definitely us. -[ editor ] +[ editor ] -+ Implemented a "Recent Sketches" menu. This replaces re-opening - sketches on startup, which behaved inconsistently anyway. ++ Implemented a "Recent Sketches" menu. This replaces re-opening + sketches on startup, which behaved inconsistently anyway. http://code.google.com/p/processing/issues/detail?id=188 + Use Swing file choosers by default on Linux. The default open/save - dialogs provided by Java are pretty gruesome, so we're switching to - the Swing JFileChooser instead. To swap the behavior, set + dialogs provided by Java are pretty gruesome, so we're switching to + the Swing JFileChooser instead. To swap the behavior, set 'chooser.files.native' in your preferences.txt file. + Suppress "invalid context 0x0" and "invalid drawable" because they're @@ -4597,13 +7549,13 @@ that they were corrupt, invalid, or not trusted. Which is definitely us. updates for 32/64-bit support in general. http://code.google.com/p/processing/issues/detail?id=955 -+ Replace processing.exe with a more standard version from launch4j, ++ Replace processing.exe with a more standard version from launch4j, which should hopefully clean up some launcher issues. http://code.google.com/p/processing/issues/detail?id=943 http://code.google.com/p/processing/issues/detail?id=176 + Change how sketches open so that there's no longer differences between - the File menu 'Open' and the way it worked from the toolbar. Simplifies + the File menu 'Open' and the way it worked from the toolbar. Simplifies additional code that was quirky. http://code.google.com/p/processing/issues/detail?id=1034 @@ -4615,18 +7567,18 @@ that they were corrupt, invalid, or not trusted. Which is definitely us. + Instead of prompting for sketchbook location on Linux, just default to a folder named 'sketchbook' in the user's home directory. This can easily - be changed later but simplifies things internally a bit. + be changed later but simplifies things internally a bit. -+ No longer allow underscore at beginning of sketch name (causes problems ++ No longer allow underscore at beginning of sketch name (causes problems with Android, and also with applets, though we care less about those...) http://code.google.com/p/processing/issues/detail?id=1047 -+ Fixed a problem where sanitized names (underscores replacing unusable ++ Fixed a problem where sanitized names (underscores replacing unusable characters) could potentially overwrite existing folders. -[ core ] +[ core ] -+ Major changes to selectInput(), selectOutput(), and selectFolder(). ++ Major changes to selectInput(), selectOutput(), and selectFolder(). See the Wiki: http://wiki.processing.org/w/Changes#Change_and_Removed The changes are there to prevent a threading bug: http://code.google.com/p/processing/issues/detail?id=173 @@ -4635,9 +7587,9 @@ that they were corrupt, invalid, or not trusted. Which is definitely us. http://code.google.com/p/processing/issues/detail?id=233 + Change 'appletViewer' back to 'online'. Still deprecated, especially - because applets are going away. + because applets are going away. -+ Add begin/endGL added to PGraphics/PApplet. ++ Add begin/endGL added to PGraphics/PApplet. + Add hasChildren() to XML library. http://code.google.com/p/processing/issues/detail?id=1045 @@ -4645,8 +7597,8 @@ that they were corrupt, invalid, or not trusted. Which is definitely us. + Fix where displayWidth/Height not being set properly before setup() http://code.google.com/p/processing/issues/detail?id=1120 -+ XML now throws exceptions in its constructor (for advanced users). - Use loadXML() instead of "new XML(this, ....)" ++ XML now throws exceptions in its constructor (for advanced users). + Use loadXML() instead of "new XML(this, ....)" http://code.google.com/p/processing/issues/detail?id=1138 + loadXML() returns null when the file did not open properly @@ -4656,11 +7608,11 @@ that they were corrupt, invalid, or not trusted. Which is definitely us. http://code.google.com/p/processing/issues/detail?id=1143 + Add some extra options for PApplet.main() for advanced users: - PApplet.main("SketchName") and PApplet.main("SketchName", args) + PApplet.main("SketchName") and PApplet.main("SketchName", args) -[ android ] +[ android ] -+ Add full PAppletMethods implementation to Android, so that PGraphics ++ Add full PAppletMethods implementation to Android, so that PGraphics and PImage methods are brought into PApplet. + Swap Run on Device and Run on Emulator @@ -4673,7 +7625,7 @@ that they were corrupt, invalid, or not trusted. Which is definitely us. http://code.google.com/p/processing/issues/detail?id=1054 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0a6 (REV 0205) - 1 June 2012 @@ -4690,9 +7642,9 @@ http://wiki.processing.org/w/Changes + Added an option for selecting the default display inside Preferences. -+ P2D and P3D are now variations of the OpenGL renderer. ++ P2D and P3D are now variations of the OpenGL renderer. -+ XML and Table are now part of the processing.data.* package. ++ XML and Table are now part of the processing.data.* package. There's also new loadTable() and loadXML() methods in PApplet. [ bug fixes ] @@ -4718,7 +7670,7 @@ http://wiki.processing.org/w/Changes + When internal tools crash, don't add them to the menu (prevents the PDE from locking up on startup). -[ fixed earlier ] +[ fixed earlier ] + Export reports "Could not copy source file" (even though it works) http://code.google.com/p/processing/issues/detail?id=638 @@ -4751,19 +7703,19 @@ http://wiki.processing.org/w/Changes + Make displayWidth/Height work properly with multiple screen. (In the past, screen.width and screen.height just returned the default - display size, not necessarily the display being used.) + display size, not necessarily the display being used.) + Built in Hansi's full screen API for OS X, so that sketches can use full screen without exclusive mode. See the Wiki for details. http://wiki.processing.org/w/Window_Size_and_Full_Screen -+ Now attempts detect when a sketch's size is the full screen, ++ Now attempts detect when a sketch's size is the full screen, and if so removes the frame border, etc. + --display option now works properly (on OS X and elsewhere) http://code.google.com/p/processing/issues/detail?id=71 -[ OpenGL by Andres ] +[ OpenGL by Andres ] + polygon shapes without fill slowdown render progressively http://code.google.com/p/processing/issues/detail?id=1028 @@ -4798,11 +7750,11 @@ http://wiki.processing.org/w/Changes + OpenGL noSmooth() does not work http://code.google.com/p/processing/issues/detail?id=328 -[ android ] +[ android ] + Android SDK Tools revision 19 (later may work too) are required. -+ Android mode no longer broken on Windows. Google has fixed the bug, ++ Android mode no longer broken on Windows. Google has fixed the bug, but you'll need to use the latest SDK. http://code.google.com/p/processing/issues/detail?id=1022 @@ -4819,32 +7771,32 @@ http://wiki.processing.org/w/Changes http://code.google.com/p/processing/issues/detail?id=751 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0a5 (REV 0204) - 23 March 2012 Major updates in this release include a huge revamp of the OpenGL library -by Andres, fixes to get Android Mode working again, and a number of bug +by Andres, fixes to get Android Mode working again, and a number of bug fixes and additions as we head toward 2.0. Unfortunately, however, Android mode is still broken on Windows. http://code.google.com/p/processing/issues/detail?id=1022 -On the OpenGL front, we're working to have a single library that works -across both desktop and mobile, which is good news because it means we have -a fighting chance of making it work (rather than maintaining two entire sets -of a very complicated set of code), but the downside is that it requires -newer versions of OpenGL on both the desktop and mobile, so it may cause -problems with old OSes, mediocre graphics drivers, etc that worked with +On the OpenGL front, we're working to have a single library that works +across both desktop and mobile, which is good news because it means we have +a fighting chance of making it work (rather than maintaining two entire sets +of a very complicated set of code), but the downside is that it requires +newer versions of OpenGL on both the desktop and mobile, so it may cause +problems with old OSes, mediocre graphics drivers, etc that worked with earlier releases. -[ bug fixes ] +[ bug fixes ] + OpenGL applets are working again. http://code.google.com/p/processing/issues/detail?id=845 -+ Abnormal high Java CPU usage at empty sketch with draw() ++ Abnormal high Java CPU usage at empty sketch with draw() http://code.google.com/p/processing/issues/detail?id=729 + "Framingham" example has BufferOverflowException @@ -4856,7 +7808,7 @@ earlier releases. + Doc comments not being properly terminated in export of applet http://code.google.com/p/processing/issues/detail?id=877 -+ Tweaks to the code to prevent multiple copies of Processing from ++ Tweaks to the code to prevent multiple copies of Processing from running at once. + Fix bug with 'base' not getting set in the Mac OS X platform class. @@ -4875,7 +7827,7 @@ earlier releases. + Several bug fixes inside Table as they relate to inserting/adding columns. -[ changes/additions ] +[ changes/additions ] + Enable smooth() by default. @@ -4886,7 +7838,7 @@ earlier releases. + Update to Java 6u29 for Linux and Windows (OS X now updated). -+ Don't show library conflict warning until someone tries to build ++ Don't show library conflict warning until someone tries to build with code that actually calls on one of those packages. + urlEncode() and urlDecode() added (docs coming later). @@ -4894,9 +7846,9 @@ earlier releases. + delay() is back again. F*king delay(). + Added anti-alias methods so that FSAA can set up properly. The API for - these is not set yet. + these is not set yet. -[ in earlier releases ] +[ in earlier releases ] + Commenting via menu or shortcut does not set sketch to "need save". http://code.google.com/p/processing/issues/detail?id=860 @@ -4914,7 +7866,7 @@ earlier releases. + Closing applet window in Processing 1.5 causes serial crash. http://code.google.com/p/processing/issues/detail?id=635 -[ javascript ] +[ javascript ] + Finalize JavaScript mode export folder name. http://code.google.com/p/processing/issues/detail?id=848 @@ -4923,7 +7875,7 @@ earlier releases. http://code.google.com/p/processing/issues/detail?id=936 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0a4 (REV 0203) - 10 November 2011 @@ -4931,7 +7883,7 @@ PROCESSING 2.0a4 (REV 0203) - 10 November 2011 This is just a quick release so that I can procrastinate on packing for Chicago a little longer. A handful of bug fixes here: -+ Video capture was broken in 2.0a3 on OS X due to an issue with the build ++ Video capture was broken in 2.0a3 on OS X due to an issue with the build process. Should be all set now. + Fixed incessant "inefficient font rendering" debug message on Android. @@ -4944,7 +7896,7 @@ Chicago a little longer. A handful of bug fixes here: messages when natives aren't available for the platform--just an UnsatisfiedLinkError when you try to run. Will fix.) -[ andres' bug victims ] +[ andres' bug victims ] + Multiple calls to curve() connect subsequent curves with lines in P3D/OPENGL http://code.google.com/p/processing/issues/detail?id=865 @@ -4953,18 +7905,18 @@ Chicago a little longer. A handful of bug fixes here: http://code.google.com/p/processing/issues/detail?id=890 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0a3 (REV 0202) - 5 November 2011 Some weekend bug fixing and regression repair for the recent alpha releases. -Also several Android fixes to get things working again with more recent -updates from Google. You'll need to upgrade to this version of Processing +Also several Android fixes to get things working again with more recent +updates from Google. You'll need to upgrade to this version of Processing in order to continue using Android mode. -[ environment ] +[ environment ] + Fix problem with serial not loading on Mac OS X. @@ -4982,14 +7934,14 @@ in order to continue using Android mode. + IDE Export Application button exports applet (fixed in 2.0a2) http://code.google.com/p/processing/issues/detail?id=863 -[ core ] +[ core ] + Fix for video frames not showing up in 3D. + Rounded rect() does not have a maximum length for corner radius http://code.google.com/p/processing/issues/detail?id=813 -[ android ] +[ android ] + Fix libraries when used with Android. Libraries can also specify an Android version by including an 'android' subfolder. @@ -5013,7 +7965,7 @@ in order to continue using Android mode. http://code.google.com/p/processing/issues/detail?id=864 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0a2 (REV 0201) - 31 October 2011 @@ -5021,12 +7973,12 @@ PROCESSING 2.0a2 (REV 0201) - 31 October 2011 Happy Halloween! I'll be dressing up as an ArrayIndexOutOfBoundsException. This release is primarily focused on the new video library and making it -usable across platforms. It also has some changes for how applications +usable across platforms. It also has some changes for how applications are exported, and a number of other bug fixes and tweaks. -[ platforms ] +[ platforms ] -+ With this release, Java 1.6 is now required. We will no longer be ++ With this release, Java 1.6 is now required. We will no longer be supporting Java 1.5. + In perhaps related news, we are no longer supporting Mac OS X 10.5. @@ -5039,21 +7991,21 @@ are exported, and a number of other bug fixes and tweaks. 64-bit. Library support has changed significantly to get things working, more on this coming soon. -+ Serial on Mac OS X and Windows is currently only available for 32-bit. - Hoping someone can help us support a 64-bit version sometime soon. ++ Serial on Mac OS X and Windows is currently only available for 32-bit. + Hoping someone can help us support a 64-bit version sometime soon. + When exporting a 64-bit application for Windows, a .bat file is created, because our .exe doesn't yet support 64-bit. Assuming you have a 64-bit JVM installed, the .bat file should load things properly. -+ Because serial only supports 32-bit on OS X, exporting an application - that uses serial will only create a application.macosx32 folder, which - is a 32-bit app for Mac OS X. No application.macosx64 will be created, - nor will a universal application.macosx folder. This is also the case ++ Because serial only supports 32-bit on OS X, exporting an application + that uses serial will only create a application.macosx32 folder, which + is a 32-bit app for Mac OS X. No application.macosx64 will be created, + nor will a universal application.macosx folder. This is also the case for other libraries that have only 32- or 64-bit support. See earlier note that 32- and 64-bit support is an f*ing nightmare. -[ video ] +[ video ] + The most significant change in this release is that the new video library from Andres (based on his old gsvideo library) is nearing fully fucntional. @@ -5064,10 +8016,10 @@ are exported, and a number of other bug fixes and tweaks. [ other changes ] -+ Application is now the default export (instead of Applet). ++ Application is now the default export (instead of Applet). + Change to how dataPath() and dataFile() work. This is an undocumented - function, but for those using it, here's the skinny: + function, but for those using it, here's the skinny: dataPath() is only available with applications, not applets or Android. On Windows and Linux, this is simply the data folder, which is located @@ -5082,26 +8034,26 @@ are exported, and a number of other bug fixes and tweaks. works with an applet, you should use other methods such as createInput(), createReader(), or loadStrings(). -+ Additional library files included with application exports are now placed ++ Additional library files included with application exports are now placed in the 'lib' folder on Linux and Windows, or buried inside the OS X app. This helps prevent the unsightly mess of DLLs that were crowding the root folder of exported applications on Windows and Linux. -+ If noLoop() has been called but a sketch is resized, redraw() will be ++ If noLoop() has been called but a sketch is resized, redraw() will be called to update the screen. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 2.0a1 (REV 0200) - 2 September 2011 -First alpha release as we head toward 2.0. Please read the changes page +First alpha release as we head toward 2.0. Please read the changes page to learn about what's different: http://wiki.processing.org/w/Changes -[ since we last spoke ] +[ since we last spoke ] -+ Lots of video work from Andres. ++ Lots of video work from Andres. + Updated to Java 6u26 on Windows and Linux. @@ -5120,16 +8072,16 @@ to learn about what's different: http://wiki.processing.org/w/Changes + PImage.save() with full path raises exception http://code.google.com/p/processing/issues/detail?id=808 -+ Fix problem where loading data from an http:// stream would - run out of memory on Android. ++ Fix problem where loading data from an http:// stream would + run out of memory on Android. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0199 - 27 June 2011 -Handful of bug fixes, primarly to deal with issues introduced in 0198. +Handful of bug fixes, primarly to deal with issues introduced in 0198. + Remove error messages for UpdateCheck w/o internet connection. @@ -5145,15 +8097,15 @@ Handful of bug fixes, primarly to deal with issues introduced in 0198. + Fix broken loadNode() and XML usage in general. + Fix problem with save() writing multiple image files with an extra .tif - at the end. + at the end. + Added no-op orientation() method to the desktop version so that code will work unchanged between Android and desktop. -+ Add warning for missing glyphs in PFont. ++ Add warning for missing glyphs in PFont. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0198 - 23 June 2011 @@ -5164,15 +8116,15 @@ covered on the changes page in the Wiki: http://wiki.processing.org/w/Changes This is an interim release so that Andres can do a workshop. Not recommended for casual use. Hostile or belligerent whiners need not apply. -Android mode has received zero testing, so XML, SVG, 3D, and other major +Android mode has received zero testing, so XML, SVG, 3D, and other major features may be broken. See statement directly above. -[ bugs fixed ] +[ bugs fixed ] + Examples window placed off-screen when PDE window is maximized http://code.google.com/p/processing/issues/detail?id=669 -+ Make examples window respond to ESC, and double-click events to ++ Make examples window respond to ESC, and double-click events to expand/collapse nodes. + Launch script for Linux fails to open a sketches with relative paths @@ -5190,7 +8142,7 @@ features may be broken. See statement directly above. + Make sketch.properties usable elsewhere by loading/reloading http://code.google.com/p/processing/issues/detail?id=722 -+ Export to Application reports "Could not copy source file:" ++ Export to Application reports "Could not copy source file:" http://code.google.com/p/processing/issues/detail?id=638 + Automatically insert the 'import processing.opengl' when P3D used. @@ -5214,10 +8166,10 @@ features may be broken. See statement directly above. + Removed the delay() method. It was awful. -+ Addded thread() method that takes a function name as a parameter, ++ Addded thread() method that takes a function name as a parameter, and runs it on its own thread. No more classes! -+ PImage.save() returns a success boolean (rather than throwing an ++ PImage.save() returns a success boolean (rather than throwing an exception when it fails). [ core bugs fixed ] @@ -5228,7 +8180,7 @@ features may be broken. See statement directly above. + problem with destroy() calling System.exit() http://code.google.com/p/processing/issues/detail?id=698 -+ post() is called after setup() ++ post() is called after setup() http://code.google.com/p/processing/issues/detail?id=455 + Remove auto-sizing from binary() (was inconsistent with hex() method). @@ -5285,19 +8237,19 @@ features may be broken. See statement directly above. + removed A2D and A3D constants -+ colorMode() error ++ colorMode() error http://code.google.com/p/processing/issues/detail?id=223 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 1.5.1 (REV 0197) - 15 May 2011 This release fixes a handful of regressions and quirks that were found in -the Processing 1.5 release last month. +the Processing 1.5 release last month. -[ editor ] +[ editor ] + Windows splash screen for version 1.5 says "1.2" http://code.google.com/p/processing/issues/detail?id=631 @@ -5316,13 +8268,13 @@ the Processing 1.5 release last month. + File > New and Command-N stop working on OS X after running a sketch http://code.google.com/p/processing/issues/detail?id=664 -[ core ] +[ core ] + Reverted to the old createFont() behavior, where native fonts will be used with createFont() in more situations. http://code.google.com/p/processing/issues/detail?id=662 -[ svg ] +[ svg ] + Improve handling of transformations in SVG files. http://code.google.com/p/processing/issues/detail?id=388 @@ -5335,7 +8287,7 @@ the Processing 1.5 release last month. + Fix misshapen quadratic bezier curves when drawing SVG files. -[ examples ] +[ examples ] + HsvSpace example sketch in 1.5 download requires additional import http://code.google.com/p/processing/issues/detail?id=661 @@ -5344,7 +8296,7 @@ the Processing 1.5 release last month. http://code.google.com/p/processing/issues/detail?id=655 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 1.5 (REV 0196) - 17 April 2011 @@ -5354,7 +8306,7 @@ being the introduction of "modes" for the editor, allowing you to switch between Android development or the classic desktop/web mode. More modes are coming in future releases. -Another significant change is a fix for applets that were stuttering or +Another significant change is a fix for applets that were stuttering or appearing to run very, very slowly in Firefox 4 and Chrome. That's the major reason that we're releasing this version in advance on 2.0 later this summer. @@ -5368,7 +8320,7 @@ eventually replacing the built-in OpenGL library for 2.0. Meanwhile, here are the changes since revision 0195, the last pre-release: -[ pde ] +[ pde ] + A new version of the reference and examples have been posted online. @@ -5381,7 +8333,7 @@ Meanwhile, here are the changes since revision 0195, the last pre-release: http://dev.processing.org/bugs/show_bug.cgi?id=810 http://code.google.com/p/processing/issues/detail?id=100 -+ Fixed a bug in the LoadFile2 example ++ Fixed a bug in the LoadFile2 example http://code.google.com/p/processing/issues/detail?id=522 + Shift-indent without selection increases indention @@ -5431,9 +8383,9 @@ Mac software developer hero of my youth, Peter N Lewis. + Fix minor native fonts issue. -[ android ] +[ android ] -+ Workaround for loadImage(url) bug in Google's Android source. ++ Workaround for loadImage(url) bug in Google's Android source. Issue tracked down by psoden. (Thanks!) http://code.google.com/p/processing/issues/detail?id=629 @@ -5447,21 +8399,21 @@ Mac software developer hero of my youth, Peter N Lewis. http://code.google.com/p/processing/issues/detail?id=518 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0195 - 10 April 2011 -Bug fixes and several Android updates. Working to close in on a proper +Bug fixes and several Android updates. Working to close in on a proper Processing 1.5 release. -This release has several changes to renaming sketches, using Save As, +This release has several changes to renaming sketches, using Save As, and how untitled sketches are handled. Please help test! Note that on the Android side, this release once again requires installation of the Google APIs. See the Android Wiki page for details. -[ general ] +[ general ] + Sketch restarts automatically after pressing stop button on PDE http://code.google.com/p/processing/issues/detail?id=561 @@ -5509,11 +8461,11 @@ of the Google APIs. See the Android Wiki page for details. + Remove version number from splash image http://code.google.com/p/processing/issues/detail?id=324 -+ Subfolders in /libraries folder not supported in 0194, ++ Subfolders in /libraries folder not supported in 0194, bring them back for toxi and the toxiclibs folks. http://code.google.com/p/processing/issues/detail?id=578 -[ core ] +[ core ] + Deal with bad screen updates for sketches running < 60 fps in JAVA2D @@ -5526,7 +8478,7 @@ of the Google APIs. See the Android Wiki page for details. + save() and other pixel operations no longer working with JAVA2D in 0194 http://code.google.com/p/processing/issues/detail?id=594 -[ android ] +[ android ] + point() doesn't render in A3D http://code.google.com/p/processing/issues/detail?id=592 @@ -5547,21 +8499,21 @@ of the Google APIs. See the Android Wiki page for details. + Better error handling when certain SDK components are not installed. -+ Canceling an attempt to find the Android SDK leaves no window open, ++ Canceling an attempt to find the Android SDK leaves no window open, or crash when trying to change to Android mode w/ no Android SDK http://code.google.com/p/processing/issues/detail?id=605 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0194 - 9 March 2011 Lots of fixes for late-breaking problems in release 0193. -[ fixes ] +[ fixes ] -+ The Auto Format command went missing in 0193. It's back for 0194, but is ++ The Auto Format command went missing in 0193. It's back for 0194, but is now located in the Edit menu, where it will stay for the rest of its long and happy life. @@ -5576,7 +8528,7 @@ Lots of fixes for late-breaking problems in release 0193. + Fix for flicker problem in the default renderer. http://code.google.com/p/processing/issues/detail?id=558 -+ The examples menu wasn't completely removed in 0193. ++ The examples menu wasn't completely removed in 0193. + Remove "temporarily skipping deletion of" debugging message on export. @@ -5587,7 +8539,7 @@ Lots of fixes for late-breaking problems in release 0193. + Fix problem with Sketch Permissions for Android. http://code.google.com/p/processing/issues/detail?id=559 -[ notes ] +[ notes ] + Because both OpenGL and OpenGL2 are present, there may be conflicts if you implement any OpenGL-specific code outside the Processing API. If your sketch @@ -5597,7 +8549,7 @@ Lots of fixes for late-breaking problems in release 0193. import javax.media.opengl.glu.*; then you should remove one of the OpenGL libraries, depending on which you - would like to use. + would like to use. + OpenGL is built-in on Android. You don't need to add it as a library, the way you do with the desktop. A "import processing.opengl.*" line won't @@ -5610,48 +8562,48 @@ Lots of fixes for late-breaking problems in release 0193. [ additions ] -+ Added a new icon for "Export to Application", along the lines of the - icons used on the Android side. ++ Added a new icon for "Export to Application", along the lines of the + icons used on the Android side. + Remove warning about the broken build. http://code.google.com/p/processing/issues/detail?id=519 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0193 - 8 March 2011 -The PDE is receiving a major overhaul. The most obvious change is that +The PDE is receiving a major overhaul. The most obvious change is that there's now a menu that allows you to switch between "modes". "Standard" -is the Java-based mode that we're all used to, and "Android" compiles -things for Android devices. +is the Java-based mode that we're all used to, and "Android" compiles +things for Android devices. -Basically it's all pre-releases from here until 2.0. +Basically it's all pre-releases from here until 2.0. -With the mode support, it will soon be possible to embed other projects, -like the Python version, or the JS exporter, directly inside the PDE. +With the mode support, it will soon be possible to embed other projects, +like the Python version, or the JS exporter, directly inside the PDE. More on this later. This release also fixes a handful of Android problems, like the use of libraries, the code folder, and so on. -[ core ] +[ core ] + Fix problem that made applets suck in Google Chrome and Firefox 4. + Fix java.lang.OutOfMemoryError using get() and image() inside a tight loop. http://code.google.com/p/processing/issues/detail?id=42 -+ Changed default font to Lucida Sans, available on all platforms. ++ Changed default font to Lucida Sans, available on all platforms. This means that your text may be a slightly different size if you haven't - used textFont(), but hey, you probably don't use the default font, right? + used textFont(), but hey, you probably don't use the default font, right? A fella (or gal) like you? + textAlign() incorrect with default font on Mac OS X 10.6 http://code.google.com/p/processing/issues/detail?id=362 -+ Clean up how PDF fonts are handled. Default to writing fonts as shapes, ++ Clean up how PDF fonts are handled. Default to writing fonts as shapes, which makes PDF files larger, but is likely to work in more cases. If you want editable/real text, you can call textMode(MODEL) right after creating the PDF renderer (directly below size() or beginRecord()). @@ -5662,7 +8614,7 @@ libraries, the code folder, and so on. + Fix bizarre window placement when using Present mode on OS X. -[ pde changes/fixes ] +[ pde changes/fixes ] + Added support for separate 32 and 64 bit versions of libraries. @@ -5676,7 +8628,7 @@ libraries, the code folder, and so on. library into a newer, faster, more amazinger OpenGL that will eventually be the default. -+ Added a *lot* of examples. This has also had the effect of making the ++ Added a *lot* of examples. This has also had the effect of making the download enormous. It's currently obese. We'll sort that out later. + Code folder oddity on application export (in SVN) @@ -5697,7 +8649,7 @@ libraries, the code folder, and so on. http://code.google.com/p/processing/issues/detail?id=529 + Console, preferences cleanup: removed build.path, as well as - console.output.file, and console.error.file. Also removed 'console' + console.output.file, and console.error.file. Also removed 'console' true/false from preferences. + Change console to write to the 'console/' folder in settings. @@ -5707,7 +8659,7 @@ libraries, the code folder, and so on. + Add splash image on OS X. + Added window for examples. It's a bit ugly, but the menu was too much - and we should be able to clean this feller up later. Also makes the + and we should be able to clean this feller up later. Also makes the examples a bit more obvious. + Updated the serial library for Mac OS X @@ -5722,7 +8674,7 @@ libraries, the code folder, and so on. http://dev.processing.org/bugs/show_bug.cgi?id=54 http://code.google.com/p/processing/issues/detail?id=17 -[ fixed in 0192 ] +[ fixed in 0192 ] + Auto-format screws up if/else/else if blocks http://code.google.com/p/processing/issues/detail?id=325 @@ -5732,7 +8684,7 @@ libraries, the code folder, and so on. [ android edits ] -+ Add better icons from Casey for exported applications. ++ Add better icons from Casey for exported applications. + Remove the need to download the android core.jar separately http://code.google.com/p/processing/issues/detail?id=421 @@ -5757,10 +8709,10 @@ libraries, the code folder, and so on. http://dev.processing.org/bugs/show_bug.cgi?id=1379 http://code.google.com/p/processing/issues/detail?id=201 -+ With mode support, "Run on Device" and "Run in Emulator" instead of ++ With mode support, "Run on Device" and "Run in Emulator" instead of "Run" and "Present". -[ internal changes ] +[ internal changes ] + Removed build.path from preferences.txt. Not really used anywhere, just trying to clean things up. @@ -5768,8 +8720,8 @@ libraries, the code folder, and so on. + Removed 'console.output.file' and 'console.error.file'. These weren't respected as paths, no reason for them. -+ Change console to write to the 'console/' folder in settings. - This may eventually create a problem with logs that need to be cleaned, ++ Change console to write to the 'console/' folder in settings. + This may eventually create a problem with logs that need to be cleaned, but we'll keep an eye on it for now. + Removed 'console' true/false from preferences. @@ -5778,19 +8730,19 @@ libraries, the code folder, and so on. http://code.google.com/p/processing/issues/detail?id=197 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0192 - 18 December 2010 This release contains a roll-up of lots of bug fixes. However, it's being released before it's ready, so it should only be used by people who are having -trouble with the new Android SDK release (revision 8) from Google, which +trouble with the new Android SDK release (revision 8) from Google, which broke Android support last week. -This version of Processing for Android *requires* Android SDK Tools Release 8. -If you're not using release 8, and don't have the necessary components -installed, you'll get (confusing) error messages saying that the SDK location +This version of Processing for Android *requires* Android SDK Tools Release 8. +If you're not using release 8, and don't have the necessary components +installed, you'll get (confusing) error messages saying that the SDK location is not set, and that it could not find an SDK in the location that you specify. As for this being an early release, the problem is that major changes were @@ -5800,11 +8752,11 @@ support is somewhat broken. So with that caveat, no whining, please. On a happier note, the changes: -[ android fixes ] +[ android fixes ] + Compile android-core with Java 5 as the target so that it works on OS X 10.5. -[ additions from andres ] +[ additions from andres ] + A3D should use lower color depth on older devices. http://code.google.com/p/processing/issues/detail?id=391 @@ -5850,7 +8802,7 @@ On a happier note, the changes: + AutoFormat unecessarily adds spaces to function with multiple args http://code.google.com/p/processing/issues/detail?id=462 -[ edits from Lonnen ] +[ edits from Lonnen ] + Fix for disappearing horizontal scroll bar regression http://code.google.com/p/processing/issues/detail?id=316 @@ -5903,19 +8855,19 @@ On a happier note, the changes: + shearX and shearY not properly implemented with P2D and JAVA2D http://code.google.com/p/processing/issues/detail?id=452 -+ frame.setResizable(true) does not enable maximize button. ++ frame.setResizable(true) does not enable maximize button. Thanks to Christian Thiemann for a workaround. http://code.google.com/p/processing/issues/detail?id=467 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0191 - 30 September 2010 Bug fix release. Contains major fixes to 3D for Android. -[ changes ] +[ changes ] + Added option to preferences panel to enable/disable smoothing of text inside the editor. @@ -5923,7 +8875,7 @@ Bug fix release. Contains major fixes to 3D for Android. + Added more anti-aliasing to the Linux interface. Things were downright ugly in places where defaults different from Windows and Mac OS X. -[ bug fixes ] +[ bug fixes ] + Fix a problem with Linux permissions in the download. http://code.google.com/p/processing/issues/detail?id=343 @@ -5936,7 +8888,7 @@ Bug fix release. Contains major fixes to 3D for Android. + Remove extraneous console messages on export. -+ When exporting, don't include a library multiple times. ++ When exporting, don't include a library multiple times. + Fixed a problem where no spaces in the size() command caused an error. http://code.google.com/p/processing/issues/detail?id=390 @@ -5970,34 +8922,34 @@ Bug fix release. Contains major fixes to 3D for Android. + Finish screen pixels/texture operations in A3D http://code.google.com/p/processing/issues/detail?id=298 -+ Fixed a bug in the camera handling. This was a quite urgent issue, ++ Fixed a bug in the camera handling. This was a quite urgent issue, since affected pretty much everything. It went unnoticed until now because the math error canceled out with the default camera settings. http://forum.processing.org/topic/possible-3d-bug -+ Also finished the implementation of the getImpl() method in PImage, - so it initializes the texture of the new image in A3D mode. ++ Also finished the implementation of the getImpl() method in PImage, + so it initializes the texture of the new image in A3D mode. This makes the CubicVR example to work fine. -[ core ] +[ core ] + Fix background(PImage) for OpenGL http://code.google.com/p/processing/issues/detail?id=336 -+ Skip null entries with trim(String[]) ++ Skip null entries with trim(String[]) + Fix NaN with PVector.angleBetween http://code.google.com/p/processing/issues/detail?id=340 + Fix missing getFloat() method in XML library -+ Make sure that paths are created with saveStream(). ++ Make sure that paths are created with saveStream(). (saveStream() wasn't working when intermediate directories didn't exist) -+ Make createWriter() use an 8k buffer by default. ++ Make createWriter() use an 8k buffer by default. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0190 - 18 August 2010 @@ -6007,18 +8959,18 @@ are some problems with fonts. If you're using text, especially with PDFs, you may want to wait until the next release. Android users should read the Wiki (http://wiki.processing.org/w/Android) -which has a lot of new information. +which has a lot of new information. -[ android ] +[ android ] -+ Added a new menu to cover enabling/disabling Android mode. ++ Added a new menu to cover enabling/disabling Android mode. -+ Added a Permissions dialog, so that you can set permissions for your ++ Added a Permissions dialog, so that you can set permissions for your applications, e.g. so you can read from the internet or save files. -+ Added support for icons. Put files named icon-32.png, icon-48.png, ++ Added support for icons. Put files named icon-32.png, icon-48.png, and icon-72.png in your sketch folder, and they'll be added to your - project when it's created. Otherwise you'll get an ugly blue dot + project when it's created. Otherwise you'll get an ugly blue dot default icon. You've been warned. + Finish implementing the size() command on Android. See the Wiki for notes. @@ -6035,7 +8987,7 @@ which has a lot of new information. + Fix text ascent/descent problem, text("blah\nblah") wasn't working. -+ Fixed how the manifest file is read/written. ++ Fixed how the manifest file is read/written. http://dev.processing.org/bugs/show_bug.cgi?id=1429 http://code.google.com/p/processing/issues/detail?id=221 @@ -6054,18 +9006,18 @@ which has a lot of new information. + Fix errors showing up that .java files were duplicates. http://code.google.com/p/processing/issues/detail?id=232 -[ core ] +[ core ] + Changed skewX/Y to shearX/Y. -+ ENABLE_NATIVE_FONTS was being ignored, native fonts were always used ++ ENABLE_NATIVE_FONTS was being ignored, native fonts were always used in some cases. However, this broke some other things. But that's why this is a pre-release, not a final. -[ xml fixes and changes ] +[ xml fixes and changes ] + Changed the XML constructor to take a String for a node name, instead of - parsing a document from a String. Instead, use XMLElement.parse(String) + parsing a document from a String. Instead, use XMLElement.parse(String) if you want to read a file. + Added getBoolean() methods. @@ -6094,9 +9046,9 @@ which has a lot of new information. + Update XMLElement constructor problem. http://code.google.com/p/processing/issues/detail?id=342 -[ environment ] +[ environment ] -+ Added more specific language to Lnux/Sun/Java error messages on Linux. ++ Added more specific language to Lnux/Sun/Java error messages on Linux. Also added support for "Oracle" in the name. + Fix the New/Open buttons on the toolbar @@ -6114,7 +9066,7 @@ which has a lot of new information. http://code.google.com/p/processing/issues/detail?id=15 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 1.2.1 (REV 0189) - 14 July 2010 @@ -6123,43 +9075,43 @@ Fix for a problem with some static-mode programs. See below for the other changes since 1.1. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 1.2 (REV 0188) - 13 July 2010 -Changes too numerous to mention, see the notes below for all the +Changes too numerous to mention, see the notes below for all the revisions that followed the 1.1 release in March. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0187 - 12 July 2010 -More bug fixes, and one new treat for OS X users. Hopefully we're about +More bug fixes, and one new treat for OS X users. Hopefully we're about set to call this one 1.2. Please test and report any issues you find: http://code.google.com/p/processing/issues/list -[ additions ] +[ additions ] -+ On Mac OS X, you're no longer required to have a sketch window open at ++ On Mac OS X, you're no longer required to have a sketch window open at all times. This will make the application feel more Mac-like--a little more elegant and trendy and smug with superiority. -+ Added a warning to the Linux version to tell users that they should be ++ Added a warning to the Linux version to tell users that they should be using the official version of Java from Sun if they're not. http://wiki.processing.org/w/Supported_Platforms#Linux - There isn't a perfect way to detect whether Sun Java is in use, - so please let us know how it works or if you have a better idea. + There isn't a perfect way to detect whether Sun Java is in use, + so please let us know how it works or if you have a better idea. -[ fixes ] +[ fixes ] + "Unexpected token" error when creating classes with recent pre-releases. http://code.google.com/p/processing/issues/detail?id=292 -+ Prevent horizontal scroll offset from disappearing. - Thanks to Christian Thiemann for the fix. ++ Prevent horizontal scroll offset from disappearing. + Thanks to Christian Thiemann for the fix. http://code.google.com/p/processing/issues/detail?id=280 http://code.google.com/p/processing/issues/detail?id=10 @@ -6171,26 +9123,26 @@ http://code.google.com/p/processing/issues/list http://code.google.com/p/processing/issues/detail?id=303 + Added requestFocusInWindow() call to replace Apple's broken requestFocus(), - which should return the previous behavior of sketches getting focus + which should return the previous behavior of sketches getting focus immediately when loaded in a web browser. http://code.google.com/p/processing/issues/detail?id=279 -+ Add getDocumentBase() version of createInput() for Internet Explorer. ++ Add getDocumentBase() version of createInput() for Internet Explorer. Without this, sketches will crash when trying to find files on a web server that are not in the exported .jar file. This fix is only for IE. Yay IE! -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0186 - 26 June 2010 Minor updates following up on 0185. -[ mixed bag ] +[ mixed bag ] + Android SDK requirement is now API 7 (Android 2.1), because Google has - deprecated API 6 (2.0.1). + deprecated API 6 (2.0.1). + More Linux PDF fixes from Matthias Breuer. Thanks! @@ -6203,18 +9155,18 @@ Minor updates following up on 0185. + Updated the included examples with recent changes. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0185 - 20 June 2010 -Primarily a bug fix release. The biggest change are a couple tweaks for +Primarily a bug fix release. The biggest change are a couple tweaks for problems caused by Apple's Update 2 for Java on OS X, so this should make -Processing usable on Macs again. +Processing usable on Macs again. -[ bug fixes ] +[ bug fixes ] -+ Fix for Apple bug that caused an assertion failure when requestFocus() ++ Fix for Apple bug that caused an assertion failure when requestFocus() was called in some situations. This was causing the PDE to become unusable for opening sketches, and focus highlighting was no longer happening. http://code.google.com/p/processing/issues/detail?id=258 @@ -6239,14 +9191,14 @@ Processing usable on Macs again. also added begin/endDraw between frames http://dev.processing.org/bugs/show_bug.cgi?id=1227 -[ additions ] +[ additions ] + Add the changes for "Copy as HTML" to replace the "Copy for Discourse" function, now that we've shut down the old YaBB discourse board. http://code.google.com/p/processing/issues/detail?id=271 -+ Option to disable re-opening sketches when you start Processing. - The default will stay the same, but if you don't like the feature, ++ Option to disable re-opening sketches when you start Processing. + The default will stay the same, but if you don't like the feature, alter your preferences.txt file to change: last.sketch.restore=true to the following: @@ -6261,7 +9213,7 @@ Processing usable on Macs again. http://code.google.com/p/processing/issues/detail?id=179 Those bugs are not yet fixed, but will be addressed in future releases. -+ Option to change the default naming of sketches via preferences.txt. ++ Option to change the default naming of sketches via preferences.txt. First, you can change the prefix, which defaults to: editor.untitled.prefix=sketch_ And the suffix is handled using dates. The current default (since 1.0) is: @@ -6279,13 +9231,13 @@ Processing usable on Macs again. + Added option to launch a sketch directly w/ linux. Thanks to Larry Kyrala. http://dev.processing.org/bugs/show_bug.cgi?id=1549 -+ Pass actual exceptions from InvocationTargetException in registered ++ Pass actual exceptions from InvocationTargetException in registered methods, which improves how exceptions are reported with libraries. -+ Added loading.gif to the js version of the applet loader. Not sure ++ Added loading.gif to the js version of the applet loader. Not sure if this is actually working or not, but it's there. -[ android ] +[ android ] + Added permissions for INTERNET and WRITE_EXTERNAL_STORAGE to the default AndroidManifest.xml file. This will be addressed in greater detail here: @@ -6296,25 +9248,25 @@ Processing usable on Macs again. + Lots of work happening underneath with regards to Android, more updates soon as things start evening out a bit. -+ Defaulting to a WVGA screen for the default Processing AVD. ++ Defaulting to a WVGA screen for the default Processing AVD. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0184 - 14 April 2010 -Pre-release version with more bug fixes. Proper release notes will +Pre-release version with more bug fixes. Proper release notes will accompany an actual release. If you're curious in the meantime, look at todo.txt and done.txt from the source tree. -+ The 'Export' option now works in Android, so that you can get at ++ The 'Export' option now works in Android, so that you can get at the debug APK that's created. -+ Problems finding javac.exe on Windows should now be fixed. ++ Problems finding javac.exe on Windows should now be fixed. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0183 - 31 March 2010 @@ -6323,10 +9275,10 @@ Bug fixes for Android, should remove the API v5 requirement and make things work fine with API v6, the new minimum. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -PROCESSING REV 0182 - 29 March 2010 +PROCESSING REV 0182 - 29 March 2010 Bug fix pre-release. This updates three areas: @@ -6340,7 +9292,7 @@ A more thorough revisions update will be written for the next full release version (1.2? 1.5? 2.0?) that includes all these changes. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0181 - 19 March 2010 @@ -6348,27 +9300,27 @@ PROCESSING REV 0181 - 19 March 2010 Another update for the preprocessor changes (see below). -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0180 - 15 March 2010 -This is a interim release with a reworked preprocessor that adds Java 5 -syntax. We're releasing this interim version because we need help testing +This is a interim release with a reworked preprocessor that adds Java 5 +syntax. We're releasing this interim version because we need help testing it since it has an impact on any sketch created in the Processing environment. Basically, we mighta goofed something up big, and we wanna catch it before -we throw it to the wolves. +we throw it to the wolves. The release also fixes a number of preprocessor bugs. Those changes will -be documented a bit later. +be documented a bit later. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 1.1 (REV 0179) - 11 March 2010 -This is the first general-purpose release since 1.0.9. The text below merges +This is the first general-purpose release since 1.0.9. The text below merges all of the changes from all the interim revisions, with the exception of the changes for the upcoming Android tools, which are not enabled in this release. @@ -6379,15 +9331,15 @@ of release 1.0.10. Which is nice, because release 1.0.10 sounds baffling. [ font changes ] -+ It's no longer necessary to use textFont() before text() and other - text-handling functions. The default "SansSerif" font is used, which - varies by platform. ++ It's no longer necessary to use textFont() before text() and other + text-handling functions. The default "SansSerif" font is used, which + varies by platform. -+ Also in this release, the createFont() method will only load characters - as they are used, which should greatly improve the font situation on ++ Also in this release, the createFont() method will only load characters + as they are used, which should greatly improve the font situation on non-Roman systems like Japanese. This will use far less memory, and should - be all around much more efficient. Formerly, createFont() took several - seconds to run, depending on the speed of your system. + be all around much more efficient. Formerly, createFont() took several + seconds to run, depending on the speed of your system. http://dev.processing.org/bugs/show_bug.cgi?id=1111 + Fixed a problem with the Create Font tool ignoring the 'smooth' setting @@ -6396,13 +9348,13 @@ of release 1.0.10. Which is nice, because release 1.0.10 sounds baffling. + Fixed a separate problem with the createFont() method also ignoring the 'smooth' setting. -+ With the Create Font tool, you can also specify what Unicode character ++ With the Create Font tool, you can also specify what Unicode character blocks you'd like to use, making a much smaller font. + Fonts are no longer power of 2 by default. This should also make them more memory efficient. With future OpenGL updates, this will work even better. -[ other changes ] +[ other changes ] + Lots of edits to the HTML that's used for exported applets. If JavaScript is enabled, Sun's new loading functions are used, which offer the best @@ -6411,14 +9363,14 @@ of release 1.0.10. Which is nice, because release 1.0.10 sounds baffling. + Changed the OpenGL HTML template to load differently, which should fix a NullPointerException in JOGLAppletLanucher with Java 6 Update 18 on Windows, - and should also be more efficient altogether, because the JOGL libraries can + and should also be more efficient altogether, because the JOGL libraries can be downloaded just once from Sun, rather than for each sketch that uses them. http://dev.processing.org/bugs/show_bug.cgi?id=1452 + Code from Takachin that handles full input method support in the editor for Japanese and other scripts that are more complicated than Roman text. http://dev.processing.org/bugs/show_bug.cgi?id=854 - Thanks Takachin! + Thanks Takachin! + Now using iText 2.1.7. @@ -6428,14 +9380,14 @@ of release 1.0.10. Which is nice, because release 1.0.10 sounds baffling. + With great help from Hansi, moved the build scripts over to Ant. http://dev.processing.org/bugs/show_bug.cgi?id=151 Also moved the special JRE for Linux and Windows out of SVN. It'll only be - downloaded when 'ant dist' is run. + downloaded when 'ant dist' is run. + Javadoc is slowly improving. More on that later. + Deprecated 'screen', and added screenWidth and screenHeight. Discussion here: http://dev.processing.org/bugs/show_bug.cgi?id=1499 -[ bug fixes ] +[ bug fixes ] + Fix for filter(DILATE/ERODE) from Dave Bollinger http://dev.processing.org/bugs/show_bug.cgi?id=1477 @@ -6455,7 +9407,7 @@ of release 1.0.10. Which is nice, because release 1.0.10 sounds baffling. + To fix video, and some other libraries on Snow Leopard, exported applications are now explicitly set to run 32-bit on OS X. -+ Fix LITERAL_class so that blah.class syntax can be used in PDE code. ++ Fix LITERAL_class so that blah.class syntax can be used in PDE code. Found and fixed by Christian Thiemann. Thank you! http://dev.processing.org/bugs/show_bug.cgi?id=1466 @@ -6481,37 +9433,37 @@ of release 1.0.10. Which is nice, because release 1.0.10 sounds baffling. + Fixed a problem where imports inside comments were being included. -[ keys ] +[ keys ] -+ Added ctrl-ins, shift-ins, shift-delete for cut/copy/paste on Windows and ++ Added ctrl-ins, shift-ins, shift-delete for cut/copy/paste on Windows and Linux, but disabled by default on Mac OS X. You can change the setting by altering "editor.keys.alternative_cut_copy_paste" in preferences.txt. http://dev.processing.org/bugs/show_bug.cgi?id=162 -+ Added a preference to change shift-backspace to just mean backspace, ++ Added a preference to change shift-backspace to just mean backspace, rather than delete. Set this entry in preferences.txt: editor.keys.shift_backspace_is_delete = true http://dev.processing.org/bugs/show_bug.cgi?id=1463 -+ Added an option for home and end keys traveling to the start/end of the ++ Added an option for home and end keys traveling to the start/end of the current line rather than the beginning/ending of a sketch. The latter is the HIG default for Mac OS X, but drives some people nuts. Change with: editor.keys.home_and_end_travel_far = false -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0178 - 4 March 2010 Tons of Android work in this release. A2D has been tested and runs correctly for all of the examples in "Basics" and "Topics". A3D is not quite finished -yet, and the size() command is still causing crashes. +yet, and the size() command is still causing crashes. This release also contains lots of work on Android Mode for the PDE, which is being worked on by Jonathan Feinberg. -[ core ] +[ core ] + Fix for filter(DILATE/ERODE) from Dave Bollinger http://dev.processing.org/bugs/show_bug.cgi?id=1477 @@ -6521,7 +9473,7 @@ is being worked on by Jonathan Feinberg. + Added implementation for get/set methods inside PImage (w/o pixels[]) -[ fixes to android core ] +[ fixes to android core ] + Fix noLoop() and static-mode sketches. http://dev.processing.org/bugs/show_bug.cgi?id=1467 @@ -6532,7 +9484,7 @@ is being worked on by Jonathan Feinberg. + App not pausing or closing when switching to another activity http://dev.processing.org/bugs/show_bug.cgi?id=1404 -+ Bezier curves were broken in A2D (extra point is drawn connecting the ++ Bezier curves were broken in A2D (extra point is drawn connecting the shape to the corner). + Fixed other minor bugs in shape drawing. @@ -6549,7 +9501,7 @@ is being worked on by Jonathan Feinberg. + Drastically improve the performance of the time functions (minute() et al) -+ Point wasn't detecting different stroke weights. ++ Point wasn't detecting different stroke weights. + Point wasn't working with strokeWeight > 1. @@ -6571,7 +9523,7 @@ is being worked on by Jonathan Feinberg. + Remove legacy PGraphics3D class from processing.core.android http://dev.processing.org/bugs/show_bug.cgi?id=1402 -[ android mode ] +[ android mode ] + Exception handling is much improved. @@ -6585,7 +9537,7 @@ is being worked on by Jonathan Feinberg. PROCESSING REV 0177 - 21 February 2010 -Fix for the Android tools complaining "Open quote is expected for +Fix for the Android tools complaining "Open quote is expected for attribute "{1}" associated with an element type android:minSdkVersion." Just posting a new revision because it's easier than writing instructions @@ -6599,17 +9551,17 @@ below that (a tipoff being that there's no PDF library on Android...) [ android ] -+ Minimum platform support is changing to 2.0 instead of 1.6. That means ++ Minimum platform support is changing to 2.0 instead of 1.6. That means "Eclair" or later, and goodbye to my T-Mobile G1, undoubtedly the ugliest - cell phone I have ever owned. Hello to Droid and Nexus One. - Performance is very poor on pre-2.0 devices anyway. + cell phone I have ever owned. Hello to Droid and Nexus One. + Performance is very poor on pre-2.0 devices anyway. -+ Known issue: Sketches that use noLoop() are currently broken. ++ Known issue: Sketches that use noLoop() are currently broken. http://dev.processing.org/bugs/show_bug.cgi?id=1467 + Added support for libraries and the code folder. -+ Classes have moved to the processing.core package instead of ++ Classes have moved to the processing.core package instead of processing.android.core. + Slashes in the SDK path are now escaped properly on Windows. @@ -6622,7 +9574,7 @@ below that (a tipoff being that there's no PDF library on Android...) + loadFont() and text() now work properly. createFont() has not been tested. -[ changes ] +[ changes ] + Lots of edits to the HTML that's used for exported applets. If JavaScript is enabled, Sun's new loading functions are used, which offer the best @@ -6631,17 +9583,17 @@ below that (a tipoff being that there's no PDF library on Android...) + Changed the OpenGL HTML template to load differently, which should fix a NullPointerException in JOGLAppletLanucher with Java 6 Update 18 on Windows, - and should also be more efficient altogether, because the JOGL libraries can + and should also be more efficient altogether, because the JOGL libraries can be downloaded just once from Sun, rather than for each sketch that uses them. http://dev.processing.org/bugs/show_bug.cgi?id=1452 + Code from Takachin that handles full input method support in the editor for Japanese and other scripts that are more complicated than Roman text. http://dev.processing.org/bugs/show_bug.cgi?id=854 - Thanks Takachin! + Thanks Takachin! + Downgraded the PDF library to use iText 1.5.4, because later versions seem - to load slower, and don't seem to offer additional benefits. If the PDF + to load slower, and don't seem to offer additional benefits. If the PDF library gets worse, please post a bug and we'll go back to the 2.x release we were using, or upgrade to the more recent 5.x series. @@ -6651,13 +9603,13 @@ below that (a tipoff being that there's no PDF library on Android...) + With great help from Hansi, moved the build scripts over to Ant. http://dev.processing.org/bugs/show_bug.cgi?id=151 Also moved the special JRE for Linux and Windows out of SVN. It'll only be - downloaded when 'ant dist' is run. This makes the build and maintenance - more of a mess for me, but will save me from people whining about the + downloaded when 'ant dist' is run. This makes the build and maintenance + more of a mess for me, but will save me from people whining about the large files. + Javadoc is slowly improving. More on that later. -[ bug fixes ] +[ bug fixes ] + Updated JNA to version 3.2.4 to support Windows 7 64-bit http://dev.processing.org/bugs/show_bug.cgi?id=1424 @@ -6672,7 +9624,7 @@ below that (a tipoff being that there's no PDF library on Android...) + To fix video, and some other libraries on Snow Leopard, exported applications are now explicitly set to run 32-bit on OS X. -+ Fix LITERAL_class so that blah.class syntax can be used in PDE code. ++ Fix LITERAL_class so that blah.class syntax can be used in PDE code. Found and fixed by Christian Thiemann. Thank you! http://dev.processing.org/bugs/show_bug.cgi?id=1466 @@ -6683,9 +9635,9 @@ below that (a tipoff being that there's no PDF library on Android...) + If you overwrite PApplet.main(), you're responsible for what happens. http://dev.processing.org/bugs/show_bug.cgi?id=1446 -[ keys ] +[ keys ] -+ Added ctrl-ins, shift-ins, shift-delete for cut/copy/paste on Windows and ++ Added ctrl-ins, shift-ins, shift-delete for cut/copy/paste on Windows and Linux, but disabled by default on Mac OS X. You can change the setting by altering "editor.keys.alternative_cut_copy_paste" in preferences.txt. http://dev.processing.org/bugs/show_bug.cgi?id=162 @@ -6695,18 +9647,18 @@ below that (a tipoff being that there's no PDF library on Android...) editor.keys.shift_backspace_is_delete = true http://dev.processing.org/bugs/show_bug.cgi?id=1463 -+ Added an option for home and end keys traveling to the start/end of the ++ Added an option for home and end keys traveling to the start/end of the current line rather than the beginning/ending of a sketch. The latter is the HIG default for Mac OS X, but drives some people nuts. Change with: editor.keys.home_and_end_travel_far = false [ fonts ] -+ Starting in this release, the createFont() method will only load characters - as they are used, which should greatly improve the font situation on ++ Starting in this release, the createFont() method will only load characters + as they are used, which should greatly improve the font situation on non-Roman systems like Japanese. This will use far less memory, and should - be all around much more efficient. Formerly, createFont() took several - seconds to run, depending on the speed of your system. + be all around much more efficient. Formerly, createFont() took several + seconds to run, depending on the speed of your system. http://dev.processing.org/bugs/show_bug.cgi?id=1111 + Fixed a problem with the Create Font tool ignoring the 'smooth' setting @@ -6715,14 +9667,14 @@ below that (a tipoff being that there's no PDF library on Android...) + Fixed a separate problem with the createFont() method also ignoring the 'smooth' setting. -+ With the Create Font tool, you can also specify what Unicode character ++ With the Create Font tool, you can also specify what Unicode character blocks you'd like to use, making a much smaller font. + Fonts are no longer power of 2 by default. This should also make them more memory efficient. With future OpenGL updates, this will work even better. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING REV 0172 through 0175 @@ -6730,7 +9682,7 @@ PROCESSING REV 0172 through 0175 These releases are mostly about Android (listed at the top), but also contain any interim fixes that happened in the meantime. -[ android ] +[ android ] + Fix problem with Android HTML dialog box several
items showing up when first loading @@ -6752,11 +9704,11 @@ any interim fixes that happened in the meantime. + Updates for r4 version of the SDK. -[ changes ] +[ changes ] -+ In the editor toolbar, shift-new and shift-open on the toolbar open a - new window. Also, when shift is down, change text of the toolbar item - to represent what it does. ++ In the editor toolbar, shift-new and shift-open on the toolbar open a + new window. Also, when shift is down, change text of the toolbar item + to represent what it does. + Replaced com.apple.eawt.Application invocation to deal with deprecation. This may cause problems with older releases (or on 10.4 or 10.5), not sure. @@ -6764,13 +9716,13 @@ any interim fixes that happened in the meantime. + Use xdg-open as launcher on linux http://dev.processing.org/bugs/show_bug.cgi?id=1358 -+ Default wildcard imports are causing naming conflicts, changed how ++ Default wildcard imports are causing naming conflicts, changed how they're set up in the preferences file. http://dev.processing.org/bugs/show_bug.cgi?id=1103 + Changed createInputRaw() to only bother checking URLs if : present -[ bug fixes ] +[ bug fixes ] + Re-enabled hack for temporary clipping. Clipping still needs to be implemented properly, however. Please help! @@ -6788,7 +9740,7 @@ any interim fixes that happened in the meantime. + Fixed a problem where imports inside comments were being included. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 1.0.9 (REV 0171) - 20 October 2009 @@ -6797,7 +9749,7 @@ Happy birthday to Casey! [ bug fixes ] -+ Removed NPOT texture support until further testing, because it was ++ Removed NPOT texture support until further testing, because it was resulting in blurring images in OPENGL sketches. http://dev.processing.org/bugs/show_bug.cgi?id=1352 @@ -6805,12 +9757,12 @@ Happy birthday to Casey! http://dev.processing.org/bugs/show_bug.cgi?id=786 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 1.0.8 (REV 0170) - 18 October 2009 -A bonfire of bug fixes. +A bonfire of bug fixes. [ environment ] @@ -6844,26 +9796,26 @@ A bonfire of bug fixes. http://dev.processing.org/bugs/show_bug.cgi?id=1332 http://dev.processing.org/bugs/show_bug.cgi?id=1092 -+ Saving the project with the same name (but different case) ++ Saving the project with the same name (but different case) as an existing tab was deleting code on Windows and OS X. http://dev.processing.org/bugs/show_bug.cgi?id=1102 -[ core ] +[ core ] -+ filter(RGB) supposed to be filter(OPAQUE) ++ filter(RGB) supposed to be filter(OPAQUE) http://dev.processing.org/bugs/show_bug.cgi?id=1346 -+ Implement non-power-of-2 textures for OpenGL (on cards where available). ++ Implement non-power-of-2 textures for OpenGL (on cards where available). This is a partial fix for texture edge problems: http://dev.processing.org/bugs/show_bug.cgi?id=602 + Fix get() when used with save() in OpenGL mode -+ Immediately update projection with OpenGL. In the past, projection - updates required a new frame. This also prevents camera/project from ++ Immediately update projection with OpenGL. In the past, projection + updates required a new frame. This also prevents camera/project from being reset when the drawing size is changed. -+ Removed an error that caused the cameraNear value to be set to -8. ++ Removed an error that caused the cameraNear value to be set to -8. This may cause other problems with drawing/clipping however. + Removed methods from PApplet that use doubles. These were only temporarily @@ -6881,18 +9833,18 @@ A bonfire of bug fixes. + Updated Quaqua to 6.2 on Mac OS X. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 1.0.7 (REV 0169) - 4 September 2009 -Bug fixes and updates, also some tweaks for Mac OS X Snow Leopard. +Bug fixes and updates, also some tweaks for Mac OS X Snow Leopard. -[ changes ] +[ changes ] + Tweaks for Mac OS X Snow Leopard, to force it to run in 32-bit mode. This should bring back the video library (if temporarily), and hopefully - fix serial as well, though I didn't have a serial device handy to test. + fix serial as well, though I didn't have a serial device handy to test. + Fix problem where line highlighting was off in 'static' mode. http://dev.processing.org/bugs/show_bug.cgi?id=1263 @@ -6903,11 +9855,11 @@ Bug fixes and updates, also some tweaks for Mac OS X Snow Leopard. + PVector.angleDistance() returning NaN due to precision errors http://dev.processing.org/bugs/show_bug.cgi?id=1316 -+ Removed a major try/catch block from PApplet.main(), hopefully ++ Removed a major try/catch block from PApplet.main(), hopefully this will allow some exception stuff to come through properly. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 1.0.6 (REV 0168) - 12 August 2009 @@ -6915,7 +9867,7 @@ PROCESSING 1.0.6 (REV 0168) - 12 August 2009 Bug fixes and minor changes. Most important are replacement JOGL libraries so that OpenGL applets won't present an "expired certificate" error. -[ bug fixes ] +[ bug fixes ] + Replaced the faulty JOGL library that had expired certificates (Sun bug). http://dev.processing.org/bugs/show_bug.cgi?id=1271 @@ -6949,29 +9901,29 @@ so that OpenGL applets won't present an "expired certificate" error. + PDF member functions set protected instead of private http://dev.processing.org/bugs/show_bug.cgi?id=1276 -+ On OS X, update Info.plist to be 32/64 explicit and also updated ++ On OS X, update Info.plist to be 32/64 explicit and also updated JavaApplicationStub for update 4. -+ Clicking the preferences location in the Preferences window will - now open the parent folder for the preferences file. ++ Clicking the preferences location in the Preferences window will + now open the parent folder for the preferences file. http://dev.processing.org/bugs/show_bug.cgi?id=1279 + Update to Java 6 update 15 for the Windows and Linux releases. -[ fixed earlier ] +[ fixed earlier ] + Mangled menu text with Java 6u10. http://dev.processing.org/bugs/show_bug.cgi?id=1065 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 1.0.5 (REV 0167) - 7 June 2009 Bug fix release, mostly dealing with regressions from 1.0.4. -[ bug fixes ] +[ bug fixes ] + Make the tab key work again inside the editor http://dev.processing.org/bugs/show_bug.cgi?id=1267 @@ -6988,20 +9940,20 @@ Bug fix release, mostly dealing with regressions from 1.0.4. + Updated reference files. -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 1.0.4 (REV 0166) - 31 May 2009 -Bug fix release. +Bug fix release. -[ changes ] +[ changes ] + Changed the workaround for Apple's Java bug related to the menus in OS X. Rather than placing the menubar inside the sketch window, File > Sketchbook and File > Examples are simply dimmed out. Instead, use the Open button on the toolbar, which provides access to the same items. The preference - to place the menu bar inside the window is still available, in case you + to place the menu bar inside the window is still available, in case you prefer the previous workaround. http://dev.processing.org/bugs/show_bug.cgi?id=786 @@ -7009,7 +9961,7 @@ Bug fix release. [ bug fixes ] -+ Fixed IDE crash when changing color scheme on windows ++ Fixed IDE crash when changing color scheme on windows http://dev.processing.org/bugs/show_bug.cgi?id=1237 + Typo in the Linux shell script was preventing it from running @@ -7018,16 +9970,16 @@ Bug fix release. + OS X finder info on application updated to say 1.0.4 http://dev.processing.org/bugs/show_bug.cgi?id=1226 -+ Removed warning message "Non-String for 8 value in 'Properties' ++ Removed warning message "Non-String for 8 value in 'Properties' sub-dictionary in 'Java' sub-dictionary of Info.plist" on OS X + Added warning to build script for users on OS X 10.4 http://dev.processing.org/bugs/show_bug.cgi?id=1179 -+ Disable point() going to set() from PGraphicsJava2D. The set() command ++ Disable point() going to set() from PGraphicsJava2D. The set() command doesn't honor alpha consistently, and it also causes problems with PDF -+ PImage cacheMap problem when using PImage.get() ++ PImage cacheMap problem when using PImage.get() http://dev.processing.org/bugs/show_bug.cgi?id=1245 + Fix problems with > 512 points and P3D/OPENGL @@ -7047,11 +9999,11 @@ Bug fix release. + Fix significant point() and set() slowdown on OS X http://dev.processing.org/bugs/show_bug.cgi?id=1094 -[ known issues ] +[ known issues ] -+ Currently no 64-bit support for any platforms. On some platforms, you'll ++ Currently no 64-bit support for any platforms. On some platforms, you'll simply need to replace the Java folder with the distribution with something - more suitable for your operating system. + more suitable for your operating system. + Command line support is currently broken http://dev.processing.org/bugs/show_bug.cgi?id=1048 @@ -7066,12 +10018,12 @@ Bug fix release. + See dev.processing.org/bugs for much, much more! -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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, +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 ] @@ -7090,31 +10042,31 @@ as well as a couple other new problems encountered since. + ArrayIndexOutOfBoundsException with point() http://dev.processing.org/bugs/show_bug.cgi?id=1168 -[ changes ] +[ 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 ] +[ 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. ++ 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 ++ 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 @@ -7166,7 +10118,7 @@ This release fixes many bugs and adds two minor functions to the XML library. 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 ++ 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. @@ -7178,7 +10130,7 @@ This release fixes many bugs and adds two minor functions to the XML library. + Fix for getChild() and getChildren() with XML elements that have null names -[ additions ] +[ additions ] + Added listChildren() method to XMLElement @@ -7186,7 +10138,7 @@ This release fixes many bugs and adds two minor functions to the XML library. in XMLElement -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 1.0.1 (REV 0163) - 29 November 2008 @@ -7197,11 +10149,11 @@ 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 +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 ] +[ bug fixes ] + ArrayIndexOutOfBoundsException with File > New http://dev.processing.org/bugs/show_bug.cgi?id=1067 @@ -7225,7 +10177,7 @@ past week following the announcement. + Fixed problem where small ellipses weren't showing up. -[ changes ] +[ changes ] + Implement multi-line tab via tab key (also outdent) http://dev.processing.org/bugs/show_bug.cgi?id=1075 @@ -7234,7 +10186,7 @@ past week following the announcement. http://dev.processing.org/bugs/show_bug.cgi?id=1064 -. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PROCESSING 1.0 (REV 0162) - 24 November 2008 @@ -7242,22 +10194,22 @@ 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 ] +[ known issues ] -+ Sketches that size(w, h, OPENGL) and do not clear the background on each ++ 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. + 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. + 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 @@ -7267,23 +10219,23 @@ in the last few months here: http://processing.org/reference/changes.html 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 ++ 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 + 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 + 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, + 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 @@ -7300,16 +10252,16 @@ in the last few months here: http://processing.org/reference/changes.html + 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 ++ 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. +notes from earlier releases because this file was getting out of hand. diff --git a/build/shared/tools/MovieMaker/build.xml b/build/shared/tools/MovieMaker/build.xml index 416992a8c5..4669b8500a 100644 --- a/build/shared/tools/MovieMaker/build.xml +++ b/build/shared/tools/MovieMaker/build.xml @@ -8,8 +8,8 @@ - list = (List) + t.getTransferData(DataFlavor.javaFileListFlavor); if (list.size() > 0) { File file = (File) list.get(0); @@ -108,9 +109,7 @@ public boolean importData(JComponent comp, Transferable t) { c.setText(file.getPath()); } imported = true; - } catch (UnsupportedFlavorException ex) { - // ex.printStackTrace(); - } catch (IOException ex) { + } catch (UnsupportedFlavorException | IOException ex) { // ex.printStackTrace(); } } @@ -128,11 +127,7 @@ public boolean importData(JComponent comp, Transferable t) { boolean useRead = false; handleReaderImport(r, c, useRead); imported = true; - } catch (UnsupportedFlavorException ex) { - // ex.printStackTrace(); - } catch (BadLocationException ex) { - // ex.printStackTrace(); - } catch (IOException ex) { + } catch (UnsupportedFlavorException | BadLocationException | IOException ex) { // ex.printStackTrace(); } } diff --git a/build/shared/tools/MovieMaker/src/ch/randelshofer/media/quicktime/DataAtomOutputStream.java b/build/shared/tools/MovieMaker/src/ch/randelshofer/media/quicktime/DataAtomOutputStream.java index ff42b53dda..a1bc78011b 100644 --- a/build/shared/tools/MovieMaker/src/ch/randelshofer/media/quicktime/DataAtomOutputStream.java +++ b/build/shared/tools/MovieMaker/src/ch/randelshofer/media/quicktime/DataAtomOutputStream.java @@ -11,6 +11,7 @@ package ch.randelshofer.media.quicktime; import java.io.*; +import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import javax.imageio.stream.ImageOutputStreamImpl; @@ -31,7 +32,8 @@ public class DataAtomOutputStream extends FilterOutputStream { ImageOutputStreamImpl impl; - protected static final long MAC_TIMESTAMP_EPOCH = new GregorianCalendar(1904, GregorianCalendar.JANUARY, 1).getTimeInMillis(); + protected static final long MAC_TIMESTAMP_EPOCH = new GregorianCalendar(1904, Calendar.JANUARY, 1).getTimeInMillis(); + /** * The number of bytes written to the data output stream so far. * If this counter overflows, it will be wrapped to Integer.MAX_VALUE. diff --git a/build/shared/tools/MovieMaker/src/processing/app/tools/MovieMaker.java b/build/shared/tools/MovieMaker/src/processing/app/tools/MovieMaker.java index ab71f3ae40..bbfd28abf5 100644 --- a/build/shared/tools/MovieMaker/src/processing/app/tools/MovieMaker.java +++ b/build/shared/tools/MovieMaker/src/processing/app/tools/MovieMaker.java @@ -24,8 +24,9 @@ import javax.swing.border.EmptyBorder; import javax.swing.filechooser.FileSystemView; +import processing.app.Base; import processing.app.Language; -import processing.app.ui.Editor; + import ch.randelshofer.gui.datatransfer.FileTextFieldTransferHandler; import ch.randelshofer.media.mp3.MP3AudioInputStream; import ch.randelshofer.media.quicktime.QuickTimeWriter; @@ -74,8 +75,8 @@ public void run() { } - public void init(Editor editor) { - initComponents(editor == null); + public void init(Base base) { + initComponents(base.getActiveEditor() == null); ((JComponent) getContentPane()).setBorder(new EmptyBorder(12, 18, 18, 18)); imageFolderField.setTransferHandler(new FileTextFieldTransferHandler(JFileChooser.DIRECTORIES_ONLY)); @@ -532,10 +533,10 @@ private void createMovie(final File movieFile) { // --------------------------------- // Create the QuickTime movie // --------------------------------- - SwingWorker w = new SwingWorker() { + new SwingWorker() { @Override - protected Object doInBackground() { + protected Throwable doInBackground() { try { // Read image files File[] imgFiles = null; @@ -599,25 +600,23 @@ Dimension findSize(File[] imgFiles) { @Override protected void done() { - Object o; + Throwable t; try { - o = get(); + t = get(); } catch (Exception ex) { - o = ex; + t = ex; } - if (o instanceof Throwable) { - Throwable t = (Throwable) o; + if (t != null) { t.printStackTrace(); JOptionPane.showMessageDialog(MovieMaker.this, - Language.text("movie_maker.error.movie_failed") + "\n" + (t.getMessage() == null ? t.toString() : t.getMessage()), - Language.text("movie_maker.error.sorry"), - JOptionPane.ERROR_MESSAGE); + Language.text("movie_maker.error.movie_failed") + "\n" + + (t.getMessage() == null ? t.toString() : t.getMessage()), + Language.text("movie_maker.error.sorry"), + JOptionPane.ERROR_MESSAGE); } createMovieButton.setEnabled(true); } - }; - w.execute(); - + }.execute(); }//GEN-LAST:event_createMovie @@ -693,7 +692,7 @@ private BufferedImage readImage(File file) { } - private void cannotRead(File file) { + static private void cannotRead(File file) { String path = file.getAbsolutePath(); String msg = Language.interpolate("movie_maker.error.cannot_read", path); System.err.println(msg); diff --git a/build/windows/about.bmp b/build/windows/about.bmp index 63c97739b6..51a3ba312a 100644 Binary files a/build/windows/about.bmp and b/build/windows/about.bmp differ diff --git a/build/windows/config-cmd.xml b/build/windows/config-cmd.xml old mode 100644 new mode 100755 index 647082bfc9..44cc9e9ca7 --- a/build/windows/config-cmd.xml +++ b/build/windows/config-cmd.xml @@ -29,11 +29,13 @@ java + + -Djava.ext.dirs="%EXEDIR%\\java\\lib\\ext" -Djna.nosys=true - 1.8.0 + 1.8.0_60 256 diff --git a/build/windows/config.xml b/build/windows/config.xml old mode 100644 new mode 100755 index 46e8982d1b..1184cb4066 --- a/build/windows/config.xml +++ b/build/windows/config.xml @@ -18,22 +18,34 @@ lib/pde.jar core/library/core.jar lib/jna.jar + lib/jna-platform.jar lib/antlr.jar lib/ant.jar lib/ant-launcher.jar - lib/org-netbeans-swing-outline.jar - lib/com.ibm.icu_4.4.2.v20110823.jar - lib/jdi.jar - lib/jdimodel.jar - lib/org.eclipse.osgi_3.8.1.v20120830-144521.jar java + + -Djava.ext.dirs="%EXEDIR%\\java\\lib\\ext" -Djna.nosys=true - - 1.7.0_40 + + -Djna.boot.library.path=lib + -Djna.nounpack=true + + -Dsun.java2d.d3d=false + -Dsun.java2d.ddoffscreen=false + -Dsun.java2d.noddraw=true + + 1.8.0_60 256 @@ -46,7 +58,7 @@ 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. If running from a folder with non-ASCII characters, try moving this folder to another location. - Required files could not be found. If running from a folder with non-ASCII characters, try moving this folder to another location. + Required files could not be found. Be sure to first extract the entire Processing folder from the .zip file download. Or if running from a folder with non-ASCII characters, try moving the Processing folder to another location. The registry refers to a nonexistent Java installation or the runtime is corrupted. An application instance is already running. diff --git a/build/windows/processing.bat b/build/windows/processing.bat index 64e7291eb7..8f71b553dd 100755 --- a/build/windows/processing.bat +++ b/build/windows/processing.bat @@ -1,3 +1,3 @@ @echo off -.\java\bin\java -cp lib/pde.jar;core/library/core.jar;lib/jna.jar;lib/antlr.jar;lib/ant.jar;lib/ant-launcher.jar;lib/org-netbeans-swing-outline.jar;lib/com.ibm.icu_4.4.2.v20110823.jar;lib/jdi.jar;lib/jdimodel.jar;lib/org.eclipse.osgi_3.8.1.v20120830-144521.jar processing.app.Base \ No newline at end of file +.\java\bin\java -cp lib\pde.jar;core\library\core.jar;lib\jna.jar;lib\jna-platform.jar;lib\antlr.jar;lib\ant.jar;lib\ant-launcher.jar processing.app.Base diff --git a/core/.gitignore b/core/.gitignore index ba077a4031..84e7b5c836 100644 --- a/core/.gitignore +++ b/core/.gitignore @@ -1 +1,2 @@ bin +.idea diff --git a/core/.settings/org.eclipse.jdt.core.prefs b/core/.settings/org.eclipse.jdt.core.prefs index 8e54f46416..f57dd085ab 100644 --- a/core/.settings/org.eclipse.jdt.core.prefs +++ b/core/.settings/org.eclipse.jdt.core.prefs @@ -6,9 +6,10 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -96,8 +97,13 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false +org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false +org.eclipse.jdt.core.formatter.align_with_spaces=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 @@ -106,24 +112,39 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=36 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 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_relational_operator=0 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 +org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=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 @@ -132,6 +153,7 @@ 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_statement_group_in_switch=0 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 @@ -141,32 +163,38 @@ 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_lambda_body=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.align_tags_descriptions_grouped=false +org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=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.count_line_length_from_starting_position=false org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_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.indent_tag_description=false org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=1 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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 @@ -179,6 +207,7 @@ 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_annotation_on_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert @@ -188,6 +217,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=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 @@ -201,11 +231,15 @@ 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_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=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_bitwise_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 @@ -232,9 +266,14 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declar 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_switch_case_expressions=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_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_not_operator=do not 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 @@ -259,13 +298,20 @@ 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_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=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_bitwise_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 @@ -309,9 +355,13 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_decla 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_switch_case_expressions=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_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=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 @@ -348,9 +398,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser 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_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=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 @@ -362,20 +415,59 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_decla org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never 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_enum_constant_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false +org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.lineSplit=80 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines 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.text_block_indentation=0 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true +org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true +org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/core/.settings/org.eclipse.jdt.ui.prefs b/core/.settings/org.eclipse.jdt.ui.prefs index 18a5c596a2..1286aca0bb 100644 --- a/core/.settings/org.eclipse.jdt.ui.prefs +++ b/core/.settings/org.eclipse.jdt.ui.prefs @@ -1,7 +1,7 @@ eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_processing -formatter_settings_version=12 +formatter_settings_version=18 org.eclipse.jdt.ui.text.custom_code_templates= sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false @@ -16,10 +16,12 @@ sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=false sp_cleanup.convert_to_enhanced_for_loop=false sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=false sp_cleanup.format_source_code_changes_only=false +sp_cleanup.insert_inferred_type_arguments=false sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false sp_cleanup.make_private_fields_final=true @@ -35,6 +37,7 @@ sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class= sp_cleanup.qualify_static_member_accesses_with_declaring_class=false sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_type_arguments=true sp_cleanup.remove_trailing_whitespaces=true sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false @@ -48,8 +51,10 @@ sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false sp_cleanup.use_blocks=false sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=false sp_cleanup.use_parentheses_in_expressions=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true diff --git a/core/build.xml b/core/build.xml index 6e57817302..e1bf0fd5fc 100644 --- a/core/build.xml +++ b/core/build.xml @@ -15,17 +15,20 @@ - + + + - - + @@ -34,43 +37,48 @@ - + + + + - - + - + - + - + + - + - +
diff --git a/core/done.txt b/core/done.txt index e46c2876dc..a04e597a69 100644 --- a/core/done.txt +++ b/core/done.txt @@ -1,3 +1,902 @@ +0270 (3.5.4) +no changes + + +0269 (3.5.3) +X fix/clean a few file i/o issues +X deal with possible resource leak when loading URLs +X create intermediate folders when saving temp files +X fix resource leaks (open files) in loadJSONObject and loadJSONArray +X get rid of errant 'Could not parse -1 for display' message + +contrib +X Update missing @Deprecated tags in PApplet.java +X https://github.com/processing/processing/pull/5686 + + +0268 (3.5.2) +X Ctrl-click on Mac OS X result in all subsequent clicks reported as right-click +X https://github.com/processing/processing/issues/5765 +X https://github.com/processing/processing/pull/5766 + + +0267 (3.5.1) +X no changes to core in this release + + +0266 (3.5) +X fix javaPlatform variable for newer JDK versions +X https://github.com/processing/processing/pull/5626 +o many fonts installed causes slow startup on macos +o run that on a thread, and make sure default font doesn't need the list loaded +X can't be done, notes in the code for PFont.loadFonts() +X improve startup time when user-specified fonts are not used +X default font will be faster, using ttf/otf is fine +X only createFont("The Font Name") is still slow on macOS +X and PFont.list() +o check again whether element 0,0 in a Table is working +X https://github.com/processing/processing/issues/3011 +X was already checked, made a note and locked the issue + +api changes +X Dict.remove() should return value, not index (for consistency w/ others) +X returns the value removed, not the key, just like remove(key) +X rationale being that if you know the index, you probably know the key +X if unavailable, throw an exception; otherwise no consistent way to indicate error +X add circle() and square() +X add push() and pop() +X make JSONObject.quote() (both versions) public +X should DoubleDict create from Iterable or Map<>? +o (Map is more efficient b/c of size, Iterable more useful) +X Iterable of what, though? Map.Entry? +X sticking with just the Map<> version for now + +contrib +o make tabs into spaces, fixes pixelDensity(2) issue with tabs +o https://github.com/processing/processing/issues/5625 +o https://github.com/processing/processing/pull/5633 +X had to back this fix out again +X Fixes blend mode not being set correctly, fixing #5645 +X https://github.com/processing/processing/issues/5645 +X https://github.com/processing/processing/pull/5647 +X extended SVG support +X https://github.com/processing/processing/pull/4168 +X show a warning when a font isn't what the user expected +X https://github.com/processing/processing/issues/5481 +X https://github.com/processing/processing/pull/5605 + +gohai +X Profile GL3bc is not available on X11GraphicsDevice +X https://github.com/processing/processing/issues/5476 +X https://github.com/processing/processing/pull/5652 + +andres +X silence TIS/TSM warning message with P2D/P3D/OPENGL since macOS 10.13.4 +X https://github.com/processing/processing/issues/5462 +X improve matrix performance in P2D/P3D +X https://github.com/processing/processing/issues/5685 +X Initializing textures loads the pixels array, even if not needed aferwards +X https://github.com/processing/processing/issues/5748 +X Processing 3.4 takes 60 seconds before can edit file +X https://github.com/processing/processing/issues/5707 +X skip Android's SDK folder when adding sketches +X https://github.com/processing/processing/commit/5b653263cc6151f838c11a61689d756901c11e37 +X PShape.attrib() and PShape.setAttrib() are not working +X https://github.com/processing/processing/issues/5560 + +jakub +X Fix freeze when restarting sketch with variables in size +X https://github.com/processing/processing/pull/5708 +X Make sure Ctrl+Left Mouse on MacOS is consistent +X https://github.com/processing/processing/issues/5672 +X https://github.com/processing/processing/pull/5674 +X Stop frame rate counter from exaggerating +X https://github.com/processing/processing/pull/5697 +X Fix vertex buffer initialized with wrong number of components +X https://github.com/processing/processing/pull/5698 +X Recreate FBOs when offscreen PGraphicsOpenGL is resized +X https://github.com/processing/processing/pull/5699 + +cleaning +o WARNING: GL pipe is running in software mode (Renderer ID=0x1020400) +o is this coming from us? if so, need to provide actions +X haven't seen for a while, maybe fixed +X figure our size(img.width, img.height) situation +X just make loadImage() work in settings +X update the wiki and reference +o update wiki/docs to say "don't override sketchXxxx() methods" +o size() command not working to do a resize +X need a programmatic way to set size +o check on performance of the new EDT setup +X present mode is 30-40% slower than windowed +X w/ this example: https://github.com/processing/processing/issues/2423 + + +0265 (3.4) +X change lack of blendMode() to a warning rather than an error in PDF +X rewrite exec() to do threads, also handle fast/excessive output cases +X rewrite requestImage() to fix errors/slowness/concurrency problems + +data classes +X add Double and Long versions of the data classes +X also add subset(long) and subset(double) to PApplet +X change Sort class to use int for comparisons +X sort only uses the sign of the value +X more accurate than float, especially when using double and long values +X consistently implement write(PrintWriter) in the List and Dict classes +X add save(File) to the List and Dict classes +X prevent Table.sort() from throwing NPE with empty cells + +jakub +X Semi-transparent colors do not display properly in PGraphics +X https://github.com/processing/processing/issues/5519 +X Semi-transparent colors do not display properly in PGraphics +X https://github.com/processing/processing/issues/5519 +X https://github.com/processing/processing/pull/5522 + +gohai +X Various ARM-related updates +X https://github.com/processing/processing/pull/5440 +X make P3D work on Linux SBCs using ARM Mali graphics and their ES 3.1 driver +X https://github.com/processing/processing/pull/5475 + +contrib +X Fixed a crash occuring while loading certain SVGs exported from Illustrator +X https://github.com/processing/processing/pull/5526 +X Support PShape.contains() on GROUP objects +X https://github.com/processing/processing/pull/5550 +X Improve implementation of PShape.contains() to take the CTM into account +X https://github.com/processing/processing/pull/5549 + + +0264 (3.3.7) +X fix exception due to version parsing in Java 9 +X https://github.com/processing/processing/issues/5275 +X remove useless deprecation on PImage.mask(int[]) +X set colorModeDefault to true by default +X blendMode() with PDF isn't showing the warning about it not being available +X add blendMode() to nope() calls in PGraphicsPDF +X https://github.com/processing/processing/issues/5105 +X Table.insertRow() causes ArrayIndexOutOfBoundsException (with fix) +X https://github.com/processing/processing/issues/5406 + +data +X added setIndex() method to IntDict, FloatDict, StringDict +X added resize() to IntDict, FloatDict, StringDict +X fix entries() Iterator in IntDict, FloatDict, StringDict + +contrib +X minor bezierPoint() rewrite for performance +X https://github.com/processing/processing/pull/5251 +X void cursor() don't work after void noCursor() in P2D and P3D +X https://github.com/processing/processing/issues/5330 +X https://github.com/processing/processing/pull/5340 +X NullPointerException on close button with P3D and noLoop +X https://github.com/processing/processing/issues/5214 +X https://github.com/processing/processing/pull/5384 + +andres +X textureWrap() not updating when changed during draw() +X https://github.com/processing/processing/issues/5322 +X cap frameRate() to 1000 in OpenGL +X https://github.com/processing/processing/issues/5404 + +gohai +X ARM tweaks for shaders on the RPi +X https://github.com/processing/processing/pull/5297 +X Fix 3D on contemporary versions of Linux +X https://github.com/processing/processing/pull/5428 +X https://github.com/processing/processing/issues/5308 + +jakub +X fix line joins on triangles +X https://github.com/processing/processing/issues/5353 +X https://github.com/processing/processing/pull/5354 +X Make un/registering methods in PApplet thread-saf +X https://github.com/processing/processing/pull/5379 + + +0263 (3.3.6) +X lots of contribs! + +gohai +X shell discussion with gohai +X https://github.com/processing/processing/pull/5082 +X Workaround issues with Raspbian release August 2017 +X https://github.com/processing/processing/pull/5222 + +jakub +X Fix bugs in line vert shader +X https://github.com/processing/processing/pull/5184 +X https://github.com/processing/processing/issues/5181 +X https://github.com/processing/processing/issues/5182 +X https://github.com/processing/processing/issues/5183 +X https://github.com/processing/processing/issues/5194 + +contrib +X Add workaround for window size = 0 crash +X https://github.com/processing/processing/pull/5234 +X https://github.com/processing/processing/issues/5052 + + +0262 (3.3.5) +X default to using native select on all platforms + +contrib +X Add defaultFontOrDeath to OpenGL textWidth +X https://github.com/processing/processing/issues/5137 +X https://github.com/processing/processing/pull/5138 + + +0261 (3.3.4) +X add exec() with StringList options +X start to add stub for shell() function +X handle edge case for set() being called with a 2D vector, on a 3D vector +X https://github.com/processing/processing/issues/5092 +o keyPressed() problems with special press-and-hold behavior macOS Sierra +X https://github.com/processing/processing/issues/4952 +X added documentation in 3 places about it + +jakub +X Fix keyPressed for multiple keys +X https://github.com/processing/processing/pull/5050 +X https://github.com/processing/processing/issues/5049 + + +0260 (3.3.3) +X keyPressed not returning false once a key is released +X https://github.com/processing/processing/issues/5033 +X deal with loadBytes() regressions introduced by their rewrite +X (was breaking p5jsMode because of its use of loadBytes(File) + +jakub +X image tint() broken in 3.3.x +X https://github.com/processing/processing/issues/5040 +X https://github.com/processing/processing/pull/5042 + + +0259 (3.3.2) +X add (far) more efficient file loading for loadBytes(File) +X add loadBytes(URL) variant that uses content length header for array size +X keyPressed is false if one key is released while multiple keys are pressed +X https://github.com/processing/processing/issues/4993 +X createInput() wasn't returning null for files that were not found +X https://github.com/processing/processing/issues/5026 + +andres +X Assigning Pixels Vertically Flipped in P2D +X https://github.com/processing/processing/issues/5013 + +gohai +X improve loadBytes() performance +X https://github.com/processing/processing/pull/5027 + +jakub +X ArrayIndexOutOfBoundsException when using tint() or loadFont() +X https://github.com/processing/processing/issues/5028 +X https://github.com/processing/processing/pull/5029 + + +0258 (3.3.1) +X improve sum() functions in processing.data +X add sum() to IntDict and FloatDict +X add sumLong() to IntList, IntDict (to handle cases outside integer range) +X add sumDouble() to FloatList, FloatDict (to handle outside float range) +X throw exception when using sum() with numbers that are too large or small +X createInput() and createOutput() now both use buffered streams by default +X createInputRaw() does not, however +X don't derive the font again if the size is unchanged +X part of https://github.com/processing/processing/issues/4956 +X fix temporary file handling for saveBytes(), saveStream(), etc +X wasn't handling gzip output properly +X also could have problems w/ names under length 3 + +jakub +X major work on window placement and pixel density +X https://github.com/processing/processing/pull/5011 + +gohai +X Fix MeshTweening vertex shader +X https://github.com/processing/processing-docs/issues/523 +X https://github.com/processing/processing-docs/pull/524 +X ARM: Allow Raspberry Pi's Mesa GL driver to use up to 8 lights +X https://github.com/processing/processing/pull/4915 +X ...and revert it back again +X https://github.com/processing/processing/pull/4922 +X Retry with multisampling disabled if creating a framebuffer fails +X because of INCOMPLETE_MULTISAMPLE +X https://github.com/processing/processing/pull/4921 +X Report more error conditions in validateFramebuffer +X https://github.com/processing/processing/pull/4920 +X Add more Raspberry Pi related fixes to JOGL +X https://github.com/processing/processing/pull/4911 +X Unblock hardware-accelerated P3D on ARM Mali devices +X https://github.com/processing/processing/pull/5014 + + +0257 (3.3) +X return null for PApplet.trim(null) +X StringDict(TableRow) constructor +X allow lone double quotes in the midst of csv strings +X make trim() work on column titles as well +o add trimRows() and trimColumns() +o would you ever use one w/o the other? +X just make this part of trim() +X also remove rows/columns from beginning +X since that's what trim() on strings does +X consume Unicode BOM (0xFEFF) in createReader() and Table parser +o no prompt shows with selectInput() on 10.11 and 10.12 +X https://github.com/processing/processing/issues/4758 +X can't fix, seems embedded in the Java implementation +X return null for getString(), getJSONObject(), and getJSONArray() +X when key is not present, more in line w/ other p5 api + +contrib +X Fix a number of memory leaks (jdf) +X https://github.com/processing/processing/pull/4862 +X https://github.com/jdf/processing.py/issues/233 +X https://github.com/processing/processing/pull/4873 + + +0256 (3.2.4) +X write exec() documentation +X https://github.com/processing/processing/issues/4740 +X add xmlns to elements procured from getChild() +X make sure newline is added after XML header when formatting + +api additions +X add listPaths(), listFiles() +X https://github.com/processing/processing/issues/4622 +X add increment() method that takes IntDict to merge another dictionary +X Calling this increment() since it doesn't make sense in practice for +X the other dictionary types, even though it's technically an add() +X add Entry class for iterating StringDict, IntDict, FloatDict +X add XML.print() method (prints with indent of 2) + +contribs +X Adding missing docs and keywords for TableRow +X https://github.com/processing/processing/pull/4333 +X PShape in Java2D wasn't respecting 'kind' +X https://github.com/processing/processing/issues/4826 +X https://github.com/processing/processing/pull/4834 + +cleaning +o probably should also check to make sure PApplet running JVM 8 +X or compile against 1.8 and force it? + +andres +X PShape array index out of bounds when using P3D +X https://github.com/processing/processing/issues/4773 +X modelX/Y/Z() should be disabled in P2D +X https://github.com/processing/processing/issues/4813 + +jakub +X FX: Prevent matrix stack overflow +X https://github.com/processing/processing/pull/4799 +X https://github.com/processing/processing/issues/4206 +X FX: Reset transform to identity before drawing background +X https://github.com/processing/processing/pull/4795 +X FX: Implement mouse wheel event +X https://github.com/processing/processing/issues/4169 +X https://github.com/processing/processing/pull/4796 +X FX: Fix curveVertex drawing all curves together as one long curve +X https://github.com/processing/processing/pull/4800 +X https://github.com/processing/processing/issues/4382 +X FX: Add exception handler which reports exceptions from user code +X https://github.com/processing/processing/pull/4798 +X https://github.com/processing/processing/issues/4339 +X Unify mouse pressed/released events across renderers +X https://github.com/processing/processing/issues/4361 +X https://github.com/processing/processing/pull/4797 +X Fix typo in GLSL preprocessor +X https://github.com/processing/processing/issues/4810 +X https://github.com/processing/processing/pull/4816 +X Keep Windows timer resolution high for OpenGL sketches +X prevents frame rate in OpenGL hovering around 30 instead of 60 +X https://github.com/processing/processing/pull/4847 +X https://github.com/processing/processing/issues/4846 +X Sketches still running in the background after closing +X https://github.com/processing/processing/issues/4831 +X (needed to allow JAVA2D to terminate when animation thread dies) +X https://github.com/processing/processing/pull/4839 + + +0255 (3.2.3) + +andres +X automatic detection of POINT and LINE shaders fails +X https://github.com/processing/processing/issues/4725 +X show warning when frameRate() less than 1 is called with P2D and P3D +X https://github.com/processing/processing/issues/4716 + + +0254 (3.2.2) +X fix quoting problem in IntDict.toJSON() +X add getRenderer() to SurfaceInfo +X https://github.com/processing/processing/issues/4441 +X Exceptions thrown in OpenGL apps when hitting window close box +X https://github.com/processing/processing/issues/4690 +X add getRowMap() function +o do we want rows() to not be transient? +X write docs for getRowMap() +o Add options to saveJSONArray documentation (enhancement) +o https://github.com/processing/processing/issues/4683 +X made note in the docs repo +X go back to textMode(MODEL) is native font not available for textMode(SHAPE) +X https://github.com/processing/processing/issues/4680 +X NPE thrown when using textMode(SHAPE) with a .vlw font +X https://github.com/processing/processing/issues/4680 +X add toJSON() method to IntDict +X had to use JSONObject.quote() to wrap the text +X do the same for the other data classes +o note the difference between this and toJSONObject() or toJSONArray() +o or is that the better way to handle it? hm +X we can add JSONObject and JSONArray later perhaps +X keep toJSONObject() for turning XxxxList into a numbered lookup + +contrib +X Call glGetProgramiv to retrieve program log length +X https://github.com/processing/processing/issues/4659 +X https://github.com/processing/processing/pull/4660 +X JSONObject get() method is private +X https://github.com/processing/processing/issues/4334 +X https://github.com/processing/processing/pull/4336 + +andres +X Automatic handling of screen FBOs breaks readPixels() for user-provided FBO +X https://github.com/processing/processing/issues/4643 +X PGraphicsOpenGL: camera info not updated +X https://github.com/processing/processing/issues/4609 +X Fix PShape, updateTessellation, matrix transformations +X https://github.com/processing/processing/issues/4662 +X QUAD_STRIP as child shape draws extra lines +X https://github.com/processing/processing/issues/4656 +X remove extra glClear() calls +X https://github.com/processing/processing/issues/4694 +X PShapes do not show up in PDF with P2D renderer +X https://github.com/processing/processing/issues/4647 +X Some semi-transparent edges of sphere() meshes rendered in higher density +X https://github.com/processing/processing/issues/4720 +X P2D and P3D not stopping with empty draw() blocks +X https://github.com/processing/processing/issues/4722 + + +0253 (3.2.1) +X implement defaultUncaughtExceptionHandler +X helps avoid needing to double-quit OS X applications + + +0252 (3.2) +X some Table cleanup based on other CSV parsing work +X use StandardCharsets.UTF_8 instead of getting encoding by name +X PApplet.main(Blah.class) now works +o add push() and pop() methods to mirror js? +X Can't render PGraphics object using image() within a PDF +X https://github.com/processing/processing/issues/4473 + +jakub +X Fix resizing targets for async save +X https://github.com/processing/processing/pull/4607 +X https://github.com/processing/processing/issues/4578 + +contrib +X Make loadStrings() and loadJSONObject/loadJSONArray() error msgs consistent +X https://github.com/processing/processing/issues/4265 +X https://github.com/processing/processing/pull/4268 + + +0251 (3.1.2) +X rewrite csv handling +X fix parsing bugs, remove newlines option, improve performance +X prevent random(low, high) from returning 'high' +X https://github.com/processing/processing/issues/4551 +X disable async saveFrame() by default +X https://github.com/processing/processing/issues/4578 + +gohai +X Fix GLExceptions on Raspberry Pi when using offscreen PGraphics +X https://github.com/processing/processing/pull/4524 + +leslie +X fixed iterator remove() methods so they dont skip container elements +X https://github.com/processing/processing/pull/4519 +X added a check for length 0 arrays in expand() +X https://github.com/processing/processing/pull/4520 + +jakub +X Prevent NPE in loadImage() when called before setup() +X https://github.com/processing/processing/pull/4505 + +andres +X fix crash when calling getUniformLoc() called in PShader.set() +X https://github.com/processing/processing/issues/4542 + +earlier +X see if 8u65 or 8u66 fix the JavaFX problem +X if not, need to add them to the block list + + +0250 (3.1.1) +X implement support for encoding= option in loadTable() + +jakub +X Block loadImage and requestImage while images still being saved +X https://github.com/processing/processing/issues/4218 +X https://github.com/processing/processing/pull/4465 + +andres +X PShapeOBJ error String for missing MTL texture file +X https://github.com/processing/processing/issues/3990 +X https://github.com/processing/processing/commit/49a4c815557214fc1bf92e381ffaa398f262361a +X Shape (OBJ) import texture data is 0.0 +X https://github.com/processing/processing/issues/3156 +X https://github.com/processing/processing/commit/9f1d2988dc80ca7d5ee861b944cb59020ff771c5 + + +0249 (3.1) +X Float/IntDict changes +X minIndex() and maxIndex() return -1 when count is zero (rather than ex) +X bug fix to reverse sorts +X 2x performance increase for sorting +X added optional "stable" parameter for sorting by values +X set to false for higher performance +X call crop() in keyArray() and valueArray() functions +X they're duplicates, their length is an implementation detail +X normalize features and error handling between all of them +X add print() and write(PrintWriter) methods to Table/TableRow +X https://github.com/processing/processing/issues/4396 + +jakub +X several JavaFX fixes +X https://github.com/processing/processing/pull/4411 +X cursor() and noCursor() not working on FX2D +X https://github.com/processing/processing/issues/4405 +X Make sure PImage.parent is set in loadImage() +X https://github.com/processing/processing/pull/4412 + +andres +X Change convention for directional lights in OpenGL-Binding for GLSL +X https://github.com/processing/processing/issues/4275 +X internal texture copy does not update immediately +X https://github.com/processing/processing/issues/4404 +X Font corruption issue in OpenGL +X https://github.com/processing/processing/issues/4392 +X setStroke() does not work with imported OBJ Pshapes +X https://github.com/processing/processing/issues/4377 + +contribs +X blendMode() resetting with getGraphics() +X https://github.com/processing/processing/issues/4019 +X https://github.com/processing/processing/pull/4341 +X https://github.com/processing/processing/issues/4376 + + +0248 (3.0.2) +X Fix another "Zero length string passed to TextLayout constructor" error +X Ambiguity on where to call smooth() +X https://github.com/processing/processing/issues/4211 +X add additional clarification for Eclipse users +X Flipped Y-axis in JavaFX is now done (JDK bug) +X https://github.com/processing/processing/issues/3795 + +jakub +X Initialize sketch args before calling settings() +X https://github.com/processing/processing/issues/4219 +X https://github.com/processing/processing/pull/4220 + +andres +X Stop button in OpenGL exported applications does not use preference settings +X https://github.com/processing/processing/issues/4064 +X Export without a stop button using P3D or P2D +X https://github.com/processing/processing/issues/4056 +X glClearDepthf() not available on older hardware +X https://github.com/processing/processing/issues/4106 +X Drawing a sphere with shape() first changes sphereDetail from default +X https://github.com/processing/processing/issues/4192 +X PShape.scale() affects strokeWeight differently in P2D and P3D +X https://github.com/processing/processing/issues/4231 +X createShape(GROUP) + textured child + non-textured child = P3D render problems +X https://github.com/processing/processing/issues/4176 +X pixelDensity() and createGraphics() with P3D +X https://github.com/processing/processing/issues/4039 +X Friendlier message when running drawing commands outside animation thread +X https://github.com/processing/processing/issues/4196 +X strokeWeight() not working properly with point() in P2D and P3D +X https://github.com/processing/processing/issues/4188 +X exit() is not called in P2D/P3D +X https://github.com/processing/processing/issues/4156 +X attrib*() function does not work well with PShape +X https://github.com/processing/processing/issues/4048 + +contribs +X Fill out the Javadoc for PMatrix +X https://github.com/processing/processing/pull/4155 +X Have PSurfaceFX pay attention to the setVisible argument +X https://github.com/processing/processing/pull/4210 +X Use xdg-open in PApplet#launch(String) +X https://github.com/processing/processing/pull/4171 + + +0247 (3.0.1) +X curveVertex() does not work with FX2D renderer +X https://github.com/processing/processing/issues/3960 +X hide menu bar on OS X when FX2D is running full screen +X add quotes to the necessary parameters in the size() error messages +X Editor menu is outside the visible screen with 800x480 display +X https://github.com/processing/processing/issues/3913 +X https://github.com/processing/processing/pull/3999 +X https://github.com/processing/processing/pull/3992 +X add a patch for FX2D menubar not hiding, root cause not sorted out + +jakub +X Fix depth sorter ordering when two triangles in a plane share vertices +X https://github.com/processing/processing/pull/4010 +X Turn off fixed rate scheduling in OpenGL +X https://github.com/processing/processing/pull/4004 +X Fix GLSL preprocessing issues with variable name mangling +X https://github.com/processing/processing/pull/4052 +X https://github.com/processing/processing/issues/3961 +X https://github.com/processing/processing/issues/3968 + +andres +X cursor() fails to work as expected with P2D/P3D +X https://github.com/processing/processing/issues/3955 +X Topics/Shader/Convay broken +X https://github.com/processing/processing/issues/3947 +X https://github.com/processing/processing/issues/3973 +X Regressions wrt GLES2 support between b4 and b7 +X https://github.com/processing/processing/issues/3976 +X stroke glitches in P3D +X https://github.com/processing/processing/issues/4007 +X https://github.com/processing/processing/issues/4027 +X https://github.com/processing/processing/issues/4012 +X line loops incorrectly closed in P3D +X https://github.com/processing/processing/issues/4031 +X pixelDensity() and createGraphics() +X https://github.com/processing/processing/issues/4039 +X https://github.com/processing/processing/commit/1d163197c970947bf5be17049bddbe8e444f759d +X GL related crashes when closing the display window on Ubuntu (Intel) +X https://github.com/processing/processing/issues/4041 +X GL related crashes when closing window on MacBook Air (Intel) running 10.9.5 +X https://github.com/processing/processing/issues/3977 + +jogl +X Update to JogAmp JOGL 2.3.2 +X https://github.com/processing/processing/issues/3979 +X Output window cannot be set as non-resizable with the P2D or P3D renderers +X https://jogamp.org/bugzilla/show_bug.cgi?id=1188 +X https://github.com/processing/processing/issues/3952 +X setAlwaysOnTop does not work in P2D and P3D on Mac +X https://github.com/processing/processing/issues/3793 +X P2D and P3D windows behave strangely when larger than the screen size +X https://github.com/processing/processing/issues/3401 +X Remove Gluegen & JOGL sources +X https://github.com/processing/processing/pull/3982 + + +0246 the papal visit (3.0) +X implement high-performance/async image saving +X Use PBOs for async texture copy +X https://github.com/processing/processing/issues/3569 +X https://github.com/processing/processing/pull/3863 +X https://github.com/processing/processing/pull/3869 +X Textures disappearing in beta 7 (might be WeakReference regression) +X https://github.com/processing/processing/issues/3858 +X https://github.com/processing/processing/pull/3874 +X https://github.com/processing/processing/pull/3875 +X Convert all documented hacky keys in OpenGL +X https://github.com/processing/processing/pull/3888 +X Frame size displays incorrectly if surface.setResizable(true) +X https://github.com/processing/processing/issues/3868 +X https://github.com/processing/processing/pull/3880 +X displayWidth, displayHeight, full screen, display number +X https://github.com/processing/processing/pull/3893 +X https://github.com/processing/processing/issues/3865 +X OpenGL with fullScreen() always opens on default display +X https://github.com/processing/processing/issues/3889 +X https://github.com/processing/processing/issues/3797 +X https://github.com/processing/processing/pull/3892 + +cleaning +o move AWT image loading into PImageAWT +o look into how GL and FX will handle from there +o run only the necessary pieces on the EDT +o in part because FX doesn't even use the EDT +o re-check the Linux frame visibility stuff +X cleaned most of this as far as we can go +o Ubuntu Unity prevents full screen from working properly +X https://github.com/processing/processing/issues/3158 +X can't fix; upstream problem, added to the wiki + + +0245 core (3.0b7) +X surface.setLocation(x,y) not working with the default renderer +X https://github.com/processing/processing/issues/3821 +X FX2D display is inverted in 3.0b6 +X https://github.com/processing/processing/issues/3795 + +jakub +X Make the PApplet regex cache LRU +X https://github.com/processing/processing/pull/3815 +X Minor OpenGL improvements +X https://github.com/processing/processing/pull/3849 + +andres +X Cannot re-enable stroke or fill of a PShape with P2D +X https://github.com/processing/processing/issues/3808 +X setResizable broke with oscilating behavior in 3.0b6 +X https://github.com/processing/processing/issues/3825 +X https://github.com/processing/processing/commit/42c0150da0f400637de916db1f94a687a7bc4288 +X surface.setLocation() causing a freeze on Windows +X https://github.com/processing/processing/commit/4c0f9234c0a48f62363233cafc9c9951ee351d3e +X selectInput/Output() is behind the drawing window (Windows) +X https://github.com/processing/processing/issues/3775 +X MouseWheel count wrong (backwards?) in P2D and P3D +X https://github.com/processing/processing/issues/3840 + + +0244 core (3.0b6) +X Incomplete text rendering of strings with consecutive line breaks +X https://github.com/processing/processing/issues/3736 +X https://github.com/processing/processing/pull/3737 +X https://github.com/processing/processing/issues/3761 +X add the Contents/Java folder to java.library.path on OS X +X allows exported applications to use the Sound library +o don't grab pixels of java2d images unless asked +o this is the difference between a lot of loadPixels() and not +o so important to have it in before beta if that's the change +o https://github.com/processing/processing/issues/99 +X won't fix for now, requires too much reworking on the image system +X add surface.setAlwaysOnTop(boolean) +X https://github.com/processing/processing/issues/3718 +X Implement standard cursor types in OpenGL +X https://github.com/processing/processing/issues/3554 +X Change value of constants PRIMITIVE, PATH, and GEOMETRY constants in PShape +X This avoids a collision with entries in PConstants which causes +X confusing errors or no errors to be thrown at all +X https://github.com/processing/processing/issues/3776 +X Fix flickering cursor regression with Java2D on Windows introduced by #3472 + +andres +X P2D: error calling surface.setTitle() +X https://github.com/processing/processing/issues/3721 +X https://github.com/processing/processing/commit/a384cbf0890a49dbf6e0fdd80e048de80e5d78d2 +X Error message with noLoop() and P2D renderer +X https://github.com/processing/processing/issues/3558 +X Concurrency issues in OpenGL renderer prevent proper garbage collection +X https://github.com/processing/processing/issues/3384 +X In P2D/P3D the background is cleared to black on each frame +X https://github.com/processing/processing/issues/3559 +X cursor() command with PImage stopped working in 3.0 with P2D +X https://github.com/processing/processing/issues/3769 +X Demos/Graphics/Wiggling regressed from 17 fps to 8.3 fps between a11 and b1 +X https://github.com/processing/processing/issues/3561 +X "Library not installed properly" message inconsistent in P2D/P3D vs. JAVA2D +X https://github.com/processing/processing/issues/3453 +X PShape 3D: strange extra lines (another fix) +X https://github.com/processing/processing/issues/3006 +X line direction vectors are incorrectly transformed +X https://github.com/processing/processing/issues/3779 +X Strokes in 3D PShapes are not properly connected +X https://github.com/processing/processing/issues/3756 +X setting surface properties hangs OpenGL sketches +X https://github.com/processing/processing/issues/3789 + +jakub +X FX - fix transformation stack NPE +X https://github.com/processing/processing/pull/3710 +X FX - fix rad-deg conversion in rotate() +X https://github.com/processing/processing/pull/3711 +X FX - basic pixel operations (get, set, load, update) +X https://github.com/processing/processing/pull/3709 +X FX - align to pixel grid when drawing 1 px strokes +X https://github.com/processing/processing/pull/3712 +X keyChar and keyCode are super wonky and unlike AWT +X https://github.com/processing/processing/issues/3290 +X what's the way to do this after the deprecation? +X if this is going to be the default renderer, has to be ironed out +X FX - arc - infamous deg-rad conversion strikes again +X https://github.com/processing/processing/pull/3713 +X FX - paths, contours, curves +X https://github.com/processing/processing/pull/3715 +X FX - fix AIOOBE when pressing ESC on Mac +X https://github.com/processing/processing/pull/3719 +X FX - framerate fix +X https://github.com/processing/processing/pull/3724 +X FX - loadPixels, updatePixels, get and set optimizations +X https://github.com/processing/processing/pull/3725 +X FX - keep track of whether pixels are up to date +X https://github.com/processing/processing/pull/3716 +X FX - improve key events +X https://github.com/processing/processing/pull/3729 +X FX - add FX2D keyword, remove JFX keyword +X https://github.com/processing/processing/pull/3731 +X JOGL - normalize enter key +X https://github.com/processing/processing/pull/3735 +X FX - normalize enter key +X https://github.com/processing/processing/pull/3730 +X Render text starting with space properly +X https://github.com/processing/processing/pull/3746 +X FX - smooth for the main surface +X https://github.com/processing/processing/pull/3749 +X OpenGL - clean up loaded and modified for pixels +X https://github.com/processing/processing/pull/3768 +X FX - text stuff, move createFont() into PGraphics +X https://github.com/processing/processing/pull/3766 +X FX - fix bug where fonts would share a tint cache +X https://github.com/processing/processing/pull/3771 +X textFont() and textSize() are each calling one another +X move createFont() to PGraphics +X Fix PShape creation in P3D +X https://github.com/processing/processing/pull/3781 +X keyTyped() not firing with P2D and P3D +X https://github.com/processing/processing/issues/3582 +X https://github.com/processing/processing/pull/3652 +X Implement a way to disable automatic key repeat +X implemented for OpenGL, where key repeat is now disabled by default +X hint(ENABLE_KEY_REPEAT) will turn it back on +X https://github.com/processing/processing/issues/1622 +X non-standard cursor images used for OpenGL +X https://github.com/processing/processing/issues/3791 +X closed as cannot fix, but notes made in Wiki and in the repo +X fix late-breaking NPE in PGL +X https://github.com/processing/processing/pull/3792 + + +0243 core (3.0b5) +X NullPointerException in selectFolder() on OS X +X https://github.com/processing/processing/issues/3661 +X Wrong positioning of circles in SVG shapes (regression from 2) +X https://github.com/processing/processing/issues/3685 +X setFill() on PShape in Java2D throws ArrayIndexOutOfBoundsException +X https://github.com/processing/processing/issues/3677 +X saveJSONObject() doesn't close the file +X https://github.com/processing/processing/issues/3705 + +jakub +X keyTyped() not firing with P2D and P3D +X https://github.com/processing/processing/issues/3582 +X https://github.com/processing/processing/pull/3652 +X rect() sizing in JavaFX +X https://github.com/processing/processing/pull/3656 +X FX - Proper sketch sizing +X https://github.com/processing/processing/pull/3658 +X implement frameRate() +X FX - Fix key typed +X https://github.com/processing/processing/pull/3672 +X FX - Make key events little bit more sane +X https://github.com/processing/processing/pull/3686 +X added note about AIOOBE seen earlier +X Update LowLevelGL to use VBOs +X https://github.com/processing/processing-docs/pull/289 +X Remove legacy GL functions from PGL +X https://github.com/processing/processing/issues/3674 +X https://github.com/processing/processing/pull/3691 +X https://github.com/processing/processing/issues/3671 +X https://github.com/processing/processing/issues/3621 +X "Internal graphics not initialized yet" +X https://github.com/processing/processing/issues/3690 +X https://github.com/processing/processing/pull/3692 +X Remove support for fixed-function pipeline +X https://github.com/processing/processing/issues/3505 +X NullPointerException in Demos > Graphics > Planets +X https://github.com/processing/processing/issues/3551 +X turns out to be a problem with capitalization + +cleaning +X How do images behave when pixelDensity(2) is set? +X https://github.com/processing/processing/issues/3364 +X retina sketches slow to start +X https://github.com/processing/processing/issues/2357 +X zero alpha values still a problem with retina renderer +X https://github.com/processing/processing/issues/2030 +X fullScreen(SPAN) reported not working (cannot reproduce) +X probably need to re-query for displays each time opening prefs +X what happens when a screen is added after p5 has started? +X https://github.com/processing/processing/issues/3381 +X fixed in beta 1 + + 0242 core (3.0b4) X dataPath() not working when app is not run from app dir on Linux X https://github.com/processing/processing/issues/2195 @@ -85,7 +984,7 @@ X https://github.com/processing/processing/issues/324 X Jakub: fixed somewhere between 0179 and 0184 cleaning/fixed earlier -X splice() throws ClassCastException when used with objects like PVector +X splice() throws ClassCastException when used with objects like PVector X http://code.google.com/p/processing/issues/detail?id=1407 X https://github.com/processing/processing/issues/1445 o Semitransparent rect drawn over image not rendered correctly @@ -145,13 +1044,13 @@ X http://code.google.com/p/processing/issues/detail?id=146 X https://github.com/processing/processing/issues/185 X OPENGL sketches flicker w/ Vista when background() not used inside draw() X Disabling Aero scheme sometimes prevents the problem -X Updating graphics drivers may prevent the problem +X Updating graphics drivers may prevent the problem X ellipse scaling method isn't great X http://code.google.com/p/processing/issues/detail?id=87 X Stroking a rect() leaves off the upper right pixel X http://code.google.com/p/processing/issues/detail?id=67 X https://github.com/processing/processing/issues/106 -X opengl applet problems with tabs - needs to handle stop() and start() +X opengl applet problems with tabs - needs to handle stop() and start() X http://code.google.com/p/processing/issues/detail?id=196 X stop() called between tabs/pages, start() may be called again X http://java.sun.com/docs/books/tutorial/deployment/applet/lifeCycle.html @@ -185,7 +1084,7 @@ X Remove mode parameters from createShape(), fixes parameter collision issues X https://github.com/processing/processing/pull/3516 X radius for rect not working on PShape X https://github.com/processing/processing/issues/2646 -X bug in arc with createShape +X bug in arc with createShape X https://github.com/processing/processing/issues/3018 X OpenGL sketch flickers when draw() is missing or empty X https://github.com/processing/processing/issues/3473 @@ -194,7 +1093,7 @@ X size() errors X https://github.com/processing/processing/issues/3483 X improve hint(ENABLE_DEPTH_SORT) to use proper painter's algo X https://github.com/processing/processing/issues/90 -X also for begin/endRaw: +X also for begin/endRaw: X https://github.com/processing/processing/issues/2235 X polygon z-order depth sorting with alpha in opengl X complete the implementation of hint() with proper implementation @@ -239,7 +1138,7 @@ X Device parsing on Linux is incorrect X https://github.com/processing/processing/issues/3532 o don't show display warning when display 1 doesn't exist X apparently this was an OpenGL bug (#3532) -X flush geometry when lighting changes +X flush geometry when lighting changes X otherwise lights apply to the entire scene X https://github.com/processing/processing/issues/3533 @@ -257,10 +1156,10 @@ X https://github.com/processing/processing/issues/3378 X PGraphic ignores PNG transparency (regression from 3.0a5) X https://github.com/processing/processing/issues/3317 X (same issue as 3378) -X move error messages out of PConstants (into PApplet? PGraphics?) +X move error messages out of PConstants (into PApplet? PGraphics?) o replace sketchXxxx() methods with another mechanism? o and an internal dictionary that stores them all? -o intParam(), stringParam() and setParam()? +o intParam(), stringParam() and setParam()? o or sketchInt() or settingsInt()? o surface.size(), surface.noSmooth()... just like PGraphics methods? o make final to move folks away from these? @@ -369,7 +1268,7 @@ X Closing OpenGL sketch from the PDE doesn't stop java.exe process X https://github.com/processing/processing/issues/2335 cleaning -o keep Danger2D? +o keep Danger2D? o can't do version that draws to BufferStrategy directly o pixel operations (get/set/loadPixels/saveFrame) might be fixable o but can't re-run draw() to re-blit the screen @@ -381,7 +1280,7 @@ X decided to put efforts into JavaFX 0237 (3.0a10) X retain original java.awt.Frame when it's available from PSurfaceAWT -X set frame icon images for Java2D (dock and cmd-tab) +X set frame icon images for Java2D (dock and cmd-tab) X https://github.com/processing/processing/issues/257 X strokeWeight() in setup() not working for default renderer X https://github.com/processing/processing/issues/3331 @@ -453,7 +1352,7 @@ X size() inside setup() can only have numbers X size() inside settings() is left alone and can do whatever it wants X comments are being removed before size() is getting checked X probably remove anything inside settings() as well? -X looks like we're off by 1 on monitor numbering +X looks like we're off by 1 on monitor numbering X https://github.com/processing/processing/issues/3309 X full screen doesn't work on second window w/o present mode X https://github.com/processing/processing/issues/3271 @@ -496,7 +1395,7 @@ X https://github.com/processing/processing/issues/2125 X group shapes are broken in 3.0a9 X https://github.com/processing/processing/issues/3336 X only a quarter of the sketch is appearing with P2D_2X and P3D_2X -X (i.e. the image shows up too large) +X (i.e. the image shows up too large) X https://github.com/processing/processing/issues/3332 X https://github.com/processing/processing/issues/3327 X single transparent pixel at end of textures in OpenGL @@ -558,7 +1457,7 @@ X https://github.com/processing/processing/issues/3293 0235 (3.0a8) -X fairly major rewrite of createShape() +X fairly major rewrite of createShape() X prevents same code from appearing 5x (!) in the source X improves bad api design with the static createShapeImpl() methods X errors in case changes not correctly reported @@ -592,7 +1491,7 @@ X otherwise args == null checks are weird X saveFrame() from setup() gives a black screen when size() is called X as seen in the 'numbers' sketch X this was fixed earlier? -X fix flicker when resizing window +X fix flicker when resizing window X running through PSurfaceAWT.setSize() is probably overkill o setLocationRelativeTo(null) was removed, will it be missed? @@ -765,13 +1664,13 @@ X Linux throwing IllegalStateException: Buffers have not been created X in render() (called from blit) PSurfaceAWT:301 -0232 core (3.0a5) +0232 core (3.0a5) X detect CMYK JPEG images and return null X https://community.oracle.com/thread/1272045?start=0&tstart=0 X show a warning when calling getVertexCount() on GROUP or PRIMITIVE shapes X https://github.com/processing/processing/issues/2873 X https://github.com/processing/processing-docs/issues/167 -X replace is3D(boolean) with set3D() +X replace is3D(boolean) with set3D() data X fix XML.getString() with a default when no attrs are present at all @@ -838,7 +1737,7 @@ X update to new version of JOGL (Andres) 0230 core (3.0a3) X add another NaN check when sorting FloatList/Dict classes X if all values were NaN, an ArrayIndexOutOfBoundsException was thrown -X PShape for JAVA2D +X PShape for JAVA2D X https://github.com/processing/processing/pull/2756 X add trim() method to the XML library @@ -975,7 +1874,7 @@ X https://github.com/processing/processing/issues/2331 X https://github.com/processing/processing/pull/2338 X bug in relative moveto commands for SVG X https://github.com/processing/processing/issues/2377 -X Add a constructor to bind Server to a specific address +X Add a constructor to bind Server to a specific address X https://github.com/processing/processing/issues/2356 X add disconnectEvent() to Server X https://github.com/processing/processing/pull/2466 @@ -983,18 +1882,18 @@ X https://github.com/processing/processing/issues/2133 X don't document for now cleaning -o how much of com.benfry.* should go in? +o how much of com.benfry.* should go in? o Table? StringIntPairs? JSON? MD5? Integrator? ColorIntegrator? o decision: depends on if we can think of a good name X finished these up in the 2.x series o check on DXFWriter, since it used to subclass P3D -o at least implement is3D? +o at least implement is3D? X should be working, barring recent regression o sleep time needs to be set *much* higher for dormant applets o 10s should be fine--no need to keep spinning (bad for android too) o just call interrupt() when it's time to get back to work X applets removed -X test PGraphicsRetina2D w/ 7u40 +X test PGraphicsRetina2D w/ 7u40 X make sure that 7u40 doesn't reintroduce starvation issue on retina Macs X createGraphics() with no renderer param to point to JAVA2D X docs: P2D and P3D are now OpenGL variations @@ -1097,7 +1996,7 @@ X alpha values from the pixels array coming back as 0 X only tested on background(), not image() X https://github.com/processing/processing/issues/2030 -opengl +opengl X Using sketchQuality() does not work properly with P3D, OPENGL, P2D X https://github.com/processing/processing/pull/2157 X Fix crashes when the sketch window is resized @@ -1140,7 +2039,7 @@ X https://github.com/processing/processing/issues/2113 X constrain lerpColor() between 0 and 1 X JSONObject/Array.format(-1) not working on embedded JSONObjects X https://github.com/processing/processing/issues/2119 -X allow println() and print() to take varargs +X allow println() and print() to take varargs o https://github.com/processing/processing/issues/2056 X causes conflict with printing arrays X added printArray() function instead @@ -1238,7 +2137,7 @@ X Error in IntList and FloatList insert() X https://github.com/processing/processing/issues/1929 X selectInput() in exported OS X sketch treats .app package as a folder o Oracle Java 7 problem, but maybe a workaround? -o might be a problem with awt dialogs for directories? +o might be a problem with awt dialogs for directories? X https://github.com/processing/processing/issues/1959 X turns out this is an apple.awt tweak for the exported Info.plist X getSubset() broken in IntList, StringList, and missing from FloatList @@ -1254,7 +2153,7 @@ X add sum() to IntList and FloatList X https://github.com/processing/processing/issues/1893 X retain blendMode() between frames X https://github.com/processing/processing/issues/1962 -X this should actually be in the code.. +X this should actually be in the code.. X maybe not working on OS X/retina? X perhaps it's a getGraphics() issue? X when using increment() on IntList, make sure the index exists @@ -1277,7 +2176,7 @@ o require people to put things in the data folder table X add sort() to Table X implement version of Table that takes a dictionary file -X dictionary=blah.tsv +X dictionary=blah.tsv X tsv only, ignores extension X if allowed extension, we couldn't use .dict instead X and that's probably the most useful @@ -1386,7 +2285,7 @@ X switch to CATEGORY instead of CATEGORICAL X removed createXML() and createTable()... just use 'new' for these X implement means for setting dpi in PNG images X need to add something for API yet -o JAI handles setting image size for png (check javax.imageio?) +o JAI handles setting image size for png (check javax.imageio?) o PNGEncodeParam png = PNGEncodeParam.getDefaultEncodeParam(bufImage); o png.setPhysicalDimension(round(dpi*39.370079), round(dpi*39.370079), 1); o JAI.create("filestore", bufImage, filename+".png", "PNG"); @@ -1398,7 +2297,7 @@ X only call setModified(), not updatePixels() in endDraw() andres A lines not properly renderered in P3D when using ortographic projection A https://github.com/processing/processing/issues/1661 -A "deleted n framebuffer objects" +A "deleted n framebuffer objects" A last lines of a beginShape(LINES) are invisible in the P2D renderer A https://github.com/processing/processing/issues/1761 A Incorrect number of vertices on beginShape(TRIANGLES) affect subsequent Shapes @@ -1409,7 +2308,7 @@ A https://github.com/processing/processing/issues/1757 earlier X decision on registered methods X remove registerPre() et al -X add register("pause", ...) +X add register("pause", ...) X size() should be resize(), so it can be overridden (ala pause()) X add PEvent X need to wrap mouse/key events for p5 @@ -1460,17 +2359,17 @@ X api note: size() used in data classes X length() too confusing w/ array.length being built-in (when to use ()?) X size() a bit confusing with the p5 size command, but less problematic o also shorter than getCount() or getLength() -o why not HashMap and ArrayList for JSON? +o why not HashMap and ArrayList for JSON? o could enable loadHash() and loadArray() functions X because the types coming back out would always have to be cast o add loadDict() and loadList() for JSON? -o Dict and List could be interfaces? +o Dict and List could be interfaces? X "hash.toJSONObject()" or "new JSONObject(hash)" X opted to use "new JSONObject" version, appears less awkward o match? find? on StringList? X naming for descending sort -o rsort(), sortReverse(), sortKeysReverse, -o sortDescend, sortDescending, sortKeysDescending, +o rsort(), sortReverse(), sortKeysReverse, +o sortDescend, sortDescending, sortKeysDescending, o sortHighLow, sortHigh, sortHighest, sortDown X sortReverse() is the final decision @@ -1489,7 +2388,7 @@ o inc(), inc(amount), dec(), dec(amount) X replace (especially for null and NaN) X make note that these work, and are special cases o listAttributes() in XML is like array from keys() etc in our data classes -X removeIndex() vs removeValue() vs remove() +X removeIndex() vs removeValue() vs remove() X remove() refers to an index (with array) or key (with hash) X more consistent with other APIs (Java) X replaceValue[s]() the same, though more on the line @@ -1517,15 +2416,15 @@ X misc bugs with last release X https://github.com/processing/processing/issues/1660 X https://github.com/processing/processing/issues/1680 X Dan having trouble with JSON -X keys() vs keySet() in JSON.. +X keys() vs keySet() in JSON.. X keys() doesn't iterate, keySet() introduces 'Set' type X parseJSONObject(x) and parseJSONArray(x) table -X do we need getColumnType() inside TableRow? +X do we need getColumnType() inside TableRow? X also inside Table X also do we make the constants public? -X table writing twice when .csv is added +X table writing twice when .csv is added X https://github.com/processing/processing/issues/1734 X checkOptions() is a mess.. need to use different options for load/save X rewrite it as necessary @@ -1536,7 +2435,7 @@ X handling gz properly, but gz has to be the extension X adding it to options is too messy o add 'gz' as one of the loadXxx() options o helps .svgz case from being weird, also generally dealing w/ compressed data -X include SQL, HTML, ODS, binary? +X include SQL, HTML, ODS, binary? X decide on TableODS, TableHTML X HTML is out--too confusing X ODS is in for loading, and finished @@ -1579,7 +2478,7 @@ o when using loadFont(), don't enable native fonts unless hint() in use o but on createFont(), we're probably OK o might need to make reference notes about the two behaviors X decision: remove hint(ENABLE_NATIVE_FONTS) -X PImage.resize() greater than image size hangs +X PImage.resize() greater than image size hangs X http://code.google.com/p/processing/issues/detail?id=1463 X turns out to be errata from the book X add warning message when registering AWT mouse/key events @@ -1697,7 +2596,7 @@ X makeEmptyNull() -> replace("", null); X saveTable("filename.tsv") or saveTable("filename.txt", "tsv") X createTable() method in PApplet X removed getUniqueXxxx() and some others, pending names -X added listUnique() and tallyUnique() +X added listUnique() and tallyUnique() X added getColumnCount() to TableRow X cleaned up checkBounds() @@ -1715,15 +2614,15 @@ o isWhitespace() method for nodes? (that's the capitalization used in Character) X doesn't help much o get back to PhiLho once finished X XML toString(0) means no indents or newlines -X but no way to remove indents and still have newlines... +X but no way to remove indents and still have newlines... X toString(-1)? a new method? X format(2), format(4)... toString() -> default to 2 params X fix this across the other items X look into json and how it would work wrt XML -o 1) we bring back getFloatAttribute() et al., +o 1) we bring back getFloatAttribute() et al., o and make getFloat() be equivalent to parseFloat(xml.getContent()) o 2) we keep getFloat() like it is, and add getFloatContent(), etc. -o 3) we deprecate our nice short getFloat/getInt/etc and go with +o 3) we deprecate our nice short getFloat/getInt/etc and go with o getXxxxAttribute() and getXxxxContent() methods. X not gonna do getFloatContent() since it's not really any shorter X beginning slash in getChild() threw an NPE @@ -1737,7 +2636,7 @@ X change to getRows() method for iterating through the Table object X add parseInto() method (provisional) X change translate() and rotate() to use x, y, z as param names o opengl.jar with eclipse -o auto-extract native libs from opengl.jar +o auto-extract native libs from opengl.jar o to remove java.library.path problems (!) X no longer necessary, JOGL does this by default X implement clip()/noClip() @@ -1784,7 +2683,7 @@ X make note for Casey to include this in the reference X Potential race condition when resizing sketches X http://code.google.com/p/processing/issues/detail?id=697 X removed mask(int[]).. check reference to make sure it's not in use -X how to handle get(x, y, w, h) when off screen? +X how to handle get(x, y, w, h) when off screen? X http://code.google.com/p/processing/issues/detail?id=925 A curves aren't rendered seperately when P3D or P2D is specified A http://code.google.com/p/processing/issues/detail?id=1317 @@ -1832,7 +2731,7 @@ X change name for hint() that controls stroke/fill combo: andres (cleanup) A when turning smoothing on, internal lines of shapes are visible -o add an edge flag when tesselating +o add an edge flag when tesselating o mind the opengl tesselation flags o need to turn off smoothing for the interior of shapes A http://code.google.com/p/processing/issues/detail?id=53 @@ -1888,7 +2787,7 @@ o loading lots of images is a problem, describe how to unload o is it possible? necessary to call delay(5) or something? events -X make sure alt/ctl/meta/etc all work (for both mouse and key) +X make sure alt/ctl/meta/etc all work (for both mouse and key) X remove thread blocking when dequeueing events X finish postEvent() X need to make events interleave @@ -1966,7 +2865,7 @@ A Using ortho() breaks stroke rendering A http://code.google.com/p/processing/issues/detail?id=1207 earlier -A Implement support for complex shapes when using the OpenGL renderer +A Implement support for complex shapes when using the OpenGL renderer A in opengl mode, use its tesselator A because the vertex calls can just come right back to regular vertex calls A this way we can also implement breakShape() for opengl @@ -1981,7 +2880,7 @@ A http://code.google.com/p/processing/issues/detail?id=902 A updatePixels wth OpenGL requires a lot of memory, need better texture update A http://code.google.com/p/processing/issues/detail?id=77 A text characters showing up as opaque rectangles in tga files -o solution is to implement alpha compositing across all of P3D +o solution is to implement alpha compositing across all of P3D o http://en.wikipedia.org/wiki/Alpha_compositing A http://code.google.com/p/processing/issues/detail?id=80 A changing framerate causes program to crash with P2D in 2.0a6 @@ -2006,13 +2905,13 @@ X provide a way to clear the PGraphics with plain alpha X removed in the end... background() can already do it X work on making API more generic and consistent X PFont.getFont() changed to PFont.getNative() (returns an Object) -X PFont.getTypeface() changed to PFont.getNative() +X PFont.getTypeface() changed to PFont.getNative() X PImage.getBitmap() and getImage() changed to PImage.getNative() X use getNative() to return the native object for X PImage (BufferedImage and Bitmap), PFont (Typeface or awt.Font) X Jagged / Glitchy JAVA2D shape strokes in Java 1.6 -X g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, -X RenderingHints.VALUE_STROKE_PURE); +X g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, +X RenderingHints.VALUE_STROKE_PURE); X http://code.google.com/p/processing/issues/detail?id=1068 X loadShape() cleanup A remove PShape2D/3D @@ -2068,7 +2967,7 @@ X broken in the recent releases X http://code.google.com/p/processing/issues/detail?id=1157 fixed earlier -A ArrayIndexOutOfBoundsException inside PFontTexture.updateGlyphsTexCoords() +A ArrayIndexOutOfBoundsException inside PFontTexture.updateGlyphsTexCoords() A http://code.google.com/p/processing/issues/detail?id=1104 A Camera function hot changing the upward axis A http://code.google.com/p/processing/issues/detail?id=534 @@ -2126,7 +3025,7 @@ o otherwise can crash the whole browser o z value hack for lines is causing trouble for 2D o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1089737928;start=0 o rewrite line and stroke code, it's a buggy mess -o lines become 2 pixels thick after a 3D transform +o lines become 2 pixels thick after a 3D transform o better handling of single-pixel special case o flat_line_retribution is a hack, can go away o some optimizations from zach @@ -2137,7 +3036,7 @@ o one pixel lines have no z value.. argh o bug re: 3d depth sorting on lines o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1043894019;start=0 o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1042004618 -o translate(58, 48, 0); +o translate(58, 48, 0); o rotateY(0.5); o box(40); o cursor() broken in applets on macosx? @@ -2158,7 +3057,7 @@ X createGraphics for JAVA2D generates the wrong error msg w/ w/h <= 0 X http://code.google.com/p/processing/issues/detail?id=983 X move to processing.data.* package X update the internal code for Android and desktop to add the import -X add loadTable().. +X add loadTable().. X loadXML and loadTable are now in desktop o trimming text on URLs? o http://code.google.com/p/processing/issues/detail?id=715 @@ -2167,7 +3066,7 @@ X update wiki.processing.org/w/Window_Size_and_Full_Screen X add createGraphics() with no renderer param to point to JAVA2D X also added to Android X removals -X CENTER_RADIUS, CENTER_DIAMETER, NORMALIZED +X CENTER_RADIUS, CENTER_DIAMETER, NORMALIZED X text(x, y, w, h, z) X textX/Y/Z variables X update changes Wiki @@ -2178,7 +3077,7 @@ X it hasn't worked for a while, also not a good way to get updates on size X use pre() or something like that instead o displayWidth/Height not set until just before setup o don't use size(displayWidth, displayHeight) anymore -o to do full screen, should use: +o to do full screen, should use: X did not work well andres @@ -2231,7 +3130,7 @@ o should this be the default to be more like old XML? o otherwise document how things are sometimes null in XML o test xml examples to see if they break X changed to make it return #text for the name, which is more correct -X white space in XML +X white space in XML X http://code.google.com/p/processing/issues/detail?id=975 o finish updating XML documentation o http://code.google.com/p/processing/issues/detail?id=382 @@ -2253,10 +3152,10 @@ X several other items under the LIBRARIES / XML section below sort out full screen issues X make screenWidth and screenHeight work properly with multiple screens X also set screenX and screenY -X boolean sketchFullscreen() ? +X boolean sketchFullscreen() ? X for more options, just integrate the fs library? X let hansi know when it's integrated so he can update his library -X casey: I think we only want to most basic functionality, +X casey: I think we only want to most basic functionality, X to go full screen across monitors. X http://www.superduper.org/processing/fullscreen_api/ X https://github.com/kritzikratzi/jAppleMenuBar/blob/master/src/native/jAppleMenuBar.m @@ -2289,7 +3188,7 @@ X frame.setSize() works, but we aren't going to add the title bar back X just too problematic and buggy to get this to work perfectly X default is that full screen app doesn't cover multiple displays X this is fine since opengl can't usually go across both -o but include an example for how to use full in gl +o but include an example for how to use full in gl o full screen not working on snow leopard X fix build script to include the jnilib, also add more error checks X screenX and screenY are both already taken, so not including vars for them @@ -2297,7 +3196,7 @@ X decide on naming for the next release 0204 core (2.0a5) -X Abnormal high Java CPU usage at empty sketch with draw() +X Abnormal high Java CPU usage at empty sketch with draw() X http://code.google.com/p/processing/issues/detail?id=729 X https://forum.processing.org/topic/absurd-java-cpu-usage-at-empty-sketch-with-draw X "Framingham" example has BufferOverflowException @@ -2326,7 +3225,7 @@ X remove textMode(SCREEN) o is it possible to do decent vlw text with JAVA2D and OPENGL? o optimize textMode(MODEL) with textMode(SCREEN) o in PGraphics and PGraphics3, check to see if matrix is within epsilon -o of one of the rotation matrices (many fewer steps) +o of one of the rotation matrices (many fewer steps) o if identity, or just translate, or a rotate, make OBJECT into SCREEN o textMode(SCREEN) needs to be faster o need flat image implementation that takes no transforms @@ -2381,7 +3280,7 @@ X add orientation() no-op and the two constants 0198 core -o arrayobjects (and others) flicker like hell in chrome 10 +o arrayobjects (and others) flicker like hell in chrome 10 o http://code.google.com/p/processing/issues/detail?id=646 o http://code.google.com/p/chromium/issues/detail?id=62004 o http://code.google.com/p/chromium/issues/detail?id=79939 @@ -2435,10 +3334,10 @@ A implement repeating textures A http://code.google.com/p/processing/issues/detail?id=94 o add a limit to pushStyle() to catch unmatched sets? X http://code.google.com/p/processing/issues/detail?id=198 -X how should quadVertex() be named? bezierVertex() quadraticVertex() +X how should quadVertex() be named? bezierVertex() quadraticVertex() X decision: quadraticVertex() to avoid confusion with quads X more efficient version of copy() added for 2D -X rounded rectangle method +X rounded rectangle method X http://code.google.com/p/processing/issues/detail?id=265 X clockwise from upper-left X check with casey about finalizing and adding to the docs @@ -2456,20 +3355,20 @@ X http://code.google.com/p/processing/issues/detail?id=455 X decision: post() only gets called in draw, not setup.. document opengl applets -X implement new applet-opengl.html based on the latest jogl +X implement new applet-opengl.html based on the latest jogl o jogl demos, NEWT examples crash on osx http://jogamp.org/jogl-demos/www/ o http://jogamp.org/jogl-demos/www/applettest-jnlp.html X not sure why these do/don't work, but it's mostly working X OpenGL Applets won't load with JRE 6 update 21 or higher X need to make the final call on this and implement X http://code.google.com/p/processing/issues/detail?id=429 -o why we can't do OpenGL applets that are self-signed (wiki?) +o why we can't do OpenGL applets that are self-signed (wiki?) o http://www.cert.org/blogs/vuls/2008/06/signed_java_security_worse_tha.html cleanup o if too many errors come through during setup, app will terminate o printStackTrace() throttles on osx and poops out -o seen especially on old mac laptops (slow ppc garbage) +o seen especially on old mac laptops (slow ppc garbage) o can this be confirmed properly? o * this may just be an OutOfMemoryError happening o when drawing into a JAVA2D surface, have to call loadPixels() @@ -2489,9 +3388,9 @@ o filter() checks to see if inside begin/endPixels, if so doesn't call o if line() is called inside beginpixels, call updatepixels? o when NPE on line with pixels[], suggest user includes beginPixels o need to test/straighten out load/update pixels -o loadPixels() and updatePixels() only need to be used when +o loadPixels() and updatePixels() only need to be used when o touching pixels[]. All other functions including get(), set(), -o filter(), etc shouldn't need them. +o filter(), etc shouldn't need them. o image memory use.. how to handle lots of images o need to figure out exactly how they should/can unload o don't do a loadPixels unless an updatePixels has completed @@ -2607,7 +3506,7 @@ o i.e. ABGR_EXT might allow for just two shifts instead of 4 o allow access to native pixel buffer in opengl and power of 2 o so that no need to copy/update everything o how to handle gluTessVertex calls -o need to re-map through the regular "vertex" command, +o need to re-map through the regular "vertex" command, o but that makes things messy because the glu calls make calls to vertex() o and i don't want an additional "pathVertex()" function o with opengl optimizations via call lists.. @@ -2641,7 +3540,7 @@ o Stroked polygons losing stroke pixels due to z-buffer issues in P3D o http://code.google.com/p/processing/issues/detail?id=73 X refactor PApplet.main() and Runner.startInternal() to remove duplication X http://dev.processing.org/bugs/show_bug.cgi?id=245 -o PFont.size not available.. other font accessors? +o PFont.size not available.. other font accessors? o http://dev.processing.org/bugs/show_bug.cgi?id=1510 o implement method for lightweight components with processing applets o http://dev.processing.org/bugs/show_bug.cgi?id=686 @@ -2674,7 +3573,7 @@ X i.e. some fonts don't work with PDF, or bg color can't be re-set X clean up filter stuff? X filter(GRAY) -> to push things to luminosity-based gray X already implemented this way -o filter(MASK, ...) -> or ALPHA? +o filter(MASK, ...) -> or ALPHA? o filter(TINT, tintColor) X decision: use luminosity for gray X decision: tinting is usually for a dynamic thing, so not necessary @@ -2705,8 +3604,8 @@ o even if not actually working properly.. just in naming of things o sorting of polygons/lines on simple painters algorithm o better lighting model to show darkness at various depths o maybe just ultra-high res bitmaps from gl -o cairo tesselation used: -o John Hobby, Practical Segment Intersection with Finite Precision Output. +o cairo tesselation used: +o John Hobby, Practical Segment Intersection with Finite Precision Output. o Computational Geometry Theory and Application, 13(4), 1999. o http://citeseer.ist.psu.edu/hobby93practical.html o textMode(SHAPE) and textMode(IMAGE)? @@ -2717,7 +3616,7 @@ o or use a getXxxx() method? o in PShape, getChild(name) refers to a o however in an XML file, that's , meaning the name of the tag o change it to getShape(name)? also for fonts getShape(char c) -o decision: use getShape() (maybe add getShapeCount and getShape(int)) +o decision: use getShape() (maybe add getShapeCount and getShape(int)) o and remove getChild() from PShape o oops: getParent() is in there, as is getChildren() and others... o svg examples should use getShape(name) not getChild(name) @@ -2853,7 +3752,7 @@ X workaround from Christian Thiemann X http://code.google.com/p/processing/issues/detail?id=467 stop/destroy/dispose -L stop() not working very well +L stop() not working very well L as a result, dispose() methods aren't being called on libraries L http://dev.processing.org/bugs/show_bug.cgi?id=131 L http://dev.processing.org/bugs/show_bug.cgi?id=77 (dupe) @@ -2866,13 +3765,13 @@ L http://code.google.com/p/processing/issues/detail?id=180 0191 core (pre) X fix background(PImage) for OpenGL X http://code.google.com/p/processing/issues/detail?id=336 -X skip null entries with trim(String[]) +X skip null entries with trim(String[]) X NaN with PVector.angleBetween X http://code.google.com/p/processing/issues/detail?id=340 X fix missing getFloat() method in XML library X setAttribute? setString/Int/Float or just set? X get() set() methods are confusing.. too spare -X make sure that paths are created with saveStream() +X make sure that paths are created with saveStream() X make createWriter() use buffering X saveStream() doesn't work when intermediate directories don't exist @@ -2986,7 +3885,7 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=1174 0181 core (pre-release) -X no changes for 0181 +X no changes for 0181 0180 core (pre-release) @@ -3004,7 +3903,7 @@ X cache font information for the PDF library to improve setup time X when using createFont("xxxx.ttf"), should use textMode(SHAPE) with PDF X because ttf files will not be installed on the system when opening pdf X added error messages for users -X bring back old-style textAscent() +X bring back old-style textAscent() X needs to just quickly run characters d and p X only takes a couple ms, so no problem X pdf library @@ -3054,7 +3953,7 @@ X probably regression b/c camera/perspective can't be called then X http://dev.processing.org/bugs/show_bug.cgi?id=1391 -0175 core (private) +0175 core (private) X changed createInputRaw() to only bother checking URLs if : present @@ -3064,13 +3963,13 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=1408 0173 core (private) -X Re-enabled hack for temporary clipping. +X Re-enabled hack for temporary clipping. X Clipping still needs to be implemented properly, however. Please help! X http://dev.processing.org/bugs/show_bug.cgi?id=1393 0172 core (private) -X no changes to the core (or were there?) +X no changes to the core (or were there?) 0171 core (1.0.9) @@ -3082,11 +3981,11 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=1352 0170 core (1.0.8) X added some min/max functions that work with doubles X not sure if those are staying in or not -X filter(RGB) supposed to be filter(OPAQUE) +X filter(RGB) supposed to be filter(OPAQUE) X http://dev.processing.org/bugs/show_bug.cgi?id=1346 X implement non-power-of-2 textures X fix get() when used with save() in OpenGL mode -X immediately update projection with OpenGL +X immediately update projection with OpenGL X in the past, projection updates required a new frame X also prevents camera/project from being reset with setSize() (regression?) X which was a problem anyway because it made GL calls outside draw() @@ -3126,7 +4025,7 @@ X set() doesn't honor alpha consistently X also causes problems with PDF X preliminary thread() implementation X double param version of map() -X PImage cacheMap problem when using PImage.get() +X PImage cacheMap problem when using PImage.get() X http://dev.processing.org/bugs/show_bug.cgi?id=1245 X problems with > 512 points and P3D/OPENGL (thx DopeShow) X http://dev.processing.org/bugs/show_bug.cgi?id=1255 @@ -3162,7 +4061,7 @@ 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 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 @@ -3182,7 +4081,7 @@ 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 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 @@ -3265,7 +4164,7 @@ 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 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 @@ -3326,7 +4225,7 @@ 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 remove copy() from PVector? X add mult() and div() with vector inputs? @@ -3412,7 +4311,7 @@ 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 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 @@ -3514,7 +4413,7 @@ 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 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 @@ -3544,7 +4443,7 @@ 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 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 @@ -3668,13 +4567,13 @@ 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 +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 glLightNoAmbient() which then creates a new FloatBuffer X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1199376364 @@ -3684,7 +4583,7 @@ 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 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? @@ -3729,7 +4628,7 @@ 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 add createOutput() X deprecate openStream() naming @@ -3744,7 +4643,7 @@ 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 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 @@ -3770,7 +4669,7 @@ 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 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) @@ -3782,7 +4681,7 @@ 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 +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 @@ -3850,7 +4749,7 @@ 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 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? @@ -3898,7 +4797,7 @@ 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 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 @@ -3907,15 +4806,15 @@ 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 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 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 @@ -3985,7 +4884,7 @@ 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 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 @@ -4042,7 +4941,7 @@ 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 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 @@ -4087,8 +4986,8 @@ 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 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 @@ -4096,7 +4995,7 @@ 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 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?) @@ -4119,7 +5018,7 @@ 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 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 @@ -4138,7 +5037,7 @@ 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 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 @@ -4159,21 +5058,21 @@ 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 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 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 screen, color dodge; overlay, soft light, hard light; X difference, exclusion; hue, sat, color, luminosity -X director: Copy, Transparent, Reverse, Ghost, Not copy, +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 flash: X DIFFERENCE: C = abs(A-B); X MULTIPLY: C = (A * B ) / 255 X SCREEN: C= 255 - ( (255-A) * (255-B) / 255 ) @@ -4195,11 +5094,11 @@ 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 +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 [0] "potato", [1] "tomato", [2] "apple" X fix filter(GRAY) on an ALPHA image to produce a good RGB image 0125p2 @@ -4221,7 +5120,7 @@ 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 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 @@ -4230,7 +5129,7 @@ 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 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? @@ -4253,7 +5152,7 @@ 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 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 @@ -4321,7 +5220,7 @@ 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 saveStrings(filename, strings, count) o otherwise the save is kinda wonky o or maybe that should just be done with the array fxns @@ -4330,14 +5229,14 @@ 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 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 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. @@ -4373,14 +5272,14 @@ 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 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 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 @@ -4393,7 +5292,7 @@ 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 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 @@ -4409,7 +5308,7 @@ 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 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 @@ -4496,7 +5395,7 @@ 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 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); @@ -4554,7 +5453,7 @@ 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 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 @@ -4577,13 +5476,13 @@ 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 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? +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 @@ -4634,7 +5533,7 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=260 0114 core -X added createGraphics(width, height, renderer) +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 @@ -4664,7 +5563,7 @@ 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 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 @@ -4672,26 +5571,26 @@ 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 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 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 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 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) @@ -4702,7 +5601,7 @@ X need to just remove PSound altogether 0111 core -X need to have a better way of getting/figuring out the endian +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 @@ -4797,12 +5696,12 @@ 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 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 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? @@ -4814,13 +5713,13 @@ 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 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 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 @@ -4922,7 +5821,7 @@ 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 +X undo the fix that causes the width/height to be properly set 0094 core @@ -4933,7 +5832,7 @@ X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action 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 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 @@ -4995,7 +5894,7 @@ 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 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? @@ -5021,13 +5920,13 @@ X add ability to draw text from the current text position 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 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 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 @@ -5058,7 +5957,7 @@ X no changes since 88 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 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 @@ -5189,9 +6088,9 @@ 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 preApplyMatrix, invApplyMatrix? o applyMatrixPre and applyMatrixIn -o rotateXInv is ugly.. +o rotateXInv is ugly.. o irotateX?, papplyMatrix? wednesday evening @@ -5201,7 +6100,7 @@ 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 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 @@ -5218,7 +6117,7 @@ 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 no, cuz it doesn't do much really.. X fromX-toX etc is all that's different thursday day @@ -5230,12 +6129,12 @@ 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? +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 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) @@ -5252,12 +6151,12 @@ 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 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 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 @@ -5267,7 +6166,7 @@ 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 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 @@ -5316,7 +6215,7 @@ 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 +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 @@ -5326,8 +6225,8 @@ 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? +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 @@ -5342,7 +6241,7 @@ 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 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 @@ -5359,13 +6258,13 @@ 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 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 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 @@ -5388,7 +6287,7 @@ 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? +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 @@ -5401,7 +6300,7 @@ 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? +o remove SCREEN_SPACE altogether? X can't do this for now implemented in 79 @@ -5477,14 +6376,14 @@ 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). +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); +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 colorMode(GRAY) to avoid stroke(0) causing trouble? o or maybe get rid of stroke(0)? hrm @@ -5550,9 +6449,9 @@ 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 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 @@ -5586,7 +6485,7 @@ 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), +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? @@ -5638,7 +6537,7 @@ 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 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() @@ -5656,7 +6555,7 @@ 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 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? @@ -5689,15 +6588,15 @@ 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 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 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 @@ -5715,7 +6614,7 @@ 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 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 @@ -5770,7 +6669,7 @@ 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 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 @@ -5830,7 +6729,7 @@ 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 sphere code needs only front face polygon o all triangles must be counter-clockwise (front-facing) X fix loadImage to be inside PApplet @@ -5872,10 +6771,10 @@ 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 +040725 X fix array functions not returning a value -040726 +040726 X noiseSeed and randomSeed X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1090749784;start=0 @@ -5886,15 +6785,15 @@ X incorporated NO_FLYING_POO line/poly hack developed for axel 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 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 +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 The biggest problem was the key and mouse functions not working. X Input: Mouse_Functions X Input: Keyboard_Functions X processing.net -> PClient, PServer @@ -5916,7 +6815,7 @@ X loop/noLoop setup 040920 X make loop/noLoop work properly X fixes/changes to key and mousehandling -X tab key not working? +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 @@ -5934,7 +6833,7 @@ X otherwise noLoop() in setup means no drawing happens at all 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 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 @@ -5945,7 +6844,7 @@ 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 +040922 X get library stuff debugged X port arcball and finish up dxf writer X beginCamera() no longer sets an identity matrix @@ -5981,7 +6880,7 @@ 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 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 diff --git a/core/library/export.txt b/core/library/export.txt index 88d0bc274b..a750489709 100644 --- a/core/library/export.txt +++ b/core/library/export.txt @@ -8,4 +8,5 @@ application.windows32=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-wind application.windows64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-windows-amd64.jar,gluegen-rt-natives-windows-amd64.jar application.linux32=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-i586.jar,gluegen-rt-natives-linux-i586.jar application.linux64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-amd64.jar,gluegen-rt-natives-linux-amd64.jar -application.linux-armv6hf=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-armv6hf.jar,gluegen-rt-natives-linux-armv6hf.jar \ No newline at end of file +application.linux-armv6hf=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-armv6hf.jar,gluegen-rt-natives-linux-armv6hf.jar +application.linux-arm64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-aarch64.jar,gluegen-rt-natives-linux-aarch64.jar diff --git a/core/library/gluegen-java-src.zip b/core/library/gluegen-java-src.zip deleted file mode 100644 index a5201e5083..0000000000 Binary files a/core/library/gluegen-java-src.zip and /dev/null differ diff --git a/core/library/gluegen-rt-natives-linux-aarch64.jar b/core/library/gluegen-rt-natives-linux-aarch64.jar new file mode 100644 index 0000000000..94c6d5e27b Binary files /dev/null and b/core/library/gluegen-rt-natives-linux-aarch64.jar differ diff --git a/core/library/gluegen-rt-natives-linux-amd64.jar b/core/library/gluegen-rt-natives-linux-amd64.jar index f37123b80d..a2466f418a 100644 Binary files a/core/library/gluegen-rt-natives-linux-amd64.jar and b/core/library/gluegen-rt-natives-linux-amd64.jar differ diff --git a/core/library/gluegen-rt-natives-linux-armv6hf.jar b/core/library/gluegen-rt-natives-linux-armv6hf.jar index da8766bf8e..5ef06731cc 100644 Binary files a/core/library/gluegen-rt-natives-linux-armv6hf.jar and b/core/library/gluegen-rt-natives-linux-armv6hf.jar differ diff --git a/core/library/gluegen-rt-natives-linux-i586.jar b/core/library/gluegen-rt-natives-linux-i586.jar index d6d6b7b990..914a259d0d 100644 Binary files a/core/library/gluegen-rt-natives-linux-i586.jar and b/core/library/gluegen-rt-natives-linux-i586.jar differ diff --git a/core/library/gluegen-rt-natives-macosx-universal.jar b/core/library/gluegen-rt-natives-macosx-universal.jar index d6b8be2756..15df5e8200 100644 Binary files a/core/library/gluegen-rt-natives-macosx-universal.jar and b/core/library/gluegen-rt-natives-macosx-universal.jar differ diff --git a/core/library/gluegen-rt-natives-windows-amd64.jar b/core/library/gluegen-rt-natives-windows-amd64.jar index 5e403c6988..517fb84c74 100644 Binary files a/core/library/gluegen-rt-natives-windows-amd64.jar and b/core/library/gluegen-rt-natives-windows-amd64.jar differ diff --git a/core/library/gluegen-rt-natives-windows-i586.jar b/core/library/gluegen-rt-natives-windows-i586.jar index 18f4468a8c..1c393b7846 100644 Binary files a/core/library/gluegen-rt-natives-windows-i586.jar and b/core/library/gluegen-rt-natives-windows-i586.jar differ diff --git a/core/library/gluegen-rt.jar b/core/library/gluegen-rt.jar index 94d84dedcf..742fdb26b6 100644 Binary files a/core/library/gluegen-rt.jar and b/core/library/gluegen-rt.jar differ diff --git a/core/library/jogl-all-natives-linux-aarch64.jar b/core/library/jogl-all-natives-linux-aarch64.jar new file mode 100644 index 0000000000..c856f34c2c Binary files /dev/null and b/core/library/jogl-all-natives-linux-aarch64.jar differ diff --git a/core/library/jogl-all-natives-linux-amd64.jar b/core/library/jogl-all-natives-linux-amd64.jar index 9de01d4252..e57b8c7c0b 100644 Binary files a/core/library/jogl-all-natives-linux-amd64.jar and b/core/library/jogl-all-natives-linux-amd64.jar differ diff --git a/core/library/jogl-all-natives-linux-armv6hf.jar b/core/library/jogl-all-natives-linux-armv6hf.jar index 50ec0525f4..5aea1b2f49 100644 Binary files a/core/library/jogl-all-natives-linux-armv6hf.jar and b/core/library/jogl-all-natives-linux-armv6hf.jar differ diff --git a/core/library/jogl-all-natives-linux-i586.jar b/core/library/jogl-all-natives-linux-i586.jar index 5f3668fa9f..88a27ce73f 100644 Binary files a/core/library/jogl-all-natives-linux-i586.jar and b/core/library/jogl-all-natives-linux-i586.jar differ diff --git a/core/library/jogl-all-natives-macosx-universal.jar b/core/library/jogl-all-natives-macosx-universal.jar index 2dc35e3096..c65ea9953b 100644 Binary files a/core/library/jogl-all-natives-macosx-universal.jar and b/core/library/jogl-all-natives-macosx-universal.jar differ diff --git a/core/library/jogl-all-natives-windows-amd64.jar b/core/library/jogl-all-natives-windows-amd64.jar index 888b2cd8c0..9577bf1d05 100644 Binary files a/core/library/jogl-all-natives-windows-amd64.jar and b/core/library/jogl-all-natives-windows-amd64.jar differ diff --git a/core/library/jogl-all-natives-windows-i586.jar b/core/library/jogl-all-natives-windows-i586.jar index 765f87dffa..4439f1dcc5 100644 Binary files a/core/library/jogl-all-natives-windows-i586.jar and b/core/library/jogl-all-natives-windows-i586.jar differ diff --git a/core/library/jogl-all.jar b/core/library/jogl-all.jar index b8aed20cdf..970a7dead9 100644 Binary files a/core/library/jogl-all.jar and b/core/library/jogl-all.jar differ diff --git a/core/library/jogl-java-src.zip b/core/library/jogl-java-src.zip deleted file mode 100644 index 475d50cce3..0000000000 Binary files a/core/library/jogl-java-src.zip and /dev/null differ diff --git a/core/methods/build.xml b/core/methods/build.xml index 11445102d4..36ed65ceda 100644 --- a/core/methods/build.xml +++ b/core/methods/build.xml @@ -15,8 +15,8 @@ - > 24) & 0xff; // System.out.println("tint color is " + a2); @@ -1682,8 +1707,8 @@ public void update(PImage source, boolean tint, int tintColor) { // The target image is opaque, meaning that the source image has no // alpha (is not ARGB), and the tint has no alpha. int index = 0; - for (int y = 0; y < source.height; y++) { - for (int x = 0; x < source.width; x++) { + for (int y = 0; y < source.pixelHeight; y++) { + for (int x = 0; x < source.pixelWidth; x++) { int argb1 = source.pixels[index++]; int r1 = (argb1 >> 16) & 0xff; int g1 = (argb1 >> 8) & 0xff; @@ -1697,7 +1722,7 @@ public void update(PImage source, boolean tint, int tintColor) { ((g2 * g1) & 0xff00) | (((b2 * b1) & 0xff00) >> 8); } - wr.setDataElements(0, y, source.width, 1, tintedTemp); + wr.setDataElements(0, y, source.pixelWidth, 1, tintedTemp); } // could this be any slower? // float[] scales = { tintR, tintG, tintB }; @@ -1711,18 +1736,18 @@ public void update(PImage source, boolean tint, int tintColor) { (tintColor & 0xffffff) == 0xffffff) { int hi = tintColor & 0xff000000; int index = 0; - for (int y = 0; y < source.height; y++) { - for (int x = 0; x < source.width; x++) { + for (int y = 0; y < source.pixelHeight; y++) { + for (int x = 0; x < source.pixelWidth; x++) { tintedTemp[x] = hi | (source.pixels[index++] & 0xFFFFFF); } - wr.setDataElements(0, y, source.width, 1, tintedTemp); + wr.setDataElements(0, y, source.pixelWidth, 1, tintedTemp); } } else { int index = 0; - for (int y = 0; y < source.height; y++) { + for (int y = 0; y < source.pixelHeight; y++) { if (source.format == RGB) { int alpha = tintColor & 0xFF000000; - for (int x = 0; x < source.width; x++) { + for (int x = 0; x < source.pixelWidth; x++) { int argb1 = source.pixels[index++]; int r1 = (argb1 >> 16) & 0xff; int g1 = (argb1 >> 8) & 0xff; @@ -1733,7 +1758,7 @@ public void update(PImage source, boolean tint, int tintColor) { (((b2 * b1) & 0xff00) >> 8); } } else if (source.format == ARGB) { - for (int x = 0; x < source.width; x++) { + for (int x = 0; x < source.pixelWidth; x++) { int argb1 = source.pixels[index++]; int a1 = (argb1 >> 24) & 0xff; int r1 = (argb1 >> 16) & 0xff; @@ -1747,13 +1772,13 @@ public void update(PImage source, boolean tint, int tintColor) { } } else if (source.format == ALPHA) { int lower = tintColor & 0xFFFFFF; - for (int x = 0; x < source.width; x++) { + for (int x = 0; x < source.pixelWidth; x++) { int a1 = source.pixels[index++]; tintedTemp[x] = (((a2 * a1) & 0xff00) << 16) | lower; } } - wr.setDataElements(0, y, source.width, 1, tintedTemp); + wr.setDataElements(0, y, source.pixelWidth, 1, tintedTemp); } } // Not sure why ARGB images take the scales in this order... @@ -1773,7 +1798,7 @@ public void update(PImage source, boolean tint, int tintColor) { // in a PImage and how the high bits will be set. } // If no tint, just shove the pixels on in there verbatim - wr.setDataElements(0, 0, source.width, source.height, source.pixels); + wr.setDataElements(0, 0, source.pixelWidth, source.pixelHeight, source.pixels); } this.tinted = tint; this.tintedColor = tintColor; @@ -1889,49 +1914,41 @@ protected boolean textModeCheck(int mode) { /** * Same as parent, but override for native version of the font. *

- * Also gets called by textFont, so the metrics + * Called from textFontImpl and textSizeImpl, so the metrics * will get recorded properly. */ @Override - public void textSize(float size) { - if (textFont == null) { - defaultFontOrDeath("textSize", size); - } - + protected void handleTextSize(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 = (Font) textFont.getNative(); - //if (font != null && (textFont.isStream() || hints[ENABLE_NATIVE_FONTS])) { + // don't derive again if the font size has not changed if (font != null) { - Map map = - new HashMap(); - map.put(TextAttribute.SIZE, size); - map.put(TextAttribute.KERNING, - TextAttribute.KERNING_ON); + if (font.getSize2D() != size) { + Map map = + new HashMap<>(); + map.put(TextAttribute.SIZE, size); + map.put(TextAttribute.KERNING, + TextAttribute.KERNING_ON); // map.put(TextAttribute.TRACKING, // TextAttribute.TRACKING_TIGHT); - font = font.deriveFont(map); + font = font.deriveFont(map); + } g2.setFont(font); textFont.setNative(font); fontObject = font; -// Font dfont = font.deriveFont(size); -//// Map attrs = dfont.getAttributes(); -//// for (TextAttribute ta : attrs.keySet()) { -//// System.out.println(ta + " -> " + attrs.get(ta)); -//// } -// g2.setFont(dfont); -// textFont.setNative(dfont); + /* + Map attrs = font.getAttributes(); + for (TextAttribute ta : attrs.keySet()) { + System.out.println(ta + " -> " + attrs.get(ta)); + } + */ } // 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); + super.handleTextSize(size); } @@ -1942,10 +1959,14 @@ public void textSize(float size) { @Override - protected float textWidthImpl(char buffer[], int start, int stop) { + protected float textWidthImpl(char[] buffer, int start, int stop) { if (textFont == null) { defaultFontOrDeath("textWidth"); } + // Avoid "Zero length string passed to TextLayout constructor" error + if (start == stop) { + return 0; + } Font font = (Font) textFont.getNative(); // System.out.println(font); @@ -2007,7 +2028,7 @@ protected float textWidthImpl(char buffer[], int start, int stop) { @Override - protected void textLineImpl(char buffer[], int start, int stop, + protected void textLineImpl(char[] buffer, int start, int stop, float x, float y) { Font font = (Font) textFont.getNative(); // if (font != null && (textFont.isStream() || hints[ENABLE_NATIVE_FONTS])) { @@ -2223,6 +2244,7 @@ public void shearY(float angle) { @Override public void resetMatrix() { g2.setTransform(new AffineTransform()); + g2.scale(pixelDensity, pixelDensity); } @@ -2806,7 +2828,7 @@ public void updatePixels(int x, int y, int c, int d) { // GET/SET - static int getset[] = new int[1]; + static int[] getset = new int[1]; @Override @@ -2827,12 +2849,6 @@ public int get(int x, int y) { //public PImage get(int x, int y, int w, int h) - @Override - public PImage get() { - return get(0, 0, width, height); - } - - @Override protected void getImpl(int sourceX, int sourceY, int sourceWidth, int sourceHeight, @@ -2843,7 +2859,7 @@ protected void getImpl(int sourceX, int sourceY, // ((BufferedImage) (useOffscreen && primarySurface ? offscreen : image)).getRaster(); WritableRaster raster = getRaster(); - if (sourceWidth == target.width && sourceHeight == target.height) { + if (sourceWidth == target.pixelWidth && sourceHeight == target.pixelHeight) { raster.getDataElements(sourceX, sourceY, sourceWidth, sourceHeight, target.pixels); // https://github.com/processing/processing/issues/2030 if (raster.getNumBands() == 3) { @@ -2857,7 +2873,7 @@ protected void getImpl(int sourceX, int sourceY, // Copy the temporary output pixels over to the outgoing image int sourceOffset = 0; - int targetOffset = targetY*target.width + targetX; + int targetOffset = targetY*target.pixelWidth + targetX; for (int y = 0; y < sourceHeight; y++) { if (raster.getNumBands() == 3) { for (int i = 0; i < sourceWidth; i++) { @@ -2869,7 +2885,7 @@ protected void getImpl(int sourceX, int sourceY, System.arraycopy(temp, sourceOffset, target.pixels, targetOffset, sourceWidth); } sourceOffset += sourceWidth; - targetOffset += target.width; + targetOffset += target.pixelWidth; } } } @@ -2877,7 +2893,7 @@ protected void getImpl(int sourceX, int sourceY, @Override public void set(int x, int y, int argb) { - if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) return; + if ((x < 0) || (y < 0) || (x >= pixelWidth) || (y >= pixelHeight)) return; // ((BufferedImage) image).setRGB(x, y, argb); getset[0] = argb; // WritableRaster raster = ((BufferedImage) (useOffscreen && primarySurface ? offscreen : image)).getRaster(); @@ -2898,18 +2914,18 @@ protected void setImpl(PImage sourceImage, // ((BufferedImage) (useOffscreen && primarySurface ? offscreen : image)).getRaster(); if ((sourceX == 0) && (sourceY == 0) && - (sourceWidth == sourceImage.width) && - (sourceHeight == sourceImage.height)) { + (sourceWidth == sourceImage.pixelWidth) && + (sourceHeight == sourceImage.pixelHeight)) { // System.out.format("%d %d %dx%d %d%n", targetX, targetY, // sourceImage.width, sourceImage.height, // sourceImage.pixels.length); raster.setDataElements(targetX, targetY, - sourceImage.width, sourceImage.height, + sourceImage.pixelWidth, sourceImage.pixelHeight, sourceImage.pixels); } else { // TODO optimize, incredibly inefficient to reallocate this much memory PImage temp = sourceImage.get(sourceX, sourceY, sourceWidth, sourceHeight); - raster.setDataElements(targetX, targetY, temp.width, temp.height, temp.pixels); + raster.setDataElements(targetX, targetY, temp.pixelWidth, temp.pixelHeight, temp.pixels); } } @@ -2925,7 +2941,6 @@ protected void setImpl(PImage sourceImage, @Override - @SuppressWarnings("deprecation") public void mask(int[] alpha) { if (primaryGraphics) { showWarning(MASK_WARNING); diff --git a/core/src/processing/awt/PSurfaceAWT.java b/core/src/processing/awt/PSurfaceAWT.java index f98b8eec66..71a59e87f5 100644 --- a/core/src/processing/awt/PSurfaceAWT.java +++ b/core/src/processing/awt/PSurfaceAWT.java @@ -74,6 +74,11 @@ public class PSurfaceAWT extends PSurfaceNone { // Note that x and y may not be zero, depending on the display configuration Rectangle screenRect; + // Used for resizing, at least on Windows insets size changes when + // frame.setResizable() is called, and in resize listener we need + // to know what size the window was before. + Insets currentInsets = new Insets(0, 0, 0, 0); + // 3.0a5 didn't use strategy, and active was shut off during init() w/ retina // boolean useStrategy = true; @@ -85,6 +90,8 @@ public class PSurfaceAWT extends PSurfaceNone { int sketchWidth; int sketchHeight; + int windowScaleFactor; + public PSurfaceAWT(PGraphics graphics) { //this.graphics = graphics; @@ -219,7 +226,7 @@ public void validate() { if (!oldSize.equals(newSize)) { // System.out.println("validate() render old=" + oldSize + " -> new=" + newSize); oldSize = newSize; - sketch.setSize(newSize.width, newSize.height); + sketch.setSize(newSize.width / windowScaleFactor, newSize.height / windowScaleFactor); // try { render(); // } catch (IllegalStateException ise) { @@ -418,8 +425,11 @@ public void initFrame(final PApplet sketch) {/*, int backgroundColor, sketch.displayWidth = screenRect.width; sketch.displayHeight = screenRect.height; - sketchWidth = sketch.sketchWidth(); - sketchHeight = sketch.sketchHeight(); + windowScaleFactor = PApplet.platform == PConstants.MACOSX ? + 1 : sketch.pixelDensity; + + sketchWidth = sketch.sketchWidth() * windowScaleFactor; + sketchHeight = sketch.sketchHeight() * windowScaleFactor; boolean fullScreen = sketch.sketchFullScreen(); // Removing the section below because sometimes people want to do the @@ -476,7 +486,7 @@ public void initFrame(final PApplet sketch) {/*, int backgroundColor, // http://dev.processing.org/bugs/show_bug.cgi?id=908 frame.add(canvas); - setSize(sketchWidth, sketchHeight); + setSize(sketchWidth / windowScaleFactor, sketchHeight / windowScaleFactor); /* if (fullScreen) { @@ -552,9 +562,11 @@ public Object getNative() { @Override public void setTitle(String title) { frame.setTitle(title); - // Workaround for apparent Java bug? + // Workaround for apparent Java bug on OS X? // https://github.com/processing/processing/issues/3472 - if (cursorVisible) { + if (cursorVisible && + (PApplet.platform == PConstants.MACOSX) && + (cursorType != PConstants.ARROW)) { hideCursor(); showCursor(); } @@ -594,6 +606,18 @@ public void setIcon(PImage image) { } + @Override + public void setAlwaysOnTop(boolean always) { + frame.setAlwaysOnTop(always); + } + + + @Override + public void setLocation(int x, int y) { + frame.setLocation(x, y); + } + + List iconImages; protected void setProcessingIcon(Frame frame) { @@ -794,11 +818,11 @@ private Dimension setFrameSize() { //int sketchWidth, int sketchHeight) { // System.out.format("setting frame size %d %d %n", sketchWidth, sketchHeight); // new Exception().printStackTrace(System.out); - Insets insets = frame.getInsets(); + currentInsets = frame.getInsets(); int windowW = Math.max(sketchWidth, MIN_WINDOW_WIDTH) + - insets.left + insets.right; + currentInsets.left + currentInsets.right; int windowH = Math.max(sketchHeight, MIN_WINDOW_HEIGHT) + - insets.top + insets.bottom; + currentInsets.top + currentInsets.bottom; frame.setSize(windowW, windowH); return new Dimension(windowW, windowH); } @@ -867,15 +891,19 @@ public void placeWindow(int[] location, int[] editorLocation) { // 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; + //locationX = editorLocation[0] + 66; + //locationY = editorLocation[1] + 66; + locationX = (sketch.displayWidth - window.width) / 2; + locationY = (sketch.displayHeight - window.height) / 2; + /* if ((locationX + window.width > sketch.displayWidth - 33) || (locationY + window.height > sketch.displayHeight - 33)) { // otherwise center on screen locationX = (sketch.displayWidth - window.width) / 2; locationY = (sketch.displayHeight - window.height) / 2; } + */ frame.setLocation(locationX, locationY); } } else { // just center on screen @@ -917,21 +945,32 @@ public void placeWindow(int[] location, int[] editorLocation) { // needs to resize the frame, which will resize the canvas, and so on... @Override public void setSize(int wide, int high) { + // When the surface is set to resizable via surface.setResizable(true), + // a crash may occur if the user sets the window to size zero. + // https://github.com/processing/processing/issues/5052 + if (high <= 0) { + high = 1; + } + if (wide <= 0) { + wide = 1; + } + // if (PApplet.DEBUG) { // //System.out.format("frame visible %b, setSize(%d, %d) %n", frame.isVisible(), wide, high); // new Exception(String.format("setSize(%d, %d)", wide, high)).printStackTrace(System.out); // } //if (wide == sketchWidth && high == sketchHeight) { // doesn't work on launch - if (wide == sketch.width && high == sketch.height) { + if (wide == sketch.width && high == sketch.height && + (frame == null || currentInsets.equals(frame.getInsets()))) { // if (PApplet.DEBUG) { // new Exception("w/h unchanged " + wide + " " + high).printStackTrace(System.out); // } return; // unchanged, don't rebuild everything } - sketchWidth = wide; - sketchHeight = high; + sketchWidth = wide * windowScaleFactor; + sketchHeight = high * windowScaleFactor; // canvas.setSize(wide, high); // frame.setSize(wide, high); @@ -1109,16 +1148,21 @@ public void componentResized(ComponentEvent e) { // 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 x = farm.getX() + currentInsets.left; + int y = farm.getY() + currentInsets.top; // JFrame (unlike java.awt.Frame) doesn't include the left/top // insets for placement (though it does seem to need them for // overall size of the window. Perhaps JFrame sets its coord // system so that (0, 0) is always the upper-left of the content // area. Which seems nice, but breaks any f*ing AWT-based code. - setSize(windowSize.width - insets.left - insets.right, - windowSize.height - insets.top - insets.bottom); + int w = windowSize.width - currentInsets.left - currentInsets.right; + int h = windowSize.height - currentInsets.top - currentInsets.bottom; + setSize(w / windowScaleFactor, h / windowScaleFactor); + + // correct the location when inset size changes + setLocation(x - currentInsets.left, y - currentInsets.top); } } } @@ -1272,19 +1316,10 @@ protected void nativeMouseEvent(java.awt.event.MouseEvent nativeEvent) { peButton = PConstants.RIGHT; } - // If running on Mac OS, allow ctrl-click as right mouse. Prior to 0215, - // this used isPopupTrigger() on the native event, but that doesn't work - // for mouseClicked and mouseReleased (or others). - if (PApplet.platform == PConstants.MACOSX) { - //if (nativeEvent.isPopupTrigger()) { - if ((modifiers & InputEvent.CTRL_MASK) != 0) { - peButton = PConstants.RIGHT; - } - } - sketch.postEvent(new MouseEvent(nativeEvent, nativeEvent.getWhen(), peAction, peModifiers, - nativeEvent.getX(), nativeEvent.getY(), + nativeEvent.getX() / windowScaleFactor, + nativeEvent.getY() / windowScaleFactor, peButton, peCount)); } @@ -1454,6 +1489,13 @@ public void setCursor(PImage img, int x, int y) { // Don't set cursorType, instead use cursorType to save the last // regular cursor type used for when cursor() is called. //cursor_type = Cursor.CUSTOM_CURSOR; + + // this is a temporary workaround for the CHIP, will be removed + Dimension cursorSize = Toolkit.getDefaultToolkit().getBestCursorSize(img.width, img.height); + if (cursorSize.width == 0 || cursorSize.height == 0) { + return; + } + Cursor cursor = canvas.getToolkit().createCustomCursor((Image) img.getNative(), new Point(x, y), @@ -1483,8 +1525,14 @@ public void hideCursor() { if (invisibleCursor == null) { BufferedImage cursorImg = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB); - invisibleCursor = - canvas.getToolkit().createCustomCursor(cursorImg, new Point(8, 8), "blank"); + // this is a temporary workaround for the CHIP, will be removed + Dimension cursorSize = Toolkit.getDefaultToolkit().getBestCursorSize(16, 16); + if (cursorSize.width == 0 || cursorSize.height == 0) { + invisibleCursor = Cursor.getDefaultCursor(); + } else { + invisibleCursor = + canvas.getToolkit().createCustomCursor(cursorImg, new Point(8, 8), "blank"); + } } canvas.setCursor(invisibleCursor); cursorVisible = false; diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 8410a8fd64..c43fbca8cb 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -24,31 +24,40 @@ package processing.core; -// used by link() -import java.awt.Desktop; -import java.awt.DisplayMode; -import java.awt.EventQueue; -import java.awt.FileDialog; -import java.awt.Font; +// dummy object for backwards compatibility, plus the select methods import java.awt.Frame; + +// before calling settings() to get displayWidth/Height +import java.awt.DisplayMode; +// handleSettings() and displayDensity() import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; +// used to present the fullScreen() warning about Spaces on OS X +import javax.swing.JOptionPane; + +// inside runSketch() to warn users about headless import java.awt.HeadlessException; -import java.awt.Image; import java.awt.Toolkit; + +// used by loadImage() +import java.awt.Image; import java.awt.color.ColorSpace; import java.awt.image.BufferedImage; - - - -// used by loadImage() functions import javax.imageio.ImageIO; // allows us to remove our own MediaTracker code import javax.swing.ImageIcon; + // used by selectInput(), selectOutput(), selectFolder() +import java.awt.EventQueue; +import java.awt.FileDialog; import javax.swing.JFileChooser; -// used to present the fullScreen() warning about Spaces on OS X -import javax.swing.JOptionPane; + +// set the look and feel, if specified +import javax.swing.UIManager; + +// used by link() +import java.awt.Desktop; + // used by desktopFile() method import javax.swing.filechooser.FileSystemView; @@ -60,8 +69,14 @@ import java.io.*; import java.lang.reflect.*; import java.net.*; +import java.nio.charset.StandardCharsets; import java.text.*; import java.util.*; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadFactory; import java.util.regex.*; import java.util.zip.*; @@ -110,45 +125,25 @@ public class PApplet implements PConstants { static public final String javaVersionName = System.getProperty("java.version"); -// /** Short name of Java version, i.e. 1.8. */ -// static public final String javaVersionShort = -// //javaVersionName.substring(0, 3); -// javaVersionName.substring(0, javaVersionName.indexOf(".", 2)); -// // can't use this one, it's 1.8.0 and breaks things -// //javaVersionName.substring(0, javaVersionName.indexOf("_")); - - static public final int javaPlatform = - PApplet.parseInt(PApplet.split(javaVersionName, '.')[1]); -// static { -// try { -// javaPlatform = PApplet.split(javaVersionName, '.')[1]; -// } catch (Exception e) { -// javaPlatform = "8"; // set a default in case -// } -// } + static public final int javaPlatform; + static { + String version = javaVersionName; + if (javaVersionName.startsWith("1.")) { + version = version.substring(2); + javaPlatform = parseInt(version.substring(0, version.indexOf('.'))); + } else { + // Remove -xxx and .yyy from java.version (@see JEP-223) + javaPlatform = parseInt(version.replaceAll("-.*","").replaceAll("\\..*","")); + } + } /** - * 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. The PDE will make 1.8 or whatever into - * a float automatically, so outside the PDE, 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 as a float because specifying a double - * (with this narrow case especially) with the preprocessor is awkward. - *

- * @deprecated Java 10 is around the corner. Use javaPlatform when you need - * a number for comparisons, i.e. "if (javaPlatform >= 7)". + * Do not use; javaPlatform or javaVersionName are better options. + * For instance, javaPlatform is useful when you need a number for + * comparison, i.e. "if (javaPlatform >= 9)". */ @Deprecated - public static final float javaVersion = - new Float(javaVersionName.substring(0, 3)); -// public static final float javaVersion = -// new Float(javaVersionName.substring(0, javaVersionName.indexOf(".", 2))).floatValue(); -// // Making this a String in 3.0, in anticipation of Java 10 -// public static final String javaVersion = "1." + javaPlatform; + public static final float javaVersion = 1 + javaPlatform / 10f; /** * Current platform in use, one of the @@ -175,12 +170,10 @@ public class PApplet implements PConstants { /** * Whether to use native (AWT) dialogs for selectInput and selectOutput. - * The native dialogs on Linux tend to be pretty awful. With selectFolder() - * this is ignored, because there is no native folder selector, except on - * Mac OS X. On OS X, the native folder selector will be used unless - * useNativeSelect is set to false. + * The native dialogs on some platforms can be ugly, buggy, or missing + * features. For 3.3.5, this defaults to true on all platforms. */ - static public boolean useNativeSelect = (platform != LINUX); + static public boolean useNativeSelect = true; /** The PGraphics renderer associated with this PApplet */ public PGraphics g; @@ -288,6 +281,9 @@ public class PApplet implements PConstants { * @see PApplet#get(int, int, int, int) * @see PApplet#set(int, int, int) * @see PImage + * @see PApplet#pixelDensity() + * @see PApplet#pixelWidth + * @see PApplet#pixelHeight */ public int[] pixels; @@ -342,8 +338,8 @@ public class PApplet implements PConstants { * * @webref environment * @see PApplet#pixelHeight - * @see pixelDensity() - * @see displayDensity() + * @see #pixelDensity(int) + * @see #displayDensity() */ public int pixelWidth; @@ -366,8 +362,8 @@ public class PApplet implements PConstants { * * @webref environment * @see PApplet#pixelWidth - * @see pixelDensity() - * @see displayDensity() + * @see #pixelDensity(int) + * @see #displayDensity() */ public int pixelHeight; @@ -567,6 +563,14 @@ public class PApplet implements PConstants { */ public boolean mousePressed; + // MACOSX: CTRL + Left Mouse is converted to Right Mouse. This boolean keeps + // track of whether the conversion happened on PRESS, because we should report + // the same button during DRAG and on RELEASE, even though CTRL might have + // been released already. Otherwise the events are inconsistent, e.g. + // Left Pressed - Left Drag - CTRL Pressed - Right Drag - Right Released. + // See: https://github.com/processing/processing/issues/5672 + private boolean macosxLeftButtonWithCtrlPressed; + /** @deprecated Use a mouse event handler that passes an event instead. */ @Deprecated @@ -657,6 +661,7 @@ public class PApplet implements PConstants { * @see PApplet#keyReleased() */ public boolean keyPressed; + List pressedKeys = new ArrayList<>(6); /** * The last KeyEvent object passed into a mouse function. @@ -710,7 +715,7 @@ public class PApplet implements PConstants { * @see PApplet#frameRate(float) * @see PApplet#frameCount */ - public float frameRate = 10; + public float frameRate = 60; protected boolean looping = true; @@ -734,6 +739,9 @@ public class PApplet implements PConstants { /** true if the sketch has stopped permanently. */ public volatile boolean finished; + /** used by the UncaughtExceptionHandler, so has to be static */ + static Throwable uncaughtThrowable; + // public, but undocumented.. removing for 3.0a5 // /** // * true if the animation thread is paused. @@ -786,6 +794,8 @@ public class PApplet implements PConstants { */ static public final String ARGS_SKETCH_FOLDER = "--sketch-path"; + static public final String ARGS_DENSITY = "--density"; + /** * When run externally to a PdeEditor, * this is sent by the sketch when it quits. @@ -905,6 +915,9 @@ public PSurface getSurface() { // Unlike the others above, needs to be public to support // the pixelWidth and pixelHeight fields. public int pixelDensity = 1; + int suggestedDensity = -1; + + boolean present; String outputPath; OutputStream outputStream; @@ -981,7 +994,7 @@ void handleSettings() { stderr.append(line); } } catch (IOException e) { - e.printStackTrace(); + printStackTrace(e); } int resultCode = -1; @@ -993,6 +1006,7 @@ void handleSettings() { if ("0".equals(result)) { EventQueue.invokeLater(new Runnable() { public void run() { + checkLookAndFeel(); final String msg = "To use fullScreen(SPAN), first turn off “Displays have separate spaces”\n" + "in System Preferences \u2192 Mission Control. Then log out and log back in."; @@ -1000,7 +1014,7 @@ public void run() { JOptionPane.WARNING_MESSAGE); } }); - } else if (!result.equals("1")) { + } else if (!"1".equals(result)) { System.err.println("Could not check the status of “Displays have separate spaces.”"); System.err.format("Received message '%s' and result code %d.%n", trim(stderr.toString()), resultCode); } @@ -1022,7 +1036,7 @@ public void run() { * @webref environment * @see PApplet#fullScreen() * @see PApplet#setup() - * @see PApplet#size() + * @see PApplet#size(int,int) * @see PApplet#smooth() */ public void settings() { @@ -1119,27 +1133,27 @@ final public int sketchPixelDensity() { * ( end auto-generated ) * * @webref environment - * @see PApplet#pixelDensity() - * @see PApplet#size() + * @see PApplet#pixelDensity(int) + * @see PApplet#size(int,int) */ public int displayDensity() { - if (display == SPAN) { - // walk through all displays, use lowest common denominator - for (int i = 0; i < displayDevices.length; i++) { - if (displayDensity(i) != 2) { - return 1; - } + if (display != SPAN && (fullScreen || present)) { + return displayDensity(display); + } + // walk through all displays, use 2 if any display is 2 + for (int i = 0; i < displayDevices.length; i++) { + if (displayDensity(i+1) == 2) { + return 2; } - // If nobody's density is 1 (or != 2, to be exact) then everyone is 2 - return 2; } - return displayDensity(display); + // If nobody's density is 2 then everyone is 1 + return 1; } /** * @param display the display number to check */ - static public int displayDensity(int display) { + public int displayDensity(int display) { if (PApplet.platform == PConstants.MACOSX) { // This should probably be reset each time there's a display change. // A 5-minute search didn't turn up any such event in the Java 7 API. @@ -1182,6 +1196,15 @@ static public int displayDensity(int display) { } } catch (Exception ignore) { } } + } else if (PApplet.platform == PConstants.WINDOWS || + PApplet.platform == PConstants.LINUX) { + if (suggestedDensity == -1) { + // TODO: detect and return DPI scaling using JNA; Windows has + // a system-wide value, not sure how it works on Linux + return 1; + } else if (suggestedDensity == 1 || suggestedDensity == 2) { + return suggestedDensity; + } } return 1; } @@ -1190,20 +1213,29 @@ static public int displayDensity(int display) { /** * @webref environment * @param density 1 or 2 - * + * @see PApplet#pixelWidth + * @see PApplet#pixelHeight */ public void pixelDensity(int density) { + //println(density + " " + this.pixelDensity); if (density != this.pixelDensity) { if (insideSettings("pixelDensity", density)) { if (density != 1 && density != 2) { throw new RuntimeException("pixelDensity() can only be 1 or 2"); } - if (density == 2 && displayDensity() == 1) { + if (!FX2D.equals(renderer) && density == 2 && displayDensity() == 1) { + // FX has its own check in PSurfaceFX // Don't throw exception because the sketch should still work - throw new RuntimeException("pixelDensity(2) is not available for this display"); + System.err.println("pixelDensity(2) is not available for this display"); + this.pixelDensity = 1; } else { this.pixelDensity = density; } + } else { + System.err.println("not inside settings"); + // this should only be reachable when not running in the PDE, + // so saying it's a settings()--not just setup()--issue should be ok + throw new RuntimeException("pixelDensity() can only be used inside settings()"); } } } @@ -1261,6 +1293,9 @@ private void smoothWarning(String method) { // When running from the PDE, say setup(), otherwise say settings() final String where = external ? "setup" : "settings"; PGraphics.showWarning("%s() can only be used inside %s()", method, where); + if (external) { + PGraphics.showWarning("When run from the PDE, %s() is automatically moved from setup() to settings()", method); + } } @@ -1375,7 +1410,10 @@ public void resume() { } /** Map of registered methods, stored by name. */ HashMap registerMap = - new HashMap(); + new HashMap<>(); + + /** Lock when un/registering from multiple threads */ + private final Object registerLock = new Object[0]; class RegisteredMethods { @@ -1411,7 +1449,7 @@ void handle(Object[] args) { throw (RuntimeException) t; } else { // trap and print as usual - t.printStackTrace(); + printStackTrace(t); } } } @@ -1518,16 +1556,17 @@ public void registerMethod(String methodName, Object target) { private void registerNoArgs(String name, Object o) { - RegisteredMethods meth = registerMap.get(name); - if (meth == null) { - meth = new RegisteredMethods(); - registerMap.put(name, meth); - } Class c = o.getClass(); try { - Method method = c.getMethod(name, new Class[] {}); - meth.add(o, method); - + Method method = c.getMethod(name); + synchronized (registerLock) { + RegisteredMethods meth = registerMap.get(name); + if (meth == null) { + meth = new RegisteredMethods(); + registerMap.put(name, meth); + } + meth.add(o, method); + } } catch (NoSuchMethodException nsme) { die("There is no public " + name + "() method in the class " + o.getClass().getName()); @@ -1539,16 +1578,17 @@ private void registerNoArgs(String name, Object o) { private void registerWithArgs(String name, Object o, Class cargs[]) { - RegisteredMethods meth = registerMap.get(name); - if (meth == null) { - meth = new RegisteredMethods(); - registerMap.put(name, meth); - } Class c = o.getClass(); try { Method method = c.getMethod(name, cargs); - meth.add(o, method); - + synchronized (registerLock) { + RegisteredMethods meth = registerMap.get(name); + if (meth == null) { + meth = new RegisteredMethods(); + registerMap.put(name, meth); + } + meth.add(o, method); + } } catch (NoSuchMethodException nsme) { die("There is no public " + name + "() method in the class " + o.getClass().getName()); @@ -1565,32 +1605,38 @@ private void registerWithArgs(String name, Object o, Class cargs[]) { public void unregisterMethod(String name, Object target) { - RegisteredMethods meth = registerMap.get(name); - if (meth == null) { - die("No registered methods with the name " + name + "() were found."); - } - try { + synchronized (registerLock) { + RegisteredMethods meth = registerMap.get(name); + if (meth == null) { + die("No registered methods with the name " + name + "() were found."); + } + try { // Method method = o.getClass().getMethod(name, new Class[] {}); // meth.remove(o, method); - meth.remove(target); - } catch (Exception e) { - die("Could not unregister " + name + "() for " + target, e); + meth.remove(target); + } catch (Exception e) { + die("Could not unregister " + name + "() for " + target, e); + } } } protected void handleMethods(String methodName) { - RegisteredMethods meth = registerMap.get(methodName); - if (meth != null) { - meth.handle(); + synchronized (registerLock) { + RegisteredMethods meth = registerMap.get(methodName); + if (meth != null) { + meth.handle(); + } } } protected void handleMethods(String methodName, Object[] args) { - RegisteredMethods meth = registerMap.get(methodName); - if (meth != null) { - meth.handle(args); + synchronized (registerLock) { + RegisteredMethods meth = registerMap.get(methodName); + if (meth != null) { + meth.handle(args); + } } } @@ -1855,7 +1901,7 @@ public void fullScreen(int display) { * @param renderer the renderer to use, e.g. P2D, P3D, JAVA2D (default) * @see PApplet#settings() * @see PApplet#setup() - * @see PApplet#size() + * @see PApplet#size(int,int) * @see PApplet#smooth() */ public void fullScreen(String renderer) { @@ -1870,8 +1916,9 @@ public void fullScreen(String renderer) { /** - * @param display the screen to run the sketch on (1, 2, 3, etc.) + * @param display the screen to run the sketch on (1, 2, 3, etc. or on multiple screens using SPAN) */ + public void fullScreen(String renderer, int display) { if (!fullScreen || !renderer.equals(this.renderer) || @@ -1957,6 +2004,9 @@ public void fullScreen(String renderer, int display) { * @param height height of the display window in units of pixels * @see PApplet#width * @see PApplet#height + * @see PApplet#setup() + * @see PApplet#settings() + * @see PApplet#fullScreen() */ public void size(int width, int height) { // Check to make sure the width/height have actually changed. It's ok to @@ -1978,7 +2028,7 @@ public void size(int width, int height, String renderer) { height != this.height || !renderer.equals(this.renderer)) { //println(width, height, renderer, this.width, this.height, this.renderer); - if (insideSettings("size", width, height, renderer)) { + if (insideSettings("size", width, height, "\"" + renderer + "\"")) { this.width = width; this.height = height; this.renderer = renderer; @@ -1997,7 +2047,8 @@ public void size(int width, int height, String renderer, String path) { if (width != this.width || height != this.height || !renderer.equals(this.renderer)) { - if (insideSettings("size", width, height, renderer, path)) { + if (insideSettings("size", width, height, "\"" + renderer + "\"", + "\"" + path + "\"")) { this.width = width; this.height = height; this.renderer = renderer; @@ -2237,11 +2288,14 @@ protected PGraphics makeGraphics(int w, int h, "specified with -Djava.library.path=/path/to/jogl"); } else { - ite.getTargetException().printStackTrace(); + printStackTrace(ite.getTargetException()); Throwable target = ite.getTargetException(); + /* + // removing for 3.2, we'll see if (platform == MACOSX) { target.printStackTrace(System.out); // OS X bug (still true?) } + */ throw new RuntimeException(target.getMessage()); } @@ -2268,16 +2322,18 @@ protected PGraphics makeGraphics(int w, int h, throw new RuntimeException(e); } else { - e.printStackTrace(); + printStackTrace(e); String msg = renderer + " needs to be updated " + "for the current release of Processing."; throw new RuntimeException(msg); } } else { + /* if (platform == MACOSX) { e.printStackTrace(System.out); // OS X bug (still true?) } - e.printStackTrace(); + */ + printStackTrace(e); throw new RuntimeException(e.getMessage()); } } @@ -2384,9 +2440,34 @@ public void handleDraw() { } else { // frameCount > 0, meaning an actual draw() // update the current frameRate - double rate = 1000000.0 / ((now - frameRateLastNanos) / 1000000.0); - float instantaneousRate = (float) (rate / 1000.0); - frameRate = (frameRate * 0.9f) + (instantaneousRate * 0.1f); + + // Calculate frameRate through average frame times, not average fps, e.g.: + // + // Alternating 2 ms and 20 ms frames (JavaFX or JOGL sometimes does this) + // is around 90.91 fps (two frames in 22 ms, one frame 11 ms). + // + // However, averaging fps gives us: (500 fps + 50 fps) / 2 = 275 fps. + // This is because we had 500 fps for 2 ms and 50 fps for 20 ms, but we + // counted them with equal weight. + // + // If we average frame times instead, we get the right result: + // (2 ms + 20 ms) / 2 = 11 ms per frame, which is 1000/11 = 90.91 fps. + // + // The counter below uses exponential moving average. To do the + // calculation, we first convert the accumulated frame rate to average + // frame time, then calculate the exponential moving average, and then + // convert the average frame time back to frame rate. + { + // Get the frame time of the last frame + double frameTimeSecs = (now - frameRateLastNanos) / 1e9; + // Convert average frames per second to average frame time + double avgFrameTimeSecs = 1.0 / frameRate; + // Calculate exponential moving average of frame time + final double alpha = 0.05; + avgFrameTimeSecs = (1.0 - alpha) * avgFrameTimeSecs + alpha * frameTimeSecs; + // Convert frame time back to frames per second + frameRate = (float) (1.0 / avgFrameTimeSecs); + } if (frameCount != 0) { handleMethods("pre"); @@ -2545,38 +2626,8 @@ public boolean isLooping() { ////////////////////////////////////////////////////////////// - InternalEventQueue eventQueue = new InternalEventQueue(); - - - static class InternalEventQueue { - protected Event queue[] = new Event[10]; - protected int offset; - protected int count; - - synchronized void add(Event e) { - if (count == queue.length) { - queue = (Event[]) expand(queue); - } - queue[count++] = e; - } - - synchronized Event remove() { - if (offset == count) { - throw new RuntimeException("Nothing left on the event queue."); - } - Event outgoing = queue[offset++]; - if (offset == count) { - // All done, time to reset - offset = 0; - count = 0; - } - return outgoing; - } - - synchronized boolean available() { - return count != 0; - } - } + BlockingQueue eventQueue = new LinkedBlockingQueue<>(); + private final Object eventQueueDequeueLock = new Object[0]; /** @@ -2593,16 +2644,17 @@ public void postEvent(processing.event.Event pe) { protected void dequeueEvents() { - while (eventQueue.available()) { - Event e = eventQueue.remove(); - - switch (e.getFlavor()) { - case Event.MOUSE: - handleMouseEvent((MouseEvent) e); - break; - case Event.KEY: - handleKeyEvent((KeyEvent) e); - break; + synchronized (eventQueueDequeueLock) { + while (!eventQueue.isEmpty()) { + Event e = eventQueue.remove(); + switch (e.getFlavor()) { + case Event.MOUSE: + handleMouseEvent((MouseEvent) e); + break; + case Event.KEY: + handleKeyEvent((KeyEvent) e); + break; + } } } } @@ -2637,8 +2689,27 @@ protected void handleMouseEvent(MouseEvent event) { mouseY = event.getY(); } + int button = event.getButton(); + + // If running on Mac OS, allow ctrl-click as right mouse. + if (PApplet.platform == PConstants.MACOSX && event.getButton() == PConstants.LEFT) { + if (action == MouseEvent.PRESS && event.isControlDown()) { + macosxLeftButtonWithCtrlPressed = true; + } + if (macosxLeftButtonWithCtrlPressed) { + button = PConstants.RIGHT; + event = new MouseEvent(event.getNative(), event.getMillis(), + event.getAction(), event.getModifiers(), + event.getX(), event.getY(), + button, event.getCount()); + } + if (action == MouseEvent.RELEASE) { + macosxLeftButtonWithCtrlPressed = false; + } + } + // Get the (already processed) button code - mouseButton = event.getButton(); + mouseButton = button; /* // Compatibility for older code (these have AWT object params, not P5) @@ -2926,11 +2997,14 @@ protected void handleKeyEvent(KeyEvent event) { switch (event.getAction()) { case KeyEvent.PRESS: + Long hash = ((long) keyCode << Character.SIZE) | key; + if (!pressedKeys.contains(hash)) pressedKeys.add(hash); keyPressed = true; keyPressed(keyEvent); break; case KeyEvent.RELEASE: - keyPressed = false; + pressedKeys.remove(((long) keyCode << Character.SIZE) | key); + keyPressed = !pressedKeys.isEmpty(); keyReleased(keyEvent); break; case KeyEvent.TYPE: @@ -3112,7 +3186,10 @@ public void keyTyped(KeyEvent event) { public void focusGained() { } - public void focusLost() { } + public void focusLost() { + // TODO: if user overrides this without calling super it's not gonna work + pressedKeys.clear(); + } @@ -3283,6 +3360,8 @@ static public int year() { /** + * ( begin auto-generated from delay.xml ) + * * 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 @@ -3296,6 +3375,12 @@ static public int year() { * a script that needs to pause a few seconds before attempting a download, * or a sketch that needs to wait a few milliseconds before reading from * the serial port). + * + * ( end auto-generated ) + * @webref environment + * @param napTime milliseconds to pause before running draw() again + * @see PApplet#frameRate + * @see PApplet#draw() */ public void delay(int napTime) { //if (frameCount != 0) { @@ -3345,11 +3430,6 @@ public void frameRate(float fps) { *

* 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. * * @param url the complete URL, as a String in quotes */ @@ -3362,9 +3442,9 @@ public void link(String url) { launch(url); } } catch (IOException e) { - e.printStackTrace(); + printStackTrace(e); } catch (URISyntaxException e) { - e.printStackTrace(); + printStackTrace(e); } } @@ -3407,7 +3487,7 @@ public void link(String url) { * * ( end auto-generated ) * @webref input:files - * @param filename name of the file + * @param args arguments to the launcher, eg. a filename. * @usage Application */ static public Process launch(String... args) { @@ -3424,25 +3504,20 @@ static public Process launch(String... args) { params = new String[] { "open" }; } else if (platform == LINUX) { - if (openLauncher == null) { - // Attempt to use gnome-open + // xdg-open is in the Free Desktop Specification and really should just + // work on desktop Linux. Not risking it though. + final String[] launchers = { "xdg-open", "gnome-open", "kde-open" }; + for (String launcher : launchers) { + if (openLauncher != null) break; try { - Process p = Runtime.getRuntime().exec(new String[] { "gnome-open" }); + Process p = Runtime.getRuntime().exec(new String[] { launcher }); /*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"; + openLauncher = launcher; } catch (Exception e) { } } if (openLauncher == null) { - System.err.println("Could not find gnome-open or kde-open, " + + System.err.println("Could not find xdg-open, gnome-open, or kde-open: " + "the open() command may not work."); } if (openLauncher != null) { @@ -3467,26 +3542,197 @@ static public Process launch(String... args) { } + /** + * Pass a set of arguments directly to the command line. Uses Java's + * Runtime.exec() + * method. This is different from the launch() + * method, which uses the operating system's launcher to open the files. + * It's always a good idea to use a full path to the executable here. + *
+   * exec("/usr/bin/say", "welcome to the command line");
+   * 
+ * Or if you want to wait until it's completed, something like this: + *
+   * Process p = exec("/usr/bin/say", "waiting until done");
+   * try {
+   *   int result = p.waitFor();
+   *   println("the process returned " + result);
+   * } catch (InterruptedException e) { }
+   * 
+ * You can also get the system output and error streams from the Process + * object, but that's more that we'd like to cover here. + * @return a Process object + */ static public Process exec(String... args) { try { return Runtime.getRuntime().exec(args); } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Could not open " + join(args, ' ')); + throw new RuntimeException("Exception while attempting " + join(args, ' '), e); } } - // yuck.. maybe this is just a class -// static public int exec(StringList stdout, StringList stderr, String... args) { -// Process p = exec(args); -// int result = p.waitFor(); -// } + static class LineThread extends Thread { + InputStream input; + StringList output; + + + LineThread(InputStream input, StringList output) { + this.input = input; + this.output = output; + start(); + } + + @Override + public void run() { + // It's not sufficient to use BufferedReader, because if the app being + // called fills up stdout or stderr to quickly, the app will hang. + // Instead, write to a byte[] array and then parse it once finished. + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + saveStream(baos, input); + BufferedReader reader = + createReader(new ByteArrayInputStream(baos.toByteArray())); + String line; + while ((line = reader.readLine()) != null) { + output.append(line); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + + + /** + * Alternative version of exec() that retrieves stdout and stderr into the + * StringList objects provided. This is a convenience function that handles + * simple exec() calls. If the results will be more than a couple lines, + * you shouldn't use this function, you should use a more elaborate method + * that makes use of proper threading (to drain the shell output) and error + * handling to address the many things that can go wrong within this method. + * + * @param stdout a non-null StringList object to be filled with any output + * @param stderr a non-null StringList object to be filled with error lines + * @param args each argument to be passed as a series of String objects + * @return the result returned from the application, or -1 if an Exception + * occurs before the application is able to return a result. + */ + static public int exec(StringList stdout, StringList stderr, String... args) { + Process p = exec(args); + + Thread outThread = new LineThread(p.getInputStream(), stdout); + Thread errThread = new LineThread(p.getErrorStream(), stderr); + /* + final InputStream err = p.getErrorStream(); + final InputStream out = p.getInputStream(); + Thread outThread = new Thread(() -> { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + String line; + try { + saveStream(baos, out); + BufferedReader err2 = createReader(new ByteArrayInputStream(baos.toByteArray())); + while ((line = err2.readLine()) != null) { + stdout.append(line); + } + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + }); + outThread.start(); + + Thread errThread = new Thread(() -> { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + String line; + try { + saveStream(baos, err); + BufferedReader err2 = createReader(new ByteArrayInputStream(baos.toByteArray())); + while ((line = err2.readLine()) != null) { + stderr.append(line); + } + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + }); + errThread.start(); + */ + + try { + int result = p.waitFor(); + outThread.join(); + errThread.join(); + return result; + + } catch (InterruptedException e) { + // Throwing the exception here because we can't give a valid 'result' + throw new RuntimeException(e); + } + } + + + /** + * Same as exec() above, but prefixes the call with a shell. + */ + static public int shell(StringList stdout, StringList stderr, String... args) { + String shell; + String runCmd; + StringList argList = new StringList(); + if (platform == WINDOWS) { + shell = System.getenv("COMSPEC"); + runCmd = "/C"; + } else { + shell = "/bin/sh"; + runCmd = "-c"; + // attempt emulate the behavior of an interactive shell + // can't use -i or -l since the version of bash shipped with macOS does not support this together with -c + // also we want to make sure no motd or similar gets returned as stdout + argList.append("if [ -f /etc/profile ]; then . /etc/profile >/dev/null 2>&1; fi;"); + argList.append("if [ -f ~/.bash_profile ]; then . ~/.bash_profile >/dev/null 2>&1; elif [ -f ~/.bash_profile ]; then . ~/.bash_profile >/dev/null 2>&1; elif [ -f ~/.profile ]; then ~/.profile >/dev/null 2>&1; fi;"); + } + for (String arg : args) { + argList.append(arg); + } + return exec(stdout, stderr, shell, runCmd, argList.join(" ")); + } + + + /* + static private final String shellQuoted(String arg) { + if (arg.indexOf(' ') != -1) { + // check to see if already quoted + if ((arg.charAt(0) != '\"' || arg.charAt(arg.length()-1) != '\"') && + (arg.charAt(0) != '\'' || arg.charAt(arg.length()-1) != '\'')) { + + // see which quotes we can use + if (arg.indexOf('\"') == -1) { + // if no double quotes, try those first + return "\"" + arg + "\""; + + } else if (arg.indexOf('\'') == -1) { + // if no single quotes, let's use those + return "'" + arg + "'"; + } + } + } + return arg; + } + */ ////////////////////////////////////////////////////////////// + /** + * Better way of handling e.printStackTrace() calls so that they can be + * handled by subclasses as necessary. + */ + protected void printStackTrace(Throwable t) { + t.printStackTrace(); + } + + /** * Function for an applet/application to kill itself and * display an error. Mostly this is here to be improved later. @@ -3590,6 +3836,17 @@ public void dispose() { // run dispose() methods registered by libraries handleMethods("dispose"); } + + if (platform == MACOSX) { + try { + final String td = "processing.core.ThinkDifferent"; + final Class thinkDifferent = getClass().getClassLoader().loadClass(td); + thinkDifferent.getMethod("cleanup").invoke(null); + } catch (Exception e) { + e.printStackTrace(); + } + } + } @@ -4349,12 +4606,12 @@ static public final float max(float[] list) { } - /** - * 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 - */ +// /** +// * 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 double max(double[] list) { if (list.length == 0) { @@ -4921,7 +5178,13 @@ public final float randomGaussian() { public final float random(float low, float high) { if (low >= high) return low; float diff = high - low; - return random(diff) + low; + float value = 0; + // because of rounding error, can't just add low, otherwise it may hit high + // https://github.com/processing/processing/issues/4551 + do { + value = random(diff) + low; + } while (value == high); + return value; } @@ -5134,7 +5397,6 @@ private float noise_fsc(float i) { * ( end auto-generated ) * @webref math:random * @param lod number of octaves to be used by the noise - * @param falloff falloff factor for each octave * @see PApplet#noise(float, float, float) */ public void noiseDetail(int lod) { @@ -5142,6 +5404,7 @@ public void noiseDetail(int lod) { } /** + * @see #noiseDetail(int) * @param falloff falloff factor for each octave */ public void noiseDetail(int lod, float falloff) { @@ -5242,19 +5505,29 @@ public PImage loadImage(String filename) { * @param extension type of image to load, for example "png", "gif", "jpg" */ public PImage loadImage(String filename, String extension) { //, Object params) { + + // awaitAsyncSaveCompletion() has to run on the main thread, because P2D + // and P3D call GL functions. If this runs on background, requestImage() + // already called awaitAsyncSaveCompletion() on the main thread. + if (g != null && !Thread.currentThread().getName().startsWith(REQUEST_IMAGE_THREAD_PREFIX)) { + g.awaitAsyncSaveCompletion(filename); + } + 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); + } else { + 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); + } } } @@ -5269,13 +5542,13 @@ public PImage loadImage(String filename, String extension) { //, Object params) // } return image; } catch (IOException e) { - e.printStackTrace(); + printStackTrace(e); return null; } } if (extension.equals("tif") || extension.equals("tiff")) { - byte bytes[] = loadBytes(filename); + byte[] bytes = loadBytes(filename); PImage image = (bytes == null) ? null : PImage.loadTIFF(bytes); // if (params != null) { // image.setParams(g, params); @@ -5290,7 +5563,7 @@ public PImage loadImage(String filename, String extension) { //, Object params) if (extension.equals("jpg") || extension.equals("jpeg") || extension.equals("gif") || extension.equals("png") || extension.equals("unknown")) { - byte bytes[] = loadBytes(filename); + byte[] bytes = loadBytes(filename); if (bytes == null) { return null; } else { @@ -5333,12 +5606,13 @@ public PImage loadImage(String filename, String extension) { //, Object params) // if (params != null) { // image.setParams(g, params); // } + image.parent = this; return image; } } } catch (Exception e) { // show error, but move on to the stuff below, see if it'll work - e.printStackTrace(); + printStackTrace(e); } if (loadImageFormats == null) { @@ -5363,8 +5637,12 @@ public PImage loadImage(String filename, String extension) { //, Object params) } + static private final String REQUEST_IMAGE_THREAD_PREFIX = "requestImage"; + // fixed-size thread pool used by requestImage() + ExecutorService requestImagePool; + + public PImage requestImage(String filename) { -// return requestImage(filename, null, null); return requestImage(filename, null); } @@ -5392,58 +5670,23 @@ public PImage requestImage(String filename) { * @see PApplet#loadImage(String, String) */ public PImage requestImage(String filename, String extension) { + // Make sure saving to this file completes before trying to load it + // Has to be called on main thread, because P2D and P3D need GL functions + if (g != null) { + g.awaitAsyncSaveCompletion(filename); + } PImage vessel = createImage(0, 0, ARGB); - AsyncImageLoader ail = - new AsyncImageLoader(filename, extension, vessel); - ail.start(); - return vessel; - } - - -// /** -// * @nowebref -// */ -// public PImage requestImage(String filename, String extension, Object params) { -// PImage vessel = createImage(0, 0, ARGB, params); -// 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; + // if the image loading thread pool hasn't been created, create it + if (requestImagePool == null) { + ThreadFactory factory = new ThreadFactory() { + public Thread newThread(Runnable r) { + return new Thread(r, REQUEST_IMAGE_THREAD_PREFIX); + } + }; + requestImagePool = Executors.newFixedThreadPool(4, factory); } - - @Override - public void run() { - while (requestImageCount == requestImageMax) { - try { - Thread.sleep(10); - } catch (InterruptedException e) { } - } - requestImageCount++; - + requestImagePool.execute(() -> { PImage actual = loadImage(filename, extension); // An error message should have already printed @@ -5461,31 +5704,11 @@ public void run() { vessel.pixelHeight = actual.height; vessel.pixelDensity = 1; } - requestImageCount--; - } + }); + return vessel; } - // done internally by ImageIcon -// /** -// * 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. */ @@ -5518,7 +5741,7 @@ protected PImage loadImageIO(String filename) { return outgoing; } catch (Exception e) { - e.printStackTrace(); + printStackTrace(e); return null; } } @@ -5542,7 +5765,7 @@ protected PImage loadImageTGA(String filename) throws IOException { InputStream is = createInput(filename); if (is == null) return null; - byte header[] = new byte[18]; + byte[] header = new byte[18]; int offset = 0; do { int count = is.read(header, offset, header.length - offset); @@ -5662,7 +5885,7 @@ header[17] image descriptor (packed bits) } else { // header[2] is 10 or 11 int index = 0; - int px[] = outgoing.pixels; + int[] px = outgoing.pixels; while (index < px.length) { int num = is.read(); @@ -5776,7 +5999,11 @@ public XML loadXML(String filename) { */ public XML loadXML(String filename, String options) { try { - return new XML(createReader(filename), options); + BufferedReader reader = createReader(filename); + if (reader != null) { + return new XML(reader, options); + } + return null; // can't use catch-all exception, since it might catch the // RuntimeException about the incorrect case sensitivity @@ -5795,7 +6022,7 @@ public XML loadXML(String filename, String options) { /** * @webref input:files * @brief Converts String content to an XML object - * @param data the content to be parsed as XML + * @param xmlString the content to be parsed as XML * @return an XML object, or null * @see XML * @see PApplet#loadXML(String) @@ -5828,12 +6055,19 @@ public boolean saveXML(XML xml, String filename) { return saveXML(xml, filename, null); } - + /** + * @nowebref + */ public boolean saveXML(XML xml, String filename, String options) { return xml.save(saveFile(filename), options); } - + /** + * @webref input:files + * @param input String to parse as a JSONObject + * @see PApplet#loadJSONObject(String) + * @see PApplet#saveJSONObject(JSONObject, String) + */ public JSONObject parseJSONObject(String input) { return new JSONObject(new StringReader(input)); } @@ -5849,17 +6083,38 @@ public JSONObject parseJSONObject(String input) { * @see PApplet#saveJSONArray(JSONArray, String) */ public JSONObject loadJSONObject(String filename) { - return new JSONObject(createReader(filename)); + // can't pass of createReader() to the constructor b/c of resource leak + BufferedReader reader = createReader(filename); + JSONObject outgoing = new JSONObject(reader); + try { + reader.close(); + } catch (IOException e) { // not sure what would cause this + e.printStackTrace(); + } + return outgoing; } + /** + * @nowebref + */ static public JSONObject loadJSONObject(File file) { - return new JSONObject(createReader(file)); + // can't pass of createReader() to the constructor b/c of resource leak + BufferedReader reader = createReader(file); + JSONObject outgoing = new JSONObject(reader); + try { + reader.close(); + } catch (IOException e) { // not sure what would cause this + e.printStackTrace(); + } + return outgoing; } /** * @webref output:files + * @param json the JSONObject to save + * @param filename the name of the file to save to * @see JSONObject * @see JSONArray * @see PApplet#loadJSONObject(String) @@ -5871,11 +6126,20 @@ public boolean saveJSONObject(JSONObject json, String filename) { } + /** + * @param options "compact" and "indent=N", replace N with the number of spaces + */ public boolean saveJSONObject(JSONObject json, String filename, String options) { return json.save(saveFile(filename), options); } - +/** + * @webref input:files + * @param input String to parse as a JSONArray + * @see JSONObject + * @see PApplet#loadJSONObject(String) + * @see PApplet#saveJSONObject(JSONObject, String) + */ public JSONArray parseJSONArray(String input) { return new JSONArray(new StringReader(input)); } @@ -5884,24 +6148,41 @@ public JSONArray parseJSONArray(String input) { /** * @webref input:files * @param filename name of a file in the data folder or a URL - * @see JSONObject * @see JSONArray * @see PApplet#loadJSONObject(String) * @see PApplet#saveJSONObject(JSONObject, String) * @see PApplet#saveJSONArray(JSONArray, String) */ public JSONArray loadJSONArray(String filename) { - return new JSONArray(createReader(filename)); + // can't pass of createReader() to the constructor b/c of resource leak + BufferedReader reader = createReader(filename); + JSONArray outgoing = new JSONArray(reader); + try { + reader.close(); + } catch (IOException e) { // not sure what would cause this + e.printStackTrace(); + } + return outgoing; } static public JSONArray loadJSONArray(File file) { - return new JSONArray(createReader(file)); + // can't pass of createReader() to the constructor b/c of resource leak + BufferedReader reader = createReader(file); + JSONArray outgoing = new JSONArray(reader); + try { + reader.close(); + } catch (IOException e) { // not sure what would cause this + e.printStackTrace(); + } + return outgoing; } /** * @webref output:files + * @param json the JSONArray to save + * @param filename the name of the file to save to * @see JSONObject * @see JSONArray * @see PApplet#loadJSONObject(String) @@ -5912,7 +6193,9 @@ public boolean saveJSONArray(JSONArray json, String filename) { return saveJSONArray(json, filename, null); } - + /** + * @param options "compact" and "indent=N", replace N with the number of spaces + */ public boolean saveJSONArray(JSONArray json, String filename, String options) { return json.save(saveFile(filename), options); } @@ -5953,6 +6236,8 @@ public Table loadTable(String filename) { * (in terms of speed and memory usage) for loading and parsing tables. The * dictionary file can only be tab separated values (.tsv) and its extension * will be ignored. This option was added in Processing 2.0.2. + * + * @param options may contain "header", "tsv", "csv", or "bin" separated by commas */ public Table loadTable(String filename, String options) { try { @@ -5974,7 +6259,7 @@ public Table loadTable(String filename, String options) { return new Table(input, optionStr); } catch (IOException e) { - e.printStackTrace(); + printStackTrace(e); return null; } } @@ -6014,7 +6299,7 @@ public boolean saveTable(Table table, String filename, String options) { return table.save(outputFile, options); } catch (IOException e) { - e.printStackTrace(); + printStackTrace(e); return false; } } @@ -6074,18 +6359,6 @@ public PFont loadFont(String filename) { } - /** - * Used by PGraphics to remove the requirement for loading a font! - */ - protected PFont createDefaultFont(float size) { -// Font f = new Font("SansSerif", Font.PLAIN, 12); -// println("n: " + f.getName()); -// println("fn: " + f.getFontName()); -// println("ps: " + f.getPSName()); - return createFont("Lucida Sans", size, true, null); - } - - public PFont createFont(String name, float size) { return createFont(name, size, true, null); } @@ -6140,39 +6413,15 @@ public PFont createFont(String name, float size, boolean smooth) { * @param charset array containing characters to be generated * @see PFont * @see PGraphics#textFont(PFont, float) - * @see PGraphics#text(String, float, float, float, float, float) + * @see PGraphics#text(String, float, float, float, float) * @see PApplet#loadFont(String) */ public PFont createFont(String name, float size, boolean smooth, char[] charset) { - String lowerName = name.toLowerCase(); - Font baseFont = null; - - try { - InputStream stream = null; - if (lowerName.endsWith(".otf") || lowerName.endsWith(".ttf")) { - 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 = PFont.findFont(name); - } - return new PFont(baseFont.deriveFont(size * pixelDensity), - smooth, charset, stream != null, - pixelDensity); - - } catch (Exception e) { - System.err.println("Problem with createFont(\"" + name + "\")"); - e.printStackTrace(); - return null; + if (g == null) { + throw new RuntimeException("createFont() can only be used inside setup() or after setup() has been called."); } + return g.createFont(name, size, smooth, charset); } @@ -6208,6 +6457,25 @@ private Frame selectFrame() { */ + static private boolean lookAndFeelCheck; + + /** + * Initialize the Look & Feel if it hasn't been already. + * Call this before using any Swing-related code in PApplet methods. + */ + static private void checkLookAndFeel() { + if (!lookAndFeelCheck) { + if (platform == WINDOWS) { + // Windows is defaulting to Metal or something else awful. + // Which also is not scaled properly with HiDPI interfaces. + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (Exception e) { } + } + lookAndFeelCheck = true; + } + } + /** * Open a platform-specific file chooser dialog to select a file for input. * After the selection is made, the selected File will be passed to the @@ -6249,13 +6517,20 @@ public void selectInput(String prompt, String callback, File file) { public void selectInput(String prompt, String callback, File file, Object callbackObject) { - selectInput(prompt, callback, file, callbackObject, null); //selectFrame()); + selectInput(prompt, callback, file, callbackObject, null, this); //selectFrame()); + } + + + static public void selectInput(String prompt, String callbackMethod, + File file, Object callbackObject, Frame parent, + PApplet sketch) { + selectImpl(prompt, callbackMethod, file, callbackObject, parent, FileDialog.LOAD, sketch); } static public void selectInput(String prompt, String callbackMethod, File file, Object callbackObject, Frame parent) { - selectImpl(prompt, callbackMethod, file, callbackObject, parent, FileDialog.LOAD); + selectImpl(prompt, callbackMethod, file, callbackObject, parent, FileDialog.LOAD, null); } @@ -6270,6 +6545,7 @@ public void selectOutput(String prompt, String callback) { selectOutput(prompt, callback, null); } + public void selectOutput(String prompt, String callback, File file) { selectOutput(prompt, callback, file, this); } @@ -6277,32 +6553,47 @@ public void selectOutput(String prompt, String callback, File file) { public void selectOutput(String prompt, String callback, File file, Object callbackObject) { - selectOutput(prompt, callback, file, callbackObject, null); //selectFrame()); + selectOutput(prompt, callback, file, callbackObject, null, this); //selectFrame()); } static public void selectOutput(String prompt, String callbackMethod, File file, Object callbackObject, Frame parent) { - selectImpl(prompt, callbackMethod, file, callbackObject, parent, FileDialog.SAVE); + selectImpl(prompt, callbackMethod, file, callbackObject, parent, FileDialog.SAVE, null); } + static public void selectOutput(String prompt, String callbackMethod, + File file, Object callbackObject, Frame parent, + PApplet sketch) { + selectImpl(prompt, callbackMethod, file, callbackObject, parent, FileDialog.SAVE, sketch); + } + + + // Will remove the 'sketch' parameter once we get an upstream JOGL fix + // https://github.com/processing/processing/issues/3831 static protected void selectImpl(final String prompt, final String callbackMethod, final File defaultSelection, final Object callbackObject, final Frame parentFrame, - final int mode) { + final int mode, + final PApplet sketch) { EventQueue.invokeLater(new Runnable() { public void run() { File selectedFile = null; + boolean hide = (sketch != null) && + (sketch.g instanceof PGraphicsOpenGL) && (platform == WINDOWS); + if (hide) sketch.surface.setVisible(false); + if (useNativeSelect) { FileDialog dialog = new FileDialog(parentFrame, prompt, mode); if (defaultSelection != null) { dialog.setDirectory(defaultSelection.getParent()); dialog.setFile(defaultSelection.getName()); } + dialog.setVisible(true); String directory = dialog.getDirectory(); String filename = dialog.getFile(); @@ -6327,6 +6618,8 @@ public void run() { selectedFile = chooser.getSelectedFile(); } } + + if (hide) sketch.surface.setVisible(true); selectCallback(selectedFile, callbackMethod, callbackObject); } }); @@ -6352,7 +6645,7 @@ public void selectFolder(String prompt, String callback, File file) { public void selectFolder(String prompt, String callback, File file, Object callbackObject) { - selectFolder(prompt, callback, file, callbackObject, null); //selectFrame()); + selectFolder(prompt, callback, file, callbackObject, null, this); //selectFrame()); } @@ -6361,14 +6654,32 @@ static public void selectFolder(final String prompt, final File defaultSelection, final Object callbackObject, final Frame parentFrame) { + selectFolder(prompt, callbackMethod, defaultSelection, callbackObject, parentFrame, null); + } + + + // Will remove the 'sketch' parameter once we get an upstream JOGL fix + // https://github.com/processing/processing/issues/3831 + static public void selectFolder(final String prompt, + final String callbackMethod, + final File defaultSelection, + final Object callbackObject, + final Frame parentFrame, + final PApplet sketch) { EventQueue.invokeLater(new Runnable() { public void run() { File selectedFile = null; + boolean hide = (sketch != null) && + (sketch.g instanceof PGraphicsOpenGL) && (platform == WINDOWS); + if (hide) sketch.surface.setVisible(false); + if (platform == MACOSX && useNativeSelect != false) { FileDialog fileDialog = new FileDialog(parentFrame, prompt, FileDialog.LOAD); - fileDialog.setDirectory(defaultSelection.getAbsolutePath()); + if (defaultSelection != null) { + fileDialog.setDirectory(defaultSelection.getAbsolutePath()); + } System.setProperty("apple.awt.fileDialogForDirectories", "true"); fileDialog.setVisible(true); System.setProperty("apple.awt.fileDialogForDirectories", "false"); @@ -6377,11 +6688,12 @@ public void run() { selectedFile = new File(fileDialog.getDirectory(), fileDialog.getFile()); } } else { + checkLookAndFeel(); JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle(prompt); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (defaultSelection != null) { - fileChooser.setSelectedFile(defaultSelection); + fileChooser.setCurrentDirectory(defaultSelection); } int result = fileChooser.showOpenDialog(parentFrame); @@ -6389,6 +6701,8 @@ public void run() { selectedFile = fileChooser.getSelectedFile(); } } + + if (hide) sketch.surface.setVisible(true); selectCallback(selectedFile, callbackMethod, callbackObject); } }); @@ -6417,6 +6731,133 @@ static private void selectCallback(File selectedFile, + ////////////////////////////////////////////////////////////// + + // LISTING DIRECTORIES + + + public String[] listPaths(String path, String... options) { + File[] list = listFiles(path, options); + + int offset = 0; + for (String opt : options) { + if (opt.equals("relative")) { + if (!path.endsWith(File.pathSeparator)) { + path += File.pathSeparator; + } + offset = path.length(); + break; + } + } + String[] outgoing = new String[list.length]; + for (int i = 0; i < list.length; i++) { + // as of Java 1.8, substring(0) returns the original object + outgoing[i] = list[i].getAbsolutePath().substring(offset); + } + return outgoing; + } + + + public File[] listFiles(String path, String... options) { + File file = new File(path); + // if not an absolute path, make it relative to the sketch folder + if (!file.isAbsolute()) { + file = sketchFile(path); + } + return listFiles(file, options); + } + + + // "relative" -> no effect with the Files version, but important for listPaths + // "recursive" + // "extension=js" or "extensions=js|csv|txt" (no dot) + // "directories" -> only directories + // "files" -> only files + // "hidden" -> include hidden files (prefixed with .) disabled by default + static public File[] listFiles(File base, String... options) { + boolean recursive = false; + String[] extensions = null; + boolean directories = true; + boolean files = true; + boolean hidden = false; + + for (String opt : options) { + if (opt.equals("recursive")) { + recursive = true; + } else if (opt.startsWith("extension=")) { + extensions = new String[] { opt.substring(10) }; + } else if (opt.startsWith("extensions=")) { + extensions = split(opt.substring(10), ','); + } else if (opt.equals("files")) { + directories = false; + } else if (opt.equals("directories")) { + files = false; + } else if (opt.equals("hidden")) { + hidden = true; + } else if (opt.equals("relative")) { + // ignored + } else { + throw new RuntimeException(opt + " is not a listFiles() option"); + } + } + + if (extensions != null) { + for (int i = 0; i < extensions.length; i++) { + extensions[i] = "." + extensions[i]; + } + } + + if (!files && !directories) { + // just make "only files" and "only directories" mean... both + files = true; + directories = true; + } + + if (!base.canRead()) { + return null; + } + + List outgoing = new ArrayList<>(); + listFilesImpl(base, recursive, extensions, hidden, directories, files, outgoing); + return outgoing.toArray(new File[0]); + } + + + static void listFilesImpl(File folder, boolean recursive, + String[] extensions, boolean hidden, + boolean directories, boolean files, + List list) { + File[] items = folder.listFiles(); + if (items != null) { + for (File item : items) { + String name = item.getName(); + if (!hidden && name.charAt(0) == '.') { + continue; + } + if (item.isDirectory()) { + if (recursive) { + listFilesImpl(item, recursive, extensions, hidden, directories, files, list); + } + if (directories) { + list.add(item); + } + } else if (files) { + if (extensions == null) { + list.add(item); + } else { + for (String ext : extensions) { + if (item.getName().toLowerCase().endsWith(ext)) { + list.add(item); + } + } + } + } + } + } + } + + + ////////////////////////////////////////////////////////////// // EXTENSIONS @@ -6469,7 +6910,10 @@ static public String checkExtension(String filename) { public BufferedReader createReader(String filename) { InputStream is = createInput(filename); if (is == null) { - System.err.println(filename + " does not exist or could not be read"); + 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; } return createReader(is); @@ -6500,11 +6944,22 @@ static public BufferedReader createReader(File file) { * following lines any more I'm gonna send Sun my medical bills. */ static public BufferedReader createReader(InputStream input) { - InputStreamReader isr = null; + InputStreamReader isr = + new InputStreamReader(input, StandardCharsets.UTF_8); + + BufferedReader reader = new BufferedReader(isr); + // consume the Unicode BOM (byte order marker) if present try { - isr = new InputStreamReader(input, "UTF-8"); - } catch (UnsupportedEncodingException e) { } // not gonna happen - return new BufferedReader(isr); + reader.mark(1); + int c = reader.read(); + // if not the BOM, back up to the beginning again + if (c != '\uFEFF') { + reader.reset(); + } + } catch (IOException e) { + e.printStackTrace(); + } + return reader; } @@ -6563,29 +7018,19 @@ static public PrintWriter createWriter(File file) { * It's the JavaSoft API engineers who need to explain themselves. */ static public PrintWriter createWriter(OutputStream output) { - try { - BufferedOutputStream bos = new BufferedOutputStream(output, 8192); - OutputStreamWriter osw = new OutputStreamWriter(bos, "UTF-8"); - return new PrintWriter(osw); - } catch (UnsupportedEncodingException e) { } // not gonna happen - return null; + BufferedOutputStream bos = new BufferedOutputStream(output, 8192); + OutputStreamWriter osw = + new OutputStreamWriter(bos, StandardCharsets.UTF_8); + return new PrintWriter(osw); } + ////////////////////////////////////////////////////////////// // FILE INPUT - // Removed for 3.0a8 -// /** -// * @deprecated As of release 0136, use createInput() instead. -// */ -// public InputStream openStream(String filename) { -// return createInput(filename); -// } - - /** * ( begin auto-generated from createInput.xml ) * @@ -6652,23 +7097,28 @@ static public PrintWriter createWriter(OutputStream output) { * @webref input:files * @param filename the name of the file to use as input * @see PApplet#createOutput(String) - * @see PApplet#selectOutput(String) - * @see PApplet#selectInput(String) + * @see PApplet#selectOutput(String,String) + * @see PApplet#selectInput(String,String) * */ public InputStream createInput(String filename) { InputStream input = createInputRaw(filename); - final String lower = filename.toLowerCase(); - if ((input != null) && - (lower.endsWith(".gz") || lower.endsWith(".svgz"))) { - try { - return new GZIPInputStream(input); - } catch (IOException e) { - e.printStackTrace(); - return null; + if (input != null) { + // if it's gzip-encoded, automatically decode + final String lower = filename.toLowerCase(); + if (lower.endsWith(".gz") || lower.endsWith(".svgz")) { + try { + // buffered has to go *around* the GZ, otherwise 25x slower + return new BufferedInputStream(new GZIPInputStream(input)); + + } catch (IOException e) { + printStackTrace(e); + } + } else { + return new BufferedInputStream(input); } } - return input; + return null; } @@ -6689,19 +7139,19 @@ public InputStream createInputRaw(String filename) { return null; } - // First check whether this looks like a URL. This will prevent online - // access logs from being spammed with GET /sketchfolder/http://blahblah + // First check whether this looks like a URL if (filename.contains(":")) { // at least smells like URL try { URL url = new URL(filename); URLConnection conn = url.openConnection(); + if (conn instanceof HttpURLConnection) { HttpURLConnection httpConn = (HttpURLConnection) conn; // Will not handle a protocol change (see below) httpConn.setInstanceFollowRedirects(true); int response = httpConn.getResponseCode(); - // Normally will not follow HTTPS redirects from HTTP due to security concerns - // http://stackoverflow.com/questions/1884230/java-doesnt-follow-redirect-in-urlconnection/1884427 + // Default won't follow HTTP -> HTTPS redirects for security reasons + // http://stackoverflow.com/a/1884427 if (response >= 300 && response < 400) { String newLocation = httpConn.getHeaderField("Location"); return createInputRaw(newLocation); @@ -6719,7 +7169,7 @@ public InputStream createInputRaw(String filename) { } catch (IOException e) { // changed for 0117, shouldn't be throwing exception - e.printStackTrace(); + printStackTrace(e); //System.err.println("Error downloading from URL " + filename); return null; //throw new RuntimeException("Error downloading from URL " + filename); @@ -6825,13 +7275,13 @@ public InputStream createInputRaw(String filename) { } catch (SecurityException se) { } // online, whups } catch (Exception e) { - //die(e.getMessage(), e); - e.printStackTrace(); + printStackTrace(e); } return null; } + /** * @nowebref */ @@ -6839,12 +7289,17 @@ static public InputStream createInput(File file) { if (file == null) { throw new IllegalArgumentException("File passed to createInput() was null"); } + if (!file.exists()) { + System.err.println(file + " does not exist, createInput() will return null"); + return null; + } try { InputStream input = new FileInputStream(file); - if (file.getName().toLowerCase().endsWith(".gz")) { - return new GZIPInputStream(input); + final String lower = file.getName().toLowerCase(); + if (lower.endsWith(".gz") || lower.endsWith(".svgz")) { + return new BufferedInputStream(new GZIPInputStream(input)); } - return input; + return new BufferedInputStream(input); } catch (IOException e) { System.err.println("Could not createInput() for " + file); @@ -6876,13 +7331,83 @@ static public InputStream createInput(File file) { * */ public byte[] loadBytes(String filename) { + String lower = filename.toLowerCase(); + // If it's not a .gz file, then we might be able to uncompress it into + // a fixed-size buffer, which should help speed because we won't have to + // reallocate and resize the target array each time it gets full. + if (!lower.endsWith(".gz")) { + // If this looks like a URL, try to load it that way. Use the fact that + // URL connections may have a content length header to size the array. + if (filename.contains(":")) { // at least smells like URL + InputStream input = null; + try { + URL url = new URL(filename); + URLConnection conn = url.openConnection(); + int length = -1; + + if (conn instanceof HttpURLConnection) { + HttpURLConnection httpConn = (HttpURLConnection) conn; + // Will not handle a protocol change (see below) + httpConn.setInstanceFollowRedirects(true); + int response = httpConn.getResponseCode(); + // Default won't follow HTTP -> HTTPS redirects for security reasons + // http://stackoverflow.com/a/1884427 + if (response >= 300 && response < 400) { + String newLocation = httpConn.getHeaderField("Location"); + return loadBytes(newLocation); + } + length = conn.getContentLength(); + input = conn.getInputStream(); + } else if (conn instanceof JarURLConnection) { + length = conn.getContentLength(); + input = url.openStream(); + } + + if (input != null) { + byte[] buffer = null; + if (length != -1) { + buffer = new byte[length]; + int count; + int offset = 0; + while ((count = input.read(buffer, offset, length - offset)) > 0) { + offset += count; + } + } else { + buffer = loadBytes(input); + } + input.close(); + return buffer; + } + } catch (MalformedURLException mfue) { + // not a url, that's fine + + } catch (FileNotFoundException fnfe) { + // Java 1.5+ throws FNFE when URL not available + // http://dev.processing.org/bugs/show_bug.cgi?id=403 + + } catch (IOException e) { + printStackTrace(e); + return null; + + } finally { + if (input != null) { + try { + input.close(); + } catch (IOException e) { + // just deal + } + } + } + } + } + InputStream is = createInput(filename); if (is != null) { byte[] outgoing = loadBytes(is); try { is.close(); } catch (IOException e) { - e.printStackTrace(); // shouldn't happen + printStackTrace(e); // shouldn't happen } return outgoing; } @@ -6894,46 +7419,93 @@ public byte[] loadBytes(String filename) { return null; } + /** * @nowebref */ static public byte[] loadBytes(InputStream input) { try { - BufferedInputStream bis = new BufferedInputStream(input); ByteArrayOutputStream out = new ByteArrayOutputStream(); + byte[] buffer = new byte[4096]; - int c = bis.read(); - while (c != -1) { - out.write(c); - c = bis.read(); + int bytesRead = input.read(buffer); + while (bytesRead != -1) { + out.write(buffer, 0, bytesRead); + bytesRead = input.read(buffer); } + out.flush(); return out.toByteArray(); } catch (IOException e) { e.printStackTrace(); - //throw new RuntimeException("Couldn't load bytes from stream"); } return null; } - /** - * @nowebref - */ - static public byte[] loadBytes(File file) { - InputStream is = createInput(file); - byte[] byteArr = loadBytes(is); - try { - is.close(); + + /** + * @nowebref + */ + static public byte[] loadBytes(File file) { + if (!file.exists()) { + System.err.println(file + " does not exist, loadBytes() will return null"); + return null; + } + + try { + InputStream input; + int length; + + if (file.getName().toLowerCase().endsWith(".gz")) { + RandomAccessFile raf = new RandomAccessFile(file, "r"); + raf.seek(raf.length() - 4); + int b4 = raf.read(); + int b3 = raf.read(); + int b2 = raf.read(); + int b1 = raf.read(); + length = (b1 << 24) | (b2 << 16) + (b3 << 8) + b4; + raf.close(); + + // buffered has to go *around* the GZ, otherwise 25x slower + input = new BufferedInputStream(new GZIPInputStream(new FileInputStream(file))); + + } else { + long len = file.length(); + // http://stackoverflow.com/a/3039805 + int maxArraySize = Integer.MAX_VALUE - 5; + if (len > maxArraySize) { + System.err.println("Cannot use loadBytes() on a file larger than " + maxArraySize); + return null; + } + length = (int) len; + input = new BufferedInputStream(new FileInputStream(file)); + } + byte[] buffer = new byte[length]; + int count; + int offset = 0; + // count will come back 0 when complete (or -1 if somehow going long?) + while ((count = input.read(buffer, offset, length - offset)) > 0) { + offset += count; + } + input.close(); + return buffer; + } catch (IOException e) { e.printStackTrace(); + return null; } - return byteArr; } + /** * @nowebref */ static public String[] loadStrings(File file) { + if (!file.exists()) { + System.err.println(file + " does not exist, loadStrings() will return null"); + return null; + } + InputStream is = createInput(file); if (is != null) { String[] outgoing = loadStrings(is); @@ -6947,6 +7519,7 @@ static public String[] loadStrings(File file) { return null; } + /** * ( begin auto-generated from loadStrings.xml ) * @@ -6998,7 +7571,7 @@ public String[] loadStrings(String filename) { try { is.close(); } catch (IOException e) { - e.printStackTrace(); + printStackTrace(e); } return strArr; } @@ -7027,12 +7600,12 @@ static public String[] loadStrings(InputStream input) { static public String[] loadStrings(BufferedReader reader) { try { - String lines[] = new String[100]; + 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]; + String[] temp = new String[lineCount << 1]; System.arraycopy(lines, 0, temp, 0, lineCount); lines = temp; } @@ -7045,7 +7618,7 @@ static public String[] loadStrings(BufferedReader reader) { } // resize array to appropriate amount for these lines - String output[] = new String[lineCount]; + String[] output = new String[lineCount]; System.arraycopy(lines, 0, output, 0, lineCount); return output; @@ -7086,7 +7659,7 @@ static public String[] loadStrings(BufferedReader reader) { * @webref output:files * @param filename name of the file to open * @see PApplet#createInput(String) - * @see PApplet#selectOutput() + * @see PApplet#selectOutput(String,String) */ public OutputStream createOutput(String filename) { return createOutput(saveFile(filename)); @@ -7098,11 +7671,11 @@ public OutputStream createOutput(String filename) { static public OutputStream createOutput(File file) { try { createPath(file); // make sure the path exists - FileOutputStream fos = new FileOutputStream(file); + OutputStream output = new FileOutputStream(file); if (file.getName().toLowerCase().endsWith(".gz")) { - return new GZIPOutputStream(fos); + return new BufferedOutputStream(new GZIPOutputStream(output)); } - return fos; + return new BufferedOutputStream(output); } catch (IOException e) { e.printStackTrace(); @@ -7158,10 +7731,9 @@ public boolean saveStream(String target, InputStream source) { static public boolean saveStream(File target, InputStream source) { File tempFile = null; try { - File parentDir = target.getParentFile(); // make sure that this path actually exists before writing createPath(target); - tempFile = File.createTempFile(target.getName(), null, parentDir); + tempFile = createTempFile(target); FileOutputStream targetStream = new FileOutputStream(tempFile); saveStream(targetStream, source); @@ -7237,6 +7809,37 @@ public void saveBytes(String filename, byte[] data) { } + /** + * Creates a temporary file based on the name/extension of another file + * and in the same parent directory. Ensures that the same extension is used + * (i.e. so that .gz files are gzip compressed on output) and that it's done + * from the same directory so that renaming the file later won't cross file + * system boundaries. + */ + static private File createTempFile(File file) throws IOException { + File parentDir = file.getParentFile(); + if (!parentDir.exists()) { + parentDir.mkdirs(); + } + String name = file.getName(); + String prefix; + String suffix = null; + int dot = name.lastIndexOf('.'); + if (dot == -1) { + prefix = name; + } else { + // preserve the extension so that .gz works properly + prefix = name.substring(0, dot); + suffix = name.substring(dot); + } + // Prefix must be three characters + if (prefix.length() < 3) { + prefix += "processing"; + } + return File.createTempFile(prefix, suffix, parentDir); + } + + /** * @nowebref * Saves bytes to a specific File location specified by the user. @@ -7244,8 +7847,7 @@ public void saveBytes(String filename, byte[] data) { static public void saveBytes(File file, byte[] data) { File tempFile = null; try { - File parentDir = file.getParentFile(); - tempFile = File.createTempFile(file.getName(), null, parentDir); + tempFile = createTempFile(file); OutputStream output = createOutput(tempFile); saveBytes(output, data); @@ -7317,7 +7919,7 @@ static public void saveBytes(OutputStream output, byte[] data) { * @see PApplet#loadBytes(String) * @see PApplet#saveBytes(String, byte[]) */ - public void saveStrings(String filename, String data[]) { + public void saveStrings(String filename, String[] data) { saveStrings(saveFile(filename), data); } @@ -7325,7 +7927,7 @@ public void saveStrings(String filename, String data[]) { /** * @nowebref */ - static public void saveStrings(File file, String data[]) { + static public void saveStrings(File file, String[] data) { saveStrings(createOutput(file), data); } @@ -7354,10 +7956,10 @@ static protected String calcSketchPath() { try { folder = System.getProperty("user.dir"); - String jarPath = - PApplet.class.getProtectionDomain().getCodeSource().getLocation().getPath(); - // The jarPath from above will be URL encoded (%20 for spaces) - jarPath = urlDecode(jarPath); + URL jarURL = + PApplet.class.getProtectionDomain().getCodeSource().getLocation(); + // Decode URL + String jarPath = jarURL.toURI().getSchemeSpecificPart(); // Workaround for bug in Java for OS X from Oracle (7u51) // https://github.com/processing/processing/issues/2181 @@ -7508,12 +8110,17 @@ public File dataFile(String where) { File why = new File(where); if (why.isAbsolute()) return why; - String jarPath = - getClass().getProtectionDomain().getCodeSource().getLocation().getPath(); + URL jarURL = getClass().getProtectionDomain().getCodeSource().getLocation(); + // Decode URL + String jarPath; + try { + jarPath = jarURL.toURI().getPath(); + } catch (URISyntaxException e) { + e.printStackTrace(); + return null; + } if (jarPath.contains("Contents/Java/")) { - // The path will be URL encoded (%20 for spaces) coming from above - // http://code.google.com/p/processing/issues/detail?id=1073 - File containingFolder = new File(urlDecode(jarPath)).getParentFile(); + File containingFolder = new File(jarPath).getParentFile(); File dataFolder = new File(containingFolder, "data"); return new File(dataFolder, where); } @@ -7569,7 +8176,7 @@ static public String getExtension(String filename) { String lower = filename.toLowerCase(); int dot = filename.lastIndexOf('.'); if (dot == -1) { - extension = "unknown"; // no extension found + return ""; // no extension found } extension = lower.substring(dot + 1); @@ -7598,6 +8205,11 @@ static public String urlEncode(String str) { } + // DO NOT use for file paths, URLDecoder can't handle RFC2396 + // "The recommended way to manage the encoding and decoding of + // URLs is to use URI, and to convert between these two classes + // using toURI() and URI.toURL()." + // https://docs.oracle.com/javase/8/docs/api/java/net/URL.html static public String urlDecode(String str) { try { return URLDecoder.decode(str, "UTF-8"); @@ -7629,7 +8241,7 @@ static public String urlDecode(String str) { * @param list array to sort * @see PApplet#reverse(boolean[]) */ - static public byte[] sort(byte list[]) { + static public byte[] sort(byte[] list) { return sort(list, list.length); } @@ -7643,7 +8255,7 @@ static public byte[] sort(byte[] list, int count) { return outgoing; } - static public char[] sort(char list[]) { + static public char[] sort(char[] list) { return sort(list, list.length); } @@ -7654,7 +8266,7 @@ static public char[] sort(char[] list, int count) { return outgoing; } - static public int[] sort(int list[]) { + static public int[] sort(int[] list) { return sort(list, list.length); } @@ -7665,7 +8277,7 @@ static public int[] sort(int[] list, int count) { return outgoing; } - static public float[] sort(float list[]) { + static public float[] sort(float[] list) { return sort(list, list.length); } @@ -7676,7 +8288,7 @@ static public float[] sort(float[] list, int count) { return outgoing; } - static public String[] sort(String list[]) { + static public String[] sort(String[] list) { return sort(list, list.length); } @@ -7739,10 +8351,10 @@ static public void arrayCopy(Object src, Object dst) { System.arraycopy(src, 0, dst, 0, Array.getLength(src)); } - // /** - * @deprecated Use arrayCopy() instead. + * Use arrayCopy() instead. */ + @Deprecated static public void arraycopy(Object src, int srcPosition, Object dst, int dstPosition, int length) { @@ -7750,19 +8362,22 @@ static public void arraycopy(Object src, int srcPosition, } /** - * @deprecated Use arrayCopy() instead. + * Use arrayCopy() instead. */ + @Deprecated static public void arraycopy(Object src, Object dst, int length) { System.arraycopy(src, 0, dst, 0, length); } /** - * @deprecated Use arrayCopy() instead. + * Use arrayCopy() instead. */ + @Deprecated static public void arraycopy(Object src, Object dst) { System.arraycopy(src, 0, dst, 0, Array.getLength(src)); } + /** * ( begin auto-generated from expand.xml ) * @@ -7780,85 +8395,85 @@ static public void arraycopy(Object src, Object dst) { * @param list the array to expand * @see PApplet#shorten(boolean[]) */ - static public boolean[] expand(boolean list[]) { - return expand(list, list.length << 1); + static public boolean[] expand(boolean[] list) { + return expand(list, list.length > 0 ? list.length << 1 : 1); } /** * @param newSize new size for the array */ - static public boolean[] expand(boolean list[], int newSize) { - boolean temp[] = new boolean[newSize]; + 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) { + return expand(list, list.length > 0 ? list.length << 1 : 1); } - static public byte[] expand(byte list[], int newSize) { - byte temp[] = new byte[newSize]; + 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) { + return expand(list, list.length > 0 ? list.length << 1 : 1); } - static public char[] expand(char list[], int newSize) { - char temp[] = new char[newSize]; + 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) { + return expand(list, list.length > 0 ? list.length << 1 : 1); } - static public int[] expand(int list[], int newSize) { - int temp[] = new int[newSize]; + 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 long[] expand(long list[]) { - return expand(list, list.length << 1); + static public long[] expand(long[] list) { + return expand(list, list.length > 0 ? list.length << 1 : 1); } - static public long[] expand(long list[], int newSize) { - long temp[] = new long[newSize]; + static public long[] expand(long[] list, int newSize) { + long[] temp = new long[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) { + return expand(list, list.length > 0 ? list.length << 1 : 1); } - static public float[] expand(float list[], int newSize) { - float temp[] = new float[newSize]; + 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 double[] expand(double list[]) { - return expand(list, list.length << 1); + static public double[] expand(double[] list) { + return expand(list, list.length > 0 ? list.length << 1 : 1); } - static public double[] expand(double list[], int newSize) { - double temp[] = new double[newSize]; + static public double[] expand(double[] list, int newSize) { + double[] temp = new double[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) { + return expand(list, list.length > 0 ? list.length << 1 : 1); } - static public String[] expand(String list[], int newSize) { - String temp[] = new String[newSize]; + 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; @@ -7868,7 +8483,8 @@ static public String[] expand(String list[], int newSize) { * @nowebref */ static public Object expand(Object array) { - return expand(array, Array.getLength(array) << 1); + int len = Array.getLength(array); + return expand(array, len > 0 ? len << 1 : 1); } static public Object expand(Object list, int newSize) { @@ -7901,31 +8517,31 @@ static public Object expand(Object list, int newSize) { * @see PApplet#shorten(boolean[]) * @see PApplet#expand(boolean[]) */ - static public byte[] append(byte array[], byte value) { + static public byte[] append(byte[] array, byte value) { array = expand(array, array.length + 1); array[array.length-1] = value; return array; } - static public char[] append(char array[], char value) { + static public char[] append(char[] array, char value) { array = expand(array, array.length + 1); array[array.length-1] = value; return array; } - static public int[] append(int array[], int value) { + static public int[] append(int[] array, int value) { array = expand(array, array.length + 1); array[array.length-1] = value; return array; } - static public float[] append(float array[], float value) { + static public float[] append(float[] array, float value) { array = expand(array, array.length + 1); array[array.length-1] = value; return array; } - static public String[] append(String array[], String value) { + static public String[] append(String[] array, String value) { array = expand(array, array.length + 1); array[array.length-1] = value; return array; @@ -7955,27 +8571,27 @@ static public Object append(Object array, Object value) { * @see PApplet#append(byte[], byte) * @see PApplet#expand(boolean[]) */ - static public boolean[] shorten(boolean list[]) { + static public boolean[] shorten(boolean[] list) { return subset(list, 0, list.length-1); } - static public byte[] shorten(byte list[]) { + static public byte[] shorten(byte[] list) { return subset(list, 0, list.length-1); } - static public char[] shorten(char list[]) { + static public char[] shorten(char[] list) { return subset(list, 0, list.length-1); } - static public int[] shorten(int list[]) { + static public int[] shorten(int[] list) { return subset(list, 0, list.length-1); } - static public float[] shorten(float list[]) { + static public float[] shorten(float[] list) { return subset(list, 0, list.length-1); } - static public String[] shorten(String list[]) { + static public String[] shorten(String[] list) { return subset(list, 0, list.length-1); } @@ -8005,9 +8621,9 @@ static public Object shorten(Object list) { * @see PApplet#concat(boolean[], boolean[]) * @see PApplet#subset(boolean[], int, int) */ - static final public boolean[] splice(boolean list[], + static final public boolean[] splice(boolean[] list, boolean value, int index) { - boolean outgoing[] = new boolean[list.length + 1]; + boolean[] outgoing = new boolean[list.length + 1]; System.arraycopy(list, 0, outgoing, 0, index); outgoing[index] = value; System.arraycopy(list, index, outgoing, index + 1, @@ -8015,9 +8631,9 @@ static final public boolean[] splice(boolean list[], return outgoing; } - static final public boolean[] splice(boolean list[], - boolean value[], int index) { - boolean outgoing[] = new boolean[list.length + value.length]; + static final public boolean[] splice(boolean[] list, + boolean[] value, int index) { + boolean[] outgoing = new boolean[list.length + value.length]; System.arraycopy(list, 0, outgoing, 0, index); System.arraycopy(value, 0, outgoing, index, value.length); System.arraycopy(list, index, outgoing, index + value.length, @@ -8025,9 +8641,9 @@ static final public boolean[] splice(boolean list[], return outgoing; } - static final public byte[] splice(byte list[], + static final public byte[] splice(byte[] list, byte value, int index) { - byte outgoing[] = new byte[list.length + 1]; + byte[] outgoing = new byte[list.length + 1]; System.arraycopy(list, 0, outgoing, 0, index); outgoing[index] = value; System.arraycopy(list, index, outgoing, index + 1, @@ -8035,9 +8651,9 @@ static final public byte[] splice(byte list[], return outgoing; } - static final public byte[] splice(byte list[], - byte value[], int index) { - byte outgoing[] = new byte[list.length + value.length]; + static final public byte[] splice(byte[] list, + byte[] value, int index) { + byte[] outgoing = new byte[list.length + value.length]; System.arraycopy(list, 0, outgoing, 0, index); System.arraycopy(value, 0, outgoing, index, value.length); System.arraycopy(list, index, outgoing, index + value.length, @@ -8046,9 +8662,9 @@ static final public byte[] splice(byte list[], } - static final public char[] splice(char list[], + static final public char[] splice(char[] list, char value, int index) { - char outgoing[] = new char[list.length + 1]; + char[] outgoing = new char[list.length + 1]; System.arraycopy(list, 0, outgoing, 0, index); outgoing[index] = value; System.arraycopy(list, index, outgoing, index + 1, @@ -8056,9 +8672,9 @@ static final public char[] splice(char list[], return outgoing; } - static final public char[] splice(char list[], - char value[], int index) { - char outgoing[] = new char[list.length + value.length]; + static final public char[] splice(char[] list, + char[] value, int index) { + char[] outgoing = new char[list.length + value.length]; System.arraycopy(list, 0, outgoing, 0, index); System.arraycopy(value, 0, outgoing, index, value.length); System.arraycopy(list, index, outgoing, index + value.length, @@ -8066,9 +8682,9 @@ static final public char[] splice(char list[], return outgoing; } - static final public int[] splice(int list[], + static final public int[] splice(int[] list, int value, int index) { - int outgoing[] = new int[list.length + 1]; + int[] outgoing = new int[list.length + 1]; System.arraycopy(list, 0, outgoing, 0, index); outgoing[index] = value; System.arraycopy(list, index, outgoing, index + 1, @@ -8076,9 +8692,9 @@ static final public int[] splice(int list[], return outgoing; } - static final public int[] splice(int list[], - int value[], int index) { - int outgoing[] = new int[list.length + value.length]; + static final public int[] splice(int[] list, + int[] value, int index) { + int[] outgoing = new int[list.length + value.length]; System.arraycopy(list, 0, outgoing, 0, index); System.arraycopy(value, 0, outgoing, index, value.length); System.arraycopy(list, index, outgoing, index + value.length, @@ -8086,9 +8702,9 @@ static final public int[] splice(int list[], return outgoing; } - static final public float[] splice(float list[], + static final public float[] splice(float[] list, float value, int index) { - float outgoing[] = new float[list.length + 1]; + float[] outgoing = new float[list.length + 1]; System.arraycopy(list, 0, outgoing, 0, index); outgoing[index] = value; System.arraycopy(list, index, outgoing, index + 1, @@ -8096,9 +8712,9 @@ static final public float[] splice(float list[], return outgoing; } - static final public float[] splice(float list[], - float value[], int index) { - float outgoing[] = new float[list.length + value.length]; + static final public float[] splice(float[] list, + float[] value, int index) { + float[] outgoing = new float[list.length + value.length]; System.arraycopy(list, 0, outgoing, 0, index); System.arraycopy(value, 0, outgoing, index, value.length); System.arraycopy(list, index, outgoing, index + value.length, @@ -8106,9 +8722,9 @@ static final public float[] splice(float list[], return outgoing; } - static final public String[] splice(String list[], + static final public String[] splice(String[] list, String value, int index) { - String outgoing[] = new String[list.length + 1]; + String[] outgoing = new String[list.length + 1]; System.arraycopy(list, 0, outgoing, 0, index); outgoing[index] = value; System.arraycopy(list, index, outgoing, index + 1, @@ -8116,9 +8732,9 @@ static final public String[] splice(String list[], return outgoing; } - static final public String[] splice(String list[], - String value[], int index) { - String outgoing[] = new String[list.length + value.length]; + static final public String[] splice(String[] list, + String[] value, int index) { + String[] outgoing = new String[list.length + value.length]; System.arraycopy(list, 0, outgoing, 0, index); System.arraycopy(value, 0, outgoing, index, value.length); System.arraycopy(list, index, outgoing, index + value.length, @@ -8148,10 +8764,12 @@ static final public Object splice(Object list, Object value, int index) { return outgoing; } - static public boolean[] subset(boolean list[], int start) { + + static public boolean[] subset(boolean[] list, int start) { return subset(list, start, list.length - start); } + /** * ( begin auto-generated from subset.xml ) * @@ -8174,60 +8792,92 @@ static public boolean[] subset(boolean list[], int start) { * @param count number of values to extract * @see PApplet#splice(boolean[], boolean, int) */ - static public boolean[] subset(boolean list[], int start, int count) { - boolean output[] = new boolean[count]; + 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 byte[] subset(byte list[], int start) { + + static public int[] subset(int[] 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]; + + 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 char[] subset(char list[], int start) { + static public long[] subset(long[] 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]; + + static public long[] subset(long[] list, int start, int count) { + long[] output = new long[count]; System.arraycopy(list, start, output, 0, count); return output; } - static public int[] subset(int list[], int start) { + + static public float[] subset(float[] 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]; + + 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 float[] subset(float list[], int start) { + + static public double[] subset(double[] 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]; + + static public double[] subset(double[] list, int start, int count) { + double[] output = new double[count]; System.arraycopy(list, start, output, 0, count); return output; } - static public String[] subset(String list[], int start) { + 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]; + + static public String[] subset(String[] list, int start, int count) { + String[] output = new String[count]; System.arraycopy(list, start, output, 0, count); return output; } @@ -8238,6 +8888,7 @@ static public Object subset(Object list, int start) { 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); @@ -8264,43 +8915,43 @@ static public Object subset(Object list, int start, int count) { * @see PApplet#splice(boolean[], boolean, int) * @see PApplet#arrayCopy(Object, int, Object, int, int) */ - static public boolean[] concat(boolean a[], boolean b[]) { - boolean c[] = new boolean[a.length + b.length]; + 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]; + 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]; + 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]; + 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]; + 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]; + 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; @@ -8329,8 +8980,8 @@ static public Object concat(Object a, Object b) { * @param list booleans[], bytes[], chars[], ints[], floats[], or Strings[] * @see PApplet#sort(String[], int) */ - static public boolean[] reverse(boolean list[]) { - boolean outgoing[] = new boolean[list.length]; + 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]; @@ -8338,8 +8989,8 @@ static public boolean[] reverse(boolean list[]) { return outgoing; } - static public byte[] reverse(byte list[]) { - byte outgoing[] = new byte[list.length]; + 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]; @@ -8347,8 +8998,8 @@ static public byte[] reverse(byte list[]) { return outgoing; } - static public char[] reverse(char list[]) { - char outgoing[] = new char[list.length]; + 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]; @@ -8356,8 +9007,8 @@ static public char[] reverse(char list[]) { return outgoing; } - static public int[] reverse(int list[]) { - int outgoing[] = new int[list.length]; + 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]; @@ -8365,8 +9016,8 @@ static public int[] reverse(int list[]) { return outgoing; } - static public float[] reverse(float list[]) { - float outgoing[] = new float[list.length]; + 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]; @@ -8374,8 +9025,8 @@ static public float[] reverse(float list[]) { return outgoing; } - static public String[] reverse(String list[]) { - String outgoing[] = new String[list.length]; + 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]; @@ -8414,6 +9065,9 @@ static public Object reverse(Object list) { * @see PApplet#join(String[], char) */ static public String trim(String str) { + if (str == null) { + return null; + } return str.replace('\u00A0', ' ').trim(); } @@ -8422,10 +9076,13 @@ static public String trim(String str) { * @param array a String array */ static public String[] trim(String[] array) { + if (array == null) { + return null; + } String[] outgoing = new String[array.length]; for (int i = 0; i < array.length; i++) { if (array[i] != null) { - outgoing[i] = array[i].replace('\u00A0', ' ').trim(); + outgoing[i] = trim(array[i]); } } return outgoing; @@ -8492,7 +9149,7 @@ static public String[] splitTokens(String value) { */ static public String[] splitTokens(String value, String delim) { StringTokenizer toker = new StringTokenizer(value, delim); - String pieces[] = new String[toker.countTokens()]; + String[] pieces = new String[toker.countTokens()]; int index = 0; while (toker.hasMoreTokens()) { @@ -8542,7 +9199,7 @@ static public String[] split(String value, char delim) { if (value == null) return null; //return split(what, String.valueOf(delim)); // huh - char chars[] = value.toCharArray(); + char[] chars = value.toCharArray(); int splitCount = 0; //1; for (int i = 0; i < chars.length; i++) { if (chars[i] == delim) splitCount++; @@ -8554,12 +9211,12 @@ static public String[] split(String value, char delim) { // on second thought, i don't agree with this, will disable //} if (splitCount == 0) { - String splits[] = new String[1]; + String[] splits = new String[1]; splits[0] = value; return splits; } //int pieceCount = splitCount + 1; - String splits[] = new String[splitCount + 1]; + String[] splits = new String[splitCount + 1]; int splitIndex = 0; int startIndex = 0; for (int i = 0; i < chars.length; i++) { @@ -8578,7 +9235,7 @@ static public String[] split(String value, char delim) { static public String[] split(String value, String delim) { - ArrayList items = new ArrayList(); + List items = new ArrayList<>(); int index; int offset = 0; while ((index = value.indexOf(delim, offset)) != -1) { @@ -8592,26 +9249,22 @@ static public String[] split(String value, String delim) { } - static protected HashMap matchPatterns; + static protected LinkedHashMap matchPatterns; static Pattern matchPattern(String regexp) { Pattern p = null; if (matchPatterns == null) { - matchPatterns = new HashMap(); + matchPatterns = new LinkedHashMap(16, 0.75f, true) { + @Override + protected boolean removeEldestEntry(Map.Entry eldest) { + // Limit the number of match patterns at 10 most recently used + return size() == 10; + } + }; } else { p = matchPatterns.get(regexp); } if (p == null) { - if (matchPatterns.size() == 10) { - // Just clear out the match patterns here if more than 10 are being - // used. It's not terribly efficient, but changes that you have >10 - // different match patterns are very slim, unless you're doing - // something really tricky (like custom match() methods), in which - // case match() won't be efficient anyway. (And you should just be - // using your own Java code.) The alternative is using a queue here, - // but that's a silly amount of work for negligible benefit. - matchPatterns.clear(); - } p = Pattern.compile(regexp, Pattern.MULTILINE | Pattern.DOTALL); matchPatterns.put(regexp, p); } @@ -8707,7 +9360,7 @@ static public String[] match(String str, String regexp) { static public String[][] matchAll(String str, String regexp) { Pattern p = matchPattern(regexp); Matcher m = p.matcher(str); - ArrayList results = new ArrayList(); + List results = new ArrayList<>(); int count = m.groupCount() + 1; while (m.find()) { String[] groups = new String[count]; @@ -8804,8 +9457,8 @@ static final public boolean[] parseBoolean(byte what[]) { * 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]; + 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); } @@ -8823,8 +9476,8 @@ static final public boolean[] parseBoolean(float what[]) { } */ - static final public boolean[] parseBoolean(String what[]) { - boolean outgoing[] = new boolean[what.length]; + static final public boolean[] parseBoolean(String[] what) { + boolean[] outgoing = new boolean[what.length]; for (int i = 0; i < what.length; i++) { outgoing[i] = Boolean.parseBoolean(what[i]); } @@ -8858,32 +9511,32 @@ static final public byte[] parseByte(String what) { // note: array[] // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - static final public byte[] parseByte(boolean what[]) { - byte outgoing[] = new byte[what.length]; + 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]; + 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]; + 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]; + 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]; } @@ -8938,8 +9591,8 @@ static final public char[] parseChar(boolean what[]) { // 0/1 or T/F ? } */ - static final public char[] parseChar(byte what[]) { - char outgoing[] = new char[what.length]; + 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); } @@ -8955,8 +9608,8 @@ static final public char[] parseChar(int what[]) { } /* - static final public char[] parseChar(float what[]) { // nonsensical - char outgoing[] = new char[what.length]; + 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]; } @@ -9026,32 +9679,32 @@ static final public int parseInt(String what, int otherwise) { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - static final public int[] parseInt(boolean what[]) { - int list[] = new int[what.length]; + 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]; + 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]; + 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]; + 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]; } @@ -9067,7 +9720,7 @@ static public int[] parseInt(float what[]) { * * numbers will contain { 1, 300, 44 } */ - static public int[] parseInt(String what[]) { + static public int[] parseInt(String[] what) { return parseInt(what, 0); } @@ -9081,8 +9734,8 @@ static public int[] parseInt(String what[]) { * * numbers will contain { 1, 300, 9999, 44 } */ - static public int[] parseInt(String what[], int missing) { - int output[] = new int[what.length]; + 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]); @@ -9115,7 +9768,7 @@ static final public float parseFloat(String what) { static final public float parseFloat(String what, float otherwise) { try { - return new Float(what).floatValue(); + return Float.parseFloat(what); } catch (NumberFormatException e) { } return otherwise; @@ -9123,49 +9776,31 @@ static final public float parseFloat(String what, float 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[] parseFloat(byte what[]) { - float floaties[] = new float[what.length]; + static final public float[] parseFloat(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]; + 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[]) { + 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]; + 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(); + output[i] = Float.parseFloat(what[i]); } catch (NumberFormatException e) { output[i] = missing; } @@ -9197,32 +9832,32 @@ static final public String str(float x) { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - static final public String[] str(boolean x[]) { - String s[] = new String[x.length]; + 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]; + 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]; + 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]; + 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]; + 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; } @@ -9232,7 +9867,6 @@ static final public String[] str(float x[]) { // INT NUMBER FORMATTING - static public String nf(float num) { int inum = (int) num; if (num == inum) { @@ -9241,31 +9875,22 @@ static public String nf(float num) { return str(num); } - - static public String[] nf(float[] num) { - String[] outgoing = new String[num.length]; - for (int i = 0; i < num.length; i++) { - outgoing[i] = nf(num[i]); + static public String[] nf(float[] nums) { + String[] outgoing = new String[nums.length]; + for (int i = 0; i < nums.length; i++) { + outgoing[i] = nf(nums[i]); } return outgoing; } - /** * 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; - } - /** * ( begin auto-generated from nf.xml ) * @@ -9281,12 +9906,24 @@ static public String[] nf(int num[], int digits) { * * ( end auto-generated ) * @webref data:string_functions - * @param num the number(s) to format + * @param nums the numbers to format * @param digits number of digits to pad with zero * @see PApplet#nfs(float, int, int) * @see PApplet#nfp(float, int, int) * @see PApplet#nfc(float, int) - * @see PApplet#int(float) + * @see int(float) + */ + + static public String[] nf(int[] nums, int digits) { + String[] formatted = new String[nums.length]; + for (int i = 0; i < formatted.length; i++) { + formatted[i] = nf(nums[i], digits); + } + return formatted; + } + + /** + * @param num the number to format */ static public String nf(int num, int digits) { if ((int_nf != null) && @@ -9303,38 +9940,35 @@ static public String nf(int num, int digits) { return int_nf.format(num); } -/** + /** * ( begin auto-generated from nfc.xml ) * * Utility function for formatting numbers into strings and placing * appropriate commas to mark units of 1000. There are two versions, one * for formatting ints and one for formatting an array of ints. The value * for the digits parameter should always be a positive integer. - *

+ *

* For a non-US locale, this will insert periods instead of commas, or * whatever is apprioriate for that region. * * ( end auto-generated ) - * @webref data:string_functions - * @param num the number(s) to format - * @see PApplet#nf(float, int, int) - * @see PApplet#nfp(float, int, int) - * @see PApplet#nfs(float, int, int) - */ - static public String[] nfc(int num[]) { - String formatted[] = new String[num.length]; + * @webref data:string_functions + * @param nums the numbers to format + * @see PApplet#nf(float, int, int) + * @see PApplet#nfp(float, int, int) + * @see PApplet#nfs(float, int, int) + */ + static public String[] nfc(int[] nums) { + String[] formatted = new String[nums.length]; for (int i = 0; i < formatted.length; i++) { - formatted[i] = nfc(num[i]); + formatted[i] = nfc(nums[i]); } return formatted; } /** - * nfc() or "number format with commas". This is an unfortunate misnomer - * because in locales where a comma is not the separator for numbers, it - * won't actually be outputting a comma, it'll use whatever makes sense for - * the locale. + * @param num the number to format */ static public String nfc(int num) { if ((int_nf != null) && @@ -9371,7 +10005,7 @@ static public String nfc(int num) { * * ( end auto-generated ) * @webref data:string_functions - * @param num the number(s) to format + * @param num the number to format * @param digits number of digits to pad with zeroes * @see PApplet#nf(float, int, int) * @see PApplet#nfp(float, int, int) @@ -9381,10 +10015,13 @@ 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]; + /** + * @param nums the numbers to format + */ + static public String[] nfs(int[] nums, int digits) { + String[] formatted = new String[nums.length]; for (int i = 0; i < formatted.length; i++) { - formatted[i] = nfs(num[i], digits); + formatted[i] = nfs(nums[i], digits); } return formatted; } @@ -9407,7 +10044,7 @@ static public String[] nfs(int num[], int digits) { * * ( end auto-generated ) * @webref data:string_functions - * @param num the number(s) to format + * @param num the number to format * @param digits number of digits to pad with zeroes * @see PApplet#nf(float, int, int) * @see PApplet#nfs(float, int, int) @@ -9416,11 +10053,13 @@ static public String[] nfs(int num[], int digits) { 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]; + /** + * @param nums the numbers to format + */ + static public String[] nfp(int[] nums, int digits) { + String[] formatted = new String[nums.length]; for (int i = 0; i < formatted.length; i++) { - formatted[i] = nfp(num[i], digits); + formatted[i] = nfp(nums[i], digits); } return formatted; } @@ -9431,23 +10070,22 @@ static public String[] nfp(int num[], int digits) { // 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]; + /** + * @param left number of digits to the left of the decimal point + * @param right number of digits to the right of the decimal point + */ + static public String[] nf(float[] nums, int left, int right) { + String[] formatted = new String[nums.length]; for (int i = 0; i < formatted.length; i++) { - formatted[i] = nf(num[i], left, right); + formatted[i] = nf(nums[i], left, right); } return formatted; } -/** - * @param num[] the number(s) to format - * @param left number of digits to the left of the decimal point - * @param right number of digits to the right of the decimal point - */ + static public String nf(float num, int left, int right) { if ((float_nf != null) && (float_nf_left == left) && @@ -9470,19 +10108,17 @@ static public String nf(float num, int left, int right) { return float_nf.format(num); } -/** - * @param num[] the number(s) to format - * @param right number of digits to the right of the decimal point - */ - static public String[] nfc(float num[], int right) { - String formatted[] = new String[num.length]; + /** + * @param right number of digits to the right of the decimal point + */ + static public String[] nfc(float[] nums, int right) { + String[] formatted = new String[nums.length]; for (int i = 0; i < formatted.length; i++) { - formatted[i] = nfc(num[i], right); + formatted[i] = nfc(nums[i], right); } return formatted; } - static public String nfc(float num, int right) { if ((float_nf != null) && (float_nf_left == 0) && @@ -9506,14 +10142,13 @@ static public String nfc(float num, int right) { /** - * @param num[] the number(s) to format * @param left the number of digits to the left of the decimal point * @param right the number of digits to the right of the decimal point */ - static public String[] nfs(float num[], int left, int right) { - String formatted[] = new String[num.length]; + static public String[] nfs(float[] nums, int left, int right) { + String[] formatted = new String[nums.length]; for (int i = 0; i < formatted.length; i++) { - formatted[i] = nfs(num[i], left, right); + formatted[i] = nfs(nums[i], left, right); } return formatted; } @@ -9526,10 +10161,10 @@ static public String nfs(float num, int left, int right) { * @param left the number of digits to the left of the decimal point * @param right the number of digits to the right of the decimal point */ - static public String[] nfp(float num[], int left, int right) { - String formatted[] = new String[num.length]; + static public String[] nfp(float[] nums, int left, int right) { + String[] formatted = new String[nums.length]; for (int i = 0; i < formatted.length; i++) { - formatted[i] = nfp(num[i], left, right); + formatted[i] = nfp(nums[i], left, right); } return formatted; } @@ -9968,6 +10603,15 @@ static public void main(final String[] args) { } + /** + * Convenience method so that PApplet.main(YourSketch.class) + * launches a sketch, rather than having to call getName() on it. + */ + static public void main(final Class mainClass, String... args) { + main(mainClass.getName(), args); + } + + /** * Convenience method so that PApplet.main("YourSketch") launches a sketch, * rather than having to wrap it into a single element String array. @@ -9983,9 +10627,9 @@ static public void main(final String mainClass) { * sketch, rather than having to wrap it into a String array, and appending * the 'args' array when not null. * @param mainClass name of the class to load (with package if any) - * @param args command line arguments to pass to the sketch's 'args' array. - * Note that this is *not* the same as the args passed to (and - * understood by) PApplet such as --display. + * @param sketchArgs command line arguments to pass to the sketch's 'args' + * array. Note that this is not the same as the args passed + * to (and understood by) PApplet such as --display. */ static public void main(final String mainClass, final String[] sketchArgs) { String[] args = new String[] { mainClass }; @@ -10020,6 +10664,40 @@ static public void runSketch(final String[] args, // TODO IIRC this helped on Windows, but need to double check. System.setProperty("sun.awt.noerasebackground", "true"); + // Remove 60fps limit on the JavaFX "pulse" timer + System.setProperty("javafx.animation.fullspeed", "true"); + + // Doesn't seem to do anything helpful here (that can't be done via Runner) + //System.setProperty("com.apple.mrj.application.apple.menu.about.name", "potato"); + + Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { + public void uncaughtException(Thread t, Throwable e) { + e.printStackTrace(); + uncaughtThrowable = e; + } + }); + + // This doesn't work, need to mess with Info.plist instead + /* + // In an exported application, add the Contents/Java folder to the + // java.library.path, so that native libraries work properly. + // Without this, the library path is only set to Contents/MacOS + // where the launcher binary lives. + if (platform == MACOSX) { + URL coreJarURL = + PApplet.class.getProtectionDomain().getCodeSource().getLocation(); + // The jarPath from above will/may be URL encoded (%20 for spaces) + String coreJarPath = urlDecode(coreJarURL.getPath()); + if (coreJarPath.endsWith("/Contents/Java/core.jar")) { + // remove the /core.jar part from the end + String javaPath = coreJarPath.substring(0, coreJarPath.length() - 9); + String libraryPath = System.getProperty("java.library.path"); + libraryPath += File.pathSeparator + javaPath; + System.setProperty("java.library.path", libraryPath); + } + } + */ + // Catch any HeadlessException to provide more useful feedback try { // Call validate() while resize events are in progress @@ -10052,6 +10730,7 @@ static public void runSketch(final String[] args, // boolean fullScreen = false; boolean present = false; // boolean spanDisplays = false; + int density = -1; String param = null, value = null; String folder = calcSketchPath(); @@ -10068,9 +10747,11 @@ static public void runSketch(final String[] args, editorLocation = parseInt(split(value, ',')); } else if (param.equals(ARGS_DISPLAY)) { - displayNum = parseInt(value, -1); - if (displayNum == -1) { - System.err.println("Could not parse " + value + " for " + ARGS_DISPLAY); + displayNum = parseInt(value, -2); + if (displayNum == -2) { + // this means the display value couldn't be parsed properly + System.err.println(value + " is not a valid choice for " + ARGS_DISPLAY); + displayNum = -1; // use the default } } else if (param.equals(ARGS_WINDOW_COLOR)) { @@ -10094,6 +10775,15 @@ static public void runSketch(final String[] args, } else if (param.equals(ARGS_LOCATION)) { location = parseInt(split(value, ',')); + + } else if (param.equals(ARGS_DENSITY)) { + density = parseInt(value, -1); + if (density == -1) { + System.err.println("Could not parse " + value + " for " + ARGS_DENSITY); + } else if (density != 1 && density != 2) { + density = -1; + System.err.println(ARGS_DENSITY + " should be 1 or 2"); + } } } else { @@ -10135,7 +10825,7 @@ static public void runSketch(final String[] args, try { Class c = Thread.currentThread().getContextClassLoader().loadClass(name); - sketch = (PApplet) c.newInstance(); + sketch = (PApplet) c.getDeclaredConstructor().newInstance(); } catch (RuntimeException re) { // Don't re-package runtime exceptions throw re; @@ -10162,6 +10852,28 @@ static public void runSketch(final String[] args, // (and most likely, from the PDE's preference setting). sketch.display = displayNum; + // Set the suggested density that is coming from command line + // (most likely set from the PDE based on a system DPI scaling) + sketch.suggestedDensity = density; + + sketch.present = present; + + // For 3.0.1, moved this above handleSettings() so that loadImage() can be + // used inside settings(). Sets a terrible precedent, but the alternative + // of not being able to size a sketch to an image is driving people loopy. + // A handful of things that need to be set before init/start. +// if (folder == null) { +// folder = calcSketchPath(); +// } + sketch.sketchPath = folder; + + // Don't set 'args' to a zero-length array if it should be null [3.0a8] + if (args.length != argIndex + 1) { + // pass everything after the class name in as args to the sketch itself + // (fixed for 2.0a5, this was just subsetting by 1, which didn't skip opts) + sketch.args = PApplet.subset(args, argIndex + 1); + } + // Call the settings() method which will give us our size() call // try { sketch.handleSettings(); @@ -10169,9 +10881,6 @@ static public void runSketch(final String[] args, // System.err.println("I think I'm gonna hurl"); // } - // A handful of things that need to be set before init/start. - sketch.sketchPath = folder; - //// sketch.spanDisplays = spanDisplays; // // If spanning screens, that means we're also full screen. //// fullScreen |= spanDisplays; @@ -10186,13 +10895,6 @@ static public void runSketch(final String[] args, // //fullScreen |= sketch.sketchFullScreen(); // sketch.fullScreen |= fullScreen; - // Don't set 'args' to a zero-length array if it should be null [3.0a8] - if (args.length != argIndex + 1) { - // pass everything after the class name in as args to the sketch itself - // (fixed for 2.0a5, this was just subsetting by 1, which didn't skip opts) - sketch.args = PApplet.subset(args, argIndex + 1); - } - sketch.external = external; if (windowColor != 0) { @@ -11076,12 +11778,20 @@ public void filter(PShader shader) { } - /* - * @webref rendering:shaders - * @param a x-coordinate of the rectangle by default - * @param b y-coordinate of the rectangle by default - * @param c width of the rectangle by default - * @param d height of the rectangle by default + /** + * ( begin auto-generated from clip.xml ) + * + * Limits the rendering to the boundaries of a rectangle defined + * by the parameters. The boundaries are drawn based on the state + * of the imageMode() fuction, either CORNER, CORNERS, or CENTER. + * + * ( end auto-generated ) + * + * @webref rendering + * @param a x-coordinate of the rectangle, by default + * @param b y-coordinate of the rectangle, by default + * @param c width of the rectangle, by default + * @param d height of the rectangle, by default */ public void clip(float a, float b, float c, float d) { if (recorder != null) recorder.clip(a, b, c, d); @@ -11089,8 +11799,14 @@ public void clip(float a, float b, float c, float d) { } - /* - * @webref rendering:shaders + /** + * ( begin auto-generated from noClip.xml ) + * + * Disables the clipping previously started by the clip() function. + * + * ( end auto-generated ) + * + * @webref rendering */ public void noClip() { if (recorder != null) recorder.noClip(); @@ -11246,6 +11962,7 @@ public void curveVertex(float x, float y, float z) { * @webref shape:2d_primitives * @param x x-coordinate of the point * @param y y-coordinate of the point + * @see PGraphics#stroke(int) */ public void point(float x, float y) { if (recorder != null) recorder.point(x, y); @@ -11431,6 +12148,31 @@ public void rect(float a, float b, float c, float d, } + /** + * ( begin auto-generated from square.xml ) + * + * Draws a square to the screen. A square is a four-sided shape with + * every angle at ninety degrees and each side is the same length. + * By default, the first two parameters set the location of the + * upper-left corner, the third sets the width and height. The way + * these parameters are interpreted, however, may be changed with the + * rectMode() function. + * + * ( end auto-generated ) + * + * @webref shape:2d_primitives + * @param x x-coordinate of the rectangle by default + * @param y y-coordinate of the rectangle by default + * @param extent width and height of the rectangle by default + * @see PGraphics#rect(float, float, float, float) + * @see PGraphics#rectMode(int) + */ + public void square(float x, float y, float extent) { + if (recorder != null) recorder.square(x, y, extent); + g.square(x, y, extent); + } + + /** * ( begin auto-generated from ellipseMode.xml ) * @@ -11519,6 +12261,28 @@ public void arc(float a, float b, float c, float d, } + /** + * ( begin auto-generated from circle.xml ) + * + * Draws a circle to the screen. By default, the first two parameters + * set the location of the center, and the third sets the shape's width + * and height. The origin may be changed with the ellipseMode() + * function. + * + * ( end auto-generated ) + * @webref shape:2d_primitives + * @param x x-coordinate of the ellipse + * @param y y-coordinate of the ellipse + * @param extent width and height of the ellipse by default + * @see PApplet#ellipse(float, float, float, float) + * @see PApplet#ellipseMode(int) + */ + public void circle(float x, float y, float extent) { + if (recorder != null) recorder.circle(x, y, extent); + g.circle(x, y, extent); + } + + /** * ( begin auto-generated from box.xml ) * @@ -11798,17 +12562,17 @@ public void bezier(float x1, float y1, float z1, * ( begin auto-generated from curvePoint.xml ) * * Evalutes the curve at point t for points a, b, c, d. The parameter t - * varies between 0 and 1, a and d are points on the curve, and b and c are - * the control points. This can be done once with the x coordinates and a + * varies between 0 and 1, a and d are the control points, and b and c are + * the points on the curve. This can be done once with the x coordinates and a * second time with the y coordinates to get the location of a curve at t. * * ( end auto-generated ) * * @webref shape:curves - * @param a coordinate of first point on the curve - * @param b coordinate of second point on the curve - * @param c coordinate of third point on the curve - * @param d coordinate of fourth point on the curve + * @param a coordinate of first control point + * @param b coordinate of first point on the curve + * @param c coordinate of second point on the curve + * @param d coordinate of second control point * @param t value between 0 and 1 * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) * @see PGraphics#curveVertex(float, float) @@ -11832,10 +12596,10 @@ public float curvePoint(float a, float b, float c, float d, float t) { * Code thanks to Dave Bollinger (Bug #715) * * @webref shape:curves - * @param a coordinate of first point on the curve - * @param b coordinate of first control point - * @param c coordinate of second control point - * @param d coordinate of second point on the curve + * @param a coordinate of first control point on the curve + * @param b coordinate of first point + * @param c coordinate of first point + * @param d coordinate of second control point on the curve * @param t value between 0 and 1 * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) * @see PGraphics#curveVertex(float, float) @@ -12017,8 +12781,8 @@ public void imageMode(int mode) { * * @webref image:loading_displaying * @param img the image to display - * @param a x-coordinate of the image - * @param b y-coordinate of the image + * @param a x-coordinate of the image by default + * @param b y-coordinate of the image by default * @see PApplet#loadImage(String, String) * @see PImage * @see PGraphics#imageMode(int) @@ -12033,8 +12797,8 @@ public void image(PImage img, float a, float b) { /** - * @param c width to display the image - * @param d height to display the image + * @param c width to display the image by default + * @param d height to display the image by default */ public void image(PImage img, float a, float b, float c, float d) { if (recorder != null) recorder.image(img, a, b, c, d); @@ -12498,7 +13262,7 @@ public void text(char[] chars, int start, int stop, * ignored. * * @param x1 by default, the x-coordinate of text, see rectMode() for more info - * @param y1 by default, the x-coordinate of text, see rectMode() for more info + * @param y1 by default, the y-coordinate of text, see rectMode() for more info * @param x2 by default, the width of the text box, see rectMode() for more info * @param y2 by default, the height of the text box, see rectMode() for more info */ @@ -12541,6 +13305,82 @@ public void text(float num, float x, float y, float z) { } + /** + * ( begin auto-generated from push.xml ) + * + * The push() function saves the current drawing style + * settings and transformations, while pop() restores these + * settings. Note that these functions are always used together. + * They allow you to change the style and transformation settings + * and later return to what you had. When a new state is started + * with push(), it builds on the current style and transform + * information.
+ *
+ * push() stores information related to the current + * transformation state and style settings controlled by the + * following functions: rotate(), translate(), + * scale(), fill(), stroke(), tint(), + * strokeWeight(), strokeCap(), strokeJoin(), + * imageMode(), rectMode(), ellipseMode(), + * colorMode(), textAlign(), textFont(), + * textMode(), textSize(), textLeading().
+ *
+ * The push() and pop() functions were added with + * Processing 3.5. They can be used in place of pushMatrix(), + * popMatrix(), pushStyles(), and popStyles(). + * The difference is that push() and pop() control both the + * transformations (rotate, scale, translate) and the drawing styles + * at the same time. + * + * ( end auto-generated ) + * + * @webref structure + * @see PGraphics#pop() + */ + public void push() { + if (recorder != null) recorder.push(); + g.push(); + } + + + /** + * ( begin auto-generated from pop.xml ) + * + * The pop() function restores the previous drawing style + * settings and transformations after push() has changed them. + * Note that these functions are always used together. They allow + * you to change the style and transformation settings and later + * return to what you had. When a new state is started with push(), + * it builds on the current style and transform information.
+ *
+ *
+ * push() stores information related to the current + * transformation state and style settings controlled by the + * following functions: rotate(), translate(), + * scale(), fill(), stroke(), tint(), + * strokeWeight(), strokeCap(), strokeJoin(), + * imageMode(), rectMode(), ellipseMode(), + * colorMode(), textAlign(), textFont(), + * textMode(), textSize(), textLeading().
+ *
+ * The push() and pop() functions were added with + * Processing 3.5. They can be used in place of pushMatrix(), + * popMatrix(), pushStyles(), and popStyles(). + * The difference is that push() and pop() control both the + * transformations (rotate, scale, translate) and the drawing styles + * at the same time. + * + * ( end auto-generated ) + * + * @webref structure + * @see PGraphics#push() + */ + public void pop() { + if (recorder != null) recorder.pop(); + g.pop(); + } + + /** * ( begin auto-generated from pushMatrix.xml ) * @@ -12778,6 +13618,7 @@ public void rotateZ(float angle) { /** *

Advanced

* Rotate about a vector in space. Same as the glRotatef() function. + * @nowebref * @param x * @param y * @param z @@ -13124,6 +13965,7 @@ public void beginCamera() { * ( end auto-generated ) * * @webref lights_camera:camera + * @see PGraphics#beginCamera() * @see PGraphics#camera(float, float, float, float, float, float, float, float, float) */ public void endCamera() { @@ -13148,6 +13990,7 @@ public void endCamera() { * ( end auto-generated ) * * @webref lights_camera:camera + * @see PGraphics#beginCamera() * @see PGraphics#endCamera() * @see PGraphics#frustum(float, float, float, float, float, float) */ @@ -13292,6 +14135,7 @@ public void perspective(float fovy, float aspect, float zNear, float zFar) { * @param near near component of the clipping plane; must be greater than zero * @param far far component of the clipping plane; must be greater than the near value * @see PGraphics#camera(float, float, float, float, float, float, float, float, float) + * @see PGraphics#beginCamera() * @see PGraphics#endCamera() * @see PGraphics#perspective(float, float, float, float) */ @@ -14000,6 +14844,8 @@ public void specular(int rgb) { /** * gray number specifying value between white and black + * + * @param gray value between black and white, by default 0 to 255 */ public void specular(float gray) { if (recorder != null) recorder.specular(gray); @@ -14065,6 +14911,8 @@ public void emissive(int rgb) { /** * gray number specifying value between white and black + * + * @param gray value between black and white, by default 0 to 255 */ public void emissive(float gray) { if (recorder != null) recorder.emissive(gray); @@ -14916,8 +15764,8 @@ public void set(int x, int y, PImage img) { * * @webref pimage:method * @usage web_application + * @param img image to use as the mask * @brief Masks part of an image with another image as an alpha channel - * @param maskArray array of integers used as the alpha channel, needs to be the same length as the image's pixel array */ public void mask(PImage img) { if (recorder != null) recorder.mask(img); diff --git a/core/src/processing/core/PConstants.java b/core/src/processing/core/PConstants.java index c7d6e83951..6792ec0542 100644 --- a/core/src/processing/core/PConstants.java +++ b/core/src/processing/core/PConstants.java @@ -520,5 +520,8 @@ public interface PConstants { static final int DISABLE_KEY_REPEAT = 11; static final int ENABLE_KEY_REPEAT = -11; - static final int HINT_COUNT = 12; + static final int DISABLE_ASYNC_SAVEFRAME = 12; + static final int ENABLE_ASYNC_SAVEFRAME = -12; + + static final int HINT_COUNT = 13; } diff --git a/core/src/processing/core/PFont.java b/core/src/processing/core/PFont.java index 632cd7ec03..5c8d38c4b5 100644 --- a/core/src/processing/core/PFont.java +++ b/core/src/processing/core/PFont.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2012-19 The Processing Foundation Copyright (c) 2004-12 Ben Fry & Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology @@ -145,29 +145,26 @@ public class PFont implements PConstants { /** True if already tried to find the native AWT version of this font. */ protected boolean fontSearched; + /** + * The name of the font that Java uses when a font isn't found. + * See {@link #findFont(String)} and {@link #loadFonts()} for more info. + */ + static protected String systemFontName; + /** * Array of the native system fonts. Used to lookup native fonts by their * PostScript name. This is a workaround for a several year old Apple Java * bug that they can't be bothered to fix. */ static protected Font[] fonts; - static protected HashMap fontDifferent; - -// /** -// * If not null, this font is set to load dynamically. This is the default -// * when createFont() method is called without a character set. Bitmap -// * versions of characters are only created when prompted by an index() call. -// */ -// protected Font lazyFont; + static protected HashMap fontDifferent; + protected BufferedImage lazyImage; protected Graphics2D lazyGraphics; protected FontMetrics lazyMetrics; protected int[] lazySamples; - /** for subclasses that need to store metadata about the font */ -// protected HashMap cacheMap; - /** * @nowebref */ @@ -207,7 +204,7 @@ public PFont(Font font, boolean smooth) { * @nowebref * @param charset array of all unicode chars that should be included */ - public PFont(Font font, boolean smooth, char charset[]) { + public PFont(Font font, boolean smooth, char[] charset) { // save this so that we can use the native version this.font = font; this.smooth = smooth; @@ -332,7 +329,7 @@ public PFont(Font font, boolean smooth, char charset[]) { * * @nowebref */ - public PFont(Font font, boolean smooth, char charset[], + public PFont(Font font, boolean smooth, char[] charset, boolean stream, int density) { this(font, smooth, charset); this.stream = stream; @@ -785,7 +782,7 @@ public PShape getShape(char ch, float detail) { case PathIterator.SEG_CUBICTO: // 3 points // System.out.println("cubicto"); // PApplet.println(iterPoints); - s.quadraticVertex(iterPoints[0], iterPoints[1], + s.bezierVertex(iterPoints[0], iterPoints[1], iterPoints[2], iterPoints[3], iterPoints[4], iterPoints[5]); break; @@ -868,7 +865,7 @@ public PShape getShape(char ch, float detail) { for (int i = 0; i < EXTRA_CHARS.length; i++) { CHARSET[index++] = EXTRA_CHARS[i]; } - }; + } /** @@ -888,7 +885,7 @@ public PShape getShape(char ch, float detail) { */ static public String[] list() { loadFonts(); - String list[] = new String[fonts.length]; + String[] list = new String[fonts.length]; for (int i = 0; i < list.length; i++) { list[i] = fonts[i].getName(); } @@ -896,17 +893,33 @@ static public String[] list() { } + /** + * Make an internal list of all installed fonts. + * + * This can take a while with a lot of fonts installed, but running it on + * a separate thread may not help much. As of the commit that's adding this + * note, loadFonts() will only be called by PFont.list() and when loading a + * font by name, both of which are occasions when we'd need to block until + * this was finished anyway. It's also possible that running getAllFonts() + * on a non-EDT thread could cause graphics system issues. Further, the first + * fonts are usually loaded at the beginning of a sketch, meaning that sketch + * startup time will still be affected, even with threading in place. + * + * Where we're getting killed on font performance is due to this bug: + * https://bugs.openjdk.java.net/browse/JDK-8179209 + */ static public void loadFonts() { if (fonts == null) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); fonts = ge.getAllFonts(); + if (PApplet.platform == PConstants.MACOSX) { - fontDifferent = new HashMap(); + fontDifferent = new HashMap<>(); for (Font font : fonts) { - // getName() returns the PostScript name on OS X 10.6 w/ Java 6. + // No need to use getPSName() anymore because getName() + // returns the PostScript name on OS X 10.6 w/ Java 6. fontDifferent.put(font.getName(), font); - //fontDifferent.put(font.getPSName(), font); } } } @@ -917,21 +930,35 @@ static public void loadFonts() { * Starting with Java 1.5, Apple broke the ability to specify most fonts. * This bug was filed years ago as #4769141 at bugreporter.apple.com. More: * Bug 407. + *
+ * This function displays a warning when the font is not found + * and Java's system font is used. + * See: issue #5481 */ static public Font findFont(String name) { - loadFonts(); if (PApplet.platform == PConstants.MACOSX) { + loadFonts(); Font maybe = fontDifferent.get(name); if (maybe != null) { return maybe; } -// for (int i = 0; i < fonts.length; i++) { -// if (name.equals(fonts[i].getName())) { -// return fonts[i]; -// } -// } } - return new Font(name, Font.PLAIN, 1); + Font font = new Font(name, Font.PLAIN, 1); + + // make sure we have the name of the system fallback font + if (systemFontName == null) { + // Figure out what the font is named when things fail + systemFontName = new Font("", Font.PLAIN, 1).getFontName(); + } + + // warn the user if they didn't get the font they want + if (!name.equals(systemFontName) && + font.getFontName().equals(systemFontName)) { + PGraphics.showWarning("\"" + name + "\" is not available, " + + "so another font will be used. " + + "Use PFont.list() to show available fonts."); + } + return font; } diff --git a/core/src/processing/core/PGraphics.java b/core/src/processing/core/PGraphics.java index 9532783f26..d9b4be5192 100644 --- a/core/src/processing/core/PGraphics.java +++ b/core/src/processing/core/PGraphics.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2013-15 The Processing Foundation + Copyright (c) 2013-20 The Processing Foundation Copyright (c) 2004-12 Ben Fry and Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology @@ -29,11 +29,22 @@ import java.awt.Color; // Used for the 'image' object that's been here forever +import java.awt.Font; import java.awt.Image; +import java.io.File; +import java.io.InputStream; import java.util.Map; import java.util.HashMap; import java.util.WeakHashMap; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.RejectedExecutionException; +import java.util.concurrent.TimeUnit; import processing.opengl.PGL; import processing.opengl.PShader; @@ -216,7 +227,7 @@ public class PGraphics extends PImage implements PConstants { * images go out of scope, they will be properly garbage collected. */ protected WeakHashMap cacheMap = - new WeakHashMap(); + new WeakHashMap<>(); //////////////////////////////////////////////////////////// @@ -323,8 +334,11 @@ public class PGraphics extends PImage implements PConstants { /** True if colors are not in the range 0..1 */ boolean colorModeScale; // = true; - /** True if colorMode(RGB, 255) */ - boolean colorModeDefault; // = true; + /** + * True if colorMode(RGB, 255). Defaults to true so that color() + * used as part of a field declaration will properly assign values. + */ + boolean colorModeDefault = true; // ........................................................ @@ -556,7 +570,7 @@ public class PGraphics extends PImage implements PConstants { // vertices public static final int DEFAULT_VERTICES = 512; - protected float vertices[][] = + protected float[][] vertices = new float[DEFAULT_VERTICES][VERTEX_FIELD_COUNT]; protected int vertexCount; // total number of vertices @@ -591,7 +605,7 @@ public class PGraphics extends PImage implements PConstants { // spline vertices - protected float curveVertices[][]; + protected float[][] curveVertices; protected int curveVertexCount; // ........................................................ @@ -604,8 +618,8 @@ public class PGraphics extends PImage implements PConstants { // [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[] 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 { @@ -688,7 +702,9 @@ public class PGraphics extends PImage implements PConstants { // [toxi031031] new & faster sphere code w/ support flexible resolutions // will be set by sphereDetail() or 1st call to sphere() - protected float sphereX[], sphereY[], sphereZ[]; + protected float[] sphereX; + protected float[] sphereY; + protected float[] sphereZ; /// Number of U steps (aka "theta") around longitudinally spanning 2*pi public int sphereDetailU = 0; @@ -707,7 +723,8 @@ public class PGraphics extends PImage implements PConstants { public PGraphics() { - // Allows subclasses to override + // In 3.1.2, giving up on the async image saving as the default + hints[DISABLE_ASYNC_SAVEFRAME] = true; } @@ -794,6 +811,10 @@ public void setSize(int w, int h) { // ignore * endRaw(), in order to shut things off. */ public void dispose() { // ignore + if (primaryGraphics && asyncImageSaver != null) { + asyncImageSaver.dispose(); + asyncImageSaver = null; + } } @@ -813,7 +834,7 @@ public PSurface createSurface() { // ignore * image data, for instance a BufferedImage with tint() settings applied for * PGraphicsJava2D, or resized image data and OpenGL texture indices for * PGraphicsOpenGL. - * @param renderer The PGraphics renderer associated to the image + * @param image The image to be stored * @param storage The metadata required by the renderer */ public void setCache(PImage image, Object storage) { // ignore @@ -826,7 +847,6 @@ public void setCache(PImage image, Object storage) { // ignore * 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 renderer The PGraphics renderer associated to the image * @return metadata stored for the specified renderer */ public Object getCache(PImage image) { // ignore @@ -836,7 +856,7 @@ public Object getCache(PImage image) { // ignore /** * Remove information associated with this renderer from the cache, if any. - * @param renderer The PGraphics renderer whose cache data should be removed + * @param image The image whose cache data should be removed */ public void removeCache(PImage image) { // ignore cacheMap.remove(image); @@ -1110,20 +1130,25 @@ protected void reapplySettings() { * hint(DISABLE_OPENGL_ERROR_REPORT) - Speeds up the P3D renderer setting * by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT). *

- * hint(ENABLE_DEPTH_READING) - Depth and stencil buffers in P2D/P3D will be + * hint(ENABLE_BUFFER_READING) - Depth and stencil buffers in P2D/P3D will be * downsampled to make PGL#readPixels work with multisampling. Enabling this * introduces some overhead, so if you experience bad performance, disable * multisampling with noSmooth() instead. This hint is not intended to be * enabled and disabled repeatedely, so call this once in setup() or after * creating your PGraphics2D/3D. You can restore the default with - * hint(DISABLE_DEPTH_READING) if you don't plan to read depth from + * hint(DISABLE_BUFFER_READING) if you don't plan to read depth from * this PGraphics anymore. *

- * hint(ENABLE_KEY_AUTO_REPEAT) - Auto-repeating key events are discarded + * hint(ENABLE_KEY_REPEAT) - Auto-repeating key events are discarded * by default (works only in P2D/P3D); use this hint to get all the key events - * (including auto-repeated). Call hint(DISABLE_KEY_AUTO_REPEAT) to get events + * (including auto-repeated). Call hint(DISABLE_KEY_REPEAT) to get events * only when the key goes physically up or down. *

+ * hint(DISABLE_ASYNC_SAVEFRAME) - P2D/P3D only - save() and saveFrame() + * will not use separate threads for saving and will block until the image + * is written to the drive. This was the default behavior in 3.0b7 and before. + * To enable, call hint(ENABLE_ASYNC_SAVEFRAME). + *

* As of release 0149, unhint() has been removed in favor of adding * additional ENABLE/DISABLE constants to reset the default behavior. This * prevents the double negatives, and also reinforces which hints can be @@ -1365,7 +1390,7 @@ public void noTexture() { protected void vertexCheck() { if (vertexCount == vertices.length) { - float temp[][] = new float[vertexCount << 1][VERTEX_FIELD_COUNT]; + float[][] temp = new float[vertexCount << 1][VERTEX_FIELD_COUNT]; System.arraycopy(vertices, 0, temp, 0, vertexCount); vertices = temp; } @@ -1457,7 +1482,7 @@ public void vertex(float x, float y, float z) { // http://dev.processing.org/bugs/show_bug.cgi?id=444 if (shape == POLYGON) { if (vertexCount > 0) { - float pvertex[] = vertices[vertexCount-1]; + float[] pvertex = vertices[vertexCount-1]; if ((Math.abs(pvertex[X] - x) < EPSILON) && (Math.abs(pvertex[Y] - y) < EPSILON) && (Math.abs(pvertex[Z] - z) < EPSILON)) { @@ -1782,7 +1807,7 @@ public PShape createShape(int kind, float... p) { if (kind == POINT) { if (is3D() && len != 2 && len != 3) { throw new IllegalArgumentException("Use createShape(POINT, x, y) or createShape(POINT, x, y, z)"); - } else if (len != 2) { + } else if (is2D() && len != 2) { throw new IllegalArgumentException("Use createShape(POINT, x, y)"); } return createShapePrimitive(kind, p); @@ -1790,7 +1815,7 @@ public PShape createShape(int kind, float... p) { } else if (kind == LINE) { if (is3D() && len != 4 && len != 6) { throw new IllegalArgumentException("Use createShape(LINE, x1, y1, x2, y2) or createShape(LINE, x1, y1, z1, x2, y2, z1)"); - } else if (len != 4) { + } else if (is2D() && len != 4) { throw new IllegalArgumentException("Use createShape(LINE, x1, y1, x2, y2)"); } return createShapePrimitive(kind, p); @@ -1941,12 +1966,20 @@ public void filter(PShader shader) { // CLIPPING - /* - * @webref rendering:shaders - * @param a x-coordinate of the rectangle by default - * @param b y-coordinate of the rectangle by default - * @param c width of the rectangle by default - * @param d height of the rectangle by default + /** + * ( begin auto-generated from clip.xml ) + * + * Limits the rendering to the boundaries of a rectangle defined + * by the parameters. The boundaries are drawn based on the state + * of the imageMode() fuction, either CORNER, CORNERS, or CENTER. + * + * ( end auto-generated ) + * + * @webref rendering + * @param a x-coordinate of the rectangle, by default + * @param b y-coordinate of the rectangle, by default + * @param c width of the rectangle, by default + * @param d height of the rectangle, by default */ public void clip(float a, float b, float c, float d) { if (imageMode == CORNER) { @@ -1985,8 +2018,15 @@ protected void clipImpl(float x1, float y1, float x2, float y2) { showMissingWarning("clip"); } - /* - * @webref rendering:shaders + + /** + * ( begin auto-generated from noClip.xml ) + * + * Disables the clipping previously started by the clip() function. + * + * ( end auto-generated ) + * + * @webref rendering */ public void noClip() { showMissingWarning("noClip"); @@ -2070,6 +2110,7 @@ public void bezierVertex(float x2, float y2, } } + /** * ( begin auto-generated from bezierVertex.xml ) * @@ -2132,6 +2173,7 @@ public void bezierVertex(float x2, float y2, float z2, } } + /** * @webref shape:vertex * @param cx the x-coordinate of the control point @@ -2154,6 +2196,7 @@ public void quadraticVertex(float cx, float cy, x3, y3); } + /** * @param cz the z-coordinate of the control point * @param z3 the z-coordinate of the anchor point @@ -2170,10 +2213,12 @@ public void quadraticVertex(float cx, float cy, float cz, x3, y3, z3); } + protected void curveVertexCheck() { curveVertexCheck(shape); } + /** * Perform initialization specific to curveVertex(), and handle standard * error modes. Can be overridden by subclasses that need the flexibility. @@ -2197,6 +2242,7 @@ protected void curveVertexCheck(int shape) { curveInitCheck(); } + /** * ( begin auto-generated from curveVertex.xml ) * @@ -2226,9 +2272,9 @@ protected void curveVertexCheck(int shape) { */ public void curveVertex(float x, float y) { curveVertexCheck(); - float[] vertex = curveVertices[curveVertexCount]; - vertex[X] = x; - vertex[Y] = y; + float[] v = curveVertices[curveVertexCount]; + v[X] = x; + v[Y] = y; curveVertexCount++; // draw a segment if there are enough points @@ -2249,10 +2295,10 @@ public void curveVertex(float x, float y) { */ public void curveVertex(float x, float y, float z) { curveVertexCheck(); - float[] vertex = curveVertices[curveVertexCount]; - vertex[X] = x; - vertex[Y] = y; - vertex[Z] = z; + float[] v = curveVertices[curveVertexCount]; + v[X] = x; + v[Y] = y; + v[Z] = z; curveVertexCount++; // draw a segment if there are enough points @@ -2368,6 +2414,7 @@ protected void curveVertexSegment(float x1, float y1, float z1, * @webref shape:2d_primitives * @param x x-coordinate of the point * @param y y-coordinate of the point + * @see PGraphics#stroke(int) */ public void point(float x, float y) { beginShape(POINTS); @@ -2684,6 +2731,29 @@ protected void rectImpl(float x1, float y1, float x2, float y2, endShape(CLOSE); } + /** + * ( begin auto-generated from square.xml ) + * + * Draws a square to the screen. A square is a four-sided shape with + * every angle at ninety degrees and each side is the same length. + * By default, the first two parameters set the location of the + * upper-left corner, the third sets the width and height. The way + * these parameters are interpreted, however, may be changed with the + * rectMode() function. + * + * ( end auto-generated ) + * + * @webref shape:2d_primitives + * @param x x-coordinate of the rectangle by default + * @param y y-coordinate of the rectangle by default + * @param extent width and height of the rectangle by default + * @see PGraphics#rect(float, float, float, float) + * @see PGraphics#rectMode(int) + */ + public void square(float x, float y, float extent) { + rect(x, y, extent, extent); + } + ////////////////////////////////////////////////////////////// @@ -2860,6 +2930,26 @@ protected void arcImpl(float x, float y, float w, float h, showMissingWarning("arc"); } + /** + * ( begin auto-generated from circle.xml ) + * + * Draws a circle to the screen. By default, the first two parameters + * set the location of the center, and the third sets the shape's width + * and height. The origin may be changed with the ellipseMode() + * function. + * + * ( end auto-generated ) + * @webref shape:2d_primitives + * @param x x-coordinate of the ellipse + * @param y y-coordinate of the ellipse + * @param extent width and height of the ellipse by default + * @see PApplet#ellipse(float, float, float, float) + * @see PApplet#ellipseMode(int) + */ + public void circle(float x, float y, float extent) { + ellipse(x, y, extent, extent); + } + ////////////////////////////////////////////////////////////// @@ -3172,10 +3262,8 @@ public void sphere(float r) { */ 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; + return (a*t1 + 3*b*t)*t1*t1 + (3*c*t1 + d*t)*t*t; } - - /** * ( begin auto-generated from bezierTangent.xml ) * @@ -3338,17 +3426,17 @@ public void bezier(float x1, float y1, float z1, * ( begin auto-generated from curvePoint.xml ) * * Evalutes the curve at point t for points a, b, c, d. The parameter t - * varies between 0 and 1, a and d are points on the curve, and b and c are - * the control points. This can be done once with the x coordinates and a + * varies between 0 and 1, a and d are the control points, and b and c are + * the points on the curve. This can be done once with the x coordinates and a * second time with the y coordinates to get the location of a curve at t. * * ( end auto-generated ) * * @webref shape:curves - * @param a coordinate of first point on the curve - * @param b coordinate of second point on the curve - * @param c coordinate of third point on the curve - * @param d coordinate of fourth point on the curve + * @param a coordinate of first control point + * @param b coordinate of first point on the curve + * @param c coordinate of second point on the curve + * @param d coordinate of second control point * @param t value between 0 and 1 * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) * @see PGraphics#curveVertex(float, float) @@ -3382,10 +3470,10 @@ public float curvePoint(float a, float b, float c, float d, float t) { * Code thanks to Dave Bollinger (Bug #715) * * @webref shape:curves - * @param a coordinate of first point on the curve - * @param b coordinate of first control point - * @param c coordinate of second control point - * @param d coordinate of second point on the curve + * @param a coordinate of first control point on the curve + * @param b coordinate of first point + * @param c coordinate of first point + * @param d coordinate of second control point on the curve * @param t value between 0 and 1 * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) * @see PGraphics#curveVertex(float, float) @@ -3713,8 +3801,8 @@ public void imageMode(int mode) { * * @webref image:loading_displaying * @param img the image to display - * @param a x-coordinate of the image - * @param b y-coordinate of the image + * @param a x-coordinate of the image by default + * @param b y-coordinate of the image by default * @see PApplet#loadImage(String, String) * @see PImage * @see PGraphics#imageMode(int) @@ -3742,8 +3830,8 @@ public void image(PImage img, float a, float b) { } /** - * @param c width to display the image - * @param d height to display the image + * @param c width to display the image by default + * @param d height to display the image by default */ public void image(PImage img, float a, float b, float c, float d) { image(img, a, b, c, d, 0, 0, img.width, img.height); @@ -3838,6 +3926,11 @@ protected void imageImpl(PImage img, // fillA = 1; // } + u1 *= img.pixelDensity; + u2 *= img.pixelDensity; + v1 *= img.pixelDensity; + v2 *= img.pixelDensity; + beginShape(QUADS); texture(img); vertex(x1, y1, u1, v1); @@ -3857,6 +3950,7 @@ protected void imageImpl(PImage img, } + ////////////////////////////////////////////////////////////// // SHAPE @@ -3910,7 +4004,6 @@ public void shape(PShape shape) { } - /** * ( begin auto-generated from shape.xml ) * @@ -4008,11 +4101,60 @@ protected void shape(PShape shape, float x, float y, float z, float c, float d, } + ////////////////////////////////////////////////////////////// // TEXT/FONTS + /** + * Used by PGraphics to remove the requirement for loading a font. + */ + protected PFont createDefaultFont(float size) { + Font baseFont = new Font("Lucida Sans", Font.PLAIN, 1); + return createFont(baseFont, size, true, null, false); + } + + + protected PFont createFont(String name, float size, + boolean smooth, char[] charset) { + String lowerName = name.toLowerCase(); + Font baseFont = null; + + try { + InputStream stream = null; + if (lowerName.endsWith(".otf") || lowerName.endsWith(".ttf")) { + stream = parent.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, parent.createInput(name)); + + } else { + baseFont = PFont.findFont(name); + } + return createFont(baseFont, size, smooth, charset, stream != null); + + } catch (Exception e) { + System.err.println("Problem with createFont(\"" + name + "\")"); + e.printStackTrace(); + return null; + } + } + + + private PFont createFont(Font baseFont, float size, + boolean smooth, char[] charset, boolean stream) { + return new PFont(baseFont.deriveFont(size * parent.pixelDensity), + smooth, charset, stream, + parent.pixelDensity); + } + + public void textAlign(int alignX) { textAlign(alignX, BASELINE); } @@ -4136,8 +4278,43 @@ public float textDescent() { * @see PGraphics#textSize(float) */ public void textFont(PFont which) { - if (which != null) { - textFont = which; + if (which == null) { + throw new RuntimeException(ERROR_TEXTFONT_NULL_PFONT); + } + textFontImpl(which, which.getDefaultSize()); + } + + + /** + * @param size the size of the letters in units of pixels + */ + public void textFont(PFont which, float size) { + if (which == null) { + throw new RuntimeException(ERROR_TEXTFONT_NULL_PFONT); + } + // https://github.com/processing/processing/issues/3110 + if (size <= 0) { + // Using System.err instead of showWarning to avoid running out of + // memory with a bunch of textSize() variants (cause of this bug is + // usually something done with map() or in a loop). + System.err.println("textFont: ignoring size " + size + " px:" + + "the text size must be larger than zero"); + size = textSize; + } + textFontImpl(which, size); + } + + + /** + * Called from textFont. Check the validity of args and + * print possible errors to the user before calling this. + * Subclasses will want to override this one. + * + * @param which font to set, not null + * @param size size to set, greater than zero + */ + protected void textFontImpl(PFont which, float size) { + textFont = which; // if (hints[ENABLE_NATIVE_FONTS]) { // //if (which.font == null) { // which.findNative(); @@ -4166,20 +4343,8 @@ public void textFont(PFont which) { // float w = font.getStringBounds(text, g2.getFontRenderContext()).getWidth(); } */ - textSize(which.getDefaultSize()); - } else { - throw new RuntimeException(ERROR_TEXTFONT_NULL_PFONT); - } - } - - - /** - * @param size the size of the letters in units of pixels - */ - public void textFont(PFont which, float size) { - textFont(which); - textSize(size); + handleTextSize(size); } @@ -4293,6 +4458,26 @@ public void textSize(float size) { if (textFont == null) { defaultFontOrDeath("textSize", size); } + textSizeImpl(size); + } + + + /** + * Called from textSize() after validating size. Subclasses + * will want to override this one. + * @param size size of the text, greater than zero + */ + protected void textSizeImpl(float size) { + handleTextSize(size); + } + + + /** + * Sets the actual size. Called from textSizeImpl and + * from textFontImpl after setting the font. + * @param size size of the text, greater than zero + */ + protected void handleTextSize(float size) { textSize = size; textLeading = (textAscent() + textDescent()) * 1.275f; } @@ -4368,7 +4553,7 @@ public float textWidth(char[] chars, int start, int length) { * 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) { + 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 @@ -4572,7 +4757,7 @@ public void text(char[] chars, int start, int stop, * ignored. * * @param x1 by default, the x-coordinate of text, see rectMode() for more info - * @param y1 by default, the x-coordinate of text, see rectMode() for more info + * @param y1 by default, the y-coordinate of text, see rectMode() for more info * @param x2 by default, the width of the text box, see rectMode() for more info * @param y2 by default, the height of the text box, see rectMode() for more info */ @@ -4708,10 +4893,11 @@ protected boolean textSentence(char[] buffer, int start, int stop, // boundary of a word or end of this sentence if ((buffer[index] == ' ') || (index == stop)) { // System.out.println((index == stop) + " " + wordStart + " " + index); - if (wordStart == index) { // end of line, nothing is fitting - return false; + float wordWidth = 0; + if (index > wordStart) { + // we have a non-empty word, measure it + wordWidth = textWidthImpl(buffer, wordStart, index); } - float wordWidth = textWidthImpl(buffer, wordStart, index); if (runningX + wordWidth >= boxWidth) { if (runningX != 0) { @@ -4794,16 +4980,6 @@ protected void textSentenceBreak(int start, int stop) { } -// public void text(String s, float a, float b, float c, float d, float z) { -// if (z != 0) translate(0, 0, z); // slowness, badness -// -// text(s, a, b, c, d); -// 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); } @@ -4845,7 +5021,7 @@ public void text(float num, float x, float y, float z) { * 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, + protected void textLineAlignImpl(char[] buffer, int start, int stop, float x, float y) { if (textAlign == CENTER) { x -= textWidthImpl(buffer, start, stop) / 2f; @@ -4861,7 +5037,7 @@ protected void textLineAlignImpl(char buffer[], int start, int stop, /** * Implementation of actual drawing for a line of text. */ - protected void textLineImpl(char buffer[], int start, int stop, + 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); @@ -4985,27 +5161,84 @@ protected void textCharScreenImpl(PImage glyph, */ -// /** -// * Convenience method to get a legit FontMetrics object. Where possible, -// * override this any renderer subclass so that you're not using what's -// * returned by getDefaultToolkit() to get your metrics. -// */ -// @SuppressWarnings("deprecation") -// public FontMetrics getFontMetrics(Font font) { // ignore -// Frame frame = parent.frame; -// if (frame != null) { -// return frame.getToolkit().getFontMetrics(font); -// } -// return Toolkit.getDefaultToolkit().getFontMetrics(font); -// } -// -// -// /** -// * Convenience method to jump through some Java2D hoops and get an FRC. -// */ -// public FontRenderContext getFontRenderContext(Font font) { // ignore -// return getFontMetrics(font).getFontRenderContext(); -// } + + ////////////////////////////////////////////////////////////// + + // PARITY WITH P5.JS + + /** + * ( begin auto-generated from push.xml ) + * + * The push() function saves the current drawing style + * settings and transformations, while pop() restores these + * settings. Note that these functions are always used together. + * They allow you to change the style and transformation settings + * and later return to what you had. When a new state is started + * with push(), it builds on the current style and transform + * information.
+ *
+ * push() stores information related to the current + * transformation state and style settings controlled by the + * following functions: rotate(), translate(), + * scale(), fill(), stroke(), tint(), + * strokeWeight(), strokeCap(), strokeJoin(), + * imageMode(), rectMode(), ellipseMode(), + * colorMode(), textAlign(), textFont(), + * textMode(), textSize(), textLeading().
+ *
+ * The push() and pop() functions were added with + * Processing 3.5. They can be used in place of pushMatrix(), + * popMatrix(), pushStyles(), and popStyles(). + * The difference is that push() and pop() control both the + * transformations (rotate, scale, translate) and the drawing styles + * at the same time. + * + * ( end auto-generated ) + * + * @webref structure + * @see PGraphics#pop() + */ + public void push() { + pushStyle(); + pushMatrix(); + } + + /** + * ( begin auto-generated from pop.xml ) + * + * The pop() function restores the previous drawing style + * settings and transformations after push() has changed them. + * Note that these functions are always used together. They allow + * you to change the style and transformation settings and later + * return to what you had. When a new state is started with push(), + * it builds on the current style and transform information.
+ *
+ *
+ * push() stores information related to the current + * transformation state and style settings controlled by the + * following functions: rotate(), translate(), + * scale(), fill(), stroke(), tint(), + * strokeWeight(), strokeCap(), strokeJoin(), + * imageMode(), rectMode(), ellipseMode(), + * colorMode(), textAlign(), textFont(), + * textMode(), textSize(), textLeading().
+ *
+ * The push() and pop() functions were added with + * Processing 3.5. They can be used in place of pushMatrix(), + * popMatrix(), pushStyles(), and popStyles(). + * The difference is that push() and pop() control both the + * transformations (rotate, scale, translate) and the drawing styles + * at the same time. + * + * ( end auto-generated ) + * + * @webref structure + * @see PGraphics#push() + */ + public void pop() { + popStyle(); + popMatrix(); + } @@ -5249,6 +5482,7 @@ public void rotateZ(float angle) { /** *

Advanced

* Rotate about a vector in space. Same as the glRotatef() function. + * @nowebref * @param x * @param y * @param z @@ -5605,6 +5839,7 @@ public void beginCamera() { * ( end auto-generated ) * * @webref lights_camera:camera + * @see PGraphics#beginCamera() * @see PGraphics#camera(float, float, float, float, float, float, float, float, float) */ public void endCamera() { @@ -5627,6 +5862,7 @@ public void endCamera() { * ( end auto-generated ) * * @webref lights_camera:camera + * @see PGraphics#beginCamera() * @see PGraphics#endCamera() * @see PGraphics#frustum(float, float, float, float, float, float) */ @@ -5761,6 +5997,7 @@ public void perspective(float fovy, float aspect, float zNear, float zFar) { * @param near near component of the clipping plane; must be greater than zero * @param far far component of the clipping plane; must be greater than the near value * @see PGraphics#camera(float, float, float, float, float, float, float, float, float) + * @see PGraphics#beginCamera() * @see PGraphics#endCamera() * @see PGraphics#perspective(float, float, float, float) */ @@ -6041,7 +6278,9 @@ public void style(PStyle s) { ellipseMode(s.ellipseMode); shapeMode(s.shapeMode); - blendMode(s.blendMode); + if (blendMode != s.blendMode) { + blendMode(s.blendMode); + } if (s.tint) { tint(s.tintColor); @@ -6703,6 +6942,8 @@ public void specular(int rgb) { /** * gray number specifying value between white and black + * + * @param gray value between black and white, by default 0 to 255 */ public void specular(float gray) { colorCalc(gray); @@ -6780,6 +7021,8 @@ public void emissive(int rgb) { /** * gray number specifying value between white and black + * + * @param gray value between black and white, by default 0 to 255 */ public void emissive(float gray) { colorCalc(gray); @@ -7225,7 +7468,7 @@ protected void backgroundFromCalc() { * @param image PImage to set as background (must be same size as the sketch window) */ public void background(PImage image) { - if ((image.width != width) || (image.height != height)) { + if ((image.pixelWidth != pixelWidth) || (image.pixelHeight != pixelHeight)) { throw new RuntimeException(ERROR_BACKGROUND_IMAGE_SIZE); } if ((image.format != RGB) && (image.format != ARGB)) { @@ -7256,6 +7499,7 @@ protected void backgroundImpl() { pushStyle(); pushMatrix(); resetMatrix(); + noStroke(); fill(backgroundColor); rect(0, 0, width, height); popMatrix(); @@ -8000,7 +8244,7 @@ public PGraphics getRaw() { // ignore */ static public void showWarning(String msg) { // ignore if (warnings == null) { - warnings = new HashMap(); + warnings = new HashMap<>(); } if (!warnings.containsKey(msg)) { System.err.println(msg); @@ -8094,7 +8338,7 @@ protected void defaultFontOrDeath(String method) { */ protected void defaultFontOrDeath(String method, float size) { if (parent != null) { - textFont = parent.createDefaultFont(size); + textFont = createDefaultFont(size); } else { throw new RuntimeException("Use textFont() before " + method + "()"); } @@ -8147,4 +8391,193 @@ public boolean isGL() { // ignore public boolean is2X() { return pixelDensity == 2; } + + + ////////////////////////////////////////////////////////////// + + // ASYNC IMAGE SAVING + + + @Override + public boolean save(String filename) { // ignore + + if (hints[DISABLE_ASYNC_SAVEFRAME]) { + return super.save(filename); + } + + if (asyncImageSaver == null) { + asyncImageSaver = new AsyncImageSaver(); + } + + if (!loaded) loadPixels(); + PImage target = asyncImageSaver.getAvailableTarget(pixelWidth, pixelHeight, + format); + if (target == null) return false; + int count = PApplet.min(pixels.length, target.pixels.length); + System.arraycopy(pixels, 0, target.pixels, 0, count); + asyncImageSaver.saveTargetAsync(this, target, parent.sketchFile(filename)); + + return true; + } + + protected void processImageBeforeAsyncSave(PImage image) { } + + + /** + * If there is running async save task for this file, blocks until it completes. + * Has to be called on main thread because OpenGL overrides this and calls GL. + * @param filename + */ + protected void awaitAsyncSaveCompletion(String filename) { + if (asyncImageSaver != null) { + asyncImageSaver.awaitAsyncSaveCompletion(parent.sketchFile(filename)); + } + } + + + protected static AsyncImageSaver asyncImageSaver; + + protected static class AsyncImageSaver { + + static final int TARGET_COUNT = + Math.max(1, Runtime.getRuntime().availableProcessors() - 1); + + BlockingQueue targetPool = new ArrayBlockingQueue<>(TARGET_COUNT); + ExecutorService saveExecutor = Executors.newFixedThreadPool(TARGET_COUNT); + + int targetsCreated = 0; + + Map> runningTasks = new HashMap<>(); + final Object runningTasksLock = new Object(); + + + static final int TIME_AVG_FACTOR = 32; + + volatile long avgNanos = 0; + long lastTime = 0; + int lastFrameCount = 0; + + + public AsyncImageSaver() { } // ignore + + + public void dispose() { // ignore + saveExecutor.shutdown(); + try { + saveExecutor.awaitTermination(5000, TimeUnit.SECONDS); + } catch (InterruptedException e) { } + } + + + public boolean hasAvailableTarget() { // ignore + return targetsCreated < TARGET_COUNT || targetPool.isEmpty(); + } + + + /** + * After taking a target, you must call saveTargetAsync() or + * returnUnusedTarget(), otherwise one thread won't be able to run + */ + public PImage getAvailableTarget(int requestedWidth, int requestedHeight, // ignore + int format) { + try { + PImage target; + if (targetsCreated < TARGET_COUNT && targetPool.isEmpty()) { + target = new PImage(requestedWidth, requestedHeight); + targetsCreated++; + } else { + target = targetPool.take(); + if (target.pixelWidth != requestedWidth || + target.pixelHeight != requestedHeight) { + // TODO: this kills performance when saving different sizes + target = new PImage(requestedWidth, requestedHeight); + } + } + target.format = format; + return target; + } catch (InterruptedException e) { + return null; + } + } + + + public void returnUnusedTarget(PImage target) { // ignore + targetPool.offer(target); + } + + + public void saveTargetAsync(final PGraphics renderer, final PImage target, // ignore + final File file) { + target.parent = renderer.parent; + + // if running every frame, smooth the framerate + if (target.parent.frameCount - 1 == lastFrameCount && TARGET_COUNT > 1) { + + // count with one less thread to reduce jitter + // 2 cores - 1 save thread - no wait + // 4 cores - 3 save threads - wait 1/2 of save time + // 8 cores - 7 save threads - wait 1/6 of save time + long avgTimePerFrame = avgNanos / (Math.max(1, TARGET_COUNT - 1)); + long now = System.nanoTime(); + long delay = PApplet.round((lastTime + avgTimePerFrame - now) / 1e6f); + try { + if (delay > 0) Thread.sleep(delay); + } catch (InterruptedException e) { } + } + + lastFrameCount = target.parent.frameCount; + lastTime = System.nanoTime(); + + awaitAsyncSaveCompletion(file); + + // Explicit lock, because submitting a task and putting it into map + // has to be atomic (and happen before task tries to remove itself) + synchronized (runningTasksLock) { + try { + Future task = saveExecutor.submit(() -> { + try { + long startTime = System.nanoTime(); + renderer.processImageBeforeAsyncSave(target); + target.save(file.getAbsolutePath()); + long saveNanos = System.nanoTime() - startTime; + synchronized (AsyncImageSaver.this) { + if (avgNanos == 0) { + avgNanos = saveNanos; + } else if (saveNanos < avgNanos) { + avgNanos = (avgNanos * (TIME_AVG_FACTOR - 1) + saveNanos) / + (TIME_AVG_FACTOR); + } else { + avgNanos = saveNanos; + } + } + } finally { + targetPool.offer(target); + synchronized (runningTasksLock) { + runningTasks.remove(file); + } + } + }); + runningTasks.put(file, task); + } catch (RejectedExecutionException e) { + // the executor service was probably shut down, no more saving for us + } + } + } + + + public void awaitAsyncSaveCompletion(final File file) { // ignore + Future taskWithSameFilename; + synchronized (runningTasksLock) { + taskWithSameFilename = runningTasks.get(file); + } + + if (taskWithSameFilename != null) { + try { + taskWithSameFilename.get(); + } catch (InterruptedException | ExecutionException e) { } + } + } + + } + } diff --git a/core/src/processing/core/PImage.java b/core/src/processing/core/PImage.java index bc7ba30eee..d83b1da5d0 100644 --- a/core/src/processing/core/PImage.java +++ b/core/src/processing/core/PImage.java @@ -90,7 +90,7 @@ public class PImage implements PConstants, Cloneable { * * @webref image:pixels * @usage web_application - * @brief Array containing the color of every pixel in the image + * @brief Array containing the color of every pixel in the image */ public int[] pixels; @@ -345,8 +345,8 @@ public PImage(Image img) { /** * Use the getNative() method instead, which allows library interfaces to be * written in a cross-platform fashion for desktop, Android, and others. + * This is still included for PGraphics objects, which may need the image. */ - @Deprecated public Image getImage() { // ignore return (Image) getNative(); } @@ -936,8 +936,11 @@ protected void setImpl(PImage sourceImage, // ALPHA CHANNEL - @Deprecated - public void mask(int maskArray[]) { // ignore + /** + * @param maskArray array of integers used as the alpha channel, needs to be + * the same length as the image's pixel array. + */ + public void mask(int[] maskArray) { // ignore loadPixels(); // don't execute if mask image is different size if (maskArray.length != pixels.length) { @@ -983,8 +986,8 @@ public void mask(int maskArray[]) { // ignore * * @webref pimage:method * @usage web_application + * @param img image to use as the mask * @brief Masks part of an image with another image as an alpha channel - * @param maskArray array of integers used as the alpha channel, needs to be the same length as the image's pixel array */ public void mask(PImage img) { img.loadPixels(); @@ -1236,7 +1239,7 @@ protected void buildBlurKernel(float r) { protected void blurAlpha(float r) { int sum, cb; int read, ri, ym, ymi, bk0; - int b2[] = new int[pixels.length]; + int[] b2 = new int[pixels.length]; int yi = 0; buildBlurKernel(r); @@ -1307,9 +1310,9 @@ protected void blurAlpha(float r) { 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[] r2 = new int[pixels.length]; + int[] g2 = new int[pixels.length]; + int[] b2 = new int[pixels.length]; int yi = 0; buildBlurKernel(r); @@ -1390,10 +1393,10 @@ 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[] r2 = new int[wh]; + int[] g2 = new int[wh]; + int[] b2 = new int[wh]; + int[] a2 = new int[wh]; int yi = 0; buildBlurKernel(r); @@ -2945,7 +2948,7 @@ private static int blend_burn(int dst, int src) { // FILE I/O - static byte TIFF_HEADER[] = { + 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, @@ -2958,7 +2961,7 @@ private static int blend_burn(int dst, int src) { static final String TIFF_ERROR = "Error: Processing can only read its own TIFF files."; - static protected PImage loadTIFF(byte tiff[]) { + 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); @@ -3015,7 +3018,7 @@ protected boolean saveTIFF(OutputStream output) { } */ try { - byte tiff[] = new byte[768]; + byte[] tiff = new byte[768]; System.arraycopy(TIFF_HEADER, 0, tiff, 0, TIFF_HEADER.length); tiff[30] = (byte) ((pixelWidth >> 8) & 0xff); @@ -3066,7 +3069,7 @@ protected boolean saveTIFF(OutputStream output) { * specification */ protected boolean saveTGA(OutputStream output) { - byte header[] = new byte[18]; + byte[] header = new byte[18]; if (format == ALPHA) { // save ALPHA images as 8bit grayscale header[2] = 0x0B; @@ -3325,15 +3328,13 @@ private IIOMetadata imageioDPI(ImageWriter writer, ImageWriteParam param, double /** * ( begin auto-generated from PImage_save.xml ) * - * Saves the image into a file. Images are saved in TIFF, TARGA, JPEG, and - * PNG format depending on the extension within the filename - * parameter. For example, "image.tif" will have a TIFF image and - * "image.png" will save a PNG image. If no extension is included in the - * filename, the image will save in TIFF format and .tif will be - * added to the name. These files are saved to the sketch's folder, which + * Saves the image into a file. Append a file extension to the name of + * the file, to indicate the file format to be used: either TIFF (.tif), + * TARGA (.tga), JPEG (.jpg), or PNG (.png). If no extension is included + * in the filename, the image will save in TIFF format and .tif will be + * added to the name. These files are saved to the sketch's folder, which * may be opened by selecting "Show sketch folder" from the "Sketch" menu. - * It is not possible to use save() while running the program in a - * web browser.

To save an image created within the code, rather + *

To save an image created within the code, rather * than through loading, it's necessary to make the image with the * createImage() function so it is aware of the location of the * program and can therefore save the file to the right place. See the diff --git a/core/src/processing/core/PMatrix.java b/core/src/processing/core/PMatrix.java index 2670eb5cea..edb1d260eb 100644 --- a/core/src/processing/core/PMatrix.java +++ b/core/src/processing/core/PMatrix.java @@ -24,8 +24,21 @@ package processing.core; +/** + * A matrix is used to define graphical transformations. PMatrix is the common + * interface for both the 2D and 3D matrix classes in Processing. A matrix is a + * grid of numbers, which can be multiplied by a vector to give another vector. + * Multiplying a point by a particular matrix might translate it, rotate it, + * or carry out a combination of transformations. + * + * Multiplying matrices by each other combines their effects; use the + * {@code apply} and {@code preApply} methods for this. + */ public interface PMatrix { + /** + * Make this an identity matrix. Multiplying by it will have no effect. + */ public void reset(); /** @@ -40,13 +53,26 @@ public interface PMatrix { public float[] get(float[] target); + /** + * Make this matrix become a copy of src. + */ public void set(PMatrix src); + /** + * Set the contents of this matrix to the contents of source. Fills the + * matrix left-to-right, starting in the top row. + */ public void set(float[] source); + /** + * Set the matrix content to this 2D matrix or its 3D equivalent. + */ public void set(float m00, float m01, float m02, float m10, float m11, float m12); + /** + * Set the matrix content to the 3D matrix supplied, if this matrix is 3D. + */ 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, @@ -77,18 +103,30 @@ public void set(float m00, float m01, float m02, float m03, public void shearY(float angle); - /** + /** * Multiply this matrix by another. */ public void apply(PMatrix source); + /** + * Multiply this matrix by another. + */ public void apply(PMatrix2D source); + /** + * Multiply this matrix by another. + */ public void apply(PMatrix3D source); + /** + * Multiply this matrix by another. + */ public void apply(float n00, float n01, float n02, float n10, float n11, float n12); + /** + * Multiply this matrix by another. + */ 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, @@ -99,27 +137,44 @@ public void apply(float n00, float n01, float n02, float n03, */ public void preApply(PMatrix left); + /** + * Apply another matrix to the left of this one. + */ public void preApply(PMatrix2D left); + /** + * Apply another matrix to the left of this one. 3D only. + */ public void preApply(PMatrix3D left); + /** + * Apply another matrix to the left of this one. + */ public void preApply(float n00, float n01, float n02, float n10, float n11, float n12); + /** + * Apply another matrix to the left of this one. 3D only. + */ 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. + /** + * Multiply source by this matrix, and return the result. + * The result will be stored in target if target is non-null, and target + * will then be the matrix returned. This improves performance if you reuse + * target, so it's recommended if you call this many times in draw(). */ public PVector mult(PVector source, PVector target); - /** - * Multiply a multi-element vector against this matrix. + /** + * Multiply a multi-element vector against this matrix. + * Supplying and recycling a target array improves performance, so it's + * recommended if you call this many times in draw(). */ public float[] mult(float[] source, float[] target); @@ -133,13 +188,14 @@ public void preApply(float n00, float n01, float n02, float n03, /** - * Transpose this matrix. + * Transpose this matrix; rows become columns and columns rows. */ public void transpose(); /** - * Invert this matrix. + * Invert this matrix. Will not necessarily succeed, because some matrices + * map more than one point to the same image point, and so are irreversible. * @return true if successful */ public boolean invert(); @@ -149,4 +205,4 @@ public void preApply(float n00, float n01, float n02, float n03, * @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 index 1ee6b0a88a..c30a3504e3 100644 --- a/core/src/processing/core/PMatrix2D.java +++ b/core/src/processing/core/PMatrix2D.java @@ -26,6 +26,15 @@ /** * 3x2 affine matrix implementation. + * Matrices are used to describe a transformation; see {@link PMatrix} for a + * general description. This matrix looks like the following when multiplying + * a vector (x, y) in {@code mult()}. + *
+ * [m00 m01 m02][x]   [m00*x + m01*y + m02*1]   [x']
+ * [m10 m11 m12][y] = [m10*x + m11*y + m12*1] = [y']
+ * [ 0   0   1 ][1]   [ 0*x  +  0*y  +  1*1 ]   [ 1]
+ * (x', y') is returned. The values in the matrix determine the transformation. + * They are modified by the various transformation functions. */ public class PMatrix2D implements PMatrix { @@ -33,6 +42,9 @@ public class PMatrix2D implements PMatrix { public float m10, m11, m12; + /** + * Create a new matrix, set to the identity matrix. + */ public PMatrix2D() { reset(); } @@ -69,6 +81,7 @@ public PMatrix2D get() { /** * 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. + * Returned in the order {@code {m00, m01, m02, m10, m11, m12}}. */ public float[] get(float[] target) { if ((target == null) || (target.length != 6)) { @@ -86,6 +99,10 @@ public float[] get(float[] target) { } + /** + * If matrix is a PMatrix2D, sets this matrix to be a copy of it. + * @throws IllegalArgumentException If matrix is not 2D. + */ public void set(PMatrix matrix) { if (matrix instanceof PMatrix2D) { PMatrix2D src = (PMatrix2D) matrix; @@ -97,6 +114,9 @@ public void set(PMatrix matrix) { } + /** + * Unavailable in 2D. Does nothing. + */ public void set(PMatrix3D src) { } @@ -112,6 +132,9 @@ public void set(float[] source) { } + /** + * Sets the matrix content. + */ public void set(float m00, float m01, float m02, float m10, float m11, float m12) { this.m00 = m00; this.m01 = m01; this.m02 = m02; @@ -119,6 +142,9 @@ public void set(float m00, float m01, float m02, } + /** + * Unavailable in 2D. Does nothing. + */ 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, @@ -133,6 +159,10 @@ public void translate(float tx, float ty) { } + /** + * Unavailable in 2D. + * @throws IllegalArgumentException + */ public void translate(float x, float y, float z) { throw new IllegalArgumentException("Cannot use translate(x, y, z) on a PMatrix2D."); } @@ -154,11 +184,19 @@ public void rotate(float angle) { } + /** + * Unavailable in 2D. + * @throws IllegalArgumentException + */ public void rotateX(float angle) { throw new IllegalArgumentException("Cannot use rotateX() on a PMatrix2D."); } + /** + * Unavailable in 2D. + * @throws IllegalArgumentException + */ public void rotateY(float angle) { throw new IllegalArgumentException("Cannot use rotateY() on a PMatrix2D."); } @@ -169,6 +207,10 @@ public void rotateZ(float angle) { } + /** + * Unavailable in 2D. + * @throws IllegalArgumentException + */ public void rotate(float angle, float v0, float v1, float v2) { throw new IllegalArgumentException("Cannot use this version of rotate() on a PMatrix2D."); } @@ -185,6 +227,10 @@ public void scale(float sx, float sy) { } + /** + * Unavailable in 2D. + * @throws IllegalArgumentException + */ public void scale(float x, float y, float z) { throw new IllegalArgumentException("Cannot use this version of scale() on a PMatrix2D."); } @@ -215,6 +261,10 @@ public void apply(PMatrix2D source) { } + /** + * Unavailable in 2D. + * @throws IllegalArgumentException + */ public void apply(PMatrix3D source) { throw new IllegalArgumentException("Cannot use apply(PMatrix3D) on a PMatrix2D."); } @@ -236,6 +286,10 @@ public void apply(float n00, float n01, float n02, } + /** + * Unavailable in 2D. + * @throws IllegalArgumentException + */ 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, @@ -262,6 +316,10 @@ public void preApply(PMatrix2D left) { } + /** + * Unavailable in 2D. + * @throws IllegalArgumentException + */ public void preApply(PMatrix3D left) { throw new IllegalArgumentException("Cannot use preApply(PMatrix3D) on a PMatrix2D."); } @@ -289,6 +347,10 @@ public void preApply(float n00, float n01, float n02, } + /** + * Unavailable in 2D. + * @throws IllegalArgumentException + */ 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, @@ -301,7 +363,8 @@ public void preApply(float n00, float n01, float n02, float n03, /** - * Multiply the x and y coordinates of a PVector against this matrix. + * {@inheritDoc} + * Ignores any z component. */ public PVector mult(PVector source, PVector target) { if (target == null) { @@ -318,7 +381,7 @@ public PVector mult(PVector source, PVector target) { * 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[]) { + public float[] mult(float[] vec, float[] out) { if (out == null || out.length != 2) { out = new float[2]; } @@ -339,26 +402,34 @@ public float[] mult(float vec[], float out[]) { } + /** + * Returns the x-coordinate of the result of multiplying the point (x, y) + * by this matrix. + */ public float multX(float x, float y) { return m00*x + m01*y + m02; } + /** + * Returns the y-coordinate of the result of multiplying the point (x, y) + * by this matrix. + */ public float multY(float x, float y) { return m10*x + m11*y + m12; } + /** - * Transpose this matrix. + * Unavailable in 2D. Does nothing. */ public void transpose() { } - /** - * Invert this matrix. Implementation stolen from OpenJDK. - * @return true if successful + /* + * Implementation stolen from OpenJDK. */ public boolean invert() { float determinant = determinant(); diff --git a/core/src/processing/core/PMatrix3D.java b/core/src/processing/core/PMatrix3D.java index f75cb12278..831d9ad635 100644 --- a/core/src/processing/core/PMatrix3D.java +++ b/core/src/processing/core/PMatrix3D.java @@ -25,6 +25,20 @@ /** * 4x4 matrix implementation. + * Matrices are used to describe a transformation; see {@link PMatrix} for a + * general description. This matrix looks like the following when multiplying + * a vector (x, y, z, w) in {@code mult()}. + *
+ * [m00 m01 m02 m03][x]   [m00*x + m01*y + m02*z + m03*w]   [x']
+ * [m10 m11 m12 m13][y] = [m10*x + m11*y + m12*z + m13*w] = [y']
+ * [m20 m21 m22 m23][z]   [m20*x + m21*y + m22*z + m23*w]   [z']
+ * [m30 m31 m32 m33][w]   [m30*x + m31*y + m32*z + m33*w]   [w']
+ * (x', y', z', w') is returned. The values in the matrix determine the + * transformation. They are modified by the various transformation functions. + * + * To transform 3D coordinates, w is set to 1, amd w' is made to be 1 by + * setting the bottom row of the matrix to [0 0 0 1]. The + * resulting point is then (x', y', z'). */ public final class PMatrix3D implements PMatrix /*, PConstants*/ { @@ -358,6 +372,9 @@ public void apply(float n00, float n01, float n02, float n03, } + /** + * Apply the 3D equivalent of the 2D matrix supplied to the left of this one. + */ public void preApply(PMatrix2D left) { preApply(left.m00, left.m01, 0, left.m02, left.m10, left.m11, 0, left.m12, @@ -378,6 +395,9 @@ public void preApply(PMatrix source) { } + /** + * 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, @@ -386,6 +406,9 @@ public void preApply(PMatrix3D left) { } + /** + * Apply the 3D equivalent of the 2D matrix supplied to the left of this one. + */ public void preApply(float n00, float n01, float n02, float n10, float n11, float n12) { preApply(n00, n01, 0, n02, @@ -395,6 +418,9 @@ public void preApply(float n00, float n01, float n02, } + /** + * Apply another matrix to the left of this one. + */ 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, @@ -430,6 +456,12 @@ public void preApply(float n00, float n01, float n02, float n03, ////////////////////////////////////////////////////////////// + /** + * Multiply source by this matrix, and return the result. + * The result will be stored in target if target is non-null, and target + * will then be the matrix returned. This improves performance if you reuse + * target, so it's recommended if you call this many times in draw(). + */ public PVector mult(PVector source, PVector target) { if (target == null) { target = new PVector(); @@ -465,6 +497,8 @@ public PVector cmult(PVector source, PVector 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. + * Supplying and recycling a target array improves performance, so it's + * recommended if you call this many times in draw. */ public float[] mult(float[] source, float[] target) { if (target == null || target.length < 3) { @@ -492,58 +526,98 @@ public float[] mult(float[] source, float[] target) { } + /** + * Returns the x-coordinate of the result of multiplying the point (x, y) + * by this matrix. + */ public float multX(float x, float y) { return m00*x + m01*y + m03; } + /** + * Returns the y-coordinate of the result of multiplying the point (x, y) + * by this matrix. + */ public float multY(float x, float y) { return m10*x + m11*y + m13; } + /** + * Returns the x-coordinate of the result of multiplying the point (x, y, z) + * by this matrix. + */ public float multX(float x, float y, float z) { return m00*x + m01*y + m02*z + m03; } + /** + * Returns the y-coordinate of the result of multiplying the point (x, y, z) + * by this matrix. + */ public float multY(float x, float y, float z) { return m10*x + m11*y + m12*z + m13; } + /** + * Returns the z-coordinate of the result of multiplying the point (x, y, z) + * by this matrix. + */ public float multZ(float x, float y, float z) { return m20*x + m21*y + m22*z + m23; } + /** + * Returns the fourth element of the result of multiplying the vector + * (x, y, z) by this matrix. (Acts as if w = 1 was supplied.) + */ public float multW(float x, float y, float z) { return m30*x + m31*y + m32*z + m33; } + /** + * Returns the x-coordinate of the result of multiplying the vector + * (x, y, z, w) by this matrix. + */ public float multX(float x, float y, float z, float w) { return m00*x + m01*y + m02*z + m03*w; } + /** + * Returns the y-coordinate of the result of multiplying the vector + * (x, y, z, w) by this matrix. + */ public float multY(float x, float y, float z, float w) { return m10*x + m11*y + m12*z + m13*w; } + /** + * Returns the z-coordinate of the result of multiplying the vector + * (x, y, z, w) by this matrix. + */ public float multZ(float x, float y, float z, float w) { return m20*x + m21*y + m22*z + m23*w; } + /** + * Returns the w-coordinate of the result of multiplying the vector + * (x, y, z, w) by this matrix. + */ public float multW(float x, float y, float z, float w) { return m30*x + m31*y + m32*z + m33*w; } /** - * Transpose this matrix. + * Transpose this matrix; rows become columns and columns rows. */ public void transpose() { float temp; @@ -557,7 +631,8 @@ public void transpose() { /** - * Invert this matrix. + * Invert this matrix. Will not necessarily succeed, because some matrices + * map more than one point to the same image point, and so are irreversible. * @return true if successful */ public boolean invert() { diff --git a/core/src/processing/core/PShape.java b/core/src/processing/core/PShape.java index a9b28eaa90..0c622d18b8 100644 --- a/core/src/processing/core/PShape.java +++ b/core/src/processing/core/PShape.java @@ -22,27 +22,31 @@ package processing.core; +import java.awt.Image; +import java.awt.color.ColorSpace; +import java.awt.image.BufferedImage; import java.util.HashMap; import java.util.Map; -import processing.core.PApplet; +import javax.swing.ImageIcon; +import javax.xml.bind.DatatypeConverter; /** - * ( begin auto-generated from PShape.xml ) - * - * Datatype for storing shapes. Processing can currently load and display - * SVG (Scalable Vector Graphics) shapes. Before a shape is used, it must - * be loaded with the loadShape() function. The shape() - * function is used to draw the shape to the display window. The - * PShape object contain a group of methods, linked below, that can - * operate on the shape data. - *

- * The loadShape() function supports SVG files created with Inkscape - * and Adobe Illustrator. It is not a full SVG implementation, but offers - * some straightforward support for handling vector data. - * - * ( end auto-generated ) + * ( begin auto-generated from PShape.xml ) + * + * Datatype for storing shapes. Processing can currently load and display + * SVG (Scalable Vector Graphics) shapes. Before a shape is used, it must + * be loaded with the loadShape() function. The shape() + * function is used to draw the shape to the display window. The + * PShape object contain a group of methods, linked below, that can + * operate on the shape data. + *

+ * The loadShape() function supports SVG files created with Inkscape + * and Adobe Illustrator. It is not a full SVG implementation, but offers + * some straightforward support for handling vector data. + * + * ( end auto-generated ) *

Advanced

* * In-progress class to handle shape data, currently to be considered of @@ -84,12 +88,16 @@ public class PShape implements PConstants { // /** Generic, only draws its child objects. */ // static public final int GROUP = 0; // GROUP now inherited from PConstants, and is still zero + + // These constants were updated in 3.0b6 so that they could be distinguished + // from others in PConstants and improve how some typos were handled. + // https://github.com/processing/processing/issues/3776 /** A line, ellipse, arc, image, etc. */ - static public final int PRIMITIVE = 1; + static public final int PRIMITIVE = 101; /** A series of vertex, curveVertex, and bezierVertex calls. */ - static public final int PATH = 2; + static public final int PATH = 102; /** Collections of vertices created with beginShape(). */ - static public final int GEOMETRY = 3; + static public final int GEOMETRY = 103; /** The shape type, one of GROUP, PRIMITIVE, PATH, or GEOMETRY. */ protected int family; @@ -102,6 +110,7 @@ public class PShape implements PConstants { /** Texture or image data associated with this shape. */ protected PImage image; + protected String imagePath = null; public static final String OUTSIDE_BEGIN_END_ERROR = "%1$s can only be called between beginShape() and endShape()"; @@ -116,13 +125,11 @@ public class PShape implements PConstants { "getVertexCount() only works with PATH or GEOMETRY shapes"; public static final String NOT_A_SIMPLE_VERTEX = - "%1$s can not be called on quadratic or bezier vertices"; + "%1$s can not be called on quadratic or bezier vertices"; + + static public final String PER_VERTEX_UNSUPPORTED = + "This renderer does not support %1$s for individual vertices"; - // boundary box of this shape - //protected float x; - //protected float y; - //protected float width; - //protected float height; /** * ( begin auto-generated from PShape_width.xml ) * @@ -239,6 +246,8 @@ public class PShape implements PConstants { /** True if contains 3D data */ protected boolean is3D = false; + protected boolean perVertexStyles = false; + // should this be called vertices (consistent with PGraphics internals) // or does that hurt flexibility? @@ -704,8 +713,7 @@ public void vertex(float x, float y, float u, float v) { public void vertex(float x, float y, float z) { - // why not? - vertex(x, y); + vertex(x, y); // maybe? maybe not? } @@ -1544,6 +1552,9 @@ static protected void copyMatrix(PShape src, PShape dest) { // TODO unapproved static protected void copyStyles(PShape src, PShape dest) { + dest.ellipseMode = src.ellipseMode; + dest.rectMode = src.rectMode; + if (src.stroke) { dest.stroke = true; dest.strokeColor = src.strokeColor; @@ -1598,9 +1609,9 @@ protected void drawImpl(PGraphics g) { } else if (family == PRIMITIVE) { drawPrimitive(g); } else if (family == GEOMETRY) { - // same as path - drawPath(g); -// drawGeometry(g); + // Not same as path: `kind` matters. +// drawPath(g); + drawGeometry(g); } else if (family == PATH) { drawPath(g); } @@ -1639,9 +1650,18 @@ protected void drawPrimitive(PGraphics g) { params[6], params[7]); } else if (kind == RECT) { + + if (imagePath != null){ + loadImage(g); + } if (image != null) { + int oldMode = g.imageMode; + g.imageMode(CORNER); g.image(image, params[0], params[1], params[2], params[3]); + g.imageMode(oldMode); } else { + int oldMode = g.rectMode; + g.rectMode(rectMode); if (params.length == 4) { g.rect(params[0], params[1], params[2], params[3]); @@ -1655,11 +1675,18 @@ protected void drawPrimitive(PGraphics g) { params[4], params[5], params[6], params[7]); } + g.rectMode(oldMode); } } else if (kind == ELLIPSE) { + int oldMode = g.ellipseMode; + g.ellipseMode(ellipseMode); g.ellipse(params[0], params[1], params[2], params[3]); + g.ellipseMode(oldMode); + } else if (kind == ARC) { + int oldMode = g.ellipseMode; + g.ellipseMode(ellipseMode); if (params.length == 6) { g.arc(params[0], params[1], params[2], params[3], @@ -1670,6 +1697,8 @@ protected void drawPrimitive(PGraphics g) { params[4], params[5], (int) params[6]); } + g.ellipseMode(oldMode); + } else if (kind == BOX) { if (params.length == 1) { g.box(params[0]); @@ -1859,6 +1888,63 @@ protected void drawPath(PGraphics g) { g.endShape(close ? CLOSE : OPEN); } + private void loadImage(PGraphics g){ + + if(this.imagePath.startsWith("data:image")){ + loadBase64Image(); + } + + if(this.imagePath.startsWith("file://")){ + loadFileSystemImage(g); + } + this.imagePath = null; + } + + private void loadFileSystemImage(PGraphics g){ + imagePath = imagePath.substring(7); + PImage loadedImage = g.parent.loadImage(imagePath); + if(loadedImage == null){ + System.err.println("Error loading image file: " + imagePath); + }else{ + setTexture(loadedImage); + } + } + + private void loadBase64Image(){ + String[] parts = this.imagePath.split(";base64,"); + String extension = parts[0].substring(11); + String encodedData = parts[1]; + + byte[] decodedBytes = DatatypeConverter.parseBase64Binary(encodedData); + + if(decodedBytes == null){ + System.err.println("Decode Error on image: " + imagePath.substring(0, 20)); + return; + } + + Image awtImage = new ImageIcon(decodedBytes).getImage(); + + if (awtImage instanceof BufferedImage) { + BufferedImage buffImage = (BufferedImage) awtImage; + int space = buffImage.getColorModel().getColorSpace().getType(); + if (space == ColorSpace.TYPE_CMYK) { + return; + } + } + + PImage loadedImage = new PImage(awtImage); + if (loadedImage.width == -1) { + // error... + } + + // if it's a .gif image, test to see if it has transparency + if (extension.equals("gif") || extension.equals("png") || + extension.equals("unknown")) { + loadedImage.checkAlpha(); + } + + setTexture(loadedImage); + } // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @@ -2020,7 +2106,7 @@ public void addName(String nom, PShape shape) { parent.addName(nom, shape); } else { if (nameTable == null) { - nameTable = new HashMap(); + nameTable = new HashMap<>(); } nameTable.put(nom, shape); } @@ -2352,7 +2438,9 @@ public int getFill(int index) { } } - + /** + * @nowebref + */ public void setFill(boolean fill) { if (openShape) { PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setFill()"); @@ -2362,7 +2450,24 @@ public void setFill(boolean fill) { this.fill = fill; } - + /** + * ( begin auto-generated from PShape_setFill.xml ) + * + * The setFill() method defines the fill color of a PShape. + * This method is used after shapes are created or when a shape is defined explicitly + * (e.g. createShape(RECT, 20, 20, 80, 80)) as shown in the above example. + * When a shape is created with beginShape() and endShape(), its + * attributes may be changed with fill() and stroke() within + * beginShape() and endShape(). However, after the shape is + * created, only the setFill() method can define a new fill value for + * the PShape. + * + * ( end auto-generated ) + * + * @webref + * @param fill + * @brief Set the fill value + */ public void setFill(int fill) { if (openShape) { PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setFill()"); @@ -2371,28 +2476,33 @@ public void setFill(int fill) { this.fillColor = fill; - if (vertices != null) { - for (int i = 0; i < vertices.length; i++) { + if (vertices != null && perVertexStyles) { + for (int i = 0; i < vertexCount; i++) { setFill(i, fill); } } } - + /** + * @nowebref + */ public void setFill(int index, int fill) { if (openShape) { PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setFill()"); return; } + if (!perVertexStyles) { + PGraphics.showWarning(PER_VERTEX_UNSUPPORTED, "setFill()"); + return; + } + // make sure we allocated the vertices array and that vertex exists - if (vertices == null || - index >= vertices.length) { + if (vertices == null || index >= vertices.length) { PGraphics.showWarning(NO_SUCH_VERTEX_ERROR + " (" + index + ")", "getFill()"); return; } - if (image == null) { vertices[index][PGraphics.A] = ((fill >> 24) & 0xFF) / 255.0f; vertices[index][PGraphics.R] = ((fill >> 16) & 0xFF) / 255.0f; @@ -2404,8 +2514,7 @@ public void setFill(int index, int fill) { public int getTint(int index) { // make sure we allocated the vertices array and that vertex exists - if (vertices == null || - index >= vertices.length) { + if (vertices == null || index >= vertices.length) { PGraphics.showWarning(NO_SUCH_VERTEX_ERROR + " (" + index + ")", "getTint()"); return this.tintColor; } @@ -2485,7 +2594,9 @@ public int getStroke(int index) { return (a << 24) | (r << 16) | (g << 8) | b; } - + /** + * @nowebref + */ public void setStroke(boolean stroke) { if (openShape) { PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setStroke()"); @@ -2495,7 +2606,24 @@ public void setStroke(boolean stroke) { this.stroke = stroke; } - + /** + * ( begin auto-generated from PShape_setStroke.xml ) + * + * The setStroke() method defines the outline color of a PShape. + * This method is used after shapes are created or when a shape is defined + * explicitly (e.g. createShape(RECT, 20, 20, 80, 80)) as shown in + * the above example. When a shape is created with beginShape() and + * endShape(), its attributes may be changed with fill() and + * stroke() within beginShape() and endShape(). + * However, after the shape is created, only the setStroke() method + * can define a new stroke value for the PShape. + * + * ( end auto-generated ) + * + * @webref + * @param stroke + * @brief Set the stroke value + */ public void setStroke(int stroke) { if (openShape) { PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setStroke()"); @@ -2503,23 +2631,30 @@ public void setStroke(int stroke) { } strokeColor = stroke; - if (vertices != null) { - for (int i = 0; i < vertices.length; i++) { + + if (vertices != null && perVertexStyles) { + for (int i = 0; i < vertices.length; i++) { setStroke(i, stroke); } } } - + /** + * @nowebref + */ public void setStroke(int index, int stroke) { if (openShape) { PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setStroke()"); return; } + if (!perVertexStyles) { + PGraphics.showWarning(PER_VERTEX_UNSUPPORTED, "setStroke()"); + return; + } + // make sure we allocated the vertices array and that vertex exists - if (vertices == null || - index >= vertices.length) { + if (vertices == null || index >= vertices.length) { PGraphics.showWarning(NO_SUCH_VERTEX_ERROR + " (" + index + ")", "setStroke()"); return; } @@ -2533,13 +2668,11 @@ public void setStroke(int index, int stroke) { public float getStrokeWeight(int index) { // make sure we allocated the vertices array and that vertex exists - if (vertices == null || - index >= vertices.length) { + if (vertices == null || index >= vertices.length) { PGraphics.showWarning(NO_SUCH_VERTEX_ERROR + " (" + index + ")", "getStrokeWeight()"); return strokeWeight; } - return vertices[index][PGraphics.SW]; } @@ -2552,8 +2685,8 @@ public void setStrokeWeight(float weight) { strokeWeight = weight; - if (vertices != null) { - for (int i = 0; i < vertices.length; i++) { + if (vertices != null && perVertexStyles) { + for (int i = 0; i < vertexCount; i++) { setStrokeWeight(i, weight); } } @@ -2566,9 +2699,13 @@ public void setStrokeWeight(int index, float weight) { return; } + if (!perVertexStyles) { + PGraphics.showWarning(PER_VERTEX_UNSUPPORTED, "setStrokeWeight()"); + return; + } + // make sure we allocated the vertices array and that vertex exists - if (vertices == null || - index >= vertices.length) { + if (vertices == null || index >= vertices.length) { PGraphics.showWarning(NO_SUCH_VERTEX_ERROR + " (" + index + ")", "setStrokeWeight()"); return; } @@ -2598,10 +2735,8 @@ public void setStrokeCap(int cap) { public int getAmbient(int index) { - // make sure we allocated the vertices array and that vertex exists - if (vertices == null || - index >= vertices.length) { + if (vertices == null || index >= vertices.length) { PGraphics.showWarning(NO_SUCH_VERTEX_ERROR + " (" + index + ")", "getAmbient()"); return ambientColor; } @@ -2636,8 +2771,7 @@ public void setAmbient(int index, int ambient) { } // make sure we allocated the vertices array and that vertex exists - if (vertices == null || - index >= vertices.length) { + if (vertices == null || index >= vertices.length) { PGraphics.showWarning(NO_SUCH_VERTEX_ERROR + " (" + index + ")", "setAmbient()"); return; } @@ -2650,8 +2784,7 @@ public void setAmbient(int index, int ambient) { public int getSpecular(int index) { // make sure we allocated the vertices array and that vertex exists - if (vertices == null || - index >= vertices.length) { + if (vertices == null || index >= vertices.length) { PGraphics.showWarning(NO_SUCH_VERTEX_ERROR + " (" + index + ")", "getSpecular()"); return specularColor; } @@ -2686,8 +2819,7 @@ public void setSpecular(int index, int specular) { } // make sure we allocated the vertices array and that vertex exists - if (vertices == null || - index >= vertices.length) { + if (vertices == null || index >= vertices.length) { PGraphics.showWarning(NO_SUCH_VERTEX_ERROR + " (" + index + ")", "setSpecular()"); return; } @@ -2700,8 +2832,7 @@ public void setSpecular(int index, int specular) { public int getEmissive(int index) { // make sure we allocated the vertices array and that vertex exists - if (vertices == null || - index >= vertices.length) { + if (vertices == null || index >= vertices.length) { PGraphics.showWarning(NO_SUCH_VERTEX_ERROR + " (" + index + ")", "getEmissive()"); return emissiveColor; } @@ -2826,13 +2957,28 @@ public boolean isClosed() { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - // http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html + /** + * Return true if this x, y coordinate is part of this shape. Only works + * with PATH shapes or GROUP shapes that contain other GROUPs or PATHs. + */ public boolean contains(float x, float y) { if (family == PATH) { + PVector p = new PVector(x, y); + if (matrix != null) { + // apply the inverse transformation matrix to the point coordinates + PMatrix inverseCoords = matrix.get(); + // TODO why is this called twice? [fry 190724] + // commit was https://github.com/processing/processing/commit/027fc7a4f8e8d0a435366eae754304eea282512a + inverseCoords.invert(); // maybe cache this? + inverseCoords.invert(); // maybe cache this? + inverseCoords.mult(new PVector(x, y), p); + } + + // http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html boolean c = false; for (int i = 0, j = vertexCount-1; i < vertexCount; j = i++) { - if (((vertices[i][Y] > y) != (vertices[j][Y] > y)) && - (x < + if (((vertices[i][Y] > p.y) != (vertices[j][Y] > p.y)) && + (p.x < (vertices[j][X]-vertices[i][X]) * (y-vertices[i][Y]) / (vertices[j][1]-vertices[i][Y]) + @@ -2841,7 +2987,18 @@ public boolean contains(float x, float y) { } } return c; + + } else if (family == GROUP) { + // If this is a group, loop through children until we find one that + // contains the supplied coordinates. If a child does not support + // contains() throw a warning and continue. + for (int i = 0; i < childCount; i++) { + if (children[i].contains(x, y)) return true; + } + return false; + } else { + // https://github.com/processing/processing/issues/1280 throw new IllegalArgumentException("The contains() method is only implemented for paths."); } } @@ -2875,8 +3032,8 @@ public boolean contains(float x, float y) { * @webref pshape:method * @usage web_application * @brief Displaces the shape - * @param tx left/right translation - * @param ty up/down translation + * @param x left/right translation + * @param y up/down translation * @see PShape#rotate(float) * @see PShape#scale(float) * @see PShape#resetMatrix() @@ -2887,7 +3044,7 @@ public void translate(float x, float y) { } /** - * @param tz forward/back translation + * @param z forward/back translation */ public void translate(float x, float y, float z) { checkMatrix(3); @@ -3377,4 +3534,4 @@ protected void colorCalcARGB(int argb, float alpha) { calcAlpha = (calcAi != 255); } -} \ No newline at end of file +} diff --git a/core/src/processing/core/PShapeOBJ.java b/core/src/processing/core/PShapeOBJ.java index b0f16dd34a..5ae8c9d1e9 100644 --- a/core/src/processing/core/PShapeOBJ.java +++ b/core/src/processing/core/PShapeOBJ.java @@ -77,10 +77,10 @@ protected PShapeOBJ(OBJFace face, OBJMaterial mtl, vertexCount = face.vertIdx.size(); vertices = new float[vertexCount][12]; for (int j = 0; j < face.vertIdx.size(); j++){ - int vertIdx, normIdx; - PVector vert, norms; + int vertIdx, normIdx, texIdx; + PVector vert, norms, tex; - vert = norms = null; + vert = norms = tex = null; vertIdx = face.vertIdx.get(j).intValue() - 1; vert = coords.get(vertIdx); @@ -92,6 +92,13 @@ protected PShapeOBJ(OBJFace face, OBJMaterial mtl, } } + if (j < face.texIdx.size()) { + texIdx = face.texIdx.get(j).intValue() - 1; + if (-1 < texIdx) { + tex = texcoords.get(texIdx); + } + } + vertices[j][X] = vert.x; vertices[j][Y] = vert.y; vertices[j][Z] = vert.z; @@ -107,23 +114,13 @@ protected PShapeOBJ(OBJFace face, OBJMaterial mtl, vertices[j][PGraphics.NZ] = norms.z; } - if (mtl != null && mtl.kdMap != null) { - // This face is textured. - int texIdx; - PVector tex = null; - - if (j < face.texIdx.size()) { - texIdx = face.texIdx.get(j).intValue() - 1; - if (-1 < texIdx) { - tex = texcoords.get(texIdx); - } - } + if (tex != null) { + vertices[j][PGraphics.U] = tex.x; + vertices[j][PGraphics.V] = tex.y; + } + if (mtl != null && mtl.kdMap != null) { image = mtl.kdMap; - if (tex != null) { - vertices[j][PGraphics.U] = tex.x; - vertices[j][PGraphics.V] = tex.y; - } } } } @@ -231,7 +228,7 @@ static protected void parseOBJ(PApplet parent, String path, } BufferedReader mreader = parent.createReader(fn); if (mreader != null) { - parseMTL(parent, path, mreader, materials, mtlTable); + parseMTL(parent, fn, path, mreader, materials, mtlTable); mreader.close(); } } @@ -320,7 +317,7 @@ static protected void parseOBJ(PApplet parent, String path, } - static protected void parseMTL(PApplet parent, String path, + static protected void parseMTL(PApplet parent, String mtlfn, String path, BufferedReader reader, ArrayList materials, Map materialsHash) { @@ -330,45 +327,59 @@ static protected void parseMTL(PApplet parent, String path, while ((line = reader.readLine()) != null) { // Parse the line line = line.trim(); - String parts[] = line.split("\\s+"); + String[] parts = line.split("\\s+"); if (parts.length > 0) { // Extract the material data. if (parts[0].equals("newmtl")) { // Starting new material. String mtlname = parts[1]; - currentMtl = new OBJMaterial(mtlname); - materialsHash.put(mtlname, Integer.valueOf(materials.size())); - materials.add(currentMtl); - } else if (parts[0].equals("map_Kd") && parts.length > 1) { - // Loading texture map. - String texname = parts[1]; - if (texname.indexOf(File.separator) == -1 && !path.equals("")) { - // Relative file name, adding the base path. - texname = path + File.separator + texname; + currentMtl = addMaterial(mtlname, materials, materialsHash); + } else { + if (currentMtl == null) { + currentMtl = addMaterial("material" + materials.size(), + materials, materialsHash); + } + if (parts[0].equals("map_Kd") && parts.length > 1) { + // Loading texture map. + String texname = parts[1]; + if (texname.indexOf(File.separator) == -1 && !path.equals("")) { + // Relative file name, adding the base path. + texname = path + File.separator + texname; + } + + File file = new File(parent.dataPath(texname)); + if (file.exists()) { + currentMtl.kdMap = parent.loadImage(texname); + } else { + System.err.println("The texture map \"" + texname + "\" " + + "in the materials definition file \"" + mtlfn + "\" " + + "is missing or inaccessible, make sure " + + "the URL is valid or that the file has been " + + "added to your sketch and is readable."); + } + } else if (parts[0].equals("Ka") && parts.length > 3) { + // The ambient color of the material + currentMtl.ka.x = Float.valueOf(parts[1]).floatValue(); + currentMtl.ka.y = Float.valueOf(parts[2]).floatValue(); + currentMtl.ka.z = Float.valueOf(parts[3]).floatValue(); + } else if (parts[0].equals("Kd") && parts.length > 3) { + // The diffuse color of the material + currentMtl.kd.x = Float.valueOf(parts[1]).floatValue(); + currentMtl.kd.y = Float.valueOf(parts[2]).floatValue(); + currentMtl.kd.z = Float.valueOf(parts[3]).floatValue(); + } else if (parts[0].equals("Ks") && parts.length > 3) { + // The specular color weighted by the specular coefficient + currentMtl.ks.x = Float.valueOf(parts[1]).floatValue(); + currentMtl.ks.y = Float.valueOf(parts[2]).floatValue(); + currentMtl.ks.z = Float.valueOf(parts[3]).floatValue(); + } else if ((parts[0].equals("d") || + parts[0].equals("Tr")) && parts.length > 1) { + // Reading the alpha transparency. + currentMtl.d = Float.valueOf(parts[1]).floatValue(); + } else if (parts[0].equals("Ns") && parts.length > 1) { + // The specular component of the Phong shading model + currentMtl.ns = Float.valueOf(parts[1]).floatValue(); } - currentMtl.kdMap = parent.loadImage(texname); - } else if (parts[0].equals("Ka") && parts.length > 3) { - // The ambient color of the material - currentMtl.ka.x = Float.valueOf(parts[1]).floatValue(); - currentMtl.ka.y = Float.valueOf(parts[2]).floatValue(); - currentMtl.ka.z = Float.valueOf(parts[3]).floatValue(); - } else if (parts[0].equals("Kd") && parts.length > 3) { - // The diffuse color of the material - currentMtl.kd.x = Float.valueOf(parts[1]).floatValue(); - currentMtl.kd.y = Float.valueOf(parts[2]).floatValue(); - currentMtl.kd.z = Float.valueOf(parts[3]).floatValue(); - } else if (parts[0].equals("Ks") && parts.length > 3) { - // The specular color weighted by the specular coefficient - currentMtl.ks.x = Float.valueOf(parts[1]).floatValue(); - currentMtl.ks.y = Float.valueOf(parts[2]).floatValue(); - currentMtl.ks.z = Float.valueOf(parts[3]).floatValue(); - } else if ((parts[0].equals("d") || - parts[0].equals("Tr")) && parts.length > 1) { - // Reading the alpha transparency. - currentMtl.d = Float.valueOf(parts[1]).floatValue(); - } else if (parts[0].equals("Ns") && parts.length > 1) { - // The specular component of the Phong shading model - currentMtl.ns = Float.valueOf(parts[1]).floatValue(); } } } @@ -377,6 +388,14 @@ static protected void parseMTL(PApplet parent, String path, } } + protected static OBJMaterial addMaterial(String mtlname, + ArrayList materials, + Map materialsHash) { + OBJMaterial currentMtl = new OBJMaterial(mtlname); + materialsHash.put(mtlname, Integer.valueOf(materials.size())); + materials.add(currentMtl); + return currentMtl; + } protected static int rgbaValue(PVector color) { return 0xFF000000 | ((int)(color.x * 255) << 16) | diff --git a/core/src/processing/core/PShapeSVG.java b/core/src/processing/core/PShapeSVG.java index 2398dbb07c..f572406ebc 100644 --- a/core/src/processing/core/PShapeSVG.java +++ b/core/src/processing/core/PShapeSVG.java @@ -24,6 +24,9 @@ package processing.core; +import static java.awt.Font.BOLD; +import static java.awt.Font.ITALIC; +import static java.awt.Font.PLAIN; import processing.data.*; // TODO replace these with PMatrix2D @@ -32,6 +35,8 @@ import java.util.Map; import java.util.HashMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** @@ -100,7 +105,7 @@ public class PShapeSVG extends PShape { protected float svgHeight; /** √((w² + h²)/2) of containing SVG (used for percentages). */ - protected float svgXYSize; + protected float svgSizeXY; protected Gradient strokeGradient; String strokeName; // id of another object, gradients only? @@ -177,7 +182,7 @@ protected PShapeSVG(PShapeSVG parent, XML properties, boolean parseKids) { svgWidth = width; svgHeight = height; - svgXYSize = PApplet.sqrt((svgWidth*svgWidth + svgHeight*svgHeight)/2.0f); + svgSizeXY = PApplet.sqrt((svgWidth*svgWidth + svgHeight*svgHeight)/2.0f); } element = properties; @@ -262,7 +267,7 @@ protected void setParent(PShapeSVG parent) { svgWidth = parent.svgWidth; svgHeight = parent.svgHeight; - svgXYSize = parent.svgXYSize; + svgSizeXY = parent.svgSizeXY; opacity = parent.opacity; } @@ -330,6 +335,10 @@ protected PShape parseChild(XML elem) { shape = createShape(this, elem, true); shape.parseRect(); + } else if (name.equals("image")) { + shape = createShape(this, elem, true); + shape.parseImage(); + } else if (name.equals("polygon")) { shape = createShape(this, elem, true); shape.parsePoly(true); @@ -358,8 +367,10 @@ protected PShape parseChild(XML elem) { // return new FontGlyph(this, elem); } else if (name.equals("text")) { // || name.equals("font")) { - PGraphics.showWarning("Text and fonts in SVG files are " + - "not currently supported, convert text to outlines instead."); + return new Text(this, elem); + + } else if (name.equals("tspan")) { + return new LineOfText(this, elem); } else if (name.equals("filter")) { PGraphics.showWarning("Filters are not supported."); @@ -416,7 +427,7 @@ protected void parseEllipse(boolean circle) { float rx, ry; if (circle) { - rx = ry = getFloatWithUnit(element, "r", svgXYSize); + rx = ry = getFloatWithUnit(element, "r", svgSizeXY); } else { rx = getFloatWithUnit(element, "rx", svgWidth); ry = getFloatWithUnit(element, "ry", svgHeight); @@ -426,7 +437,6 @@ protected void parseEllipse(boolean circle) { params[2] = rx*2; params[3] = ry*2; - } @@ -442,6 +452,21 @@ protected void parseRect() { } + protected void parseImage() { + kind = RECT; + textureMode = NORMAL; + + family = PRIMITIVE; + params = new float[] { + getFloatWithUnit(element, "x", svgWidth), + getFloatWithUnit(element, "y", svgHeight), + getFloatWithUnit(element, "width", svgWidth), + getFloatWithUnit(element, "height", svgHeight) + }; + + this.imagePath = element.getString("xlink:href"); + } + /** * Parse a polyline or polygon from an SVG file. * Syntax defined at http://www.w3.org/TR/SVG/shapes.html#PointsBNF @@ -453,14 +478,27 @@ protected void parsePoly(boolean close) { String pointsAttr = element.getString("points"); if (pointsAttr != null) { - String[] pointsBuffer = PApplet.splitTokens(pointsAttr); - vertexCount = pointsBuffer.length; + Pattern pattern = Pattern.compile("([+-]?[\\d]+(\\.[\\d]+)?([eE][+-][\\d]+)?)(,?\\s*)([+-]?[\\d]+(\\.[\\d]+)?([eE][+-][\\d]+)?)"); + Matcher matcher = pattern.matcher(pointsAttr); + vertexCount = 0; + while (matcher.find()) { + vertexCount++; + } + matcher.reset(); vertices = new float[vertexCount][2]; for (int i = 0; i < vertexCount; i++) { - String pb[] = PApplet.splitTokens(pointsBuffer[i], ", \t\r\n"); - vertices[i][X] = Float.parseFloat(pb[0]); - vertices[i][Y] = Float.parseFloat(pb[1]); + matcher.find(); + vertices[i][X] = Float.parseFloat(matcher.group(1)); + vertices[i][Y] = Float.parseFloat(matcher.group(5)); } +// String[] pointsBuffer = PApplet.splitTokens(pointsAttr); +// vertexCount = pointsBuffer.length; +// vertices = new float[vertexCount][2]; +// for (int i = 0; i < vertexCount; i++) { +// String pb[] = PApplet.splitTokens(pointsBuffer[i], ", \t\r\n"); +// vertices[i][X] = Float.parseFloat(pb[0]); +// vertices[i][Y] = Float.parseFloat(pb[1]); +// } } } @@ -1181,7 +1219,7 @@ void setOpacity(String opacityText) { void setStrokeWeight(String lineweight) { - strokeWeight = parseUnitSize(lineweight, svgXYSize); + strokeWeight = parseUnitSize(lineweight, svgSizeXY); } @@ -1461,7 +1499,7 @@ static public class Gradient extends PShapeSVG { public Gradient(PShapeSVG parent, XML properties) { super(parent, properties, true); - XML elements[] = properties.getChildren(); + XML[] elements = properties.getChildren(); offset = new float[elements.length]; color = new int[elements.length]; @@ -1499,7 +1537,10 @@ public Gradient(PShapeSVG parent, XML properties) { } - public class LinearGradient extends Gradient { + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + static public class LinearGradient extends Gradient { public float x1, y1, x2, y2; public LinearGradient(PShapeSVG parent, XML properties) { @@ -1514,7 +1555,7 @@ public LinearGradient(PShapeSVG parent, XML properties) { properties.getString("gradientTransform"); if (transformStr != null) { - float t[] = parseTransform(transformStr).get(null); + float[] t = parseTransform(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); @@ -1529,7 +1570,10 @@ public LinearGradient(PShapeSVG parent, XML properties) { } - public class RadialGradient extends Gradient { + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + static public class RadialGradient extends Gradient { public float cx, cy, r; public RadialGradient(PShapeSVG parent, XML properties) { @@ -1537,13 +1581,13 @@ public RadialGradient(PShapeSVG parent, XML properties) { this.cx = getFloatWithUnit(properties, "cx", svgWidth); this.cy = getFloatWithUnit(properties, "cy", svgHeight); - this.r = getFloatWithUnit(properties, "r", svgXYSize); + this.r = getFloatWithUnit(properties, "r", svgSizeXY); String transformStr = properties.getString("gradientTransform"); if (transformStr != null) { - float t[] = parseTransform(transformStr).get(null); + float[] t = parseTransform(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); @@ -1560,7 +1604,179 @@ public RadialGradient(PShapeSVG parent, XML properties) { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - public static class Font extends PShapeSVG { +// static private float TEXT_QUALITY = 1; + + static private PFont parseFont(XML properties) { + String fontFamily = null; + float size = 10; + int weight = PLAIN; // 0 + int italic = 0; + + if (properties.hasAttribute("style")) { + String styleText = properties.getString("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("font-style")) { + // PApplet.println("font-style: " + tokens[1]); + if (tokens[1].contains("italic")) { + italic = ITALIC; + } + } else if (tokens[0].equals("font-variant")) { + // PApplet.println("font-variant: " + tokens[1]); + // setFillOpacity(tokens[1]); + + } else if (tokens[0].equals("font-weight")) { + // PApplet.println("font-weight: " + tokens[1]); + + if (tokens[1].contains("bold")) { + weight = BOLD; + // PApplet.println("Bold weight ! "); + } + + + } else if (tokens[0].equals("font-stretch")) { + // not supported. + + } else if (tokens[0].equals("font-size")) { + // PApplet.println("font-size: " + tokens[1]); + size = Float.parseFloat(tokens[1].split("px")[0]); + // PApplet.println("font-size-parsed: " + size); + } else if (tokens[0].equals("line-height")) { + // not supported + + } else if (tokens[0].equals("font-family")) { + // PApplet.println("Font-family: " + tokens[1]); + fontFamily = tokens[1]; + + } else if (tokens[0].equals("text-align")) { + // not supported + + } else if (tokens[0].equals("letter-spacing")) { + // not supported + + } else if (tokens[0].equals("word-spacing")) { + // not supported + + } else if (tokens[0].equals("writing-mode")) { + // not supported + + } else if (tokens[0].equals("text-anchor")) { + // not supported + + } else { + // Other attributes are not yet implemented + } + } + } + if (fontFamily == null) { + return null; + } +// size = size * TEXT_QUALITY; + + return createFont(fontFamily, weight | italic, size, true); + } + + + static protected PFont createFont(String name, int weight, + float size, boolean smooth) { + //System.out.println("Try to create a font of " + name + " family, " + weight); + java.awt.Font baseFont = new java.awt.Font(name, weight, (int) size); + + //System.out.println("Resulting family : " + baseFont.getFamily() + " " + baseFont.getStyle()); + return new PFont(baseFont.deriveFont(size), smooth, null); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + static public class Text extends PShapeSVG { + protected PFont font; + + public Text(PShapeSVG parent, XML properties) { + super(parent, properties, true); + + // get location + float x = Float.parseFloat(properties.getString("x")); + float y = Float.parseFloat(properties.getString("y")); + + if (matrix == null) { + matrix = new PMatrix2D(); + } + matrix.translate(x, y); + + family = GROUP; + + font = parseFont(properties); + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + static public class LineOfText extends PShapeSVG { + String textToDisplay; + PFont font; + + public LineOfText(PShapeSVG parent, XML properties) { + // TODO: child should ideally be parsed too for inline content. + super(parent, properties, false); + + //get location + float x = Float.parseFloat(properties.getString("x")); + float y = Float.parseFloat(properties.getString("y")); + + float parentX = Float.parseFloat(parent.element.getString("x")); + float parentY = Float.parseFloat(parent.element.getString("y")); + + if (matrix == null) matrix = new PMatrix2D(); + matrix.translate(x - parentX, (y - parentY) / 2f); + + // get the first properties + parseColors(properties); + font = parseFont(properties); + + // cleaned up syntax but removing b/c unused [fry 190118] + //boolean isLine = properties.getString("role").equals("line"); + + if (this.childCount > 0) { + // no inline content yet. + } + + String text = properties.getContent(); + textToDisplay = text; + } + + @Override + public void drawImpl(PGraphics g) { + if (font == null) { + font = ((Text) parent).font; + if (font == null) { + return; + } + } + + pre(g); +// g.textFont(font, font.size / TEXT_QUALITY); + g.textFont(font, font.size); + g.text(textToDisplay, 0, 0); + post(g); + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + static public class Font extends PShapeSVG { public FontFace face; public Map namedGlyphs; @@ -1581,8 +1797,8 @@ public Font(PShapeSVG parent, XML properties) { horizAdvX = properties.getInt("horiz-adv-x", 0); - namedGlyphs = new HashMap(); - unicodeGlyphs = new HashMap(); + namedGlyphs = new HashMap<>(); + unicodeGlyphs = new HashMap<>(); glyphCount = 0; glyphs = new FontGlyph[elements.length]; @@ -1711,7 +1927,7 @@ protected void drawShape() { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - public static class FontGlyph extends PShapeSVG { // extends Path + static public class FontGlyph extends PShapeSVG { // extends Path public String name; char unicode; int horizAdvX; diff --git a/core/src/processing/core/PSurface.java b/core/src/processing/core/PSurface.java index 45dcf1f53f..c4f3580fb6 100644 --- a/core/src/processing/core/PSurface.java +++ b/core/src/processing/core/PSurface.java @@ -71,6 +71,9 @@ public interface PSurface { /** Set true if we want to resize things (default is not resizable) */ public void setResizable(boolean resizable); + /** Dumb name, but inherited from Frame and no better ideas. */ + public void setAlwaysOnTop(boolean always); + public void setIcon(PImage icon); // @@ -94,14 +97,14 @@ public interface PSurface { public void setSize(int width, int height); - /** - * Called by {@link PApplet#createGraphics} to initialize the - * {@link PGraphics#image} object with an image that's compatible with this - * drawing surface/display/hardware. - * @param gr PGraphics object whose image will be set - * @param wide - * @param high - */ +// /** +// * Called by {@link PApplet#createGraphics} to initialize the +// * {@link PGraphics#image} object with an image that's compatible with this +// * drawing surface/display/hardware. +// * @param gr PGraphics object whose image will be set +// * @param wide +// * @param high +// */ // create pixel buffer (pulled out for offscreen graphics) //public void initImage(PGraphics gr, int wide, int high); // create pixel buffer, called from allocate() to produce a compatible image for rendering efficiently @@ -155,4 +158,4 @@ public interface PSurface { public boolean stopThread(); public boolean isStopped(); -} \ No newline at end of file +} diff --git a/core/src/processing/core/PSurfaceNone.java b/core/src/processing/core/PSurfaceNone.java index a3ffa1ab8c..f86ac0cde9 100644 --- a/core/src/processing/core/PSurfaceNone.java +++ b/core/src/processing/core/PSurfaceNone.java @@ -58,10 +58,7 @@ public void initOffscreen(PApplet sketch) { @Override - public void initFrame(PApplet sketch) {/*, int backgroundColor, - int deviceIndex, boolean fullScreen, - boolean spanDisplays) {*/ - //this.sketch = sketch; + public void initFrame(PApplet sketch) { throw new IllegalStateException("initFrame() not available with " + getClass().getSimpleName()); } @@ -111,6 +108,10 @@ public void placePresent(int stopColor) { } public void setupExternalMessages() { } + @Override + public void setAlwaysOnTop(boolean always) { } + + // @@ -203,7 +204,7 @@ public boolean stopThread() { public boolean isStopped() { - return thread == null; + return thread == null || !thread.isAlive(); } diff --git a/core/src/processing/core/PVector.java b/core/src/processing/core/PVector.java index 72c26a0938..9c0b65e841 100644 --- a/core/src/processing/core/PVector.java +++ b/core/src/processing/core/PVector.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2012-17 The Processing Foundation Copyright (c) 2008-12 Ben Fry and Casey Reas Copyright (c) 2008 Dan Shiffman @@ -26,8 +26,6 @@ import java.io.Serializable; -import processing.core.PApplet; -import processing.core.PConstants; /** * ( begin auto-generated from PVector.xml ) @@ -142,7 +140,6 @@ public PVector(float x, float y, float z) { public PVector(float x, float y) { this.x = x; this.y = y; - this.z = 0; } @@ -175,6 +172,7 @@ public PVector set(float x, float y, float z) { public PVector set(float x, float y) { this.x = x; this.y = y; + this.z = 0; return this; } @@ -201,6 +199,8 @@ public PVector set(float[] source) { } if (source.length >= 3) { z = source[2]; + } else { + z = 0; } return this; } @@ -356,13 +356,8 @@ static public PVector fromAngle(float angle, PVector target) { } - public PVector copy() { - return new PVector(x, y, z); - } - - /** - * ( begin auto-generated from PVector_get.xml ) + * ( begin auto-generated from PVector_copy.xml ) * * Gets a copy of the vector, returns a PVector object. * @@ -372,6 +367,11 @@ public PVector copy() { * @usage web_application * @brief Get a copy of the vector */ + public PVector copy() { + return new PVector(x, y, z); + } + + @Deprecated public PVector get() { return copy(); @@ -472,8 +472,6 @@ public PVector add(float x, float y) { /** - * @param x x component of the vector - * @param y y component of the vector * @param z z component of the vector */ public PVector add(float x, float y, float z) { @@ -544,8 +542,6 @@ public PVector sub(float x, float y) { /** - * @param x the x component of the vector - * @param y the y component of the vector * @param z the z component of the vector */ public PVector sub(float x, float y, float z) { @@ -568,8 +564,6 @@ static public PVector sub(PVector v1, PVector v2) { /** * Subtract one vector from another and store in another vector - * @param v1 the x, y, and z components of a PVector object - * @param v2 the x, y, and z components of a PVector object * @param target PVector in which to store the result */ static public PVector sub(PVector v1, PVector v2, PVector target) { @@ -940,7 +934,7 @@ public PVector rotate(float theta) { * @usage web_application * @brief Linear interpolate the vector to another vector * @param v the vector to lerp to - * @param amt The amount of interpolation; some value between 0.0 (old vector) and 1.0 (new vector). 0.1 is very near the new vector. 0.5 is halfway in between. + * @param amt The amount of interpolation; some value between 0.0 (old vector) and 1.0 (new vector). 0.1 is very near the old vector; 0.5 is halfway in between. * @see PApplet#lerp(float, float, float) */ public PVector lerp(PVector v, float amt) { diff --git a/core/src/processing/core/ThinkDifferent.java b/core/src/processing/core/ThinkDifferent.java index ca2903f913..8596696198 100644 --- a/core/src/processing/core/ThinkDifferent.java +++ b/core/src/processing/core/ThinkDifferent.java @@ -60,8 +60,9 @@ static public void init(final PApplet sketch) { application.setQuitHandler(new QuitHandler() { public void handleQuitRequestWith(QuitEvent event, QuitResponse response) { sketch.exit(); - if (!attemptedQuit) { - response.cancelQuit(); // we'll quit manually + if (PApplet.uncaughtThrowable == null && // no known crash + !attemptedQuit) { // haven't tried yet + response.cancelQuit(); // tell OS X we'll handle this attemptedQuit = true; } else { response.performQuit(); // just force it this time @@ -70,6 +71,12 @@ public void handleQuitRequestWith(QuitEvent event, QuitResponse response) { }); } + static public void cleanup() { + if (application == null) { + application = Application.getApplication(); + } + application.setQuitHandler(null); + } // Called via reflection from PSurfaceAWT and others static public void setIconImage(Image image) { diff --git a/core/src/processing/data/DoubleDict.java b/core/src/processing/data/DoubleDict.java new file mode 100644 index 0000000000..5cec4d6e18 --- /dev/null +++ b/core/src/processing/data/DoubleDict.java @@ -0,0 +1,850 @@ +package processing.data; + +import java.io.*; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.NoSuchElementException; + +import processing.core.PApplet; + + +/** + * A simple table class to use a String as a lookup for an double value. + * + * @nowebref + * @see IntDict + * @see StringDict + */ +public class DoubleDict { + + /** Number of elements in the table */ + protected int count; + + protected String[] keys; + protected double[] values; + + /** Internal implementation for faster lookups */ + private HashMap indices = new HashMap<>(); + + + public DoubleDict() { + count = 0; + keys = new String[10]; + values = new double[10]; + } + + + /** + * Create a new lookup with a specific size. This is more efficient than not + * specifying a size. Use it when you know the rough size of the thing you're creating. + * + * @nowebref + */ + public DoubleDict(int length) { + count = 0; + keys = new String[length]; + values = new double[length]; + } + + + /** + * Read a set of entries from a Reader that has each key/value pair on + * a single line, separated by a tab. + * + * @nowebref + */ + public DoubleDict(BufferedReader reader) { + String[] lines = PApplet.loadStrings(reader); + keys = new String[lines.length]; + values = new double[lines.length]; + + for (int i = 0; i < lines.length; i++) { + String[] pieces = PApplet.split(lines[i], '\t'); + if (pieces.length == 2) { + keys[count] = pieces[0]; + values[count] = PApplet.parseFloat(pieces[1]); + indices.put(pieces[0], count); + count++; + } + } + } + + + /** + * @nowebref + */ + public DoubleDict(String[] keys, double[] values) { + if (keys.length != values.length) { + throw new IllegalArgumentException("key and value arrays must be the same length"); + } + this.keys = keys; + this.values = values; + count = keys.length; + for (int i = 0; i < count; i++) { + indices.put(keys[i], i); + } + } + + + /** + * Constructor to allow (more intuitive) inline initialization, e.g.: + *
+   * new FloatDict(new Object[][] {
+   *   { "key1", 1 },
+   *   { "key2", 2 }
+   * });
+   * 
+ */ + public DoubleDict(Object[][] pairs) { + count = pairs.length; + this.keys = new String[count]; + this.values = new double[count]; + for (int i = 0; i < count; i++) { + keys[i] = (String) pairs[i][0]; + values[i] = (Float) pairs[i][1]; + indices.put(keys[i], i); + } + } + + + public DoubleDict(Map incoming) { + count = incoming.size(); + keys = new String[count]; + values = new double[count]; + int index = 0; + for (Map.Entry e : incoming.entrySet()) { + keys[index] = e.getKey(); + values[index] = e.getValue(); + indices.put(keys[index], index); + index++; + } + } + + + /** + * @webref doubledict:method + * @brief Returns the number of key/value pairs + */ + public int size() { + return count; + } + + + /** + * Resize the internal data, this can only be used to shrink the list. + * Helpful for situations like sorting and then grabbing the top 50 entries. + */ + public void resize(int length) { + if (length == count) return; + + if (length > count) { + throw new IllegalArgumentException("resize() can only be used to shrink the dictionary"); + } + if (length < 1) { + throw new IllegalArgumentException("resize(" + length + ") is too small, use 1 or higher"); + } + + String[] newKeys = new String[length]; + double[] newValues = new double[length]; + PApplet.arrayCopy(keys, newKeys, length); + PApplet.arrayCopy(values, newValues, length); + keys = newKeys; + values = newValues; + count = length; + resetIndices(); + } + + + /** + * Remove all entries. + * + * @webref doubledict:method + * @brief Remove all entries + */ + public void clear() { + count = 0; + indices = new HashMap<>(); + } + + + private void resetIndices() { + indices = new HashMap<>(count); + for (int i = 0; i < count; i++) { + indices.put(keys[i], i); + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + public class Entry { + public String key; + public double value; + + Entry(String key, double value) { + this.key = key; + this.value = value; + } + } + + + public Iterable entries() { + return new Iterable() { + + public Iterator iterator() { + return entryIterator(); + } + }; + } + + + public Iterator entryIterator() { + return new Iterator() { + int index = -1; + + public void remove() { + removeIndex(index); + index--; + } + + public Entry next() { + ++index; + Entry e = new Entry(keys[index], values[index]); + return e; + } + + public boolean hasNext() { + return index+1 < size(); + } + }; + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + public String key(int index) { + return keys[index]; + } + + + protected void crop() { + if (count != keys.length) { + keys = PApplet.subset(keys, 0, count); + values = PApplet.subset(values, 0, count); + } + } + + + public Iterable keys() { + return new Iterable() { + + @Override + public Iterator iterator() { + return keyIterator(); + } + }; + } + + + // Use this to iterate when you want to be able to remove elements along the way + public Iterator keyIterator() { + return new Iterator() { + int index = -1; + + public void remove() { + removeIndex(index); + index--; + } + + public String next() { + return key(++index); + } + + public boolean hasNext() { + return index+1 < size(); + } + }; + } + + + /** + * Return a copy of the internal keys array. This array can be modified. + * + * @webref doubledict:method + * @brief Return a copy of the internal keys array + */ + public String[] keyArray() { + crop(); + return keyArray(null); + } + + + public String[] keyArray(String[] outgoing) { + if (outgoing == null || outgoing.length != count) { + outgoing = new String[count]; + } + System.arraycopy(keys, 0, outgoing, 0, count); + return outgoing; + } + + + public double value(int index) { + return values[index]; + } + + + /** + * @webref doubledict:method + * @brief Return the internal array being used to store the values + */ + public Iterable values() { + return new Iterable() { + + @Override + public Iterator iterator() { + return valueIterator(); + } + }; + } + + + public Iterator valueIterator() { + return new Iterator() { + int index = -1; + + public void remove() { + removeIndex(index); + index--; + } + + public Double next() { + return value(++index); + } + + public boolean hasNext() { + return index+1 < size(); + } + }; + } + + + /** + * Create a new array and copy each of the values into it. + * + * @webref doubledict:method + * @brief Create a new array and copy each of the values into it + */ + public double[] valueArray() { + crop(); + return valueArray(null); + } + + + /** + * Fill an already-allocated array with the values (more efficient than + * creating a new array each time). If 'array' is null, or not the same + * size as the number of values, a new array will be allocated and returned. + */ + public double[] valueArray(double[] array) { + if (array == null || array.length != size()) { + array = new double[count]; + } + System.arraycopy(values, 0, array, 0, count); + return array; + } + + + /** + * Return a value for the specified key. + * + * @webref doubledict:method + * @brief Return a value for the specified key + */ + public double get(String key) { + int index = index(key); + if (index == -1) { + throw new IllegalArgumentException("No key named '" + key + "'"); + } + return values[index]; + } + + + public double get(String key, double alternate) { + int index = index(key); + if (index == -1) { + return alternate; + } + return values[index]; + } + + + /** + * @webref doubledict:method + * @brief Create a new key/value pair or change the value of one + */ + public void set(String key, double amount) { + int index = index(key); + if (index == -1) { + create(key, amount); + } else { + values[index] = amount; + } + } + + + public void setIndex(int index, String key, double value) { + if (index < 0 || index >= count) { + throw new ArrayIndexOutOfBoundsException(index); + } + keys[index] = key; + values[index] = value; + } + + + /** + * @webref doubledict:method + * @brief Check if a key is a part of the data structure + */ + public boolean hasKey(String key) { + return index(key) != -1; + } + + + /** + * @webref doubledict:method + * @brief Add to a value + */ + public void add(String key, double amount) { + int index = index(key); + if (index == -1) { + create(key, amount); + } else { + values[index] += amount; + } + } + + + /** + * @webref doubledict:method + * @brief Subtract from a value + */ + public void sub(String key, double amount) { + add(key, -amount); + } + + + /** + * @webref doubledict:method + * @brief Multiply a value + */ + public void mult(String key, double amount) { + int index = index(key); + if (index != -1) { + values[index] *= amount; + } + } + + + /** + * @webref doubledict:method + * @brief Divide a value + */ + public void div(String key, double amount) { + int index = index(key); + if (index != -1) { + values[index] /= amount; + } + } + + + private void checkMinMax(String functionName) { + if (count == 0) { + String msg = + String.format("Cannot use %s() on an empty %s.", + functionName, getClass().getSimpleName()); + throw new RuntimeException(msg); + } + } + + + /** + * @webref doublelist:method + * @brief Return the smallest value + */ + public int minIndex() { + //checkMinMax("minIndex"); + if (count == 0) return -1; + + // Will still return NaN if there are 1 or more entries, and they're all NaN + double m = Float.NaN; + int mi = -1; + for (int i = 0; i < count; i++) { + // find one good value to start + if (values[i] == values[i]) { + m = values[i]; + mi = i; + + // calculate the rest + for (int j = i+1; j < count; j++) { + double d = values[j]; + if ((d == d) && (d < m)) { + m = values[j]; + mi = j; + } + } + break; + } + } + return mi; + } + + + // return the key for the minimum value + public String minKey() { + checkMinMax("minKey"); + int index = minIndex(); + if (index == -1) { + return null; + } + return keys[index]; + } + + + // return the minimum value, or throw an error if there are no values + public double minValue() { + checkMinMax("minValue"); + int index = minIndex(); + if (index == -1) { + return Float.NaN; + } + return values[index]; + } + + + /** + * @webref doublelist:method + * @brief Return the largest value + */ + // The index of the entry that has the max value. Reference above is incorrect. + public int maxIndex() { + //checkMinMax("maxIndex"); + if (count == 0) { + return -1; + } + // Will still return NaN if there is 1 or more entries, and they're all NaN + double m = Double.NaN; + int mi = -1; + for (int i = 0; i < count; i++) { + // find one good value to start + if (values[i] == values[i]) { + m = values[i]; + mi = i; + + // calculate the rest + for (int j = i+1; j < count; j++) { + double d = values[j]; + if (!Double.isNaN(d) && (d > m)) { + m = values[j]; + mi = j; + } + } + break; + } + } + return mi; + } + + + /** The key for a max value; null if empty or everything is NaN (no max). */ + public String maxKey() { + //checkMinMax("maxKey"); + int index = maxIndex(); + if (index == -1) { + return null; + } + return keys[index]; + } + + + /** The max value. (Or NaN if no entries or they're all NaN.) */ + public double maxValue() { + //checkMinMax("maxValue"); + int index = maxIndex(); + if (index == -1) { + return Float.NaN; + } + return values[index]; + } + + + public double sum() { + double sum = 0; + for (int i = 0; i < count; i++) { + sum += values[i]; + } + return sum; + } + + + public int index(String what) { + Integer found = indices.get(what); + return (found == null) ? -1 : found.intValue(); + } + + + protected void create(String what, double much) { + if (count == keys.length) { + keys = PApplet.expand(keys); + values = PApplet.expand(values); + } + indices.put(what, Integer.valueOf(count)); + keys[count] = what; + values[count] = much; + count++; + } + + + /** + * @webref doubledict:method + * @brief Remove a key/value pair + */ + public double remove(String key) { + int index = index(key); + if (index == -1) { + throw new NoSuchElementException("'" + key + "' not found"); + } + double value = values[index]; + removeIndex(index); + return value; + } + + + public double removeIndex(int index) { + if (index < 0 || index >= count) { + throw new ArrayIndexOutOfBoundsException(index); + } + double value = values[index]; + indices.remove(keys[index]); + for (int i = index; i < count-1; i++) { + keys[i] = keys[i+1]; + values[i] = values[i+1]; + indices.put(keys[i], i); + } + count--; + keys[count] = null; + values[count] = 0; + return value; + } + + + public void swap(int a, int b) { + String tkey = keys[a]; + double tvalue = values[a]; + keys[a] = keys[b]; + values[a] = values[b]; + keys[b] = tkey; + values[b] = tvalue; + +// indices.put(keys[a], Integer.valueOf(a)); +// indices.put(keys[b], Integer.valueOf(b)); + } + + + /** + * Sort the keys alphabetically (ignoring case). Uses the value as a + * tie-breaker (only really possible with a key that has a case change). + * + * @webref doubledict:method + * @brief Sort the keys alphabetically + */ + public void sortKeys() { + sortImpl(true, false, true); + } + + + /** + * @webref doubledict:method + * @brief Sort the keys alphabetically in reverse + */ + public void sortKeysReverse() { + sortImpl(true, true, true); + } + + + /** + * Sort by values in descending order (largest value will be at [0]). + * + * @webref doubledict:method + * @brief Sort by values in ascending order + */ + public void sortValues() { + sortValues(true); + } + + + /** + * Set true to ensure that the order returned is identical. Slightly + * slower because the tie-breaker for identical values compares the keys. + * @param stable + */ + public void sortValues(boolean stable) { + sortImpl(false, false, stable); + } + + + /** + * @webref doubledict:method + * @brief Sort by values in descending order + */ + public void sortValuesReverse() { + sortValuesReverse(true); + } + + + public void sortValuesReverse(boolean stable) { + sortImpl(false, true, stable); + } + + + protected void sortImpl(final boolean useKeys, final boolean reverse, + final boolean stable) { + Sort s = new Sort() { + @Override + public int size() { + if (useKeys) { + return count; // don't worry about NaN values + + } else if (count == 0) { // skip the NaN check, it'll AIOOBE + return 0; + + } else { // first move NaN values to the end of the list + int right = count - 1; + while (values[right] != values[right]) { + right--; + if (right == -1) { + return 0; // all values are NaN + } + } + for (int i = right; i >= 0; --i) { + if (Double.isNaN(values[i])) { + swap(i, right); + --right; + } + } + return right + 1; + } + } + + @Override + public int compare(int a, int b) { + double diff = 0; + if (useKeys) { + diff = keys[a].compareToIgnoreCase(keys[b]); + if (diff == 0) { + diff = values[a] - values[b]; + } + } else { // sort values + diff = values[a] - values[b]; + if (diff == 0 && stable) { + diff = keys[a].compareToIgnoreCase(keys[b]); + } + } + if (diff == 0) { + return 0; + } else if (reverse) { + return diff < 0 ? 1 : -1; + } else { + return diff < 0 ? -1 : 1; + } + } + + @Override + public void swap(int a, int b) { + DoubleDict.this.swap(a, b); + } + }; + s.run(); + + // Set the indices after sort/swaps (performance fix 160411) + resetIndices(); + } + + + /** + * Sum all of the values in this dictionary, then return a new FloatDict of + * each key, divided by the total sum. The total for all values will be ~1.0. + * @return a FloatDict with the original keys, mapped to their pct of the total + */ + public DoubleDict getPercent() { + double sum = sum(); + DoubleDict outgoing = new DoubleDict(); + for (int i = 0; i < size(); i++) { + double percent = value(i) / sum; + outgoing.set(key(i), percent); + } + return outgoing; + } + + + /** Returns a duplicate copy of this object. */ + public DoubleDict copy() { + DoubleDict outgoing = new DoubleDict(count); + System.arraycopy(keys, 0, outgoing.keys, 0, count); + System.arraycopy(values, 0, outgoing.values, 0, count); + for (int i = 0; i < count; i++) { + outgoing.indices.put(keys[i], i); + } + outgoing.count = count; + return outgoing; + } + + + public void print() { + for (int i = 0; i < size(); i++) { + System.out.println(keys[i] + " = " + values[i]); + } + } + + + /** + * Save tab-delimited entries to a file (TSV format, UTF-8 encoding) + */ + public void save(File file) { + PrintWriter writer = PApplet.createWriter(file); + write(writer); + writer.close(); + } + + + /** + * Write tab-delimited entries out to + * @param writer + */ + public void write(PrintWriter writer) { + for (int i = 0; i < count; i++) { + writer.println(keys[i] + "\t" + values[i]); + } + writer.flush(); + } + + + /** + * Return this dictionary as a String in JSON format. + */ + public String toJSON() { + StringList items = new StringList(); + for (int i = 0; i < count; i++) { + items.append(JSONObject.quote(keys[i])+ ": " + values[i]); + } + return "{ " + items.join(", ") + " }"; + } + + + @Override + public String toString() { + return getClass().getSimpleName() + " size=" + size() + " " + toJSON(); + } +} diff --git a/core/src/processing/data/DoubleList.java b/core/src/processing/data/DoubleList.java new file mode 100644 index 0000000000..6c364130c9 --- /dev/null +++ b/core/src/processing/data/DoubleList.java @@ -0,0 +1,928 @@ +package processing.data; + +import java.io.File; +import java.io.PrintWriter; +import java.util.Arrays; +import java.util.Iterator; +import java.util.Random; + +import processing.core.PApplet; + + +/** + * Helper class for a list of floats. Lists are designed to have some of the + * features of ArrayLists, but to maintain the simplicity and efficiency of + * working with arrays. + * + * Functions like sort() and shuffle() always act on the list itself. To get + * a sorted copy, use list.copy().sort(). + * + * @nowebref + * @see IntList + * @see StringList + */ +public class DoubleList implements Iterable { + int count; + double[] data; + + + public DoubleList() { + data = new double[10]; + } + + + /** + * @nowebref + */ + public DoubleList(int length) { + data = new double[length]; + } + + + /** + * @nowebref + */ + public DoubleList(double[] list) { + count = list.length; + data = new double[count]; + System.arraycopy(list, 0, data, 0, count); + } + + + /** + * Construct an FloatList from an iterable pile of objects. + * For instance, a double array, an array of strings, who knows). + * Un-parseable or null values will be set to NaN. + * @nowebref + */ + public DoubleList(Iterable iter) { + this(10); + for (Object o : iter) { + if (o == null) { + append(Double.NaN); + } else if (o instanceof Number) { + append(((Number) o).doubleValue()); + } else { + append(PApplet.parseFloat(o.toString().trim())); + } + } + crop(); + } + + + /** + * Construct an FloatList from a random pile of objects. + * Un-parseable or null values will be set to NaN. + */ + public DoubleList(Object... items) { + // nuts, no good way to pass missingValue to this fn (varargs must be last) + final double missingValue = Double.NaN; + + count = items.length; + data = new double[count]; + int index = 0; + for (Object o : items) { + double value = missingValue; + if (o != null) { + if (o instanceof Number) { + value = ((Number) o).doubleValue(); + } else { + try { + value = Double.parseDouble(o.toString().trim()); + } catch (NumberFormatException nfe) { + value = missingValue; + } + } + } + data[index++] = value; + } + } + + + /** + * Improve efficiency by removing allocated but unused entries from the + * internal array used to store the data. Set to private, though it could + * be useful to have this public if lists are frequently making drastic + * size changes (from very large to very small). + */ + private void crop() { + if (count != data.length) { + data = PApplet.subset(data, 0, count); + } + } + + + /** + * Get the length of the list. + * + * @webref doublelist:method + * @brief Get the length of the list + */ + public int size() { + return count; + } + + + public void resize(int length) { + if (length > data.length) { + double[] temp = new double[length]; + System.arraycopy(data, 0, temp, 0, count); + data = temp; + + } else if (length > count) { + Arrays.fill(data, count, length, 0); + } + count = length; + } + + + /** + * Remove all entries from the list. + * + * @webref doublelist:method + * @brief Remove all entries from the list + */ + public void clear() { + count = 0; + } + + + /** + * Get an entry at a particular index. + * + * @webref doublelist:method + * @brief Get an entry at a particular index + */ + public double get(int index) { + if (index >= count) { + throw new ArrayIndexOutOfBoundsException(index); + } + return data[index]; + } + + + /** + * Set the entry at a particular index. If the index is past the length of + * the list, it'll expand the list to accommodate, and fill the intermediate + * entries with 0s. + * + * @webref doublelist:method + * @brief Set the entry at a particular index + */ + public void set(int index, double what) { + if (index >= count) { + data = PApplet.expand(data, index+1); + for (int i = count; i < index; i++) { + data[i] = 0; + } + count = index+1; + } + data[index] = what; + } + + + /** Just an alias for append(), but matches pop() */ + public void push(double value) { + append(value); + } + + + public double pop() { + if (count == 0) { + throw new RuntimeException("Can't call pop() on an empty list"); + } + double value = get(count-1); + count--; + return value; + } + + + /** + * Remove an element from the specified index. + * + * @webref doublelist:method + * @brief Remove an element from the specified index + */ + public double remove(int index) { + if (index < 0 || index >= count) { + throw new ArrayIndexOutOfBoundsException(index); + } + double entry = data[index]; +// int[] outgoing = new int[count - 1]; +// System.arraycopy(data, 0, outgoing, 0, index); +// count--; +// System.arraycopy(data, index + 1, outgoing, 0, count - index); +// data = outgoing; + // For most cases, this actually appears to be faster + // than arraycopy() on an array copying into itself. + for (int i = index; i < count-1; i++) { + data[i] = data[i+1]; + } + count--; + return entry; + } + + + // Remove the first instance of a particular value, + // and return the index at which it was found. + public int removeValue(int value) { + int index = index(value); + if (index != -1) { + remove(index); + return index; + } + return -1; + } + + + // Remove all instances of a particular value, + // and return the number of values found and removed + public int removeValues(int value) { + int ii = 0; + if (Double.isNaN(value)) { + for (int i = 0; i < count; i++) { + if (!Double.isNaN(data[i])) { + data[ii++] = data[i]; + } + } + } else { + for (int i = 0; i < count; i++) { + if (data[i] != value) { + data[ii++] = data[i]; + } + } + } + int removed = count - ii; + count = ii; + return removed; + } + + + /** Replace the first instance of a particular value */ + public boolean replaceValue(double value, double newValue) { + if (Double.isNaN(value)) { + for (int i = 0; i < count; i++) { + if (Double.isNaN(data[i])) { + data[i] = newValue; + return true; + } + } + } else { + int index = index(value); + if (index != -1) { + data[index] = newValue; + return true; + } + } + return false; + } + + + /** Replace all instances of a particular value */ + public boolean replaceValues(double value, double newValue) { + boolean changed = false; + if (Double.isNaN(value)) { + for (int i = 0; i < count; i++) { + if (Double.isNaN(data[i])) { + data[i] = newValue; + changed = true; + } + } + } else { + for (int i = 0; i < count; i++) { + if (data[i] == value) { + data[i] = newValue; + changed = true; + } + } + } + return changed; + } + + + + /** + * Add a new entry to the list. + * + * @webref doublelist:method + * @brief Add a new entry to the list + */ + public void append(double value) { + if (count == data.length) { + data = PApplet.expand(data); + } + data[count++] = value; + } + + + public void append(double[] values) { + for (double v : values) { + append(v); + } + } + + + public void append(DoubleList list) { + for (double v : list.values()) { // will concat the list... + append(v); + } + } + + + /** Add this value, but only if it's not already in the list. */ + public void appendUnique(double value) { + if (!hasValue(value)) { + append(value); + } + } + + +// public void insert(int index, int value) { +// if (index+1 > count) { +// if (index+1 < data.length) { +// } +// } +// if (index >= data.length) { +// data = PApplet.expand(data, index+1); +// data[index] = value; +// count = index+1; +// +// } else if (count == data.length) { +// if (index >= count) { +// //int[] temp = new int[count << 1]; +// System.arraycopy(data, 0, temp, 0, index); +// temp[index] = value; +// System.arraycopy(data, index, temp, index+1, count - index); +// data = temp; +// +// } else { +// // data[] has room to grow +// // for() loop believed to be faster than System.arraycopy over itself +// for (int i = count; i > index; --i) { +// data[i] = data[i-1]; +// } +// data[index] = value; +// count++; +// } +// } + + + public void insert(int index, double value) { + insert(index, new double[] { value }); + } + + + // same as splice + public void insert(int index, double[] values) { + if (index < 0) { + throw new IllegalArgumentException("insert() index cannot be negative: it was " + index); + } + if (index >= data.length) { + throw new IllegalArgumentException("insert() index " + index + " is past the end of this list"); + } + + double[] temp = new double[count + values.length]; + + // Copy the old values, but not more than already exist + System.arraycopy(data, 0, temp, 0, Math.min(count, index)); + + // Copy the new values into the proper place + System.arraycopy(values, 0, temp, index, values.length); + +// if (index < count) { + // The index was inside count, so it's a true splice/insert + System.arraycopy(data, index, temp, index+values.length, count - index); + count = count + values.length; +// } else { +// // The index was past 'count', so the new count is weirder +// count = index + values.length; +// } + data = temp; + } + + + public void insert(int index, DoubleList list) { + insert(index, list.values()); + } + + + // below are aborted attempts at more optimized versions of the code + // that are harder to read and debug... + +// if (index + values.length >= count) { +// // We're past the current 'count', check to see if we're still allocated +// // index 9, data.length = 10, values.length = 1 +// if (index + values.length < data.length) { +// // There's still room for these entries, even though it's past 'count'. +// // First clear out the entries leading up to it, however. +// for (int i = count; i < index; i++) { +// data[i] = 0; +// } +// data[index] = +// } +// if (index >= data.length) { +// int length = index + values.length; +// int[] temp = new int[length]; +// System.arraycopy(data, 0, temp, 0, count); +// System.arraycopy(values, 0, temp, index, values.length); +// data = temp; +// count = data.length; +// } else { +// +// } +// +// } else if (count == data.length) { +// int[] temp = new int[count << 1]; +// System.arraycopy(data, 0, temp, 0, index); +// temp[index] = value; +// System.arraycopy(data, index, temp, index+1, count - index); +// data = temp; +// +// } else { +// // data[] has room to grow +// // for() loop believed to be faster than System.arraycopy over itself +// for (int i = count; i > index; --i) { +// data[i] = data[i-1]; +// } +// data[index] = value; +// count++; +// } + + + /** Return the first index of a particular value. */ + public int index(double what) { + /* + if (indexCache != null) { + try { + return indexCache.get(what); + } catch (Exception e) { // not there + return -1; + } + } + */ + for (int i = 0; i < count; i++) { + if (data[i] == what) { + return i; + } + } + return -1; + } + + + /** + * @webref doublelist:method + * @brief Check if a number is a part of the list + */ + public boolean hasValue(double value) { + if (Double.isNaN(value)) { + for (int i = 0; i < count; i++) { + if (Double.isNaN(data[i])) { + return true; + } + } + } else { + for (int i = 0; i < count; i++) { + if (data[i] == value) { + return true; + } + } + } + return false; + } + + + private void boundsProblem(int index, String method) { + final String msg = String.format("The list size is %d. " + + "You cannot %s() to element %d.", count, method, index); + throw new ArrayIndexOutOfBoundsException(msg); + } + + + /** + * @webref doublelist:method + * @brief Add to a value + */ + public void add(int index, double amount) { + if (index < count) { + data[index] += amount; + } else { + boundsProblem(index, "add"); + } + } + + + /** + * @webref doublelist:method + * @brief Subtract from a value + */ + public void sub(int index, double amount) { + if (index < count) { + data[index] -= amount; + } else { + boundsProblem(index, "sub"); + } + } + + + /** + * @webref doublelist:method + * @brief Multiply a value + */ + public void mult(int index, double amount) { + if (index < count) { + data[index] *= amount; + } else { + boundsProblem(index, "mult"); + } + } + + + /** + * @webref doublelist:method + * @brief Divide a value + */ + public void div(int index, double amount) { + if (index < count) { + data[index] /= amount; + } else { + boundsProblem(index, "div"); + } + } + + + private void checkMinMax(String functionName) { + if (count == 0) { + String msg = + String.format("Cannot use %s() on an empty %s.", + functionName, getClass().getSimpleName()); + throw new RuntimeException(msg); + } + } + + + /** + * @webref doublelist:method + * @brief Return the smallest value + */ + public double min() { + checkMinMax("min"); + int index = minIndex(); + return index == -1 ? Double.NaN : data[index]; + } + + + public int minIndex() { + checkMinMax("minIndex"); + double m = Double.NaN; + int mi = -1; + for (int i = 0; i < count; i++) { + // find one good value to start + if (data[i] == data[i]) { + m = data[i]; + mi = i; + + // calculate the rest + for (int j = i+1; j < count; j++) { + double d = data[j]; + if (!Double.isNaN(d) && (d < m)) { + m = data[j]; + mi = j; + } + } + break; + } + } + return mi; + } + + + /** + * @webref doublelist:method + * @brief Return the largest value + */ + public double max() { + checkMinMax("max"); + int index = maxIndex(); + return index == -1 ? Double.NaN : data[index]; + } + + + public int maxIndex() { + checkMinMax("maxIndex"); + double m = Double.NaN; + int mi = -1; + for (int i = 0; i < count; i++) { + // find one good value to start + if (data[i] == data[i]) { + m = data[i]; + mi = i; + + // calculate the rest + for (int j = i+1; j < count; j++) { + double d = data[j]; + if (!Double.isNaN(d) && (d > m)) { + m = data[j]; + mi = j; + } + } + break; + } + } + return mi; + } + + + public double sum() { + double sum = 0; + for (int i = 0; i < count; i++) { + sum += data[i]; + } + return sum; + } + + + /** + * Sorts the array in place. + * + * @webref doublelist:method + * @brief Sorts an array, lowest to highest + */ + public void sort() { + Arrays.sort(data, 0, count); + } + + + /** + * Reverse sort, orders values from highest to lowest + * + * @webref doublelist:method + * @brief Reverse sort, orders values from highest to lowest + */ + public void sortReverse() { + new Sort() { + @Override + public int size() { + // if empty, don't even mess with the NaN check, it'll AIOOBE + if (count == 0) { + return 0; + } + // move NaN values to the end of the list and don't sort them + int right = count - 1; + while (data[right] != data[right]) { + right--; + if (right == -1) { // all values are NaN + return 0; + } + } + for (int i = right; i >= 0; --i) { + double v = data[i]; + if (v != v) { + data[i] = data[right]; + data[right] = v; + --right; + } + } + return right + 1; + } + + @Override + public int compare(int a, int b) { + double diff = data[b] - data[a]; + return diff == 0 ? 0 : (diff < 0 ? -1 : 1); + } + + @Override + public void swap(int a, int b) { + double temp = data[a]; + data[a] = data[b]; + data[b] = temp; + } + }.run(); + } + + + // use insert() +// public void splice(int index, int value) { +// } + + +// public void subset(int start) { +// subset(start, count - start); +// } + + +// public void subset(int start, int num) { +// for (int i = 0; i < num; i++) { +// data[i] = data[i+start]; +// } +// count = num; +// } + + + /** + * @webref doublelist:method + * @brief Reverse the order of the list elements + */ + public void reverse() { + int ii = count - 1; + for (int i = 0; i < count/2; i++) { + double t = data[i]; + data[i] = data[ii]; + data[ii] = t; + --ii; + } + } + + + /** + * Randomize the order of the list elements. Note that this does not + * obey the randomSeed() function in PApplet. + * + * @webref doublelist:method + * @brief Randomize the order of the list elements + */ + public void shuffle() { + Random r = new Random(); + int num = count; + while (num > 1) { + int value = r.nextInt(num); + num--; + double temp = data[num]; + data[num] = data[value]; + data[value] = temp; + } + } + + + /** + * Randomize the list order using the random() function from the specified + * sketch, allowing shuffle() to use its current randomSeed() setting. + */ + public void shuffle(PApplet sketch) { + int num = count; + while (num > 1) { + int value = (int) sketch.random(num); + num--; + double temp = data[num]; + data[num] = data[value]; + data[value] = temp; + } + } + + + public DoubleList copy() { + DoubleList outgoing = new DoubleList(data); + outgoing.count = count; + return outgoing; + } + + + /** + * Returns the actual array being used to store the data. For advanced users, + * this is the fastest way to access a large list. Suitable for iterating + * with a for() loop, but modifying the list will have terrible consequences. + */ + public double[] values() { + crop(); + return data; + } + + + /** Implemented this way so that we can use a FloatList in a for loop. */ + @Override + public Iterator iterator() { +// } +// +// +// public Iterator valueIterator() { + return new Iterator() { + int index = -1; + + public void remove() { + DoubleList.this.remove(index); + index--; + } + + public Double next() { + return data[++index]; + } + + public boolean hasNext() { + return index+1 < count; + } + }; + } + + + /** + * Create a new array with a copy of all the values. + * @return an array sized by the length of the list with each of the values. + * @webref doublelist:method + * @brief Create a new array with a copy of all the values + */ + public double[] array() { + return array(null); + } + + + /** + * Copy values into the specified array. If the specified array is null or + * not the same size, a new array will be allocated. + * @param array + */ + public double[] array(double[] array) { + if (array == null || array.length != count) { + array = new double[count]; + } + System.arraycopy(data, 0, array, 0, count); + return array; + } + + + /** + * Returns a normalized version of this array. Called getPercent() for + * consistency with the Dict classes. It's a getter method because it needs + * to returns a new list (because IntList/Dict can't do percentages or + * normalization in place on int values). + */ + public DoubleList getPercent() { + double sum = 0; + for (double value : array()) { + sum += value; + } + DoubleList outgoing = new DoubleList(count); + for (int i = 0; i < count; i++) { + double percent = data[i] / sum; + outgoing.set(i, percent); + } + return outgoing; + } + + + public DoubleList getSubset(int start) { + return getSubset(start, count - start); + } + + + public DoubleList getSubset(int start, int num) { + double[] subset = new double[num]; + System.arraycopy(data, start, subset, 0, num); + return new DoubleList(subset); + } + + + public String join(String separator) { + if (count == 0) { + return ""; + } + StringBuilder sb = new StringBuilder(); + sb.append(data[0]); + for (int i = 1; i < count; i++) { + sb.append(separator); + sb.append(data[i]); + } + return sb.toString(); + } + + + public void print() { + for (int i = 0; i < count; i++) { + System.out.format("[%d] %f%n", i, data[i]); + } + } + + + /** + * Save tab-delimited entries to a file (TSV format, UTF-8 encoding) + */ + public void save(File file) { + PrintWriter writer = PApplet.createWriter(file); + write(writer); + writer.close(); + } + + + /** + * Write entries to a PrintWriter, one per line + */ + public void write(PrintWriter writer) { + for (int i = 0; i < count; i++) { + writer.println(data[i]); + } + writer.flush(); + } + + + /** + * Return this dictionary as a String in JSON format. + */ + public String toJSON() { + return "[ " + join(", ") + " ]"; + } + + + @Override + public String toString() { + return getClass().getSimpleName() + " size=" + size() + " " + toJSON(); + } +} diff --git a/core/src/processing/data/FloatDict.java b/core/src/processing/data/FloatDict.java index cb06c2b15c..9495563ad0 100644 --- a/core/src/processing/data/FloatDict.java +++ b/core/src/processing/data/FloatDict.java @@ -3,6 +3,7 @@ import java.io.*; import java.util.HashMap; import java.util.Iterator; +import java.util.NoSuchElementException; import processing.core.PApplet; @@ -23,7 +24,7 @@ public class FloatDict { protected float[] values; /** Internal implementation for faster lookups */ - private HashMap indices = new HashMap(); + private HashMap indices = new HashMap<>(); public FloatDict() { @@ -69,6 +70,22 @@ public FloatDict(BufferedReader reader) { } + /** + * @nowebref + */ + public FloatDict(String[] keys, float[] values) { + if (keys.length != values.length) { + throw new IllegalArgumentException("key and value arrays must be the same length"); + } + this.keys = keys; + this.values = values; + count = keys.length; + for (int i = 0; i < count; i++) { + indices.put(keys[i], i); + } + } + + /** * Constructor to allow (more intuitive) inline initialization, e.g.: *
@@ -90,21 +107,6 @@ public FloatDict(Object[][] pairs) {
   }
 
 
-  /**
-   * @nowebref
-   */
-  public FloatDict(String[] keys, float[] values) {
-    if (keys.length != values.length) {
-      throw new IllegalArgumentException("key and value arrays must be the same length");
-    }
-    this.keys = keys;
-    this.values = values;
-    count = keys.length;
-    for (int i = 0; i < count; i++) {
-      indices.put(keys[i], i);
-    }
-  }
-
   /**
    * @webref floatdict:method
    * @brief Returns the number of key/value pairs
@@ -114,6 +116,31 @@ public int size() {
   }
 
 
+  /**
+   * Resize the internal data, this can only be used to shrink the list.
+   * Helpful for situations like sorting and then grabbing the top 50 entries.
+   */
+  public void resize(int length) {
+    if (length == count) return;
+
+    if (length > count) {
+      throw new IllegalArgumentException("resize() can only be used to shrink the dictionary");
+    }
+    if (length < 1) {
+      throw new IllegalArgumentException("resize(" + length + ") is too small, use 1 or higher");
+    }
+
+    String[] newKeys = new String[length];
+    float[] newValues = new float[length];
+    PApplet.arrayCopy(keys, newKeys, length);
+    PApplet.arrayCopy(values, newValues, length);
+    keys = newKeys;
+    values = newValues;
+    count = length;
+    resetIndices();
+  }
+
+
   /**
    * Remove all entries.
    *
@@ -122,10 +149,67 @@ public int size() {
    */
   public void clear() {
     count = 0;
-    indices = new HashMap();
+    indices = new HashMap<>();
+  }
+
+
+  private void resetIndices() {
+    indices = new HashMap<>(count);
+    for (int i = 0; i < count; i++) {
+      indices.put(keys[i], i);
+    }
   }
 
 
+  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+
+  public class Entry {
+    public String key;
+    public float value;
+
+    Entry(String key, float value) {
+      this.key = key;
+      this.value = value;
+    }
+  }
+
+
+  public Iterable entries() {
+    return new Iterable() {
+
+      public Iterator iterator() {
+        return entryIterator();
+      }
+    };
+  }
+
+
+  public Iterator entryIterator() {
+    return new Iterator() {
+      int index = -1;
+
+      public void remove() {
+        removeIndex(index);
+        index--;
+      }
+
+      public Entry next() {
+        ++index;
+        Entry e = new Entry(keys[index], values[index]);
+        return e;
+      }
+
+      public boolean hasNext() {
+        return index+1 < size();
+      }
+    };
+  }
+
+
+  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+
   public String key(int index) {
     return keys[index];
   }
@@ -139,71 +223,36 @@ protected void crop() {
   }
 
 
-//  /**
-//   * Return the internal array being used to store the keys. Allocated but
-//   * unused entries will be removed. This array should not be modified.
-//   */
-//  public String[] keys() {
-//    crop();
-//    return keys;
-//  }
-
-  /**
-   * @webref floatdict:method
-   * @brief Return the internal array being used to store the keys
-   */
   public Iterable keys() {
     return new Iterable() {
 
       @Override
       public Iterator iterator() {
-        return new Iterator() {
-          int index = -1;
-
-          public void remove() {
-            removeIndex(index);
-          }
-
-          public String next() {
-            return key(++index);
-          }
-
-          public boolean hasNext() {
-            return index+1 < size();
-          }
-        };
+        return keyIterator();
       }
     };
   }
 
 
-  /*
-  static class KeyIterator implements Iterator {
-    FloatHash parent;
-    int index;
-
-    public KeyIterator(FloatHash parent) {
-      this.parent = parent;
-      index = -1;
-    }
-
-    public void remove() {
-      parent.removeIndex(index);
-    }
+  // Use this to iterate when you want to be able to remove elements along the way
+  public Iterator keyIterator() {
+    return new Iterator() {
+      int index = -1;
 
-    public String next() {
-      return parent.key(++index);
-    }
+      public void remove() {
+        removeIndex(index);
+        index--;
+      }
 
-    public boolean hasNext() {
-      return index+1 < parent.size();
-    }
+      public String next() {
+        return key(++index);
+      }
 
-    public void reset() {
-      index = -1;
-    }
+      public boolean hasNext() {
+        return index+1 < size();
+      }
+    };
   }
-  */
 
 
   /**
@@ -213,6 +262,7 @@ public void reset() {
    * @brief Return a copy of the internal keys array
    */
   public String[] keyArray() {
+    crop();
     return keyArray(null);
   }
 
@@ -231,11 +281,6 @@ public float value(int index) {
   }
 
 
-//  public float[] values() {
-//    crop();
-//    return values;
-//  }
-
   /**
    * @webref floatdict:method
    * @brief Return the internal array being used to store the values
@@ -245,21 +290,27 @@ public Iterable values() {
 
       @Override
       public Iterator iterator() {
-        return new Iterator() {
-          int index = -1;
+        return valueIterator();
+      }
+    };
+  }
 
-          public void remove() {
-            removeIndex(index);
-          }
 
-          public Float next() {
-            return value(++index);
-          }
+  public Iterator valueIterator() {
+    return new Iterator() {
+      int index = -1;
 
-          public boolean hasNext() {
-            return index+1 < size();
-          }
-        };
+      public void remove() {
+        removeIndex(index);
+        index--;
+      }
+
+      public Float next() {
+        return value(++index);
+      }
+
+      public boolean hasNext() {
+        return index+1 < size();
       }
     };
   }
@@ -272,6 +323,7 @@ public boolean hasNext() {
    * @brief Create a new array and copy each of the values into it
    */
   public float[] valueArray() {
+    crop();
     return valueArray(null);
   }
 
@@ -328,6 +380,15 @@ public void set(String key, float amount) {
   }
 
 
+  public void setIndex(int index, String key, float value) {
+    if (index < 0 || index >= count) {
+      throw new ArrayIndexOutOfBoundsException(index);
+    }
+    keys[index] = key;
+    values[index] = value;
+  }
+
+
   /**
    * @webref floatdict:method
    * @brief Check if a key is a part of the data structure
@@ -337,18 +398,6 @@ public boolean hasKey(String key) {
   }
 
 
-//  /** Increase the value of a specific key by 1. */
-//  public void inc(String key) {
-//    inc(key, 1);
-////    int index = index(key);
-////    if (index == -1) {
-////      create(key, 1);
-////    } else {
-////      values[index]++;
-////    }
-//  }
-
-
   /**
    * @webref floatdict:method
    * @brief Add to a value
@@ -363,12 +412,6 @@ public void add(String key, float amount) {
   }
 
 
-//  /** Decrease the value of a key by 1. */
-//  public void dec(String key) {
-//    inc(key, -1);
-//  }
-
-
   /**
    * @webref floatdict:method
    * @brief Subtract from a value
@@ -417,8 +460,10 @@ private void checkMinMax(String functionName) {
    * @brief Return the smallest value
    */
   public int minIndex() {
-    checkMinMax("minIndex");
-    // Will still return NaN if there is 1 or more entries, and they're all NaN
+    //checkMinMax("minIndex");
+    if (count == 0) return -1;
+
+    // Will still return NaN if there are 1 or more entries, and they're all NaN
     float m = Float.NaN;
     int mi = -1;
     for (int i = 0; i < count; i++) {
@@ -430,7 +475,7 @@ public int minIndex() {
         // calculate the rest
         for (int j = i+1; j < count; j++) {
           float d = values[j];
-          if (!Float.isNaN(d) && (d < m)) {
+          if ((d == d) && (d < m)) {
             m = values[j];
             mi = j;
           }
@@ -442,6 +487,7 @@ public int minIndex() {
   }
 
 
+  // return the key for the minimum value
   public String minKey() {
     checkMinMax("minKey");
     int index = minIndex();
@@ -452,6 +498,7 @@ public String minKey() {
   }
 
 
+  // return the minimum value, or throw an error if there are no values
   public float minValue() {
     checkMinMax("minValue");
     int index = minIndex();
@@ -468,7 +515,10 @@ public float minValue() {
    */
   // The index of the entry that has the max value. Reference above is incorrect.
   public int maxIndex() {
-    checkMinMax("maxIndex");
+    //checkMinMax("maxIndex");
+    if (count == 0) {
+      return -1;
+    }
     // Will still return NaN if there is 1 or more entries, and they're all NaN
     float m = Float.NaN;
     int mi = -1;
@@ -493,9 +543,9 @@ public int maxIndex() {
   }
 
 
-  /** The key for a max value, or null if everything is NaN (no max). */
+  /** The key for a max value; null if empty or everything is NaN (no max). */
   public String maxKey() {
-    checkMinMax("maxKey");
+    //checkMinMax("maxKey");
     int index = maxIndex();
     if (index == -1) {
       return null;
@@ -504,9 +554,9 @@ public String maxKey() {
   }
 
 
-  /** The max value. (Or NaN if they're all NaN.) */
+  /** The max value. (Or NaN if no entries or they're all NaN.) */
   public float maxValue() {
-    checkMinMax("maxValue");
+    //checkMinMax("maxValue");
     int index = maxIndex();
     if (index == -1) {
       return Float.NaN;
@@ -515,6 +565,27 @@ public float maxValue() {
   }
 
 
+  public float sum() {
+    double amount = sumDouble();
+    if (amount > Float.MAX_VALUE) {
+      throw new RuntimeException("sum() exceeds " + Float.MAX_VALUE + ", use sumDouble()");
+    }
+    if (amount < -Float.MAX_VALUE) {
+      throw new RuntimeException("sum() lower than " + -Float.MAX_VALUE + ", use sumDouble()");
+    }
+    return (float) amount;
+  }
+
+
+  public double sumDouble() {
+    double sum = 0;
+    for (int i = 0; i < count; i++) {
+      sum += values[i];
+    }
+    return sum;
+  }
+
+
   public int index(String what) {
     Integer found = indices.get(what);
     return (found == null) ? -1 : found.intValue();
@@ -537,21 +608,22 @@ protected void create(String what, float much) {
    * @webref floatdict:method
    * @brief Remove a key/value pair
    */
-  public int remove(String key) {
+  public float remove(String key) {
     int index = index(key);
-    if (index != -1) {
-      removeIndex(index);
+    if (index == -1) {
+      throw new NoSuchElementException("'" + key + "' not found");
     }
-    return index;
+    float value = values[index];
+    removeIndex(index);
+    return value;
   }
 
 
-  public String removeIndex(int index) {
+  public float removeIndex(int index) {
     if (index < 0 || index >= count) {
       throw new ArrayIndexOutOfBoundsException(index);
     }
-    String key = keys[index];
-    //System.out.println("index is " + which + " and " + keys[which]);
+    float value = values[index];
     indices.remove(keys[index]);
     for (int i = index; i < count-1; i++) {
       keys[i] = keys[i+1];
@@ -561,7 +633,7 @@ public String removeIndex(int index) {
     count--;
     keys[count] = null;
     values[count] = 0;
-    return key;
+    return value;
   }
 
 
@@ -573,24 +645,11 @@ public void swap(int a, int b) {
     keys[b] = tkey;
     values[b] = tvalue;
 
-    indices.put(keys[a], Integer.valueOf(a));
-    indices.put(keys[b], Integer.valueOf(b));
+//    indices.put(keys[a], Integer.valueOf(a));
+//    indices.put(keys[b], Integer.valueOf(b));
   }
 
 
-//  abstract class InternalSort extends Sort {
-//    @Override
-//    public int size() {
-//      return count;
-//    }
-//
-//    @Override
-//    public void swap(int a, int b) {
-//      FloatHash.this.swap(a, b);
-//    }
-//  }
-
-
   /**
    * Sort the keys alphabetically (ignoring case). Uses the value as a
    * tie-breaker (only really possible with a key that has a case change).
@@ -599,36 +658,16 @@ public void swap(int a, int b) {
    * @brief Sort the keys alphabetically
    */
   public void sortKeys() {
-    sortImpl(true, false);
-//    new InternalSort() {
-//      @Override
-//      public float compare(int a, int b) {
-//        int result = keys[a].compareToIgnoreCase(keys[b]);
-//        if (result != 0) {
-//          return result;
-//        }
-//        return values[b] - values[a];
-//      }
-//    }.run();
+    sortImpl(true, false, true);
   }
 
 
   /**
    * @webref floatdict:method
-   * @brief Sort the keys alphabetially in reverse
+   * @brief Sort the keys alphabetically in reverse
    */
   public void sortKeysReverse() {
-    sortImpl(true, true);
-//    new InternalSort() {
-//      @Override
-//      public float compare(int a, int b) {
-//        int result = keys[b].compareToIgnoreCase(keys[a]);
-//        if (result != 0) {
-//          return result;
-//        }
-//        return values[a] - values[b];
-//      }
-//    }.run();
+    sortImpl(true, true, true);
   }
 
 
@@ -639,13 +678,17 @@ public void sortKeysReverse() {
    * @brief Sort by values in ascending order
    */
   public void sortValues() {
-    sortImpl(false, false);
-//    new InternalSort() {
-//      @Override
-//      public float compare(int a, int b) {
-//
-//      }
-//    }.run();
+    sortValues(true);
+  }
+
+
+  /**
+   * Set true to ensure that the order returned is identical. Slightly
+   * slower because the tie-breaker for identical values compares the keys.
+   * @param stable
+   */
+  public void sortValues(boolean stable) {
+    sortImpl(false, false, stable);
   }
 
 
@@ -654,50 +697,17 @@ public void sortValues() {
    * @brief Sort by values in descending order
    */
   public void sortValuesReverse() {
-    sortImpl(false, true);
-//    new InternalSort() {
-//      @Override
-//      public float compare(int a, int b) {
-//        float diff = values[b] - values[a];
-//        if (diff == 0 && keys[a] != null && keys[b] != null) {
-//          diff = keys[a].compareToIgnoreCase(keys[b]);
-//        }
-//        return descending ? diff : -diff;
-//      }
-//    }.run();
-  }
-
-
-//  // ascending puts the largest value at the end
-//  // descending puts the largest value at 0
-//  public void sortValues(final boolean descending, final boolean tiebreaker) {
-//    Sort s = new Sort() {
-//      @Override
-//      public int size() {
-//        return count;
-//      }
-//
-//      @Override
-//      public float compare(int a, int b) {
-//        float diff = values[b] - values[a];
-//        if (tiebreaker) {
-//          if (diff == 0) {
-//            diff = keys[a].compareToIgnoreCase(keys[b]);
-//          }
-//        }
-//        return descending ? diff : -diff;
-//      }
-//
-//      @Override
-//      public void swap(int a, int b) {
-//        FloatHash.this.swap(a, b);
-//      }
-//    };
-//    s.run();
-//  }
-
-
-  protected void sortImpl(final boolean useKeys, final boolean reverse) {
+    sortValuesReverse(true);
+  }
+
+
+  public void sortValuesReverse(boolean stable) {
+    sortImpl(false, true, stable);
+  }
+
+
+  protected void sortImpl(final boolean useKeys, final boolean reverse,
+                          final boolean stable) {
     Sort s = new Sort() {
       @Override
       public int size() {
@@ -726,20 +736,26 @@ public int size() {
       }
 
       @Override
-      public float compare(int a, int b) {
+      public int compare(int a, int b) {
         float diff = 0;
         if (useKeys) {
           diff = keys[a].compareToIgnoreCase(keys[b]);
           if (diff == 0) {
-            return values[a] - values[b];
+            diff = values[a] - values[b];
           }
         } else {  // sort values
           diff = values[a] - values[b];
-          if (diff == 0) {
+          if (diff == 0 && stable) {
             diff = keys[a].compareToIgnoreCase(keys[b]);
           }
         }
-        return reverse ? -diff : diff;
+        if (diff == 0) {
+          return 0;
+        } else if (reverse) {
+          return diff < 0 ? 1 : -1;
+        } else {
+          return diff < 0 ? -1 : 1;
+        }
       }
 
       @Override
@@ -748,19 +764,19 @@ public void swap(int a, int b) {
       }
     };
     s.run();
+
+    // Set the indices after sort/swaps (performance fix 160411)
+    resetIndices();
   }
 
 
   /**
    * Sum all of the values in this dictionary, then return a new FloatDict of
    * each key, divided by the total sum. The total for all values will be ~1.0.
-   * @return a Dict with the original keys, mapped to their pct of the total
+   * @return a FloatDict with the original keys, mapped to their pct of the total
    */
   public FloatDict getPercent() {
-    double sum = 0;
-    for (float value : valueArray()) {
-      sum += value;
-    }
+    double sum = sum();
     FloatDict outgoing = new FloatDict();
     for (int i = 0; i < size(); i++) {
       double percent = value(i) / sum;
@@ -790,6 +806,16 @@ public void print() {
   }
 
 
+  /**
+   * Save tab-delimited entries to a file (TSV format, UTF-8 encoding)
+   */
+  public void save(File file) {
+    PrintWriter writer = PApplet.createWriter(file);
+    write(writer);
+    writer.close();
+  }
+
+
   /**
    * Write tab-delimited entries out to
    * @param writer
@@ -802,17 +828,20 @@ public void write(PrintWriter writer) {
   }
 
 
+  /**
+   * Return this dictionary as a String in JSON format.
+   */
+  public String toJSON() {
+    StringList items = new StringList();
+    for (int i = 0; i < count; i++) {
+      items.append(JSONObject.quote(keys[i])+ ": " + values[i]);
+    }
+    return "{ " + items.join(", ") + " }";
+  }
+
+
   @Override
   public String toString() {
-    StringBuilder sb = new StringBuilder();
-    sb.append(getClass().getSimpleName() + " size=" + size() + " { ");
-    for (int i = 0; i < size(); i++) {
-      if (i != 0) {
-        sb.append(", ");
-      }
-      sb.append("\"" + keys[i] + "\": " + values[i]);
-    }
-    sb.append(" }");
-    return sb.toString();
+    return getClass().getSimpleName() + " size=" + size() + " " + toJSON();
   }
 }
diff --git a/core/src/processing/data/FloatList.java b/core/src/processing/data/FloatList.java
index c2ff82367d..863b056587 100644
--- a/core/src/processing/data/FloatList.java
+++ b/core/src/processing/data/FloatList.java
@@ -1,5 +1,7 @@
 package processing.data;
 
+import java.io.File;
+import java.io.PrintWriter;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.Random;
@@ -627,11 +629,23 @@ public int maxIndex() {
 
 
   public float sum() {
-    double outgoing = 0;
+    double amount = sumDouble();
+    if (amount > Float.MAX_VALUE) {
+      throw new RuntimeException("sum() exceeds " + Float.MAX_VALUE + ", use sumDouble()");
+    }
+    if (amount < -Float.MAX_VALUE) {
+      throw new RuntimeException("sum() lower than " + -Float.MAX_VALUE + ", use sumDouble()");
+    }
+    return (float) amount;
+  }
+
+
+  public double sumDouble() {
+    double sum = 0;
     for (int i = 0; i < count; i++) {
-      outgoing += data[i];
+      sum += data[i];
     }
-    return (float) outgoing;
+    return sum;
   }
 
 
@@ -680,8 +694,9 @@ public int size() {
       }
 
       @Override
-      public float compare(int a, int b) {
-        return data[b] - data[a];
+      public int compare(int a, int b) {
+        float diff = data[b] - data[a];
+        return diff == 0 ? 0 : (diff < 0 ? -1 : 1);
       }
 
       @Override
@@ -793,6 +808,7 @@ public Iterator iterator() {
 
       public void remove() {
         FloatList.this.remove(index);
+        index--;
       }
 
       public Float next() {
@@ -878,23 +894,43 @@ public String join(String separator) {
 
 
   public void print() {
-    for (int i = 0; i < size(); i++) {
+    for (int i = 0; i < count; i++) {
       System.out.format("[%d] %f%n", i, data[i]);
     }
   }
 
 
+  /**
+   * Save tab-delimited entries to a file (TSV format, UTF-8 encoding)
+   */
+  public void save(File file) {
+    PrintWriter writer = PApplet.createWriter(file);
+    write(writer);
+    writer.close();
+  }
+
+
+  /**
+   * Write entries to a PrintWriter, one per line
+   */
+  public void write(PrintWriter writer) {
+    for (int i = 0; i < count; i++) {
+      writer.println(data[i]);
+    }
+    writer.flush();
+  }
+
+
+  /**
+   * Return this dictionary as a String in JSON format.
+   */
+  public String toJSON() {
+    return "[ " + join(", ") + " ]";
+  }
+
+
   @Override
   public String toString() {
-    StringBuilder sb = new StringBuilder();
-    sb.append(getClass().getSimpleName() + " size=" + size() + " [ ");
-    for (int i = 0; i < size(); i++) {
-      if (i != 0) {
-        sb.append(", ");
-      }
-      sb.append(i + ": " + data[i]);
-    }
-    sb.append(" ]");
-    return sb.toString();
+    return getClass().getSimpleName() + " size=" + size() + " " + toJSON();
   }
 }
diff --git a/core/src/processing/data/IntDict.java b/core/src/processing/data/IntDict.java
index ba0bbaca01..96913591fa 100644
--- a/core/src/processing/data/IntDict.java
+++ b/core/src/processing/data/IntDict.java
@@ -3,6 +3,7 @@
 import java.io.*;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.NoSuchElementException;
 
 import processing.core.PApplet;
 
@@ -23,7 +24,7 @@ public class IntDict {
   protected int[] values;
 
   /** Internal implementation for faster lookups */
-  private HashMap indices = new HashMap();
+  private HashMap indices = new HashMap<>();
 
 
   public IntDict() {
@@ -116,6 +117,29 @@ public int size() {
   }
 
 
+  /**
+   * Resize the internal data, this can only be used to shrink the list.
+   * Helpful for situations like sorting and then grabbing the top 50 entries.
+   */
+  public void resize(int length) {
+    if (length > count) {
+      throw new IllegalArgumentException("resize() can only be used to shrink the dictionary");
+    }
+    if (length < 1) {
+      throw new IllegalArgumentException("resize(" + length + ") is too small, use 1 or higher");
+    }
+
+    String[] newKeys = new String[length];
+    int[] newValues = new int[length];
+    PApplet.arrayCopy(keys, newKeys, length);
+    PApplet.arrayCopy(values, newValues, length);
+    keys = newKeys;
+    values = newValues;
+    count = length;
+    resetIndices();
+  }
+
+
   /**
    * Remove all entries.
    *
@@ -124,83 +148,86 @@ public int size() {
    */
   public void clear() {
     count = 0;
-    indices = new HashMap();
+    indices = new HashMap<>();
+  }
+
+
+  private void resetIndices() {
+    indices = new HashMap<>(count);
+    for (int i = 0; i < count; i++) {
+      indices.put(keys[i], i);
+    }
+  }
+
+
+  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+
+  public class Entry {
+    public String key;
+    public int value;
+
+    Entry(String key, int value) {
+      this.key = key;
+      this.value = value;
+    }
   }
 
 
+  public Iterable entries() {
+    return new Iterable() {
+
+      public Iterator iterator() {
+        return entryIterator();
+      }
+    };
+  }
+
+
+  public Iterator entryIterator() {
+    return new Iterator() {
+      int index = -1;
+
+      public void remove() {
+        removeIndex(index);
+        index--;
+      }
+
+      public Entry next() {
+        ++index;
+        Entry e = new Entry(keys[index], values[index]);
+        return e;
+      }
+
+      public boolean hasNext() {
+        return index+1 < size();
+      }
+    };
+  }
+
+
+  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+
   public String key(int index) {
     return keys[index];
   }
 
 
-//  private void crop() {
-//    if (count != keys.length) {
-//      keys = PApplet.subset(keys, 0, count);
-//      values = PApplet.subset(values, 0, count);
-//    }
-//  }
+  protected void crop() {
+    if (count != keys.length) {
+      keys = PApplet.subset(keys, 0, count);
+      values = PApplet.subset(values, 0, count);
+    }
+  }
 
 
-  /**
-   * Return the internal array being used to store the keys. Allocated but
-   * unused entries will be removed. This array should not be modified.
-   *
-   * @webref intdict:method
-   * @brief Return the internal array being used to store the keys
-   */
-//  public String[] keys() {
-//    crop();
-//    return keys;
-//  }
-
-
-//  public Iterable keys() {
-//    return new Iterable() {
-//
-//      @Override
-//      public Iterator iterator() {
-//        return new Iterator() {
-//          int index = -1;
-//
-//          public void remove() {
-//            removeIndex(index);
-//          }
-//
-//          public String next() {
-//            return key(++index);
-//          }
-//
-//          public boolean hasNext() {
-//            return index+1 < size();
-//          }
-//        };
-//      }
-//    };
-//  }
-
-
-  // Use this with 'for' loops
   public Iterable keys() {
     return new Iterable() {
 
       @Override
       public Iterator iterator() {
         return keyIterator();
-//        return new Iterator() {
-//          int index = -1;
-//
-//          public void remove() {
-//            removeIndex(index);
-//          }
-//
-//          public String next() {
-//            return key(++index);
-//          }
-//
-//          public boolean hasNext() {
-//            return index+1 < size();
-//          }
-//        };
       }
     };
   }
@@ -213,6 +240,7 @@ public Iterator keyIterator() {
 
       public void remove() {
         removeIndex(index);
+        index--;
       }
 
       public String next() {
@@ -233,6 +261,7 @@ public boolean hasNext() {
    * @brief Return a copy of the internal keys array
    */
   public String[] keyArray() {
+    crop();
     return keyArray(null);
   }
 
@@ -253,7 +282,7 @@ public int value(int index) {
 
   /**
    * @webref intdict:method
-   * @brief Return the internal array being used to store the keys
+   * @brief Return the internal array being used to store the values
    */
   public Iterable values() {
     return new Iterable() {
@@ -272,6 +301,7 @@ public Iterator valueIterator() {
 
       public void remove() {
         removeIndex(index);
+        index--;
       }
 
       public Integer next() {
@@ -292,6 +322,7 @@ public boolean hasNext() {
    * @brief Create a new array and copy each of the values into it
    */
   public int[] valueArray() {
+    crop();
     return valueArray(null);
   }
 
@@ -349,6 +380,16 @@ public void set(String key, int amount) {
     }
   }
 
+
+  public void setIndex(int index, String key, int value) {
+    if (index < 0 || index >= count) {
+      throw new ArrayIndexOutOfBoundsException(index);
+    }
+    keys[index] = key;
+    values[index] = value;
+  }
+
+
   /**
    * @webref intdict:method
    * @brief Check if a key is a part of the data structure
@@ -369,6 +410,18 @@ public void increment(String key) {
   }
 
 
+  /**
+   * Merge another dictionary into this one. Calling this increment()
+   * since it doesn't make sense in practice for the other dictionary types,
+   * even though it's technically an add().
+   */
+  public void increment(IntDict dict) {
+    for (int i = 0; i < dict.count; i++) {
+      add(dict.key(i), dict.value(i));
+    }
+  }
+
+
   /**
    * @webref intdict:method
    * @brief Add to a value
@@ -428,7 +481,9 @@ private void checkMinMax(String functionName) {
 
   // return the index of the minimum value
   public int minIndex() {
-    checkMinMax("minIndex");
+    //checkMinMax("minIndex");
+    if (count == 0) return -1;
+
     int index = 0;
     int value = values[0];
     for (int i = 1; i < count; i++) {
@@ -441,23 +496,30 @@ public int minIndex() {
   }
 
 
-  // return the minimum value
-  public int minValue() {
-    checkMinMax("minValue");
-    return values[minIndex()];
-  }
-
-
   // return the key for the minimum value
   public String minKey() {
     checkMinMax("minKey");
-    return keys[minIndex()];
+    int index = minIndex();
+    if (index == -1) {
+      return null;
+    }
+    return keys[index];
+  }
+
+
+  // return the minimum value, or throw an error if there are no values
+  public int minValue() {
+    checkMinMax("minValue");
+    return values[minIndex()];
   }
 
 
   // return the index of the max value
   public int maxIndex() {
-    checkMinMax("maxIndex");
+    //checkMinMax("maxIndex");
+    if (count == 0) {
+      return -1;
+    }
     int index = 0;
     int value = values[0];
     for (int i = 1; i < count; i++) {
@@ -470,17 +532,42 @@ public int maxIndex() {
   }
 
 
-  // return the maximum value
+  /** return the key corresponding to the maximum value or null if no entries */
+  public String maxKey() {
+    //checkMinMax("maxKey");
+    int index = maxIndex();
+    if (index == -1) {
+      return null;
+    }
+    return keys[index];
+  }
+
+
+  // return the maximum value or throw an error if zero length
   public int maxValue() {
-    checkMinMax("maxValue");
+    checkMinMax("maxIndex");
     return values[maxIndex()];
   }
 
 
-  // return the key corresponding to the maximum value
-  public String maxKey() {
-    checkMinMax("maxKey");
-    return keys[maxIndex()];
+  public int sum() {
+    long amount = sumLong();
+    if (amount > Integer.MAX_VALUE) {
+      throw new RuntimeException("sum() exceeds " + Integer.MAX_VALUE + ", use sumLong()");
+    }
+    if (amount < Integer.MIN_VALUE) {
+      throw new RuntimeException("sum() less than " + Integer.MIN_VALUE + ", use sumLong()");
+    }
+    return (int) amount;
+  }
+
+
+  public long sumLong() {
+    long sum = 0;
+    for (int i = 0; i < count; i++) {
+      sum += values[i];
+    }
+    return sum;
   }
 
 
@@ -507,19 +594,20 @@ protected void create(String what, int much) {
    */
   public int remove(String key) {
     int index = index(key);
-    if (index != -1) {
-      removeIndex(index);
+    if (index == -1) {
+      throw new NoSuchElementException("'" + key + "' not found");
     }
-    return index;
+    int value = values[index];
+    removeIndex(index);
+    return value;
   }
 
 
-  public String removeIndex(int index) {
+  public int removeIndex(int index) {
     if (index < 0 || index >= count) {
       throw new ArrayIndexOutOfBoundsException(index);
     }
-    //System.out.println("index is " + which + " and " + keys[which]);
-    String key = keys[index];
+    int value = values[index];
     indices.remove(keys[index]);
     for (int i = index; i < count-1; i++) {
       keys[i] = keys[i+1];
@@ -529,7 +617,7 @@ public String removeIndex(int index) {
     count--;
     keys[count] = null;
     values[count] = 0;
-    return key;
+    return value;
   }
 
 
@@ -541,8 +629,8 @@ public void swap(int a, int b) {
     keys[b] = tkey;
     values[b] = tvalue;
 
-    indices.put(keys[a], Integer.valueOf(a));
-    indices.put(keys[b], Integer.valueOf(b));
+//    indices.put(keys[a], Integer.valueOf(a));
+//    indices.put(keys[b], Integer.valueOf(b));
   }
 
 
@@ -554,7 +642,7 @@ public void swap(int a, int b) {
    * @brief Sort the keys alphabetically
    */
   public void sortKeys() {
-    sortImpl(true, false);
+    sortImpl(true, false, true);
   }
 
   /**
@@ -562,10 +650,10 @@ public void sortKeys() {
    * tie-breaker (only really possible with a key that has a case change).
    *
    * @webref intdict:method
-   * @brief Sort the keys alphabetially in reverse
+   * @brief Sort the keys alphabetically in reverse
    */
   public void sortKeysReverse() {
-    sortImpl(true, true);
+    sortImpl(true, true, true);
   }
 
 
@@ -576,9 +664,20 @@ public void sortKeysReverse() {
    * @brief Sort by values in ascending order
    */
   public void sortValues() {
-    sortImpl(false, false);
+    sortValues(true);
   }
 
+
+  /**
+   * Set true to ensure that the order returned is identical. Slightly
+   * slower because the tie-breaker for identical values compares the keys.
+   * @param stable
+   */
+  public void sortValues(boolean stable) {
+    sortImpl(false, false, stable);
+  }
+
+
   /**
    * Sort by values in descending order. The largest value will be at [0].
    *
@@ -586,11 +685,17 @@ public void sortValues() {
    * @brief Sort by values in descending order
    */
   public void sortValuesReverse() {
-    sortImpl(false, true);
+    sortValuesReverse(true);
+  }
+
+
+  public void sortValuesReverse(boolean stable) {
+    sortImpl(false, true, stable);
   }
 
 
-  protected void sortImpl(final boolean useKeys, final boolean reverse) {
+  protected void sortImpl(final boolean useKeys, final boolean reverse,
+                          final boolean stable) {
     Sort s = new Sort() {
       @Override
       public int size() {
@@ -598,16 +703,16 @@ public int size() {
       }
 
       @Override
-      public float compare(int a, int b) {
+      public int compare(int a, int b) {
         int diff = 0;
         if (useKeys) {
           diff = keys[a].compareToIgnoreCase(keys[b]);
           if (diff == 0) {
-            return values[a] - values[b];
+            diff = values[a] - values[b];
           }
         } else {  // sort values
           diff = values[a] - values[b];
-          if (diff == 0) {
+          if (diff == 0 && stable) {
             diff = keys[a].compareToIgnoreCase(keys[b]);
           }
         }
@@ -620,19 +725,19 @@ public void swap(int a, int b) {
       }
     };
     s.run();
+
+    // Set the indices after sort/swaps (performance fix 160411)
+    resetIndices();
   }
 
 
   /**
    * Sum all of the values in this dictionary, then return a new FloatDict of
    * each key, divided by the total sum. The total for all values will be ~1.0.
-   * @return a Dict with the original keys, mapped to their pct of the total
+   * @return an IntDict with the original keys, mapped to their pct of the total
    */
   public FloatDict getPercent() {
-    double sum = 0;
-    for (int value : valueArray()) {
-      sum += value;
-    }
+    double sum = sum();  // a little more accuracy
     FloatDict outgoing = new FloatDict();
     for (int i = 0; i < size(); i++) {
       double percent = value(i) / sum;
@@ -655,9 +760,25 @@ public IntDict copy() {
   }
 
 
+  public void print() {
+    for (int i = 0; i < size(); i++) {
+      System.out.println(keys[i] + " = " + values[i]);
+    }
+  }
+
+
+  /**
+   * Save tab-delimited entries to a file (TSV format, UTF-8 encoding)
+   */
+  public void save(File file) {
+    PrintWriter writer = PApplet.createWriter(file);
+    write(writer);
+    writer.close();
+  }
+
+
   /**
-   * Write tab-delimited entries out to
-   * @param writer
+   * Write tab-delimited entries to a PrintWriter
    */
   public void write(PrintWriter writer) {
     for (int i = 0; i < count; i++) {
@@ -667,24 +788,20 @@ public void write(PrintWriter writer) {
   }
 
 
-  public void print() {
-    for (int i = 0; i < size(); i++) {
-      System.out.println(keys[i] + " = " + values[i]);
+  /**
+   * Return this dictionary as a String in JSON format.
+   */
+  public String toJSON() {
+    StringList items = new StringList();
+    for (int i = 0; i < count; i++) {
+      items.append(JSONObject.quote(keys[i])+ ": " + values[i]);
     }
+    return "{ " + items.join(", ") + " }";
   }
 
 
   @Override
   public String toString() {
-    StringBuilder sb = new StringBuilder();
-    sb.append(getClass().getSimpleName() + " size=" + size() + " { ");
-    for (int i = 0; i < size(); i++) {
-      if (i != 0) {
-        sb.append(", ");
-      }
-      sb.append("\"" + keys[i] + "\": " + values[i]);
-    }
-    sb.append(" }");
-    return sb.toString();
+    return getClass().getSimpleName() + " size=" + size() + " " + toJSON();
   }
 }
diff --git a/core/src/processing/data/IntList.java b/core/src/processing/data/IntList.java
index cb5dc560b2..dc2c899166 100644
--- a/core/src/processing/data/IntList.java
+++ b/core/src/processing/data/IntList.java
@@ -1,5 +1,7 @@
 package processing.data;
 
+import java.io.File;
+import java.io.PrintWriter;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.Random;
@@ -596,11 +598,23 @@ public int maxIndex() {
 
 
   public int sum() {
-    int outgoing = 0;
+    long amount = sumLong();
+    if (amount > Integer.MAX_VALUE) {
+      throw new RuntimeException("sum() exceeds " + Integer.MAX_VALUE + ", use sumLong()");
+    }
+    if (amount < Integer.MIN_VALUE) {
+      throw new RuntimeException("sum() less than " + Integer.MIN_VALUE + ", use sumLong()");
+    }
+    return (int) amount;
+  }
+
+
+  public long sumLong() {
+    long sum = 0;
     for (int i = 0; i < count; i++) {
-      outgoing += data[i];
+      sum += data[i];
     }
-    return outgoing;
+    return sum;
   }
 
 
@@ -629,7 +643,7 @@ public int size() {
       }
 
       @Override
-      public float compare(int a, int b) {
+      public int compare(int a, int b) {
         return data[b] - data[a];
       }
 
@@ -737,6 +751,7 @@ public Iterator iterator() {
 
       public void remove() {
         IntList.this.remove(index);
+        index--;
       }
 
       public Integer next() {
@@ -839,6 +854,19 @@ public FloatList getPercent() {
   }
 
 
+//  /**
+//   * Count the number of times each entry is found in this list.
+//   * Converts each entry to a String so it can be used as a key.
+//   */
+//  public IntDict getTally() {
+//    IntDict outgoing = new IntDict();
+//    for (int i = 0; i < count; i++) {
+//      outgoing.increment(String.valueOf(data[i]));
+//    }
+//    return outgoing;
+//  }
+
+
   public IntList getSubset(int start) {
     return getSubset(start, count - start);
   }
@@ -866,23 +894,43 @@ public String join(String separator) {
 
 
   public void print() {
-    for (int i = 0; i < size(); i++) {
+    for (int i = 0; i < count; i++) {
       System.out.format("[%d] %d%n", i, data[i]);
     }
   }
 
 
+  /**
+   * Save tab-delimited entries to a file (TSV format, UTF-8 encoding)
+   */
+  public void save(File file) {
+    PrintWriter writer = PApplet.createWriter(file);
+    write(writer);
+    writer.close();
+  }
+
+
+  /**
+   * Write entries to a PrintWriter, one per line
+   */
+  public void write(PrintWriter writer) {
+    for (int i = 0; i < count; i++) {
+      writer.println(data[i]);
+    }
+    writer.flush();
+  }
+
+
+  /**
+   * Return this dictionary as a String in JSON format.
+   */
+  public String toJSON() {
+    return "[ " + join(", ") + " ]";
+  }
+
+
   @Override
   public String toString() {
-    StringBuilder sb = new StringBuilder();
-    sb.append(getClass().getSimpleName() + " size=" + size() + " [ ");
-    for (int i = 0; i < size(); i++) {
-      if (i != 0) {
-        sb.append(", ");
-      }
-      sb.append(i + ": " + data[i]);
-    }
-    sb.append(" ]");
-    return sb.toString();
+    return getClass().getSimpleName() + " size=" + size() + " " + toJSON();
   }
 }
diff --git a/core/src/processing/data/JSONArray.java b/core/src/processing/data/JSONArray.java
index d1d0b50d64..ea8276bd8b 100644
--- a/core/src/processing/data/JSONArray.java
+++ b/core/src/processing/data/JSONArray.java
@@ -109,7 +109,7 @@ public class JSONArray {
    * Construct an empty JSONArray.
    */
   public JSONArray() {
-    this.myArrayList = new ArrayList();
+    this.myArrayList = new ArrayList<>();
   }
 
 
@@ -125,7 +125,7 @@ public JSONArray(Reader reader) {
    * Construct a JSONArray from a JSONTokener.
    *
    * @param x A JSONTokener
-   * @throws JSONException If there is a syntax error.
+   * @throws RuntimeException If there is a syntax error.
    * @nowebref
    */
   protected JSONArray(JSONTokener x) {
@@ -165,7 +165,7 @@ protected JSONArray(JSONTokener x) {
    * @nowebref
    */
   public JSONArray(IntList list) {
-    myArrayList = new ArrayList();
+    myArrayList = new ArrayList<>();
     for (int item : list.values()) {
       myArrayList.add(Integer.valueOf(item));
     }
@@ -176,9 +176,9 @@ public JSONArray(IntList list) {
    * @nowebref
    */
   public JSONArray(FloatList list) {
-    myArrayList = new ArrayList();
+    myArrayList = new ArrayList<>();
     for (float item : list.values()) {
-      myArrayList.add(new Float(item));
+      myArrayList.add(Float.valueOf(item));
     }
   }
 
@@ -187,7 +187,7 @@ public JSONArray(FloatList list) {
    * @nowebref
    */
   public JSONArray(StringList list) {
-    myArrayList = new ArrayList();
+    myArrayList = new ArrayList<>();
     for (String item : list.values()) {
       myArrayList.add(item);
     }
@@ -199,7 +199,7 @@ public JSONArray(StringList list) {
    * @param source     A string that begins with
    * [ (left bracket)
    *  and ends with ] (right bracket).
-   *  @throws JSONException If there is a syntax error.
+   *  @return {@code null} if there is a syntax error.
    */
   static public JSONArray parse(String source) {
     try {
@@ -228,7 +228,7 @@ static public JSONArray parse(String source) {
   // TODO not decided whether we keep this one, but used heavily by JSONObject
   /**
    * Construct a JSONArray from an array
-   * @throws JSONException If not an array.
+   * @throws RuntimeException If not an array.
    */
   protected JSONArray(Object array) {
     this();
@@ -261,9 +261,9 @@ private Object opt(int index) {
    * Get the object value associated with an index.
    * @param index must be between 0 and length() - 1
    * @return An object value.
-   * @throws JSONException If there is no value for the index.
+   * @throws RuntimeException If there is no value for the index.
    */
-  private Object get(int index) {
+  public Object get(int index) {
     Object object = opt(index);
     if (object == null) {
       throw new RuntimeException("JSONArray[" + index + "] not found.");
@@ -279,7 +279,7 @@ private Object get(int index) {
    * @brief Gets the String value associated with an index
    * @param index must be between 0 and length() - 1
    * @return      A string value.
-   * @throws JSONException If there is no string value for the index.
+   * @throws RuntimeException If there is no string value for the index.
    * @see JSONArray#getInt(int)
    * @see JSONArray#getFloat(int)
    * @see JSONArray#getBoolean(int)
@@ -314,7 +314,7 @@ public String getString(int index, String defaultValue) {
    * @brief Gets the int value associated with an index
    * @param index must be between 0 and length() - 1
    * @return The value.
-   * @throws JSONException If the key is not found or if the value is not a number.
+   * @throws RuntimeException If the key is not found or if the value is not a number.
    * @see JSONArray#getFloat(int)
    * @see JSONArray#getString(int)
    * @see JSONArray#getBoolean(int)
@@ -353,7 +353,7 @@ public int getInt(int index, int defaultValue) {
    *
    * @param index The index must be between 0 and length() - 1
    * @return      The value.
-   * @throws   JSONException If the key is not found or if the value cannot
+   * @throws   RuntimeException If the key is not found or if the value cannot
    *  be converted to a number.
    */
   public long getLong(int index) {
@@ -415,7 +415,7 @@ public float getFloat(int index, float defaultValue) {
    *
    * @param index must be between 0 and length() - 1
    * @return      The value.
-   * @throws   JSONException If the key is not found or if the value cannot
+   * @throws   RuntimeException If the key is not found or if the value cannot
    *  be converted to a number.
    */
   public double getDouble(int index) {
@@ -456,7 +456,7 @@ public double getDouble(int index, double defaultValue) {
    * @brief Gets the boolean value associated with an index
    * @param index must be between 0 and length() - 1
    * @return      The truth.
-   * @throws JSONException If there is no value for the index or if the
+   * @throws RuntimeException If there is no value for the index or if the
    *  value is not convertible to boolean.
    * @see JSONArray#getInt(int)
    * @see JSONArray#getFloat(int)
@@ -502,7 +502,7 @@ public boolean getBoolean(int index, boolean defaultValue)  {
    * @brief Gets the JSONArray associated with an index value
    * @param index must be between 0 and length() - 1
    * @return A JSONArray value.
-   * @throws JSONException If there is no value for the index. or if the
+   * @throws RuntimeException If there is no value for the index. or if the
    * value is not a JSONArray
    * @see JSONArray#getJSONObject(int)
    * @see JSONArray#setJSONObject(int, JSONObject)
@@ -533,7 +533,7 @@ public JSONArray getJSONArray(int index, JSONArray defaultValue) {
    * @brief Gets the JSONObject associated with an index value
    * @param index the index value of the object to get
    * @return A JSONObject value.
-   * @throws JSONException If there is no value for the index or if the
+   * @throws RuntimeException If there is no value for the index or if the
    * value is not a JSONObject
    * @see JSONArray#getJSONArray(int)
    * @see JSONArray#setJSONObject(int, JSONObject)
@@ -740,7 +740,7 @@ public JSONArray append(long value) {
    * This will store the value as a double, since there are no floats in JSON.
    *
    * @param value a float value
-   * @throws JSONException if the value is not finite.
+   * @throws RuntimeException if the value is not finite.
    * @return this.
    */
   public JSONArray append(float value) {
@@ -753,7 +753,7 @@ public JSONArray append(float value) {
    *
    * @nowebref
    * @param value A double value.
-   * @throws JSONException if the value is not finite.
+   * @throws RuntimeException if the value is not finite.
    * @return this.
    */
   public JSONArray append(double value) {
@@ -837,7 +837,7 @@ protected JSONArray append(Object value) {
 //   * @param index The subscript.
 //   * @param value A Collection value.
 //   * @return      this.
-//   * @throws JSONException If the index is negative or if the value is
+//   * @throws RuntimeException If the index is negative or if the value is
 //   * not finite.
 //   */
 //  public JSONArray set(int index, Collection value) {
@@ -856,7 +856,7 @@ protected JSONArray append(Object value) {
    * @param index an index value
    * @param value the value to assign
    * @return this.
-   * @throws JSONException If the index is negative.
+   * @throws RuntimeException If the index is negative.
    * @see JSONArray#setInt(int, int)
    * @see JSONArray#setFloat(int, float)
    * @see JSONArray#setBoolean(int, boolean)
@@ -877,7 +877,7 @@ public JSONArray setString(int index, String value) {
    * @param index an index value
    * @param value the value to assign
    * @return this.
-   * @throws JSONException If the index is negative.
+   * @throws RuntimeException If the index is negative.
    * @see JSONArray#setFloat(int, float)
    * @see JSONArray#setString(int, String)
    * @see JSONArray#setBoolean(int, boolean)
@@ -895,7 +895,7 @@ public JSONArray setInt(int index, int value) {
    * @param index The subscript.
    * @param value A long value.
    * @return this.
-   * @throws JSONException If the index is negative.
+   * @throws RuntimeException If the index is negative.
    */
   public JSONArray setLong(int index, long value) {
     return set(index, Long.valueOf(value));
@@ -931,7 +931,7 @@ public JSONArray setFloat(int index, float value) {
    * @param index The subscript.
    * @param value A double value.
    * @return this.
-   * @throws JSONException If the index is negative or if the value is
+   * @throws RuntimeException If the index is negative or if the value is
    * not finite.
    */
   public JSONArray setDouble(int index, double value) {
@@ -949,7 +949,7 @@ public JSONArray setDouble(int index, double value) {
    * @param index an index value
    * @param value the value to assign
    * @return this.
-   * @throws JSONException If the index is negative.
+   * @throws RuntimeException If the index is negative.
    * @see JSONArray#setInt(int, int)
    * @see JSONArray#setFloat(int, float)
    * @see JSONArray#setString(int, String)
@@ -965,7 +965,7 @@ public JSONArray setBoolean(int index, boolean value) {
 //   * @param index The subscript.
 //   * @param value The Map value.
 //   * @return      this.
-//   * @throws JSONException If the index is negative or if the the value is
+//   * @throws RuntimeException If the index is negative or if the the value is
 //   *  an invalid number.
 //   */
 //  public JSONArray set(int index, Map value) {
@@ -1011,7 +1011,7 @@ public JSONArray setJSONObject(int index, JSONObject value) {
    *  Boolean, Double, Integer, JSONArray, JSONObject, Long, or String, or the
    *  JSONObject.NULL object.
    * @return this.
-   * @throws JSONException If the index is negative or if the the value is
+   * @throws RuntimeException If the index is negative or if the the value is
    *  an invalid number.
    */
   private JSONArray set(int index, Object value) {
@@ -1047,6 +1047,7 @@ public int size() {
 
   /**
    * Determine if the value is null.
+   * @webref
    * @param index must be between 0 and length() - 1
    * @return true if the value at the index is null, or if there is no value.
    */
@@ -1099,7 +1100,10 @@ public Object remove(int index) {
 
 
   public boolean save(File file, String options) {
-    return write(PApplet.createWriter(file), options);
+    PrintWriter writer = PApplet.createWriter(file);
+    boolean success = write(writer, options);
+    writer.close();
+    return success;
   }
 
 
@@ -1188,7 +1192,7 @@ public String format(int indentFactor) {
    * @param indent
    *            The indention of the top level.
    * @return The writer.
-   * @throws JSONException
+   * @throws RuntimeException
    */
   protected Writer writeInternal(Writer writer, int indentFactor, int indent) {
     try {
@@ -1239,7 +1243,7 @@ protected Writer writeInternal(Writer writer, int indentFactor, int indent) {
    * Warning: This method assumes that the data structure is acyclic.
    * @param separator A string that will be inserted between the elements.
    * @return a string.
-   * @throws JSONException If the array contains an invalid number.
+   * @throws RuntimeException If the array contains an invalid number.
    */
   public String join(String separator) {
     int len = this.size();
diff --git a/core/src/processing/data/JSONObject.java b/core/src/processing/data/JSONObject.java
index 8f1c8c3d44..cc7a22de08 100644
--- a/core/src/processing/data/JSONObject.java
+++ b/core/src/processing/data/JSONObject.java
@@ -95,7 +95,7 @@ of this software and associated documentation files (the "Software"), to deal
  * { } [ ] / \ : , = ; # and if they do not look like numbers and
  * if they are not the reserved words true, false, or
  * null.
- * 
  • Keys can be followed by = or => as well as by + *
  • Keys can be followed by = or {@code =>} as well as by * :.
  • *
  • Values can be followed by ; (semicolon) as * well as by , (comma).
  • @@ -123,7 +123,7 @@ public class JSONObject { * string objects. This is used by JSONObject.put(string, object). */ private static HashMap keyPool = - new HashMap(keyPoolSize); + new HashMap<>(keyPoolSize); // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @@ -197,7 +197,7 @@ public int hashCode() { * @nowebref */ public JSONObject() { - this.map = new HashMap(); + this.map = new HashMap<>(); } @@ -207,8 +207,6 @@ public JSONObject() { // * Missing keys are ignored. // * @param jo A JSONObject. // * @param names An array of strings. -// * @throws JSONException -// * @exception JSONException If a value is a non-finite number or if a name is duplicated. // */ // public JSONObject(JSONObject jo, String[] names) { // this(); @@ -232,7 +230,7 @@ public JSONObject(Reader reader) { /** * Construct a JSONObject from a JSONTokener. * @param x A JSONTokener object containing the source string. - * @throws JSONException If there is a syntax error in the source string + * @throws RuntimeException If there is a syntax error in the source string * or a duplicated key. */ protected JSONObject(JSONTokener x) { @@ -291,10 +289,9 @@ protected JSONObject(JSONTokener x) { * * @param map A map object that can be used to initialize the contents of * the JSONObject. - * @throws JSONException */ protected JSONObject(HashMap map) { - this.map = new HashMap(); + this.map = new HashMap<>(); if (map != null) { Iterator i = map.entrySet().iterator(); while (i.hasNext()) { @@ -312,7 +309,7 @@ protected JSONObject(HashMap map) { * @nowebref */ public JSONObject(IntDict dict) { - map = new HashMap(); + map = new HashMap<>(); for (int i = 0; i < dict.size(); i++) { setInt(dict.key(i), dict.value(i)); } @@ -323,7 +320,7 @@ public JSONObject(IntDict dict) { * @nowebref */ public JSONObject(FloatDict dict) { - map = new HashMap(); + map = new HashMap<>(); for (int i = 0; i < dict.size(); i++) { setFloat(dict.key(i), dict.value(i)); } @@ -334,7 +331,7 @@ public JSONObject(FloatDict dict) { * @nowebref */ public JSONObject(StringDict dict) { - map = new HashMap(); + map = new HashMap<>(); for (int i = 0; i < dict.size(); i++) { setString(dict.key(i), dict.value(i)); } @@ -397,7 +394,7 @@ protected JSONObject(Object bean) { * @param source A string beginning * with { (left brace) and ending * with } (right brace). - * @exception JSONException If there is a syntax error in the source + * @exception RuntimeException If there is a syntax error in the source * string or a duplicated key. */ static public JSONObject parse(String source) { @@ -538,15 +535,19 @@ static protected String doubleToString(double d) { * * @param key A key string. * @return The object associated with the key. - * @throws JSONException if the key is not found. + * @throws RuntimeException if the key is not found. */ - private Object get(String key) { + public Object get(String key) { if (key == null) { - throw new RuntimeException("Null key."); + throw new RuntimeException("JSONObject.get(null) called"); } Object object = this.opt(key); if (object == null) { - throw new RuntimeException("JSONObject[" + quote(key) + "] not found."); + // Adding for rev 0257 in line with other p5 api + return null; + } + if (object == null) { + throw new RuntimeException("JSONObject[" + quote(key) + "] not found"); } return object; } @@ -559,17 +560,21 @@ private Object get(String key) { * @brief Gets the string value associated with a key * @param key a key string * @return A string which is the value. - * @throws JSONException if there is no string value for the key. + * @throws RuntimeException if there is no string value for the key. * @see JSONObject#getInt(String) * @see JSONObject#getFloat(String) * @see JSONObject#getBoolean(String) */ public String getString(String key) { Object object = this.get(key); + if (object == null) { + // Adding for rev 0257 in line with other p5 api + return null; + } if (object instanceof String) { return (String)object; } - throw new RuntimeException("JSONObject[" + quote(key) + "] not a string."); + throw new RuntimeException("JSONObject[" + quote(key) + "] is not a string"); } @@ -592,9 +597,9 @@ public String getString(String key, String defaultValue) { * * @webref jsonobject:method * @brief Gets the int value associated with a key - * @param key a key string + * @param key A key string. * @return The integer value. - * @throws JSONException if the key is not found or if the value cannot + * @throws RuntimeException if the key is not found or if the value cannot * be converted to an integer. * @see JSONObject#getFloat(String) * @see JSONObject#getString(String) @@ -602,10 +607,12 @@ public String getString(String key, String defaultValue) { */ public int getInt(String key) { Object object = this.get(key); + if (object == null) { + throw new RuntimeException("JSONObject[" + quote(key) + "] not found"); + } try { - return object instanceof Number - ? ((Number)object).intValue() - : Integer.parseInt((String)object); + return object instanceof Number ? + ((Number)object).intValue() : Integer.parseInt((String)object); } catch (Exception e) { throw new RuntimeException("JSONObject[" + quote(key) + "] is not an int."); } @@ -636,7 +643,7 @@ public int getInt(String key, int defaultValue) { * * @param key A key string. * @return The long value. - * @throws JSONException if the key is not found or if the value cannot + * @throws RuntimeException if the key is not found or if the value cannot * be converted to a long. */ public long getLong(String key) { @@ -696,7 +703,7 @@ public float getFloat(String key, float defaultValue) { * Get the double value associated with a key. * @param key A key string. * @return The numeric value. - * @throws JSONException if the key is not found or + * @throws RuntimeException if the key is not found or * if the value is not a Number object and cannot be converted to a number. */ public double getDouble(String key) { @@ -737,7 +744,7 @@ public double getDouble(String key, double defaultValue) { * @brief Gets the boolean value associated with a key * @param key a key string * @return The truth. - * @throws JSONException if the value is not a Boolean or the String "true" or "false". + * @throws RuntimeException if the value is not a Boolean or the String "true" or "false". * @see JSONObject#getInt(String) * @see JSONObject#getFloat(String) * @see JSONObject#getString(String) @@ -781,14 +788,17 @@ public boolean getBoolean(String key, boolean defaultValue) { * @webref jsonobject:method * @brief Gets the JSONArray value associated with a key * @param key a key string - * @return A JSONArray which is the value. - * @throws JSONException if the key is not found or if the value is not a JSONArray. + * @return A JSONArray which is the value, or null if not present + * @throws RuntimeException if the value is not a JSONArray. * @see JSONObject#getJSONObject(String) * @see JSONObject#setJSONObject(String, JSONObject) * @see JSONObject#setJSONArray(String, JSONArray) */ public JSONArray getJSONArray(String key) { Object object = this.get(key); + if (object == null) { + return null; + } if (object instanceof JSONArray) { return (JSONArray)object; } @@ -802,14 +812,17 @@ public JSONArray getJSONArray(String key) { * @webref jsonobject:method * @brief Gets the JSONObject value associated with a key * @param key a key string - * @return A JSONObject which is the value. - * @throws JSONException if the key is not found or if the value is not a JSONObject. + * @return A JSONObject which is the value or null if not available. + * @throws RuntimeException if the value is not a JSONObject. * @see JSONObject#getJSONArray(String) * @see JSONObject#setJSONObject(String, JSONObject) * @see JSONObject#setJSONArray(String, JSONArray) */ public JSONObject getJSONObject(String key) { Object object = this.get(key); + if (object == null) { + return null; + } if (object instanceof JSONObject) { return (JSONObject)object; } @@ -867,7 +880,7 @@ public JSONObject getJSONObject(String key) { * @return true if the key exists in the JSONObject. */ public boolean hasKey(String key) { - return this.map.containsKey(key); + return map.containsKey(key); } @@ -901,7 +914,9 @@ public boolean hasKey(String key) { /** * Determine if the value associated with the key is null or if there is - * no value. + * no value. + * + * @webref * @param key A key string. * @return true if there is no value associated with the key or if * the value is the JSONObject.NULL object. @@ -962,7 +977,7 @@ public int size() { * Produce a string from a Number. * @param number A Number * @return A String. - * @throws JSONException If n is a non-finite number. + * @throws RuntimeException If number is null or a non-finite number. */ private static String numberToString(Number number) { if (number == null) { @@ -1162,7 +1177,7 @@ public JSONObject setString(String key, String value) { * @param key a key string * @param value the value to assign * @return this. - * @throws JSONException If the key is null. + * @throws RuntimeException If the key is null. * @see JSONObject#setFloat(String, float) * @see JSONObject#setString(String, String) * @see JSONObject#setBoolean(String, boolean) @@ -1179,7 +1194,7 @@ public JSONObject setInt(String key, int value) { * @param key A key string. * @param value A long which is the value. * @return this. - * @throws JSONException If the key is null. + * @throws RuntimeException If the key is null. */ public JSONObject setLong(String key, long value) { this.put(key, Long.valueOf(value)); @@ -1191,12 +1206,13 @@ public JSONObject setLong(String key, long value) { * @brief Put a key/float pair in the JSONObject * @param key a key string * @param value the value to assign + * @throws RuntimeException If the key is null or if the number is NaN or infinite. * @see JSONObject#setInt(String, int) * @see JSONObject#setString(String, String) * @see JSONObject#setBoolean(String, boolean) */ public JSONObject setFloat(String key, float value) { - this.put(key, new Double(value)); + this.put(key, Double.valueOf(value)); return this; } @@ -1207,10 +1223,10 @@ public JSONObject setFloat(String key, float value) { * @param key A key string. * @param value A double which is the value. * @return this. - * @throws JSONException If the key is null or if the number is invalid. + * @throws RuntimeException If the key is null or if the number is NaN or infinite. */ public JSONObject setDouble(String key, double value) { - this.put(key, new Double(value)); + this.put(key, Double.valueOf(value)); return this; } @@ -1223,7 +1239,7 @@ public JSONObject setDouble(String key, double value) { * @param key a key string * @param value the value to assign * @return this. - * @throws JSONException If the key is null. + * @throws RuntimeException If the key is null. * @see JSONObject#setInt(String, int) * @see JSONObject#setFloat(String, float) * @see JSONObject#setString(String, String) @@ -1297,10 +1313,10 @@ public JSONObject setJSONArray(String key, JSONArray value) { * types: Boolean, Double, Integer, JSONArray, JSONObject, Long, String, * or the JSONObject.NULL object. * @return this. - * @throws JSONException If the value is non-finite number + * @throws RuntimeException If the value is non-finite number * or if the key is null. */ - private JSONObject put(String key, Object value) { + public JSONObject put(String key, Object value) { String pooled; if (key == null) { throw new RuntimeException("Null key."); @@ -1310,7 +1326,7 @@ private JSONObject put(String key, Object value) { pooled = (String)keyPool.get(key); if (pooled == null) { if (keyPool.size() >= keyPoolSize) { - keyPool = new HashMap(keyPoolSize); + keyPool = new HashMap<>(keyPoolSize); } keyPool.put(key, key); } else { @@ -1330,8 +1346,9 @@ private JSONObject put(String key, Object value) { * with that name. * @param key * @param value - * @return his. - * @throws JSONException if the key is a duplicate + * @return {@code this}. + * @throws RuntimeException if the key is a duplicate, or if + * {@link #put(String,Object)} throws. */ private JSONObject putOnce(String key, Object value) { if (key != null && value != null) { @@ -1370,7 +1387,7 @@ private JSONObject putOnce(String key, Object value) { * @param string A String * @return A String correctly formatted for insertion in a JSON text. */ - static protected String quote(String string) { + static public String quote(String string) { StringWriter sw = new StringWriter(); synchronized (sw.getBuffer()) { try { @@ -1382,7 +1399,7 @@ static protected String quote(String string) { } } - static protected Writer quote(String string, Writer w) throws IOException { + static public Writer quote(String string, Writer w) throws IOException { if (string == null || string.length() == 0) { w.write("\"\""); return w; @@ -1508,8 +1525,9 @@ static protected Object stringToValue(String string) { /** * Throw an exception if the object is a NaN or infinite number. - * @param o The object to test. - * @throws JSONException If o is a non-finite number. + * @param o The object to test. If not Float or Double, accepted without + * exceptions. + * @throws RuntimeException If o is infinite or NaN. */ static protected void testValidity(Object o) { if (o != null) { @@ -1554,7 +1572,10 @@ static protected void testValidity(Object o) { public boolean save(File file, String options) { - return write(PApplet.createWriter(file), options); + PrintWriter writer = PApplet.createWriter(file); + boolean success = write(writer, options); + writer.close(); + return success; } @@ -1611,7 +1632,7 @@ public String toString() { * representation of the object, beginning * with { (left brace) and ending * with } (right brace). - * @throws JSONException If the object contains an invalid number. + * @throws RuntimeException If the object contains an invalid number. */ public String format(int indentFactor) { StringWriter w = new StringWriter(); @@ -1639,7 +1660,7 @@ public String format(int indentFactor) { * representation of the object, beginning * with { (left brace) and ending * with } (right brace). - * @throws JSONException If the value is or contains an invalid number. + * @throws RuntimeException If the value is or contains an invalid number. */ static protected String valueToString(Object value) { if (value == null || value.equals(null)) { @@ -1792,7 +1813,7 @@ static final void indent(Writer writer, int indent) throws IOException { * Warning: This method assumes that the data structure is acyclical. * * @return The writer. - * @throws JSONException + * @throws RuntimeException */ protected Writer writeInternal(Writer writer, int indentFactor, int indent) { try { diff --git a/core/src/processing/data/LongDict.java b/core/src/processing/data/LongDict.java new file mode 100644 index 0000000000..c9bf408216 --- /dev/null +++ b/core/src/processing/data/LongDict.java @@ -0,0 +1,802 @@ +package processing.data; + +import java.io.*; +import java.util.HashMap; +import java.util.Iterator; +import java.util.NoSuchElementException; + +import processing.core.PApplet; + + +/** + * A simple class to use a String as a lookup for an int value. + * + * @nowebref + * @see FloatDict + * @see StringDict + */ +public class LongDict { + + /** Number of elements in the table */ + protected int count; + + protected String[] keys; + protected long[] values; + + /** Internal implementation for faster lookups */ + private HashMap indices = new HashMap<>(); + + + public LongDict() { + count = 0; + keys = new String[10]; + values = new long[10]; + } + + + /** + * Create a new lookup with a specific size. This is more efficient than not + * specifying a size. Use it when you know the rough size of the thing you're creating. + * + * @nowebref + */ + public LongDict(int length) { + count = 0; + keys = new String[length]; + values = new long[length]; + } + + + /** + * Read a set of entries from a Reader that has each key/value pair on + * a single line, separated by a tab. + * + * @nowebref + */ + public LongDict(BufferedReader reader) { + String[] lines = PApplet.loadStrings(reader); + keys = new String[lines.length]; + values = new long[lines.length]; + + for (int i = 0; i < lines.length; i++) { + String[] pieces = PApplet.split(lines[i], '\t'); + if (pieces.length == 2) { + keys[count] = pieces[0]; + values[count] = PApplet.parseInt(pieces[1]); + indices.put(pieces[0], count); + count++; + } + } + } + + /** + * @nowebref + */ + public LongDict(String[] keys, long[] values) { + if (keys.length != values.length) { + throw new IllegalArgumentException("key and value arrays must be the same length"); + } + this.keys = keys; + this.values = values; + count = keys.length; + for (int i = 0; i < count; i++) { + indices.put(keys[i], i); + } + } + + + /** + * Constructor to allow (more intuitive) inline initialization, e.g.: + *
    +   * new FloatDict(new Object[][] {
    +   *   { "key1", 1 },
    +   *   { "key2", 2 }
    +   * });
    +   * 
    + */ + public LongDict(Object[][] pairs) { + count = pairs.length; + this.keys = new String[count]; + this.values = new long[count]; + for (int i = 0; i < count; i++) { + keys[i] = (String) pairs[i][0]; + values[i] = (Integer) pairs[i][1]; + indices.put(keys[i], i); + } + } + + + /** + * Returns the number of key/value pairs + * + * @webref intdict:method + * @brief Returns the number of key/value pairs + */ + public int size() { + return count; + } + + + /** + * Resize the internal data, this can only be used to shrink the list. + * Helpful for situations like sorting and then grabbing the top 50 entries. + */ + public void resize(int length) { + if (length > count) { + throw new IllegalArgumentException("resize() can only be used to shrink the dictionary"); + } + if (length < 1) { + throw new IllegalArgumentException("resize(" + length + ") is too small, use 1 or higher"); + } + + String[] newKeys = new String[length]; + long[] newValues = new long[length]; + PApplet.arrayCopy(keys, newKeys, length); + PApplet.arrayCopy(values, newValues, length); + keys = newKeys; + values = newValues; + count = length; + resetIndices(); + } + + + /** + * Remove all entries. + * + * @webref intdict:method + * @brief Remove all entries + */ + public void clear() { + count = 0; + indices = new HashMap<>(); + } + + + private void resetIndices() { + indices = new HashMap<>(count); + for (int i = 0; i < count; i++) { + indices.put(keys[i], i); + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + public class Entry { + public String key; + public long value; + + Entry(String key, long value) { + this.key = key; + this.value = value; + } + } + + + public Iterable entries() { + return new Iterable() { + + public Iterator iterator() { + return entryIterator(); + } + }; + } + + + public Iterator entryIterator() { + return new Iterator() { + int index = -1; + + public void remove() { + removeIndex(index); + index--; + } + + public Entry next() { + ++index; + Entry e = new Entry(keys[index], values[index]); + return e; + } + + public boolean hasNext() { + return index+1 < size(); + } + }; + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + public String key(int index) { + return keys[index]; + } + + + protected void crop() { + if (count != keys.length) { + keys = PApplet.subset(keys, 0, count); + values = PApplet.subset(values, 0, count); + } + } + + + public Iterable keys() { + return new Iterable() { + + @Override + public Iterator iterator() { + return keyIterator(); + } + }; + } + + + // Use this to iterate when you want to be able to remove elements along the way + public Iterator keyIterator() { + return new Iterator() { + int index = -1; + + public void remove() { + removeIndex(index); + index--; + } + + public String next() { + return key(++index); + } + + public boolean hasNext() { + return index+1 < size(); + } + }; + } + + + /** + * Return a copy of the internal keys array. This array can be modified. + * + * @webref intdict:method + * @brief Return a copy of the internal keys array + */ + public String[] keyArray() { + crop(); + return keyArray(null); + } + + + public String[] keyArray(String[] outgoing) { + if (outgoing == null || outgoing.length != count) { + outgoing = new String[count]; + } + System.arraycopy(keys, 0, outgoing, 0, count); + return outgoing; + } + + + public long value(int index) { + return values[index]; + } + + + /** + * @webref intdict:method + * @brief Return the internal array being used to store the values + */ + public Iterable values() { + return new Iterable() { + + @Override + public Iterator iterator() { + return valueIterator(); + } + }; + } + + + public Iterator valueIterator() { + return new Iterator() { + int index = -1; + + public void remove() { + removeIndex(index); + index--; + } + + public Long next() { + return value(++index); + } + + public boolean hasNext() { + return index+1 < size(); + } + }; + } + + + /** + * Create a new array and copy each of the values into it. + * + * @webref intdict:method + * @brief Create a new array and copy each of the values into it + */ + public int[] valueArray() { + crop(); + return valueArray(null); + } + + + /** + * Fill an already-allocated array with the values (more efficient than + * creating a new array each time). If 'array' is null, or not the same + * size as the number of values, a new array will be allocated and returned. + * + * @param array values to copy into the array + */ + public int[] valueArray(int[] array) { + if (array == null || array.length != size()) { + array = new int[count]; + } + System.arraycopy(values, 0, array, 0, count); + return array; + } + + + /** + * Return a value for the specified key. + * + * @webref intdict:method + * @brief Return a value for the specified key + */ + public long get(String key) { + int index = index(key); + if (index == -1) { + throw new IllegalArgumentException("No key named '" + key + "'"); + } + return values[index]; + } + + + public long get(String key, long alternate) { + int index = index(key); + if (index == -1) return alternate; + return values[index]; + } + + + /** + * Create a new key/value pair or change the value of one. + * + * @webref intdict:method + * @brief Create a new key/value pair or change the value of one + */ + public void set(String key, long amount) { + int index = index(key); + if (index == -1) { + create(key, amount); + } else { + values[index] = amount; + } + } + + + public void setIndex(int index, String key, long value) { + if (index < 0 || index >= count) { + throw new ArrayIndexOutOfBoundsException(index); + } + keys[index] = key; + values[index] = value; + } + + + /** + * @webref intdict:method + * @brief Check if a key is a part of the data structure + */ + public boolean hasKey(String key) { + return index(key) != -1; + } + + + /** + * Increase the value associated with a specific key by 1. + * + * @webref intdict:method + * @brief Increase the value of a specific key value by 1 + */ + public void increment(String key) { + add(key, 1); + } + + + /** + * Merge another dictionary into this one. Calling this increment() + * since it doesn't make sense in practice for the other dictionary types, + * even though it's technically an add(). + */ + public void increment(LongDict dict) { + for (int i = 0; i < dict.count; i++) { + add(dict.key(i), dict.value(i)); + } + } + + + /** + * @webref intdict:method + * @brief Add to a value + */ + public void add(String key, long amount) { + int index = index(key); + if (index == -1) { + create(key, amount); + } else { + values[index] += amount; + } + } + + + /** + * @webref intdict:method + * @brief Subtract from a value + */ + public void sub(String key, long amount) { + add(key, -amount); + } + + + /** + * @webref intdict:method + * @brief Multiply a value + */ + public void mult(String key, long amount) { + int index = index(key); + if (index != -1) { + values[index] *= amount; + } + } + + + /** + * @webref intdict:method + * @brief Divide a value + */ + public void div(String key, long amount) { + int index = index(key); + if (index != -1) { + values[index] /= amount; + } + } + + + private void checkMinMax(String functionName) { + if (count == 0) { + String msg = + String.format("Cannot use %s() on an empty %s.", + functionName, getClass().getSimpleName()); + throw new RuntimeException(msg); + } + } + + + // return the index of the minimum value + public int minIndex() { + //checkMinMax("minIndex"); + if (count == 0) return -1; + + int index = 0; + long value = values[0]; + for (int i = 1; i < count; i++) { + if (values[i] < value) { + index = i; + value = values[i]; + } + } + return index; + } + + + // return the key for the minimum value + public String minKey() { + checkMinMax("minKey"); + int index = minIndex(); + if (index == -1) { + return null; + } + return keys[index]; + } + + + // return the minimum value, or throw an error if there are no values + public long minValue() { + checkMinMax("minValue"); + return values[minIndex()]; + } + + + // return the index of the max value + public int maxIndex() { + //checkMinMax("maxIndex"); + if (count == 0) { + return -1; + } + int index = 0; + long value = values[0]; + for (int i = 1; i < count; i++) { + if (values[i] > value) { + index = i; + value = values[i]; + } + } + return index; + } + + + /** return the key corresponding to the maximum value or null if no entries */ + public String maxKey() { + //checkMinMax("maxKey"); + int index = maxIndex(); + if (index == -1) { + return null; + } + return keys[index]; + } + + + // return the maximum value or throw an error if zero length + public long maxValue() { + checkMinMax("maxIndex"); + return values[maxIndex()]; + } + + + public long sum() { + long sum = 0; + for (int i = 0; i < count; i++) { + sum += values[i]; + } + return sum; + } + + + public int index(String what) { + Integer found = indices.get(what); + return (found == null) ? -1 : found.intValue(); + } + + + protected void create(String what, long much) { + if (count == keys.length) { + keys = PApplet.expand(keys); + values = PApplet.expand(values); + } + indices.put(what, Integer.valueOf(count)); + keys[count] = what; + values[count] = much; + count++; + } + + + /** + * @webref intdict:method + * @brief Remove a key/value pair + */ + public long remove(String key) { + int index = index(key); + if (index == -1) { + throw new NoSuchElementException("'" + key + "' not found"); + } + long value = values[index]; + removeIndex(index); + return value; + } + + + public long removeIndex(int index) { + if (index < 0 || index >= count) { + throw new ArrayIndexOutOfBoundsException(index); + } + long value = values[index]; + indices.remove(keys[index]); + for (int i = index; i < count-1; i++) { + keys[i] = keys[i+1]; + values[i] = values[i+1]; + indices.put(keys[i], i); + } + count--; + keys[count] = null; + values[count] = 0; + return value; + } + + + public void swap(int a, int b) { + String tkey = keys[a]; + long tvalue = values[a]; + keys[a] = keys[b]; + values[a] = values[b]; + keys[b] = tkey; + values[b] = tvalue; + +// indices.put(keys[a], Integer.valueOf(a)); +// indices.put(keys[b], Integer.valueOf(b)); + } + + + /** + * Sort the keys alphabetically (ignoring case). Uses the value as a + * tie-breaker (only really possible with a key that has a case change). + * + * @webref intdict:method + * @brief Sort the keys alphabetically + */ + public void sortKeys() { + sortImpl(true, false, true); + } + + /** + * Sort the keys alphabetically in reverse (ignoring case). Uses the value as a + * tie-breaker (only really possible with a key that has a case change). + * + * @webref intdict:method + * @brief Sort the keys alphabetically in reverse + */ + public void sortKeysReverse() { + sortImpl(true, true, true); + } + + + /** + * Sort by values in ascending order. The smallest value will be at [0]. + * + * @webref intdict:method + * @brief Sort by values in ascending order + */ + public void sortValues() { + sortValues(true); + } + + + /** + * Set true to ensure that the order returned is identical. Slightly + * slower because the tie-breaker for identical values compares the keys. + * @param stable + */ + public void sortValues(boolean stable) { + sortImpl(false, false, stable); + } + + + /** + * Sort by values in descending order. The largest value will be at [0]. + * + * @webref intdict:method + * @brief Sort by values in descending order + */ + public void sortValuesReverse() { + sortValuesReverse(true); + } + + + public void sortValuesReverse(boolean stable) { + sortImpl(false, true, stable); + } + + + protected void sortImpl(final boolean useKeys, final boolean reverse, + final boolean stable) { + Sort s = new Sort() { + @Override + public int size() { + return count; + } + + @Override + public int compare(int a, int b) { + long diff = 0; + if (useKeys) { + diff = keys[a].compareToIgnoreCase(keys[b]); + if (diff == 0) { + diff = values[a] - values[b]; + } + } else { // sort values + diff = values[a] - values[b]; + if (diff == 0 && stable) { + diff = keys[a].compareToIgnoreCase(keys[b]); + } + } + if (diff == 0) { + return 0; + } else if (reverse) { + return diff < 0 ? 1 : -1; + } else { + return diff < 0 ? -1 : 1; + } + } + + @Override + public void swap(int a, int b) { + LongDict.this.swap(a, b); + } + }; + s.run(); + + // Set the indices after sort/swaps (performance fix 160411) + resetIndices(); + } + + + /** + * Sum all of the values in this dictionary, then return a new FloatDict of + * each key, divided by the total sum. The total for all values will be ~1.0. + * @return an IntDict with the original keys, mapped to their pct of the total + */ + public FloatDict getPercent() { + double sum = sum(); // a little more accuracy + FloatDict outgoing = new FloatDict(); + for (int i = 0; i < size(); i++) { + double percent = value(i) / sum; + outgoing.set(key(i), (float) percent); + } + return outgoing; + } + + + /** Returns a duplicate copy of this object. */ + public LongDict copy() { + LongDict outgoing = new LongDict(count); + System.arraycopy(keys, 0, outgoing.keys, 0, count); + System.arraycopy(values, 0, outgoing.values, 0, count); + for (int i = 0; i < count; i++) { + outgoing.indices.put(keys[i], i); + } + outgoing.count = count; + return outgoing; + } + + + public void print() { + for (int i = 0; i < size(); i++) { + System.out.println(keys[i] + " = " + values[i]); + } + } + + + /** + * Save tab-delimited entries to a file (TSV format, UTF-8 encoding) + */ + public void save(File file) { + PrintWriter writer = PApplet.createWriter(file); + write(writer); + writer.close(); + } + + + /** + * Write tab-delimited entries to a PrintWriter + */ + public void write(PrintWriter writer) { + for (int i = 0; i < count; i++) { + writer.println(keys[i] + "\t" + values[i]); + } + writer.flush(); + } + + + /** + * Return this dictionary as a String in JSON format. + */ + public String toJSON() { + StringList items = new StringList(); + for (int i = 0; i < count; i++) { + items.append(JSONObject.quote(keys[i])+ ": " + values[i]); + } + return "{ " + items.join(", ") + " }"; + } + + + @Override + public String toString() { + return getClass().getSimpleName() + " size=" + size() + " " + toJSON(); + } +} diff --git a/core/src/processing/data/LongList.java b/core/src/processing/data/LongList.java new file mode 100644 index 0000000000..adfb1ea83c --- /dev/null +++ b/core/src/processing/data/LongList.java @@ -0,0 +1,937 @@ +package processing.data; + +import java.io.File; +import java.io.PrintWriter; +import java.util.Arrays; +import java.util.Iterator; +import java.util.Random; + +import processing.core.PApplet; + + +// splice, slice, subset, concat, reverse + +// trim, join for String versions + + +/** + * Helper class for a list of ints. Lists are designed to have some of the + * features of ArrayLists, but to maintain the simplicity and efficiency of + * working with arrays. + * + * Functions like sort() and shuffle() always act on the list itself. To get + * a sorted copy, use list.copy().sort(). + * + * @nowebref + * @see FloatList + * @see StringList + */ +public class LongList implements Iterable { + protected int count; + protected long[] data; + + + public LongList() { + data = new long[10]; + } + + + /** + * @nowebref + */ + public LongList(int length) { + data = new long[length]; + } + + + /** + * @nowebref + */ + public LongList(int[] source) { + count = source.length; + data = new long[count]; + System.arraycopy(source, 0, data, 0, count); + } + + + /** + * Construct an IntList from an iterable pile of objects. + * For instance, a float array, an array of strings, who knows). + * Un-parseable or null values will be set to 0. + * @nowebref + */ + public LongList(Iterable iter) { + this(10); + for (Object o : iter) { + if (o == null) { + append(0); // missing value default + } else if (o instanceof Number) { + append(((Number) o).intValue()); + } else { + append(PApplet.parseInt(o.toString().trim())); + } + } + crop(); + } + + + /** + * Construct an IntList from a random pile of objects. + * Un-parseable or null values will be set to zero. + */ + public LongList(Object... items) { + final int missingValue = 0; // nuts, can't be last/final/second arg + + count = items.length; + data = new long[count]; + int index = 0; + for (Object o : items) { + int value = missingValue; + if (o != null) { + if (o instanceof Number) { + value = ((Number) o).intValue(); + } else { + value = PApplet.parseInt(o.toString().trim(), missingValue); + } + } + data[index++] = value; + } + } + + + static public LongList fromRange(int stop) { + return fromRange(0, stop); + } + + + static public LongList fromRange(int start, int stop) { + int count = stop - start; + LongList newbie = new LongList(count); + for (int i = 0; i < count; i++) { + newbie.set(i, start+i); + } + return newbie; + } + + + /** + * Improve efficiency by removing allocated but unused entries from the + * internal array used to store the data. Set to private, though it could + * be useful to have this public if lists are frequently making drastic + * size changes (from very large to very small). + */ + private void crop() { + if (count != data.length) { + data = PApplet.subset(data, 0, count); + } + } + + + /** + * Get the length of the list. + * + * @webref intlist:method + * @brief Get the length of the list + */ + public int size() { + return count; + } + + + public void resize(int length) { + if (length > data.length) { + long[] temp = new long[length]; + System.arraycopy(data, 0, temp, 0, count); + data = temp; + + } else if (length > count) { + Arrays.fill(data, count, length, 0); + } + count = length; + } + + + /** + * Remove all entries from the list. + * + * @webref intlist:method + * @brief Remove all entries from the list + */ + public void clear() { + count = 0; + } + + + /** + * Get an entry at a particular index. + * + * @webref intlist:method + * @brief Get an entry at a particular index + */ + public long get(int index) { + if (index >= this.count) { + throw new ArrayIndexOutOfBoundsException(index); + } + return data[index]; + } + + + /** + * Set the entry at a particular index. If the index is past the length of + * the list, it'll expand the list to accommodate, and fill the intermediate + * entries with 0s. + * + * @webref intlist:method + * @brief Set the entry at a particular index + */ + public void set(int index, int what) { + if (index >= count) { + data = PApplet.expand(data, index+1); + for (int i = count; i < index; i++) { + data[i] = 0; + } + count = index+1; + } + data[index] = what; + } + + + /** Just an alias for append(), but matches pop() */ + public void push(int value) { + append(value); + } + + + public long pop() { + if (count == 0) { + throw new RuntimeException("Can't call pop() on an empty list"); + } + long value = get(count-1); + count--; + return value; + } + + + /** + * Remove an element from the specified index + * + * @webref intlist:method + * @brief Remove an element from the specified index + */ + public long remove(int index) { + if (index < 0 || index >= count) { + throw new ArrayIndexOutOfBoundsException(index); + } + long entry = data[index]; +// int[] outgoing = new int[count - 1]; +// System.arraycopy(data, 0, outgoing, 0, index); +// count--; +// System.arraycopy(data, index + 1, outgoing, 0, count - index); +// data = outgoing; + // For most cases, this actually appears to be faster + // than arraycopy() on an array copying into itself. + for (int i = index; i < count-1; i++) { + data[i] = data[i+1]; + } + count--; + return entry; + } + + + // Remove the first instance of a particular value, + // and return the index at which it was found. + public int removeValue(int value) { + int index = index(value); + if (index != -1) { + remove(index); + return index; + } + return -1; + } + + + // Remove all instances of a particular value, + // and return the number of values found and removed + public int removeValues(int value) { + int ii = 0; + for (int i = 0; i < count; i++) { + if (data[i] != value) { + data[ii++] = data[i]; + } + } + int removed = count - ii; + count = ii; + return removed; + } + + + /** + * Add a new entry to the list. + * + * @webref intlist:method + * @brief Add a new entry to the list + */ + public void append(long value) { + if (count == data.length) { + data = PApplet.expand(data); + } + data[count++] = value; + } + + + public void append(int[] values) { + for (int v : values) { + append(v); + } + } + + + public void append(LongList list) { + for (long v : list.values()) { // will concat the list... + append(v); + } + } + + + /** Add this value, but only if it's not already in the list. */ + public void appendUnique(int value) { + if (!hasValue(value)) { + append(value); + } + } + + +// public void insert(int index, int value) { +// if (index+1 > count) { +// if (index+1 < data.length) { +// } +// } +// if (index >= data.length) { +// data = PApplet.expand(data, index+1); +// data[index] = value; +// count = index+1; +// +// } else if (count == data.length) { +// if (index >= count) { +// //int[] temp = new int[count << 1]; +// System.arraycopy(data, 0, temp, 0, index); +// temp[index] = value; +// System.arraycopy(data, index, temp, index+1, count - index); +// data = temp; +// +// } else { +// // data[] has room to grow +// // for() loop believed to be faster than System.arraycopy over itself +// for (int i = count; i > index; --i) { +// data[i] = data[i-1]; +// } +// data[index] = value; +// count++; +// } +// } + + + public void insert(int index, long value) { + insert(index, new long[] { value }); + } + + + // same as splice + public void insert(int index, long[] values) { + if (index < 0) { + throw new IllegalArgumentException("insert() index cannot be negative: it was " + index); + } + if (index >= data.length) { + throw new IllegalArgumentException("insert() index " + index + " is past the end of this list"); + } + + long[] temp = new long[count + values.length]; + + // Copy the old values, but not more than already exist + System.arraycopy(data, 0, temp, 0, Math.min(count, index)); + + // Copy the new values into the proper place + System.arraycopy(values, 0, temp, index, values.length); + +// if (index < count) { + // The index was inside count, so it's a true splice/insert + System.arraycopy(data, index, temp, index+values.length, count - index); + count = count + values.length; +// } else { +// // The index was past 'count', so the new count is weirder +// count = index + values.length; +// } + data = temp; + } + + + public void insert(int index, LongList list) { + insert(index, list.values()); + } + + + // below are aborted attempts at more optimized versions of the code + // that are harder to read and debug... + +// if (index + values.length >= count) { +// // We're past the current 'count', check to see if we're still allocated +// // index 9, data.length = 10, values.length = 1 +// if (index + values.length < data.length) { +// // There's still room for these entries, even though it's past 'count'. +// // First clear out the entries leading up to it, however. +// for (int i = count; i < index; i++) { +// data[i] = 0; +// } +// data[index] = +// } +// if (index >= data.length) { +// int length = index + values.length; +// int[] temp = new int[length]; +// System.arraycopy(data, 0, temp, 0, count); +// System.arraycopy(values, 0, temp, index, values.length); +// data = temp; +// count = data.length; +// } else { +// +// } +// +// } else if (count == data.length) { +// int[] temp = new int[count << 1]; +// System.arraycopy(data, 0, temp, 0, index); +// temp[index] = value; +// System.arraycopy(data, index, temp, index+1, count - index); +// data = temp; +// +// } else { +// // data[] has room to grow +// // for() loop believed to be faster than System.arraycopy over itself +// for (int i = count; i > index; --i) { +// data[i] = data[i-1]; +// } +// data[index] = value; +// count++; +// } + + + /** Return the first index of a particular value. */ + public int index(int what) { + /* + if (indexCache != null) { + try { + return indexCache.get(what); + } catch (Exception e) { // not there + return -1; + } + } + */ + for (int i = 0; i < count; i++) { + if (data[i] == what) { + return i; + } + } + return -1; + } + + + // !!! TODO this is not yet correct, because it's not being reset when + // the rest of the entries are changed +// protected void cacheIndices() { +// indexCache = new HashMap(); +// for (int i = 0; i < count; i++) { +// indexCache.put(data[i], i); +// } +// } + + /** + * @webref intlist:method + * @brief Check if a number is a part of the list + */ + public boolean hasValue(int value) { +// if (indexCache == null) { +// cacheIndices(); +// } +// return index(what) != -1; + for (int i = 0; i < count; i++) { + if (data[i] == value) { + return true; + } + } + return false; + } + + /** + * @webref intlist:method + * @brief Add one to a value + */ + public void increment(int index) { + if (count <= index) { + resize(index + 1); + } + data[index]++; + } + + + private void boundsProblem(int index, String method) { + final String msg = String.format("The list size is %d. " + + "You cannot %s() to element %d.", count, method, index); + throw new ArrayIndexOutOfBoundsException(msg); + } + + + /** + * @webref intlist:method + * @brief Add to a value + */ + public void add(int index, int amount) { + if (index < count) { + data[index] += amount; + } else { + boundsProblem(index, "add"); + } + } + + /** + * @webref intlist:method + * @brief Subtract from a value + */ + public void sub(int index, int amount) { + if (index < count) { + data[index] -= amount; + } else { + boundsProblem(index, "sub"); + } + } + + /** + * @webref intlist:method + * @brief Multiply a value + */ + public void mult(int index, int amount) { + if (index < count) { + data[index] *= amount; + } else { + boundsProblem(index, "mult"); + } + } + + /** + * @webref intlist:method + * @brief Divide a value + */ + public void div(int index, int amount) { + if (index < count) { + data[index] /= amount; + } else { + boundsProblem(index, "div"); + } + } + + + private void checkMinMax(String functionName) { + if (count == 0) { + String msg = + String.format("Cannot use %s() on an empty %s.", + functionName, getClass().getSimpleName()); + throw new RuntimeException(msg); + } + } + + + /** + * @webref intlist:method + * @brief Return the smallest value + */ + public long min() { + checkMinMax("min"); + long outgoing = data[0]; + for (int i = 1; i < count; i++) { + if (data[i] < outgoing) outgoing = data[i]; + } + return outgoing; + } + + + // returns the index of the minimum value. + // if there are ties, it returns the first one found. + public int minIndex() { + checkMinMax("minIndex"); + long value = data[0]; + int index = 0; + for (int i = 1; i < count; i++) { + if (data[i] < value) { + value = data[i]; + index = i; + } + } + return index; + } + + + /** + * @webref intlist:method + * @brief Return the largest value + */ + public long max() { + checkMinMax("max"); + long outgoing = data[0]; + for (int i = 1; i < count; i++) { + if (data[i] > outgoing) outgoing = data[i]; + } + return outgoing; + } + + + // returns the index of the maximum value. + // if there are ties, it returns the first one found. + public int maxIndex() { + checkMinMax("maxIndex"); + long value = data[0]; + int index = 0; + for (int i = 1; i < count; i++) { + if (data[i] > value) { + value = data[i]; + index = i; + } + } + return index; + } + + + public int sum() { + long amount = sumLong(); + if (amount > Integer.MAX_VALUE) { + throw new RuntimeException("sum() exceeds " + Integer.MAX_VALUE + ", use sumLong()"); + } + if (amount < Integer.MIN_VALUE) { + throw new RuntimeException("sum() less than " + Integer.MIN_VALUE + ", use sumLong()"); + } + return (int) amount; + } + + + public long sumLong() { + long sum = 0; + for (int i = 0; i < count; i++) { + sum += data[i]; + } + return sum; + } + + + /** + * Sorts the array in place. + * + * @webref intlist:method + * @brief Sorts the array, lowest to highest + */ + public void sort() { + Arrays.sort(data, 0, count); + } + + + /** + * Reverse sort, orders values from highest to lowest. + * + * @webref intlist:method + * @brief Reverse sort, orders values from highest to lowest + */ + public void sortReverse() { + new Sort() { + @Override + public int size() { + return count; + } + + @Override + public int compare(int a, int b) { + long diff = data[b] - data[a]; + return diff == 0 ? 0 : (diff < 0 ? -1 : 1); + } + + @Override + public void swap(int a, int b) { + long temp = data[a]; + data[a] = data[b]; + data[b] = temp; + } + }.run(); + } + + + // use insert() +// public void splice(int index, int value) { +// } + + +// public void subset(int start) { +// subset(start, count - start); +// } +// +// +// public void subset(int start, int num) { +// for (int i = 0; i < num; i++) { +// data[i] = data[i+start]; +// } +// count = num; +// } + + /** + * @webref intlist:method + * @brief Reverse the order of the list elements + */ + public void reverse() { + int ii = count - 1; + for (int i = 0; i < count/2; i++) { + long t = data[i]; + data[i] = data[ii]; + data[ii] = t; + --ii; + } + } + + + /** + * Randomize the order of the list elements. Note that this does not + * obey the randomSeed() function in PApplet. + * + * @webref intlist:method + * @brief Randomize the order of the list elements + */ + public void shuffle() { + Random r = new Random(); + int num = count; + while (num > 1) { + int value = r.nextInt(num); + num--; + long temp = data[num]; + data[num] = data[value]; + data[value] = temp; + } + } + + + /** + * Randomize the list order using the random() function from the specified + * sketch, allowing shuffle() to use its current randomSeed() setting. + */ + public void shuffle(PApplet sketch) { + int num = count; + while (num > 1) { + int value = (int) sketch.random(num); + num--; + long temp = data[num]; + data[num] = data[value]; + data[value] = temp; + } + } + + + public LongList copy() { + LongList outgoing = new LongList(data); + outgoing.count = count; + return outgoing; + } + + + /** + * Returns the actual array being used to store the data. For advanced users, + * this is the fastest way to access a large list. Suitable for iterating + * with a for() loop, but modifying the list will have terrible consequences. + */ + public long[] values() { + crop(); + return data; + } + + + @Override + public Iterator iterator() { +// public Iterator valueIterator() { + return new Iterator() { + int index = -1; + + public void remove() { + LongList.this.remove(index); + index--; + } + + public Long next() { + return data[++index]; + } + + public boolean hasNext() { + return index+1 < count; + } + }; + } + + + /** + * Create a new array with a copy of all the values. + * + * @return an array sized by the length of the list with each of the values. + * @webref intlist:method + * @brief Create a new array with a copy of all the values + */ + public int[] array() { + return array(null); + } + + + /** + * Copy values into the specified array. If the specified array is null or + * not the same size, a new array will be allocated. + * @param array + */ + public int[] array(int[] array) { + if (array == null || array.length != count) { + array = new int[count]; + } + System.arraycopy(data, 0, array, 0, count); + return array; + } + + +// public int[] toIntArray() { +// int[] outgoing = new int[count]; +// for (int i = 0; i < count; i++) { +// outgoing[i] = (int) data[i]; +// } +// return outgoing; +// } + + +// public long[] toLongArray() { +// long[] outgoing = new long[count]; +// for (int i = 0; i < count; i++) { +// outgoing[i] = (long) data[i]; +// } +// return outgoing; +// } + + +// public float[] toFloatArray() { +// float[] outgoing = new float[count]; +// System.arraycopy(data, 0, outgoing, 0, count); +// return outgoing; +// } + + +// public double[] toDoubleArray() { +// double[] outgoing = new double[count]; +// for (int i = 0; i < count; i++) { +// outgoing[i] = data[i]; +// } +// return outgoing; +// } + + +// public String[] toStringArray() { +// String[] outgoing = new String[count]; +// for (int i = 0; i < count; i++) { +// outgoing[i] = String.valueOf(data[i]); +// } +// return outgoing; +// } + + + /** + * Returns a normalized version of this array. Called getPercent() for + * consistency with the Dict classes. It's a getter method because it needs + * to returns a new list (because IntList/Dict can't do percentages or + * normalization in place on int values). + */ + public FloatList getPercent() { + double sum = 0; + for (float value : array()) { + sum += value; + } + FloatList outgoing = new FloatList(count); + for (int i = 0; i < count; i++) { + double percent = data[i] / sum; + outgoing.set(i, (float) percent); + } + return outgoing; + } + + +// /** +// * Count the number of times each entry is found in this list. +// * Converts each entry to a String so it can be used as a key. +// */ +// public IntDict getTally() { +// IntDict outgoing = new IntDict(); +// for (int i = 0; i < count; i++) { +// outgoing.increment(String.valueOf(data[i])); +// } +// return outgoing; +// } + + + public LongList getSubset(int start) { + return getSubset(start, count - start); + } + + + public LongList getSubset(int start, int num) { + int[] subset = new int[num]; + System.arraycopy(data, start, subset, 0, num); + return new LongList(subset); + } + + + public String join(String separator) { + if (count == 0) { + return ""; + } + StringBuilder sb = new StringBuilder(); + sb.append(data[0]); + for (int i = 1; i < count; i++) { + sb.append(separator); + sb.append(data[i]); + } + return sb.toString(); + } + + + public void print() { + for (int i = 0; i < count; i++) { + System.out.format("[%d] %d%n", i, data[i]); + } + } + + + /** + * Save tab-delimited entries to a file (TSV format, UTF-8 encoding) + */ + public void save(File file) { + PrintWriter writer = PApplet.createWriter(file); + write(writer); + writer.close(); + } + + + /** + * Write entries to a PrintWriter, one per line + */ + public void write(PrintWriter writer) { + for (int i = 0; i < count; i++) { + writer.println(data[i]); + } + writer.flush(); + } + + + /** + * Return this dictionary as a String in JSON format. + */ + public String toJSON() { + return "[ " + join(", ") + " ]"; + } + + + @Override + public String toString() { + return getClass().getSimpleName() + " size=" + size() + " " + toJSON(); + } +} diff --git a/core/src/processing/data/Sort.java b/core/src/processing/data/Sort.java index b42e0f141c..a83fea5514 100644 --- a/core/src/processing/data/Sort.java +++ b/core/src/processing/data/Sort.java @@ -41,6 +41,6 @@ protected int partition(int left, int right) { abstract public int size(); - abstract public float compare(int a, int b); + abstract public int compare(int a, int b); abstract public void swap(int a, int b); } \ No newline at end of file diff --git a/core/src/processing/data/StringDict.java b/core/src/processing/data/StringDict.java index 69fb4b7164..c66a61e4df 100644 --- a/core/src/processing/data/StringDict.java +++ b/core/src/processing/data/StringDict.java @@ -3,6 +3,7 @@ import java.io.*; import java.util.HashMap; import java.util.Iterator; +import java.util.NoSuchElementException; import processing.core.PApplet; @@ -23,7 +24,7 @@ public class StringDict { protected String[] values; /** Internal implementation for faster lookups */ - private HashMap indices = new HashMap(); + private HashMap indices = new HashMap<>(); public StringDict() { @@ -108,6 +109,26 @@ public StringDict(String[][] pairs) { } + /** + * Create a dictionary that maps between column titles and cell entries + * in a TableRow. If two columns have the same name, the later column's + * values will override the earlier values. + */ + public StringDict(TableRow row) { + this(row.getColumnCount()); + + String[] titles = row.getColumnTitles(); + if (titles == null) { + titles = new StringList(IntList.fromRange(row.getColumnCount())).array(); + } + for (int col = 0; col < row.getColumnCount(); col++) { + set(titles[col], row.getString(col)); + } + // remove unused and overwritten entries + crop(); + } + + /** * @webref stringdict:method * @brief Returns the number of key/value pairs @@ -117,6 +138,29 @@ public int size() { } + /** + * Resize the internal data, this can only be used to shrink the list. + * Helpful for situations like sorting and then grabbing the top 50 entries. + */ + public void resize(int length) { + if (length > count) { + throw new IllegalArgumentException("resize() can only be used to shrink the dictionary"); + } + if (length < 1) { + throw new IllegalArgumentException("resize(" + length + ") is too small, use 1 or higher"); + } + + String[] newKeys = new String[length]; + String[] newValues = new String[length]; + PApplet.arrayCopy(keys, newKeys, length); + PApplet.arrayCopy(values, newValues, length); + keys = newKeys; + values = newValues; + count = length; + resetIndices(); + } + + /** * Remove all entries. * @@ -125,10 +169,67 @@ public int size() { */ public void clear() { count = 0; - indices = new HashMap(); + indices = new HashMap<>(); } + private void resetIndices() { + indices = new HashMap<>(count); + for (int i = 0; i < count; i++) { + indices.put(keys[i], i); + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + public class Entry { + public String key; + public String value; + + Entry(String key, String value) { + this.key = key; + this.value = value; + } + } + + + public Iterable entries() { + return new Iterable() { + + public Iterator iterator() { + return entryIterator(); + } + }; + } + + + public Iterator entryIterator() { + return new Iterator() { + int index = -1; + + public void remove() { + removeIndex(index); + index--; + } + + public Entry next() { + ++index; + Entry e = new Entry(keys[index], values[index]); + return e; + } + + public boolean hasNext() { + return index+1 < size(); + } + }; + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + public String key(int index) { return keys[index]; } @@ -142,39 +243,33 @@ protected void crop() { } -// /** -// * Return the internal array being used to store the keys. Allocated but -// * unused entries will be removed. This array should not be modified. -// */ -// public String[] keys() { -// crop(); -// return keys; -// } - - /** - * @webref stringdict:method - * @brief Return the internal array being used to store the keys - */ public Iterable keys() { return new Iterable() { @Override public Iterator iterator() { - return new Iterator() { - int index = -1; + return keyIterator(); + } + }; + } - public void remove() { - removeIndex(index); - } - public String next() { - return key(++index); - } + // Use this to iterate when you want to be able to remove elements along the way + public Iterator keyIterator() { + return new Iterator() { + int index = -1; - public boolean hasNext() { - return index+1 < size(); - } - }; + public void remove() { + removeIndex(index); + index--; + } + + public String next() { + return key(++index); + } + + public boolean hasNext() { + return index+1 < size(); } }; } @@ -187,6 +282,7 @@ public boolean hasNext() { * @brief Return a copy of the internal keys array */ public String[] keyArray() { + crop(); return keyArray(null); } @@ -213,21 +309,27 @@ public Iterable values() { @Override public Iterator iterator() { - return new Iterator() { - int index = -1; + return valueIterator(); + } + }; + } - public void remove() { - removeIndex(index); - } - public String next() { - return value(++index); - } + public Iterator valueIterator() { + return new Iterator() { + int index = -1; - public boolean hasNext() { - return index+1 < size(); - } - }; + public void remove() { + removeIndex(index); + index--; + } + + public String next() { + return value(++index); + } + + public boolean hasNext() { + return index+1 < size(); } }; } @@ -240,6 +342,7 @@ public boolean hasNext() { * @brief Create a new array and copy each of the values into it */ public String[] valueArray() { + crop(); return valueArray(null); } @@ -292,11 +395,21 @@ public void set(String key, String value) { } + public void setIndex(int index, String key, String value) { + if (index < 0 || index >= count) { + throw new ArrayIndexOutOfBoundsException(index); + } + keys[index] = key; + values[index] = value; + } + + public int index(String what) { Integer found = indices.get(what); return (found == null) ? -1 : found.intValue(); } + /** * @webref stringdict:method * @brief Check if a key is a part of the data structure @@ -321,12 +434,14 @@ protected void create(String key, String value) { * @webref stringdict:method * @brief Remove a key/value pair */ - public int remove(String key) { + public String remove(String key) { int index = index(key); - if (index != -1) { - removeIndex(index); + if (index == -1) { + throw new NoSuchElementException("'" + key + "' not found"); } - return index; + String value = values[index]; + removeIndex(index); + return value; } @@ -334,9 +449,8 @@ public String removeIndex(int index) { if (index < 0 || index >= count) { throw new ArrayIndexOutOfBoundsException(index); } - //System.out.println("index is " + which + " and " + keys[which]); - String key = keys[index]; - indices.remove(key); + String value = values[index]; + indices.remove(keys[index]); for (int i = index; i < count-1; i++) { keys[i] = keys[i+1]; values[i] = values[i+1]; @@ -345,10 +459,11 @@ public String removeIndex(int index) { count--; keys[count] = null; values[count] = null; - return key; + return value; } + public void swap(int a, int b) { String tkey = keys[a]; String tvalue = values[a]; @@ -357,8 +472,8 @@ public void swap(int a, int b) { keys[b] = tkey; values[b] = tvalue; - indices.put(keys[a], Integer.valueOf(a)); - indices.put(keys[b], Integer.valueOf(b)); +// indices.put(keys[a], Integer.valueOf(a)); +// indices.put(keys[b], Integer.valueOf(b)); } @@ -375,7 +490,7 @@ public void sortKeys() { /** * @webref stringdict:method - * @brief Sort the keys alphabetially in reverse + * @brief Sort the keys alphabetically in reverse */ public void sortKeysReverse() { sortImpl(true, true); @@ -410,7 +525,7 @@ public int size() { } @Override - public float compare(int a, int b) { + public int compare(int a, int b) { int diff = 0; if (useKeys) { diff = keys[a].compareToIgnoreCase(keys[b]); @@ -432,6 +547,9 @@ public void swap(int a, int b) { } }; s.run(); + + // Set the indices after sort/swaps (performance fix 160411) + resetIndices(); } @@ -448,9 +566,25 @@ public StringDict copy() { } + public void print() { + for (int i = 0; i < size(); i++) { + System.out.println(keys[i] + " = " + values[i]); + } + } + + /** - * Write tab-delimited entries out to - * @param writer + * Save tab-delimited entries to a file (TSV format, UTF-8 encoding) + */ + public void save(File file) { + PrintWriter writer = PApplet.createWriter(file); + write(writer); + writer.close(); + } + + + /** + * Write tab-delimited entries to a PrintWriter */ public void write(PrintWriter writer) { for (int i = 0; i < count; i++) { @@ -460,24 +594,20 @@ public void write(PrintWriter writer) { } - public void print() { - for (int i = 0; i < size(); i++) { - System.out.println(keys[i] + " = " + values[i]); + /** + * Return this dictionary as a String in JSON format. + */ + public String toJSON() { + StringList items = new StringList(); + for (int i = 0; i < count; i++) { + items.append(JSONObject.quote(keys[i])+ ": " + JSONObject.quote(values[i])); } + return "{ " + items.join(", ") + " }"; } @Override public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(getClass().getSimpleName() + " size=" + size() + " { "); - for (int i = 0; i < size(); i++) { - if (i != 0) { - sb.append(", "); - } - sb.append("\"" + keys[i] + "\": \"" + values[i] + "\""); - } - sb.append(" }"); - return sb.toString(); + return getClass().getSimpleName() + " size=" + size() + " " + toJSON(); } } diff --git a/core/src/processing/data/StringList.java b/core/src/processing/data/StringList.java index a647a91917..2123a61432 100644 --- a/core/src/processing/data/StringList.java +++ b/core/src/processing/data/StringList.java @@ -1,5 +1,7 @@ package processing.data; +import java.io.File; +import java.io.PrintWriter; import java.util.Arrays; import java.util.Iterator; import java.util.Random; @@ -47,6 +49,8 @@ public StringList(String[] list) { /** * Construct a StringList from a random pile of objects. Null values will * stay null, but all the others will be converted to String values. + * + * @nowebref */ public StringList(Object... items) { count = items.length; @@ -514,8 +518,8 @@ public int size() { } @Override - public float compare(int a, int b) { - float diff = data[a].compareToIgnoreCase(data[b]); + public int compare(int a, int b) { + int diff = data[a].compareToIgnoreCase(data[b]); return reverse ? -diff : diff; } @@ -657,6 +661,7 @@ public Iterator iterator() { public void remove() { StringList.this.remove(index); + index--; } public String next() { @@ -749,23 +754,47 @@ public String join(String separator) { public void print() { - for (int i = 0; i < size(); i++) { + for (int i = 0; i < count; i++) { System.out.format("[%d] %s%n", i, data[i]); } } + /** + * Save tab-delimited entries to a file (TSV format, UTF-8 encoding) + */ + public void save(File file) { + PrintWriter writer = PApplet.createWriter(file); + write(writer); + writer.close(); + } + + + /** + * Write entries to a PrintWriter, one per line + */ + public void write(PrintWriter writer) { + for (int i = 0; i < count; i++) { + writer.println(data[i]); + } + writer.flush(); + } + + + /** + * Return this dictionary as a String in JSON format. + */ + public String toJSON() { + StringList temp = new StringList(); + for (String item : this) { + temp.append(JSONObject.quote(item)); + } + return "[ " + temp.join(", ") + " ]"; + } + + @Override public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(getClass().getSimpleName() + " size=" + size() + " [ "); - for (int i = 0; i < size(); i++) { - if (i != 0) { - sb.append(", "); - } - sb.append(i + ": \"" + data[i] + "\""); - } - sb.append(" ]"); - return sb.toString(); + return getClass().getSimpleName() + " size=" + size() + " " + toJSON(); } -} \ No newline at end of file +} diff --git a/core/src/processing/data/Table.java b/core/src/processing/data/Table.java index d60e9ede5f..e0684b4c1e 100644 --- a/core/src/processing/data/Table.java +++ b/core/src/processing/data/Table.java @@ -325,12 +325,11 @@ static public String extensionOptions(boolean loading, String filename, String o protected void parse(InputStream input, String options) throws IOException { - //init(); - - boolean awfulCSV = false; +// boolean awfulCSV = false; boolean header = false; String extension = null; boolean binary = false; + String encoding = "UTF-8"; String worksheet = null; final String sheetParam = "worksheet="; @@ -346,8 +345,9 @@ protected void parse(InputStream input, String options) throws IOException { } else if (opt.equals("ods")) { extension = "ods"; } else if (opt.equals("newlines")) { - awfulCSV = true; - extension = "csv"; + //awfulCSV = true; + //extension = "csv"; + throw new IllegalArgumentException("The 'newlines' option is no longer necessary."); } else if (opt.equals("bin")) { binary = true; extension = "bin"; @@ -357,6 +357,8 @@ protected void parse(InputStream input, String options) throws IOException { worksheet = opt.substring(sheetParam.length()); } else if (opt.startsWith("dictionary=")) { // ignore option, this is only handled by PApplet + } else if (opt.startsWith("encoding=")) { + encoding = opt.substring(9); } else { throw new IllegalArgumentException("'" + opt + "' is not a valid option for loading a Table"); } @@ -374,14 +376,27 @@ protected void parse(InputStream input, String options) throws IOException { odsParse(input, worksheet, header); } else { - BufferedReader reader = PApplet.createReader(input); - if (awfulCSV) { + InputStreamReader isr = new InputStreamReader(input, encoding); + BufferedReader reader = new BufferedReader(isr); + + // strip out the Unicode BOM, if present + reader.mark(1); + int c = reader.read(); + // if not the BOM, back up to the beginning again + if (c != '\uFEFF') { + reader.reset(); + } + + /* + if (awfulCSV) { parseAwfulCSV(reader, header); } else if ("tsv".equals(extension)) { parseBasic(reader, header, true); } else if ("csv".equals(extension)) { parseBasic(reader, header, false); } + */ + parseBasic(reader, header, "tsv".equals(extension)); } } @@ -400,16 +415,16 @@ protected void parseBasic(BufferedReader reader, setRowCount(row << 1); } if (row == 0 && header) { - setColumnTitles(tsv ? PApplet.split(line, '\t') : splitLineCSV(line)); + setColumnTitles(tsv ? PApplet.split(line, '\t') : splitLineCSV(line, reader)); header = false; } else { - setRow(row, tsv ? PApplet.split(line, '\t') : splitLineCSV(line)); + setRow(row, tsv ? PApplet.split(line, '\t') : splitLineCSV(line, reader)); row++; } - // this is problematic unless we're going to calculate rowCount first if (row % 10000 == 0) { /* + // this is problematic unless we're going to calculate rowCount first if (row < rowCount) { int pct = (100 * row) / rowCount; if (pct != prev) { // also prevents "0%" from showing up @@ -441,6 +456,7 @@ protected void parseBasic(BufferedReader reader, // } + /* protected void parseAwfulCSV(BufferedReader reader, boolean header) throws IOException { char[] c = new char[100]; @@ -538,72 +554,271 @@ protected void parseAwfulCSV(BufferedReader reader, setRowCount(row); // shrink to the actual size } } + */ - /** - * Parse a line of text as comma-separated values, returning each value as - * one entry in an array of String objects. Remove quotes from entries that - * begin and end with them, and convert 'escaped' quotes to actual quotes. - * @param line line of text to be parsed - * @return an array of the individual values formerly separated by commas - */ - static protected String[] splitLineCSV(String line) { - char[] c = line.toCharArray(); - int rough = 1; // at least one - boolean quote = false; - for (int i = 0; i < c.length; i++) { - if (!quote && (c[i] == ',')) { - rough++; - } else if (c[i] == '\"') { - quote = !quote; + static class CommaSeparatedLine { + char[] c; + String[] pieces; + int pieceCount; + +// int offset; + int start; //, stop; + + String[] handle(String line, BufferedReader reader) throws IOException { +// PApplet.println("handle() called for: " + line); + start = 0; + pieceCount = 0; + c = line.toCharArray(); + + // get tally of number of columns and allocate the array + int cols = 1; // the first comma indicates the second column + boolean quote = false; + for (int i = 0; i < c.length; i++) { + if (!quote && (c[i] == ',')) { + cols++; + } else if (c[i] == '\"') { + // double double quotes (escaped quotes like "") will simply toggle + // this back and forth, so it should remain accurate + quote = !quote; + } + } + pieces = new String[cols]; + +// while (offset < c.length) { +// start = offset; + while (start < c.length) { + boolean enough = ingest(); + while (!enough) { + // found a newline inside the quote, grab another line + String nextLine = reader.readLine(); +// System.out.println("extending to " + nextLine); + if (nextLine == null) { +// System.err.println(line); + throw new IOException("Found a quoted line that wasn't terminated properly."); + } + // for simplicity, not bothering to skip what's already been read + // from c (and reset the offset to 0), opting to make a bigger array + // with both lines. + char[] temp = new char[c.length + 1 + nextLine.length()]; + PApplet.arrayCopy(c, temp, c.length); + // NOTE: we're converting to \n here, which isn't perfect + temp[c.length] = '\n'; + nextLine.getChars(0, nextLine.length(), temp, c.length + 1); +// c = temp; + return handle(new String(temp), reader); + //System.out.println(" full line is now " + new String(c)); + //stop = nextComma(c, offset); + //System.out.println("stop is now " + stop); + //enough = ingest(); + } + } + + // Make any remaining entries blanks instead of nulls. Empty columns from + // CSV are always "" not null, so this handles successive commas in a line + for (int i = pieceCount; i < pieces.length; i++) { + pieces[i] = ""; } +// PApplet.printArray(pieces); + return pieces; } - String[] pieces = new String[rough]; - int pieceCount = 0; - int offset = 0; - while (offset < c.length) { - int start = offset; - int stop = nextComma(c, offset); - offset = stop + 1; // next time around, need to step over the comment - if (c[start] == '\"' && c[stop-1] == '\"') { - start++; - stop--; + + protected void addPiece(int start, int stop, boolean quotes) { + if (quotes) { + int dest = start; + for (int i = start; i < stop; i++) { + if (c[i] == '\"') { + ++i; // step over the quote + } + if (i != dest) { + c[dest] = c[i]; + } + dest++; + } + pieces[pieceCount++] = new String(c, start, dest - start); + + } else { + pieces[pieceCount++] = new String(c, start, stop - start); + } + } + + /** + * Returns the next comma (not inside a quote) in the specified array. + * @param c array to search + * @param index offset at which to start looking + * @return index of the comma, or -1 if line ended inside an unclosed quote + */ + protected boolean ingest() { + boolean hasEscapedQuotes = false; + // not possible +// if (index == c.length) { // we're already at the end +// return c.length; +// } + boolean quoted = c[start] == '\"'; + if (quoted) { + start++; // step over the quote } int i = start; - int ii = start; - while (i < stop) { + while (i < c.length) { +// PApplet.println(c[i] + " i=" + i); if (c[i] == '\"') { - i++; // skip over pairs of double quotes become one - } - if (i != ii) { - c[ii] = c[i]; + // if this fella started with a quote + if (quoted) { + if (i == c.length-1) { + // closing quote for field; last field on the line + addPiece(start, i, hasEscapedQuotes); + start = c.length; + return true; + + } else if (c[i+1] == '\"') { + // an escaped quote inside a quoted field, step over it + hasEscapedQuotes = true; + i += 2; + + } else if (c[i+1] == ',') { + // that was our closing quote, get outta here + addPiece(start, i, hasEscapedQuotes); + start = i+2; + return true; + + } else { + // This is a lone-wolf quote, occasionally seen in exports. + // It's a single quote in the middle of some other text, + // and not escaped properly. Pray for the best! + i++; + } + + } else { // not a quoted line + if (i == c.length-1) { + // we're at the end of the line, can't have an unescaped quote + throw new RuntimeException("Unterminated quote at end of line"); + + } else if (c[i+1] == '\"') { + // step over this crummy quote escape + hasEscapedQuotes = true; + i += 2; + + } else { + throw new RuntimeException("Unterminated quoted field mid-line"); + } + } + } else if (!quoted && c[i] == ',') { + addPiece(start, i, hasEscapedQuotes); + start = i+1; + return true; + + } else if (!quoted && i == c.length-1) { + addPiece(start, c.length, hasEscapedQuotes); + start = c.length; + return true; + + } else { // nothing all that interesting + i++; } - i++; - ii++; } - String s = new String(c, start, ii - start); - pieces[pieceCount++] = s; +// if (!quote && (c[i] == ',')) { +// // found a comma, return this location +// return i; +// } else if (c[i] == '\"') { +// // if it's a quote, then either the next char is another quote, +// // or if this is a quoted entry, it better be a comma +// quote = !quote; +// } +// } + + // if still inside a quote, indicate that another line should be read + if (quoted) { + return false; + } + +// // made it to the end of the array with no new comma +// return c.length; + + throw new RuntimeException("not sure how..."); } - // make any remaining entries blanks instead of nulls - for (int i = pieceCount; i < pieces.length; i++) { - pieces[i] = ""; + } + + CommaSeparatedLine csl; + + /** + * Parse a line of text as comma-separated values, returning each value as + * one entry in an array of String objects. Remove quotes from entries that + * begin and end with them, and convert 'escaped' quotes to actual quotes. + * @param line line of text to be parsed + * @return an array of the individual values formerly separated by commas + */ + protected String[] splitLineCSV(String line, BufferedReader reader) throws IOException { + if (csl == null) { + csl = new CommaSeparatedLine(); } - return pieces; + return csl.handle(line, reader); } + /** + * Returns the next comma (not inside a quote) in the specified array. + * @param c array to search + * @param index offset at which to start looking + * @return index of the comma, or -1 if line ended inside an unclosed quote + */ + /* static protected int nextComma(char[] c, int index) { - boolean quote = false; + if (index == c.length) { // we're already at the end + return c.length; + } + boolean quoted = c[index] == '\"'; + if (quoted) { + index++; // step over the quote + } for (int i = index; i < c.length; i++) { + if (c[i] == '\"') { + // if this fella started with a quote + if (quoted) { + if (i == c.length-1) { + //return -1; // ran out of chars + // closing quote for field; last field on the line + return c.length; + } else if (c[i+1] == '\"') { + // an escaped quote inside a quoted field, step over it + i++; + } else if (c[i+1] == ',') { + // that's our closing quote, get outta here + return i+1; + } + + } else { // not a quoted line + if (i == c.length-1) { + // we're at the end of the line, can't have an unescaped quote + //return -1; // ran out of chars + throw new RuntimeException("Unterminated quoted field at end of line"); + } else if (c[i+1] == '\"') { + // step over this crummy quote escape + ++i; + } else { + throw new RuntimeException("Unterminated quoted field mid-line"); + } + } + } else if (!quoted && c[i] == ',') { + return i; + } if (!quote && (c[i] == ',')) { + // found a comma, return this location return i; } else if (c[i] == '\"') { + // if it's a quote, then either the next char is another quote, + // or if this is a quoted entry, it better be a comma quote = !quote; } } + // if still inside a quote, indicate that another line should be read + if (quote) { + return -1; + } + // made it to the end of the array with no new comma return c.length; } + */ /** @@ -861,7 +1076,7 @@ public void parseInto(Object enclosingObject, String fieldName) { } Field[] fields = target.getDeclaredFields(); - ArrayList inuse = new ArrayList(); + ArrayList inuse = new ArrayList<>(); for (Field field : fields) { String name = field.getName(); if (getColumnIndex(name, false) != -1) { @@ -1497,19 +1712,19 @@ protected void loadBinary(InputStream is) throws IOException { columns[column] = new int[rowCount]; break; case LONG: - columns[column] = new long[rowCount];; + columns[column] = new long[rowCount]; break; case FLOAT: - columns[column] = new float[rowCount];; + columns[column] = new float[rowCount]; break; case DOUBLE: - columns[column] = new double[rowCount];; + columns[column] = new double[rowCount]; break; case STRING: - columns[column] = new String[rowCount];; + columns[column] = new String[rowCount]; break; case CATEGORY: - columns[column] = new int[rowCount];; + columns[column] = new int[rowCount]; break; default: throw new IllegalArgumentException(newType + " is not a valid column type."); @@ -1590,7 +1805,7 @@ public void addColumn(String title) { /** - * @param type the type to be used for the new column: INT, LONG, FLOAT, DOUBLE, STRING, or CATEGORY + * @param type the type to be used for the new column: INT, LONG, FLOAT, DOUBLE, or STRING */ public void addColumn(String title, int type) { insertColumn(columns.length, title, type); @@ -1730,12 +1945,7 @@ public void setColumnType(String columnName, String columnType) { } - /** - * Set the data type for a column so that using it is more efficient. - * @param column the column to change - * @param columnType One of int, long, float, double, string, or category. - */ - public void setColumnType(int column, String columnType) { + static int parseColumnType(String columnType) { columnType = columnType.toLowerCase(); int type = -1; if (columnType.equals("string")) { @@ -1753,7 +1963,17 @@ public void setColumnType(int column, String columnType) { } else { throw new IllegalArgumentException("'" + columnType + "' is not a valid column type."); } - setColumnType(column, type); + return type; + } + + + /** + * Set the data type for a column so that using it is more efficient. + * @param column the column to change + * @param columnType One of int, long, float, double, string, or category. + */ + public void setColumnType(int column, String columnType) { + setColumnType(column, parseColumnType(columnType)); } @@ -1995,7 +2215,7 @@ protected int getColumnIndex(String name, boolean report) { // only create this on first get(). subsequent calls to set the title will // also update this array, but only if it exists. if (columnIndices == null) { - columnIndices = new HashMap(); + columnIndices = new HashMap<>(); for (int col = 0; col < columns.length; col++) { columnIndices.put(columnTitles[col], col); } @@ -2208,10 +2428,13 @@ public void insertRow(int insert, Object[] columnData) { } } } + // Need to increment before setRow(), because it calls ensureBounds() + // https://github.com/processing/processing/issues/5406 + ++rowCount; setRow(insert, columnData); - rowCount++; } + /** * @webref table:method * @brief Removes a row from a table @@ -2590,6 +2813,19 @@ public String getColumnTitle(int column) { public String[] getColumnTitles() { return table.getColumnTitles(); } + + public void print() { + write(new PrintWriter(System.out)); + } + + public void write(PrintWriter writer) { + for (int i = 0 ; i < getColumnCount(); i++) { + if (i != 0) { + writer.print('\t'); + } + writer.print(getString(i)); + } + } } @@ -3564,7 +3800,7 @@ public int matchRowIndex(String what, String columnName) { /** * Return a list of rows that contain the String passed in. If there are no * matches, a zero length array will be returned (not a null array). - * @param what the String to match + * @param regexp the String to match * @param column ID number of the column to search */ public int[] matchRowIndices(String regexp, int column) { @@ -3749,7 +3985,7 @@ public void replaceAll(String regex, String replacement, int column) { /** * Run String.replaceAll() on all entries in a column. * Only works with columns that are already String values. - * @param what the String to match + * @param regex the String to match * @param columnName title of the column to search */ public void replaceAll(String regex, String replacement, String columnName) { @@ -3815,17 +4051,78 @@ public void removeTokens(String tokens, String columnName) { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + /** * @webref table:method * @brief Trims whitespace from values * @see Table#removeTokens(String) */ public void trim() { + columnTitles = PApplet.trim(columnTitles); for (int col = 0; col < getColumnCount(); col++) { trim(col); } + // remove empty columns + int lastColumn = getColumnCount() - 1; + //while (isEmptyColumn(lastColumn) && lastColumn >= 0) { + while (isEmptyArray(getStringColumn(lastColumn)) && lastColumn >= 0) { + lastColumn--; + } + setColumnCount(lastColumn + 1); + + // trim() works from both sides + while (getColumnCount() > 0 && isEmptyArray(getStringColumn(0))) { + removeColumn(0); + } + + // remove empty rows (starting from the end) + int lastRow = lastRowIndex(); + //while (isEmptyRow(lastRow) && lastRow >= 0) { + while (isEmptyArray(getStringRow(lastRow)) && lastRow >= 0) { + lastRow--; + } + setRowCount(lastRow + 1); + + while (getRowCount() > 0 && isEmptyArray(getStringRow(0))) { + removeRow(0); + } + } + + + protected boolean isEmptyArray(String[] contents) { + for (String entry : contents) { + if (entry != null && entry.length() > 0) { + return false; + } + } + return true; + } + + + /* + protected boolean isEmptyColumn(int column) { + String[] contents = getStringColumn(column); + for (String entry : contents) { + if (entry != null && entry.length() > 0) { + return false; + } + } + return true; } + + protected boolean isEmptyRow(int row) { + String[] contents = getStringRow(row); + for (String entry : contents) { + if (entry != null && entry.length() > 0) { + return false; + } + } + return true; + } + */ + + /** * @param column ID number of the column to trim */ @@ -3901,8 +4198,8 @@ protected void checkBounds(int row, int column) { static class HashMapBlows { - HashMap dataToIndex = new HashMap(); - ArrayList indexToData = new ArrayList(); + HashMap dataToIndex = new HashMap<>(); + ArrayList indexToData = new ArrayList<>(); HashMapBlows() { } @@ -3961,7 +4258,7 @@ private void writeln(PrintWriter writer) throws IOException { void read(DataInputStream input) throws IOException { int count = input.readInt(); //System.out.println("found " + count + " entries in category map"); - dataToIndex = new HashMap(count); + dataToIndex = new HashMap<>(count); for (int i = 0; i < count; i++) { String str = input.readUTF(); //System.out.println(i + " " + str); @@ -3996,12 +4293,21 @@ void read(DataInputStream input) throws IOException { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - + /** + * Sorts (orders) a table based on the values in a column. + * + * @webref table:method + * @brief Orders a table based on the values in a column + * @param columnName the name of the column to sort + * @see Table#trim() + */ public void sort(String columnName) { sort(getColumnIndex(columnName), false); } - + /** + * @param column the column ID, e.g. 0, 1, 2 + */ public void sort(int column) { sort(column, false); } @@ -4027,7 +4333,7 @@ public int size() { } @Override - public float compare(int index1, int index2) { + public int compare(int index1, int index2) { int a = reverse ? order[index2] : order[index1]; int b = reverse ? order[index1] : order[index2]; @@ -4035,13 +4341,24 @@ public float compare(int index1, int index2) { case INT: return getInt(a, column) - getInt(b, column); case LONG: - return getLong(a, column) - getLong(b, column); + long diffl = getLong(a, column) - getLong(b, column); + return diffl == 0 ? 0 : (diffl < 0 ? -1 : 1); case FLOAT: - return getFloat(a, column) - getFloat(b, column); + float difff = getFloat(a, column) - getFloat(b, column); + return difff == 0 ? 0 : (difff < 0 ? -1 : 1); case DOUBLE: - return (float) (getDouble(a, column) - getDouble(b, column)); + double diffd = getDouble(a, column) - getDouble(b, column); + return diffd == 0 ? 0 : (diffd < 0 ? -1 : 1); case STRING: - return getString(a, column).compareToIgnoreCase(getString(b, column)); + String string1 = getString(a, column); + if (string1 == null) { + string1 = ""; // avoid NPE when cells are left empty + } + String string2 = getString(b, column); + if (string2 == null) { + string2 = ""; + } + return string1.compareToIgnoreCase(string2); case CATEGORY: return getInt(a, column) - getInt(b, column); default: @@ -4200,13 +4517,13 @@ public FloatDict getFloatDict(String keyColumnName, String valueColumnName) { public FloatDict getFloatDict(int keyColumn, int valueColumn) { return new FloatDict(getStringColumn(keyColumn), - getFloatColumn(valueColumn)); + getFloatColumn(valueColumn)); } public StringDict getStringDict(String keyColumnName, String valueColumnName) { return new StringDict(getStringColumn(keyColumnName), - getStringColumn(valueColumnName)); + getStringColumn(valueColumnName)); } @@ -4216,6 +4533,39 @@ public StringDict getStringDict(int keyColumn, int valueColumn) { } + public Map getRowMap(String columnName) { + int col = getColumnIndex(columnName); + return (col == -1) ? null : getRowMap(col); + } + + + /** + * Return a mapping that connects the entry from a column back to the row + * from which it came. For instance: + *
    +   * Table t = loadTable("country-data.tsv", "header");
    +   * // use the contents of the 'country' column to index the table
    +   * Map lookup = t.getRowMap("country");
    +   * // get the row that has "us" in the "country" column:
    +   * TableRow usRow = lookup.get("us");
    +   * // get an entry from the 'population' column
    +   * int population = usRow.getInt("population");
    +   * 
    + */ + public Map getRowMap(int column) { + Map outgoing = new HashMap<>(); + for (int row = 0; row < getRowCount(); row++) { + String id = getString(row, column); + outgoing.put(id, new RowPointer(this, row)); + } +// for (TableRow row : rows()) { +// String id = row.getString(column); +// outgoing.put(id, row); +// } + return outgoing; + } + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @@ -4412,7 +4762,7 @@ protected void convertBasic(BufferedReader reader, boolean tsv, int prev = -1; int row = 0; while ((line = reader.readLine()) != null) { - convertRow(output, tsv ? PApplet.split(line, '\t') : splitLineCSV(line)); + convertRow(output, tsv ? PApplet.split(line, '\t') : splitLineCSV(line, reader)); row++; if (row % 10000 == 0) { @@ -4571,4 +4921,14 @@ private void convertRowCol(DataOutputStream output, int row, int col, String pie public Table copy() { return new Table(rows()); } + + + public void write(PrintWriter writer) { + writeTSV(writer); + } + + + public void print() { + writeTSV(new PrintWriter(System.out)); + } } diff --git a/core/src/processing/data/TableRow.java b/core/src/processing/data/TableRow.java index 87e288825f..3ac59fe4c8 100644 --- a/core/src/processing/data/TableRow.java +++ b/core/src/processing/data/TableRow.java @@ -1,5 +1,7 @@ package processing.data; +import java.io.PrintWriter; + /** * @webref data:composite * @see Table @@ -19,6 +21,7 @@ public interface TableRow { * @see TableRow#getFloat(int) */ public String getString(int column); + /** * @param columnName title of the column to reference */ @@ -32,12 +35,24 @@ public interface TableRow { * @see TableRow#getString(int) */ public int getInt(int column); + /** * @param columnName title of the column to reference */ public int getInt(String columnName); + /** + * @brief Get a long value from the specified column + * @param column ID number of the column to reference + * @see TableRow#getFloat(int) + * @see TableRow#getString(int) + */ + public long getLong(int column); + + /** + * @param columnName title of the column to reference + */ public long getLong(String columnName); /** @@ -48,12 +63,23 @@ public interface TableRow { * @see TableRow#getString(int) */ public float getFloat(int column); + /** * @param columnName title of the column to reference */ public float getFloat(String columnName); - + + /** + * @brief Get a double value from the specified column + * @param column ID number of the column to reference + * @see TableRow#getInt(int) + * @see TableRow#getString(int) + */ public double getDouble(int column); + + /** + * @param columnName title of the column to reference + */ public double getDouble(String columnName); /** @@ -79,12 +105,24 @@ public interface TableRow { * @see TableRow#setString(int, String) */ public void setInt(int column, int value); + /** * @param columnName title of the target column */ public void setInt(String columnName, int value); - + + /** + * @brief Store a long value in the specified column + * @param column ID number of the target column + * @param value value to assign + * @see TableRow#setFloat(int, float) + * @see TableRow#setString(int, String) + */ public void setLong(int column, long value); + + /** + * @param columnName title of the target column + */ public void setLong(String columnName, long value); /** @@ -96,20 +134,65 @@ public interface TableRow { * @see TableRow#setString(int, String) */ public void setFloat(int column, float value); + /** * @param columnName title of the target column */ public void setFloat(String columnName, float value); + /** + * @brief Store a double value in the specified column + * @param column ID number of the target column + * @param value value to assign + * @see TableRow#setFloat(int, float) + * @see TableRow#setString(int, String) + */ public void setDouble(int column, double value); + + /** + * @param columnName title of the target column + */ public void setDouble(String columnName, double value); + /** + * @webref tablerow:method + * @brief Get the column count. + * @return count of all columns + */ public int getColumnCount(); + + /** + * @brief Get the column type. + * @param columnName title of the target column + * @return type of the column + */ public int getColumnType(String columnName); + + /** + * @param column ID number of the target column + */ public int getColumnType(int column); - + + /** + * @brief Get the all column types + * @return list of all column types + */ public int[] getColumnTypes(); + /** + * @webref tablerow:method + * @brief Get the column title. + * @param column ID number of the target column + * @return title of the column + */ public String getColumnTitle(int column); + + /** + * @brief Get the all column titles + * @return list of all column titles + */ public String[] getColumnTitles(); + + public void write(PrintWriter writer); + public void print(); } diff --git a/core/src/processing/data/XML.java b/core/src/processing/data/XML.java index 19086dfc7a..7089e65db3 100644 --- a/core/src/processing/data/XML.java +++ b/core/src/processing/data/XML.java @@ -45,7 +45,6 @@ * representing a single node of an XML tree. * * @webref data:composite - * @see PApplet#createXML(String) * @see PApplet#loadXML(String) * @see PApplet#parseXML(String) * @see PApplet#saveXML(XML, String) @@ -232,7 +231,18 @@ public XML(String name) { protected XML(XML parent, Node node) { this.node = node; this.parent = parent; -// this.name = node.getNodeName(); + + for (String attr : parent.listAttributes()) { + if (attr.startsWith("xmlns")) { + // Copy namespace attributes to the kids, otherwise this XML + // can no longer be printed (or manipulated in most ways). + // Only do this when it's an Element, otherwise it's trying to set + // attributes on text notes (interstitial content). + if (node instanceof Element) { + setString(attr, parent.getString(attr)); + } + } + } } @@ -430,8 +440,7 @@ public XML[] getChildren() { /** * Quick accessor for an element at a particular index. * - * @webref xml:method - * @brief Returns the child element with the specified index value or path + * @nowebref */ public XML getChild(int index) { checkChildren(); @@ -442,8 +451,10 @@ public XML getChild(int index) { /** * Get a child by its name or path. * + * @webref xml:method + * @brief Returns the child element with the specified index value or path * @param name element name or path/to/element - * @return the first matching element + * @return the first matching element or null if no match */ public XML getChild(String name) { if (name.length() > 0 && name.charAt(0) == '/') { @@ -584,7 +595,14 @@ public void removeChild(XML kid) { children = null; // TODO not efficient } - + /** + * Removes whitespace nodes. + * Those whitespace nodes are required to reconstruct the original XML's spacing and indentation. + * If you call this and use saveXML() your original spacing will be gone. + * + * @nowebref + * @brief Removes whitespace nodes + */ public void trim() { try { XPathFactory xpathFactory = XPathFactory.newInstance(); @@ -1095,10 +1113,18 @@ public String format(int indent) { String outgoing = stringWriter.toString(); // Add the XML declaration to the top if it's not there already - if (!outgoing.startsWith(decl)) { - return decl + sep + outgoing; - } else { + if (outgoing.startsWith(decl)) { + int declen = decl.length(); + int seplen = sep.length(); + if (outgoing.length() > declen + seplen && + !outgoing.substring(declen, declen + seplen).equals(sep)) { + // make sure there's a line break between the XML decl and the code + return outgoing.substring(0, decl.length()) + + sep + outgoing.substring(decl.length()); + } return outgoing; + } else { + return decl + sep + outgoing; } } catch (Exception e) { @@ -1108,6 +1134,11 @@ public String format(int indent) { } + public void print() { + PApplet.println(format(2)); + } + + /** * Return the XML document formatted with two spaces for indents. * Chosen to do this since it's the most common case (e.g. with println()). diff --git a/core/src/processing/javafx/PGraphicsFX2D.java b/core/src/processing/javafx/PGraphicsFX2D.java index dd97745330..7868c7fe0f 100644 --- a/core/src/processing/javafx/PGraphicsFX2D.java +++ b/core/src/processing/javafx/PGraphicsFX2D.java @@ -22,7 +22,15 @@ package processing.javafx; +import com.sun.javafx.geom.Path2D; +import com.sun.javafx.geom.PathIterator; +import com.sun.javafx.geom.Shape; + import java.nio.IntBuffer; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; import javafx.scene.SnapshotParameters; import javafx.scene.canvas.GraphicsContext; @@ -33,12 +41,11 @@ import javafx.scene.image.WritableImage; import javafx.scene.image.WritablePixelFormat; import javafx.scene.paint.Color; -import javafx.scene.paint.Paint; import javafx.scene.shape.ArcType; -import javafx.scene.shape.ClosePath; -import javafx.scene.shape.Path; import javafx.scene.shape.StrokeLineCap; import javafx.scene.shape.StrokeLineJoin; +import javafx.scene.text.Font; +import javafx.scene.text.Text; import javafx.scene.transform.Affine; import javafx.scene.transform.Transform; @@ -51,12 +58,17 @@ public class PGraphicsFX2D extends PGraphics { static final WritablePixelFormat argbFormat = PixelFormat.getIntArgbInstance(); - Path workPath; - Path auxPath; + WritableImage snapshotImage; + + Path2D workPath = new Path2D(); + Path2D auxPath = new Path2D(); boolean openContour; + boolean adjustedForThinLines; /// break the shape at the next vertex (next vertex() call is a moveto()) boolean breakShape; + private float[] pathCoordsBuffer = new float[6]; + /// coordinates for internal curve calculation float[] curveCoordX; float[] curveCoordY; @@ -64,7 +76,7 @@ public class PGraphicsFX2D extends PGraphics { float[] curveDrawY; int transformCount; - Affine transformStack[] = new Affine[MATRIX_STACK_DEPTH]; + Affine[] transformStack = new Affine[MATRIX_STACK_DEPTH]; // Line2D.Float line = new Line2D.Float(); // Ellipse2D.Float ellipse = new Ellipse2D.Float(); @@ -140,16 +152,12 @@ public void beginDraw() { @Override public void endDraw() { + flush(); + if (!primaryGraphics) { // TODO this is probably overkill for most tasks... loadPixels(); } - - // Marks pixels as modified so that the pixels will be updated. - // Also sets mx1/y1/x2/y2 so that OpenGL will pick it up. - setModified(); - - //g2.dispose(); } @@ -201,13 +209,15 @@ public void beginShape(int 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. - workPath = null; - auxPath = null; + workPath.reset(); + auxPath.reset(); + + flushPixels(); + + if (drawingThinLines()) { + adjustedForThinLines = true; + translate(0.5f, 0.5f); + } } @@ -228,11 +238,8 @@ public void texture(PImage image) { @Override public void vertex(float x, float y) { - curveVertexCount = 0; - //float vertex[]; - if (vertexCount == vertices.length) { - float temp[][] = new float[vertexCount<<1][VERTEX_FIELD_COUNT]; + 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); @@ -324,13 +331,11 @@ public void vertex(float x, float y) { break; case POLYGON: - if (workPath == null) { - context.moveTo(x, y); - } else if (breakShape) { - context.moveTo(x, y); + if (workPath.getNumCommands() == 0 || breakShape) { + workPath.moveTo(x, y); breakShape = false; } else { - context.lineTo(x, y); + workPath.lineTo(x, y); } break; } @@ -369,16 +374,14 @@ public void beginContour() { } // draw contours to auxiliary path so main path can be closed later - Path temp = auxPath; + Path2D contourPath = auxPath; auxPath = workPath; - workPath = temp; + workPath = contourPath; -// if (auxPath != null) { // first contour does not break - breakShape = true; - auxPath = new Path(); -// } + if (contourPath.getNumCommands() > 0) { // first contour does not break + breakShape = true; + } - breakShape = true; openContour = true; } @@ -390,15 +393,9 @@ public void endContour() { return; } - // close this contour - if (workPath != null) { - //gpath.closePath(); - auxPath.getElements().addAll(workPath.getElements()); - auxPath.getElements().add(new ClosePath()); - } + if (workPath.getNumCommands() > 0) workPath.closePath(); - // switch back to main path - Path temp = workPath; + Path2D temp = workPath; workPath = auxPath; auxPath = temp; @@ -412,21 +409,57 @@ public void endShape(int mode) { endContour(); PGraphics.showWarning("Missing endContour() before endShape()"); } - if (workPath != null) { // make sure something has been drawn + if (workPath.getNumCommands() > 0) { if (shape == POLYGON) { if (mode == CLOSE) { - //gpath.closePath(); - workPath.getElements().add(new ClosePath()); + workPath.closePath(); } - if (auxPath != null) { - //gpath.append(auxPath, false); - workPath.getElements().addAll(auxPath.getElements()); + if (auxPath.getNumCommands() > 0) { + workPath.append(auxPath, false); } - //drawShape(gpath); - // TODO argh, can't go this route + drawShape(workPath); } } shape = 0; + if (adjustedForThinLines) { + adjustedForThinLines = false; + translate(-0.5f, -0.5f); + } + loaded = false; + } + + + private void drawShape(Shape s) { + context.beginPath(); + PathIterator pi = s.getPathIterator(null); + while (!pi.isDone()) { + int pitype = pi.currentSegment(pathCoordsBuffer); + switch (pitype) { + case PathIterator.SEG_MOVETO: + context.moveTo(pathCoordsBuffer[0], pathCoordsBuffer[1]); + break; + case PathIterator.SEG_LINETO: + context.lineTo(pathCoordsBuffer[0], pathCoordsBuffer[1]); + break; + case PathIterator.SEG_QUADTO: + context.quadraticCurveTo(pathCoordsBuffer[0], pathCoordsBuffer[1], + pathCoordsBuffer[2], pathCoordsBuffer[3]); + break; + case PathIterator.SEG_CUBICTO: + context.bezierCurveTo(pathCoordsBuffer[0], pathCoordsBuffer[1], + pathCoordsBuffer[2], pathCoordsBuffer[3], + pathCoordsBuffer[4], pathCoordsBuffer[5]); + break; + case PathIterator.SEG_CLOSE: + context.closePath(); + break; + default: + showWarning("Unknown segment type " + pitype); + } + pi.next(); + } + if (fill) context.fill(); + if (stroke) context.stroke(); } @@ -486,13 +519,24 @@ protected void blendModeImpl() { // BEZIER VERTICES + @Override + protected void bezierVertexCheck() { + if (shape == 0 || shape != POLYGON) { + throw new RuntimeException("beginShape() or beginShape(POLYGON) " + + "must be used before bezierVertex() or quadraticVertex()"); + } + if (workPath.getNumCommands() == 0) { + throw new RuntimeException("vertex() must be used at least once " + + "before bezierVertex() or quadraticVertex()"); + } + } + @Override public void bezierVertex(float x1, float y1, float x2, float y2, float x3, float y3) { bezierVertexCheck(); - context.bezierCurveTo(x1, y1, x2, y2, x3, y3); - + workPath.curveTo(x1, y1, x2, y2, x3, y3); } @@ -513,7 +557,8 @@ public void bezierVertex(float x2, float y2, float z2, @Override public void quadraticVertex(float ctrlX, float ctrlY, float endX, float endY) { - context.quadraticCurveTo(ctrlX, ctrlY, endX, endY); + bezierVertexCheck(); + workPath.quadTo(ctrlX, ctrlY, endX, endY); } @@ -531,23 +576,17 @@ public void quadraticVertex(float x2, float y2, float z2, @Override - protected void curveVertexCheck() { - super.curveVertexCheck(); - + protected void curveVertexSegment(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { if (curveCoordX == null) { curveCoordX = new float[4]; curveCoordY = new float[4]; curveDrawX = new float[4]; curveDrawY = new float[4]; } - } - - @Override - 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; @@ -565,14 +604,14 @@ protected void curveVertexSegment(float x1, float y1, // since the paths are continuous, // only the first point needs the actual moveto - if (workPath == null) { -// gpath = new GeneralPath(); - context.moveTo(curveDrawX[0], curveDrawY[0]); + if (workPath.getNumCommands() == 0) { + workPath.moveTo(curveDrawX[0], curveDrawY[0]); + breakShape = false; } - context.bezierCurveTo(curveDrawX[1], curveDrawY[1], - curveDrawX[2], curveDrawY[2], - curveDrawX[3], curveDrawY[3]); + workPath.curveTo(curveDrawX[1], curveDrawY[1], + curveDrawX[2], curveDrawY[2], + curveDrawX[3], curveDrawY[3]); } @@ -587,9 +626,56 @@ public void curveVertex(float x, float y, float z) { // RENDERER + @Override + public void flush() { + flushPixels(); + } - //public void flush() + protected void flushPixels() { + boolean hasPixels = modified && pixels != null; + if (hasPixels) { + // If the user has been manipulating individual pixels, + // the changes need to be copied to the screen before + // drawing any new geometry. + int mx1 = getModifiedX1(); + int mx2 = getModifiedX2(); + int my1 = getModifiedY1(); + int my2 = getModifiedY2(); + int mw = mx2 - mx1; + int mh = my2 - my1; + + if (pixelDensity == 1) { + PixelWriter pw = context.getPixelWriter(); + pw.setPixels(mx1, my1, mw, mh, argbFormat, pixels, + mx1 + my1 * pixelWidth, pixelWidth); + } else { + // The only way to push all the pixels is to draw a scaled-down image + if (snapshotImage == null || + snapshotImage.getWidth() != pixelWidth || + snapshotImage.getHeight() != pixelHeight) { + snapshotImage = new WritableImage(pixelWidth, pixelHeight); + } + + PixelWriter pw = snapshotImage.getPixelWriter(); + pw.setPixels(mx1, my1, mw, mh, argbFormat, pixels, + mx1 + my1 * pixelWidth, pixelWidth); + context.save(); + resetMatrix(); + context.scale(1d / pixelDensity, 1d / pixelDensity); + context.drawImage(snapshotImage, mx1, my1, mw, mh, mx1, my1, mw, mh); + context.restore(); + } + } + + modified = false; + } + + + protected void beforeContextDraw() { + flushPixels(); + loaded = false; + } ////////////////////////////////////////////////////////////// @@ -611,6 +697,13 @@ public void point(float x, float y) { @Override public void line(float x1, float y1, float x2, float y2) { + beforeContextDraw(); + if (drawingThinLines()) { + x1 += 0.5f; + x2 += 0.5f; + y1 += 0.5f; + y2 += 0.5f; + } context.strokeLine(x1, y1, x2, y2); } @@ -618,6 +711,15 @@ public void line(float x1, float y1, float x2, float y2) { @Override public void triangle(float x1, float y1, float x2, float y2, float x3, float y3) { + beforeContextDraw(); + if (drawingThinLines()) { + x1 += 0.5f; + x2 += 0.5f; + x3 += 0.5f; + y1 += 0.5f; + y2 += 0.5f; + y3 += 0.5f; + } context.beginPath(); context.moveTo(x1, y1); context.lineTo(x2, y2); @@ -631,6 +733,17 @@ public void triangle(float x1, float y1, float x2, float y2, @Override public void quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { + beforeContextDraw(); + if (drawingThinLines()) { + x1 += 0.5f; + x2 += 0.5f; + x3 += 0.5f; + x4 += 0.5f; + y1 += 0.5f; + y2 += 0.5f; + y3 += 0.5f; + y4 += 0.5f; + } context.beginPath(); context.moveTo(x1, y1); context.lineTo(x2, y2); @@ -656,8 +769,13 @@ public void quad(float x1, float y1, float x2, float y2, @Override protected void rectImpl(float x1, float y1, float x2, float y2) { -// rect.setFrame(x1, y1, x2-x1, y2-y1); -// drawShape(rect); + beforeContextDraw(); + if (drawingThinLines()) { + x1 += 0.5f; + x2 += 0.5f; + y1 += 0.5f; + y2 += 0.5f; + } if (fill) context.fillRect(x1, y1, x2 - x1, y2 - y1); if (stroke) context.strokeRect(x1, y1, x2 - x1, y2 - y1); } @@ -677,8 +795,11 @@ protected void rectImpl(float x1, float y1, float x2, float y2) { @Override protected void ellipseImpl(float x, float y, float w, float h) { -// ellipse.setFrame(x, y, w, h); -// drawShape(ellipse); + beforeContextDraw(); + if (drawingThinLines()) { + x += 0.5f; + y += 0.5f; + } if (fill) context.fillOval(x, y, w, h); if (stroke) context.strokeOval(x, y, w, h); } @@ -697,11 +818,17 @@ protected void ellipseImpl(float x, float y, float w, float h) { @Override protected void arcImpl(float x, float y, float w, float h, float start, float stop, int mode) { + beforeContextDraw(); + + if (drawingThinLines()) { + x += 0.5f; + y += 0.5f; + } + // 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; + start = -start; + stop = -stop; float sweep = stop - start; @@ -904,8 +1031,8 @@ protected void imageImpl(PImage who, // Nuke the cache if the image was resized if (cash != null) { - if (who.width != cash.image.getWidth() || - who.height != cash.image.getHeight()) { + if (who.pixelWidth != cash.image.getWidth() || + who.pixelHeight != cash.image.getHeight()) { cash = null; } } @@ -932,12 +1059,17 @@ protected void imageImpl(PImage who, // This might be a PGraphics that hasn't been drawn to yet. // Can't just bail because the cache has been created above. // https://github.com/processing/processing/issues/2208 - who.pixels = new int[who.width * who.height]; + who.pixels = new int[who.pixelWidth * who.pixelHeight]; } cash.update(who, tint, tintColor); who.setModified(false); } + u1 *= who.pixelDensity; + v1 *= who.pixelDensity; + u2 *= who.pixelDensity; + v2 *= who.pixelDensity; + context.drawImage(((ImageCache) getCache(who)).image, u1, v1, u2-u1, v2-v1, x1, y1, x2-x1, y2-y1); @@ -978,14 +1110,14 @@ public void update(PImage source, boolean tint, int tintColor) { // BufferedImage.TYPE_INT_ARGB); // } if (image == null) { - image = new WritableImage(source.width, source.height); + image = new WritableImage(source.pixelWidth, source.pixelHeight); } //WritableRaster wr = image.getRaster(); PixelWriter pw = image.getPixelWriter(); if (tint) { - if (tintedTemp == null || tintedTemp.length != source.width) { - tintedTemp = new int[source.width]; + if (tintedTemp == null || tintedTemp.length != source.pixelWidth) { + tintedTemp = new int[source.pixelWidth]; } int a2 = (tintColor >> 24) & 0xff; // System.out.println("tint color is " + a2); @@ -999,8 +1131,8 @@ public void update(PImage source, boolean tint, int tintColor) { // The target image is opaque, meaning that the source image has no // alpha (is not ARGB), and the tint has no alpha. int index = 0; - for (int y = 0; y < source.height; y++) { - for (int x = 0; x < source.width; x++) { + for (int y = 0; y < source.pixelHeight; y++) { + for (int x = 0; x < source.pixelWidth; x++) { int argb1 = source.pixels[index++]; int r1 = (argb1 >> 16) & 0xff; int g1 = (argb1 >> 8) & 0xff; @@ -1015,7 +1147,7 @@ public void update(PImage source, boolean tint, int tintColor) { (((b2 * b1) & 0xff00) >> 8); } //wr.setDataElements(0, y, source.width, 1, tintedTemp); - pw.setPixels(0, y, source.width, 1, argbFormat, tintedTemp, 0, source.width); + pw.setPixels(0, y, source.pixelWidth, 1, argbFormat, tintedTemp, 0, source.pixelWidth); } // could this be any slower? // float[] scales = { tintR, tintG, tintB }; @@ -1029,19 +1161,19 @@ public void update(PImage source, boolean tint, int tintColor) { (tintColor & 0xffffff) == 0xffffff) { int hi = tintColor & 0xff000000; int index = 0; - for (int y = 0; y < source.height; y++) { - for (int x = 0; x < source.width; x++) { + for (int y = 0; y < source.pixelHeight; y++) { + for (int x = 0; x < source.pixelWidth; x++) { tintedTemp[x] = hi | (source.pixels[index++] & 0xFFFFFF); } //wr.setDataElements(0, y, source.width, 1, tintedTemp); - pw.setPixels(0, y, source.width, 1, argbFormat, tintedTemp, 0, source.width); + pw.setPixels(0, y, source.pixelWidth, 1, argbFormat, tintedTemp, 0, source.pixelWidth); } } else { int index = 0; - for (int y = 0; y < source.height; y++) { + for (int y = 0; y < source.pixelHeight; y++) { if (source.format == RGB) { int alpha = tintColor & 0xFF000000; - for (int x = 0; x < source.width; x++) { + for (int x = 0; x < source.pixelWidth; x++) { int argb1 = source.pixels[index++]; int r1 = (argb1 >> 16) & 0xff; int g1 = (argb1 >> 8) & 0xff; @@ -1052,7 +1184,7 @@ public void update(PImage source, boolean tint, int tintColor) { (((b2 * b1) & 0xff00) >> 8); } } else if (source.format == ARGB) { - for (int x = 0; x < source.width; x++) { + for (int x = 0; x < source.pixelWidth; x++) { int argb1 = source.pixels[index++]; int a1 = (argb1 >> 24) & 0xff; int r1 = (argb1 >> 16) & 0xff; @@ -1066,14 +1198,14 @@ public void update(PImage source, boolean tint, int tintColor) { } } else if (source.format == ALPHA) { int lower = tintColor & 0xFFFFFF; - for (int x = 0; x < source.width; x++) { + for (int x = 0; x < source.pixelWidth; x++) { int a1 = source.pixels[index++]; tintedTemp[x] = (((a2 * a1) & 0xff00) << 16) | lower; } } //wr.setDataElements(0, y, source.width, 1, tintedTemp); - pw.setPixels(0, y, source.width, 1, argbFormat, tintedTemp, 0, source.width); + pw.setPixels(0, y, source.pixelWidth, 1, argbFormat, tintedTemp, 0, source.pixelWidth); } } // Not sure why ARGB images take the scales in this order... @@ -1095,8 +1227,8 @@ public void update(PImage source, boolean tint, int tintColor) { // If no tint, just shove the pixels on in there verbatim //wr.setDataElements(0, 0, source.width, source.height, source.pixels); //System.out.println("moving the big one"); - pw.setPixels(0, 0, source.width, source.height, - argbFormat, source.pixels, 0, source.width); + pw.setPixels(0, 0, source.pixelWidth, source.pixelHeight, + argbFormat, source.pixels, 0, source.pixelWidth); } this.tinted = tint; this.tintedColor = tintColor; @@ -1154,243 +1286,330 @@ public PShape loadShape(String filename, String options) { -// ////////////////////////////////////////////////////////////// -// -// // TEXT ATTRIBTUES -// -// -// //public void textAlign(int align) -// -// -// //public void textAlign(int alignX, int alignY) -// -// -// @Override -// public float textAscent() { -// if (textFont == null) { -// defaultFontOrDeath("textAscent"); -// } -// -// Font font = (Font) textFont.getNative(); -// if (font != null) { -// return getFontMetrics(font).getAscent(); -// } -// return super.textAscent(); -// } -// -// -// @Override -// public float textDescent() { -// if (textFont == null) { -// defaultFontOrDeath("textDescent"); -// } -// Font font = (Font) textFont.getNative(); -// if (font != null) { -// return getFontMetrics(font).getDescent(); -// } -// return super.textDescent(); -// } -// -// -// //public void textFont(PFont which) -// -// -// //public void textFont(PFont which, float size) -// -// -// //public void textLeading(float leading) -// -// -// //public void textMode(int mode) -// -// -// @Override -// protected boolean textModeCheck(int mode) { -// return mode == MODEL; -// } -// -// -// /** -// * Same as parent, but override for native version of the font. -// *

    -// * Also gets called by textFont, so the metrics -// * will get recorded properly. -// */ -// @Override -// public void textSize(float size) { -// if (textFont == null) { -// defaultFontOrDeath("textSize", 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 = (Font) textFont.getNative(); -// //if (font != null && (textFont.isStream() || hints[ENABLE_NATIVE_FONTS])) { -// if (font != null) { -// Map map = -// new HashMap(); -// map.put(TextAttribute.SIZE, size); -// map.put(TextAttribute.KERNING, -// TextAttribute.KERNING_ON); -//// map.put(TextAttribute.TRACKING, -//// TextAttribute.TRACKING_TIGHT); -// font = font.deriveFont(map); -// g2.setFont(font); -// textFont.setNative(font); -// -//// Font dfont = font.deriveFont(size); -////// Map attrs = dfont.getAttributes(); -////// for (TextAttribute ta : attrs.keySet()) { -////// System.out.println(ta + " -> " + attrs.get(ta)); -////// } -//// g2.setFont(dfont); -//// textFont.setNative(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) -// -// -// @Override -// protected float textWidthImpl(char buffer[], int start, int stop) { -// if (textFont == null) { -// defaultFontOrDeath("textWidth"); -// } -// -// Font font = (Font) textFont.getNative(); -// //if (font != null && (textFont.isStream() || hints[ENABLE_NATIVE_FONTS])) { -// if (font != null) { -// // maybe should use one of the newer/fancier functions for this? -// int length = stop - start; -// FontMetrics metrics = getFontMetrics(font); -// // Using fractional metrics makes the measurement worse, not better, -// // at least on OS X 10.6 (November, 2010). -// // TextLayout returns the same value as charsWidth(). -//// System.err.println("using native"); -//// g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, -//// RenderingHints.VALUE_FRACTIONALMETRICS_ON); -//// float m1 = metrics.charsWidth(buffer, start, length); -//// //float m2 = (float) metrics.getStringBounds(buffer, start, stop, g2).getWidth(); -//// TextLayout tl = new TextLayout(new String(buffer, start, length), font, g2.getFontRenderContext()); -//// float m2 = (float) tl.getBounds().getWidth(); -//// System.err.println(m1 + " " + m2); -////// return m1; -//// return m2; -// return metrics.charsWidth(buffer, start, length); -// } -//// System.err.println("not native"); -// return super.textWidthImpl(buffer, start, stop); -// } -// -// -//// protected void beginTextScreenMode() { -//// loadPixels(); -//// } -// -// -//// protected void endTextScreenMode() { -//// updatePixels(); -//// } -// -// -// ////////////////////////////////////////////////////////////// -// -// // 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) -// -// -// @Override -// protected void textLineImpl(char buffer[], int start, int stop, -// float x, float y) { -// Font font = (Font) textFont.getNative(); -//// if (font != null && (textFont.isStream() || hints[ENABLE_NATIVE_FONTS])) { -// if (font != null) { -// /* -// // 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); -// -// g2.setColor(fillColorObject); -// -// int length = stop - start; -// if (length != 0) { -// g2.drawChars(buffer, start, length, (int) (x + 0.5f), (int) (y + 0.5f)); -// // better to use round here? also, drawChars now just calls drawString -//// g2.drawString(new String(buffer, start, stop - start), Math.round(x), Math.round(y)); -// -// // 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 a fairly heavyweight new temporary object -//// java.awt.font.GlyphVector gv = -//// font.createGlyphVector(g2.getFontRenderContext(), new String(buffer, start, stop - start)); -//// g2.drawGlyphVector(gv, x, y); -// } -// -// // return to previous smoothing state if it was changed -// //g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, textAntialias); -// g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antialias); -// -// } else { // otherwise just do the default -// super.textLineImpl(buffer, start, stop, x, y); -// } -// } -// -// -// @Override -// public FontMetrics getFontMetrics(Font font) { -// return (g2 != null) ? g2.getFontMetrics(font) : super.getFontMetrics(font); -// } + ////////////////////////////////////////////////////////////// + + // TEXT ATTRIBTUES + + + protected FontCache fontCache = new FontCache(); + + // Is initialized when defaultFontOrDeath() is called + // and mirrors PGraphics.textFont field + protected FontInfo textFontInfo; + + + @Override + protected PFont createFont(String name, float size, + boolean smooth, char[] charset) { + PFont font = super.createFont(name, size, smooth, charset); + if (font.isStream()) { + fontCache.nameToFilename.put(font.getName(), name); + } + return font; + } + + + @Override + protected void defaultFontOrDeath(String method, float size) { + super.defaultFontOrDeath(method, size); + handleTextFont(textFont, size); + } + + + @Override + protected boolean textModeCheck(int mode) { + return mode == MODEL; + } + + + @Override + public float textAscent() { + if (textFont == null) { + defaultFontOrDeath("textAscent"); + } + if (textFontInfo.font == null) { + return super.textAscent(); + } + return textFontInfo.ascent; + } + + + @Override + public float textDescent() { + if (textFont == null) { + defaultFontOrDeath("textDescent"); + } + if (textFontInfo.font == null) { + return super.textDescent(); + } + return textFontInfo.descent; + } + + + static final class FontInfo { + // TODO: this should be based on memory consumption + // this should be enough e.g. for all grays and alpha combos + static final int MAX_CACHED_COLORS_PER_FONT = 1 << 16; + + // used only when there is native font + Font font; + float ascent; + float descent; + + // used only when there is no native font + // maps 32-bit color to the arrays of tinted glyph images + Map tintCache; + } + + + static final class FontCache { + static final int MAX_CACHE_SIZE = 512; + + // keeps track of filenames of fonts loaded from ttf and otf files + Map nameToFilename = new HashMap<>(); + + // keeps track of fonts which should be rendered as pictures + // so we don't go through native font search process every time + final HashSet nonNativeNames = new HashSet<>(); + + // keeps all created fonts for reuse up to MAX_CACHE_SIZE limit + // when the limit is reached, the least recently used font is removed + // TODO: this should be based on memory consumtion + final LinkedHashMap cache = + new LinkedHashMap(16, 0.75f, true) { + @Override + protected boolean removeEldestEntry(Map.Entry eldest) { + return size() > MAX_CACHE_SIZE; + } + }; + + // key for retrieving fonts from cache; don't use for insertion, + // every font has to have its own new Key instance + final Key retrievingKey = new Key(); + + // text node used for measuring sizes of text + final Text measuringText = new Text(); + + FontInfo get(String name, float size) { + if (nonNativeNames.contains(name)) { + // Don't have native font, using glyph images. + // Size is set to zero, because all sizes of this font + // should share one FontInfo with one tintCache. + size = 0; + } + retrievingKey.name = name; + retrievingKey.size = size; + return cache.get(retrievingKey); + } + + void put(String name, float size, FontInfo fontInfo) { + if (fontInfo.font == null) { + // Don't have native font, using glyph images. + // Size is set to zero, because all sizes of this font + // should share one FontInfo with one tintCache. + nonNativeNames.add(name); + size = 0; + } + Key key = new Key(); + key.name = name; + key.size = size; + cache.put(key, fontInfo); + } + + FontInfo createFontInfo(Font font) { + FontInfo result = new FontInfo(); + result.font = font; + if (font != null) { + // measure ascent and descent + measuringText.setFont(result.font); + measuringText.setText(" "); + float lineHeight = (float) measuringText.getLayoutBounds().getHeight(); + result.ascent = (float) measuringText.getBaselineOffset(); + result.descent = lineHeight - result.ascent; + } + return result; + } + + static final class Key { + String name; + float size; + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Key that = (Key) o; + if (Float.compare(that.size, size) != 0) return false; + return name.equals(that.name); + } + + @Override + public int hashCode() { + int result = name.hashCode(); + result = 31 * result + (size != +0.0f ? Float.floatToIntBits(size) : 0); + return result; + } + } + } + + + /////////////////////////////////////////////////////////////// + + // TEXT + + // None of the variations of text() are overridden from PGraphics. + + + + ////////////////////////////////////////////////////////////// + + // TEXT IMPL + + + @Override + protected void textFontImpl(PFont which, float size) { + handleTextFont(which, size); + handleTextSize(size); + } + + + @Override + protected void textSizeImpl(float size) { + handleTextFont(textFont, size); + handleTextSize(size); + } + + + /** + * FX specific. When setting font or size, new font has to + * be created. Both textFontImpl and textSizeImpl call this one. + * @param which font to be set, not null + * @param size size to be set, greater than zero + */ + protected void handleTextFont(PFont which, float size) { + textFont = which; + + String fontName = which.getName(); + String fontPsName = which.getPostScriptName(); + + textFontInfo = fontCache.get(fontName, size); + if (textFontInfo == null) { + Font font = null; + + if (which.isStream()) { + // Load from ttf or otf file + String filename = fontCache.nameToFilename.get(fontName); + font = Font.loadFont(parent.createInput(filename), size); + } + + if (font == null) { + // Look up font name + font = new Font(fontName, size); + if (!fontName.equalsIgnoreCase(font.getName())) { + // Look up font postscript name + font = new Font(fontPsName, size); + if (!fontPsName.equalsIgnoreCase(font.getName())) { + font = null; // Done with it + } + } + } + + if (font == null && which.getNative() != null) { + // Ain't got nothing, but AWT has something, so glyph images are not + // going to be used for this font; go with the default font then + font = new Font(size); + } + + textFontInfo = fontCache.createFontInfo(font); + fontCache.put(fontName, size, textFontInfo); + } + + context.setFont(textFontInfo.font); + } + + + @Override + protected void textLineImpl(char[] buffer, int start, int stop, float x, float y) { + if (textFontInfo.font == null) { + super.textLineImpl(buffer, start, stop, x, y); + } else { + context.fillText(new String(buffer, start, stop - start), x, y); + } + } + + + protected PImage getTintedGlyphImage(PFont.Glyph glyph, int tintColor) { + if (textFontInfo.tintCache == null) { + textFontInfo.tintCache = new LinkedHashMap(16, 0.75f, true) { + @Override + protected boolean removeEldestEntry(Map.Entry eldest) { + return size() > FontInfo.MAX_CACHED_COLORS_PER_FONT; + } + }; + } + PImage[] tintedGlyphs = textFontInfo.tintCache.get(tintColor); + int index = glyph.index; + if (tintedGlyphs == null || tintedGlyphs.length <= index) { + PImage[] newArray = new PImage[textFont.getGlyphCount()]; + if (tintedGlyphs != null) { + System.arraycopy(tintedGlyphs, 0, newArray, 0, tintedGlyphs.length); + } + tintedGlyphs = newArray; + textFontInfo.tintCache.put(tintColor, tintedGlyphs); + } + PImage tintedGlyph = tintedGlyphs[index]; + if (tintedGlyph == null) { + tintedGlyph = glyph.image.copy(); + tintedGlyphs[index] = tintedGlyph; + } + return tintedGlyph; + } + + + @Override + protected void textCharImpl(char ch, float x, float y) { //, float z) { + PFont.Glyph glyph = textFont.getGlyph(ch); + if (glyph != null) { + if (textMode == MODEL) { + float high = glyph.height / (float) textFont.getSize(); + float bwidth = glyph.width / (float) textFont.getSize(); + float lextent = glyph.leftExtent / (float) textFont.getSize(); + float textent = glyph.topExtent / (float) textFont.getSize(); + + float x1 = x + lextent * textSize; + float y1 = y - textent * textSize; + float x2 = x1 + bwidth * textSize; + float y2 = y1 + high * textSize; + + PImage glyphImage = (fillColor == 0xFFFFFFFF) ? + glyph.image : getTintedGlyphImage(glyph, fillColor); + + textCharModelImpl(glyphImage, + x1, y1, x2, y2, + glyph.width, glyph.height); + } + } else if (ch != ' ' && ch != 127) { + showWarning("No glyph found for the " + ch + + " (\\u" + PApplet.hex(ch, 4) + ") character"); + } + } + + + @Override + protected float textWidthImpl(char[] buffer, int start, int stop) { + if (textFont == null) { + defaultFontOrDeath("textWidth"); + } + + if (textFontInfo.font == null) { + return super.textWidthImpl(buffer, start, stop); + } + + fontCache.measuringText.setFont(textFontInfo.font); + fontCache.measuringText.setText(new String(buffer, start, stop - start)); + return (float) fontCache.measuringText.getLayoutBounds().getWidth(); + } + ////////////////////////////////////////////////////////////// @@ -1404,7 +1623,7 @@ public void pushMatrix() { throw new RuntimeException("pushMatrix() cannot use push more than " + transformStack.length + " times"); } - context.getTransform(transformStack[transformCount]); + transformStack[transformCount] = context.getTransform(transformStack[transformCount]); transformCount++; } @@ -1437,7 +1656,7 @@ public void translate(float tx, float ty) { @Override public void rotate(float angle) { - context.rotate(PApplet.radians(angle)); + context.rotate(PApplet.degrees(angle)); } @@ -1729,6 +1948,12 @@ protected void strokeFromCalc() { } + protected boolean drawingThinLines() { + // align strokes to pixel centers when drawing thin lines + return stroke && strokeWeight == 1; + } + + ////////////////////////////////////////////////////////////// @@ -1806,15 +2031,26 @@ protected void fillFromCalc() { @Override public void backgroundImpl() { + + // if pixels are modified, we don't flush them (just mark them flushed) + // because they would be immediatelly overwritten by the background anyway + modified = false; + loaded = false; + + // Save drawing context (transform, fill, blend mode, etc.) + context.save(); + + // Reset transform to identity + context.setTransform(new Affine()); + // This only takes into account cases where this is the primary surface. // Not sure what we do with offscreen anyway. - Paint savedFill = context.getFill(); - BlendMode savedBlend = context.getGlobalBlendMode(); context.setFill(new Color(backgroundR, backgroundG, backgroundB, backgroundA)); context.setGlobalBlendMode(BlendMode.SRC_OVER); context.fillRect(0, 0, width, height); - context.setFill(savedFill); - context.setGlobalBlendMode(savedBlend); + + // Restore drawing context (transform, fill, blend mode, etc.) + context.restore(); } @@ -1908,180 +2144,90 @@ public void backgroundImpl() { @Override public void loadPixels() { -// pixelFactor = 2; - int wide = width * pixelDensity; - int high = height * pixelDensity; - - if ((pixels == null) || (pixels.length != wide*high)) { - pixels = new int[wide * high]; + if ((pixels == null) || (pixels.length != pixelWidth * pixelHeight)) { + pixels = new int[pixelWidth * pixelHeight]; + loaded = false; } -// WritableRaster raster = getRaster(); -// raster.getDataElements(0, 0, width, height, pixels); -// if (raster.getNumBands() == 3) { -// // Java won't set the high bits when RGB, returns 0 for alpha -// // https://github.com/processing/processing/issues/2030 -// for (int i = 0; i < pixels.length; i++) { -// pixels[i] = 0xff000000 | pixels[i]; -// } -// } - SnapshotParameters sp = new SnapshotParameters(); - if (pixelDensity == 2) { - sp.setTransform(Transform.scale(2, 2)); + if (!loaded) { + if (snapshotImage == null || + snapshotImage.getWidth() != pixelWidth || + snapshotImage.getHeight() != pixelHeight) { + snapshotImage = new WritableImage(pixelWidth, pixelHeight); + } + + SnapshotParameters sp = null; + if (pixelDensity != 1) { + sp = new SnapshotParameters(); + sp.setTransform(Transform.scale(pixelDensity, pixelDensity)); + } + snapshotImage = ((PSurfaceFX) surface).canvas.snapshot(sp, snapshotImage); + PixelReader pr = snapshotImage.getPixelReader(); + pr.getPixels(0, 0, pixelWidth, pixelHeight, argbFormat, pixels, 0, pixelWidth); + + loaded = true; + modified = false; } - WritableImage wi = ((PSurfaceFX) surface).canvas.snapshot(sp, null); - PixelReader pr = wi.getPixelReader(); - //pr.getPixels(0, 0, width, height, argbFormat, pixels, 0, width); - //pr.getPixels(0, 0, width*2, height*2, argbFormat, pixels, 0, width*2); - pr.getPixels(0, 0, wide, high, argbFormat, pixels, 0, wide); } -// /** -// * 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. -// */ -// @Override -// public void updatePixels(int x, int y, int c, int d) { -// //if ((x == 0) && (y == 0) && (c == width) && (d == height)) { -//// System.err.format("%d %d %d %d .. w/h = %d %d .. pw/ph = %d %d %n", x, y, c, d, width, height, pixelWidth, pixelHeight); -// if ((x != 0) || (y != 0) || (c != pixelWidth) || (d != pixelHeight)) { -// // Show a warning message, but continue anyway. -// showVariationWarning("updatePixels(x, y, w, h)"); -//// new Exception().printStackTrace(System.out); -// } -//// updatePixels(); -// if (pixels != null) { -// getRaster().setDataElements(0, 0, width, height, pixels); -// } -// modified = true; -// } -// -// -//// @Override -//// protected void updatePixelsImpl(int x, int y, int w, int h) { -//// super.updatePixelsImpl(x, y, w, h); -//// -//// if ((x != 0) || (y != 0) || (w != width) || (h != height)) { -//// // Show a warning message, but continue anyway. -//// showVariationWarning("updatePixels(x, y, w, h)"); -//// } -//// getRaster().setDataElements(0, 0, width, height, pixels); -//// } -// -// -// -// ////////////////////////////////////////////////////////////// -// -// // GET/SET -// -// -// static int getset[] = new int[1]; -// -// -// @Override -// 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) (useOffscreen && primarySurface ? offscreen : image)).getRaster(); -// WritableRaster raster = getRaster(); -// raster.getDataElements(x, y, getset); -// if (raster.getNumBands() == 3) { -// // https://github.com/processing/processing/issues/2030 -// return getset[0] | 0xff000000; -// } -// return getset[0]; -// } -// -// -// //public PImage get(int x, int y, int w, int h) -// -// -// @Override -// public PImage get() { -// return get(0, 0, width, height); -// } -// -// -// @Override -// protected void getImpl(int sourceX, int sourceY, -// int sourceWidth, int sourceHeight, -// PImage target, int targetX, int targetY) { -// // last parameter to getRGB() is the scan size of the *target* buffer -// //((BufferedImage) image).getRGB(x, y, w, h, output.pixels, 0, w); -//// WritableRaster raster = -//// ((BufferedImage) (useOffscreen && primarySurface ? offscreen : image)).getRaster(); -// WritableRaster raster = getRaster(); -// -// if (sourceWidth == target.width && sourceHeight == target.height) { -// raster.getDataElements(sourceX, sourceY, sourceWidth, sourceHeight, target.pixels); -// // https://github.com/processing/processing/issues/2030 -// if (raster.getNumBands() == 3) { -// target.filter(OPAQUE); -// } -// -// } else { -// // TODO optimize, incredibly inefficient to reallocate this much memory -// int[] temp = new int[sourceWidth * sourceHeight]; -// raster.getDataElements(sourceX, sourceY, sourceWidth, sourceHeight, temp); -// -// // Copy the temporary output pixels over to the outgoing image -// int sourceOffset = 0; -// int targetOffset = targetY*target.width + targetX; -// for (int y = 0; y < sourceHeight; y++) { -// if (raster.getNumBands() == 3) { -// for (int i = 0; i < sourceWidth; i++) { -// // Need to set the high bits for this feller -// // https://github.com/processing/processing/issues/2030 -// target.pixels[targetOffset + i] = 0xFF000000 | temp[sourceOffset + i]; -// } -// } else { -// System.arraycopy(temp, sourceOffset, target.pixels, targetOffset, sourceWidth); -// } -// sourceOffset += sourceWidth; -// targetOffset += target.width; -// } -// } -// } -// -// -// @Override -// 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) (useOffscreen && primarySurface ? offscreen : image)).getRaster(); -//// WritableRaster raster = image.getRaster(); -// getRaster().setDataElements(x, y, getset); -// } -// -// -// //public void set(int x, int y, PImage img) -// -// -// @Override -// protected void setImpl(PImage sourceImage, -// int sourceX, int sourceY, -// int sourceWidth, int sourceHeight, -// int targetX, int targetY) { -// WritableRaster raster = getRaster(); -//// ((BufferedImage) (useOffscreen && primarySurface ? offscreen : image)).getRaster(); -// -// if ((sourceX == 0) && (sourceY == 0) && -// (sourceWidth == sourceImage.width) && -// (sourceHeight == sourceImage.height)) { -// raster.setDataElements(targetX, targetY, -// sourceImage.width, sourceImage.height, -// sourceImage.pixels); -// } else { -// // TODO optimize, incredibly inefficient to reallocate this much memory -// PImage temp = sourceImage.get(sourceX, sourceY, sourceWidth, sourceHeight); -// raster.setDataElements(targetX, targetY, temp.width, temp.height, temp.pixels); -// } -// } + ////////////////////////////////////////////////////////////// + + // GET/SET PIXELS + + + @Override + public int get(int x, int y) { + loadPixels(); + return super.get(x, y); + } + + + @Override + protected void getImpl(int sourceX, int sourceY, + int sourceWidth, int sourceHeight, + PImage target, int targetX, int targetY) { + loadPixels(); + super.getImpl(sourceX, sourceY, sourceWidth, sourceHeight, + target, targetX, targetY); + } + + + @Override + public void set(int x, int y, int argb) { + loadPixels(); + super.set(x, y, argb); + } + + + @Override + protected void setImpl(PImage sourceImage, + int sourceX, int sourceY, + int sourceWidth, int sourceHeight, + int targetX, int targetY) { + sourceImage.loadPixels(); + + int sourceOffset = sourceX + sourceImage.pixelWidth * sourceY; + + PixelWriter pw = context.getPixelWriter(); + pw.setPixels(targetX, targetY, sourceWidth, sourceHeight, + argbFormat, + sourceImage.pixels, + sourceOffset, + sourceImage.pixelWidth); + + // Let's keep them loaded + if (loaded) { + int sourceStride = sourceImage.pixelWidth; + int targetStride = pixelWidth; + int targetOffset = targetX + targetY * targetStride; + for (int i = 0; i < sourceHeight; i++) { + System.arraycopy(sourceImage.pixels, sourceOffset + i * sourceStride, + pixels, targetOffset + i * targetStride, sourceWidth); + } + } + } ////////////////////////////////////////////////////////////// diff --git a/core/src/processing/javafx/PSurfaceFX.java b/core/src/processing/javafx/PSurfaceFX.java index 7e5e1c6b9f..4061f36fca 100644 --- a/core/src/processing/javafx/PSurfaceFX.java +++ b/core/src/processing/javafx/PSurfaceFX.java @@ -22,34 +22,45 @@ package processing.javafx; -//import java.awt.event.FocusEvent; -//import java.awt.event.FocusListener; -//import java.awt.event.KeyListener; -//import java.awt.event.MouseListener; -//import java.awt.event.MouseMotionListener; -//import java.awt.event.MouseWheelEvent; -//import java.awt.event.MouseWheelListener; +import com.sun.glass.ui.Screen; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Rectangle; +import java.net.URL; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.concurrent.SynchronousQueue; -import javafx.animation.AnimationTimer; +import javafx.animation.Animation; +import javafx.animation.KeyFrame; +import javafx.animation.Timeline; import javafx.application.Application; import javafx.application.Platform; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; +import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.event.EventType; +import javafx.scene.Cursor; +import javafx.scene.ImageCursor; import javafx.scene.Scene; +import javafx.scene.SceneAntialiasing; import javafx.scene.canvas.Canvas; +import javafx.scene.image.Image; +import javafx.scene.image.PixelFormat; +import javafx.scene.image.WritableImage; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import javafx.scene.input.MouseEvent; import javafx.scene.input.ScrollEvent; import javafx.scene.layout.StackPane; import javafx.stage.Stage; +import javafx.stage.StageStyle; import javafx.stage.WindowEvent; - +import javafx.util.Duration; import processing.core.*; @@ -60,13 +71,55 @@ public class PSurfaceFX implements PSurface { Stage stage; Canvas canvas; - AnimationTimer timer; + final Animation animation; + float frameRate = 60; + private SynchronousQueue drawExceptionQueue = new SynchronousQueue<>(); public PSurfaceFX(PGraphicsFX2D graphics) { fx = graphics; canvas = new ResizableCanvas(); - fx.context = canvas.getGraphicsContext2D(); + + // set up main drawing loop + KeyFrame keyFrame = new KeyFrame(Duration.millis(1000), + new EventHandler() { + public void handle(ActionEvent event) { + long startNanoTime = System.nanoTime(); + try { + sketch.handleDraw(); + } catch (Throwable e) { + // Let exception handler thread crash with our exception + drawExceptionQueue.offer(e); + // Stop animating right now so nothing runs afterwards + // and crash frame can be for example traced by println() + animation.stop(); + return; + } + long drawNanos = System.nanoTime() - startNanoTime; + + if (sketch.exitCalled()) { + // using Platform.runLater() didn't work +// Platform.runLater(new Runnable() { +// public void run() { + // instead of System.exit(), safely shut down JavaFX this way + Platform.exit(); +// } +// }); + } + if (sketch.frameCount > 5) { + animation.setRate(-PApplet.min(1e9f / drawNanos, frameRate)); + } + } + }); + animation = new Timeline(keyFrame); + animation.setCycleCount(Animation.INDEFINITE); + + // key frame has duration of 1 second, so the rate of the animation + // should be set to frames per second + + // setting rate to negative so that event fires at the start of + // the key frame and first frame is drawn immediately + animation.setRate(-frameRate); } @@ -191,24 +244,122 @@ public void start(final Stage stage) { // stage.setTitle(title); // } + PApplet sketch = surface.sketch; + + float renderScale = Screen.getMainScreen().getRenderScale(); + if (PApplet.platform == PConstants.MACOSX) { + for (Screen s : Screen.getScreens()) { + renderScale = Math.max(renderScale, s.getRenderScale()); + } + } + float uiScale = Screen.getMainScreen().getUIScale(); + if (sketch.pixelDensity == 2 && renderScale < 2) { + sketch.pixelDensity = 1; + sketch.g.pixelDensity = 1; + System.err.println("pixelDensity(2) is not available for this display"); + } + + // Use AWT display code, because FX orders screens in different way + GraphicsDevice displayDevice = null; + + GraphicsEnvironment environment = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + + int displayNum = sketch.sketchDisplay(); + if (displayNum > 0) { // if -1, use the default device + GraphicsDevice[] devices = environment.getScreenDevices(); + if (displayNum <= devices.length) { + displayDevice = devices[displayNum - 1]; + } else { + System.err.format("Display %d does not exist, " + + "using the default display instead.%n", displayNum); + for (int i = 0; i < devices.length; i++) { + System.err.format("Display %d is %s%n", (i+1), devices[i]); + } + } + } + if (displayDevice == null) { + displayDevice = environment.getDefaultScreenDevice(); + } + + boolean fullScreen = sketch.sketchFullScreen(); + boolean spanDisplays = sketch.sketchDisplay() == PConstants.SPAN; + + Rectangle primaryScreenRect = displayDevice.getDefaultConfiguration().getBounds(); + Rectangle screenRect = primaryScreenRect; + if (fullScreen || spanDisplays) { + double minX = screenRect.getMinX(); + double maxX = screenRect.getMaxX(); + double minY = screenRect.getMinY(); + double maxY = screenRect.getMaxY(); + if (spanDisplays) { + for (GraphicsDevice s : environment.getScreenDevices()) { + Rectangle bounds = s.getDefaultConfiguration().getBounds(); + minX = Math.min(minX, bounds.getMinX()); + maxX = Math.max(maxX, bounds.getMaxX()); + minY = Math.min(minY, bounds.getMinY()); + maxY = Math.max(maxY, bounds.getMaxY()); + } + } + screenRect = new Rectangle((int) minX, (int) minY, + (int) (maxX - minX), (int) (maxY - minY)); + } + + // Set the displayWidth/Height variables inside PApplet, so that they're + // usable and can even be returned by the sketchWidth()/Height() methods. + sketch.displayWidth = (int) screenRect.getWidth(); + sketch.displayHeight = (int) screenRect.getHeight(); + + int sketchWidth = sketch.sketchWidth(); + int sketchHeight = sketch.sketchHeight(); + + if (fullScreen || spanDisplays) { + sketchWidth = (int) (screenRect.getWidth() / uiScale); + sketchHeight = (int) (screenRect.getHeight() / uiScale); + + stage.initStyle(StageStyle.UNDECORATED); + stage.setX(screenRect.getMinX() / uiScale); + stage.setY(screenRect.getMinY() / uiScale); + stage.setWidth(screenRect.getWidth() / uiScale); + stage.setHeight(screenRect.getHeight() / uiScale); + } + Canvas canvas = surface.canvas; + surface.fx.context = canvas.getGraphicsContext2D(); StackPane stackPane = new StackPane(); stackPane.getChildren().add(canvas); canvas.widthProperty().bind(stackPane.widthProperty()); canvas.heightProperty().bind(stackPane.heightProperty()); - PApplet sketch = surface.sketch; - int width = sketch.sketchWidth(); - int height = sketch.sketchHeight(); + int width = sketchWidth; + int height = sketchHeight; + int smooth = sketch.sketchSmooth(); + + // Workaround for https://bugs.openjdk.java.net/browse/JDK-8136495 + // https://github.com/processing/processing/issues/3823 + if ((PApplet.platform == PConstants.MACOSX || + PApplet.platform == PConstants.LINUX) && + PApplet.javaVersionName.compareTo("1.8.0_60") >= 0 && + PApplet.javaVersionName.compareTo("1.8.0_72") < 0) { + System.err.println("smooth() disabled for JavaFX with this Java version due to Oracle bug"); + System.err.println("https://github.com/processing/processing/issues/3795"); + smooth = 0; + } + + SceneAntialiasing sceneAntialiasing = (smooth == 0) ? + SceneAntialiasing.DISABLED : SceneAntialiasing.BALANCED; - //stage.setScene(new Scene(new Group(canvas))); - stage.setScene(new Scene(stackPane, width, height)); - //stage.show(); // move to setVisible(true)? + stage.setScene(new Scene(stackPane, width, height, false, sceneAntialiasing)); // initFrame in different thread is waiting for // the stage, assign it only when it is all set up surface.stage = stage; } + + @Override + public void stop() throws Exception { + surface.sketch.dispose(); + } } @@ -232,6 +383,38 @@ public void run() { Thread.sleep(5); } catch (InterruptedException e) { } } + + startExceptionHandlerThread(); + + setProcessingIcon(stage); + } + + + private void startExceptionHandlerThread() { + Thread exceptionHandlerThread = new Thread(() -> { + Throwable drawException; + try { + drawException = drawExceptionQueue.take(); + } catch (InterruptedException e) { + return; + } + // Adapted from PSurfaceJOGL + if (drawException != null) { + if (drawException instanceof ThreadDeath) { +// System.out.println("caught ThreadDeath"); +// throw (ThreadDeath)cause; + } else if (drawException instanceof RuntimeException) { + throw (RuntimeException) drawException; + } else if (drawException instanceof UnsatisfiedLinkError) { + throw new UnsatisfiedLinkError(drawException.getMessage()); + } else { + throw new RuntimeException(drawException); + } + } + }); + exceptionHandlerThread.setDaemon(true); + exceptionHandlerThread.setName("Processing-FX-ExceptionHandler"); + exceptionHandlerThread.start(); } @@ -246,11 +429,15 @@ public void setTitle(String title) { /** Show or hide the window. */ @Override - public void setVisible(boolean visible) { + public void setVisible(final boolean visible) { Platform.runLater(new Runnable() { public void run() { - stage.show(); - canvas.requestFocus(); + if (visible) { + stage.show(); + canvas.requestFocus(); + } else { + stage.hide(); + } } }); } @@ -266,7 +453,48 @@ public void setResizable(boolean resizable) { public void setIcon(PImage icon) { - // TODO implement this in JavaFX + int w = icon.pixelWidth; + int h = icon.pixelHeight; + WritableImage im = new WritableImage(w, h); + im.getPixelWriter().setPixels(0, 0, w, h, + PixelFormat.getIntArgbInstance(), + icon.pixels, + 0, w); + + Stage stage = (Stage) canvas.getScene().getWindow(); + stage.getIcons().clear(); + stage.getIcons().add(im); + } + + + List iconImages; + + protected void setProcessingIcon(Stage stage) { + // Adapted from PSurfaceAWT + // Note: FX chooses wrong icon size, should be fixed in Java 9, see: + // https://bugs.openjdk.java.net/browse/JDK-8091186 + // Removing smaller sizes helps a bit, but big ones are downsized + try { + if (iconImages == null) { + iconImages = new ArrayList<>(); + final int[] sizes = { 48, 64, 128, 256, 512 }; + + for (int sz : sizes) { + URL url = PApplet.class.getResource("/icon/icon-" + sz + ".png"); + Image image = new Image(url.toString()); + iconImages.add(image); + } + } + List icons = stage.getIcons(); + icons.clear(); + icons.addAll(iconImages); + } catch (Exception e) { } // harmless; keep this to ourselves + } + + + @Override + public void setAlwaysOnTop(boolean always) { + stage.setAlwaysOnTop(always); } @@ -316,10 +544,13 @@ public void placeWindow(int[] location) { @Override public void placeWindow(int[] location, int[] editorLocation) { - //Dimension window = setFrameSize(); + if (sketch.sketchFullScreen()) { + PApplet.hideMenuBar(); + return; + } -// int contentW = Math.max(sketchWidth, MIN_WINDOW_WIDTH); -// int contentH = Math.max(sketchHeight, MIN_WINDOW_HEIGHT); + int wide = sketch.width; // stage.getWidth() is NaN here + //int high = sketch.height; // stage.getHeight() if (location != null) { // a specific location was received from the Runner @@ -331,46 +562,16 @@ public void placeWindow(int[] location, int[] editorLocation) { int locationX = editorLocation[0] - 20; int locationY = editorLocation[1]; - if (locationX - stage.getWidth() > 10) { + if (locationX - wide > 10) { // if it fits to the left of the window - stage.setX(locationX - stage.getWidth()); + stage.setX(locationX - wide); stage.setY(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 + stage.getWidth() > sketch.displayWidth - 33) || - (locationY + stage.getHeight() > sketch.displayHeight - 33)) { - // otherwise center on screen - locationX = (int) ((sketch.displayWidth - stage.getWidth()) / 2); - locationY = (int) ((sketch.displayHeight - stage.getHeight()) / 2); - } - stage.setX(locationX); - stage.setY(locationY); + stage.centerOnScreen(); } } else { // just center on screen - //setFrameCentered(); - } - if (stage.getY() < 0) { - // Windows actually allows you to place frames where they can't be - // closed. Awesome. http://dev.processing.org/bugs/show_bug.cgi?id=1508 - //frame.setLocation(frameLoc.x, 30); - stage.setY(30); - } - - //canvas.setBounds((contentW - sketchWidth)/2, - // (contentH - sketchHeight)/2, - // sketchWidth, sketchHeight); - - // handle frame resizing events - //setupFrameResizeListener(); - - if (sketch.getGraphics().displayable()) { - setVisible(true); + stage.centerOnScreen(); } } @@ -379,6 +580,7 @@ public void placeWindow(int[] location, int[] editorLocation) { // http://download.java.net/jdk8/jfxdocs/javafx/stage/Stage.html#setFullScreenExitKeyCombination-javafx.scene.input.KeyCombination- public void placePresent(int stopColor) { // TODO Auto-generated method stub + PApplet.hideMenuBar(); } @@ -414,14 +616,24 @@ public void setLocation(int x, int y) { } - public void setSize(int width, int height) { + public void setSize(int wide, int high) { + // When the surface is set to resizable via surface.setResizable(true), + // a crash may occur if the user sets the window to size zero. + // https://github.com/processing/processing/issues/5052 + if (high <= 0) { + high = 1; + } + if (wide <= 0) { + wide = 1; + } + //System.out.format("%s.setSize(%d, %d)%n", getClass().getSimpleName(), width, height); Scene scene = stage.getScene(); double decorH = stage.getWidth() - scene.getWidth(); double decorV = stage.getHeight() - scene.getHeight(); - stage.setWidth(width + decorH); - stage.setHeight(height + decorV); - fx.setSize(width, height); + stage.setWidth(wide + decorH); + stage.setHeight(high + decorV); + fx.setSize(wide, high); } @@ -437,8 +649,12 @@ public void setSmooth(int level) { public void setFrameRate(float fps) { - // TODO Auto-generated method stub - + // setting rate to negative so that event fires at the start of + // the key frame and first frame is drawn immediately + if (fps > 0) { + frameRate = fps; + animation.setRate(-frameRate); + } } @@ -447,70 +663,71 @@ public void setFrameRate(float fps) { // canvas.requestFocus(); // } + Cursor lastCursor = Cursor.DEFAULT; public void setCursor(int kind) { - // TODO Auto-generated method stub - + Cursor c; + switch (kind) { + case PConstants.ARROW: c = Cursor.DEFAULT; break; + case PConstants.CROSS: c = Cursor.CROSSHAIR; break; + case PConstants.HAND: c = Cursor.HAND; break; + case PConstants.MOVE: c = Cursor.MOVE; break; + case PConstants.TEXT: c = Cursor.TEXT; break; + case PConstants.WAIT: c = Cursor.WAIT; break; + default: c = Cursor.DEFAULT; break; + } + lastCursor = c; + canvas.getScene().setCursor(c); } public void setCursor(PImage image, int hotspotX, int hotspotY) { - // TODO Auto-generated method stub - + int w = image.pixelWidth; + int h = image.pixelHeight; + WritableImage im = new WritableImage(w, h); + im.getPixelWriter().setPixels(0, 0, w, h, + PixelFormat.getIntArgbInstance(), + image.pixels, + 0, w); + ImageCursor c = new ImageCursor(im, hotspotX, hotspotY); + lastCursor = c; + canvas.getScene().setCursor(c); } public void showCursor() { - // TODO Auto-generated method stub - + canvas.getScene().setCursor(lastCursor); } public void hideCursor() { - // TODO Auto-generated method stub - + canvas.getScene().setCursor(Cursor.NONE); } public void startThread() { - if (timer == null) { - timer = new AnimationTimer() { - - @Override - public void handle(long now) { - //System.out.println("handle(" + now + ") calling handleDraw()"); - sketch.handleDraw(); - - if (sketch.exitCalled()) { - //sketch.exitActual(); // just calls System.exit() - Platform.exit(); // version for safe JavaFX shutdown - } - } - }; - timer.start(); - } + animation.play(); } public void pauseThread() { - // TODO Auto-generated method stub + animation.pause(); } public void resumeThread() { - // TODO Auto-generated method stub + animation.play(); } public boolean stopThread() { - // TODO Auto-generated method stub - return false; + animation.stop(); + return true; } public boolean isStopped() { - // TODO Auto-generated method stub - return false; + return animation.getStatus() == Animation.Status.STOPPED; } @@ -612,11 +829,6 @@ protected void fxMouseEvent(MouseEvent fxEvent) { int count = fxEvent.getClickCount(); int action = mouseMap.get(fxEvent.getEventType()); - //EventType et = nativeEvent.getEventType(); -// if (et == MouseEvent.MOUSE_PRESSED) { -// peAction = processing.event.MouseEvent.PRESS; -// } else if (et == MouseEvent.MOUSE_RELEASED) { -// peAction = processing.event.MouseEvent.RELEASE; int modifiers = 0; if (fxEvent.isShiftDown()) { @@ -633,20 +845,19 @@ protected void fxMouseEvent(MouseEvent fxEvent) { } int button = 0; - if (fxEvent.isPrimaryButtonDown()) { - button = PConstants.LEFT; - } else if (fxEvent.isSecondaryButtonDown()) { - button = PConstants.RIGHT; - } else if (fxEvent.isMiddleButtonDown()) { - button = PConstants.CENTER; - } - - // If running on Mac OS, allow ctrl-click as right mouse. - // Verified to be necessary with Java 8u45. - if (PApplet.platform == PConstants.MACOSX && - fxEvent.isControlDown() && - button == PConstants.LEFT) { - button = PConstants.RIGHT; + switch (fxEvent.getButton()) { + case PRIMARY: + button = PConstants.LEFT; + break; + case SECONDARY: + button = PConstants.RIGHT; + break; + case MIDDLE: + button = PConstants.CENTER; + break; + case NONE: + // not currently handled + break; } //long when = nativeEvent.getWhen(); // from AWT @@ -659,27 +870,40 @@ protected void fxMouseEvent(MouseEvent fxEvent) { x, y, button, count)); } + // https://docs.oracle.com/javase/8/javafx/api/javafx/scene/input/ScrollEvent.html + protected void fxScrollEvent(ScrollEvent fxEvent) { + // the number of steps/clicks on the wheel for a mouse wheel event. + int count = (int) -(fxEvent.getDeltaY() / fxEvent.getMultiplierY()); - // https://docs.oracle.com/javafx/2/api/javafx/scene/input/ScrollEvent.html - protected void fxScrollEvent(ScrollEvent event) { -// //case java.awt.event.MouseWheelEvent.WHEEL_UNIT_SCROLL: -// case java.awt.event.MouseEvent.MOUSE_WHEEL: -// peAction = MouseEvent.WHEEL; -// /* -// if (preciseWheelMethod != null) { -// try { -// peAmount = ((Double) preciseWheelMethod.invoke(nativeEvent, (Object[]) null)).floatValue(); -// } catch (Exception e) { -// preciseWheelMethod = null; -// } -// } -// */ -// peCount = ((MouseWheelEvent) nativeEvent).getWheelRotation(); -// break; + int action = processing.event.MouseEvent.WHEEL; + + int modifiers = 0; + if (fxEvent.isShiftDown()) { + modifiers |= processing.event.Event.SHIFT; + } + if (fxEvent.isControlDown()) { + modifiers |= processing.event.Event.CTRL; + } + if (fxEvent.isMetaDown()) { + modifiers |= processing.event.Event.META; + } + if (fxEvent.isAltDown()) { + modifiers |= processing.event.Event.ALT; + } + + // FX does not supply button info + int button = 0; + + long when = System.currentTimeMillis(); + int x = (int) fxEvent.getX(); // getSceneX()? + int y = (int) fxEvent.getY(); + + sketch.postEvent(new processing.event.MouseEvent(fxEvent, when, + action, modifiers, + x, y, button, count)); } - @SuppressWarnings("deprecation") protected void fxKeyEvent(javafx.scene.input.KeyEvent fxEvent) { int action = 0; EventType et = fxEvent.getEventType(); @@ -706,12 +930,132 @@ protected void fxKeyEvent(javafx.scene.input.KeyEvent fxEvent) { } long when = System.currentTimeMillis(); - KeyCode kc = fxEvent.getCode(); - // Are they f*ing serious? - char key = kc.impl_getChar().charAt(0); - int keyCode = kc.impl_getCode(); + + char keyChar = getKeyChar(fxEvent); + int keyCode = getKeyCode(fxEvent); sketch.postEvent(new processing.event.KeyEvent(fxEvent, when, action, modifiers, - key, keyCode)); + keyChar, keyCode)); + } + + + @SuppressWarnings("deprecation") + private int getKeyCode(KeyEvent fxEvent) { + if (fxEvent.getEventType() == KeyEvent.KEY_TYPED) { + return 0; + } + + KeyCode kc = fxEvent.getCode(); + switch (kc) { + case ALT_GRAPH: + return PConstants.ALT; + default: + break; + } + return kc.impl_getCode(); + } + + + @SuppressWarnings("deprecation") + private char getKeyChar(KeyEvent fxEvent) { + KeyCode kc = fxEvent.getCode(); + + // Overriding chars for some + // KEY_PRESSED and KEY_RELEASED events + switch (kc) { + case UP: + case KP_UP: + case DOWN: + case KP_DOWN: + case LEFT: + case KP_LEFT: + case RIGHT: + case KP_RIGHT: + case ALT: + case ALT_GRAPH: + case CONTROL: + case SHIFT: + case CAPS: + case META: + case WINDOWS: + case CONTEXT_MENU: + case HOME: + case PAGE_UP: + case PAGE_DOWN: + case END: + case PAUSE: + case PRINTSCREEN: + case INSERT: + case NUM_LOCK: + case SCROLL_LOCK: + case F1: + case F2: + case F3: + case F4: + case F5: + case F6: + case F7: + case F8: + case F9: + case F10: + case F11: + case F12: + return PConstants.CODED; + case ENTER: + return '\n'; + case DIVIDE: + return '/'; + case MULTIPLY: + return '*'; + case SUBTRACT: + return '-'; + case ADD: + return '+'; + case NUMPAD0: + return '0'; + case NUMPAD1: + return '1'; + case NUMPAD2: + return '2'; + case NUMPAD3: + return '3'; + case NUMPAD4: + return '4'; + case NUMPAD5: + return '5'; + case NUMPAD6: + return '6'; + case NUMPAD7: + return '7'; + case NUMPAD8: + return '8'; + case NUMPAD9: + return '9'; + case DECIMAL: + // KEY_TYPED does not go through here and will produce + // dot or comma based on the keyboard layout. + // For KEY_PRESSED and KEY_RELEASED, let's just go with + // the dot. Users can detect the key by its keyCode. + return '.'; + case UNDEFINED: + // KEY_TYPED has KeyCode: UNDEFINED + // and falls through here + break; + default: + break; + } + + // Just go with what FX gives us for the rest of + // KEY_PRESSED and KEY_RELEASED and all of KEY_TYPED + String ch; + if (fxEvent.getEventType() == KeyEvent.KEY_TYPED) { + ch = fxEvent.getCharacter(); + } else { + ch = kc.impl_getChar(); + } + + if (ch.length() < 1) return PConstants.CODED; + if (ch.startsWith("\r")) return '\n'; // normalize enter key + return ch.charAt(0); } -} \ No newline at end of file +} diff --git a/core/src/processing/opengl/FontTexture.java b/core/src/processing/opengl/FontTexture.java index 950e2f0c08..af28ad9f32 100644 --- a/core/src/processing/opengl/FontTexture.java +++ b/core/src/processing/opengl/FontTexture.java @@ -3,12 +3,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -58,12 +59,10 @@ class FontTexture implements PConstants { protected int lineHeight; protected Texture[] textures = null; protected PImage[] images = null; - protected int currentTex; protected int lastTex; protected TextureInfo[] glyphTexinfos; protected HashMap texinfoMap; - public FontTexture(PGraphicsOpenGL pg, PFont font, boolean is3D) { pgl = pg.pgl; this.is3D = is3D; @@ -86,7 +85,6 @@ protected void dispose() { protected void initTexture(PGraphicsOpenGL pg, PFont font) { - currentTex = -1; lastTex = -1; int spow = PGL.nextPowerOfTwo(font.getSize()); @@ -117,10 +115,10 @@ public boolean addTexture(PGraphicsOpenGL pg) { boolean resize; w = maxSize; - if (-1 < currentTex && textures[currentTex].glHeight < maxSize) { + if (-1 < lastTex && textures[lastTex].glHeight < maxSize) { // The height of the current texture is less than the maximum, this // means we can replace it with a larger texture. - h = PApplet.min(2 * textures[currentTex].glHeight, maxSize); + h = PApplet.min(2 * textures[lastTex].glHeight, maxSize); resize = true; } else { h = minSize; @@ -147,38 +145,31 @@ public boolean addTexture(PGraphicsOpenGL pg) { textures[0] = tex; images = new PImage[1]; images[0] = pg.wrapTexture(tex); - currentTex = 0; + lastTex = 0; } else if (resize) { // Replacing old smaller texture with larger one. // But first we must copy the contents of the older - // texture into the new one. Setting blend mode to - // REPLACE to preserve color of transparent pixels. - Texture tex0 = textures[currentTex]; - - tex.pg.pushStyle(); - tex.pg.blendMode(REPLACE); + // texture into the new one. + Texture tex0 = textures[lastTex]; tex.put(tex0); - tex.pg.popStyle(); + textures[lastTex] = tex; - textures[currentTex] = tex; - - pg.setCache(images[currentTex], tex); - images[currentTex].width = tex.width; - images[currentTex].height = tex.height; + pg.setCache(images[lastTex], tex); + images[lastTex].width = tex.width; + images[lastTex].height = tex.height; } else { // Adding new texture to the list. - Texture[] tempTex = textures; - textures = new Texture[textures.length + 1]; - PApplet.arrayCopy(tempTex, textures, tempTex.length); - textures[tempTex.length] = tex; - currentTex = textures.length - 1; - - PImage[] tempImg = images; - images = new PImage[textures.length]; - PApplet.arrayCopy(tempImg, images, tempImg.length); - images[tempImg.length] = pg.wrapTexture(tex); + lastTex = textures.length; + Texture[] tempTex = new Texture[lastTex + 1]; + PApplet.arrayCopy(textures, tempTex, textures.length); + tempTex[lastTex] = tex; + textures = tempTex; + + PImage[] tempImg = new PImage[textures.length]; + PApplet.arrayCopy(images, tempImg, images.length); + tempImg[lastTex] = pg.wrapTexture(tex); + images = tempImg; } - lastTex = currentTex; // Make sure that the current texture is bound. tex.bind(); @@ -188,7 +179,6 @@ public boolean addTexture(PGraphicsOpenGL pg) { public void begin() { - setTexture(0); } @@ -199,23 +189,8 @@ public void end() { } - public void setTexture(int idx) { - if (0 <= idx && idx < textures.length) { - currentTex = idx; - } - } - - - public PImage getTexture(int idx) { - if (0 <= idx && idx < images.length) { - return images[idx]; - } - return null; - } - - - public PImage getCurrentTexture() { - return getTexture(currentTex); + public PImage getTexture(TextureInfo info) { + return images[info.texIndex]; } @@ -232,7 +207,7 @@ public void updateGlyphsTexCoords() { // loop over current glyphs. for (int i = 0; i < glyphTexinfos.length; i++) { TextureInfo tinfo = glyphTexinfos[i]; - if (tinfo != null && tinfo.texIndex == currentTex) { + if (tinfo != null && tinfo.texIndex == lastTex) { tinfo.updateUV(); } } @@ -265,14 +240,19 @@ public boolean contextIsOutdated() { if (outdated) { for (int i = 0; i < textures.length; i++) { textures[i].dispose(); -// PGraphicsOpenGL.removeTextureObject(textures[i].glName, -// textures[i].context); -// textures[i].glName = 0; } } return outdated; } +// public void draw() { +// Texture tex = textures[lastTex]; +// pgl.drawTexture(tex.glTarget, tex.glName, +// tex.glWidth, tex.glHeight, +// 0, 0, tex.glWidth, tex.glHeight); +// } + + // Adds this glyph to the opengl texture in PFont. protected void addToTexture(PGraphicsOpenGL pg, int idx, PFont.Glyph glyph) { // We add one pixel to avoid issues when sampling the font texture at @@ -316,16 +296,15 @@ protected void addToTexture(PGraphicsOpenGL pg, int idx, PFont.Glyph glyph) { } // Is there room for this glyph in the current line? - if (offsetX + w > textures[currentTex].glWidth) { + if (offsetX + w > textures[lastTex].glWidth) { // No room, go to the next line: offsetX = 0; offsetY += lineHeight; - lineHeight = 0; } lineHeight = Math.max(lineHeight, h); boolean resized = false; - if (offsetY + lineHeight > textures[currentTex].glHeight) { + if (offsetY + lineHeight > textures[lastTex].glHeight) { // We run out of space in the current texture, so we add a new texture: resized = addTexture(pg); if (resized) { @@ -341,8 +320,7 @@ protected void addToTexture(PGraphicsOpenGL pg, int idx, PFont.Glyph glyph) { } } - TextureInfo tinfo = new TextureInfo(currentTex, offsetX, offsetY, - w, h, rgba); + TextureInfo tinfo = new TextureInfo(lastTex, offsetX, offsetY, w, h, rgba); offsetX += w; if (idx == glyphTexinfos.length) { @@ -385,6 +363,7 @@ class TextureInfo { void updateUV() { width = textures[texIndex].glWidth; height = textures[texIndex].glHeight; + u0 = (float)crop[0] / (float)width; u1 = u0 + (float)crop[2] / (float)width; v0 = (float)(crop[1] + crop[3]) / (float)height; diff --git a/core/src/processing/opengl/FrameBuffer.java b/core/src/processing/opengl/FrameBuffer.java index 31d50f5592..e2992be682 100644 --- a/core/src/processing/opengl/FrameBuffer.java +++ b/core/src/processing/opengl/FrameBuffer.java @@ -3,12 +3,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,6 +26,7 @@ import processing.core.PApplet; import processing.core.PConstants; +import processing.opengl.PGraphicsOpenGL.GLResourceFrameBuffer; import java.nio.IntBuffer; @@ -51,6 +53,7 @@ public class FrameBuffer implements PConstants { public int glMultisample; public int width; public int height; + private GLResourceFrameBuffer glres; protected int depthBits; protected int stencilBits; @@ -148,31 +151,6 @@ public class FrameBuffer implements PConstants { } - @Override - protected void finalize() throws Throwable { - try { - if (!screenFb) { - if (glFbo != 0) { - PGraphicsOpenGL.finalizeFrameBufferObject(glFbo, context); - } - if (glDepth != 0) { - PGraphicsOpenGL.finalizeRenderBufferObject(glDepth, context); - } - if (glStencil != 0) { - PGraphicsOpenGL.finalizeRenderBufferObject(glStencil, context); - } - if (glMultisample != 0) { - PGraphicsOpenGL.finalizeRenderBufferObject(glMultisample, context); - } - if (glDepthStencil != 0) { - PGraphicsOpenGL.finalizeRenderBufferObject(glDepthStencil, context); - } - } - } finally { - super.finalize(); - } - } - public void clear() { pg.pushFramebuffer(); pg.setFramebuffer(this); @@ -353,26 +331,23 @@ protected void allocate() { dispose(); // Just in the case this object is being re-allocated. context = pgl.getCurrentContext(); + glres = new GLResourceFrameBuffer(this); // create the FBO resources... if (screenFb) { glFbo = 0; } else { - //create the FBO object... - glFbo = PGraphicsOpenGL.createFrameBufferObject(context, pgl); - - // ... and then create the rest of the stuff. if (multisample) { - createColorBufferMultisample(); + initColorBufferMultisample(); } if (packedDepthStencil) { - createPackedDepthStencilBuffer(); + initPackedDepthStencilBuffer(); } else { if (0 < depthBits) { - createDepthBuffer(); + initDepthBuffer(); } if (0 < stencilBits) { - createStencilBuffer(); + initStencilBuffer(); } } } @@ -381,26 +356,14 @@ protected void allocate() { protected void dispose() { if (screenFb) return; - - if (glFbo != 0) { - PGraphicsOpenGL.finalizeFrameBufferObject(glFbo, context); + if (glres != null) { + glres.dispose(); glFbo = 0; - } - if (glDepth != 0) { - PGraphicsOpenGL.finalizeRenderBufferObject(glDepth, context); glDepth = 0; - } - if (glStencil != 0) { - PGraphicsOpenGL.finalizeRenderBufferObject(glStencil, context); glStencil = 0; - } - if (glMultisample != 0) { - PGraphicsOpenGL.finalizeRenderBufferObject(glMultisample, context); glMultisample = 0; - } - if (glDepthStencil != 0) { - PGraphicsOpenGL.finalizeRenderBufferObject(glDepthStencil, context); glDepthStencil = 0; + glres = null; } } @@ -410,18 +373,7 @@ protected boolean contextIsOutdated() { boolean outdated = !pgl.contextIsCurrent(context); if (outdated) { - PGraphicsOpenGL.removeFrameBufferObject(glFbo, context); - PGraphicsOpenGL.removeRenderBufferObject(glDepth, context); - PGraphicsOpenGL.removeRenderBufferObject(glStencil, context); - PGraphicsOpenGL.removeRenderBufferObject(glDepthStencil, context); - PGraphicsOpenGL.removeRenderBufferObject(glMultisample, context); - - glFbo = 0; - glDepth = 0; - glStencil = 0; - glDepthStencil = 0; - glMultisample = 0; - + dispose(); for (int i = 0; i < numColorBuffers; i++) { colorBufferTex[i] = null; } @@ -430,13 +382,12 @@ protected boolean contextIsOutdated() { } - protected void createColorBufferMultisample() { + protected void initColorBufferMultisample() { if (screenFb) return; pg.pushFramebuffer(); pg.setFramebuffer(this); - glMultisample = PGraphicsOpenGL.createRenderBufferObject(context, pgl); pgl.bindRenderbuffer(PGL.RENDERBUFFER, glMultisample); pgl.renderbufferStorageMultisample(PGL.RENDERBUFFER, nsamples, PGL.RGBA8, width, height); @@ -447,7 +398,7 @@ protected void createColorBufferMultisample() { } - protected void createPackedDepthStencilBuffer() { + protected void initPackedDepthStencilBuffer() { if (screenFb) return; if (width == 0 || height == 0) { @@ -457,7 +408,6 @@ protected void createPackedDepthStencilBuffer() { pg.pushFramebuffer(); pg.setFramebuffer(this); - glDepthStencil = PGraphicsOpenGL.createRenderBufferObject(context, pgl); pgl.bindRenderbuffer(PGL.RENDERBUFFER, glDepthStencil); if (multisample) { @@ -477,7 +427,7 @@ protected void createPackedDepthStencilBuffer() { } - protected void createDepthBuffer() { + protected void initDepthBuffer() { if (screenFb) return; if (width == 0 || height == 0) { @@ -487,7 +437,6 @@ protected void createDepthBuffer() { pg.pushFramebuffer(); pg.setFramebuffer(this); - glDepth = PGraphicsOpenGL.createRenderBufferObject(context, pgl); pgl.bindRenderbuffer(PGL.RENDERBUFFER, glDepth); int glConst = PGL.DEPTH_COMPONENT16; @@ -513,7 +462,7 @@ protected void createDepthBuffer() { } - protected void createStencilBuffer() { + protected void initStencilBuffer() { if (screenFb) return; if (width == 0 || height == 0) { @@ -523,7 +472,6 @@ protected void createStencilBuffer() { pg.pushFramebuffer(); pg.setFramebuffer(this); - glStencil = PGraphicsOpenGL.createRenderBufferObject(context, pgl); pgl.bindRenderbuffer(PGL.RENDERBUFFER, glStencil); int glConst = PGL.STENCIL_INDEX1; diff --git a/core/src/processing/opengl/LinePath.java b/core/src/processing/opengl/LinePath.java index 6e86431a75..03c1d69d57 100644 --- a/core/src/processing/opengl/LinePath.java +++ b/core/src/processing/opengl/LinePath.java @@ -159,7 +159,7 @@ public LinePath(int rule) { * * @param rule * the winding rule - * @param initialTypes + * @param initialCapacity * the size to make the initial array to store the path segment types */ public LinePath(int rule, int initialCapacity) { @@ -324,7 +324,7 @@ public final void reset() { static public class PathIterator { - float floatCoords[]; + float[] floatCoords; int typeIdx; @@ -334,7 +334,7 @@ static public class PathIterator { LinePath path; - static final int curvecoords[] = { 2, 2, 0 }; + static final int[] curvecoords = { 2, 2, 0 }; PathIterator(LinePath p2df) { this.path = p2df; @@ -415,7 +415,7 @@ static public LinePath createStrokedPath(LinePath src, float weight, * the original path to be stroked * @param weight * the weight of the stroked path - * @param cap + * @param caps * the decoration of the ends of the segments in the path * @param join * the decoration applied where path segments meet @@ -470,7 +470,7 @@ private static void strokeTo(LinePath src, float width, int caps, int join, private static void pathTo(PathIterator pi, LineStroker lsink) { - float coords[] = new float[6]; + float[] coords = new float[6]; while (!pi.isDone()) { int color; switch (pi.currentSegment(coords)) { diff --git a/core/src/processing/opengl/PGL.java b/core/src/processing/opengl/PGL.java index 650bfd9959..d57eb91269 100644 --- a/core/src/processing/opengl/PGL.java +++ b/core/src/processing/opengl/PGL.java @@ -3,12 +3,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -32,6 +33,7 @@ import java.nio.IntBuffer; import java.nio.ShortBuffer; import java.util.Arrays; +import java.util.regex.Pattern; import processing.core.PApplet; import processing.core.PConstants; @@ -50,8 +52,9 @@ public abstract class PGL { // Basic fields - /** The PGraphics object using this interface */ - protected PGraphicsOpenGL pg; + /** The PGraphics and PApplet objects using this interface */ + protected PGraphicsOpenGL graphics; + protected PApplet sketch; /** OpenGL thread */ protected Thread glThread; @@ -66,7 +69,6 @@ public abstract class PGL { // Parameters - protected static boolean USE_FBOLAYER_BY_DEFAULT = false; public static int REQUESTED_DEPTH_BITS = 24; public static int REQUESTED_STENCIL_BITS = 8; public static int REQUESTED_ALPHA_BITS = 8; @@ -75,13 +77,6 @@ public abstract class PGL { protected static boolean USE_DIRECT_BUFFERS = true; protected static int MIN_DIRECT_BUFFER_SIZE = 1; - /** This flag enables/disables a hack to make sure that anything drawn - * in setup will be maintained even a renderer restart (e.g.: smooth change). - * See the code and comments involving this constant in - * PGraphicsOpenGL.endDraw(). - */ - protected static boolean SAVE_SURFACE_TO_PIXELS_HACK = false; - /** Enables/disables mipmap use. */ protected static boolean MIPMAPS_ENABLED = true; @@ -132,15 +127,22 @@ public abstract class PGL { * order to make sure the lines are always on top of the fill geometry */ protected static float STROKE_DISPLACEMENT = 0.999f; + // ........................................................ + + // Variables to handle single-buffered situations (i.e.: Android) + + protected IntBuffer firstFrame; + protected static boolean SINGLE_BUFFERED = false; // ........................................................ // FBO layer - protected boolean fboLayerRequested = false; + protected boolean fboLayerEnabled = false; protected boolean fboLayerCreated = false; - protected boolean fboLayerInUse = false; - protected boolean firstFrame = true; + protected boolean fboLayerEnabledReq = false; + protected boolean fboLayerDisableReq = false; + protected boolean fbolayerResetReq = false; public int reqNumSamples; protected int numSamples; @@ -258,6 +260,25 @@ public abstract class PGL { protected FloatBuffer depthBuffer; protected ByteBuffer stencilBuffer; + //........................................................ + + // Rendering information + + /** Used to register amount of geometry rendered in each frame. */ + protected int geomCount = 0; + protected int pgeomCount; + + /** Used to register calls to background. */ + protected boolean clearColor = false; + protected boolean pclearColor; + + protected boolean clearDepth = false; + protected boolean pclearDepth; + + protected boolean clearStencil = false; + protected boolean pclearStencil; + + // ........................................................ // Error messages @@ -328,11 +349,40 @@ public abstract class PGL { protected static boolean BIG_ENDIAN = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN; + // ........................................................ + + // Present mode + + // ........................................................ + // Present mode + + protected boolean presentMode = false; + protected boolean showStopButton = true; + public float presentX; + public float presentY; + protected IntBuffer closeButtonTex; + protected int stopButtonColor; + protected int stopButtonWidth = 28; + protected int stopButtonHeight = 12; + protected int stopButtonX = 21; // The position of the close button is relative to the + protected int closeButtonY = 21; // lower left corner + protected static int[] closeButtonPix = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, -1, -1, -1, -1, -1, 0, 0, 0, -1, + -1, -1, 0, 0, 0, -1, -1, -1, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, + 0, 0, 0, -1, -1, 0, -1, -1, 0, 0, -1, -1, 0, -1, -1, 0, 0, -1, 0, 0, 0, 0, 0, + 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, + -1, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, + 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, + 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, -1, 0, -1, + -1, 0, 0, -1, -1, 0, -1, -1, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0, -1, -1, -1, + 0, 0, 0, -1, -1, -1, 0, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0}; - public boolean presentMode = false; - public float offsetX; - public float offsetY; /////////////////////////////////////////////////////////////// @@ -343,7 +393,7 @@ public PGL() { } public PGL(PGraphicsOpenGL pg) { - this.pg = pg; + this.graphics = pg; if (glColorTex == null) { glColorFbo = allocateIntBuffer(1); glColorTex = allocateIntBuffer(2); @@ -356,10 +406,6 @@ public PGL(PGraphicsOpenGL pg) { glMultiDepthStencil = allocateIntBuffer(1); glMultiDepth = allocateIntBuffer(1); glMultiStencil = allocateIntBuffer(1); - - fboLayerCreated = false; - fboLayerInUse = false; - firstFrame = false; } byteBuffer = allocateByteBuffer(1); @@ -368,12 +414,17 @@ public PGL(PGraphicsOpenGL pg) { } + public void dispose() { + destroyFBOLayer(); + } + + public void setPrimary(boolean primary) { primaryPGL = primary; } - static protected int smoothToSamples(int smooth) { + static public int smoothToSamples(int smooth) { if (smooth == 0) { // smooth(0) is noSmooth(), which is 1x sampling return 1; @@ -386,71 +437,67 @@ static protected int smoothToSamples(int smooth) { } } -// public abstract Object getCanvas(); -// -// -// protected abstract void setFps(float fps); -// -// -// protected abstract void initSurface(int antialias); -// -// -// protected abstract void reinitSurface(); -// -// -// protected abstract void registerListeners(); + abstract public Object getNative(); - protected void deleteSurface() { - if (threadIsCurrent() && fboLayerCreated) { - deleteFramebuffers(1, glColorFbo); - deleteTextures(2, glColorTex); - deleteRenderbuffers(1, glDepthStencil); - deleteRenderbuffers(1, glDepth); - deleteRenderbuffers(1, glStencil); - deleteFramebuffers(1, glMultiFbo); - deleteRenderbuffers(1, glMultiColor); - deleteRenderbuffers(1, glMultiDepthStencil); - deleteRenderbuffers(1, glMultiDepth); - deleteRenderbuffers(1, glMultiStencil); - } + abstract protected void setFrameRate(float fps); + + + abstract protected void initSurface(int antialias); + + + abstract protected void reinitSurface(); - fboLayerCreated = false; - fboLayerInUse = false; - firstFrame = false; - } + + abstract protected void registerListeners(); protected int getReadFramebuffer() { - return fboLayerInUse ? glColorFbo.get(0) : 0; + return fboLayerEnabled ? glColorFbo.get(0) : 0; } protected int getDrawFramebuffer() { - if (fboLayerInUse) return 1 < numSamples ? glMultiFbo.get(0) : - glColorFbo.get(0); + if (fboLayerEnabled) return 1 < numSamples ? glMultiFbo.get(0) : + glColorFbo.get(0); else return 0; } protected int getDefaultDrawBuffer() { - return fboLayerInUse ? COLOR_ATTACHMENT0 : BACK; + return fboLayerEnabled ? COLOR_ATTACHMENT0 : BACK; } protected int getDefaultReadBuffer() { - return fboLayerInUse ? COLOR_ATTACHMENT0 : FRONT; + return fboLayerEnabled ? COLOR_ATTACHMENT0 : FRONT; } - protected boolean isFBOBacked() {; - return fboLayerInUse; + protected boolean isFBOBacked() { + return fboLayerEnabled; } + @Deprecated public void requestFBOLayer() { - fboLayerRequested = true; + enableFBOLayer(); + } + + + public void enableFBOLayer() { + fboLayerEnabledReq = true; + } + + + public void disableFBOLayer() { + fboLayerDisableReq = true; + } + + + public void resetFBOLayer() { + fbolayerResetReq = true; } @@ -481,14 +528,14 @@ protected boolean getDepthWriteMask() { protected Texture wrapBackTexture(Texture texture) { if (texture == null) { - texture = new Texture(pg); - texture.init(pg.width, pg.height, + texture = new Texture(graphics); + texture.init(graphics.width, graphics.height, glColorTex.get(backTex), TEXTURE_2D, RGBA, fboWidth, fboHeight, NEAREST, NEAREST, CLAMP_TO_EDGE, CLAMP_TO_EDGE); texture.invertedY(true); texture.colorBuffer(true); - pg.setCache(pg, texture); + graphics.setCache(graphics, texture); } else { texture.glName = glColorTex.get(backTex); } @@ -498,8 +545,8 @@ protected Texture wrapBackTexture(Texture texture) { protected Texture wrapFrontTexture(Texture texture) { if (texture == null) { - texture = new Texture(pg); - texture.init(pg.width, pg.height, + texture = new Texture(graphics); + texture.init(graphics.width, graphics.height, glColorTex.get(frontTex), TEXTURE_2D, RGBA, fboWidth, fboHeight, NEAREST, NEAREST, CLAMP_TO_EDGE, CLAMP_TO_EDGE); @@ -542,7 +589,7 @@ protected void syncBackTexture() { bindFramebufferImpl(READ_FRAMEBUFFER, glMultiFbo.get(0)); bindFramebufferImpl(DRAW_FRAMEBUFFER, glColorFbo.get(0)); int mask = COLOR_BUFFER_BIT; - if (pg.getHint(PConstants.ENABLE_BUFFER_READING)) { + if (graphics.getHint(PConstants.ENABLE_BUFFER_READING)) { mask |= DEPTH_BUFFER_BIT | STENCIL_BUFFER_BIT; } blitFramebuffer(0, 0, fboWidth, fboHeight, @@ -552,15 +599,135 @@ protected void syncBackTexture() { } + abstract protected float getPixelScale(); + + /////////////////////////////////////////////////////////// + + // Present mode + + + public void initPresentMode(float x, float y, int stopColor) { + presentMode = true; + showStopButton = stopColor != 0; + stopButtonColor = stopColor; + presentX = x; + presentY = y; + enableFBOLayer(); + } + + + public boolean presentMode() { + return presentMode; + } + + + public float presentX() { + return presentX; + } + + + public float presentY() { + return presentY; + } + + + public boolean insideStopButton(float x, float y) { + if (!showStopButton) return false; + return stopButtonX < x && x < stopButtonX + stopButtonWidth && + -(closeButtonY + stopButtonHeight) < y && y < -closeButtonY; + } + + /////////////////////////////////////////////////////////// // Frame rendering - protected void beginDraw(boolean clear0) { - if (needFBOLayer(clear0)) { - if (!fboLayerCreated) createFBOLayer(); + protected void clearDepthStencil() { + if (!pclearDepth && !pclearStencil) { + depthMask(true); + clearDepth(1); + clearStencil(0); + clear(DEPTH_BUFFER_BIT | STENCIL_BUFFER_BIT); + } else if (!pclearDepth) { + depthMask(true); + clearDepth(1); + clear(DEPTH_BUFFER_BIT); + } else if (!pclearStencil) { + clearStencil(0); + clear(STENCIL_BUFFER_BIT); + } + } + + + protected void clearBackground(float r, float g, float b, float a, + boolean depth, boolean stencil) { + clearColor(r, g, b, a); + if (depth && stencil) { + clearDepth(1); + clearStencil(0); + clear(DEPTH_BUFFER_BIT | STENCIL_BUFFER_BIT | COLOR_BUFFER_BIT); + if (0 < sketch.frameCount) { + clearDepth = true; + clearStencil = true; + } + } else if (depth) { + clearDepth(1); + clear(DEPTH_BUFFER_BIT | COLOR_BUFFER_BIT); + if (0 < sketch.frameCount) { + clearDepth = true; + } + } else if (stencil) { + clearStencil(0); + clear(STENCIL_BUFFER_BIT | COLOR_BUFFER_BIT); + if (0 < sketch.frameCount) { + clearStencil = true; + } + } else { + clear(PGL.COLOR_BUFFER_BIT); + } + if (0 < sketch.frameCount) { + clearColor = true; + } + } + + + protected void beginRender() { + if (sketch == null) { + sketch = graphics.parent; + } + + pgeomCount = geomCount; + geomCount = 0; + + pclearColor = clearColor; + clearColor = false; + + pclearDepth = clearDepth; + clearDepth = false; + + pclearStencil = clearStencil; + clearStencil = false; + + if (SINGLE_BUFFERED && sketch.frameCount == 1) { + restoreFirstFrame(); + } + if (fboLayerEnabledReq) { + fboLayerEnabled = true; + fboLayerEnabledReq = false; + } + + if (fboLayerEnabled) { + if (fbolayerResetReq) { + destroyFBOLayer(); + fbolayerResetReq = false; + } + if (!fboLayerCreated) { + createFBOLayer(); + } + + // Draw to the back texture bindFramebufferImpl(FRAMEBUFFER, glColorFbo.get(0)); framebufferTexture2D(FRAMEBUFFER, COLOR_ATTACHMENT0, TEXTURE_2D, glColorTex.get(backTex), 0); @@ -569,107 +736,87 @@ protected void beginDraw(boolean clear0) { bindFramebufferImpl(FRAMEBUFFER, glMultiFbo.get(0)); } - if (firstFrame) { + if (sketch.frameCount == 0) { // No need to draw back color buffer because we are in the first frame. - int argb = pg.backgroundColor; - float a = ((argb >> 24) & 0xff) / 255.0f; - float r = ((argb >> 16) & 0xff) / 255.0f; - float g = ((argb >> 8) & 0xff) / 255.0f; - float b = ((argb) & 0xff) / 255.0f; - clearColor(r, g, b, a); + int argb = graphics.backgroundColor; + float ba = ((argb >> 24) & 0xff) / 255.0f; + float br = ((argb >> 16) & 0xff) / 255.0f; + float bg = ((argb >> 8) & 0xff) / 255.0f; + float bb = ((argb) & 0xff) / 255.0f; + clearColor(br, bg, bb, ba); clear(COLOR_BUFFER_BIT); - } else if (!clear0) { + } else if (!pclearColor || !sketch.isLooping()) { // Render previous back texture (now is the front) as background, // because no background() is being used ("incremental drawing") int x = 0; int y = 0; if (presentMode) { - x = (int)offsetX; - y = (int)offsetY; + x = (int)presentX; + y = (int)presentY; } - float scale = pg.getPixelScale(); + float scale = getPixelScale(); drawTexture(TEXTURE_2D, glColorTex.get(frontTex), fboWidth, fboHeight, - x, y, pg.width, pg.height, - 0, 0, (int)(scale * pg.width), (int)(scale * pg.height), - 0, 0, pg.width, pg.height); + x, y, graphics.width, graphics.height, + 0, 0, (int)(scale * graphics.width), (int)(scale * graphics.height), + 0, 0, graphics.width, graphics.height); } - - fboLayerInUse = true; - } else { - fboLayerInUse = false; } - - if (firstFrame) { - firstFrame = false; - } - -// if (!USE_FBOLAYER_BY_DEFAULT) { - // The result of this assignment is the following: if the user requested - // at some point the use of the FBO layer, but subsequently didn't - // request it again, then the rendering won't render to the FBO layer if - // not needed by the config, since it is slower than simple onscreen - // rendering. -// fboLayerRequested = false; -// } } - IntBuffer labelTex; - protected void endDraw(boolean clear, int windowColor) { - if (fboLayerInUse) { + protected void endRender(int windowColor) { + if (fboLayerEnabled) { syncBackTexture(); // Draw the contents of the back texture to the screen framebuffer. bindFramebufferImpl(FRAMEBUFFER, 0); if (presentMode) { - int argb = windowColor; - float a = ((argb >> 24) & 0xff) / 255.0f; - float r = ((argb >> 16) & 0xff) / 255.0f; - float g = ((argb >> 8) & 0xff) / 255.0f; - float b = (argb & 0xff) / 255.0f; + float wa = ((windowColor >> 24) & 0xff) / 255.0f; + float wr = ((windowColor >> 16) & 0xff) / 255.0f; + float wg = ((windowColor >> 8) & 0xff) / 255.0f; + float wb = (windowColor & 0xff) / 255.0f; clearDepth(1); - clearColor(r, g, b, a); + clearColor(wr, wg, wb, wa); clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT); - if (labelTex == null) { - labelTex = allocateIntBuffer(1); - genTextures(1, labelTex); - bindTexture(TEXTURE_2D, labelTex.get(0)); - texParameteri(TEXTURE_2D, TEXTURE_MIN_FILTER, NEAREST); - texParameteri(TEXTURE_2D, TEXTURE_MAG_FILTER, NEAREST); - texParameteri(TEXTURE_2D, TEXTURE_WRAP_S, CLAMP_TO_EDGE); - texParameteri(TEXTURE_2D, TEXTURE_WRAP_T, CLAMP_TO_EDGE); - texImage2D(TEXTURE_2D, 0, RGBA, 100, 50, 0, RGBA, UNSIGNED_BYTE, null); -// initTexture(TEXTURE_2D, RGBA, 100, 50, pg.backgroundColor); - -// ByteBuffer bb = ByteBuffer.allocateDirect(labelPix.length*4); -// bb.order(ByteOrder.nativeOrder()); -// IntBuffer ib = bb.asIntBuffer(); -// ib.put(labelPix); -// ib.position(0); - - IntBuffer buf = allocateIntBuffer(labelPix); - copyToTexture(TEXTURE_2D, RGBA, labelTex.get(0), 0, 0, 100, 50, buf); - bindTexture(TEXTURE_2D, 0); - } - drawTexture(TEXTURE_2D, labelTex.get(0), 100, 50, - 0, 0, 20 + 100, 20 + 50, - 0, 50, 100, 0, - 20, 20, 20 + 100, 20 + 50); - -/* - // Don't use presentMode offset! - drawTexture(TEXTURE_2D, labelTex.get(0), - 100, 50, pg.width, pg.height, - 0, 0, pg.width, pg.height, - 0, 0, pg.width, pg.height); - - drawTexture2D(labelTex.get(0), 100, 50, int scrW, int scrH, - 0, 0, 100, 50, - int scrX0, int scrY0, int scrX1, int scrY1); -*/ - + if (showStopButton) { + if (closeButtonTex == null) { + closeButtonTex = allocateIntBuffer(1); + genTextures(1, closeButtonTex); + bindTexture(TEXTURE_2D, closeButtonTex.get(0)); + texParameteri(TEXTURE_2D, TEXTURE_MIN_FILTER, NEAREST); + texParameteri(TEXTURE_2D, TEXTURE_MAG_FILTER, NEAREST); + texParameteri(TEXTURE_2D, TEXTURE_WRAP_S, CLAMP_TO_EDGE); + texParameteri(TEXTURE_2D, TEXTURE_WRAP_T, CLAMP_TO_EDGE); + texImage2D(TEXTURE_2D, 0, RGBA, stopButtonWidth, stopButtonHeight, 0, RGBA, UNSIGNED_BYTE, null); + + int[] color = new int[closeButtonPix.length]; + PApplet.arrayCopy(closeButtonPix, color); + + + // Multiply the texture by the button color + float ba = ((stopButtonColor >> 24) & 0xFF) / 255f; + float br = ((stopButtonColor >> 16) & 0xFF) / 255f; + float bg = ((stopButtonColor >> 8) & 0xFF) / 255f; + float bb = ((stopButtonColor >> 0) & 0xFF) / 255f; + for (int i = 0; i < color.length; i++) { + int c = closeButtonPix[i]; + int a = (int)(ba * ((c >> 24) & 0xFF)); + int r = (int)(br * ((c >> 16) & 0xFF)); + int g = (int)(bg * ((c >> 8) & 0xFF)); + int b = (int)(bb * ((c >> 0) & 0xFF)); + color[i] = javaToNativeARGB((a << 24) | (r << 16) | (g << 8) | b); + } + IntBuffer buf = allocateIntBuffer(color); + copyToTexture(TEXTURE_2D, RGBA, closeButtonTex.get(0), 0, 0, stopButtonWidth, stopButtonHeight, buf); + bindTexture(TEXTURE_2D, 0); + } + drawTexture(TEXTURE_2D, closeButtonTex.get(0), stopButtonWidth, stopButtonHeight, + 0, 0, stopButtonX + stopButtonWidth, closeButtonY + stopButtonHeight, + 0, stopButtonHeight, stopButtonWidth, 0, + stopButtonX, closeButtonY, stopButtonX + stopButtonWidth, closeButtonY + stopButtonHeight); + } } else { clearDepth(1); clearColor(0, 0, 0, 0); @@ -681,39 +828,53 @@ protected void endDraw(boolean clear, int windowColor) { int x = 0; int y = 0; if (presentMode) { - x = (int)offsetX; - y = (int)offsetY; + x = (int)presentX; + y = (int)presentY; } - float scale = pg.getPixelScale(); + float scale = getPixelScale(); drawTexture(TEXTURE_2D, glColorTex.get(backTex), fboWidth, fboHeight, - x, y, pg.width, pg.height, - 0, 0, (int)(scale * pg.width), (int)(scale * pg.height), - 0, 0, pg.width, pg.height); + x, y, graphics.width, graphics.height, + 0, 0, (int)(scale * graphics.width), (int)(scale * graphics.height), + 0, 0, graphics.width, graphics.height); // Swapping front and back textures. int temp = frontTex; frontTex = backTex; backTex = temp; - } else if (!clear && pg.parent.frameCount == 1) { - //requestFBOLayer(); + + if (fboLayerDisableReq) { + fboLayerEnabled = false; + fboLayerDisableReq = false; + } + } else { + if (SINGLE_BUFFERED && sketch.frameCount == 0) { + saveFirstFrame(); + } + + if (!clearColor && 0 < sketch.frameCount || !sketch.isLooping()) { + enableFBOLayer(); + if (SINGLE_BUFFERED) { + createFBOLayer(); + } + } } } protected abstract void getGL(PGL pgl); -// -// -// protected abstract boolean canDraw(); -// -// -// protected abstract void requestFocus(); -// -// -// protected abstract void requestDraw(); -// -// -// protected abstract void swapBuffers(); + + + protected abstract boolean canDraw(); + + + protected abstract void requestFocus(); + + + protected abstract void requestDraw(); + + + protected abstract void swapBuffers(); public boolean threadIsCurrent() { @@ -732,29 +893,19 @@ protected void beginGL() { } protected void endGL() { } - private boolean needFBOLayer(boolean clear0) { - // TODO: need to revise this, on windows we might not want to use FBO layer - // even with anti-aliasing enabled... -// boolean res = !clear0 || fboLayerRequested || 1 < numSamples; -// System.err.println(res + " " + clear0 + " " + fboLayerRequested + " " + numSamples); -// return res; - return fboLayerRequested; - } - - private void createFBOLayer() { - float scale = pg.getPixelScale(); + float scale = getPixelScale(); if (hasNpotTexSupport()) { - fboWidth = (int)(scale * pg.width); - fboHeight = (int)(scale * pg.height); + fboWidth = (int)(scale * graphics.width); + fboHeight = (int)(scale * graphics.height); } else { - fboWidth = nextPowerOfTwo((int)(scale * pg.width)); - fboHeight = nextPowerOfTwo((int)(scale * pg.height)); + fboWidth = nextPowerOfTwo((int)(scale * graphics.width)); + fboHeight = nextPowerOfTwo((int)(scale * graphics.height)); } - int maxs = maxSamples(); - if (hasFboMultisampleSupport() && 1 < maxs) { + if (hasFboMultisampleSupport()) { + int maxs = maxSamples(); numSamples = PApplet.min(reqNumSamples, maxs); } else { numSamples = 1; @@ -774,7 +925,7 @@ private void createFBOLayer() { texParameteri(TEXTURE_2D, TEXTURE_WRAP_T, CLAMP_TO_EDGE); texImage2D(TEXTURE_2D, 0, RGBA, fboWidth, fboHeight, 0, RGBA, UNSIGNED_BYTE, null); - initTexture(TEXTURE_2D, RGBA, fboWidth, fboHeight, pg.backgroundColor); + initTexture(TEXTURE_2D, RGBA, fboWidth, fboHeight, graphics.backgroundColor); } bindTexture(TEXTURE_2D, 0); @@ -786,7 +937,7 @@ private void createFBOLayer() { framebufferTexture2D(FRAMEBUFFER, COLOR_ATTACHMENT0, TEXTURE_2D, glColorTex.get(backTex), 0); - if (!multisample || pg.getHint(PConstants.ENABLE_BUFFER_READING)) { + if (!multisample || graphics.getHint(PConstants.ENABLE_BUFFER_READING)) { // If not multisampled, this is the only depth and stencil buffer. // If multisampled and depth reading enabled, these are going to // hold downsampled depth and stencil buffers. @@ -810,24 +961,96 @@ private void createFBOLayer() { createDepthAndStencilBuffer(true, depthBits, stencilBits, packed); } - validateFramebuffer(); + int status = validateFramebuffer(); + + if (status == FRAMEBUFFER_INCOMPLETE_MULTISAMPLE && 1 < numSamples) { + System.err.println("Continuing with multisampling disabled"); + reqNumSamples = 1; + destroyFBOLayer(); + // try again + createFBOLayer(); + return; + } // Clear all buffers. clearDepth(1); clearStencil(0); - int argb = pg.backgroundColor; - float a = ((argb >> 24) & 0xff) / 255.0f; - float r = ((argb >> 16) & 0xff) / 255.0f; - float g = ((argb >> 8) & 0xff) / 255.0f; - float b = ((argb) & 0xff) / 255.0f; - clearColor(r, g, b, a); + int argb = graphics.backgroundColor; + float ba = ((argb >> 24) & 0xff) / 255.0f; + float br = ((argb >> 16) & 0xff) / 255.0f; + float bg = ((argb >> 8) & 0xff) / 255.0f; + float bb = ((argb) & 0xff) / 255.0f; + clearColor(br, bg, bb, ba); clear(DEPTH_BUFFER_BIT | STENCIL_BUFFER_BIT | COLOR_BUFFER_BIT); bindFramebufferImpl(FRAMEBUFFER, 0); + initFBOLayer(); fboLayerCreated = true; } + protected abstract void initFBOLayer(); + + + protected void saveFirstFrame() { + firstFrame = allocateDirectIntBuffer(graphics.width * graphics.height); + if (hasReadBuffer()) readBuffer(BACK); + readPixelsImpl(0, 0, graphics.width, graphics.height, RGBA, UNSIGNED_BYTE, firstFrame); + } + + + protected void restoreFirstFrame() { + if (firstFrame == null) return; + + IntBuffer tex = allocateIntBuffer(1); + genTextures(1, tex); + + int w, h; + float scale = getPixelScale(); + if (hasNpotTexSupport()) { + w = (int)(scale * graphics.width); + h = (int)(scale * graphics.height); + } else { + w = nextPowerOfTwo((int)(scale * graphics.width)); + h = nextPowerOfTwo((int)(scale * graphics.height)); + } + + bindTexture(TEXTURE_2D, tex.get(0)); + texParameteri(TEXTURE_2D, TEXTURE_MIN_FILTER, NEAREST); + texParameteri(TEXTURE_2D, TEXTURE_MAG_FILTER, NEAREST); + texParameteri(TEXTURE_2D, TEXTURE_WRAP_S, CLAMP_TO_EDGE); + texParameteri(TEXTURE_2D, TEXTURE_WRAP_T, CLAMP_TO_EDGE); + texImage2D(TEXTURE_2D, 0, RGBA, w, h, 0, RGBA, UNSIGNED_BYTE, null); + texSubImage2D(TEXTURE_2D, 0, 0, 0, graphics.width, graphics.height, RGBA, UNSIGNED_BYTE, firstFrame); + + drawTexture(TEXTURE_2D, tex.get(0), w, h, + 0, 0, graphics.width, graphics.height, + 0, 0, (int)(scale * graphics.width), (int)(scale * graphics.height), + 0, 0, graphics.width, graphics.height); + + deleteTextures(1, tex); + firstFrame.clear(); + firstFrame = null; + } + + protected void destroyFBOLayer() { + if (threadIsCurrent() && fboLayerCreated) { + deleteFramebuffers(1, glColorFbo); + deleteTextures(2, glColorTex); + deleteRenderbuffers(1, glDepthStencil); + deleteRenderbuffers(1, glDepth); + deleteRenderbuffers(1, glStencil); + + deleteFramebuffers(1, glMultiFbo); + deleteRenderbuffers(1, glMultiColor); + deleteRenderbuffers(1, glMultiDepthStencil); + deleteRenderbuffers(1, glMultiDepth); + deleteRenderbuffers(1, glMultiStencil); + } + fboLayerCreated = false; + } + + private void createDepthAndStencilBuffer(boolean multisample, int depthBits, int stencilBits, boolean packed) { // Creating depth and stencil buffers @@ -1034,7 +1257,7 @@ public void drawTexture(int target, int id,int texW, int texH, int viewX, int viewY, int viewW, int viewH, int texX0, int texY0, int texX1, int texY1, int scrX0, int scrY0, int scrX1, int scrY1) { - int viewF = (int)pg.getPixelScale(); + int viewF = (int)getPixelScale(); drawTexture(target, id, texW, texH, viewX, viewY, viewW, viewH, viewF, texX0, texY0, texX1, texY1, @@ -1061,12 +1284,12 @@ public void drawTexture(int target, int id,int texW, int texH, protected PGL initTex2DShader() { - PGL ppgl = primaryPGL ? this : pg.getPrimaryPGL(); + PGL ppgl = primaryPGL ? this : graphics.getPrimaryPGL(); if (!ppgl.loadedTex2DShader || ppgl.tex2DShaderContext != ppgl.glContext) { - String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion()); + String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion(), getGLSLVersionSuffix()); String vertSource = PApplet.join(preprocVertSrc, "\n"); - String[] preprocFragSrc = preprocessFragmentSource(tex2DFragShaderSource, getGLSLVersion()); + String[] preprocFragSrc = preprocessFragmentSource(tex2DFragShaderSource, getGLSLVersion(), getGLSLVersionSuffix()); String fragSource = PApplet.join(preprocFragSrc, "\n"); ppgl.tex2DVertShader = createShader(VERTEX_SHADER, vertSource); ppgl.tex2DFragShader = createShader(FRAGMENT_SHADER, fragSource); @@ -1193,12 +1416,12 @@ protected void drawTexture2D(int id, int texW, int texH, protected PGL initTexRectShader() { - PGL ppgl = primaryPGL ? this : pg.getPrimaryPGL(); + PGL ppgl = primaryPGL ? this : graphics.getPrimaryPGL(); if (!ppgl.loadedTexRectShader || ppgl.texRectShaderContext != ppgl.glContext) { - String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion()); + String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion(), getGLSLVersionSuffix()); String vertSource = PApplet.join(preprocVertSrc, "\n"); - String[] preprocFragSrc = preprocessFragmentSource(texRectFragShaderSource, getGLSLVersion()); + String[] preprocFragSrc = preprocessFragmentSource(texRectFragShaderSource, getGLSLVersion(), getGLSLVersionSuffix()); String fragSource = PApplet.join(preprocFragSrc, "\n"); ppgl.texRectVertShader = createShader(VERTEX_SHADER, vertSource); ppgl.texRectFragShader = createShader(FRAGMENT_SHADER, fragSource); @@ -1330,7 +1553,7 @@ protected int getColorValue(int scrX, int scrY) { colorBuffer = IntBuffer.allocate(1); } colorBuffer.rewind(); - readPixels(scrX, pg.height - scrY - 1, 1, 1, RGBA, UNSIGNED_BYTE, + readPixels(scrX, graphics.height - scrY - 1, 1, 1, RGBA, UNSIGNED_BYTE, colorBuffer); return colorBuffer.get(); } @@ -1341,7 +1564,7 @@ protected float getDepthValue(int scrX, int scrY) { depthBuffer = FloatBuffer.allocate(1); } depthBuffer.rewind(); - readPixels(scrX, pg.height - scrY - 1, 1, 1, DEPTH_COMPONENT, FLOAT, + readPixels(scrX, graphics.height - scrY - 1, 1, 1, DEPTH_COMPONENT, FLOAT, depthBuffer); return depthBuffer.get(0); } @@ -1352,7 +1575,7 @@ protected byte getStencilValue(int scrX, int scrY) { stencilBuffer = ByteBuffer.allocate(1); } stencilBuffer.rewind(); - readPixels(scrX, pg.height - scrY - 1, 1, 1, STENCIL_INDEX, + readPixels(scrX, graphics.height - scrY - 1, 1, 1, STENCIL_INDEX, UNSIGNED_BYTE, stencilBuffer); return stencilBuffer.get(0); } @@ -1377,12 +1600,10 @@ protected static int nextPowerOfTwo(int val) { */ protected static int nativeToJavaARGB(int color) { if (BIG_ENDIAN) { // RGBA to ARGB - return (color >>> 8) | ((color << 24) & 0xFF000000); - // equivalent to - // ((color >> 8) & 0x00FFFFFF) | ((color << 24) & 0xFF000000) + return (color >>> 8) | (color << 24); } else { // ABGR to ARGB - return ((color & 0xFF) << 16) | ((color & 0xFF0000) >> 16) | - (color & 0xFF00FF00); + int rb = color & 0x00FF00FF; + return (color & 0xFF00FF00) | (rb << 16) | (rb >> 16); } } @@ -1401,13 +1622,13 @@ protected static void nativeToJavaARGB(int[] pixels, int width, int height) { int pixy = pixels[yindex]; int pixi = pixels[index]; if (BIG_ENDIAN) { // RGBA to ARGB - pixels[index] = (pixy >>> 8) | ((pixy << 24) & 0xFF000000); - pixels[yindex] = (pixi >>> 8) | ((pixi << 24) & 0xFF000000); + pixels[index] = (pixy >>> 8) | (pixy << 24); + pixels[yindex] = (pixi >>> 8) | (pixi << 24); } else { // ABGR to ARGB - pixels[index] = ((pixy & 0xFF) << 16) | ((pixy & 0xFF0000) >> 16) | - (pixy & 0xFF00FF00); - pixels[yindex] = ((pixi & 0xFF) << 16) | ((pixi & 0xFF0000) >> 16) | - (pixi & 0xFF00FF00); + int rbi = pixi & 0x00FF00FF; + int rby = pixy & 0x00FF00FF; + pixels[index] = (pixy & 0xFF00FF00) | (rby << 16) | (rby >> 16); + pixels[yindex] = (pixi & 0xFF00FF00) | (rbi << 16) | (rbi >> 16); } index++; yindex++; @@ -1420,10 +1641,10 @@ protected static void nativeToJavaARGB(int[] pixels, int width, int height) { for (int x = 0; x < width; x++) { int pixi = pixels[index]; if (BIG_ENDIAN) { // RGBA to ARGB - pixels[index] = (pixi >>> 8) | ((pixi << 24) & 0xFF000000); + pixels[index] = (pixi >>> 8) | (pixi << 24); } else { // ABGR to ARGB - pixels[index] = ((pixi & 0xFF) << 16) | ((pixi & 0xFF0000) >> 16) | - (pixi & 0xFF00FF00); + int rbi = pixi & 0x00FF00FF; + pixels[index] = (pixi & 0xFF00FF00) | (rbi << 16) | (rbi >> 16); } index++; } @@ -1440,8 +1661,9 @@ protected static int nativeToJavaRGB(int color) { if (BIG_ENDIAN) { // RGBA to ARGB return (color >>> 8) | 0xFF000000; } else { // ABGR to ARGB - return ((color & 0xFF) << 16) | ((color & 0xFF0000) >> 16) | - (color & 0xFF00FF00) | 0xFF000000; + int rb = color & 0x00FF00FF; + return 0xFF000000 | (rb << 16) | + (color & 0x0000FF00) | (rb >> 16); } } @@ -1464,10 +1686,12 @@ protected static void nativeToJavaRGB(int[] pixels, int width, int height) { pixels[index] = (pixy >>> 8) | 0xFF000000; pixels[yindex] = (pixi >>> 8) | 0xFF000000; } else { // ABGR to ARGB - pixels[index] = ((pixy & 0xFF) << 16) | ((pixy & 0xFF0000) >> 16) | - (pixy & 0xFF00FF00) | 0xFF000000; - pixels[yindex] = ((pixi & 0xFF) << 16) | ((pixi & 0xFF0000) >> 16) | - (pixi & 0xFF00FF00) | 0xFF000000; + int rbi = pixi & 0x00FF00FF; + int rby = pixy & 0x00FF00FF; + pixels[index] = 0xFF000000 | (rby << 16) | + (pixy & 0x0000FF00) | (rby >> 16); + pixels[yindex] = 0xFF000000 | (rbi << 16) | + (pixi & 0x0000FF00) | (rbi >> 16); } index++; yindex++; @@ -1482,8 +1706,9 @@ protected static void nativeToJavaRGB(int[] pixels, int width, int height) { if (BIG_ENDIAN) { // RGBA to ARGB pixels[index] = (pixi >>> 8) | 0xFF000000; } else { // ABGR to ARGB - pixels[index] = ((pixi & 0xFF) << 16) | ((pixi & 0xFF0000) >> 16) | - (pixi & 0xFF00FF00) | 0xFF000000; + int rbi = pixi & 0x00FF00FF; + pixels[index] = 0xFF000000 | (rbi << 16) | + (pixi & 0x000FF00) | (rbi >> 16); } index++; } @@ -1497,10 +1722,10 @@ protected static void nativeToJavaRGB(int[] pixels, int width, int height) { */ protected static int javaToNativeARGB(int color) { if (BIG_ENDIAN) { // ARGB to RGBA - return ((color >> 24) & 0xFF) | ((color << 8) & 0xFFFFFF00); + return (color >>> 24) | (color << 8); } else { // ARGB to ABGR - return (color & 0xFF000000) | ((color << 16) & 0xFF0000) | - (color & 0xFF00) | ((color >> 16) & 0xFF); + int rb = color & 0x00FF00FF; + return (color & 0xFF00FF00) | (rb << 16) | (rb >> 16); } } @@ -1519,13 +1744,13 @@ protected static void javaToNativeARGB(int[] pixels, int width, int height) { int pixy = pixels[yindex]; int pixi = pixels[index]; if (BIG_ENDIAN) { // ARGB to RGBA - pixels[index] = ((pixy >> 24) & 0xFF) | ((pixy << 8) & 0xFFFFFF00); - pixels[yindex] = ((pixi >> 24) & 0xFF) | ((pixi << 8) & 0xFFFFFF00); + pixels[index] = (pixy >>> 24) | (pixy << 8); + pixels[yindex] = (pixi >>> 24) | (pixi << 8); } else { // ARGB to ABGR - pixels[index] = (pixy & 0xFF000000) | ((pixy << 16) & 0xFF0000) | - (pixy & 0xFF00) | ((pixy >> 16) & 0xFF); - pixels[yindex] = (pixi & 0xFF000000) | ((pixi << 16) & 0xFF0000) | - (pixi & 0xFF00) | ((pixi >> 16) & 0xFF); + int rbi = pixi & 0x00FF00FF; + int rby = pixy & 0x00FF00FF; + pixels[index] = (pixy & 0xFF00FF00) | (rby << 16) | (rby >> 16); + pixels[yindex] = (pixi & 0xFF00FF00) | (rbi << 16) | (rbi >> 16); } index++; yindex++; @@ -1538,10 +1763,10 @@ protected static void javaToNativeARGB(int[] pixels, int width, int height) { for (int x = 0; x < width; x++) { int pixi = pixels[index]; if (BIG_ENDIAN) { // ARGB to RGBA - pixels[index] = ((pixi >> 24) & 0xFF) | ((pixi << 8) & 0xFFFFFF00); + pixels[index] = (pixi >>> 24) | (pixi << 8); } else { // ARGB to ABGR - pixels[index] = (pixi & 0xFF000000) | ((pixi << 16) & 0xFF0000) | - (pixi & 0xFF00) | ((pixi >> 16) & 0xFF); + int rbi = pixi & 0x00FF00FF; + pixels[index] = (pixi & 0xFF00FF00) | (rbi << 16) | (rbi >> 16); } index++; } @@ -1555,10 +1780,10 @@ protected static void javaToNativeARGB(int[] pixels, int width, int height) { */ protected static int javaToNativeRGB(int color) { if (BIG_ENDIAN) { // ARGB to RGB - return 0xFF | ((color << 8) & 0xFFFFFF00); + return 0xFF | (color << 8); } else { // ARGB to BGR - return 0xFF000000 | ((color << 16) & 0xFF0000) | - (color & 0xFF00) | ((color >> 16) & 0xFF); + int rb = color & 0x00FF00FF; + return 0xFF000000 | (rb << 16) | (color & 0x0000FF00) | (rb >> 16); } } @@ -1578,13 +1803,15 @@ protected static void javaToNativeRGB(int[] pixels, int width, int height) { int pixy = pixels[yindex]; int pixi = pixels[index]; if (BIG_ENDIAN) { // ARGB to RGB - pixels[index] = 0xFF | ((pixy << 8) & 0xFFFFFF00); - pixels[yindex] = 0xFF | ((pixi << 8) & 0xFFFFFF00); + pixels[index] = 0xFF | (pixy << 8); + pixels[yindex] = 0xFF | (pixi << 8); } else { // ARGB to BGR - pixels[index] = 0xFF000000 | ((pixy << 16) & 0xFF0000) | - (pixy & 0xFF00) | ((pixy >> 16) & 0xFF); - pixels[yindex] = 0xFF000000 | ((pixi << 16) & 0xFF0000) | - (pixi & 0xFF00) | ((pixi >> 16) & 0xFF); + int rbi = pixi & 0x00FF00FF; + int rby = pixy & 0x00FF00FF; + pixels[index] = 0xFF000000 | (rby << 16) | + (pixy & 0x0000FF00) | (rby >> 16); + pixels[yindex] = 0xFF000000 | (rbi << 16) | + (pixi & 0x0000FF00) | (rbi >> 16); } index++; yindex++; @@ -1597,10 +1824,11 @@ protected static void javaToNativeRGB(int[] pixels, int width, int height) { for (int x = 0; x < width; x++) { int pixi = pixels[index]; if (BIG_ENDIAN) { // ARGB to RGB - pixels[index] = 0xFF | ((pixi << 8) & 0xFFFFFF00); + pixels[index] = 0xFF | (pixi << 8); } else { // ARGB to BGR - pixels[index] = 0xFF000000 | ((pixi << 16) & 0xFF0000) | - (pixi & 0xFF00) | ((pixi >> 16) & 0xFF); + int rbi = pixi & 0x00FF00FF; + pixels[index] = 0xFF000000 | (rbi << 16) | + (pixi & 0x0000FF00) | (rbi >> 16); } index++; } @@ -1619,18 +1847,17 @@ protected static int qualityToSamples(int quality) { } - protected int getGLSLVersion() { - return 120; - } + abstract protected int getGLSLVersion(); + abstract protected String getGLSLVersionSuffix(); protected String[] loadVertexShader(String filename) { - return pg.parent.loadStrings(filename); + return sketch.loadStrings(filename); } protected String[] loadFragmentShader(String filename) { - return pg.parent.loadStrings(filename); + return sketch.loadStrings(filename); } @@ -1654,115 +1881,146 @@ protected String[] loadVertexShader(URL url) { } - protected String[] loadVertexShader(String filename, int version) { + protected String[] loadVertexShader(String filename, int version, String versionSuffix) { return loadVertexShader(filename); } - protected String[] loadFragmentShader(String filename, int version) { + protected String[] loadFragmentShader(String filename, int version, String versionSuffix) { return loadFragmentShader(filename); } - protected String[] loadFragmentShader(URL url, int version) { + protected String[] loadFragmentShader(URL url, int version, String versionSuffix) { return loadFragmentShader(url); } - protected String[] loadVertexShader(URL url, int version) { + protected String[] loadVertexShader(URL url, int version, String versionSuffix) { return loadVertexShader(url); } protected static String[] preprocessFragmentSource(String[] fragSrc0, - int version) { + int version, + String versionSuffix) { + if (containsVersionDirective(fragSrc0)) { + // The user knows what she or he is doing + return fragSrc0; + } + String[] fragSrc; if (version < 130) { - String[] search = { }; + Pattern[] search = { }; String[] replace = { }; int offset = 1; fragSrc = preprocessShaderSource(fragSrc0, search, replace, offset); - fragSrc[0] = "#version " + version; + fragSrc[0] = "#version " + version + versionSuffix; } else { // We need to replace 'texture' uniform by 'texMap' uniform and // 'textureXXX()' functions by 'texture()' functions. Order of these // replacements is important to prevent collisions between these two. - String[] search = new String[] { - "varying", "attribute", - "texture", - "texMap2D", "texMap3D", "texMap2DRect", - "texMapCube", "gl_FragColor" + Pattern[] search = new Pattern[] { + Pattern.compile(String.format(GLSL_ID_REGEX, "varying|attribute")), + Pattern.compile(String.format(GLSL_ID_REGEX, "texture")), + Pattern.compile(String.format(GLSL_FN_REGEX, "texture2DRect|texture2D|texture3D|textureCube")), + Pattern.compile(String.format(GLSL_ID_REGEX, "gl_FragColor")) }; String[] replace = new String[] { - "in", "in", - "texMap", - "texture", "texture", "texture", "texture", - "fragColor" + "in", "texMap", "texture", "_fragColor" }; int offset = 2; fragSrc = preprocessShaderSource(fragSrc0, search, replace, offset); - fragSrc[0] = "#version " + version; - fragSrc[1] = "out vec4 fragColor;"; + fragSrc[0] = "#version " + version + versionSuffix; + if (" es".equals(versionSuffix)) { + fragSrc[1] = "out mediump vec4 _fragColor;"; + } else { + fragSrc[1] = "out vec4 _fragColor;"; + } } return fragSrc; } protected static String[] preprocessVertexSource(String[] vertSrc0, - int version) { + int version, + String versionSuffix) { + if (containsVersionDirective(vertSrc0)) { + // The user knows what she or he is doing + return vertSrc0; + } + String[] vertSrc; if (version < 130) { - String[] search = { }; + Pattern[] search = { }; String[] replace = { }; int offset = 1; vertSrc = preprocessShaderSource(vertSrc0, search, replace, offset); - vertSrc[0] = "#version " + version; + vertSrc[0] = "#version " + version + versionSuffix; } else { // We need to replace 'texture' uniform by 'texMap' uniform and // 'textureXXX()' functions by 'texture()' functions. Order of these // replacements is important to prevent collisions between these two. - String[] search = new String[] { - "varying", "attribute", - "texture", - "texMap2D", "texMap3D", "texMap2DRect", "texMapCube" + Pattern[] search = new Pattern[] { + Pattern.compile(String.format(GLSL_ID_REGEX, "varying")), + Pattern.compile(String.format(GLSL_ID_REGEX, "attribute")), + Pattern.compile(String.format(GLSL_ID_REGEX, "texture")), + Pattern.compile(String.format(GLSL_FN_REGEX, "texture2DRect|texture2D|texture3D|textureCube")) }; String[] replace = new String[] { - "out", "in", - "texMap", - "texture", "texture", "texture", "texture" + "out", "in", "texMap", "texture", }; int offset = 1; vertSrc = preprocessShaderSource(vertSrc0, search, replace, offset); - vertSrc[0] = "#version " + version; + vertSrc[0] = "#version " + version + versionSuffix; } return vertSrc; } + + protected static final String GLSL_ID_REGEX = "(?= 0) { + line = line.substring(0, versionIndex); } for (int j = 0; j < search.length; j++) { - line = line.replace(search[j], replace[j]); + line = search[j].matcher(line).replaceAll(replace[j]); } src[i+offset] = line; } return src; } + protected static boolean containsVersionDirective(String[] shSrc) { + for (int i = 0; i < shSrc.length; i++) { + String line = shSrc[i]; + int versionIndex = line.indexOf("#version"); + if (versionIndex >= 0) { + int commentIndex = line.indexOf("//"); + if (commentIndex < 0 || versionIndex < commentIndex) { + return true; + } + } + } + return false; + } protected int createShader(int shaderType, String source) { int shader = createShader(shaderType); @@ -1811,10 +2069,13 @@ protected boolean linked(int program) { } - protected boolean validateFramebuffer() { + protected int validateFramebuffer() { int status = checkFramebufferStatus(FRAMEBUFFER); if (status == FRAMEBUFFER_COMPLETE) { - return true; + return 0; + } else if (status == FRAMEBUFFER_UNDEFINED) { + System.err.println(String.format(FRAMEBUFFER_ERROR, + "framebuffer undefined")); } else if (status == FRAMEBUFFER_INCOMPLETE_ATTACHMENT) { System.err.println(String.format(FRAMEBUFFER_ERROR, "incomplete attachment")); @@ -1827,24 +2088,46 @@ protected boolean validateFramebuffer() { } else if (status == FRAMEBUFFER_INCOMPLETE_FORMATS) { System.err.println(String.format(FRAMEBUFFER_ERROR, "incomplete formats")); + } else if (status == FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER) { + System.err.println(String.format(FRAMEBUFFER_ERROR, + "incomplete draw buffer")); + } else if (status == FRAMEBUFFER_INCOMPLETE_READ_BUFFER) { + System.err.println(String.format(FRAMEBUFFER_ERROR, + "incomplete read buffer")); } else if (status == FRAMEBUFFER_UNSUPPORTED) { System.err.println(String.format(FRAMEBUFFER_ERROR, "framebuffer unsupported")); + } else if (status == FRAMEBUFFER_INCOMPLETE_MULTISAMPLE) { + System.err.println(String.format(FRAMEBUFFER_ERROR, + "incomplete multisample buffer")); + } else if (status == FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS) { + System.err.println(String.format(FRAMEBUFFER_ERROR, + "incomplete layer targets")); } else { System.err.println(String.format(FRAMEBUFFER_ERROR, - "unknown error")); + "unknown error " + status)); } - return false; + return status; } + protected boolean isES() { + return getString(VERSION).trim().toLowerCase().contains("opengl es"); + } protected int[] getGLVersion() { - String version = getString(VERSION).trim(); + String version = getString(VERSION).trim().toLowerCase(); + + String ES = "opengl es"; + int esPosition = version.indexOf(ES); + if (esPosition >= 0) { + version = version.substring(esPosition + ES.length()).trim(); + } + int[] res = {0, 0, 0}; String[] parts = version.split(" "); for (int i = 0; i < parts.length; i++) { if (0 < parts[i].indexOf(".")) { - String nums[] = parts[i].split("\\."); + String[] nums = parts[i].split("\\."); try { res[0] = Integer.parseInt(nums[0]); } catch (NumberFormatException e) { } @@ -1901,7 +2184,11 @@ protected boolean hasNpotTexSupport() { int major = getGLVersion()[0]; if (major < 3) { String ext = getString(EXTENSIONS); - return -1 < ext.indexOf("_texture_non_power_of_two"); + if (isES()) { + return -1 < ext.indexOf("_texture_npot"); + } else { + return -1 < ext.indexOf("_texture_non_power_of_two"); + } } else { return true; } @@ -1910,11 +2197,13 @@ protected boolean hasNpotTexSupport() { protected boolean hasAutoMipmapGenSupport() { int major = getGLVersion()[0]; - if (major < 3) { + if (isES() && major >= 2) { + return true; + } else if (!isES() && major >= 3) { + return true; + } else { String ext = getString(EXTENSIONS); return -1 < ext.indexOf("_generate_mipmap"); - } else { - return true; } } @@ -1943,7 +2232,7 @@ protected boolean hasPackedDepthStencilSupport() { protected boolean hasAnisoSamplingSupport() { int major = getGLVersion()[0]; - if (major < 3) { + if (isES() || major < 3) { String ext = getString(EXTENSIONS); return -1 < ext.indexOf("_texture_filter_anisotropic"); } else { @@ -1952,6 +2241,42 @@ protected boolean hasAnisoSamplingSupport() { } + protected boolean hasSynchronization() { + int[] version = getGLVersion(); + if (isES()) { + return version[0] >= 3; + } + return (version[0] > 3) || (version[0] == 3 && version[1] >= 2); + } + + + protected boolean hasPBOs() { + int[] version = getGLVersion(); + if (isES()) { + return version[0] >= 3; + } + return (version[0] > 2) || (version[0] == 2 && version[1] >= 1); + } + + + protected boolean hasReadBuffer() { + int[] version = getGLVersion(); + if (isES()) { + return version[0] >= 3; + } + return version[0] >= 2; + } + + + protected boolean hasDrawBuffer() { + int[] version = getGLVersion(); + if (isES()) { + return version[0] >= 3; + } + return version[0] >= 2; + } + + protected int maxSamples() { intBuffer.rewind(); getIntegerv(MAX_SAMPLES, intBuffer); @@ -2356,12 +2681,17 @@ protected static void fillFloatBuffer(FloatBuffer buf, int i0, int i1, protected interface Tessellator { + public void setCallback(int flag); + public void setWindingRule(int rule); + public void setProperty(int property, int value); + public void beginPolygon(); + public void beginPolygon(Object data); public void endPolygon(); - public void setWindingRule(int rule); public void beginContour(); public void endContour(); public void addVertex(double[] v); + public void addVertex(double[] v, int n, Object data); } @@ -2473,6 +2803,7 @@ protected interface FontOutline { public static int TESS_WINDING_NONZERO; public static int TESS_WINDING_ODD; + public static int TESS_EDGE_FLAG; public static int GENERATE_MIPMAP_HINT; public static int FASTEST; @@ -2501,12 +2832,14 @@ protected interface FontOutline { public static int ARRAY_BUFFER; public static int ELEMENT_ARRAY_BUFFER; + public static int PIXEL_PACK_BUFFER; public static int MAX_VERTEX_ATTRIBS; public static int STATIC_DRAW; public static int DYNAMIC_DRAW; public static int STREAM_DRAW; + public static int STREAM_READ; public static int BUFFER_SIZE; public static int BUFFER_USAGE; @@ -2663,7 +2996,6 @@ protected interface FontOutline { public static int STENCIL_TEST; public static int DEPTH_TEST; public static int DEPTH_WRITEMASK; - public static int ALPHA_TEST; public static int COLOR_BUFFER_BIT; public static int DEPTH_BUFFER_BIT; @@ -2695,6 +3027,7 @@ protected interface FontOutline { public static int DEPTH_STENCIL; public static int FRAMEBUFFER_COMPLETE; + public static int FRAMEBUFFER_UNDEFINED; public static int FRAMEBUFFER_INCOMPLETE_ATTACHMENT; public static int FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; public static int FRAMEBUFFER_INCOMPLETE_DIMENSIONS; @@ -2702,6 +3035,8 @@ protected interface FontOutline { public static int FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER; public static int FRAMEBUFFER_INCOMPLETE_READ_BUFFER; public static int FRAMEBUFFER_UNSUPPORTED; + public static int FRAMEBUFFER_INCOMPLETE_MULTISAMPLE; + public static int FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS; public static int FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE; public static int FRAMEBUFFER_ATTACHMENT_OBJECT_NAME; @@ -2719,10 +3054,13 @@ protected interface FontOutline { public static int RENDERBUFFER_INTERNAL_FORMAT; public static int MULTISAMPLE; - public static int POINT_SMOOTH; public static int LINE_SMOOTH; public static int POLYGON_SMOOTH; + public static int SYNC_GPU_COMMANDS_COMPLETE; + public static int ALREADY_SIGNALED; + public static int CONDITION_SATISFIED; + /////////////////////////////////////////////////////////// // Special Functions @@ -2767,6 +3105,14 @@ protected interface FontOutline { ////////////////////////////////////////////////////////////////////////////// + // Synchronization + + public abstract long fenceSync(int condition, int flags); + public abstract void deleteSync(long sync); + public abstract int clientWaitSync(long sync, int flags, long timeout); + + ////////////////////////////////////////////////////////////////////////////// + // Viewport and Clipping public abstract void depthRangef(float n, float f); @@ -2782,8 +3128,8 @@ protected interface FontOutline { // to glReadPixels() should be done in readPixelsImpl(). public void readPixels(int x, int y, int width, int height, int format, int type, Buffer buffer){ - boolean multisampled = isMultisampled() || pg.offscreenMultisample; - boolean depthReadingEnabled = pg.getHint(PConstants.ENABLE_BUFFER_READING); + boolean multisampled = isMultisampled() || graphics.offscreenMultisample; + boolean depthReadingEnabled = graphics.getHint(PConstants.ENABLE_BUFFER_READING); boolean depthRequested = format == STENCIL_INDEX || format == DEPTH_COMPONENT || format == DEPTH_STENCIL; if (multisampled && depthRequested && !depthReadingEnabled) { @@ -2791,12 +3137,28 @@ public void readPixels(int x, int y, int width, int height, int format, int type return; } - pg.beginReadPixels(); + graphics.beginReadPixels(); readPixelsImpl(x, y, width, height, format, type, buffer); - pg.endReadPixels(); + graphics.endReadPixels(); + } + + public void readPixels(int x, int y, int width, int height, int format, int type, long offset){ + boolean multisampled = isMultisampled() || graphics.offscreenMultisample; + boolean depthReadingEnabled = graphics.getHint(PConstants.ENABLE_BUFFER_READING); + boolean depthRequested = format == STENCIL_INDEX || format == DEPTH_COMPONENT || format == DEPTH_STENCIL; + + if (multisampled && depthRequested && !depthReadingEnabled) { + PGraphics.showWarning(DEPTH_READING_NOT_ENABLED_ERROR); + return; + } + + graphics.beginReadPixels(); + readPixelsImpl(x, y, width, height, format, type, offset); + graphics.endReadPixels(); } protected abstract void readPixelsImpl(int x, int y, int width, int height, int format, int type, Buffer buffer); + protected abstract void readPixelsImpl(int x, int y, int width, int height, int format, int type, long offset); ////////////////////////////////////////////////////////////////////////////// @@ -2809,14 +3171,24 @@ public void readPixels(int x, int y, int width, int height, int format, int type public abstract void vertexAttrib1fv(int index, FloatBuffer values); public abstract void vertexAttrib2fv(int index, FloatBuffer values); public abstract void vertexAttrib3fv(int index, FloatBuffer values); - public abstract void vertexAttri4fv(int index, FloatBuffer values); + public abstract void vertexAttrib4fv(int index, FloatBuffer values); public abstract void vertexAttribPointer(int index, int size, int type, boolean normalized, int stride, int offset); - public abstract void vertexAttribPointer(int index, int size, int type, boolean normalized, int stride, Buffer data); public abstract void enableVertexAttribArray(int index); public abstract void disableVertexAttribArray(int index); - public abstract void drawArrays(int mode, int first, int count); - public abstract void drawElements(int mode, int count, int type, int offset); - public abstract void drawElements(int mode, int count, int type, Buffer indices); + + public void drawArrays(int mode, int first, int count) { + geomCount += count; + drawArraysImpl(mode, first, count); + } + + public abstract void drawArraysImpl(int mode, int first, int count); + + public void drawElements(int mode, int count, int type, int offset) { + geomCount += count; + drawElementsImpl(mode, count, type, offset); + } + + public abstract void drawElementsImpl(int mode, int count, int type, int offset); ////////////////////////////////////////////////////////////////////////////// @@ -2956,7 +3328,6 @@ public void bindTexture(int target, int texture) { public abstract void blendFunc(int src, int dst); public abstract void blendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha); public abstract void blendColor(float red, float green, float blue, float alpha); - public abstract void alphaFunc(int func, float ref); /////////////////////////////////////////////////////////// @@ -2966,19 +3337,19 @@ public void bindTexture(int target, int texture) { public abstract void depthMask(boolean mask); public abstract void stencilMask(int mask); public abstract void stencilMaskSeparate(int face, int mask); - public abstract void clear(int buf); public abstract void clearColor(float r, float g, float b, float a); public abstract void clearDepth(float d); public abstract void clearStencil(int s); + public abstract void clear(int buf); /////////////////////////////////////////////////////////// // Framebuffers Objects public void bindFramebuffer(int target, int framebuffer) { - pg.beginBindFramebuffer(target, framebuffer); + graphics.beginBindFramebuffer(target, framebuffer); bindFramebufferImpl(target, framebuffer); - pg.endBindFramebuffer(target, framebuffer); + graphics.endBindFramebuffer(target, framebuffer); } protected abstract void bindFramebufferImpl(int target, int framebuffer); @@ -2999,73 +3370,4 @@ public void bindFramebuffer(int target, int framebuffer) { public abstract void renderbufferStorageMultisample(int target, int samples, int format, int width, int height); public abstract void readBuffer(int buf); public abstract void drawBuffer(int buf); - - // Label pixels - - int[] labelPix = {-2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -1315861, -2171170, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -1118482, -1, -2105377, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -1052689, -1, -2105377, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2039584, -855310, -263173, -131587, -460552, -1315861, -2236963, -2236963, -1052689, -263173, -1, -460552, -1118482, -2236963, -2236963, -1776412, -657931, -197380, -197380, -723724, --1907998, -2236963, -2236963, -2236963, -789517, -1118482, -1447447, -460552, -197380, -789517, -1710619, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --526345, -131587, -921103, -1250068, -592138, -1, -1184275, -2236963, -1447447, -526345, -1, -1052689, -1513240, -2236963, -1710619, -1, -328966, -1184275, -1118482, -263173, -65794, -1776412, -2236963, -2236963, -394759, -263173, -65794, -1118482, -1381654, -394759, -131587, -1907998, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2039584, -1, -1184275, -2236963, -2236963, -2236963, -460552, -723724, -2236963, -2236963, -1052689, -1, -2105377, -2236963, -2171170, -328966, -263173, -2105377, -2236963, -2236963, -2039584, -197380, -460552, -2236963, -2236963, -394759, -1, -1513240, -2236963, -2236963, -2105377, -197380, -526345, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2171170, -65794, -394759, -1710619, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -1052689, -1, -2105377, -2236963, -1907998, -1, -1184275, -2236963, -2236963, -2236963, -2236963, -1052689, -1, -1973791, -2236963, -394759, -328966, -2236963, -2236963, -2236963, -2236963, -1052689, -65794, -2171170, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -1250068, -1, -1, -197380, -855310, -1579033, -2236963, -2236963, -2236963, -1052689, -1, -2105377, -2236963, -1579033, -1, -1579033, -2236963, -2236963, -2236963, -2236963, --1447447, -1, -1644826, -2236963, -394759, -657931, -2236963, -2236963, -2236963, -2236963, -1381654, -1, -1842205, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -1776412, -986896, -328966, -1, -1, -855310, -2236963, -2236963, -1052689, -1, -2105377, -2236963, -1447447, -1, -1644826, -2236963, -2236963, -2236963, -2236963, -1513240, -1, -1579033, -2236963, -394759, -789517, -2236963, -2236963, -2236963, -2236963, -1381654, -1, -1776412, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2105377, -2171170, -2236963, -2236963, -1907998, -460552, -1, -1973791, -2236963, -1052689, -1, -2105377, -2236963, -1776412, -1, -1381654, -2236963, -2236963, -2236963, -2236963, -1184275, -1, -1776412, -2236963, -394759, -526345, -2236963, -2236963, -2236963, -2236963, -1118482, -65794, -2171170, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -1776412, -1, -1250068, -2236963, -2236963, -2236963, -1250068, -1, -1776412, -2236963, -1118482, -1, -2039584, -2236963, -2105377, -131587, -460552, -2236963, -2236963, -2236963, -2236963, -328966, -131587, -2171170, -2236963, -394759, -1, -1907998, -2236963, -2236963, -2236963, -328966, -394759, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -592138, -197380, -1250068, -1842205, -1381654, -263173, -263173, -2236963, -2236963, -1250068, -1, -921103, -1579033, -2236963, -1250068, -1, -789517, -1776412, -1776412, -657931, --1, -1513240, -2236963, -2236963, -394759, -1, -394759, -1644826, -1776412, -723724, -65794, -1776412, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --1842205, -460552, -1, -1, -1, -526345, -1973791, -2236963, -2236963, -2039584, -394759, -1, -460552, -2236963, -2236963, -1315861, -131587, -1, -1, -394759, -1447447, -2236963, -2236963, -2236963, -394759, -460552, -855310, -1, -1, -394759, -1513240, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2039584, -1842205, -2171170, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2105377, -2171170, -2236963, -2236963, -2236963, -2236963, -1973791, -2039584, -2236963, -2236963, -2236963, -2236963, -2236963, -394759, -526345, -2236963, -2105377, -1973791, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -394759, -526345, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -394759, -526345, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -1184275, -1250068, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, --2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963, -2236963 - }; - } diff --git a/core/src/processing/opengl/PGraphics2D.java b/core/src/processing/opengl/PGraphics2D.java index daa5b8611c..8fbdd5eff9 100644 --- a/core/src/processing/opengl/PGraphics2D.java +++ b/core/src/processing/opengl/PGraphics2D.java @@ -3,11 +3,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2012 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,7 +20,7 @@ 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.opengl; @@ -249,6 +251,31 @@ static protected PShape loadShapeImpl(PGraphics pg, } + ////////////////////////////////////////////////////////////// + + // SCREEN TRANSFORMS + + + @Override + public float modelX(float x, float y, float z) { + showDepthWarning("modelX"); + return 0; + } + + + @Override + public float modelY(float x, float y, float z) { + showDepthWarning("modelY"); + return 0; + } + + + @Override + public float modelZ(float x, float y, float z) { + showDepthWarning("modelZ"); + return 0; + } + ////////////////////////////////////////////////////////////// diff --git a/core/src/processing/opengl/PGraphics3D.java b/core/src/processing/opengl/PGraphics3D.java index ec4cb81dc4..50b18b167e 100644 --- a/core/src/processing/opengl/PGraphics3D.java +++ b/core/src/processing/opengl/PGraphics3D.java @@ -3,11 +3,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2012 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,7 +20,7 @@ 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.opengl; diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 60f9bce2ce..b4f145eda6 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -3,11 +3,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2004-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,13 +20,13 @@ 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.opengl; import processing.core.*; -import java.awt.Font; +import java.io.File; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; import java.net.URL; @@ -40,16 +42,50 @@ public class PGraphicsOpenGL extends PGraphics { public PGL pgl; /** The renderer currently in use. */ - protected PGraphicsOpenGL currentPG; + public PGraphicsOpenGL currentPG; /** Font cache for texture objects. */ protected WeakHashMap fontMap; - // just to get things running properly, need to - static protected PSurfaceJOGL surfaceJOGL; - // ........................................................ + // Disposal of native resources + // Using the technique alternative to finalization described in: + // http://www.oracle.com/technetwork/articles/java/finalization-137655.html + private static ReferenceQueue refQueue = new ReferenceQueue<>(); + private static List> reachableWeakReferences = + new LinkedList<>(); + + static final private int MAX_DRAIN_GLRES_ITERATIONS = 10; + + static void drainRefQueueBounded() { + int iterations = 0; + while (iterations < MAX_DRAIN_GLRES_ITERATIONS) { + Disposable res = + (Disposable) refQueue.poll(); + if (res == null) { + break; + } + res.dispose(); + ++iterations; + } + } + + private static abstract class Disposable extends WeakReference { + protected Disposable(T obj) { + super(obj, refQueue); + drainRefQueueBounded(); + reachableWeakReferences.add(this); + } + + public void dispose() { + reachableWeakReferences.remove(this); + disposeNative(); + } + + abstract public void disposeNative(); + } + // Basic rendering parameters: /** Whether the PGraphics object is ready to render or not. */ @@ -83,15 +119,6 @@ public class PGraphicsOpenGL extends PGraphics { protected VertexBuffer bufPolyEmissive; protected VertexBuffer bufPolyShininess; protected VertexBuffer bufPolyIndex; -// public int glPolyVertex; -// public int glPolyColor; -// public int glPolyNormal; -// public int glPolyTexcoord; -// public int glPolyAmbient; -// public int glPolySpecular; -// public int glPolyEmissive; -// public int glPolyShininess; -// public int glPolyIndex; protected boolean polyBuffersCreated = false; protected int polyBuffersContext; @@ -99,10 +126,6 @@ public class PGraphicsOpenGL extends PGraphics { protected VertexBuffer bufLineColor; protected VertexBuffer bufLineAttrib; protected VertexBuffer bufLineIndex; -// public int glLineVertex; -// public int glLineColor; -// public int glLineAttrib; -// public int glLineIndex; protected boolean lineBuffersCreated = false; protected int lineBuffersContext; @@ -110,10 +133,6 @@ public class PGraphicsOpenGL extends PGraphics { protected VertexBuffer bufPointColor; protected VertexBuffer bufPointAttrib; protected VertexBuffer bufPointIndex; -// public int glPointVertex; -// public int glPointColor; -// public int glPointAttrib; -// public int glPointIndex; protected boolean pointBuffersCreated = false; protected int pointBuffersContext; @@ -136,6 +155,8 @@ public class PGraphicsOpenGL extends PGraphics { static public boolean packedDepthStencilSupported; static public boolean anisoSamplingSupported; static public boolean blendEqSupported; + static public boolean readBufferSupported; + static public boolean drawBufferSupported; /** Some hardware limits */ static public int maxTextureSize; @@ -153,25 +174,6 @@ public class PGraphicsOpenGL extends PGraphics { // ........................................................ - // GL resources: - -// static protected HashMap glTextureObjects = -// new HashMap(); -// static protected HashMap glVertexBuffers = -// new HashMap(); - static protected HashMap glFrameBuffers = - new HashMap(); - static protected HashMap glRenderBuffers = - new HashMap(); -// static protected HashMap glslPrograms = -// new HashMap(); -// static protected HashMap glslVertexShaders = -// new HashMap(); -// static protected HashMap glslFragmentShaders = -// new HashMap(); - - // ........................................................ - // Shaders static protected URL defColorShaderVertURL = @@ -232,6 +234,22 @@ public class PGraphicsOpenGL extends PGraphics { // ........................................................ + // Async pixel reader + + protected AsyncPixelReader asyncPixelReader; + protected boolean asyncPixelReaderInitialized; + + // Keeps track of ongoing transfers so they can be finished. + // Set is copied to the List when we need to iterate it + // so that readers can remove themselves from the Set during + // iteration if they don't have any ongoing transfers. + protected static final Set + ongoingPixelTransfers = new HashSet<>(); + protected static final List + ongoingPixelTransfersIterable = new ArrayList<>(); + + // ........................................................ + // Camera: /** Camera field of view. */ @@ -244,6 +262,12 @@ public class PGraphicsOpenGL extends PGraphics { /** Aspect ratio of camera's view. */ public float cameraAspect; + /** Default camera properties. */ + public float defCameraFOV; + public float defCameraX, defCameraY, defCameraZ; + public float defCameraNear, defCameraFar; + public float defCameraAspect; + /** Distance between camera eye and center. */ protected float eyeDist; @@ -393,10 +417,10 @@ public class PGraphicsOpenGL extends PGraphics { // Screen surface: /** Texture containing the current frame */ - protected Texture texture; + protected Texture texture = null; /** Texture containing the previous frame */ - protected Texture ptexture; + protected Texture ptexture = null; /** IntBuffer wrapping the pixels array. */ protected IntBuffer pixelBuffer; @@ -408,15 +432,11 @@ public class PGraphicsOpenGL extends PGraphics { protected IntBuffer nativePixelBuffer; /** texture used to apply a filter on the screen image. */ - protected Texture filterTexture; + protected Texture filterTexture = null; /** PImage that wraps filterTexture. */ protected PImage filterImage; - /** Flag to indicate that pixels array is up-to-date and - * ready to be manipulated through the set()/get() methods */ - protected boolean arePixelsUpToDate; - // ........................................................ // Utility variables: @@ -424,9 +444,6 @@ public class PGraphicsOpenGL extends PGraphics { /** True if we are inside a beginDraw()/endDraw() block. */ protected boolean drawing = false; - /** Used to indicate an OpenGL surface recreation */ - protected boolean restoreSurface = false; - /** Used to detect continuous use of the smooth/noSmooth functions */ protected boolean smoothDisabled = false; protected int smoothCallCount = 0; @@ -445,10 +462,6 @@ public class PGraphicsOpenGL extends PGraphics { /** Viewport dimensions. */ protected IntBuffer viewport; - /** Used to register calls to glClear. */ - protected boolean clearColorBuffer; - protected boolean clearColorBuffer0; - protected boolean openContour = false; protected boolean breakShape = false; protected boolean defaultEdges = false; @@ -540,6 +553,12 @@ public class PGraphicsOpenGL extends PGraphics { "to render this geometry properly, using default shader instead."; static final String TESSELLATION_ERROR = "Tessellation Error: %1$s"; + static final String GL_THREAD_NOT_CURRENT = + "You are trying to draw outside OpenGL's animation thread.\n" + + "Place all drawing commands in the draw() function, or inside\n" + + "your own functions as long as they are called from draw(),\n" + + "but not in event handling functions such as keyPressed()\n" + + "or mousePressed()."; ////////////////////////////////////////////////////////////// @@ -582,6 +601,15 @@ public PGraphicsOpenGL() { } + @Override + public void setParent(PApplet parent) { + super.setParent(parent); + if (pgl != null) { + pgl.sketch = parent; + } + } + + @Override public void setPrimary(boolean primary) { super.setPrimary(primary); @@ -589,7 +617,7 @@ public void setPrimary(boolean primary) { format = ARGB; if (primary) { fbStack = new FrameBuffer[FB_STACK_DEPTH]; - fontMap = new WeakHashMap(); + fontMap = new WeakHashMap<>(); tessellator = new Tessellator(); } else { tessellator = getPrimaryPG().tessellator; @@ -603,26 +631,31 @@ public void setPrimary(boolean primary) { //public void setAntiAlias(int samples) // PGraphics -// @Override -// public void setFrameRate(float frameRate) { -// pgl.setFps(frameRate); -// } - - @Override public void setSize(int iwidth, int iheight) { width = iwidth; height = iheight; updatePixelSize(); + texture = null; + ptexture = null; + // 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; + defCameraFOV = 60 * DEG_TO_RAD; // at least for now + defCameraX = width / 2.0f; + defCameraY = height / 2.0f; + defCameraZ = defCameraY / ((float) Math.tan(defCameraFOV / 2.0f)); + defCameraNear = defCameraZ / 10.0f; + defCameraFar = defCameraZ * 10.0f; + defCameraAspect = (float) width / (float) height; + + cameraFOV = defCameraFOV; + cameraX = defCameraX; + cameraY = defCameraY; + cameraZ = defCameraZ; + cameraNear = defCameraNear; + cameraFar = defCameraFar; + cameraAspect = defCameraAspect; sized = true; } @@ -630,80 +663,149 @@ public void setSize(int iwidth, int iheight) { @Override public void dispose() { // PGraphics - super.dispose(); - - if (primaryGraphics) { - // Swap buffers the end to make sure that no - // garbage is shown on the screen, this particularly - // affects non-interactive sketches on windows that - // render only 1 frame, so no enough rendering - // iterations have been conducted so far to properly - // initialize all the buffers. -// pgl.swapBuffers(); + if (asyncPixelReader != null) { + asyncPixelReader.dispose(); + asyncPixelReader = null; } -// finalizePolyBuffers(); -// finalizeLineBuffers(); -// finalizePointBuffers(); - - deleteSurfaceTextures(); - if (primaryGraphics) { - deleteDefaultShaders(); - } else { - if (offscreenFramebuffer != null) { - offscreenFramebuffer.dispose(); + if (!primaryGraphics) { + deleteSurfaceTextures(); + FrameBuffer ofb = offscreenFramebuffer; + FrameBuffer mfb = multisampleFramebuffer; + if (ofb != null) { + ofb.dispose(); } - if (multisampleFramebuffer != null) { - multisampleFramebuffer.dispose(); + if (mfb != null) { + mfb.dispose(); } } - deleteFinalizedGLResources(pgl); + pgl.dispose(); - if (primaryGraphics) { - pgl.deleteSurface(); - } + super.dispose(); } -// @Override -// protected void finalize() throws Throwable { -// try { -// finalizePolyBuffers(); -// finalizeLineBuffers(); -// finalizePointBuffers(); -// -// deleteSurfaceTextures(); -// if (!primaryGraphics) { -// if (offscreenFramebuffer != null) { -// offscreenFramebuffer.dispose(); -// offscreenFramebuffer = null; -// } -// if (multisampleFramebuffer != null) { -// multisampleFramebuffer.dispose(); -// multisampleFramebuffer = null; -// } -// } -// } finally { -// super.finalize(); -// } -// } protected void setFlushMode(int mode) { flushMode = mode; } + protected void updatePixelSize() { + float f = pgl.getPixelScale(); + pixelWidth = (int)(width * f); + pixelHeight = (int)(height * f); + if (primaryGraphics) { + parent.pixelWidth = pixelWidth; + parent.pixelHeight = pixelHeight; + } + } + + + ////////////////////////////////////////////////////////////// + + // PLATFORM-SPECIFIC CODE (Java, Android, etc.). Needs to be manually edited. + + + // Factory method + protected PGL createPGL(PGraphicsOpenGL pg) { + return new PJOGL(pg); +// return new PGLES(pg); + } + + +/* + @Override + // Android only + public void setFrameRate(float frameRate) { + pgl.setFrameRate(frameRate); + } + + @Override + // Android only + public boolean canDraw() { + return pgl.canDraw(); + } + + + @Override + // Android only + public void requestDraw() { + if (primaryGraphics) { + if (initialized) { + if (sized) pgl.reinitSurface(); + if (parent.canDraw()) pgl.requestDraw(); + } else { + initPrimary(); + } + } + } +*/ + + + @Override + // Java only public PSurface createSurface() { // ignore - surfaceJOGL = new PSurfaceJOGL(this); - return surfaceJOGL; + return surface = new PSurfaceJOGL(this); } - protected void updatePixelSize() { - float f = getPixelScale(); - pixelWidth = (int)(width * f); - pixelHeight = (int)(height * f); + public boolean saveImpl(String filename) { +// return super.save(filename); // ASYNC save frame using PBOs not yet available on Android + + if (getHint(DISABLE_ASYNC_SAVEFRAME)) { + // Act as an opaque surface for the purposes of saving. + if (primaryGraphics) { + int prevFormat = format; + format = RGB; + boolean result = super.save(filename); + format = prevFormat; + return result; + } + + return super.save(filename); + } + + if (asyncImageSaver == null) { + asyncImageSaver = new AsyncImageSaver(); + } + + if (!asyncPixelReaderInitialized) { + // First call! Get this guy initialized + if (pgl.hasPBOs() && pgl.hasSynchronization()) { + asyncPixelReader = new AsyncPixelReader(); + } + asyncPixelReaderInitialized = true; + } + + if (asyncPixelReader != null && !loaded) { + boolean needEndDraw = false; + if (!drawing) { + beginDraw(); + needEndDraw = true; + } + flush(); + updatePixelSize(); + + // get the whole async package + asyncPixelReader.readAndSaveAsync(parent.sketchFile(filename)); + + if (needEndDraw) endDraw(); + } else { + // async transfer is not supported or + // pixels are already in memory, just do async save + if (!loaded) loadPixels(); + int format = primaryGraphics ? RGB : ARGB; + PImage target = asyncImageSaver.getAvailableTarget(pixelWidth, pixelHeight, + format); + if (target == null) return false; + int count = PApplet.min(pixels.length, target.pixels.length); + System.arraycopy(pixels, 0, target.pixels, 0, count); + asyncImageSaver.saveTargetAsync(this, target, parent.sketchFile(filename)); + } + + return true; } @@ -714,13 +816,25 @@ protected void updatePixelSize() { @Override public void setCache(PImage image, Object storage) { + if (image instanceof PGraphicsOpenGL) { + // Prevent strong reference to the key from the value by wrapping + // the Texture into WeakReference (proposed solution by WeakHashMap docs) + getPrimaryPG().cacheMap.put(image, new WeakReference<>(storage)); + return; + } getPrimaryPG().cacheMap.put(image, storage); } @Override + @SuppressWarnings("rawtypes") public Object getCache(PImage image) { - return getPrimaryPG().cacheMap.get(image); + Object storage = getPrimaryPG().cacheMap.get(image); + if (storage != null && storage.getClass() == WeakReference.class) { + // Unwrap the value, use getClass() for fast check + return ((WeakReference) storage).get(); + } + return storage; } @@ -730,12 +844,6 @@ public void removeCache(PImage image) { } - public float getPixelScale() { - if (surfaceJOGL == null) return pixelDensity; - else return surfaceJOGL.getPixelScale(); - } - - ////////////////////////////////////////////////////////////// @@ -756,56 +864,27 @@ protected void removeFontTexture(PFont font) { ////////////////////////////////////////////////////////////// - // RESOURCE HANDLING - // Using the technique alternative to finalization described in: - // http://www.oracle.com/technetwork/articles/java/finalization-137655.html - - static final private int MAX_DRAIN_GLRES_ITERATIONS = 10; - protected static class GLResourceTexture extends WeakReference { + protected static class GLResourceTexture extends Disposable { int glName; private PGL pgl; private int context; - static private ReferenceQueue refQueue = new ReferenceQueue(); - static private List refList = new ArrayList(); - - static void drainRefQueueBounded() { - ReferenceQueue refQueue = GLResourceTexture.referenceQueue(); - int iterations = 0; - while (iterations < MAX_DRAIN_GLRES_ITERATIONS) { - GLResourceTexture res = (GLResourceTexture)refQueue.poll(); - if (res == null) { - break; - } - System.out.println("Disposing texture resource " + iterations + " " + res.hashCode()); - res.dispose(); - ++iterations; - } - } - - static ReferenceQueue referenceQueue() { - return refQueue; - } - public GLResourceTexture(Texture tex) { - super(tex, refQueue); + super(tex); - drainRefQueueBounded(); - this.pgl = tex.pgl; + pgl = tex.pg.getPrimaryPGL(); pgl.genTextures(1, intBuffer); tex.glName = intBuffer.get(0); this.glName = tex.glName; - this.context = tex.context; - - refList.add(this); } - private void disposeNative() { + @Override + public void disposeNative() { if (pgl != null) { if (glName != 0) { intBuffer.put(0, glName); @@ -816,13 +895,11 @@ private void disposeNative() { } } - void dispose() { - refList.remove(this); - disposeNative(); - } - @Override public boolean equals(Object obj) { + if (!(obj instanceof GLResourceTexture)) { + return false; + } GLResourceTexture other = (GLResourceTexture)obj; return other.glName == glName && other.context == context; @@ -838,50 +915,25 @@ public int hashCode() { } - protected static class GLResourceVertexBuffer extends WeakReference { + protected static class GLResourceVertexBuffer extends Disposable { int glId; private PGL pgl; private int context; - static private ReferenceQueue refQueue = new ReferenceQueue(); - static private List refList = new ArrayList(); - - static void drainRefQueueBounded() { - ReferenceQueue refQueue = GLResourceVertexBuffer.referenceQueue(); - int iterations = 0; - while (iterations < MAX_DRAIN_GLRES_ITERATIONS) { - GLResourceVertexBuffer res = (GLResourceVertexBuffer)refQueue.poll(); - if (res == null) { - break; - } - System.out.println("Disposing VertexBuffer resource " + iterations + " " + res.hashCode()); - res.dispose(); - ++iterations; - } - } - - static ReferenceQueue referenceQueue() { - return refQueue; - } - public GLResourceVertexBuffer(VertexBuffer vbo) { - super(vbo, refQueue); + super(vbo); - drainRefQueueBounded(); - - this.pgl = vbo.pgl; + pgl = vbo.pgl.graphics.getPrimaryPGL(); pgl.genBuffers(1, intBuffer); vbo.glId = intBuffer.get(0); this.glId = vbo.glId; - this.context = vbo.context; - - refList.add(this); } - private void disposeNative() { + @Override + public void disposeNative() { if (pgl != null) { if (glId != 0) { intBuffer.put(0, glId); @@ -892,13 +944,11 @@ private void disposeNative() { } } - void dispose() { - refList.remove(this); - disposeNative(); - } - @Override public boolean equals(Object obj) { + if (!(obj instanceof GLResourceVertexBuffer)) { + return false; + } GLResourceVertexBuffer other = (GLResourceVertexBuffer)obj; return other.glId == glId && other.context == context; @@ -914,7 +964,7 @@ public int hashCode() { } - protected static class GLResourceShader extends WeakReference { + protected static class GLResourceShader extends Disposable { int glProgram; int glVertex; int glFragment; @@ -922,33 +972,10 @@ protected static class GLResourceShader extends WeakReference { private PGL pgl; private int context; - static private ReferenceQueue refQueue = new ReferenceQueue(); - static private List refList = new ArrayList(); - - static void drainRefQueueBounded() { - ReferenceQueue refQueue = GLResourceShader.referenceQueue(); - int iterations = 0; - while (iterations < MAX_DRAIN_GLRES_ITERATIONS) { - GLResourceShader res = (GLResourceShader)refQueue.poll(); - if (res == null) { - break; - } - System.out.println("Disposing shader resource " + res.hashCode()); - res.dispose(); - ++iterations; - } - } - - static ReferenceQueue referenceQueue() { - return refQueue; - } - public GLResourceShader(PShader sh) { - super(sh, refQueue); + super(sh); - drainRefQueueBounded(); - - this.pgl = sh.pgl; + this.pgl = sh.pgl.graphics.getPrimaryPGL(); sh.glProgram = pgl.createProgram(); sh.glVertex = pgl.createShader(PGL.VERTEX_SHADER); sh.glFragment = pgl.createShader(PGL.FRAGMENT_SHADER); @@ -958,11 +985,10 @@ public GLResourceShader(PShader sh) { this.glFragment = sh.glFragment; this.context = sh.context; - - refList.add(this); } - private void disposeNative() { + @Override + public void disposeNative() { if (pgl != null) { if (glFragment != 0) { pgl.deleteShader(glFragment); @@ -980,13 +1006,11 @@ private void disposeNative() { } } - void dispose() { - refList.remove(this); - disposeNative(); - } - @Override public boolean equals(Object obj) { + if (!(obj instanceof GLResourceShader)) { + return false; + } GLResourceShader other = (GLResourceShader)obj; return other.glProgram == glProgram && other.glVertex == glVertex && @@ -1000,496 +1024,117 @@ public int hashCode() { result = 31 * result + glProgram; result = 31 * result + glVertex; result = 31 * result + glFragment; - result = 31 * result + context; - return result; - } - } - - - - // http://www.oracle.com/technetwork/articles/java/finalization-137655.html - protected static class GLResource { - int id; - int context; - - GLResource(int id, int context) { - this.id = id; - this.context = context; - } - - @Override - public boolean equals(Object obj) { - GLResource other = (GLResource)obj; - return other.id == id && other.context == context; - } - - @Override - public int hashCode() { - int result = 17; - result = 31 * result + id; - result = 31 * result + context; - return result; - } - } - - - // Texture Objects ----------------------------------------------------------- - - /* - protected static int createTextureObject(int context, PGL pgl) { - deleteFinalizedTextureObjects(pgl); - - pgl.genTextures(1, intBuffer); - int id = intBuffer.get(0); - - GLResource res = new GLResource(id, context); - if (!glTextureObjects.containsKey(res)) { - glTextureObjects.put(res, false); - } - - return id; - } - - protected static void deleteTextureObject(int id, int context, PGL pgl) { - GLResource res = new GLResource(id, context); - if (glTextureObjects.containsKey(res)) { - intBuffer.put(0, id); - if (pgl.threadIsCurrent()) pgl.deleteTextures(1, intBuffer); - glTextureObjects.remove(res); - } - } - - protected static void deleteAllTextureObjects(PGL pgl) { - for (GLResource res : glTextureObjects.keySet()) { - intBuffer.put(0, res.id); - if (pgl.threadIsCurrent()) pgl.deleteTextures(1, intBuffer); - } - glTextureObjects.clear(); - } - - // This is synchronized because it is called from the GC thread. - synchronized protected static void finalizeTextureObject(int id, int context) { - GLResource res = new GLResource(id, context); - if (glTextureObjects.containsKey(res)) { - glTextureObjects.put(res, true); - } - } - - protected static void deleteFinalizedTextureObjects(PGL pgl) { - Set finalized = new HashSet(); - - for (GLResource res : glTextureObjects.keySet()) { - if (glTextureObjects.get(res)) { - finalized.add(res); - intBuffer.put(0, res.id); - if (pgl.threadIsCurrent()) pgl.deleteTextures(1, intBuffer); - } - } - - for (GLResource res : finalized) { - glTextureObjects.remove(res); - } - } - - protected static void removeTextureObject(int id, int context) { - GLResource res = new GLResource(id, context); - if (glTextureObjects.containsKey(res)) { - glTextureObjects.remove(res); - } - } -*/ - - // Vertex Buffer Objects ----------------------------------------------------- - - /* - protected static int createVertexBufferObject(int context, PGL pgl) { - deleteFinalizedVertexBufferObjects(pgl); - - pgl.genBuffers(1, intBuffer); - int id = intBuffer.get(0); - - GLResource res = new GLResource(id, context); - if (!glVertexBuffers.containsKey(res)) { - glVertexBuffers.put(res, false); - } - - return id; - } - - protected static void deleteVertexBufferObject(int id, int context, PGL pgl) { - GLResource res = new GLResource(id, context); - if (glVertexBuffers.containsKey(res)) { - intBuffer.put(0, id); - if (pgl.threadIsCurrent()) pgl.deleteBuffers(1, intBuffer); - glVertexBuffers.remove(res); - } - } - - protected static void deleteAllVertexBufferObjects(PGL pgl) { - for (GLResource res : glVertexBuffers.keySet()) { - intBuffer.put(0, res.id); - if (pgl.threadIsCurrent()) pgl.deleteBuffers(1, intBuffer); - } - glVertexBuffers.clear(); - } - - // This is synchronized because it is called from the GC thread. - synchronized static protected void finalizeVertexBufferObject(int id, int context) { - GLResource res = new GLResource(id, context); - if (glVertexBuffers.containsKey(res)) { - glVertexBuffers.put(res, true); - } - } - - protected static void deleteFinalizedVertexBufferObjects(PGL pgl) { - Set finalized = new HashSet(); - - for (GLResource res : glVertexBuffers.keySet()) { - if (glVertexBuffers.get(res)) { - finalized.add(res); - intBuffer.put(0, res.id); - if (pgl.threadIsCurrent()) pgl.deleteBuffers(1, intBuffer); - } - } - - for (GLResource res : finalized) { - glVertexBuffers.remove(res); - } - } - - protected static void removeVertexBufferObject(int id, int context) { - GLResource res = new GLResource(id, context); - if (glVertexBuffers.containsKey(res)) { - glVertexBuffers.remove(res); - } - } - */ - - // FrameBuffer Objects ------------------------------------------------------- - - protected static int createFrameBufferObject(int context, PGL pgl) { - deleteFinalizedFrameBufferObjects(pgl); - - pgl.genFramebuffers(1, intBuffer); - int id = intBuffer.get(0); - - GLResource res = new GLResource(id, context); - if (!glFrameBuffers.containsKey(res)) { - glFrameBuffers.put(res, false); - } - - return id; - } - - protected static void deleteFrameBufferObject(int id, int context, PGL pgl) { - GLResource res = new GLResource(id, context); - if (glFrameBuffers.containsKey(res)) { - intBuffer.put(0, id); - if (pgl.threadIsCurrent()) pgl.deleteFramebuffers(1, intBuffer); - glFrameBuffers.remove(res); - } - } - - protected static void deleteAllFrameBufferObjects(PGL pgl) { - for (GLResource res : glFrameBuffers.keySet()) { - intBuffer.put(0, res.id); - if (pgl.threadIsCurrent()) pgl.deleteFramebuffers(1, intBuffer); - } - glFrameBuffers.clear(); - } - - // This is synchronized because it is called from the GC thread. - synchronized static protected void finalizeFrameBufferObject(int id, int context) { - GLResource res = new GLResource(id, context); - if (glFrameBuffers.containsKey(res)) { - glFrameBuffers.put(res, true); - } - } - - protected static void deleteFinalizedFrameBufferObjects(PGL pgl) { - Set finalized = new HashSet(); - - for (GLResource res : glFrameBuffers.keySet()) { - if (glFrameBuffers.get(res)) { - finalized.add(res); - intBuffer.put(0, res.id); - if (pgl.threadIsCurrent()) { - pgl.deleteFramebuffers(1, intBuffer); - } - } - } - - for (GLResource res : finalized) { - glFrameBuffers.remove(res); - } - } - - protected static void removeFrameBufferObject(int id, int context) { - GLResource res = new GLResource(id, context); - if (glFrameBuffers.containsKey(res)) { - glFrameBuffers.remove(res); - } - } - - // RenderBuffer Objects ------------------------------------------------------ - - protected static int createRenderBufferObject(int context, PGL pgl) { - deleteFinalizedRenderBufferObjects(pgl); - - pgl.genRenderbuffers(1, intBuffer); - int id = intBuffer.get(0); - - GLResource res = new GLResource(id, context); - if (!glRenderBuffers.containsKey(res)) { - glRenderBuffers.put(res, false); - } - - return id; - } - - protected static void deleteRenderBufferObject(int id, int context, PGL pgl) { - GLResource res = new GLResource(id, context); - if (glRenderBuffers.containsKey(res)) { - intBuffer.put(0, id); - if (pgl.threadIsCurrent()) pgl.deleteRenderbuffers(1, intBuffer); - glRenderBuffers.remove(res); - } - } - - protected static void deleteAllRenderBufferObjects(PGL pgl) { - for (GLResource res : glRenderBuffers.keySet()) { - intBuffer.put(0, res.id); - if (pgl.threadIsCurrent()) pgl.deleteRenderbuffers(1, intBuffer); - } - glRenderBuffers.clear(); - } - - // This is synchronized because it is called from the GC thread. - synchronized static protected void finalizeRenderBufferObject(int id, int context) { - GLResource res = new GLResource(id, context); - if (glRenderBuffers.containsKey(res)) { - glRenderBuffers.put(res, true); - } - } - - protected static void deleteFinalizedRenderBufferObjects(PGL pgl) { - Set finalized = new HashSet(); - - for (GLResource res : glRenderBuffers.keySet()) { - if (glRenderBuffers.get(res)) { - finalized.add(res); - intBuffer.put(0, res.id); - if (pgl.threadIsCurrent()) pgl.deleteRenderbuffers(1, intBuffer); - } - } - - for (GLResource res : finalized) { - glRenderBuffers.remove(res); - } - } - - protected static void removeRenderBufferObject(int id, int context) { - GLResource res = new GLResource(id, context); - if (glRenderBuffers.containsKey(res)) { - glRenderBuffers.remove(res); - } - } - - /* - // GLSL Program Objects ------------------------------------------------------ - - protected static int createGLSLProgramObject(int context, PGL pgl) { - deleteFinalizedGLSLProgramObjects(pgl); - - int id = pgl.createProgram(); - - GLResource res = new GLResource(id, context); - if (!glslPrograms.containsKey(res)) { - glslPrograms.put(res, false); - } - - return id; - } - - protected static void deleteGLSLProgramObject(int id, int context, PGL pgl) { - GLResource res = new GLResource(id, context); - if (glslPrograms.containsKey(res)) { - if (pgl.threadIsCurrent()) pgl.deleteProgram(res.id); - glslPrograms.remove(res); - } - } - - protected static void deleteAllGLSLProgramObjects(PGL pgl) { - for (GLResource res : glslPrograms.keySet()) { - if (pgl.threadIsCurrent()) pgl.deleteProgram(res.id); - } - glslPrograms.clear(); - } - - // This is synchronized because it is called from the GC thread. - synchronized static protected void finalizeGLSLProgramObject(int id, int context) { - GLResource res = new GLResource(id, context); - if (glslPrograms.containsKey(res)) { - glslPrograms.put(res, true); - } - } - - protected static void deleteFinalizedGLSLProgramObjects(PGL pgl) { - Set finalized = new HashSet(); - - for (GLResource res : glslPrograms.keySet()) { - if (glslPrograms.get(res)) { - finalized.add(res); - if (pgl.threadIsCurrent()) pgl.deleteProgram(res.id); - } - } - - for (GLResource res : finalized) { - glslPrograms.remove(res); - } - } - - protected static void removeGLSLProgramObject(int id, int context) { - GLResource res = new GLResource(id, context); - if (glslPrograms.containsKey(res)) { - glslPrograms.remove(res); - } - } - - // GLSL Vertex Shader Objects ------------------------------------------------ - - protected static int createGLSLVertShaderObject(int context, PGL pgl) { - deleteFinalizedGLSLVertShaderObjects(pgl); - - int id = pgl.createShader(PGL.VERTEX_SHADER); - - GLResource res = new GLResource(id, context); - if (!glslVertexShaders.containsKey(res)) { - glslVertexShaders.put(res, false); - } - - return id; - } - - protected static void deleteGLSLVertShaderObject(int id, int context, PGL pgl) { - GLResource res = new GLResource(id, context); - if (glslVertexShaders.containsKey(res)) { - if (pgl.threadIsCurrent()) pgl.deleteShader(res.id); - glslVertexShaders.remove(res); - } - } - - protected static void deleteAllGLSLVertShaderObjects(PGL pgl) { - for (GLResource res : glslVertexShaders.keySet()) { - if (pgl.threadIsCurrent()) pgl.deleteShader(res.id); - } - glslVertexShaders.clear(); - } - - // This is synchronized because it is called from the GC thread. - synchronized static protected void finalizeGLSLVertShaderObject(int id, - int context) { - GLResource res = new GLResource(id, context); - if (glslVertexShaders.containsKey(res)) { - glslVertexShaders.put(res, true); - } - } - - protected static void deleteFinalizedGLSLVertShaderObjects(PGL pgl) { - Set finalized = new HashSet(); - - for (GLResource res : glslVertexShaders.keySet()) { - if (glslVertexShaders.get(res)) { - finalized.add(res); - if (pgl.threadIsCurrent()) pgl.deleteShader(res.id); - } - } - - for (GLResource res : finalized) { - glslVertexShaders.remove(res); + result = 31 * result + context; + return result; } } - protected static void removeGLSLVertShaderObject(int id, int context) { - GLResource res = new GLResource(id, context); - if (glslVertexShaders.containsKey(res)) { - glslVertexShaders.remove(res); - } - } - // GLSL Fragment Shader Objects ---------------------------------------------- + protected static class GLResourceFrameBuffer extends Disposable { + int glFbo; + int glDepth; + int glStencil; + int glDepthStencil; + int glMultisample; - protected static int createGLSLFragShaderObject(int context, PGL pgl) { - deleteFinalizedGLSLFragShaderObjects(pgl); + private PGL pgl; + private int context; - int id = pgl.createShader(PGL.FRAGMENT_SHADER); + public GLResourceFrameBuffer(FrameBuffer fb) { + super(fb); - GLResource res = new GLResource(id, context); - if (!glslFragmentShaders.containsKey(res)) { - glslFragmentShaders.put(res, false); - } + pgl = fb.pg.getPrimaryPGL(); + if (!fb.screenFb) { + pgl.genFramebuffers(1, intBuffer); + fb.glFbo = intBuffer.get(0); - return id; - } + if (fb.multisample) { + pgl.genRenderbuffers(1, intBuffer); + fb.glMultisample = intBuffer.get(0); + } - protected static void deleteGLSLFragShaderObject(int id, int context, PGL pgl) { - GLResource res = new GLResource(id, context); - if (glslFragmentShaders.containsKey(res)) { - if (pgl.threadIsCurrent()) pgl.deleteShader(res.id); - glslFragmentShaders.remove(res); - } - } + if (fb.packedDepthStencil) { + pgl.genRenderbuffers(1, intBuffer); + fb.glDepthStencil = intBuffer.get(0); + } else { + if (0 < fb.depthBits) { + pgl.genRenderbuffers(1, intBuffer); + fb.glDepth = intBuffer.get(0); + } + if (0 < fb.stencilBits) { + pgl.genRenderbuffers(1, intBuffer); + fb.glStencil = intBuffer.get(0); + } + } - protected static void deleteAllGLSLFragShaderObjects(PGL pgl) { - for (GLResource res : glslFragmentShaders.keySet()) { - if (pgl.threadIsCurrent()) pgl.deleteShader(res.id); - } - glslFragmentShaders.clear(); - } + this.glFbo = fb.glFbo; + this.glDepth = fb.glDepth; + this.glStencil = fb.glStencil; + this.glDepthStencil = fb.glDepthStencil; + this.glMultisample = fb.glMultisample; + } - // This is synchronized because it is called from the GC thread. - synchronized static protected void finalizeGLSLFragShaderObject(int id, - int context) { - GLResource res = new GLResource(id, context); - if (glslFragmentShaders.containsKey(res)) { - glslFragmentShaders.put(res, true); + this.context = fb.context; } - } - - protected static void deleteFinalizedGLSLFragShaderObjects(PGL pgl) { - Set finalized = new HashSet(); - for (GLResource res : glslFragmentShaders.keySet()) { - if (glslFragmentShaders.get(res)) { - finalized.add(res); - if (pgl.threadIsCurrent()) pgl.deleteShader(res.id); + @Override + public void disposeNative() { + if (pgl != null) { + if (glFbo != 0) { + intBuffer.put(0, glFbo); + pgl.deleteFramebuffers(1, intBuffer); + glFbo = 0; + } + if (glDepth != 0) { + intBuffer.put(0, glDepth); + pgl.deleteRenderbuffers(1, intBuffer); + glDepth = 0; + } + if (glStencil != 0) { + intBuffer.put(0, glStencil); + pgl.deleteRenderbuffers(1, intBuffer); + glStencil = 0; + } + if (glDepthStencil != 0) { + intBuffer.put(0, glDepthStencil); + pgl.deleteRenderbuffers(1, intBuffer); + glDepthStencil = 0; + } + if (glMultisample != 0) { + intBuffer.put(0, glMultisample); + pgl.deleteRenderbuffers(1, intBuffer); + glMultisample = 0; + } + pgl = null; } } - for (GLResource res : finalized) { - glslFragmentShaders.remove(res); + @Override + public boolean equals(Object obj) { + if (!(obj instanceof GLResourceFrameBuffer)) { + return false; + } + GLResourceFrameBuffer other = (GLResourceFrameBuffer)obj; + return other.glFbo == glFbo && + other.glDepth == glDepth && + other.glStencil == glStencil && + other.glDepthStencil == glDepthStencil && + other.glMultisample == glMultisample && + other.context == context; } - } - protected static void removeGLSLFragShaderObject(int id, int context) { - GLResource res = new GLResource(id, context); - if (glslFragmentShaders.containsKey(res)) { - glslFragmentShaders.remove(res); + @Override + public int hashCode() { + int result = 17; + result = 31 * result + glFbo; + result = 31 * result + glDepth; + result = 31 * result + glStencil; + result = 31 * result + glDepthStencil; + result = 31 * result + glMultisample; + result = 31 * result + context; + return result; } } - */ - - // All OpenGL resources ------------------------------------------------------ - - protected static void deleteFinalizedGLResources(PGL pgl) { -// deleteFinalizedTextureObjects(pgl); -// deleteFinalizedVertexBufferObjects(pgl); - deleteFinalizedFrameBufferObjects(pgl); - deleteFinalizedRenderBufferObjects(pgl); -// deleteFinalizedGLSLProgramObjects(pgl); -// deleteFinalizedGLSLVertShaderObjects(pgl); -// deleteFinalizedGLSLFragShaderObjects(pgl); - } ////////////////////////////////////////////////////////////// @@ -1545,12 +1190,7 @@ protected void createPolyBuffers() { if (!polyBuffersCreated || polyBuffersContextIsOutdated()) { polyBuffersContext = pgl.getCurrentContext(); -// int sizef = INIT_VERTEX_BUFFER_SIZE * PGL.SIZEOF_FLOAT; -// int sizei = INIT_VERTEX_BUFFER_SIZE * PGL.SIZEOF_INT; -// int sizex = INIT_INDEX_BUFFER_SIZE * PGL.SIZEOF_INDEX; - - - bufPolyVertex = new VertexBuffer(this, PGL.ARRAY_BUFFER, 3, PGL.SIZEOF_FLOAT); + bufPolyVertex = new VertexBuffer(this, PGL.ARRAY_BUFFER, 4, PGL.SIZEOF_FLOAT); bufPolyColor = new VertexBuffer(this, PGL.ARRAY_BUFFER, 1, PGL.SIZEOF_INT); bufPolyNormal = new VertexBuffer(this, PGL.ARRAY_BUFFER, 3, PGL.SIZEOF_FLOAT); bufPolyTexcoord = new VertexBuffer(this, PGL.ARRAY_BUFFER, 2, PGL.SIZEOF_FLOAT); @@ -1562,44 +1202,6 @@ protected void createPolyBuffers() { bufPolyIndex = new VertexBuffer(this, PGL.ELEMENT_ARRAY_BUFFER, 1, PGL.SIZEOF_INDEX, true); pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); - -// glPolyVertex = createVertexBufferObject(polyBuffersContext, pgl); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyVertex); -// pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW); -// -// glPolyColor = createVertexBufferObject(polyBuffersContext, pgl); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyColor); -// pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW); -// -// glPolyNormal = createVertexBufferObject(polyBuffersContext, pgl); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyNormal); -// pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW); -// -// glPolyTexcoord = createVertexBufferObject(polyBuffersContext, pgl); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyTexcoord); -// pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef, null, PGL.STATIC_DRAW); -// -// glPolyAmbient = createVertexBufferObject(polyBuffersContext, pgl); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyAmbient); -// pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW); -// -// glPolySpecular = createVertexBufferObject(polyBuffersContext, pgl); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolySpecular); -// pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW); -// -// glPolyEmissive = createVertexBufferObject(polyBuffersContext, pgl); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyEmissive); -// pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW); -// -// glPolyShininess = createVertexBufferObject(polyBuffersContext, pgl); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyShininess); -// pgl.bufferData(PGL.ARRAY_BUFFER, sizef, null, PGL.STATIC_DRAW); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); -// glPolyIndex = createVertexBufferObject(polyBuffersContext, pgl); -// pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPolyIndex); -// pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, sizex, null, PGL.STATIC_DRAW); -// pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); - polyBuffersCreated = true; } @@ -1696,72 +1298,10 @@ protected boolean polyBuffersContextIsOutdated() { } -// protected void finalizePolyBuffers() { -// if (glPolyVertex != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyVertex, polyBuffersContext); -// glPolyVertex = 0; -// } -// -// if (glPolyColor != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyColor, polyBuffersContext); -// glPolyColor = 0; -// } -// -// if (glPolyNormal != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyNormal, polyBuffersContext); -// glPolyNormal = 0; -// } -// -// if (glPolyTexcoord != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyTexcoord, polyBuffersContext); -// glPolyTexcoord = 0; -// } -// -// if (glPolyAmbient != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyAmbient, polyBuffersContext); -// glPolyAmbient = 0; -// } -// -// if (glPolySpecular != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolySpecular, polyBuffersContext); -// glPolySpecular = 0; -// } -// -// if (glPolyEmissive != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyEmissive, polyBuffersContext); -// glPolyEmissive = 0; -// } -// -// if (glPolyShininess != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyShininess, polyBuffersContext); -// glPolyShininess = 0; -// } -// -// for (String name: polyAttribs.keySet()) { -// VertexAttribute attrib = polyAttribs.get(name); -// if (attrib.glName != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(attrib.glName, polyBuffersContext); -// attrib.glName = 0; -// } -// } -// -// if (glPolyIndex != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyIndex, polyBuffersContext); -// glPolyIndex = 0; -// } -// -// polyBuffersCreated = false; -// } - - protected void createLineBuffers() { if (!lineBuffersCreated || lineBufferContextIsOutdated()) { lineBuffersContext = pgl.getCurrentContext(); -// int sizef = INIT_VERTEX_BUFFER_SIZE * PGL.SIZEOF_FLOAT; -// int sizei = INIT_VERTEX_BUFFER_SIZE * PGL.SIZEOF_INT; -// int sizex = INIT_INDEX_BUFFER_SIZE * PGL.SIZEOF_INDEX; - bufLineVertex = new VertexBuffer(this, PGL.ARRAY_BUFFER, 3, PGL.SIZEOF_FLOAT); bufLineColor = new VertexBuffer(this, PGL.ARRAY_BUFFER, 1, PGL.SIZEOF_INT); bufLineAttrib = new VertexBuffer(this, PGL.ARRAY_BUFFER, 4, PGL.SIZEOF_FLOAT); @@ -1769,26 +1309,6 @@ protected void createLineBuffers() { bufLineIndex = new VertexBuffer(this, PGL.ELEMENT_ARRAY_BUFFER, 1, PGL.SIZEOF_INDEX, true); pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); -// glLineVertex = createVertexBufferObject(lineBuffersContext, pgl); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineVertex); -// pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW); -// -// glLineColor = createVertexBufferObject(lineBuffersContext, pgl); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineColor); -// pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW); -// -// glLineAttrib = createVertexBufferObject(lineBuffersContext, pgl); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib); -// pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, null, PGL.STATIC_DRAW); -// -// pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); -// -// glLineIndex = createVertexBufferObject(lineBuffersContext, pgl); -// pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glLineIndex); -// pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, sizex, null, PGL.STATIC_DRAW); -// -// pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); - lineBuffersCreated = true; } } @@ -1837,39 +1357,10 @@ protected boolean lineBufferContextIsOutdated() { } -// protected void finalizeLineBuffers() { -// if (glLineVertex != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glLineVertex, lineBuffersContext); -// glLineVertex = 0; -// } -// -// if (glLineColor != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glLineColor, lineBuffersContext); -// glLineColor = 0; -// } -// -// if (glLineAttrib != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glLineAttrib, lineBuffersContext); -// glLineAttrib = 0; -// } -// -// if (glLineIndex != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glLineIndex, lineBuffersContext); -// glLineIndex = 0; -// } -// -// lineBuffersCreated = false; -// } - - protected void createPointBuffers() { if (!pointBuffersCreated || pointBuffersContextIsOutdated()) { pointBuffersContext = pgl.getCurrentContext(); -// int sizef = INIT_VERTEX_BUFFER_SIZE * PGL.SIZEOF_FLOAT; -// int sizei = INIT_VERTEX_BUFFER_SIZE * PGL.SIZEOF_INT; -// int sizex = INIT_INDEX_BUFFER_SIZE * PGL.SIZEOF_INDEX; - bufPointVertex = new VertexBuffer(this, PGL.ARRAY_BUFFER, 3, PGL.SIZEOF_FLOAT); bufPointColor = new VertexBuffer(this, PGL.ARRAY_BUFFER, 1, PGL.SIZEOF_INT); bufPointAttrib = new VertexBuffer(this, PGL.ARRAY_BUFFER, 2, PGL.SIZEOF_FLOAT); @@ -1877,26 +1368,6 @@ protected void createPointBuffers() { bufPointIndex = new VertexBuffer(this, PGL.ELEMENT_ARRAY_BUFFER, 1, PGL.SIZEOF_INDEX, true); pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); -// glPointVertex = createVertexBufferObject(pointBuffersContext, pgl); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointVertex); -// pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW); -// -// glPointColor = createVertexBufferObject(pointBuffersContext, pgl); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointColor); -// pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW); -// -// glPointAttrib = createVertexBufferObject(pointBuffersContext, pgl); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib); -// pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef, null, PGL.STATIC_DRAW); -// -// pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); -// -// glPointIndex = createVertexBufferObject(pointBuffersContext, pgl); -// pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPointIndex); -// pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, sizex, null, PGL.STATIC_DRAW); -// -// pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); - pointBuffersCreated = true; } } @@ -1943,60 +1414,6 @@ protected boolean pointBuffersContextIsOutdated() { } -// protected void finalizePointBuffers() { -// if (glPointVertex != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPointVertex, pointBuffersContext); -// glPointVertex = 0; -// } -// -// if (glPointColor != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPointColor, pointBuffersContext); -// glPointColor = 0; -// } -// -// if (glPointAttrib != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPointAttrib, pointBuffersContext); -// glPointAttrib = 0; -// } -// -// if (glPointIndex != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPointIndex, pointBuffersContext); -// glPointIndex = 0; -// } -// -// pointBuffersCreated = false; -// } - - -// @Override -// public void requestFocus() { -// pgl.requestFocus(); -// } - - - /** - * OpenGL cannot draw until a proper native peer is available, so this - * returns the value of PApplet.isDisplayable() (inherited from Component). - */ -// @Override -// public boolean canDraw() { -// return pgl.canDraw(); -// } - - -// @Override -// public void requestDraw() { -// if (primarySurface) { -// if (initialized) { -// if (sized) pgl.reinitSurface(); -// if (parent.canDraw()) pgl.requestDraw(); -// } else { -// initPrimary(); -// } -// } -// } - - @Override public void beginDraw() { if (primaryGraphics) { @@ -2009,6 +1426,11 @@ public void beginDraw() { getPrimaryPG().setCurrentPG(this); } + if (!pgl.threadIsCurrent()) { + PGraphics.showWarning(GL_THREAD_NOT_CURRENT); + return; + } + // This has to go after the surface initialization, otherwise offscreen // surfaces will have a null gl object. report("top beginDraw()"); @@ -2038,7 +1460,7 @@ public void beginDraw() { } else { beginOffscreenDraw(); } - setDrawDefaults(); // TODO: look at using checkSettings() instead... + checkSettings(); drawing = true; @@ -2057,17 +1479,6 @@ public void endDraw() { // Flushing any remaining geometry. flush(); - if (PGL.SAVE_SURFACE_TO_PIXELS_HACK && - (!getPrimaryPG().initialized || parent.frameCount == 0)) { - // Smooth was disabled/enabled at some point during drawing. We save - // the current contents of the back buffer (because the buffers haven't - // been swapped yet) to the pixels array. The frameCount == 0 condition - // is to handle the situation when no smooth is called in setup in the - // PDE, but the OpenGL appears to be recreated due to the size() nastiness. - saveSurfaceToPixels(); - restoreSurface = true; - } - if (primaryGraphics) { endOnscreenDraw(); } else { @@ -2077,7 +1488,7 @@ public void endDraw() { if (primaryGraphics) { setCurrentPG(null); } else { - getPrimaryPG().setCurrentPG(getPrimaryPG()); + getPrimaryPG().setCurrentPG(); } drawing = false; @@ -2085,12 +1496,6 @@ public void endDraw() { } - // Factory method - protected PGL createPGL(PGraphicsOpenGL pg) { - return new PJOGL(pg); - } - - protected PGraphicsOpenGL getPrimaryPG() { if (primaryGraphics) { return this; @@ -2103,6 +1508,10 @@ protected void setCurrentPG(PGraphicsOpenGL pg) { currentPG = pg; } + protected void setCurrentPG() { + currentPG = this; + } + protected PGraphicsOpenGL getCurrentPG() { return currentPG; } @@ -2152,10 +1561,14 @@ protected void restoreGL() { } pgl.depthFunc(PGL.LEQUAL); - if (smooth < 1) { + if (pgl.isES()) { + // neither GL_MULTISAMPLE nor GL_POLYGON_SMOOTH are part of GLES2 or GLES3 + } else if (smooth < 1) { pgl.disable(PGL.MULTISAMPLE); - } else { + } else if (1 <= smooth) { pgl.enable(PGL.MULTISAMPLE); + } + if (!pgl.isES()) { pgl.disable(PGL.POLYGON_SMOOTH); } @@ -2182,7 +1595,7 @@ protected void restoreGL() { FrameBuffer fb = getCurrentFB(); if (fb != null) { fb.bind(); - pgl.drawBuffer(fb.getDefaultDrawBuffer()); + if (drawBufferSupported) pgl.drawBuffer(fb.getDefaultDrawBuffer()); } } @@ -2209,44 +1622,56 @@ protected void endReadPixels() { protected void beginPixelsOp(int op) { FrameBuffer pixfb = null; + FrameBuffer currfb = getCurrentFB(); if (primaryGraphics) { - if (op == OP_READ) { - if (pgl.isFBOBacked() && pgl.isMultisampled()) { - // Making sure the back texture is up-to-date... - pgl.syncBackTexture(); - // ...because the read framebuffer uses it as the color buffer (the - // draw framebuffer is MSAA so it cannot be read from it). - pixfb = readFramebuffer; - } else { - pixfb = drawFramebuffer; + FrameBuffer rfb = readFramebuffer; + FrameBuffer dfb = drawFramebuffer; + if ((currfb == rfb) || (currfb == dfb)) { + // Not user-provided FB, need to check if the correct FB is current. + if (op == OP_READ) { + if (pgl.isFBOBacked() && pgl.isMultisampled()) { + // Making sure the back texture is up-to-date... + pgl.syncBackTexture(); + // ...because the read framebuffer uses it as the color buffer (the + // draw framebuffer is MSAA so it cannot be read from it). + pixfb = rfb; + } else { + pixfb = dfb; + } + } else if (op == OP_WRITE) { + // We can write to the draw framebuffer irrespective of whether is + // FBO-baked or multisampled. + pixfb = dfb; } - } else if (op == OP_WRITE) { - // We can write to the draw framebuffer irrespective of whether is - // FBO-baked or multisampled. - pixfb = drawFramebuffer; } } else { - if (op == OP_READ) { - if (offscreenMultisample) { - // Making sure the offscreen FBO is up-to-date - int mask = PGL.COLOR_BUFFER_BIT; - if (hints[ENABLE_BUFFER_READING]) { - mask |= PGL.DEPTH_BUFFER_BIT | PGL.STENCIL_BUFFER_BIT; + FrameBuffer ofb = offscreenFramebuffer; + FrameBuffer mfb = multisampleFramebuffer; + if ((currfb == ofb) || (currfb == mfb)) { + // Not user-provided FB, need to check if the correct FB is current. + if (op == OP_READ) { + if (offscreenMultisample) { + // Making sure the offscreen FBO is up-to-date + int mask = PGL.COLOR_BUFFER_BIT; + if (hints[ENABLE_BUFFER_READING]) { + mask |= PGL.DEPTH_BUFFER_BIT | PGL.STENCIL_BUFFER_BIT; + } + if (ofb != null && mfb != null) { + mfb.copy(ofb, mask); + } } - multisampleFramebuffer.copy(offscreenFramebuffer, mask); + // We always read the screen pixels from the color FBO. + pixfb = ofb; + } else if (op == OP_WRITE) { + // We can write directly to the color FBO, or to the multisample FBO + // if multisampling is enabled. + pixfb = offscreenMultisample ? mfb : ofb; } - // We always read the screen pixels from the color FBO. - pixfb = offscreenFramebuffer; - } else if (op == OP_WRITE) { - // We can write directly to the color FBO, or to the multisample FBO - // if multisampling is enabled. - pixfb = offscreenMultisample ? multisampleFramebuffer : - offscreenFramebuffer; } } // Set the framebuffer where the pixel operation shall be carried out. - if (pixfb != getCurrentFB()) { + if (pixfb != null && pixfb != getCurrentFB()) { pushFramebuffer(); setFramebuffer(pixfb); pixOpChangedFB = true; @@ -2254,9 +1679,9 @@ protected void beginPixelsOp(int op) { // We read from/write to the draw buffer. if (op == OP_READ) { - pgl.readBuffer(getCurrentFB().getDefaultDrawBuffer()); + if (readBufferSupported) pgl.readBuffer(getCurrentFB().getDefaultDrawBuffer()); } else if (op == OP_WRITE) { - pgl.drawBuffer(getCurrentFB().getDefaultDrawBuffer()); + if (drawBufferSupported) pgl.drawBuffer(getCurrentFB().getDefaultDrawBuffer()); } pixelsOp = op; @@ -2271,8 +1696,8 @@ protected void endPixelsOp() { } // Restoring default read/draw buffer configuration. - pgl.readBuffer(getCurrentFB().getDefaultReadBuffer()); - pgl.drawBuffer(getCurrentFB().getDefaultDrawBuffer()); + if (readBufferSupported) pgl.readBuffer(getCurrentFB().getDefaultReadBuffer()); + if (drawBufferSupported) pgl.drawBuffer(getCurrentFB().getDefaultDrawBuffer()); pixelsOp = OP_NONE; } @@ -2395,8 +1820,6 @@ protected void defaultSettings() { manipulatingCamera = false; - clearColorBuffer = false; - // easiest for beginners textureMode(IMAGE); @@ -2546,7 +1969,7 @@ public void endShape(int mode) { flush(); } else { // pixels array is not up-to-date anymore - arePixelsUpToDate = false; + loaded = false; } } @@ -2564,13 +1987,16 @@ protected void endShape(int[] indices) { flush(); } else { // pixels array is not up-to-date anymore - arePixelsUpToDate = false; + loaded = false; } } @Override public void textureWrap(int wrap) { + if (this.textureWrap != wrap) { + flush(); + } this.textureWrap = wrap; } @@ -2725,8 +2151,8 @@ protected void vertexImpl(float x, float y, float z, float u, float v) { } if (textured && textureMode == IMAGE) { - u /= textureImage.width; - v /= textureImage.height; + u /= textureImage.pixelWidth; + v /= textureImage.pixelHeight; } inGeo.addVertex(x, y, z, @@ -2922,11 +2348,12 @@ public void flush() { modelviewInv = modelviewInv0; updateProjmodelview(); } + + loaded = false; } tessGeo.clear(); texCache.clear(); - arePixelsUpToDate = false; } @@ -2938,8 +2365,8 @@ protected void flushPixels() { protected void flushPolys() { boolean customShader = polyShader != null; - boolean needNormals = customShader ? polyShader.accessNormals() : false; - boolean needTexCoords = customShader ? polyShader.accessTexCoords() : false; + boolean needNormals = customShader && polyShader.accessNormals(); + boolean needTexCoords = customShader && polyShader.accessTexCoords(); updatePolyBuffers(lights, texCache.hasTextures, needNormals, needTexCoords); @@ -3011,8 +2438,8 @@ protected void flushPolys() { protected void flushSortedPolys() { boolean customShader = polyShader != null; - boolean needNormals = customShader ? polyShader.accessNormals() : false; - boolean needTexCoords = customShader ? polyShader.accessTexCoords() : false; + boolean needNormals = customShader && polyShader.accessNormals(); + boolean needTexCoords = customShader && polyShader.accessTexCoords(); sorter.sort(tessGeo); @@ -4038,7 +3465,7 @@ protected boolean textModeCheck(int mode) { @Override public float textAscent() { if (textFont == null) defaultFontOrDeath("textAscent"); - Font font = (Font) textFont.getNative(); + Object font = textFont.getNative(); float ascent = 0; if (font != null) ascent = pgl.getFontAscent(font); if (ascent == 0) ascent = super.textAscent(); @@ -4048,8 +3475,8 @@ public float textAscent() { @Override public float textDescent() { - if (textFont == null) defaultFontOrDeath("textAscent"); - Font font = (Font) textFont.getNative(); + if (textFont == null) defaultFontOrDeath("textDescent"); + Object font = textFont.getNative(); float descent = 0; if (font != null) descent = pgl.getFontDescent(font); if (descent == 0) descent = super.textDescent(); @@ -4058,8 +3485,9 @@ public float textDescent() { @Override - protected float textWidthImpl(char buffer[], int start, int stop) { - Font font = (Font) textFont.getNative(); + protected float textWidthImpl(char[] buffer, int start, int stop) { + if (textFont == null) defaultFontOrDeath("textWidth"); + Object font = textFont.getNative(); float twidth = 0; if (font != null) twidth = pgl.getTextWidth(font, buffer, start, stop); if (twidth == 0) twidth = super.textWidthImpl(buffer, start, stop); @@ -4068,14 +3496,13 @@ protected float textWidthImpl(char buffer[], int start, int stop) { @Override - public void textSize(float size) { - if (textFont == null) defaultFontOrDeath("textSize", size); - Font font = (Font) textFont.getNative(); + protected void handleTextSize(float size) { + Object font = textFont.getNative(); if (font != null) { Object dfont = pgl.getDerivedFont(font, size); textFont.setNative(dfont); } - super.textSize(size); + super.handleTextSize(size); } @@ -4083,8 +3510,14 @@ public void textSize(float size) { * Implementation of actual drawing for a line of text. */ @Override - protected void textLineImpl(char buffer[], int start, int stop, + protected void textLineImpl(char[] buffer, int start, int stop, float x, float y) { + + if (textMode == SHAPE && textFont.getNative() == null) { + showWarning("textMode(SHAPE) not available for .vlw fonts, " + + "use an .otf or .ttf instead."); + textMode(MODEL); + } if (textMode == MODEL) { textTex = getFontTexture(textFont); @@ -4173,11 +3606,8 @@ protected void textCharImpl(char ch, float x, float y) { protected void textCharModelImpl(FontTexture.TextureInfo info, float x0, float y0, float x1, float y1) { - if (textTex.currentTex != info.texIndex) { - textTex.setTexture(info.texIndex); - } beginShape(QUADS); - texture(textTex.getCurrentTexture()); + texture(textTex.getTexture(info)); vertex(x0, y0, info.u0, info.v0); vertex(x1, y0, info.u1, info.v0); vertex(x1, y1, info.u1, info.v1); @@ -4224,7 +3654,7 @@ protected void textCharShapeImpl(char ch, float x, float y) { PGL.FontOutline outline = pgl.createFontOutline(ch, textFont.getNative()); // six element array received from the Java2D path iterator - float textPoints[] = new float[6]; + float[] textPoints = new float[6]; float lastX = 0; float lastY = 0; @@ -4342,6 +3772,37 @@ static protected void invTranslate(PMatrix3D matrix, } + static protected void invTranslate(PMatrix2D matrix, + float tx, float ty) { + matrix.preApply(1, 0, -tx, + 0, 1, -ty); + } + + + static protected float matrixScale(PMatrix matrix) { + // Volumetric scaling factor that is associated to the given + // transformation matrix, which is given by the absolute value of its + // determinant: + float factor = 1; + + if (matrix != null) { + if (matrix instanceof PMatrix2D) { + PMatrix2D tr = (PMatrix2D)matrix; + float areaScaleFactor = Math.abs(tr.m00 * tr.m11 - tr.m01 * tr.m10); + factor = (float) Math.sqrt(areaScaleFactor); + } else if (matrix instanceof PMatrix3D) { + PMatrix3D tr = (PMatrix3D)matrix; + float volumeScaleFactor = + Math.abs(tr.m00 * (tr.m11 * tr.m22 - tr.m12 * tr.m21) + + tr.m01 * (tr.m12 * tr.m20 - tr.m10 * tr.m22) + + tr.m02 * (tr.m10 * tr.m21 - tr.m11 * tr.m20)); + factor = (float) Math.pow(volumeScaleFactor, 1.0f / 3.0f); + } + } + return factor; + } + + /** * 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 @@ -4403,8 +3864,8 @@ protected void rotateImpl(float angle, float v0, float v1, float v2) { } - static private void invRotate(PMatrix3D matrix, float angle, - float v0, float v1, float v2) { + static protected void invRotate(PMatrix3D matrix, float angle, + float v0, float v1, float v2) { float c = PApplet.cos(-angle); float s = PApplet.sin(-angle); float t = 1.0f - c; @@ -4416,6 +3877,11 @@ static private void invRotate(PMatrix3D matrix, float angle, } + static protected void invRotate(PMatrix2D matrix, float angle) { + matrix.rotate(-angle); + } + + /** * Same as scale(s, s, s). */ @@ -4457,6 +3923,11 @@ static protected void invScale(PMatrix3D matrix, float x, float y, float z) { } + static protected void invScale(PMatrix2D matrix, float x, float y) { + matrix.preApply(1/x, 0, 0, 1/y, 0, 0); + } + + @Override public void shearX(float angle) { float t = (float) Math.tan(angle); @@ -4847,7 +4318,8 @@ public void endCamera() { */ @Override public void camera() { - camera(cameraX, cameraY, cameraZ, cameraX, cameraY, 0, 0, 1, 0); + camera(defCameraX, defCameraY, defCameraZ, defCameraX, defCameraY, + 0, 0, 1, 0); } @@ -4911,6 +4383,10 @@ public void camera() { public void camera(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) { + cameraX = eyeX; + cameraY = eyeY; + cameraZ = eyeZ; + // Calculating Z vector float z0 = eyeX - centerX; float z1 = eyeY - centerY; @@ -5068,7 +4544,7 @@ public void ortho(float left, float right, */ @Override public void perspective() { - perspective(cameraFOV, cameraAspect, cameraNear, cameraFar); + perspective(defCameraFOV, defCameraAspect, defCameraNear, defCameraFar); } @@ -5097,6 +4573,11 @@ public void frustum(float left, float right, float bottom, float top, // Flushing geometry with a different perspective configuration. flush(); + cameraFOV = 2 * (float) Math.atan2(top, znear); + cameraAspect = left / bottom; + cameraNear = znear; + cameraFar = zfar; + float n2 = 2 * znear; float w = right - left; float h = top - bottom; @@ -5692,7 +5173,7 @@ protected void lightPosition(int num, float x, float y, float z, x*modelview.m20 + y*modelview.m21 + z*modelview.m22 + modelview.m23; // Used to indicate if the light is directional or not. - lightPosition[4 * num + 3] = dir ? 1: 0; + lightPosition[4 * num + 3] = dir ? 0 : 1; } @@ -5799,31 +5280,21 @@ protected void noLightSpot(int num) { protected void backgroundImpl(PImage image) { backgroundImpl(); set(0, 0, image); - if (0 < parent.frameCount) { - clearColorBuffer = true; - } // Setting the background as opaque. If this an offscreen surface, the // alpha channel will be set to 1 in endOffscreenDraw(), even if // blending operations during draw create translucent areas in the // color buffer. backgroundA = 1; + loaded = false; } @Override protected void backgroundImpl() { flush(); - - if (!hints[DISABLE_DEPTH_MASK]) { - pgl.clearDepth(1); - pgl.clear(PGL.DEPTH_BUFFER_BIT); - } - - pgl.clearColor(backgroundR, backgroundG, backgroundB, backgroundA); - pgl.clear(PGL.COLOR_BUFFER_BIT); - if (0 < parent.frameCount) { - clearColorBuffer = true; - } + pgl.clearBackground(backgroundR, backgroundG, backgroundB, backgroundA, + !hints[DISABLE_DEPTH_MASK], true); + loaded = false; } @@ -5918,7 +5389,7 @@ public void loadPixels() { needEndDraw = true; } - if (!arePixelsUpToDate) { + if (!loaded) { // Draws any remaining geometry in case the user is still not // setting/getting new pixels. flush(); @@ -5926,12 +5397,13 @@ public void loadPixels() { allocatePixels(); - if (!arePixelsUpToDate) { + if (!loaded) { readPixels(); } // Pixels are now up-to-date, set the flag. - arePixelsUpToDate = true; + loaded = true; + if (needEndDraw) { endDraw(); @@ -5944,21 +5416,11 @@ protected void allocatePixels() { if ((pixels == null) || (pixels.length != pixelWidth * pixelHeight)) { pixels = new int[pixelWidth * pixelHeight]; pixelBuffer = PGL.allocateIntBuffer(pixels); + loaded = false; } } - protected void saveSurfaceToPixels() { - allocatePixels(); - readPixels(); - } - - - protected void restoreSurfaceFromPixels() { - drawPixels(0, 0, width, height); - } - - protected void readPixels() { updatePixelSize(); beginPixelsOp(OP_READ); @@ -5984,30 +5446,29 @@ protected void readPixels() { protected void drawPixels(int x, int y, int w, int h) { - int f = (int)getPixelScale(); - int len = f * w * f * h; + int len = w * h; if (nativePixels == null || nativePixels.length < len) { nativePixels = new int[len]; nativePixelBuffer = PGL.allocateIntBuffer(nativePixels); } try { - if (0 < x || 0 < y || w < width || h < height) { + if (0 < x || 0 < y || w < pixelWidth || h < pixelHeight) { // The pixels to be copied to the texture need to be consecutive, and // they are not in the pixels array, so putting each row one after // another in nativePixels. - int offset0 = f * (y * width + x); + int offset0 = y * pixelWidth + x; int offset1 = 0; - for (int yc = f * y; yc < f * (y + h); yc++) { - System.arraycopy(pixels, offset0, nativePixels, offset1, f * w); - offset0 += f * width; - offset1 += f * w; + for (int yc = y; yc < y + h; yc++) { + System.arraycopy(pixels, offset0, nativePixels, offset1, w); + offset0 += pixelWidth; + offset1 += w; } } else { PApplet.arrayCopy(pixels, 0, nativePixels, 0, len); } - PGL.javaToNativeARGB(nativePixels, f * w, f * h); + PGL.javaToNativeARGB(nativePixels, w, h); } catch (ArrayIndexOutOfBoundsException e) { } PGL.putIntArray(nativePixelBuffer, nativePixels); @@ -6021,6 +5482,7 @@ protected void drawPixels(int x, int y, int w, int h) { boolean needToDrawTex = primaryGraphics && (!pgl.isFBOBacked() || (pgl.isFBOBacked() && pgl.isMultisampled())) || offscreenMultisample; + if (texture == null) return; if (needToDrawTex) { // The texture to screen needs to be drawn only if we are on the primary // surface w/out FBO-layer, or with FBO-layer and multisampling. Or, we @@ -6030,19 +5492,19 @@ protected void drawPixels(int x, int y, int w, int h) { // (off)screen buffer. // First, copy the pixels to the texture. We don't need to invert the // pixel copy because the texture will be drawn inverted. - int tw = PApplet.min(texture.glWidth - f * x, f * w); - int th = PApplet.min(texture.glHeight - f * y, f * h); + int tw = PApplet.min(texture.glWidth - x, w); + int th = PApplet.min(texture.glHeight - y, h); pgl.copyToTexture(texture.glTarget, texture.glFormat, texture.glName, - f * x, f * y, tw, th, nativePixelBuffer); + x, y, tw, th, nativePixelBuffer); beginPixelsOp(OP_WRITE); drawTexture(x, y, w, h); endPixelsOp(); } else { // We only need to copy the pixels to the back texture where we are - // currently drawing to. Because the texture is invertex along Y, we + // currently drawing to. Because the texture is inverted along Y, we // need to reflect that in the vertical arguments. pgl.copyToTexture(texture.glTarget, texture.glFormat, texture.glName, - f * x, f * (height - (y + h)), f * w, f * h, nativePixelBuffer); + x, pixelHeight - (y + h), w, h, nativePixelBuffer); } } @@ -6108,17 +5570,277 @@ protected void setImpl(PImage sourceImage, @Override public boolean save(String filename) { + return saveImpl(filename); + } - // Act as an opaque surface for the purposes of saving. - if (primaryGraphics) { - int prevFormat = format; - format = RGB; - boolean result = super.save(filename); - format = prevFormat; - return result; + + @Override + protected void processImageBeforeAsyncSave(PImage image) { + if (image.format == AsyncPixelReader.OPENGL_NATIVE) { + PGL.nativeToJavaARGB(image.pixels, image.pixelWidth, image.pixelHeight); + image.format = ARGB; + } else if (image.format == AsyncPixelReader.OPENGL_NATIVE_OPAQUE) { + PGL.nativeToJavaRGB(image.pixels, image.pixelWidth, image.pixelHeight); + image.format = RGB; + } + } + + + protected static void completeFinishedPixelTransfers() { + ongoingPixelTransfersIterable.addAll(ongoingPixelTransfers); + for (AsyncPixelReader pixelReader : ongoingPixelTransfersIterable) { + // if the getter was not called this frame, + // tell it to check for completed transfers now + if (!pixelReader.calledThisFrame) { + pixelReader.completeFinishedTransfers(); + } + pixelReader.calledThisFrame = false; + } + ongoingPixelTransfersIterable.clear(); + } + + protected static void completeAllPixelTransfers() { + ongoingPixelTransfersIterable.addAll(ongoingPixelTransfers); + for (AsyncPixelReader pixelReader : ongoingPixelTransfersIterable) { + pixelReader.completeAllTransfers(); + } + ongoingPixelTransfersIterable.clear(); + } + + + @Override + protected void awaitAsyncSaveCompletion(String filename) { + if (asyncPixelReader != null) { + ongoingPixelTransfersIterable.addAll(ongoingPixelTransfers); + File file = parent.sketchFile(filename); + for (AsyncPixelReader pixelReader : ongoingPixelTransfersIterable) { + pixelReader.awaitTransferCompletion(file); + } + ongoingPixelTransfersIterable.clear(); + } + super.awaitAsyncSaveCompletion(filename); + } + + + protected class AsyncPixelReader { + + // PImage formats used internally to offload + // color format conversion to save threads + static final int OPENGL_NATIVE = -1; + static final int OPENGL_NATIVE_OPAQUE = -2; + + static final int BUFFER_COUNT = 3; + + int[] pbos; + long[] fences; + File[] files; + int[] widths; + int[] heights; + + int head; + int tail; + int size; + + boolean supportsAsyncTransfers; + + boolean calledThisFrame; + + + /// PGRAPHICS API ////////////////////////////////////////////////////////// + + public AsyncPixelReader() { + supportsAsyncTransfers = pgl.hasPBOs() && pgl.hasSynchronization(); + if (supportsAsyncTransfers) { + pbos = new int[BUFFER_COUNT]; + fences = new long[BUFFER_COUNT]; + files = new File[BUFFER_COUNT]; + widths = new int[BUFFER_COUNT]; + heights = new int[BUFFER_COUNT]; + + IntBuffer intBuffer = PGL.allocateIntBuffer(BUFFER_COUNT); + intBuffer.rewind(); + pgl.genBuffers(BUFFER_COUNT, intBuffer); + for (int i = 0; i < BUFFER_COUNT; i++) { + pbos[i] = intBuffer.get(i); + } + } + } + + + public void dispose() { + if (fences != null) { + while (size > 0) { + pgl.deleteSync(fences[tail]); + size--; + tail = (tail + 1) % BUFFER_COUNT; + } + fences = null; + } + if (pbos != null) { + for (int i = 0; i < BUFFER_COUNT; i++) { + IntBuffer intBuffer = PGL.allocateIntBuffer(pbos); + pgl.deleteBuffers(BUFFER_COUNT, intBuffer); + } + pbos = null; + } + files = null; + widths = null; + heights = null; + size = 0; + head = 0; + tail = 0; + calledThisFrame = false; + ongoingPixelTransfers.remove(this); + } + + + public void readAndSaveAsync(final File file) { + if (size > 0) { + boolean shouldRead = (size == BUFFER_COUNT); + if (!shouldRead) shouldRead = isLastTransferComplete(); + if (shouldRead) endTransfer(); + } else { + ongoingPixelTransfers.add(this); + } + beginTransfer(file); + calledThisFrame = true; + } + + + public void completeFinishedTransfers() { + if (size <= 0 || !asyncImageSaver.hasAvailableTarget()) return; + + boolean needEndDraw = false; + if (!drawing) { + beginDraw(); + needEndDraw = true; + } + + while (asyncImageSaver.hasAvailableTarget() && + isLastTransferComplete()) { + endTransfer(); + } + + // make sure to always unregister if there are no ongoing transfers + // so that PGraphics can be GC'd if needed + if (size <= 0) ongoingPixelTransfers.remove(this); + + if (needEndDraw) endDraw(); + } + + + protected void completeAllTransfers() { + if (size <= 0) return; + completeTransfers(size); + } + + + protected void completeTransfers(int count) { + if (size <= 0) return; + if (count <= 0) return; + + boolean needEndDraw = false; + if (!drawing) { + beginDraw(); + needEndDraw = true; + } + + while (size > 0 && count > 0) { + endTransfer(); + count--; + } + + // make sure to always unregister if there are no ongoing transfers + // so that PGraphics can be GC'd if needed + if (size <= 0) { + ongoingPixelTransfers.remove(this); + } + + if (needEndDraw) endDraw(); + } + + + protected void awaitTransferCompletion(File file) { + if (size <= 0) return; + + int i = tail; // tail -> head, wraps around (we have circular queue) + int j = 0; // 0 -> size, simple counter + int lastIndex = 0; + do { + if (file.equals(files[i])) { + lastIndex = j; // no 'break' here, we need last index for this filename + } + i = (i + 1) % BUFFER_COUNT; + j++; + } while (i != head); + + if (lastIndex <= 0) return; + + // Saving this file is in progress, block until transfers complete + completeTransfers(lastIndex + 1); + } + + + /// TRANSFERS ////////////////////////////////////////////////////////////// + + public boolean isLastTransferComplete() { + if (size <= 0) return false; + int status = pgl.clientWaitSync(fences[tail], 0, 0); + return (status == PGL.ALREADY_SIGNALED) || + (status == PGL.CONDITION_SATISFIED); + } + + + public void beginTransfer(File file) { + // check the size of the buffer + if (widths[head] != pixelWidth || heights[head] != pixelHeight) { + if (widths[head] * heights[head] != pixelWidth * pixelHeight) { + pgl.bindBuffer(PGL.PIXEL_PACK_BUFFER, pbos[head]); + pgl.bufferData(PGL.PIXEL_PACK_BUFFER, + Integer.SIZE/8 * pixelWidth * pixelHeight, + null, PGL.STREAM_READ); + } + widths[head] = pixelWidth; + heights[head] = pixelHeight; + pgl.bindBuffer(PGL.PIXEL_PACK_BUFFER, 0); + } + + pgl.bindBuffer(PGL.PIXEL_PACK_BUFFER, pbos[head]); + pgl.readPixels(0, 0, pixelWidth, pixelHeight, PGL.RGBA, PGL.UNSIGNED_BYTE, 0); + pgl.bindBuffer(PGL.PIXEL_PACK_BUFFER, 0); + + fences[head] = pgl.fenceSync(PGL.SYNC_GPU_COMMANDS_COMPLETE, 0); + files[head] = file; + + head = (head + 1) % BUFFER_COUNT; + size++; + } + + + public void endTransfer() { + pgl.deleteSync(fences[tail]); + pgl.bindBuffer(PGL.PIXEL_PACK_BUFFER, pbos[tail]); + ByteBuffer readBuffer = pgl.mapBuffer(PGL.PIXEL_PACK_BUFFER, + PGL.READ_ONLY); + if (readBuffer != null) { + int format = primaryGraphics ? OPENGL_NATIVE_OPAQUE : OPENGL_NATIVE; + PImage target = asyncImageSaver.getAvailableTarget(widths[tail], + heights[tail], + format); + if (target == null) return; + readBuffer.rewind(); + readBuffer.asIntBuffer().get(target.pixels); + pgl.unmapBuffer(PGL.PIXEL_PACK_BUFFER); + asyncImageSaver.saveTargetAsync(PGraphicsOpenGL.this, target, + files[tail]); + } + + pgl.bindBuffer(PGL.PIXEL_PACK_BUFFER, 0); + + size--; + tail = (tail + 1) % BUFFER_COUNT; } - return super.save(filename); } @@ -6165,12 +5887,18 @@ public void loadTexture() { } endPixelsOp(); - texture.setNative(nativePixelBuffer, 0, 0, pixelWidth, pixelHeight); + if (texture != null) { + texture.setNative(nativePixelBuffer, 0, 0, pixelWidth, pixelHeight); + } } } else if (offscreenMultisample) { // We need to copy the contents of the multisampled buffer to the color // buffer, so the later is up-to-date with the last drawing. - multisampleFramebuffer.copyColor(offscreenFramebuffer); + FrameBuffer ofb = offscreenFramebuffer; + FrameBuffer mfb = multisampleFramebuffer; + if (ofb != null && mfb != null) { + mfb.copyColor(ofb); + } } if (needEndDraw) { @@ -6181,14 +5909,18 @@ public void loadTexture() { // Just marks the whole texture as updated public void updateTexture() { - texture.updateTexels(); + if (texture != null) { + texture.updateTexels(); + } } // Marks the specified rectanglular subregion in the texture as // updated. public void updateTexture(int x, int y, int w, int h) { - texture.updateTexels(x, y, w, h); + if (texture != null) { + texture.updateTexels(x, y, w, h); + } } @@ -6217,43 +5949,50 @@ protected void loadTextureImpl(int sampling, boolean mipmap) { protected void createPTexture() { updatePixelSize(); - ptexture = new Texture(this, pixelWidth, pixelHeight, texture.getParameters()); - ptexture.invertedY(true); - ptexture.colorBuffer(true); + if (texture != null) { + ptexture = new Texture(this, pixelWidth, pixelHeight, texture.getParameters()); + ptexture.invertedY(true); + ptexture.colorBuffer(true); + } } protected void swapOffscreenTextures() { - if (ptexture != null) { + FrameBuffer ofb = offscreenFramebuffer; + if (texture != null && ptexture != null && ofb != null) { int temp = texture.glName; texture.glName = ptexture.glName; ptexture.glName = temp; - offscreenFramebuffer.setColorBuffer(texture); + ofb.setColorBuffer(texture); } } protected void drawTexture() { - // No blend so the texure replaces wherever is on the screen, - // irrespective of the alpha - pgl.disable(PGL.BLEND); - pgl.drawTexture(texture.glTarget, texture.glName, - texture.glWidth, texture.glHeight, - 0, 0, width, height); - pgl.enable(PGL.BLEND); + if (texture != null) { + // No blend so the texure replaces wherever is on the screen, + // irrespective of the alpha + pgl.disable(PGL.BLEND); + pgl.drawTexture(texture.glTarget, texture.glName, + texture.glWidth, texture.glHeight, + 0, 0, width, height); + pgl.enable(PGL.BLEND); + } } protected void drawTexture(int x, int y, int w, int h) { - // Processing Y axis is inverted with respect to OpenGL, so we need to - // invert the y coordinates of the screen rectangle. - pgl.disable(PGL.BLEND); - pgl.drawTexture(texture.glTarget, texture.glName, - texture.glWidth, texture.glHeight, - 0, 0, width, height, - x, y, x + w, y + h, - x, height - (y + h), x + w, height - y); - pgl.enable(PGL.BLEND); + if (texture != null) { + // Processing Y axis is inverted with respect to OpenGL, so we need to + // invert the y coordinates of the screen rectangle. + pgl.disable(PGL.BLEND); + pgl.drawTexture(texture.glTarget, texture.glName, + texture.glWidth, texture.glHeight, + 0, 0, pixelWidth, pixelHeight, 1, + x, y, x + w, y + h, + x, pixelHeight - (y + h), x + w, pixelHeight - y); + pgl.enable(PGL.BLEND); + } } @@ -6286,7 +6025,7 @@ protected void drawPTexture() { @Override public void mask(PImage alpha) { updatePixelSize(); - if (alpha.width != pixelWidth || alpha.height != pixelHeight) { + if (alpha.pixelWidth != pixelWidth || alpha.pixelHeight != pixelHeight) { throw new RuntimeException("The PImage used with mask() must be " + "the same size as the applet."); } @@ -6341,8 +6080,9 @@ public void filter(PShader shader) { } boolean needEndDraw = false; - if (primaryGraphics) pgl.requestFBOLayer(); - else if (!drawing) { + if (primaryGraphics) { + pgl.enableFBOLayer(); + } else if (!drawing) { beginDraw(); needEndDraw = true; } @@ -6417,11 +6157,10 @@ else if (!drawing) { @Override public void copy(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh) { - if (primaryGraphics) pgl.requestFBOLayer(); + if (primaryGraphics) pgl.enableFBOLayer(); loadTexture(); if (filterTexture == null || filterTexture.contextIsOutdated()) { - filterTexture = new Texture(this, texture.width, texture.height, - texture.getParameters()); + filterTexture = new Texture(this, texture.width, texture.height, texture.getParameters()); filterTexture.invertedY(true); filterImage = wrapTexture(filterTexture); } @@ -6646,9 +6385,9 @@ public Texture getTexture(PImage img) { Texture tex = (Texture)initCache(img); if (tex == null) return null; - if (img.isModified() || img.isLoaded()) { - if (img.width != tex.width || img.height != tex.height) { - tex.init(img.width, img.height); + if (img.isModified()) { + if (img.pixelWidth != tex.width || img.pixelHeight != tex.height) { + tex.init(img.pixelWidth, img.pixelHeight); } updateTexture(img, tex); } @@ -6690,9 +6429,16 @@ protected Object initCache(PImage img) { if (tex == null || tex.contextIsOutdated()) { tex = addTexture(img); if (tex != null) { + boolean dispose = img.pixels == null; img.loadPixels(); tex.set(img.pixels, img.format); - img.setLoaded(false); + img.setModified(); + if (dispose) { + // We only used the pixels to load the image into the texture and the user did not request + // to load the pixels, so we should dispose the pixels array to avoid wasting memory + img.pixels = null; + img.loaded = false; + } } } return tex; @@ -6703,7 +6449,9 @@ protected void bindFrontTexture() { if (primaryGraphics) { pgl.bindFrontTexture(); } else { - if (ptexture == null) createPTexture(); + if (ptexture == null) { + createPTexture(); + } ptexture.bind(); } } @@ -6739,7 +6487,7 @@ protected Texture addTexture(PImage img, Texture.Parameters params) { if (img.parent == null) { img.parent = parent; } - Texture tex = new Texture(this, img.width, img.height, params); + Texture tex = new Texture(this, img.pixelWidth, img.pixelHeight, params); setCache(img, tex); return tex; } @@ -6772,8 +6520,8 @@ protected PImage wrapTexture(Texture tex) { // avoid initializing the pixels array. PImage img = new PImage(); img.parent = parent; - img.width = tex.width; - img.height = tex.height; + img.width = img.pixelWidth = tex.width; + img.height = img.pixelHeight = tex.height; img.format = ARGB; setCache(img, tex); return img; @@ -6788,12 +6536,9 @@ protected void updateTexture(PImage img, Texture tex) { int w = img.getModifiedX2() - x; int h = img.getModifiedY2() - y; tex.set(img.pixels, x, y, w, h, img.format); - } else if (img.isLoaded()) { - tex.set(img.pixels, 0, 0, img.width, img.height, img.format); } } img.setModified(false); - img.setLoaded(false); } @@ -6809,6 +6554,8 @@ protected void deleteSurfaceTextures() { if (filterTexture != null) { filterTexture.dispose(); } + + } @@ -6839,10 +6586,11 @@ public void resize(int wide, int high) { protected void initPrimary() { -// pgl.initSurface(quality); + pgl.initSurface(smooth); if (texture != null) { removeCache(this); - texture = ptexture = null; + texture = null; + ptexture = null; } initialized = true; } @@ -6851,7 +6599,7 @@ protected void initPrimary() { protected void beginOnscreenDraw() { updatePixelSize(); - pgl.beginDraw(clearColorBuffer); + pgl.beginRender(); if (drawFramebuffer == null) { drawFramebuffer = new FrameBuffer(this, pixelWidth, pixelHeight, true); @@ -6873,7 +6621,7 @@ protected void beginOnscreenDraw() { protected void endOnscreenDraw() { - pgl.endDraw(clearColorBuffer, parent.sketchWindowColor()); + pgl.endRender(parent.sketchWindowColor()); } @@ -6881,49 +6629,49 @@ protected void initOffscreen() { // Getting the context and capabilities from the main renderer. loadTextureImpl(textureSampling, false); - // In case of reinitialization (for example, when the smooth level + FrameBuffer ofb = offscreenFramebuffer; + FrameBuffer mfb = multisampleFramebuffer; + + // In case of re-initialization (for example, when the smooth level // is changed), we make sure that all the OpenGL resources associated // to the surface are released by calling delete(). - if (offscreenFramebuffer != null) { - offscreenFramebuffer.dispose(); + if (ofb != null) { + ofb.dispose(); + ofb = null; } - if (multisampleFramebuffer != null) { - multisampleFramebuffer.dispose(); + if (mfb != null) { + mfb.dispose(); + mfb = null; } boolean packed = depthBits == 24 && stencilBits == 8 && packedDepthStencilSupported; if (PGraphicsOpenGL.fboMultisampleSupported && 1 < PGL.smoothToSamples(smooth)) { - multisampleFramebuffer = - new FrameBuffer(this, texture.glWidth, texture.glHeight, PGL.smoothToSamples(smooth), 0, - depthBits, stencilBits, packed, false); - - multisampleFramebuffer.clear(); + mfb = new FrameBuffer(this, texture.glWidth, texture.glHeight, PGL.smoothToSamples(smooth), 0, + depthBits, stencilBits, packed, false); + mfb.clear(); + multisampleFramebuffer = mfb; offscreenMultisample = true; // The offscreen framebuffer where the multisampled image is finally drawn // to. If depth reading is disabled it doesn't need depth and stencil buffers // since they are part of the multisampled framebuffer. if (hints[ENABLE_BUFFER_READING]) { - offscreenFramebuffer = - new FrameBuffer(this, texture.glWidth, texture.glHeight, 1, 1, - depthBits, stencilBits, packed, false); + ofb = new FrameBuffer(this, texture.glWidth, texture.glHeight, 1, 1, + depthBits, stencilBits, packed, false); } else { - offscreenFramebuffer = - new FrameBuffer(this, texture.glWidth, texture.glHeight, 1, 1, + ofb = new FrameBuffer(this, texture.glWidth, texture.glHeight, 1, 1, 0, 0, false, false); } - } else { smooth = 0; - offscreenFramebuffer = - new FrameBuffer(this, texture.glWidth, texture.glHeight, 1, 1, - depthBits, stencilBits, packed, false); + ofb = new FrameBuffer(this, texture.glWidth, texture.glHeight, 1, 1, + depthBits, stencilBits, packed, false); offscreenMultisample = false; } - - offscreenFramebuffer.setColorBuffer(texture); - offscreenFramebuffer.clear(); + ofb.setColorBuffer(texture); + ofb.clear(); + offscreenFramebuffer = ofb; initialized = true; } @@ -6933,10 +6681,10 @@ protected void beginOffscreenDraw() { if (!initialized) { initOffscreen(); } else { - boolean outdated = offscreenFramebuffer != null && - offscreenFramebuffer.contextIsOutdated(); - boolean outdatedMulti = multisampleFramebuffer != null && - multisampleFramebuffer.contextIsOutdated(); + FrameBuffer ofb = offscreenFramebuffer; + FrameBuffer mfb = multisampleFramebuffer; + boolean outdated = ofb != null && ofb.contextIsOutdated(); + boolean outdatedMulti = mfb != null && mfb.contextIsOutdated(); if (outdated || outdatedMulti) { restartPGL(); initOffscreen(); @@ -6950,9 +6698,15 @@ protected void beginOffscreenDraw() { pushFramebuffer(); if (offscreenMultisample) { - setFramebuffer(multisampleFramebuffer); + FrameBuffer mfb = multisampleFramebuffer; + if (mfb != null) { + setFramebuffer(mfb); + } } else { - setFramebuffer(offscreenFramebuffer); + FrameBuffer ofb = offscreenFramebuffer; + if (ofb != null) { + setFramebuffer(ofb); + } } // Render previous back texture (now is the front) as background @@ -6970,7 +6724,11 @@ protected void beginOffscreenDraw() { protected void endOffscreenDraw() { if (offscreenMultisample) { - multisampleFramebuffer.copyColor(offscreenFramebuffer); + FrameBuffer ofb = offscreenFramebuffer; + FrameBuffer mfb = multisampleFramebuffer; + if (ofb != null && mfb != null) { + mfb.copyColor(ofb); + } } popFramebuffer(); @@ -6985,7 +6743,9 @@ protected void endOffscreenDraw() { pgl.colorMask(true, true, true, true); } - texture.updateTexels(); // Mark all texels in screen texture as modified. + if (texture != null) { + texture.updateTexels(); // Mark all texels in screen texture as modified. + } getPrimaryPG().restoreGL(); } @@ -6999,7 +6759,14 @@ protected void setViewport() { } - protected void setDrawDefaults() { + @Override + protected void checkSettings() { + super.checkSettings(); + setGLSettings(); + } + + + protected void setGLSettings() { inGeo.clear(); tessGeo.clear(); texCache.clear(); @@ -7033,16 +6800,14 @@ protected void setDrawDefaults() { // quality = temp; // } } - if (smooth < 1) { + if (pgl.isES()) { + // neither GL_MULTISAMPLE nor GL_POLYGON_SMOOTH are part of GLES2 or GLES3 + } else if (smooth < 1) { pgl.disable(PGL.MULTISAMPLE); - } else { - // work around runtime exceptions in Broadcom's VC IV driver - if (false == OPENGL_RENDERER.equals("VideoCore IV HW")) { - pgl.enable(PGL.MULTISAMPLE); - } + } else if (1 <= smooth) { + pgl.enable(PGL.MULTISAMPLE); } - // work around runtime exceptions in Broadcom's VC IV driver - if (false == OPENGL_RENDERER.equals("VideoCore IV HW")) { + if (!pgl.isES()) { pgl.disable(PGL.POLYGON_SMOOTH); } @@ -7056,6 +6821,9 @@ protected void setDrawDefaults() { } else { // offscreen surfaces are transparent by default. background(0x00 << 24 | (backgroundColor & 0xFFFFFF)); + + // Recreate offscreen FBOs + restartPGL(); } // Sets the default projection and camera (initializes modelview). @@ -7097,20 +6865,7 @@ protected void setDrawDefaults() { normalX = normalY = 0; normalZ = 1; - // Clear depth and stencil buffers. - pgl.depthMask(true); - pgl.clearDepth(1); - pgl.clearStencil(0); - pgl.clear(PGL.DEPTH_BUFFER_BIT | PGL.STENCIL_BUFFER_BIT); - - if (!settingsInited) { - defaultSettings(); - } - - if (restoreSurface) { - restoreSurfaceFromPixels(); - restoreSurface = false; - } + pgl.clearDepthStencil(); if (hints[DISABLE_DEPTH_MASK]) { pgl.depthMask(false); @@ -7120,11 +6875,8 @@ protected void setDrawDefaults() { pixelsOp = OP_NONE; - clearColorBuffer0 = clearColorBuffer; - clearColorBuffer = false; - modified = false; - arePixelsUpToDate = false; + loaded = false; } @@ -7140,6 +6892,8 @@ protected void getGLParameters() { fboMultisampleSupported = pgl.hasFboMultisampleSupport(); packedDepthStencilSupported = pgl.hasPackedDepthStencilSupport(); anisoSamplingSupported = pgl.hasAnisoSamplingSupport(); + readBufferSupported = pgl.hasReadBuffer(); + drawBufferSupported = pgl.hasDrawBuffer(); try { pgl.blendEquation(PGL.FUNC_ADD); @@ -7167,8 +6921,12 @@ protected void getGLParameters() { // overwrite the default shaders with vendor specific versions // if needed - if (OPENGL_RENDERER.equals("VideoCore IV HW") || // Broadcom's binary driver for Raspberry Pi - OPENGL_RENDERER.equals("Gallium 0.4 on VC4")) { // Mesa driver for same hardware + if (OPENGL_RENDERER.equals("VideoCore IV HW")) { // Broadcom's binary driver for Raspberry Pi + defLightShaderVertURL = + PGraphicsOpenGL.class.getResource("/processing/opengl/shaders/LightVert-brcm.glsl"); + defTexlightShaderVertURL = + PGraphicsOpenGL.class.getResource("/processing/opengl/shaders/TexLightVert-brcm.glsl"); + } else if (OPENGL_RENDERER.contains("VC4")) { // Mesa driver for same hardware defLightShaderVertURL = PGraphicsOpenGL.class.getResource("/processing/opengl/shaders/LightVert-vc4.glsl"); defTexlightShaderVertURL = @@ -7282,20 +7040,6 @@ public void resetShader(int kind) { } - protected void deleteDefaultShaders() { - // The default shaders contains references to the PGraphics object that - // creates them, so when restarting the renderer, those references should - // dissapear. - defColorShader = null; - defTextureShader = null; - defLightShader = null; - defTexlightShader = null; - defLineShader = null; - defPointShader = null; - maskShader = null; - } - - protected PShader getPolyShader(boolean lit, boolean tex) { PShader shader; PGraphicsOpenGL ppg = getPrimaryPG(); @@ -7431,7 +7175,7 @@ static protected AttributeMap newAttributeMap() { static protected class AttributeMap extends HashMap { - public ArrayList names = new ArrayList(); + public ArrayList names = new ArrayList<>(); public int numComp = 0; // number of components for a single vertex @Override @@ -7551,21 +7295,13 @@ boolean bufferCreated() { } void createBuffer(PGL pgl) { -// int ctx = pgl.getCurrentContext(); buf = new VertexBuffer(pg, PGL.ARRAY_BUFFER, size, elementSize, false); -// -// glName = createVertexBufferObject(ctx, pgl); -// pgl.bindBuffer(PGL.ARRAY_BUFFER, glName); -// pgl.bufferData(PGL.ARRAY_BUFFER, size * INIT_VERTEX_BUFFER_SIZE * elementSize, -// null, PGL.STATIC_DRAW); } void deleteBuffer(PGL pgl) { if (buf.glId != 0) { -// int ctx = pgl.getCurrentContext(); intBuffer.put(0, buf.glId); if (pgl.threadIsCurrent()) pgl.deleteBuffers(1, intBuffer); -// PGraphicsOpenGL.deleteVertexBufferObject(buf.glId, ctx, pgl); } } @@ -7779,17 +7515,19 @@ static protected class IndexCache { int[] indexOffset; int[] vertexCount; int[] vertexOffset; + int[] counter; IndexCache() { allocate(); } void allocate() { + size = 0; indexCount = new int[2]; indexOffset = new int[2]; vertexCount = new int[2]; vertexOffset = new int[2]; - size = 0; + counter = null; } void clear() { @@ -7822,9 +7560,17 @@ int getLast() { return size - 1; } + void setCounter(int[] counter) { + this.counter = counter; + } + void incCounts(int index, int icount, int vcount) { indexCount[index] += icount; vertexCount[index] += vcount; + if (counter != null) { + counter[0] += icount; + counter[1] += vcount; + } } void init(int n) { @@ -7955,9 +7701,9 @@ void allocate() { shininess = new float[PGL.DEFAULT_IN_VERTICES]; edges = new int[PGL.DEFAULT_IN_EDGES][3]; - fattribs = new HashMap(); - iattribs = new HashMap(); - battribs = new HashMap(); + fattribs = new HashMap<>(); + iattribs = new HashMap<>(); + battribs = new HashMap<>(); clear(); } @@ -8051,8 +7797,11 @@ int getNumEdgeVertices(boolean bevel) { if (bevel) { for (int i = 0; i < edgeCount; i++) { int[] edge = edges[i]; - if (edge[2] == EDGE_MIDDLE || edge[2] == EDGE_START) bevVert++; - if (edge[2] == EDGE_CLOSE) segVert--; + if (edge[2] == EDGE_MIDDLE || edge[2] == EDGE_START) bevVert += 3; + if (edge[2] == EDGE_CLOSE) { + bevVert += 5; + segVert--; + } } } else { segVert -= getNumEdgeClosures(); @@ -8067,7 +7816,10 @@ int getNumEdgeIndices(boolean bevel) { for (int i = 0; i < edgeCount; i++) { int[] edge = edges[i]; if (edge[2] == EDGE_MIDDLE || edge[2] == EDGE_START) bevInd++; - if (edge[2] == EDGE_CLOSE) segInd--; + if (edge[2] == EDGE_CLOSE) { + bevInd++; + segInd--; + } } } else { segInd -= getNumEdgeClosures(); @@ -8147,61 +7899,61 @@ int getVertexSum(PVector v) { // Expand arrays void expandVertices(int n) { - float temp[] = new float[3 * n]; + float[] temp = new float[3 * n]; PApplet.arrayCopy(vertices, 0, temp, 0, 3 * vertexCount); vertices = temp; } void expandColors(int n) { - int temp[] = new int[n]; + int[] temp = new int[n]; PApplet.arrayCopy(colors, 0, temp, 0, vertexCount); colors = temp; } void expandNormals(int n) { - float temp[] = new float[3 * n]; + float[] temp = new float[3 * n]; PApplet.arrayCopy(normals, 0, temp, 0, 3 * vertexCount); normals = temp; } void expandTexCoords(int n) { - float temp[] = new float[2 * n]; + float[] temp = new float[2 * n]; PApplet.arrayCopy(texcoords, 0, temp, 0, 2 * vertexCount); texcoords = temp; } void expandStrokeColors(int n) { - int temp[] = new int[n]; + int[] temp = new int[n]; PApplet.arrayCopy(strokeColors, 0, temp, 0, vertexCount); strokeColors = temp; } void expandStrokeWeights(int n) { - float temp[] = new float[n]; + float[] temp = new float[n]; PApplet.arrayCopy(strokeWeights, 0, temp, 0, vertexCount); strokeWeights = temp; } void expandAmbient(int n) { - int temp[] = new int[n]; + int[] temp = new int[n]; PApplet.arrayCopy(ambient, 0, temp, 0, vertexCount); ambient = temp; } void expandSpecular(int n) { - int temp[] = new int[n]; + int[] temp = new int[n]; PApplet.arrayCopy(specular, 0, temp, 0, vertexCount); specular = temp; } void expandEmissive(int n) { - int temp[] = new int[n]; + int[] temp = new int[n]; PApplet.arrayCopy(emissive, 0, temp, 0, vertexCount); emissive = temp; } void expandShininess(int n) { - float temp[] = new float[n]; + float[] temp = new float[n]; PApplet.arrayCopy(shininess, 0, temp, 0, vertexCount); shininess = temp; } @@ -8221,33 +7973,33 @@ void expandAttribs(int n) { void expandFloatAttrib(VertexAttribute attrib, int n) { float[] values = fattribs.get(attrib.name); - float temp[] = new float[attrib.size * n]; + float[] temp = new float[attrib.size * n]; PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount); fattribs.put(attrib.name, temp); } void expandIntAttrib(VertexAttribute attrib, int n) { int[] values = iattribs.get(attrib.name); - int temp[] = new int[attrib.size * n]; + int[] temp = new int[attrib.size * n]; PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount); iattribs.put(attrib.name, temp); } void expandBoolAttrib(VertexAttribute attrib, int n) { byte[] values = battribs.get(attrib.name); - byte temp[] = new byte[attrib.size * n]; + byte[] temp = new byte[attrib.size * n]; PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount); battribs.put(attrib.name, temp); } void expandCodes(int n) { - int temp[] = new int[n]; + int[] temp = new int[n]; PApplet.arrayCopy(codes, 0, temp, 0, codeCount); codes = temp; } void expandEdges(int n) { - int temp[][] = new int[n][3]; + int[][] temp = new int[n][3]; PApplet.arrayCopy(edges, 0, temp, 0, edgeCount); edges = temp; } @@ -8281,73 +8033,73 @@ void trim() { } void trimVertices() { - float temp[] = new float[3 * vertexCount]; + float[] temp = new float[3 * vertexCount]; PApplet.arrayCopy(vertices, 0, temp, 0, 3 * vertexCount); vertices = temp; } void trimColors() { - int temp[] = new int[vertexCount]; + int[] temp = new int[vertexCount]; PApplet.arrayCopy(colors, 0, temp, 0, vertexCount); colors = temp; } void trimNormals() { - float temp[] = new float[3 * vertexCount]; + float[] temp = new float[3 * vertexCount]; PApplet.arrayCopy(normals, 0, temp, 0, 3 * vertexCount); normals = temp; } void trimTexCoords() { - float temp[] = new float[2 * vertexCount]; + float[] temp = new float[2 * vertexCount]; PApplet.arrayCopy(texcoords, 0, temp, 0, 2 * vertexCount); texcoords = temp; } void trimStrokeColors() { - int temp[] = new int[vertexCount]; + int[] temp = new int[vertexCount]; PApplet.arrayCopy(strokeColors, 0, temp, 0, vertexCount); strokeColors = temp; } void trimStrokeWeights() { - float temp[] = new float[vertexCount]; + float[] temp = new float[vertexCount]; PApplet.arrayCopy(strokeWeights, 0, temp, 0, vertexCount); strokeWeights = temp; } void trimAmbient() { - int temp[] = new int[vertexCount]; + int[] temp = new int[vertexCount]; PApplet.arrayCopy(ambient, 0, temp, 0, vertexCount); ambient = temp; } void trimSpecular() { - int temp[] = new int[vertexCount]; + int[] temp = new int[vertexCount]; PApplet.arrayCopy(specular, 0, temp, 0, vertexCount); specular = temp; } void trimEmissive() { - int temp[] = new int[vertexCount]; + int[] temp = new int[vertexCount]; PApplet.arrayCopy(emissive, 0, temp, 0, vertexCount); emissive = temp; } void trimShininess() { - float temp[] = new float[vertexCount]; + float[] temp = new float[vertexCount]; PApplet.arrayCopy(shininess, 0, temp, 0, vertexCount); shininess = temp; } void trimCodes() { - int temp[] = new int[codeCount]; + int[] temp = new int[codeCount]; PApplet.arrayCopy(codes, 0, temp, 0, codeCount); codes = temp; } void trimEdges() { - int temp[][] = new int[edgeCount][3]; + int[][] temp = new int[edgeCount][3]; PApplet.arrayCopy(edges, 0, temp, 0, edgeCount); edges = temp; } @@ -8367,21 +8119,21 @@ void trimAttribs() { void trimFloatAttrib(VertexAttribute attrib) { float[] values = fattribs.get(attrib.name); - float temp[] = new float[attrib.size * vertexCount]; + float[] temp = new float[attrib.size * vertexCount]; PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount); fattribs.put(attrib.name, temp); } void trimIntAttrib(VertexAttribute attrib) { int[] values = iattribs.get(attrib.name); - int temp[] = new int[attrib.size * vertexCount]; + int[] temp = new int[attrib.size * vertexCount]; PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount); iattribs.put(attrib.name, temp); } void trimBoolAttrib(VertexAttribute attrib) { byte[] values = battribs.get(attrib.name); - byte temp[] = new byte[attrib.size * vertexCount]; + byte[] temp = new byte[attrib.size * vertexCount]; PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount); battribs.put(attrib.name, temp); } @@ -8391,7 +8143,13 @@ void trimBoolAttrib(VertexAttribute attrib) { // Vertices int addVertex(float x, float y, boolean brk) { - return addVertex(x, y, VERTEX, brk); + return addVertex(x, y, 0, + fillColor, + normalX, normalY, normalZ, + 0, 0, + strokeColor, strokeWeight, + ambientColor, specularColor, emissiveColor, shininessFactor, + VERTEX, brk); } int addVertex(float x, float y, @@ -8408,7 +8166,13 @@ int addVertex(float x, float y, int addVertex(float x, float y, float u, float v, boolean brk) { - return addVertex(x, y, u, v, VERTEX, brk); + return addVertex(x, y, 0, + fillColor, + normalX, normalY, normalZ, + u, v, + strokeColor, strokeWeight, + ambientColor, specularColor, emissiveColor, shininessFactor, + VERTEX, brk); } int addVertex(float x, float y, @@ -8424,7 +8188,13 @@ int addVertex(float x, float y, } int addVertex(float x, float y, float z, boolean brk) { - return addVertex(x, y, z, VERTEX, brk); + return addVertex(x, y, z, + fillColor, + normalX, normalY, normalZ, + 0, 0, + strokeColor, strokeWeight, + ambientColor, specularColor, emissiveColor, shininessFactor, + VERTEX, brk); } int addVertex(float x, float y, float z, int code, boolean brk) { @@ -8440,7 +8210,13 @@ int addVertex(float x, float y, float z, int code, boolean brk) { int addVertex(float x, float y, float z, float u, float v, boolean brk) { - return addVertex(x, y, z, u, v, VERTEX, brk); + return addVertex(x, y, z, + fillColor, + normalX, normalY, normalZ, + u, v, + strokeColor, strokeWeight, + ambientColor, specularColor, emissiveColor, shininessFactor, + VERTEX, brk); } int addVertex(float x, float y, float z, @@ -8648,9 +8424,9 @@ void addTrianglesEdges() { int i1 = 3 * i + 1; int i2 = 3 * i + 2; - addEdge(i0, i1, true, false); + addEdge(i0, i1, true, false); addEdge(i1, i2, false, false); - addEdge(i2, i0, false, false); + addEdge(i2, i0, false, false); closeEdge(i2, i0); } } @@ -8661,9 +8437,9 @@ void addTriangleFanEdges() { int i1 = i; int i2 = i + 1; - addEdge(i0, i1, true, false); + addEdge(i0, i1, true, false); addEdge(i1, i2, false, false); - addEdge(i2, i0, false, false); + addEdge(i2, i0, false, false); closeEdge(i2, i0); } } @@ -8680,9 +8456,9 @@ void addTriangleStripEdges() { i2 = i - 1; } - addEdge(i0, i1, true, false); + addEdge(i0, i1, true, false); addEdge(i1, i2, false, false); - addEdge(i2, i0, false, false); + addEdge(i2, i0, false, false); closeEdge(i2, i0); } } @@ -8694,7 +8470,7 @@ void addQuadsEdges() { int i2 = 4 * i + 2; int i3 = 4 * i + 3; - addEdge(i0, i1, true, false); + addEdge(i0, i1, true, false); addEdge(i1, i2, false, false); addEdge(i2, i3, false, false); addEdge(i3, i0, false, false); @@ -8709,10 +8485,10 @@ void addQuadStripEdges() { int i2 = 2 * qd + 1; int i3 = 2 * qd; - addEdge(i0, i1, true, false); + addEdge(i0, i1, true, false); addEdge(i1, i2, false, false); - addEdge(i2, i3, false, false); - addEdge(i3, i0, false, true); + addEdge(i2, i3, false, false); + addEdge(i3, i0, false, false); closeEdge(i3, i0); } } @@ -9330,7 +9106,6 @@ int[] addSphere(float r, int detailU, int detailV, indices[indCount + 3 * i + 1] = i0; indices[indCount + 3 * i + 2] = i0 + 1; - addEdge(i0, i0 + 1, true, true); addEdge(i0, i1, true, true); } indCount += 3 * detailU; @@ -9363,7 +9138,7 @@ static protected class TessGeometry { FloatBuffer polyShininessBuffer; // Generic attributes - HashMap polyAttribBuffers = new HashMap(); + HashMap polyAttribBuffers = new HashMap<>(); int polyIndexCount; int firstPolyIndex; @@ -9418,9 +9193,9 @@ static protected class TessGeometry { float[] pointOffsets; short[] pointIndices; - HashMap fpolyAttribs = new HashMap(); - HashMap ipolyAttribs = new HashMap(); - HashMap bpolyAttribs = new HashMap(); + HashMap fpolyAttribs = new HashMap<>(); + HashMap ipolyAttribs = new HashMap<>(); + HashMap bpolyAttribs = new HashMap<>(); TessGeometry(PGraphicsOpenGL pg, AttributeMap attr, int mode) { this.pg = pg; @@ -9900,56 +9675,56 @@ protected void updatePointIndicesBuffer(int offset, int size) { // Expand arrays void expandPolyVertices(int n) { - float temp[] = new float[4 * n]; + float[] temp = new float[4 * n]; PApplet.arrayCopy(polyVertices, 0, temp, 0, 4 * polyVertexCount); polyVertices = temp; polyVerticesBuffer = PGL.allocateFloatBuffer(polyVertices); } void expandPolyColors(int n) { - int temp[] = new int[n]; + int[] temp = new int[n]; PApplet.arrayCopy(polyColors, 0, temp, 0, polyVertexCount); polyColors = temp; polyColorsBuffer = PGL.allocateIntBuffer(polyColors); } void expandPolyNormals(int n) { - float temp[] = new float[3 * n]; + float[] temp = new float[3 * n]; PApplet.arrayCopy(polyNormals, 0, temp, 0, 3 * polyVertexCount); polyNormals = temp; polyNormalsBuffer = PGL.allocateFloatBuffer(polyNormals); } void expandPolyTexCoords(int n) { - float temp[] = new float[2 * n]; + float[] temp = new float[2 * n]; PApplet.arrayCopy(polyTexCoords, 0, temp, 0, 2 * polyVertexCount); polyTexCoords = temp; polyTexCoordsBuffer = PGL.allocateFloatBuffer(polyTexCoords); } void expandPolyAmbient(int n) { - int temp[] = new int[n]; + int[] temp = new int[n]; PApplet.arrayCopy(polyAmbient, 0, temp, 0, polyVertexCount); polyAmbient = temp; polyAmbientBuffer = PGL.allocateIntBuffer(polyAmbient); } void expandPolySpecular(int n) { - int temp[] = new int[n]; + int[] temp = new int[n]; PApplet.arrayCopy(polySpecular, 0, temp, 0, polyVertexCount); polySpecular = temp; polySpecularBuffer = PGL.allocateIntBuffer(polySpecular); } void expandPolyEmissive(int n) { - int temp[] = new int[n]; + int[] temp = new int[n]; PApplet.arrayCopy(polyEmissive, 0, temp, 0, polyVertexCount); polyEmissive = temp; polyEmissiveBuffer = PGL.allocateIntBuffer(polyEmissive); } void expandPolyShininess(int n) { - float temp[] = new float[n]; + float[] temp = new float[n]; PApplet.arrayCopy(polyShininess, 0, temp, 0, polyVertexCount); polyShininess = temp; polyShininessBuffer = PGL.allocateFloatBuffer(polyShininess); @@ -9970,7 +9745,7 @@ void expandAttributes(int n) { void expandFloatAttribute(VertexAttribute attrib, int n) { float[] array = fpolyAttribs.get(attrib.name); - float temp[] = new float[attrib.tessSize * n]; + float[] temp = new float[attrib.tessSize * n]; PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount); fpolyAttribs.put(attrib.name, temp); polyAttribBuffers.put(attrib.name, PGL.allocateFloatBuffer(temp)); @@ -9978,7 +9753,7 @@ void expandFloatAttribute(VertexAttribute attrib, int n) { void expandIntAttribute(VertexAttribute attrib, int n) { int[] array = ipolyAttribs.get(attrib.name); - int temp[] = new int[attrib.tessSize * n]; + int[] temp = new int[attrib.tessSize * n]; PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount); ipolyAttribs.put(attrib.name, temp); polyAttribBuffers.put(attrib.name, PGL.allocateIntBuffer(temp)); @@ -9986,70 +9761,70 @@ void expandIntAttribute(VertexAttribute attrib, int n) { void expandBoolAttribute(VertexAttribute attrib, int n) { byte[] array = bpolyAttribs.get(attrib.name); - byte temp[] = new byte[attrib.tessSize * n]; + byte[] temp = new byte[attrib.tessSize * n]; PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount); bpolyAttribs.put(attrib.name, temp); polyAttribBuffers.put(attrib.name, PGL.allocateByteBuffer(temp)); } void expandPolyIndices(int n) { - short temp[] = new short[n]; + short[] temp = new short[n]; PApplet.arrayCopy(polyIndices, 0, temp, 0, polyIndexCount); polyIndices = temp; polyIndicesBuffer = PGL.allocateShortBuffer(polyIndices); } void expandLineVertices(int n) { - float temp[] = new float[4 * n]; + float[] temp = new float[4 * n]; PApplet.arrayCopy(lineVertices, 0, temp, 0, 4 * lineVertexCount); lineVertices = temp; lineVerticesBuffer = PGL.allocateFloatBuffer(lineVertices); } void expandLineColors(int n) { - int temp[] = new int[n]; + int[] temp = new int[n]; PApplet.arrayCopy(lineColors, 0, temp, 0, lineVertexCount); lineColors = temp; lineColorsBuffer = PGL.allocateIntBuffer(lineColors); } void expandLineDirections(int n) { - float temp[] = new float[4 * n]; + float[] temp = new float[4 * n]; PApplet.arrayCopy(lineDirections, 0, temp, 0, 4 * lineVertexCount); lineDirections = temp; lineDirectionsBuffer = PGL.allocateFloatBuffer(lineDirections); } void expandLineIndices(int n) { - short temp[] = new short[n]; + short[] temp = new short[n]; PApplet.arrayCopy(lineIndices, 0, temp, 0, lineIndexCount); lineIndices = temp; lineIndicesBuffer = PGL.allocateShortBuffer(lineIndices); } void expandPointVertices(int n) { - float temp[] = new float[4 * n]; + float[] temp = new float[4 * n]; PApplet.arrayCopy(pointVertices, 0, temp, 0, 4 * pointVertexCount); pointVertices = temp; pointVerticesBuffer = PGL.allocateFloatBuffer(pointVertices); } void expandPointColors(int n) { - int temp[] = new int[n]; + int[] temp = new int[n]; PApplet.arrayCopy(pointColors, 0, temp, 0, pointVertexCount); pointColors = temp; pointColorsBuffer = PGL.allocateIntBuffer(pointColors); } void expandPointOffsets(int n) { - float temp[] = new float[2 * n]; + float[] temp = new float[2 * n]; PApplet.arrayCopy(pointOffsets, 0, temp, 0, 2 * pointVertexCount); pointOffsets = temp; pointOffsetsBuffer = PGL.allocateFloatBuffer(pointOffsets); } void expandPointIndices(int n) { - short temp[] = new short[n]; + short[] temp = new short[n]; PApplet.arrayCopy(pointIndices, 0, temp, 0, pointIndexCount); pointIndices = temp; pointIndicesBuffer = PGL.allocateShortBuffer(pointIndices); @@ -10069,7 +9844,7 @@ void trim() { trimPolySpecular(); trimPolyEmissive(); trimPolyShininess(); - trimAttributes(); + trimPolyAttributes(); } if (0 < polyIndexCount && polyIndexCount < polyIndices.length) { @@ -10098,62 +9873,62 @@ void trim() { } void trimPolyVertices() { - float temp[] = new float[4 * polyVertexCount]; + float[] temp = new float[4 * polyVertexCount]; PApplet.arrayCopy(polyVertices, 0, temp, 0, 4 * polyVertexCount); polyVertices = temp; polyVerticesBuffer = PGL.allocateFloatBuffer(polyVertices); } void trimPolyColors() { - int temp[] = new int[polyVertexCount]; + int[] temp = new int[polyVertexCount]; PApplet.arrayCopy(polyColors, 0, temp, 0, polyVertexCount); polyColors = temp; polyColorsBuffer = PGL.allocateIntBuffer(polyColors); } void trimPolyNormals() { - float temp[] = new float[3 * polyVertexCount]; + float[] temp = new float[3 * polyVertexCount]; PApplet.arrayCopy(polyNormals, 0, temp, 0, 3 * polyVertexCount); polyNormals = temp; polyNormalsBuffer = PGL.allocateFloatBuffer(polyNormals); } void trimPolyTexCoords() { - float temp[] = new float[2 * polyVertexCount]; + float[] temp = new float[2 * polyVertexCount]; PApplet.arrayCopy(polyTexCoords, 0, temp, 0, 2 * polyVertexCount); polyTexCoords = temp; polyTexCoordsBuffer = PGL.allocateFloatBuffer(polyTexCoords); } void trimPolyAmbient() { - int temp[] = new int[polyVertexCount]; + int[] temp = new int[polyVertexCount]; PApplet.arrayCopy(polyAmbient, 0, temp, 0, polyVertexCount); polyAmbient = temp; polyAmbientBuffer = PGL.allocateIntBuffer(polyAmbient); } void trimPolySpecular() { - int temp[] = new int[polyVertexCount]; + int[] temp = new int[polyVertexCount]; PApplet.arrayCopy(polySpecular, 0, temp, 0, polyVertexCount); polySpecular = temp; polySpecularBuffer = PGL.allocateIntBuffer(polySpecular); } void trimPolyEmissive() { - int temp[] = new int[polyVertexCount]; + int[] temp = new int[polyVertexCount]; PApplet.arrayCopy(polyEmissive, 0, temp, 0, polyVertexCount); polyEmissive = temp; polyEmissiveBuffer = PGL.allocateIntBuffer(polyEmissive); } void trimPolyShininess() { - float temp[] = new float[polyVertexCount]; + float[] temp = new float[polyVertexCount]; PApplet.arrayCopy(polyShininess, 0, temp, 0, polyVertexCount); polyShininess = temp; polyShininessBuffer = PGL.allocateFloatBuffer(polyShininess); } - void trimAttributes() { + void trimPolyAttributes() { for (String name: polyAttribs.keySet()) { VertexAttribute attrib = polyAttribs.get(name); if (attrib.type == PGL.FLOAT) { @@ -10168,7 +9943,7 @@ void trimAttributes() { void trimFloatAttribute(VertexAttribute attrib) { float[] array = fpolyAttribs.get(attrib.name); - float temp[] = new float[attrib.tessSize * polyVertexCount]; + float[] temp = new float[attrib.tessSize * polyVertexCount]; PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount); fpolyAttribs.put(attrib.name, temp); polyAttribBuffers.put(attrib.name, PGL.allocateFloatBuffer(temp)); @@ -10176,7 +9951,7 @@ void trimFloatAttribute(VertexAttribute attrib) { void trimIntAttribute(VertexAttribute attrib) { int[] array = ipolyAttribs.get(attrib.name); - int temp[] = new int[attrib.tessSize * polyVertexCount]; + int[] temp = new int[attrib.tessSize * polyVertexCount]; PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount); ipolyAttribs.put(attrib.name, temp); polyAttribBuffers.put(attrib.name, PGL.allocateIntBuffer(temp)); @@ -10184,70 +9959,70 @@ void trimIntAttribute(VertexAttribute attrib) { void trimBoolAttribute(VertexAttribute attrib) { byte[] array = bpolyAttribs.get(attrib.name); - byte temp[] = new byte[attrib.tessSize * polyVertexCount]; + byte[] temp = new byte[attrib.tessSize * polyVertexCount]; PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount); bpolyAttribs.put(attrib.name, temp); polyAttribBuffers.put(attrib.name, PGL.allocateByteBuffer(temp)); } void trimPolyIndices() { - short temp[] = new short[polyIndexCount]; + short[] temp = new short[polyIndexCount]; PApplet.arrayCopy(polyIndices, 0, temp, 0, polyIndexCount); polyIndices = temp; polyIndicesBuffer = PGL.allocateShortBuffer(polyIndices); } void trimLineVertices() { - float temp[] = new float[4 * lineVertexCount]; + float[] temp = new float[4 * lineVertexCount]; PApplet.arrayCopy(lineVertices, 0, temp, 0, 4 * lineVertexCount); lineVertices = temp; lineVerticesBuffer = PGL.allocateFloatBuffer(lineVertices); } void trimLineColors() { - int temp[] = new int[lineVertexCount]; + int[] temp = new int[lineVertexCount]; PApplet.arrayCopy(lineColors, 0, temp, 0, lineVertexCount); lineColors = temp; lineColorsBuffer = PGL.allocateIntBuffer(lineColors); } void trimLineDirections() { - float temp[] = new float[4 * lineVertexCount]; + float[] temp = new float[4 * lineVertexCount]; PApplet.arrayCopy(lineDirections, 0, temp, 0, 4 * lineVertexCount); lineDirections = temp; lineDirectionsBuffer = PGL.allocateFloatBuffer(lineDirections); } void trimLineIndices() { - short temp[] = new short[lineIndexCount]; + short[] temp = new short[lineIndexCount]; PApplet.arrayCopy(lineIndices, 0, temp, 0, lineIndexCount); lineIndices = temp; lineIndicesBuffer = PGL.allocateShortBuffer(lineIndices); } void trimPointVertices() { - float temp[] = new float[4 * pointVertexCount]; + float[] temp = new float[4 * pointVertexCount]; PApplet.arrayCopy(pointVertices, 0, temp, 0, 4 * pointVertexCount); pointVertices = temp; pointVerticesBuffer = PGL.allocateFloatBuffer(pointVertices); } void trimPointColors() { - int temp[] = new int[pointVertexCount]; + int[] temp = new int[pointVertexCount]; PApplet.arrayCopy(pointColors, 0, temp, 0, pointVertexCount); pointColors = temp; pointColorsBuffer = PGL.allocateIntBuffer(pointColors); } void trimPointOffsets() { - float temp[] = new float[2 * pointVertexCount]; + float[] temp = new float[2 * pointVertexCount]; PApplet.arrayCopy(pointOffsets, 0, temp, 0, 2 * pointVertexCount); pointOffsets = temp; pointOffsetsBuffer = PGL.allocateFloatBuffer(pointOffsets); } void trimPointIndices() { - short temp[] = new short[pointIndexCount]; + short[] temp = new short[pointIndexCount]; PApplet.arrayCopy(pointIndices, 0, temp, 0, pointIndexCount); pointIndices = temp; pointIndicesBuffer = PGL.allocateShortBuffer(pointIndices); @@ -10639,250 +10414,275 @@ void addPolyVertex(InGeometry in, int i, boolean clampXY) { } void addPolyVertices(InGeometry in, int i0, int i1, boolean clampXY) { - int index; + int index = 0; int nvert = i1 - i0 + 1; polyVertexCheck(nvert); if (renderMode == IMMEDIATE && pg.flushMode == FLUSH_WHEN_FULL) { - PMatrix3D mm = pg.modelview; - PMatrix3D nm = pg.modelviewInv; + modelviewCoords(in, i0, index, nvert, clampXY); + } else { + if (nvert <= PGL.MIN_ARRAYCOPY_SIZE) { + copyFewCoords(in, i0, index, nvert); + } else { + copyManyCoords(in, i0, index, nvert); + } + } - for (int i = 0; i < nvert; i++) { - int inIdx = i0 + i; - int tessIdx = firstPolyVertex + i; + if (nvert <= PGL.MIN_ARRAYCOPY_SIZE) { + copyFewAttribs(in, i0, index, nvert); + } else { + copyManyAttribs(in, i0, index, nvert); + } + } - index = 3 * inIdx; - float x = in.vertices[index++]; - float y = in.vertices[index++]; - float z = in.vertices[index ]; + // Apply modelview transformation on the vertices + private void modelviewCoords(InGeometry in, int i0, int index, int nvert, boolean clampXY) { + PMatrix3D mm = pg.modelview; + PMatrix3D nm = pg.modelviewInv; - index = 3 * inIdx; - float nx = in.normals[index++]; - float ny = in.normals[index++]; - float nz = in.normals[index ]; - - index = 4 * tessIdx; - if (clampXY) { - // ceil emulates the behavior of JAVA2D - polyVertices[index++] = - PApplet.ceil(x*mm.m00 + y*mm.m01 + z*mm.m02 + mm.m03); - polyVertices[index++] = - PApplet.ceil(x*mm.m10 + y*mm.m11 + z*mm.m12 + mm.m13); - } else { - polyVertices[index++] = x*mm.m00 + y*mm.m01 + z*mm.m02 + mm.m03; - polyVertices[index++] = x*mm.m10 + y*mm.m11 + z*mm.m12 + mm.m13; - } - polyVertices[index++] = x*mm.m20 + y*mm.m21 + z*mm.m22 + mm.m23; - polyVertices[index ] = x*mm.m30 + y*mm.m31 + z*mm.m32 + mm.m33; + for (int i = 0; i < nvert; i++) { + int inIdx = i0 + i; + int tessIdx = firstPolyVertex + i; - index = 3 * tessIdx; - polyNormals[index++] = nx*nm.m00 + ny*nm.m10 + nz*nm.m20; - polyNormals[index++] = nx*nm.m01 + ny*nm.m11 + nz*nm.m21; - polyNormals[index ] = nx*nm.m02 + ny*nm.m12 + nz*nm.m22; + index = 3 * inIdx; + float x = in.vertices[index++]; + float y = in.vertices[index++]; + float z = in.vertices[index ]; - for (String name: polyAttribs.keySet()) { - VertexAttribute attrib = polyAttribs.get(name); - if (attrib.isColor() || attrib.isOther()) continue; + index = 3 * inIdx; + float nx = in.normals[index++]; + float ny = in.normals[index++]; + float nz = in.normals[index ]; - float[] inValues = in.fattribs.get(name); - index = 3 * inIdx; - x = inValues[index++]; - y = inValues[index++]; - z = inValues[index ]; + index = 4 * tessIdx; + if (clampXY) { + // ceil emulates the behavior of JAVA2D + polyVertices[index++] = + PApplet.ceil(x*mm.m00 + y*mm.m01 + z*mm.m02 + mm.m03); + polyVertices[index++] = + PApplet.ceil(x*mm.m10 + y*mm.m11 + z*mm.m12 + mm.m13); + } else { + polyVertices[index++] = x*mm.m00 + y*mm.m01 + z*mm.m02 + mm.m03; + polyVertices[index++] = x*mm.m10 + y*mm.m11 + z*mm.m12 + mm.m13; + } + polyVertices[index++] = x*mm.m20 + y*mm.m21 + z*mm.m22 + mm.m23; + polyVertices[index ] = x*mm.m30 + y*mm.m31 + z*mm.m32 + mm.m33; - float[] tessValues = fpolyAttribs.get(name); - if (attrib.isPosition()) { - index = 4 * tessIdx; - if (clampXY) { - // ceil emulates the behavior of JAVA2D - tessValues[index++] = - PApplet.ceil(x*mm.m00 + y*mm.m01 + z*mm.m02 + mm.m03); - tessValues[index++] = - PApplet.ceil(x*mm.m10 + y*mm.m11 + z*mm.m12 + mm.m13); - } else { - tessValues[index++] = x*mm.m00 + y*mm.m01 + z*mm.m02 + mm.m03; - tessValues[index++] = x*mm.m10 + y*mm.m11 + z*mm.m12 + mm.m13; - } - tessValues[index++] = x*mm.m20 + y*mm.m21 + z*mm.m22 + mm.m23; - tessValues[index ] = x*mm.m30 + y*mm.m31 + z*mm.m32 + mm.m33; + index = 3 * tessIdx; + polyNormals[index++] = nx*nm.m00 + ny*nm.m10 + nz*nm.m20; + polyNormals[index++] = nx*nm.m01 + ny*nm.m11 + nz*nm.m21; + polyNormals[index ] = nx*nm.m02 + ny*nm.m12 + nz*nm.m22; + + for (String name: polyAttribs.keySet()) { + VertexAttribute attrib = polyAttribs.get(name); + if (attrib.isColor() || attrib.isOther()) continue; + + float[] inValues = in.fattribs.get(name); + index = 3 * inIdx; + x = inValues[index++]; + y = inValues[index++]; + z = inValues[index ]; + + float[] tessValues = fpolyAttribs.get(name); + if (attrib.isPosition()) { + index = 4 * tessIdx; + if (clampXY) { + // ceil emulates the behavior of JAVA2D + tessValues[index++] = + PApplet.ceil(x*mm.m00 + y*mm.m01 + z*mm.m02 + mm.m03); + tessValues[index++] = + PApplet.ceil(x*mm.m10 + y*mm.m11 + z*mm.m12 + mm.m13); } else { - index = 3 * tessIdx; - tessValues[index++] = x*nm.m00 + y*nm.m10 + z*nm.m20; - tessValues[index++] = x*nm.m01 + y*nm.m11 + z*nm.m21; - tessValues[index ] = x*nm.m02 + y*nm.m12 + z*nm.m22; + tessValues[index++] = x*mm.m00 + y*mm.m01 + z*mm.m02 + mm.m03; + tessValues[index++] = x*mm.m10 + y*mm.m11 + z*mm.m12 + mm.m13; } + tessValues[index++] = x*mm.m20 + y*mm.m21 + z*mm.m22 + mm.m23; + tessValues[index ] = x*mm.m30 + y*mm.m31 + z*mm.m32 + mm.m33; + } else { + index = 3 * tessIdx; + tessValues[index++] = x*nm.m00 + y*nm.m10 + z*nm.m20; + tessValues[index++] = x*nm.m01 + y*nm.m11 + z*nm.m21; + tessValues[index ] = x*nm.m02 + y*nm.m12 + z*nm.m22; } } - } else { - if (nvert <= PGL.MIN_ARRAYCOPY_SIZE) { - // Copying elements one by one instead of using arrayCopy is more - // efficient for few vertices... - for (int i = 0; i < nvert; i++) { - int inIdx = i0 + i; - int tessIdx = firstPolyVertex + i; - - index = 3 * inIdx; - float x = in.vertices[index++]; - float y = in.vertices[index++]; - float z = in.vertices[index ]; - - index = 3 * inIdx; - float nx = in.normals[index++]; - float ny = in.normals[index++]; - float nz = in.normals[index ]; + } + } - index = 4 * tessIdx; - polyVertices[index++] = x; - polyVertices[index++] = y; - polyVertices[index++] = z; - polyVertices[index ] = 1; + // Just copy vertices one by one. + private void copyFewCoords(InGeometry in, int i0, int index, int nvert) { + // Copying elements one by one instead of using arrayCopy is more + // efficient for few vertices... + for (int i = 0; i < nvert; i++) { + int inIdx = i0 + i; + int tessIdx = firstPolyVertex + i; + + index = 3 * inIdx; + float x = in.vertices[index++]; + float y = in.vertices[index++]; + float z = in.vertices[index ]; + + index = 3 * inIdx; + float nx = in.normals[index++]; + float ny = in.normals[index++]; + float nz = in.normals[index ]; + + index = 4 * tessIdx; + polyVertices[index++] = x; + polyVertices[index++] = y; + polyVertices[index++] = z; + polyVertices[index ] = 1; + + index = 3 * tessIdx; + polyNormals[index++] = nx; + polyNormals[index++] = ny; + polyNormals[index ] = nz; + + for (String name: polyAttribs.keySet()) { + VertexAttribute attrib = polyAttribs.get(name); + if (attrib.isColor() || attrib.isOther()) continue; + + float[] inValues = in.fattribs.get(name); + index = 3 * inIdx; + x = inValues[index++]; + y = inValues[index++]; + z = inValues[index ]; + float[] tessValues = fpolyAttribs.get(name); + if (attrib.isPosition()) { + index = 4 * tessIdx; + tessValues[index++] = x; + tessValues[index++] = y; + tessValues[index++] = z; + tessValues[index ] = 1; + } else { index = 3 * tessIdx; - polyNormals[index++] = nx; - polyNormals[index++] = ny; - polyNormals[index ] = nz; - - for (String name: polyAttribs.keySet()) { - VertexAttribute attrib = polyAttribs.get(name); - if (attrib.isColor() || attrib.isOther()) continue; - - float[] inValues = in.fattribs.get(name); - index = 3 * inIdx; - x = inValues[index++]; - y = inValues[index++]; - z = inValues[index ]; - - float[] tessValues = fpolyAttribs.get(name); - if (attrib.isPosition()) { - index = 4 * tessIdx; - tessValues[index++] = x; - tessValues[index++] = y; - tessValues[index++] = z; - tessValues[index ] = 1; - } else { - index = 3 * tessIdx; - tessValues[index++] = x; - tessValues[index++] = y; - tessValues[index ] = z; - } - } - } - } else { - for (int i = 0; i < nvert; i++) { - int inIdx = i0 + i; - int tessIdx = firstPolyVertex + i; - PApplet.arrayCopy(in.vertices, 3 * inIdx, - polyVertices, 4 * tessIdx, 3); - polyVertices[4 * tessIdx + 3] = 1; - - for (String name: polyAttribs.keySet()) { - VertexAttribute attrib = polyAttribs.get(name); - if (!attrib.isPosition()) continue; - float[] inValues = in.fattribs.get(name); - float[] tessValues = fpolyAttribs.get(name); - PApplet.arrayCopy(inValues, 3 * inIdx, - tessValues, 4 * tessIdx, 3); - tessValues[4 * tessIdx + 3] = 1; - } - } - PApplet.arrayCopy(in.normals, 3 * i0, - polyNormals, 3 * firstPolyVertex, 3 * nvert); - for (String name: polyAttribs.keySet()) { - VertexAttribute attrib = polyAttribs.get(name); - if (!attrib.isPosition()) continue; - float[] inValues = in.fattribs.get(name); - float[] tessValues = fpolyAttribs.get(name); - PApplet.arrayCopy(inValues, 3 * i0, - tessValues, 3 * firstPolyVertex, 3 * nvert); + tessValues[index++] = x; + tessValues[index++] = y; + tessValues[index ] = z; } } } + } - if (nvert <= PGL.MIN_ARRAYCOPY_SIZE) { - for (int i = 0; i < nvert; i++) { - int inIdx = i0 + i; - int tessIdx = firstPolyVertex + i; + // Copy many vertices using arrayCopy + private void copyManyCoords(InGeometry in, int i0, int index, int nvert) { + for (int i = 0; i < nvert; i++) { + // Position data needs to be copied in batches of three, because the + // input vertices don't have a w coordinate. + int inIdx = i0 + i; + int tessIdx = firstPolyVertex + i; + PApplet.arrayCopy(in.vertices, 3 * inIdx, + polyVertices, 4 * tessIdx, 3); + polyVertices[4 * tessIdx + 3] = 1; + + for (String name: polyAttribs.keySet()) { + VertexAttribute attrib = polyAttribs.get(name); + if (!attrib.isPosition()) continue; + float[] inValues = in.fattribs.get(name); + float[] tessValues = fpolyAttribs.get(name); + PApplet.arrayCopy(inValues, 3 * inIdx, + tessValues, 4 * tessIdx, 3); + tessValues[4 * tessIdx + 3] = 1; + } + } + PApplet.arrayCopy(in.normals, 3 * i0, + polyNormals, 3 * firstPolyVertex, 3 * nvert); + for (String name: polyAttribs.keySet()) { + VertexAttribute attrib = polyAttribs.get(name); + if (!attrib.isNormal()) continue; + float[] inValues = in.fattribs.get(name); + float[] tessValues = fpolyAttribs.get(name); + PApplet.arrayCopy(inValues, 3 * i0, + tessValues, 3 * firstPolyVertex, 3 * nvert); + } + } - index = 2 * inIdx; - float u = in.texcoords[index++]; - float v = in.texcoords[index ]; + // Just copy attributes one by one. + private void copyFewAttribs(InGeometry in, int i0, int index, int nvert) { + for (int i = 0; i < nvert; i++) { + int inIdx = i0 + i; + int tessIdx = firstPolyVertex + i; - polyColors[tessIdx] = in.colors[inIdx]; + index = 2 * inIdx; + float u = in.texcoords[index++]; + float v = in.texcoords[index ]; - index = 2 * tessIdx; - polyTexCoords[index++] = u; - polyTexCoords[index ] = v; + polyColors[tessIdx] = in.colors[inIdx]; - polyAmbient[tessIdx] = in.ambient[inIdx]; - polySpecular[tessIdx] = in.specular[inIdx]; - polyEmissive[tessIdx] = in.emissive[inIdx]; - polyShininess[tessIdx] = in.shininess[inIdx]; + index = 2 * tessIdx; + polyTexCoords[index++] = u; + polyTexCoords[index ] = v; - for (String name: polyAttribs.keySet()) { - VertexAttribute attrib = polyAttribs.get(name); - if (attrib.isPosition() || attrib.isNormal()) continue; - int index0 = attrib.size * inIdx; - int index1 = attrib.size * tessIdx; - if (attrib.isFloat()) { - float[] inValues = in.fattribs.get(name); - float[] tessValues = fpolyAttribs.get(name); - for (int n = 0; n < attrib.size; n++) { - tessValues[index1++] = inValues[index0++]; - } - } else if (attrib.isInt()) { - int[] inValues = in.iattribs.get(name); - int[] tessValues = ipolyAttribs.get(name); - for (int n = 0; n < attrib.size; n++) { - tessValues[index1++] = inValues[index0++]; - } - } else if (attrib.isBool()) { - byte[] inValues = in.battribs.get(name); - byte[] tessValues = bpolyAttribs.get(name); - for (int n = 0; n < attrib.size; n++) { - tessValues[index1++] = inValues[index0++]; - } - } - } - } - } else { - PApplet.arrayCopy(in.colors, i0, - polyColors, firstPolyVertex, nvert); - PApplet.arrayCopy(in.texcoords, 2 * i0, - polyTexCoords, 2 * firstPolyVertex, 2 * nvert); - PApplet.arrayCopy(in.ambient, i0, - polyAmbient, firstPolyVertex, nvert); - PApplet.arrayCopy(in.specular, i0, - polySpecular, firstPolyVertex, nvert); - PApplet.arrayCopy(in.emissive, i0, - polyEmissive, firstPolyVertex, nvert); - PApplet.arrayCopy(in.shininess, i0, - polyShininess, firstPolyVertex, nvert); + polyAmbient[tessIdx] = in.ambient[inIdx]; + polySpecular[tessIdx] = in.specular[inIdx]; + polyEmissive[tessIdx] = in.emissive[inIdx]; + polyShininess[tessIdx] = in.shininess[inIdx]; for (String name: polyAttribs.keySet()) { VertexAttribute attrib = polyAttribs.get(name); if (attrib.isPosition() || attrib.isNormal()) continue; - Object inValues = null; - Object tessValues = null; + int index0 = attrib.size * inIdx; + int index1 = attrib.size * tessIdx; if (attrib.isFloat()) { - inValues = in.fattribs.get(name); - tessValues = fpolyAttribs.get(name); -// PApplet.println(inValues); -// PApplet.println("****************"); + float[] inValues = in.fattribs.get(name); + float[] tessValues = fpolyAttribs.get(name); + for (int n = 0; n < attrib.size; n++) { + tessValues[index1++] = inValues[index0++]; + } } else if (attrib.isInt()) { - inValues = in.iattribs.get(name); - tessValues = ipolyAttribs.get(name); + int[] inValues = in.iattribs.get(name); + int[] tessValues = ipolyAttribs.get(name); + for (int n = 0; n < attrib.size; n++) { + tessValues[index1++] = inValues[index0++]; + } } else if (attrib.isBool()) { - inValues = in.battribs.get(name); - tessValues = bpolyAttribs.get(name); + byte[] inValues = in.battribs.get(name); + byte[] tessValues = bpolyAttribs.get(name); + for (int n = 0; n < attrib.size; n++) { + tessValues[index1++] = inValues[index0++]; + } } - PApplet.arrayCopy(inValues, attrib.size * i0, - tessValues, attrib.tessSize * firstPolyVertex, - attrib.size * nvert); } } } + // Copy many attributes using arrayCopy() + private void copyManyAttribs(InGeometry in, int i0, int index, int nvert) { + PApplet.arrayCopy(in.colors, i0, + polyColors, firstPolyVertex, nvert); + PApplet.arrayCopy(in.texcoords, 2 * i0, + polyTexCoords, 2 * firstPolyVertex, 2 * nvert); + PApplet.arrayCopy(in.ambient, i0, + polyAmbient, firstPolyVertex, nvert); + PApplet.arrayCopy(in.specular, i0, + polySpecular, firstPolyVertex, nvert); + PApplet.arrayCopy(in.emissive, i0, + polyEmissive, firstPolyVertex, nvert); + PApplet.arrayCopy(in.shininess, i0, + polyShininess, firstPolyVertex, nvert); + + for (String name: polyAttribs.keySet()) { + VertexAttribute attrib = polyAttribs.get(name); + if (attrib.isPosition() || attrib.isNormal()) continue; + Object inValues = null; + Object tessValues = null; + if (attrib.isFloat()) { + inValues = in.fattribs.get(name); + tessValues = fpolyAttribs.get(name); + } else if (attrib.isInt()) { + inValues = in.iattribs.get(name); + tessValues = ipolyAttribs.get(name); + } else if (attrib.isBool()) { + inValues = in.battribs.get(name); + tessValues = bpolyAttribs.get(name); + } + PApplet.arrayCopy(inValues, attrib.size * i0, + tessValues, attrib.tessSize * firstPolyVertex, + attrib.size * nvert); + } + } + // ----------------------------------------------------------------- // // Matrix transformations @@ -10960,17 +10760,15 @@ void applyMatrixOnLineGeometry(PMatrix2D tr, int first, int last) { if (first < last) { int index; + float scaleFactor = matrixScale(tr); for (int i = first; i <= last; i++) { index = 4 * i; float x = lineVertices[index++]; float y = lineVertices[index ]; index = 4 * i; - float xa = lineDirections[index++]; - float ya = lineDirections[index ]; - - float dx = xa - x; - float dy = ya - y; + float dx = lineDirections[index++]; + float dy = lineDirections[index ]; index = 4 * i; lineVertices[index++] = x*tr.m00 + y*tr.m01 + tr.m02; @@ -10979,6 +10777,7 @@ void applyMatrixOnLineGeometry(PMatrix2D tr, int first, int last) { index = 4 * i; lineDirections[index++] = dx*tr.m00 + dy*tr.m01; lineDirections[index ] = dx*tr.m10 + dy*tr.m11; + lineDirections[index + 2] *= scaleFactor; } } } @@ -10987,6 +10786,7 @@ void applyMatrixOnPointGeometry(PMatrix2D tr, int first, int last) { if (first < last) { int index; + float matrixScale = matrixScale(tr); for (int i = first; i <= last; i++) { index = 4 * i; float x = pointVertices[index++]; @@ -10995,6 +10795,10 @@ void applyMatrixOnPointGeometry(PMatrix2D tr, int first, int last) { index = 4 * i; pointVertices[index++] = x*tr.m00 + y*tr.m01 + tr.m02; pointVertices[index ] = x*tr.m10 + y*tr.m11 + tr.m12; + + index = 2 * i; + pointOffsets[index++] *= matrixScale; + pointOffsets[index] *= matrixScale; } } } @@ -11060,6 +10864,7 @@ void applyMatrixOnLineGeometry(PMatrix3D tr, int first, int last) { if (first < last) { int index; + float scaleFactor = matrixScale(tr); for (int i = first; i <= last; i++) { index = 4 * i; float x = lineVertices[index++]; @@ -11068,13 +10873,9 @@ void applyMatrixOnLineGeometry(PMatrix3D tr, int first, int last) { float w = lineVertices[index ]; index = 4 * i; - float xa = lineDirections[index++]; - float ya = lineDirections[index++]; - float za = lineDirections[index ]; - - float dx = xa - x; - float dy = ya - y; - float dz = za - z; + float dx = lineDirections[index++]; + float dy = lineDirections[index++]; + float dz = lineDirections[index ]; index = 4 * i; lineVertices[index++] = x*tr.m00 + y*tr.m01 + z*tr.m02 + w*tr.m03; @@ -11085,7 +10886,8 @@ void applyMatrixOnLineGeometry(PMatrix3D tr, int first, int last) { index = 4 * i; lineDirections[index++] = dx*tr.m00 + dy*tr.m01 + dz*tr.m02; lineDirections[index++] = dx*tr.m10 + dy*tr.m11 + dz*tr.m12; - lineDirections[index ] = dx*tr.m20 + dy*tr.m21 + dz*tr.m22; + lineDirections[index++] = dx*tr.m20 + dy*tr.m21 + dz*tr.m22; + lineDirections[index] *= scaleFactor; } } } @@ -11094,6 +10896,7 @@ void applyMatrixOnPointGeometry(PMatrix3D tr, int first, int last) { if (first < last) { int index; + float matrixScale = matrixScale(tr); for (int i = first; i <= last; i++) { index = 4 * i; float x = pointVertices[index++]; @@ -11106,6 +10909,10 @@ void applyMatrixOnPointGeometry(PMatrix3D tr, int first, int last) { pointVertices[index++] = x*tr.m10 + y*tr.m11 + z*tr.m12 + w*tr.m13; pointVertices[index++] = x*tr.m20 + y*tr.m21 + z*tr.m22 + w*tr.m23; pointVertices[index ] = x*tr.m30 + y*tr.m31 + z*tr.m32 + w*tr.m33; + + index = 2 * i; + pointOffsets[index++] *= matrixScale; + pointOffsets[index] *= matrixScale; } } } @@ -11325,9 +11132,9 @@ void tessellateRoundPoints3D(int nvertTot, int nindTot, int nPtVert) { float inc = (float) SINCOS_LENGTH / perim; for (int k = 0; k < perim; k++) { tess.pointOffsets[2 * attribIdx + 0] = - 0.5f * cosLUT[(int) val] * strokeWeight; + 0.5f * cosLUT[(int) val] * transformScale() * strokeWeight; tess.pointOffsets[2 * attribIdx + 1] = - 0.5f * sinLUT[(int) val] * strokeWeight; + 0.5f * sinLUT[(int) val] * transformScale() * strokeWeight; val = (val + inc) % SINCOS_LENGTH; attribIdx++; } @@ -11455,9 +11262,9 @@ void tessellateSquarePoints3D(int nvertTot, int nindTot) { attribIdx++; for (int k = 0; k < 4; k++) { tess.pointOffsets[2 * attribIdx + 0] = - 0.5f * QUAD_POINT_SIGNS[k][0] * strokeWeight; + 0.5f * QUAD_POINT_SIGNS[k][0] * transformScale() * strokeWeight; tess.pointOffsets[2 * attribIdx + 1] = - 0.5f * QUAD_POINT_SIGNS[k][1] * strokeWeight; + 0.5f * QUAD_POINT_SIGNS[k][1] * transformScale() * strokeWeight; attribIdx++; } @@ -11564,16 +11371,24 @@ void tessellateLines3D(int lineCount) { // require 3 indices to specify their connectivities. int nind = lineCount * 2 * 3; + int vcount0 = tess.lineVertexCount; + int icount0 = tess.lineIndexCount; tess.lineVertexCheck(nvert); tess.lineIndexCheck(nind); int index = in.renderMode == RETAINED ? tess.lineIndexCache.addNew() : tess.lineIndexCache.getLast(); firstLineIndexCache = index; + int[] tmp = {0, 0}; + tess.lineIndexCache.setCounter(tmp); for (int ln = 0; ln < lineCount; ln++) { int i0 = 2 * ln + 0; int i1 = 2 * ln + 1; index = addLineSegment3D(i0, i1, i0 - 2, i1 - 1, index, null, false); } + // Adjust counts of line vertices and indices to exact values + tess.lineIndexCache.setCounter(null); + tess.lineIndexCount = icount0 + tmp[0]; + tess.lineVertexCount = vcount0 + tmp[1]; lastLineIndexCache = index; } @@ -11642,9 +11457,11 @@ void tessellateLineStrip() { void tessellateLineStrip3D(int lineCount) { int nBevelTr = noCapsJoins() ? 0 : (lineCount - 1); - int nvert = lineCount * 4 + nBevelTr; + int nvert = lineCount * 4 + nBevelTr * 3; int nind = lineCount * 2 * 3 + nBevelTr * 2 * 3; + int vcount0 = tess.lineVertexCount; + int icount0 = tess.lineIndexCount; tess.lineVertexCheck(nvert); tess.lineIndexCheck(nind); int index = in.renderMode == RETAINED ? tess.lineIndexCache.addNew() : @@ -11652,6 +11469,8 @@ void tessellateLineStrip3D(int lineCount) { firstLineIndexCache = index; int i0 = 0; short[] lastInd = {-1, -1}; + int[] tmp = {0, 0}; + tess.lineIndexCache.setCounter(tmp); for (int ln = 0; ln < lineCount; ln++) { int i1 = ln + 1; if (0 < nBevelTr) { @@ -11661,6 +11480,10 @@ void tessellateLineStrip3D(int lineCount) { } i0 = i1; } + // Adjust counts of line vertices and indices to exact values + tess.lineIndexCache.setCounter(null); + tess.lineIndexCount = icount0 + tmp[0]; + tess.lineVertexCount = vcount0 + tmp[1]; lastLineIndexCache = index; } @@ -11726,9 +11549,11 @@ void tessellateLineLoop() { void tessellateLineLoop3D(int lineCount) { int nBevelTr = noCapsJoins() ? 0 : lineCount; - int nvert = lineCount * 4 + nBevelTr; + int nvert = lineCount * 4 + nBevelTr * 3; int nind = lineCount * 2 * 3 + nBevelTr * 2 * 3; + int vcount0 = tess.lineVertexCount; + int icount0 = tess.lineIndexCount; tess.lineVertexCheck(nvert); tess.lineIndexCheck(nind); int index = in.renderMode == RETAINED ? tess.lineIndexCache.addNew() : @@ -11737,21 +11562,25 @@ void tessellateLineLoop3D(int lineCount) { int i0 = 0; int i1 = -1; short[] lastInd = {-1, -1}; - short firstInd = -1; + int[] tmp = {0, 0}; + tess.lineIndexCache.setCounter(tmp); for (int ln = 0; ln < lineCount - 1; ln++) { i1 = ln + 1; if (0 < nBevelTr) { index = addLineSegment3D(i0, i1, i1 - 2, i1 - 1, index, lastInd, false); - if (ln == 0) firstInd = (short)(lastInd[0] - 2); } else { index = addLineSegment3D(i0, i1, i1 - 2, i1 - 1, index, null, false); } i0 = i1; } - index = addLineSegment3D(0, in.vertexCount - 1, i1 - 2, i1 - 1, index, lastInd, false); + index = addLineSegment3D(in.vertexCount - 1, 0, i1 - 2, i1 - 1, index, lastInd, false); if (0 < nBevelTr) { - index = addBevel3D(0, 0, in.vertexCount - 1, index, lastInd, firstInd, false); + index = addBevel3D(0, 1, in.vertexCount - 1, 0, index, lastInd, false); } + // Adjust counts of line vertices and indices to exact values + tess.lineIndexCache.setCounter(null); + tess.lineIndexCount = icount0 + tmp[0]; + tess.lineVertexCount = vcount0 + tmp[1]; lastLineIndexCache = index; } @@ -11820,36 +11649,53 @@ void tessellateEdges3D() { int nInVert = in.getNumEdgeVertices(bevel); int nInInd = in.getNumEdgeIndices(bevel); + int vcount0 = tess.lineVertexCount; + int icount0 = tess.lineIndexCount; tess.lineVertexCheck(nInVert); tess.lineIndexCheck(nInInd); int index = in.renderMode == RETAINED ? tess.lineIndexCache.addNew() : tess.lineIndexCache.getLast(); firstLineIndexCache = index; + int fi0 = 0; + int fi1 = 0; short[] lastInd = {-1, -1}; - short firstInd = -1; int pi0 = -1; int pi1 = -1; + + int[] tmp = {0, 0}; + tess.lineIndexCache.setCounter(tmp); for (int i = 0; i <= in.edgeCount - 1; i++) { int[] edge = in.edges[i]; int i0 = edge[0]; int i1 = edge[1]; if (bevel) { if (edge[2] == EDGE_CLOSE) { - index = addBevel3D(edge[1], pi0, pi1, index, lastInd, firstInd, false); - lastInd[0] = lastInd[1] = -1; // No join with next line segment. + index = addBevel3D(fi0, fi1, pi0, pi1, index, lastInd, false); } else { index = addLineSegment3D(i0, i1, pi0, pi1, index, lastInd, false); - if (edge[2] == EDGE_START) firstInd = (short)(lastInd[0] - 2); - if (edge[2] == EDGE_STOP || edge[2] == EDGE_SINGLE) { - lastInd[0] = lastInd[1] = -1; // No join with next line segment. - } } } else if (edge[2] != EDGE_CLOSE) { index = addLineSegment3D(i0, i1, pi0, pi1, index, null, false); } - pi0 = i0; - pi1 = i1; + if (edge[2] == EDGE_START) { + fi0 = i0; + fi1 = i1; + } + + if (edge[2] == EDGE_STOP || edge[2] == EDGE_SINGLE || edge[2] == EDGE_CLOSE) { + // No join with next line segment. + lastInd[0] = lastInd[1] = -1; + pi1 = pi0 = -1; + } else { + pi0 = i0; + pi1 = i1; + } } + // Adjust counts of line vertices and indices to exact values + tess.lineIndexCache.setCounter(null); + tess.lineIndexCount = icount0 + tmp[0]; + tess.lineVertexCount = vcount0 + tmp[1]; + lastLineIndexCache = index; } @@ -11977,16 +11823,16 @@ int addLineSegment3D(int i0, int i1, int pi0, int pi1, int index, short[] lastIn if (-1 < lastInd[0] && -1 < lastInd[1]) { // Adding bevel triangles if (newCache) { - if (-1 < pi0 && -1 <= pi1) { + if (-1 < pi0 && -1 < pi1) { // Vertices used in the previous cache need to be copied to the // newly created one - tess.setLineVertex(vidx, strokeVertices, i0, color0); - color = constStroke ? strokeColor : strokeColors[pi0]; weight = constStroke ? strokeWeight : strokeWeights[pi0]; weight *= transformScale(); + + tess.setLineVertex(vidx++, strokeVertices, pi1, color); tess.setLineVertex(vidx++, strokeVertices, pi1, pi0, color, -weight/2); // count+2 vert from previous block - tess.setLineVertex(vidx++, strokeVertices, pi1, pi0, color, +weight/2); // count+3 vert from previous block + tess.setLineVertex(vidx, strokeVertices, pi1, pi0, color, +weight/2); // count+3 vert from previous block tess.lineIndices[iidx++] = (short) (count + 4); tess.lineIndices[iidx++] = (short) (count + 5); @@ -12011,67 +11857,63 @@ int addLineSegment3D(int i0, int i1, int pi0, int pi1, int index, short[] lastIn cache.incCounts(index, 6, 1); } - - // Vertices for next bevel - lastInd[0] = (short) (count + 2); - lastInd[1] = (short) (count + 3); } + + // The last two vertices of the segment will be used in the next + // bevel triangle + lastInd[0] = (short) (count + 2); + lastInd[1] = (short) (count + 3); } return index; } - int addBevel3D(int i0, int pi0, int pi1, int index, short[] lastInd, short firstInd, + int addBevel3D(int fi0, int fi1, int pi0 ,int pi1, int index, short[] lastInd, boolean constStroke) { IndexCache cache = tess.lineIndexCache; int count = cache.vertexCount[index]; - boolean addBevel = lastInd != null && -1 < lastInd[0] && -1 < lastInd[1]; boolean newCache = false; - if (PGL.MAX_VERTEX_INDEX1 <= count + (addBevel ? 1 : 0)) { + if (PGL.MAX_VERTEX_INDEX1 <= count + 3) { // We need to start a new index block for this line. index = cache.addNew(); count = 0; newCache = true; } + int iidx = cache.indexOffset[index] + cache.indexCount[index]; int vidx = cache.vertexOffset[index] + cache.vertexCount[index]; - int color0 = constStroke ? strokeColor : strokeColors[i0]; - - if (lastInd != null) { - if (-1 < lastInd[0] && -1 < lastInd[1]) { - tess.setLineVertex(vidx, strokeVertices, i0, color0); + int color = constStroke ? strokeColor : strokeColors[fi0]; + float weight = constStroke ? strokeWeight : strokeWeights[fi0]; + weight *= transformScale(); - if (newCache) { - if (-1 < pi0 && -1 <= pi1) { - // Vertices used in the previous cache need to be copied to the - // newly created one - int color1 = constStroke ? strokeColor : strokeColors[pi1]; + tess.setLineVertex(vidx++, strokeVertices, fi0, color); + tess.setLineVertex(vidx++, strokeVertices, fi0, fi1, color, +weight/2); + tess.setLineVertex(vidx++, strokeVertices, fi0, fi1, color, -weight/2); - tess.setLineVertex(vidx, strokeVertices, pi0, color0); - tess.setLineVertex(vidx, strokeVertices, pi1, color1); + int extra = 0; + if (newCache && -1 < pi0 && -1 < pi1) { + // Vertices used in the previous cache need to be copied to the + // newly created one + color = constStroke ? strokeColor : strokeColors[pi1]; + weight = constStroke ? strokeWeight : strokeWeights[pi1]; + weight *= transformScale(); - tess.lineIndices[iidx++] = (short) (count + 4); - tess.lineIndices[iidx++] = (short) (count + 5); - tess.lineIndices[iidx++] = (short) (count + 0); + tess.setLineVertex(vidx++, strokeVertices, pi1, pi0, color, -weight/2); + tess.setLineVertex(vidx , strokeVertices, pi1, pi0, color, +weight/2); - tess.lineIndices[iidx++] = (short) (count + 4); - tess.lineIndices[iidx++] = (short) (count + 6); - tess.lineIndices[iidx ] = (short) (count + 1); + lastInd[0] = (short) (count + 3); + lastInd[1] = (short) (count + 4); + extra = 2; + } - cache.incCounts(index, 6, 3); - } - } else { - tess.lineIndices[iidx++] = (short) (count + 0); - tess.lineIndices[iidx++] = lastInd[0]; - tess.lineIndices[iidx++] = (short) (firstInd + 0); + tess.lineIndices[iidx++] = (short) (count + 0); + tess.lineIndices[iidx++] = lastInd[0]; + tess.lineIndices[iidx++] = (short) (count + 1); - tess.lineIndices[iidx++] = (short) (count + 0); - tess.lineIndices[iidx++] = lastInd[1]; - tess.lineIndices[iidx ] = (short) (firstInd + 1); + tess.lineIndices[iidx++] = (short) (count + 0); + tess.lineIndices[iidx++] = (short) (count + 2); + tess.lineIndices[iidx ] = lastInd[1]; - cache.incCounts(index, 6, 1); - } - } - } + cache.incCounts(index, 6, 3 + extra); return index; } @@ -12212,28 +12054,7 @@ boolean noCapsJoins() { float transformScale() { if (-1 < transformScale) return transformScale; - - // Volumetric scaling factor that is associated to the current - // transformation matrix, which is given by the absolute value of its - // determinant: - float factor = 1; - - if (transform != null) { - if (transform instanceof PMatrix2D) { - PMatrix2D tr = (PMatrix2D)transform; - float areaScaleFactor = Math.abs(tr.m00 * tr.m11 - tr.m01 * tr.m10); - factor = (float) Math.sqrt(areaScaleFactor); - } else if (transform instanceof PMatrix3D) { - PMatrix3D tr = (PMatrix3D)transform; - float volumeScaleFactor = - Math.abs(tr.m00 * (tr.m11 * tr.m22 - tr.m12 * tr.m21) + - tr.m01 * (tr.m12 * tr.m20 - tr.m10 * tr.m22) + - tr.m02 * (tr.m10 * tr.m21 - tr.m11 * tr.m20)); - factor = (float) Math.pow(volumeScaleFactor, 1.0f / 3.0f); - } - } - - return transformScale = factor; + return transformScale = matrixScale(transform); } boolean segmentIsAxisAligned(int i0, int i1) { @@ -12525,7 +12346,7 @@ void splitRawIndices(boolean clamp) { IndexCache cache = tess.polyIndexCache; // In retained mode, each shape has with its own cache item, since - // they should always be available to be rendererd individually, even + // they should always be available to be rendered individually, even // if contained in a larger hierarchy. int index = in.renderMode == RETAINED ? cache.addNew() : cache.getLast(); firstPolyIndexCache = index; @@ -12627,7 +12448,7 @@ void addDupIndex(int idx) { if (dupIndices.length == dupCount) { int n = dupCount << 1; - int temp[] = new int[n]; + int[] temp = new int[n]; PApplet.arrayCopy(dupIndices, 0, temp, 0, dupCount); dupIndices = temp; } @@ -12674,7 +12495,7 @@ void setRawSize(int size) { } void expandRawIndices(int n) { - int temp[] = new int[n]; + int[] temp = new int[n]; PApplet.arrayCopy(rawIndices, 0, temp, 0, rawSize); rawIndices = temp; } @@ -12716,8 +12537,8 @@ void setLastTexIndex(int lastIndex, int lastCache) { } else { texCache.setLastIndex(lastIndex, lastCache); } + prevTexImage = newTexImage; } - prevTexImage = newTexImage; } // ----------------------------------------------------------------- @@ -13119,15 +12940,15 @@ void addStrokeVertex(float x, float y, float z, int c, float w) { if (pathVertexCount == pathVertices.length / 3) { int newSize = pathVertexCount << 1; - float vtemp[] = new float[3 * newSize]; + float[] vtemp = new float[3 * newSize]; PApplet.arrayCopy(pathVertices, 0, vtemp, 0, 3 * pathVertexCount); pathVertices = vtemp; - int ctemp[] = new int[newSize]; + int[] ctemp = new int[newSize]; PApplet.arrayCopy(pathColors, 0, ctemp, 0, pathVertexCount); pathColors = ctemp; - float wtemp[] = new float[newSize]; + float[] wtemp = new float[newSize]; PApplet.arrayCopy(pathWeights, 0, wtemp, 0, pathVertexCount); pathWeights = wtemp; } @@ -13681,9 +13502,9 @@ void sort(TessGeometry tessGeo) { testTid = activeTid + 1; } else { - // oops, we already tested this one, probably intersecting or - // interlocked in loop with others, just draw it incorrectly :( - draw = true; + // oops, we already tested this one, either in one plane or + // interlocked in loop with others, just ignore it for now :( + testTid++; } } } diff --git a/core/src/processing/opengl/PJOGL.java b/core/src/processing/opengl/PJOGL.java index 2729917703..9c057313a0 100644 --- a/core/src/processing/opengl/PJOGL.java +++ b/core/src/processing/opengl/PJOGL.java @@ -3,12 +3,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -40,11 +41,12 @@ import com.jogamp.common.util.VersionNumber; import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2; -import com.jogamp.opengl.GL2ES1; import com.jogamp.opengl.GL2ES2; import com.jogamp.opengl.GL2ES3; import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GL3ES3; import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLCapabilitiesImmutable; import com.jogamp.opengl.GLContext; import com.jogamp.opengl.GLDrawable; @@ -55,14 +57,17 @@ import processing.core.PApplet; import processing.core.PGraphics; -import processing.opengl.PGL; -import processing.opengl.PGraphicsOpenGL; +import processing.core.PMatrix3D; +import processing.core.PSurface; public class PJOGL extends PGL { // OpenGL profile to use (2, 3 or 4) public static int profile = 2; + // User-provided icons to override defaults + protected static String[] icons = null; + // The two windowing toolkits available to use in JOGL: public static final int AWT = 0; // http://jogamp.org/wiki/index.php/Using_JOGL_in_AWT_SWT_and_Swing public static final int NEWT = 1; // http://jogamp.org/jogl/doc/NEWT-Overview.html @@ -91,49 +96,6 @@ public class PJOGL extends PGL { // ........................................................ - // OS-specific configuration - - /* - protected static int WINDOW_TOOLKIT; - protected static int EVENTS_TOOLKIT; - protected static boolean USE_JOGL_FBOLAYER; - static { - if (PApplet.platform == PConstants.WINDOWS) { - // Using AWT on Windows because NEWT displays a black background while - // initializing, and the cursor functions don't work. GLWindow has some - // functions for basic cursor handling (hide/show): - // GLWindow.setPointerVisible(false); - // but apparently nothing to set the cursor icon: - // https://jogamp.org/bugzilla/show_bug.cgi?id=409 - WINDOW_TOOLKIT = AWT; - EVENTS_TOOLKIT = AWT; - USE_FBOLAYER_BY_DEFAULT = false; - USE_JOGL_FBOLAYER = false; - } else if (PApplet.platform == PConstants.MACOSX) { - // Note: The JOGL FBO layer (in 2.0.2) seems incompatible with NEWT. - WINDOW_TOOLKIT = AWT; - EVENTS_TOOLKIT = AWT; - USE_FBOLAYER_BY_DEFAULT = true; - USE_JOGL_FBOLAYER = true; - } else if (PApplet.platform == PConstants.LINUX) { - WINDOW_TOOLKIT = AWT; - EVENTS_TOOLKIT = AWT; - USE_FBOLAYER_BY_DEFAULT = false; - USE_JOGL_FBOLAYER = false; - } else if (PApplet.platform == PConstants.OTHER) { - WINDOW_TOOLKIT = NEWT; // NEWT works on the Raspberry pi? - EVENTS_TOOLKIT = NEWT; - USE_FBOLAYER_BY_DEFAULT = false; - USE_JOGL_FBOLAYER = false; - } - } -*/ - -// protected static boolean USE_FBOLAYER_BY_DEFAULT = false; -// protected static boolean USE_JOGL_FBOLAYER = false; - - // ........................................................ - // Protected JOGL-specific objects needed to access the GL profiles /** The capabilities of the OpenGL rendering surface */ @@ -152,48 +114,14 @@ public class PJOGL extends PGL { * multisampled renderbuffers) */ protected GL2 gl2x; - /** The AWT-OpenGL canvas */ -// protected GLCanvas canvasAWT; - - /** The NEWT window */ -// protected GLWindow windowNEWT; - - /** The NEWT-OpenGL canvas */ -// protected NewtCanvasAWT canvasNEWT; - - /** The listener that fires the frame rendering in Processing */ -// protected PGLListener listener; - - /** This countdown latch is used to maintain the synchronization between - * Processing's drawing thread and JOGL's rendering thread */ -// protected CountDownLatch drawLatch = new CountDownLatch(0); - - /** Flag used to do request final display() call to make sure that the - * buffers are properly swapped. - */ -// protected boolean prevCanDraw = false; + /** GL3ES3 interface */ + protected GL3ES3 gl3es3; /** Stores exceptions that ocurred during drawing */ protected Exception drawException; // ........................................................ - // JOGL's FBO-layer - - /** Back (== draw, current frame) buffer */ -// protected FBObject backFBO; - /** Sink buffer, used in the multisampled case */ -// protected FBObject sinkFBO; - /** Front (== read, previous frame) buffer */ -// protected FBObject frontFBO; -// protected FBObject.TextureAttachment backTexAttach; -// protected FBObject.TextureAttachment frontTexAttach; - -// protected boolean changedFrontTex = false; -// protected boolean changedBackTex = false; - - // ........................................................ - // Utility arrays to copy projection/modelview matrices to GL protected float[] projMatrix; @@ -221,288 +149,66 @@ public PJOGL(PGraphicsOpenGL pg) { } - /* @Override - public Canvas getCanvas() { - return canvas; - } -*/ - - - protected void setFps(float fps) { - if (!setFps || targetFps != fps) { - if (60 < fps) { - // Disables v-sync - gl.setSwapInterval(0); - } else if (30 < fps) { - gl.setSwapInterval(1); - } else { - gl.setSwapInterval(2); - } - targetFps = currentFps = fps; - setFps = true; - } + public Object getNative() { + return sketch.getSurface().getNative(); } - /* - @Override - protected void initSurface(int antialias) { - - if (profile == null) { - if (PROFILE == 2) { - try { - profile = GLProfile.getGL2ES1(); - } catch (GLException ex) { - profile = GLProfile.getMaxFixedFunc(true); - } - } else if (PROFILE == 3) { - try { - profile = GLProfile.getGL2GL3(); - } catch (GLException ex) { - profile = GLProfile.getMaxProgrammable(true); - } - if (!profile.isGL3()) { - PGraphics.showWarning("Requested profile GL3 but is not available, got: " + profile); - } - } else if (PROFILE == 4) { - try { - profile = GLProfile.getGL4ES3(); - } catch (GLException ex) { - profile = GLProfile.getMaxProgrammable(true); - } - if (!profile.isGL4()) { - PGraphics.showWarning("Requested profile GL4 but is not available, got: " + profile); - } - } else throw new RuntimeException(UNSUPPORTED_GLPROF_ERROR); - - if (2 < PROFILE) { - texVertShaderSource = convertVertexSource(texVertShaderSource, 120, 150); - tex2DFragShaderSource = convertFragmentSource(tex2DFragShaderSource, 120, 150); - texRectFragShaderSource = convertFragmentSource(texRectFragShaderSource, 120, 150); - } - } - - if (canvasAWT != null || canvasNEWT != null) { - // Restarting... - if (canvasAWT != null) { - canvasAWT.removeGLEventListener(listener); - pg.parent.removeListeners(canvasAWT); - pg.parent.remove(canvasAWT); - } else if (canvasNEWT != null) { - windowNEWT.removeGLEventListener(listener); - pg.parent.remove(canvasNEWT); - } - sinkFBO = backFBO = frontFBO = null; - } + @Override + protected void setFrameRate(float fps) {} - // Setting up the desired capabilities; - GLCapabilities caps = new GLCapabilities(profile); - caps.setAlphaBits(REQUESTED_ALPHA_BITS); - caps.setDepthBits(REQUESTED_DEPTH_BITS); - caps.setStencilBits(REQUESTED_STENCIL_BITS); - - caps.setBackgroundOpaque(true); - caps.setOnscreen(true); - if (USE_FBOLAYER_BY_DEFAULT) { - if (USE_JOGL_FBOLAYER) { - caps.setPBuffer(false); - caps.setFBO(true); - if (1 < antialias) { - caps.setSampleBuffers(true); - caps.setNumSamples(antialias); - } else { - caps.setSampleBuffers(false); - } - fboLayerRequested = false; - } else { - caps.setPBuffer(false); - caps.setFBO(false); - caps.setSampleBuffers(false); - fboLayerRequested = 1 < antialias; - } - } else { - if (1 < antialias) { - caps.setSampleBuffers(true); - caps.setNumSamples(antialias); - } else { - caps.setSampleBuffers(false); - } - fboLayerRequested = false; - } - caps.setDepthBits(REQUESTED_DEPTH_BITS); - caps.setStencilBits(REQUESTED_STENCIL_BITS); - caps.setAlphaBits(REQUESTED_ALPHA_BITS); - reqNumSamples = qualityToSamples(antialias); - - if (WINDOW_TOOLKIT == AWT) { - canvasAWT = new GLCanvas(caps); - - if (RETINA) { - canvasAWT.setSurfaceScale(new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, - ScalableSurface.AUTOMAX_PIXELSCALE }); - retf = 2; - } else { - canvasAWT.setSurfaceScale(new int[] { ScalableSurface.IDENTITY_PIXELSCALE, - ScalableSurface.IDENTITY_PIXELSCALE }); - } - canvasAWT.setBounds(0, 0, pg.width, pg.height); - canvasAWT.setBackground(new Color(pg.backgroundColor, true)); - canvasAWT.setFocusable(true); + @Override + protected void initSurface(int antialias) {} - pg.parent.setLayout(new BorderLayout()); - pg.parent.add(canvasAWT, BorderLayout.CENTER); - canvasAWT.requestFocusInWindow(); + @Override + protected void reinitSurface() {} - canvas = canvasAWT; - canvasNEWT = null; - } else if (WINDOW_TOOLKIT == NEWT) { - windowNEWT = GLWindow.create(caps); - canvasNEWT = new NewtCanvasAWT(windowNEWT); - canvasNEWT.setBounds(0, 0, pg.width, pg.height); - canvasNEWT.setBackground(new Color(pg.backgroundColor, true)); - canvasNEWT.setFocusable(true); + @Override + protected void registerListeners() {} - pg.parent.setLayout(new BorderLayout()); - pg.parent.add(canvasNEWT, BorderLayout.CENTER); - canvasNEWT.requestFocusInWindow(); - int[] reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; - windowNEWT.setSurfaceScale(reqSurfacePixelScale); + static public void setIcon(String... icons) { + PJOGL.icons = new String[icons.length]; + PApplet.arrayCopy(icons, PJOGL.icons); + } - canvas = canvasNEWT; - canvasAWT = null; - } - pg.parent.defaultSize = false; - registerListeners(); + /////////////////////////////////////////////////////////////// + // Public methods to get/set renderer's properties - fboLayerCreated = false; - fboLayerInUse = false; - firstFrame = true; - setFps = false; - } - */ -/* - @Override - protected void reinitSurface() { - sinkFBO = backFBO = frontFBO = null; - fboLayerCreated = false; - fboLayerInUse = false; - firstFrame = true; - pg.parent.defaultSize = false; + public void setCaps(GLCapabilities caps) { + reqNumSamples = caps.getNumSamples(); + capabilities = caps; } -*/ -// @Override -// protected void registerListeners() { -// if (WINDOW_TOOLKIT == AWT) { -// pg.parent.addListeners(canvasAWT); -// -// listener = new PGLListener(); -// canvasAWT.addGLEventListener(listener); -// } else if (WINDOW_TOOLKIT == NEWT) { -// if (EVENTS_TOOLKIT == NEWT) { -// NEWTMouseListener mouseListener = new NEWTMouseListener(); -// windowNEWT.addMouseListener(mouseListener); -// NEWTKeyListener keyListener = new NEWTKeyListener(); -// windowNEWT.addKeyListener(keyListener); -// NEWTWindowListener winListener = new NEWTWindowListener(); -// windowNEWT.addWindowListener(winListener); -// } else if (EVENTS_TOOLKIT == AWT) { -// pg.parent.addListeners(canvasNEWT); -// } -// -// listener = new PGLListener(); -// windowNEWT.addGLEventListener(listener); -// } -// -// if (canvas != null) { -// canvas.setFocusTraversalKeysEnabled(false); -// } -// } - - -// @Override -// protected void deleteSurface() { -// super.deleteSurface(); -// -// if (canvasAWT != null) { -// canvasAWT.removeGLEventListener(listener); -// pg.parent.removeListeners(canvasAWT); -// } else if (canvasNEWT != null) { -// windowNEWT.removeGLEventListener(listener); -// } -// } -/* - @Override - protected int getReadFramebuffer() { - if (fboLayerInUse) { - return glColorFbo.get(0); - } else if (capabilities.isFBO()) { - return context.getDefaultReadFramebuffer(); - } else { - return 0; - } + public GLCapabilitiesImmutable getCaps() { + return capabilities; } - @Override - protected int getDrawFramebuffer() { - if (fboLayerInUse) { - if (1 < numSamples) { - return glMultiFbo.get(0); + public void setFps(float fps) { + if (!setFps || targetFps != fps) { + if (60 < fps) { + // Disables v-sync + gl.setSwapInterval(0); + } else if (30 < fps) { + gl.setSwapInterval(1); } else { - return glColorFbo.get(0); + gl.setSwapInterval(2); } - } else if (capabilities.isFBO()) { - return context.getDefaultDrawFramebuffer(); - } else { - return 0; - } - } - - - @Override - protected int getDefaultDrawBuffer() { - if (fboLayerInUse) { - return COLOR_ATTACHMENT0; - } else if (capabilities.isFBO()) { - return GL.GL_COLOR_ATTACHMENT0; - } else if (capabilities.getDoubleBuffered()) { - return GL.GL_BACK; - } else { - return GL.GL_FRONT; - } - } - - - @Override - protected int getDefaultReadBuffer() { - if (fboLayerInUse) { - return COLOR_ATTACHMENT0; - } else if (capabilities.isFBO()) { - return GL.GL_COLOR_ATTACHMENT0; - } else if (capabilities.getDoubleBuffered()) { - return GL.GL_BACK; - } else { - return GL.GL_FRONT; + targetFps = currentFps = fps; + setFps = true; } } - @Override - protected boolean isFBOBacked() { - return super.isFBOBacked() || capabilities.isFBO(); - } -*/ - @Override protected int getDepthBits() { return capabilities.getDepthBits(); @@ -513,135 +219,21 @@ protected int getDepthBits() { protected int getStencilBits() { return capabilities.getStencilBits(); } -/* - - @Override - protected Texture wrapBackTexture(Texture texture) { - if (texture == null || changedBackTex) { - if (USE_JOGL_FBOLAYER) { - texture = new Texture(pg); - texture.init(pg.width, pg.height, - backTexAttach.getName(), TEXTURE_2D, RGBA, - backTexAttach.getWidth(), backTexAttach.getHeight(), - backTexAttach.minFilter, backTexAttach.magFilter, - backTexAttach.wrapS, backTexAttach.wrapT); - texture.invertedY(true); - texture.colorBuffer(true); - pg.setCache(pg, texture); - } else { - texture = super.wrapBackTexture(null); - } - } else { - if (USE_JOGL_FBOLAYER) { - texture.glName = backTexAttach.getName(); - } else { - texture = super.wrapBackTexture(texture); - } - } - return texture; - } @Override - protected Texture wrapFrontTexture(Texture texture) { - if (texture == null || changedFrontTex) { - if (USE_JOGL_FBOLAYER) { - texture = new Texture(pg); - texture.init(pg.width, pg.height, - backTexAttach.getName(), TEXTURE_2D, RGBA, - frontTexAttach.getWidth(), frontTexAttach.getHeight(), - frontTexAttach.minFilter, frontTexAttach.magFilter, - frontTexAttach.wrapS, frontTexAttach.wrapT); - texture.invertedY(true); - texture.colorBuffer(true); - } else { - texture = super.wrapFrontTexture(null); - } + protected float getPixelScale() { + PSurface surf = sketch.getSurface(); + if (surf == null) { + return graphics.pixelDensity; + } else if (surf instanceof PSurfaceJOGL) { + return ((PSurfaceJOGL)surf).getPixelScale(); } else { - if (USE_JOGL_FBOLAYER) { - texture.glName = frontTexAttach.getName(); - } else { - texture = super.wrapFrontTexture(texture); - } + throw new RuntimeException("Renderer cannot find a JOGL surface"); } - return texture; - } - - - @Override - protected void bindFrontTexture() { - if (USE_JOGL_FBOLAYER) { - usingFrontTex = true; - if (!texturingIsEnabled(TEXTURE_2D)) { - enableTexturing(TEXTURE_2D); - } - bindTexture(TEXTURE_2D, frontTexAttach.getName()); - } else super.bindFrontTexture(); - } - - - @Override - protected void unbindFrontTexture() { - if (USE_JOGL_FBOLAYER) { - if (textureIsBound(TEXTURE_2D, frontTexAttach.getName())) { - // We don't want to unbind another texture - // that might be bound instead of this one. - if (!texturingIsEnabled(TEXTURE_2D)) { - enableTexturing(TEXTURE_2D); - bindTexture(TEXTURE_2D, 0); - disableTexturing(TEXTURE_2D); - } else { - bindTexture(TEXTURE_2D, 0); - } - } - } else super.unbindFrontTexture(); - } - - - @Override - protected void syncBackTexture() { - if (USE_JOGL_FBOLAYER) { - if (usingFrontTex) needSepFrontTex = true; - if (1 < numSamples && backFBO != null) { - backFBO.syncSamplingSink(gl); - backFBO.bind(gl); - } - } else super.syncBackTexture(); } - @Override - protected void beginDraw(boolean clear0) { - if (!setFps) setFps(targetFps); - if (USE_JOGL_FBOLAYER) return; - super.beginDraw(clear0); - } - - - @Override - protected void endDraw(boolean clear0) { - if (isFBOBacked()) { - if (USE_JOGL_FBOLAYER) { - if (!clear0 && isFBOBacked() && !isMultisampled() && - frontFBO != null && backFBO != null) { - // Draw the back texture into the front texture, which will be used as - // back texture in the next frame. Otherwise flickering will occur if - // the sketch uses "incremental drawing" (background() not called). - frontFBO.bind(gl); - gl.glDisable(GL.GL_BLEND); - drawTexture(TEXTURE_2D, backTexAttach.getName(), - backTexAttach.getWidth(), backTexAttach.getHeight(), - pg.width, pg.height, - 0, 0, pg.width, pg.height, 0, 0, pg.width, pg.height); - backFBO.bind(gl); - } - } else { - super.endDraw(clear0); - } - } - } -*/ - @Override protected void getGL(PGL pgl) { PJOGL pjogl = (PJOGL)pgl; @@ -655,10 +247,11 @@ protected void getGL(PGL pgl) { this.gl2 = pjogl.gl2; this.gl2x = pjogl.gl2x; this.gl3 = pjogl.gl3; + this.gl3es3 = pjogl.gl3es3; } - protected void getGL(GLAutoDrawable glDrawable) { + public void getGL(GLAutoDrawable glDrawable) { context = glDrawable.getContext(); glContext = context.hashCode(); setThread(Thread.currentThread()); @@ -675,113 +268,141 @@ protected void getGL(GLAutoDrawable glDrawable) { } catch (com.jogamp.opengl.GLException e) { gl3 = null; } + try { + gl3es3 = gl.getGL3ES3(); + } catch (com.jogamp.opengl.GLException e) { + gl3es3 = null; + } } + @Override + protected boolean canDraw() { return true; } + - /* @Override - protected boolean canDraw() { - return true; -// return pg.initialized; -// && pg.parent.isDisplayable(); - } + protected void requestFocus() {} @Override - protected void requestFocus() { } + protected void requestDraw() {} @Override - protected void requestDraw() { + protected void swapBuffers() { + PSurfaceJOGL surf = (PSurfaceJOGL)sketch.getSurface(); + surf.window.swapBuffers(); + } - drawException = null; - boolean canDraw = pg.parent.canDraw(); - if (pg.initialized && (canDraw || prevCanDraw)) { - drawLatch = new CountDownLatch(1); - if (WINDOW_TOOLKIT == AWT) { - canvasAWT.display(); - } else if (WINDOW_TOOLKIT == NEWT) { - windowNEWT.display(); - } - try { - drawLatch.await(DRAW_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); - } catch (InterruptedException e) { - e.printStackTrace(); - } - if (canDraw) prevCanDraw = true; - else prevCanDraw = false; + @Override + protected void initFBOLayer() { + if (0 < sketch.frameCount) { + if (isES()) initFBOLayerES(); + else initFBOLayerGL(); } + } - // Throw wherever exception happened during drawing outside the GL thread - // to it is properly picked up by the PDE. - if (drawException != null) { - if (drawException instanceof RuntimeException) { - throw (RuntimeException)drawException; - } else { - throw new RuntimeException(drawException); - } - } + + private void initFBOLayerES() { + IntBuffer buf = allocateDirectIntBuffer(fboWidth * fboHeight); + + if (hasReadBuffer()) readBuffer(BACK); + readPixelsImpl(0, 0, fboWidth, fboHeight, RGBA, UNSIGNED_BYTE, buf); + bindTexture(TEXTURE_2D, glColorTex.get(frontTex)); + texSubImage2D(TEXTURE_2D, 0, 0, 0, fboWidth, fboHeight, RGBA, UNSIGNED_BYTE, buf); + + bindTexture(TEXTURE_2D, glColorTex.get(backTex)); + texSubImage2D(TEXTURE_2D, 0, 0, 0, fboWidth, fboHeight, RGBA, UNSIGNED_BYTE, buf); + + bindTexture(TEXTURE_2D, 0); + bindFramebufferImpl(FRAMEBUFFER, 0); } - @Override - protected void swapBuffers() { - if (WINDOW_TOOLKIT == AWT) { - canvasAWT.swapBuffers(); - } else if (WINDOW_TOOLKIT == NEWT) { - windowNEWT.swapBuffers(); + private void initFBOLayerGL() { + // Copy the contents of the front and back screen buffers to the textures + // of the FBO, so they are properly initialized. Note that the front buffer + // of the default framebuffer (the screen) contains the previous frame: + // https://www.opengl.org/wiki/Default_Framebuffer + // so it is copied to the front texture of the FBO layer: + if (pclearColor || 0 < pgeomCount || !sketch.isLooping()) { + if (hasReadBuffer()) readBuffer(FRONT); + } else { + // ...except when the previous frame has not been cleared and nothing was + // rendered while looping. In this case the back buffer, which holds the + // initial state of the previous frame, still contains the most up-to-date + // screen state. + readBuffer(BACK); } + bindFramebufferImpl(DRAW_FRAMEBUFFER, glColorFbo.get(0)); + framebufferTexture2D(FRAMEBUFFER, COLOR_ATTACHMENT0, + TEXTURE_2D, glColorTex.get(frontTex), 0); + if (hasDrawBuffer()) drawBuffer(COLOR_ATTACHMENT0); + blitFramebuffer(0, 0, fboWidth, fboHeight, + 0, 0, fboWidth, fboHeight, + COLOR_BUFFER_BIT, NEAREST); + + readBuffer(BACK); + bindFramebufferImpl(DRAW_FRAMEBUFFER, glColorFbo.get(0)); + framebufferTexture2D(FRAMEBUFFER, COLOR_ATTACHMENT0, + TEXTURE_2D, glColorTex.get(backTex), 0); + drawBuffer(COLOR_ATTACHMENT0); + blitFramebuffer(0, 0, fboWidth, fboHeight, + 0, 0, fboWidth, fboHeight, + COLOR_BUFFER_BIT, NEAREST); + + bindFramebufferImpl(FRAMEBUFFER, 0); } - */ @Override protected void beginGL() { + PMatrix3D proj = graphics.projection; + PMatrix3D mdl = graphics.modelview; if (gl2x != null) { if (projMatrix == null) { projMatrix = new float[16]; } gl2x.glMatrixMode(GLMatrixFunc.GL_PROJECTION); - projMatrix[ 0] = pg.projection.m00; - projMatrix[ 1] = pg.projection.m10; - projMatrix[ 2] = pg.projection.m20; - projMatrix[ 3] = pg.projection.m30; - projMatrix[ 4] = pg.projection.m01; - projMatrix[ 5] = pg.projection.m11; - projMatrix[ 6] = pg.projection.m21; - projMatrix[ 7] = pg.projection.m31; - projMatrix[ 8] = pg.projection.m02; - projMatrix[ 9] = pg.projection.m12; - projMatrix[10] = pg.projection.m22; - projMatrix[11] = pg.projection.m32; - projMatrix[12] = pg.projection.m03; - projMatrix[13] = pg.projection.m13; - projMatrix[14] = pg.projection.m23; - projMatrix[15] = pg.projection.m33; + projMatrix[ 0] = proj.m00; + projMatrix[ 1] = proj.m10; + projMatrix[ 2] = proj.m20; + projMatrix[ 3] = proj.m30; + projMatrix[ 4] = proj.m01; + projMatrix[ 5] = proj.m11; + projMatrix[ 6] = proj.m21; + projMatrix[ 7] = proj.m31; + projMatrix[ 8] = proj.m02; + projMatrix[ 9] = proj.m12; + projMatrix[10] = proj.m22; + projMatrix[11] = proj.m32; + projMatrix[12] = proj.m03; + projMatrix[13] = proj.m13; + projMatrix[14] = proj.m23; + projMatrix[15] = proj.m33; gl2x.glLoadMatrixf(projMatrix, 0); if (mvMatrix == null) { mvMatrix = new float[16]; } gl2x.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); - mvMatrix[ 0] = pg.modelview.m00; - mvMatrix[ 1] = pg.modelview.m10; - mvMatrix[ 2] = pg.modelview.m20; - mvMatrix[ 3] = pg.modelview.m30; - mvMatrix[ 4] = pg.modelview.m01; - mvMatrix[ 5] = pg.modelview.m11; - mvMatrix[ 6] = pg.modelview.m21; - mvMatrix[ 7] = pg.modelview.m31; - mvMatrix[ 8] = pg.modelview.m02; - mvMatrix[ 9] = pg.modelview.m12; - mvMatrix[10] = pg.modelview.m22; - mvMatrix[11] = pg.modelview.m32; - mvMatrix[12] = pg.modelview.m03; - mvMatrix[13] = pg.modelview.m13; - mvMatrix[14] = pg.modelview.m23; - mvMatrix[15] = pg.modelview.m33; + mvMatrix[ 0] = mdl.m00; + mvMatrix[ 1] = mdl.m10; + mvMatrix[ 2] = mdl.m20; + mvMatrix[ 3] = mdl.m30; + mvMatrix[ 4] = mdl.m01; + mvMatrix[ 5] = mdl.m11; + mvMatrix[ 6] = mdl.m21; + mvMatrix[ 7] = mdl.m31; + mvMatrix[ 8] = mdl.m02; + mvMatrix[ 9] = mdl.m12; + mvMatrix[10] = mdl.m22; + mvMatrix[11] = mdl.m32; + mvMatrix[12] = mdl.m03; + mvMatrix[13] = mdl.m13; + mvMatrix[14] = mdl.m23; + mvMatrix[15] = mdl.m33; gl2x.glLoadMatrixf(mvMatrix, 0); } } @@ -801,74 +422,7 @@ protected boolean hasShaders() { } - /////////////////////////////////////////////////////////// - - // JOGL event listeners - -/* - protected void getBuffers(GLWindow glWindow) { - if (false) { -// if (capabilities.isFBO()) { -// if (USE_JOGL_FBOLAYER && capabilities.isFBO()) { - // The onscreen drawing surface is backed by an FBO layer. - GLFBODrawable fboDrawable = null; - fboDrawable = (GLFBODrawable)glWindow.getDelegatedDrawable(); - - if (fboDrawable != null) { - backFBO = fboDrawable.getFBObject(GL.GL_BACK); - if (1 < numSamples) { - if (needSepFrontTex) { - // When using multisampled FBO, the back buffer is the MSAA - // surface so it cannot be read from. The sink buffer contains - // the readable 2D texture. - // In this case, we create an auxiliary "front" buffer that it is - // swapped with the sink buffer at the beginning of each frame. - // In this way, we always have a readable copy of the previous - // frame in the front texture, while the back is synchronized - // with the contents of the MSAA back buffer when requested. - if (frontFBO == null) { - // init - frontFBO = new FBObject(); - frontFBO.reset(gl, pg.width, pg.height, numSamples); - frontFBO.attachTexture2D(gl, 0, true); - sinkFBO = backFBO.getSamplingSinkFBO(); - changedFrontTex = changedBackTex = true; - } else { - // swap - FBObject temp = sinkFBO; - sinkFBO = frontFBO; - frontFBO = temp; - backFBO.setSamplingSink(sinkFBO); - changedFrontTex = changedBackTex = false; - } - backTexAttach = (FBObject.TextureAttachment) sinkFBO. - getColorbuffer(0); - frontTexAttach = (FBObject.TextureAttachment)frontFBO. - getColorbuffer(0); - } else { - changedFrontTex = changedBackTex = sinkFBO == null; - - // Default setting (to save resources): the front and back - // textures are the same. - sinkFBO = backFBO.getSamplingSinkFBO(); - backTexAttach = (FBObject.TextureAttachment) sinkFBO. - getColorbuffer(0); - frontTexAttach = backTexAttach; - } - } else { - // w/out multisampling, rendering is done on the back buffer. - frontFBO = fboDrawable.getFBObject(GL.GL_FRONT); - backTexAttach = (FBObject.TextureAttachment) backFBO.getColorbuffer(0); - frontTexAttach = (FBObject.TextureAttachment) frontFBO.getColorbuffer(0); - } - } - - } - } -*/ - - protected void init(GLAutoDrawable glDrawable) { - firstFrame = true; + public void init(GLAutoDrawable glDrawable) { capabilities = glDrawable.getChosenGLCapabilities(); if (!hasFBOs()) { throw new RuntimeException(MISSING_FBO_ERROR); @@ -876,296 +430,8 @@ protected void init(GLAutoDrawable glDrawable) { if (!hasShaders()) { throw new RuntimeException(MISSING_GLSL_ERROR); } -// if (USE_JOGL_FBOLAYER && capabilities.isFBO()) { -// int maxs = maxSamples(); -// numSamples = PApplet.min(capabilities.getNumSamples(), maxs); -// } - } - - /* - protected class PGLListener implements GLEventListener { - public PGLListener() {} - - @Override - public void display(GLAutoDrawable glDrawable) { - - getGL(glDrawable); - - if (USE_JOGL_FBOLAYER && capabilities.isFBO()) { - // The onscreen drawing surface is backed by an FBO layer. - GLFBODrawable fboDrawable = null; - - if (WINDOW_TOOLKIT == AWT) { - GLCanvas glCanvas = (GLCanvas)glDrawable; - fboDrawable = (GLFBODrawable)glCanvas.getDelegatedDrawable(); - } else { - GLWindow glWindow = (GLWindow)glDrawable; - fboDrawable = (GLFBODrawable)glWindow.getDelegatedDrawable(); - } - - if (fboDrawable != null) { - backFBO = fboDrawable.getFBObject(GL.GL_BACK); - if (1 < numSamples) { - if (needSepFrontTex) { - // When using multisampled FBO, the back buffer is the MSAA - // surface so it cannot be read from. The sink buffer contains - // the readable 2D texture. - // In this case, we create an auxiliary "front" buffer that it is - // swapped with the sink buffer at the beginning of each frame. - // In this way, we always have a readable copy of the previous - // frame in the front texture, while the back is synchronized - // with the contents of the MSAA back buffer when requested. - if (frontFBO == null) { - // init - frontFBO = new FBObject(); - frontFBO.reset(gl, pg.width, pg.height, numSamples); - frontFBO.attachTexture2D(gl, 0, true); - sinkFBO = backFBO.getSamplingSinkFBO(); - changedFrontTex = changedBackTex = true; - } else { - // swap - FBObject temp = sinkFBO; - sinkFBO = frontFBO; - frontFBO = temp; - backFBO.setSamplingSink(sinkFBO); - changedFrontTex = changedBackTex = false; - } - backTexAttach = (FBObject.TextureAttachment) sinkFBO. - getColorbuffer(0); - frontTexAttach = (FBObject.TextureAttachment)frontFBO. - getColorbuffer(0); - } else { - changedFrontTex = changedBackTex = sinkFBO == null; - - // Default setting (to save resources): the front and back - // textures are the same. - sinkFBO = backFBO.getSamplingSinkFBO(); - backTexAttach = (FBObject.TextureAttachment) sinkFBO. - getColorbuffer(0); - frontTexAttach = backTexAttach; - } - } else { - // w/out multisampling, rendering is done on the back buffer. - frontFBO = fboDrawable.getFBObject(GL.GL_FRONT); - backTexAttach = (FBObject.TextureAttachment) backFBO.getColorbuffer(0); - frontTexAttach = (FBObject.TextureAttachment) frontFBO.getColorbuffer(0); - } - } - } - - try { - pg.parent.handleDraw(); - } catch (Exception ex) { - drawException = ex; - } - drawLatch.countDown(); - } - - @Override - public void dispose(GLAutoDrawable adrawable) { - } - - @Override - public void init(GLAutoDrawable glDrawable) { - getGL(glDrawable); - - capabilities = glDrawable.getChosenGLCapabilities(); - if (!hasFBOs()) { - throw new RuntimeException(MISSING_FBO_ERROR); - } - if (!hasShaders()) { - throw new RuntimeException(MISSING_GLSL_ERROR); - } - if (USE_JOGL_FBOLAYER && capabilities.isFBO()) { - int maxs = maxSamples(); - numSamples = PApplet.min(capabilities.getNumSamples(), maxs); - } - } - - @Override - public void reshape(GLAutoDrawable glDrawable, int x, int y, int w, int h) { - //getGL(glDrawable); - } - -// private void getGL(GLAutoDrawable glDrawable) { -// drawable = glDrawable; -// context = glDrawable.getContext(); -// glContext = context.hashCode(); -// glThread = Thread.currentThread(); -// -// gl = context.getGL(); -// gl2 = gl.getGL2ES2(); -// try { -// gl2x = gl.getGL2(); -// } catch (javax.media.opengl.GLException e) { -// gl2x = null; -// } -// try { -// gl3 = gl.getGL2GL3(); -// } catch (javax.media.opengl.GLException e) { -// gl3 = null; -// } -// } - } - */ - - /* - protected void nativeMouseEvent(com.jogamp.newt.event.MouseEvent nativeEvent, - int peAction) { - int modifiers = nativeEvent.getModifiers(); - int peModifiers = modifiers & - (InputEvent.SHIFT_MASK | - InputEvent.CTRL_MASK | - InputEvent.META_MASK | - InputEvent.ALT_MASK); - - int peButton = 0; - if ((modifiers & InputEvent.BUTTON1_MASK) != 0) { - peButton = PConstants.LEFT; - } else if ((modifiers & InputEvent.BUTTON2_MASK) != 0) { - peButton = PConstants.CENTER; - } else if ((modifiers & InputEvent.BUTTON3_MASK) != 0) { - peButton = PConstants.RIGHT; - } - - if (PApplet.platform == PConstants.MACOSX) { - //if (nativeEvent.isPopupTrigger()) { - if ((modifiers & InputEvent.CTRL_MASK) != 0) { - peButton = PConstants.RIGHT; - } - } - - int peCount = 0; - if (peAction == MouseEvent.WHEEL) { - peCount = nativeEvent.isShiftDown() ? (int)nativeEvent.getRotation()[0] : - (int)nativeEvent.getRotation()[1]; - } else { - peCount = nativeEvent.getClickCount(); - } - - MouseEvent me = new MouseEvent(nativeEvent, nativeEvent.getWhen(), - peAction, peModifiers, - nativeEvent.getX(), nativeEvent.getY(), - peButton, - peCount); - - pg.parent.postEvent(me); - } - - protected void nativeKeyEvent(com.jogamp.newt.event.KeyEvent nativeEvent, - int peAction) { - int peModifiers = nativeEvent.getModifiers() & - (InputEvent.SHIFT_MASK | - InputEvent.CTRL_MASK | - InputEvent.META_MASK | - InputEvent.ALT_MASK); - - char keyChar; - if (nativeEvent.getKeyChar() == 0) { - keyChar = PConstants.CODED; - } else { - keyChar = nativeEvent.getKeyChar(); - } - - KeyEvent ke = new KeyEvent(nativeEvent, nativeEvent.getWhen(), - peAction, peModifiers, - keyChar, - nativeEvent.getKeyCode()); - - pg.parent.postEvent(ke); - } - - protected class NEWTWindowListener implements com.jogamp.newt.event.WindowListener { - public NEWTWindowListener() { - super(); - } - @Override - public void windowGainedFocus(com.jogamp.newt.event.WindowEvent arg0) { - pg.parent.focusGained(null); - } - - @Override - public void windowLostFocus(com.jogamp.newt.event.WindowEvent arg0) { - pg.parent.focusLost(null); - } - - @Override - public void windowDestroyNotify(com.jogamp.newt.event.WindowEvent arg0) { - } - - @Override - public void windowDestroyed(com.jogamp.newt.event.WindowEvent arg0) { - } - - @Override - public void windowMoved(com.jogamp.newt.event.WindowEvent arg0) { - } - - @Override - public void windowRepaint(com.jogamp.newt.event.WindowUpdateEvent arg0) { - } - - @Override - public void windowResized(com.jogamp.newt.event.WindowEvent arg0) { } } - // NEWT mouse listener - protected class NEWTMouseListener extends com.jogamp.newt.event.MouseAdapter { - public NEWTMouseListener() { - super(); - } - @Override - public void mousePressed(com.jogamp.newt.event.MouseEvent e) { - nativeMouseEvent(e, MouseEvent.PRESS); - } - @Override - public void mouseReleased(com.jogamp.newt.event.MouseEvent e) { - nativeMouseEvent(e, MouseEvent.RELEASE); - } - @Override - public void mouseClicked(com.jogamp.newt.event.MouseEvent e) { - nativeMouseEvent(e, MouseEvent.CLICK); - } - @Override - public void mouseDragged(com.jogamp.newt.event.MouseEvent e) { - nativeMouseEvent(e, MouseEvent.DRAG); - } - @Override - public void mouseMoved(com.jogamp.newt.event.MouseEvent e) { - nativeMouseEvent(e, MouseEvent.MOVE); - } - @Override - public void mouseWheelMoved(com.jogamp.newt.event.MouseEvent e) { - nativeMouseEvent(e, MouseEvent.WHEEL); - } - @Override - public void mouseEntered(com.jogamp.newt.event.MouseEvent e) { - nativeMouseEvent(e, MouseEvent.ENTER); - } - @Override - public void mouseExited(com.jogamp.newt.event.MouseEvent e) { - nativeMouseEvent(e, MouseEvent.EXIT); - } - } - - // NEWT key listener - protected class NEWTKeyListener extends com.jogamp.newt.event.KeyAdapter { - public NEWTKeyListener() { - super(); - } - @Override - public void keyPressed(com.jogamp.newt.event.KeyEvent e) { - nativeKeyEvent(e, KeyEvent.PRESS); - } - @Override - public void keyReleased(com.jogamp.newt.event.KeyEvent e) { - nativeKeyEvent(e, KeyEvent.RELEASE); - } - public void keyTyped(com.jogamp.newt.event.KeyEvent e) { - nativeKeyEvent(e, KeyEvent.TYPE); - } - } -*/ /////////////////////////////////////////////////////////// @@ -1237,6 +503,7 @@ protected Object getDerivedFont(Object font, float size) { return ((Font) font).deriveFont(size); } + @Override protected int getGLSLVersion() { VersionNumber vn = context.getGLSLVersionNumber(); @@ -1244,49 +511,60 @@ protected int getGLSLVersion() { } + @Override + protected String getGLSLVersionSuffix() { + VersionNumber vn = context.getGLSLVersionNumber(); + if (context.isGLESProfile() && 1 < vn.getMajor()) { + return " es"; + } else { + return ""; + } + } + + @Override protected String[] loadVertexShader(String filename) { - return loadVertexShader(filename, getGLSLVersion()); + return loadVertexShader(filename, getGLSLVersion(), getGLSLVersionSuffix()); } @Override protected String[] loadFragmentShader(String filename) { - return loadFragmentShader(filename, getGLSLVersion()); + return loadFragmentShader(filename, getGLSLVersion(), getGLSLVersionSuffix()); } @Override protected String[] loadVertexShader(URL url) { - return loadVertexShader(url, getGLSLVersion()); + return loadVertexShader(url, getGLSLVersion(), getGLSLVersionSuffix()); } @Override protected String[] loadFragmentShader(URL url) { - return loadFragmentShader(url, getGLSLVersion()); + return loadFragmentShader(url, getGLSLVersion(), getGLSLVersionSuffix()); } @Override - protected String[] loadFragmentShader(String filename, int version) { - String[] fragSrc0 = pg.parent.loadStrings(filename); - return preprocessFragmentSource(fragSrc0, version); + protected String[] loadFragmentShader(String filename, int version, String versionSuffix) { + String[] fragSrc0 = sketch.loadStrings(filename); + return preprocessFragmentSource(fragSrc0, version, versionSuffix); } @Override - protected String[] loadVertexShader(String filename, int version) { - String[] vertSrc0 = pg.parent.loadStrings(filename); - return preprocessVertexSource(vertSrc0, version); + protected String[] loadVertexShader(String filename, int version, String versionSuffix) { + String[] vertSrc0 = sketch.loadStrings(filename); + return preprocessVertexSource(vertSrc0, version, versionSuffix); } @Override - protected String[] loadFragmentShader(URL url, int version) { + protected String[] loadFragmentShader(URL url, int version, String versionSuffix) { try { String[] fragSrc0 = PApplet.loadStrings(url.openStream()); - return preprocessFragmentSource(fragSrc0, version); + return preprocessFragmentSource(fragSrc0, version, versionSuffix); } catch (IOException e) { PGraphics.showException("Cannot load fragment shader " + url.getFile()); } @@ -1295,10 +573,10 @@ protected String[] loadFragmentShader(URL url, int version) { @Override - protected String[] loadVertexShader(URL url, int version) { + protected String[] loadVertexShader(URL url, int version, String versionSuffix) { try { String[] vertSrc0 = PApplet.loadStrings(url.openStream()); - return preprocessVertexSource(vertSrc0, version); + return preprocessVertexSource(vertSrc0, version, versionSuffix); } catch (IOException e) { PGraphics.showException("Cannot load vertex shader " + url.getFile()); } @@ -1334,19 +612,33 @@ public Tessellator(TessellatorCallback callback) { GLU.gluTessCallback(tess, GLU.GLU_TESS_ERROR, gluCallback); } + @Override + public void setCallback(int flag) { + GLU.gluTessCallback(tess, flag, gluCallback); + } + + @Override + public void setWindingRule(int rule) { + setProperty(GLU.GLU_TESS_WINDING_RULE, rule); + } + + public void setProperty(int property, int value) { + GLU.gluTessProperty(tess, property, value); + } + @Override public void beginPolygon() { - GLU.gluTessBeginPolygon(tess, null); + beginPolygon(null); } @Override - public void endPolygon() { - GLU.gluTessEndPolygon(tess); + public void beginPolygon(Object data) { + GLU.gluTessBeginPolygon(tess, data); } @Override - public void setWindingRule(int rule) { - GLU.gluTessProperty(tess, GLU.GLU_TESS_WINDING_RULE, rule); + public void endPolygon() { + GLU.gluTessEndPolygon(tess); } @Override @@ -1361,7 +653,12 @@ public void endContour() { @Override public void addVertex(double[] v) { - GLU.gluTessVertex(tess, v, 0, v); + addVertex(v, 0, v); + } + + @Override + public void addVertex(double[] v, int n, Object data) { + GLU.gluTessVertex(tess, v, n, data); } protected class GLUCallback extends GLUtessellatorCallbackAdapter { @@ -1425,7 +722,7 @@ protected class FontOutline implements PGL.FontOutline { PathIterator iter; public FontOutline(char ch, Font font) { - char textArray[] = new char[] { ch }; + char[] textArray = new char[] { ch }; FontRenderContext frc = getFontRenderContext(font); GlyphVector gv = font.createGlyphVector(frc, textArray); Shape shp = gv.getOutline(); @@ -1436,7 +733,7 @@ public boolean isDone() { return iter.isDone(); } - public int currentSegment(float coords[]) { + public int currentSegment(float[] coords) { return iter.currentSegment(coords); } @@ -1486,6 +783,7 @@ public void next() { TESS_WINDING_NONZERO = GLU.GLU_TESS_WINDING_NONZERO; TESS_WINDING_ODD = GLU.GLU_TESS_WINDING_ODD; + TESS_EDGE_FLAG = GLU.GLU_TESS_EDGE_FLAG; GENERATE_MIPMAP_HINT = GL.GL_GENERATE_MIPMAP_HINT; FASTEST = GL.GL_FASTEST; @@ -1514,12 +812,14 @@ public void next() { ARRAY_BUFFER = GL.GL_ARRAY_BUFFER; ELEMENT_ARRAY_BUFFER = GL.GL_ELEMENT_ARRAY_BUFFER; + PIXEL_PACK_BUFFER = GL2ES3.GL_PIXEL_PACK_BUFFER; MAX_VERTEX_ATTRIBS = GL2ES2.GL_MAX_VERTEX_ATTRIBS; STATIC_DRAW = GL.GL_STATIC_DRAW; DYNAMIC_DRAW = GL.GL_DYNAMIC_DRAW; STREAM_DRAW = GL2ES2.GL_STREAM_DRAW; + STREAM_READ = GL2ES3.GL_STREAM_READ; BUFFER_SIZE = GL.GL_BUFFER_SIZE; BUFFER_USAGE = GL.GL_BUFFER_USAGE; @@ -1676,7 +976,6 @@ public void next() { STENCIL_TEST = GL.GL_STENCIL_TEST; DEPTH_TEST = GL.GL_DEPTH_TEST; DEPTH_WRITEMASK = GL.GL_DEPTH_WRITEMASK; - ALPHA_TEST = GL2ES1.GL_ALPHA_TEST; COLOR_BUFFER_BIT = GL.GL_COLOR_BUFFER_BIT; DEPTH_BUFFER_BIT = GL.GL_DEPTH_BUFFER_BIT; @@ -1709,6 +1008,7 @@ public void next() { DEPTH_STENCIL = GL.GL_DEPTH_STENCIL; FRAMEBUFFER_COMPLETE = GL.GL_FRAMEBUFFER_COMPLETE; + FRAMEBUFFER_UNDEFINED = GL2ES3.GL_FRAMEBUFFER_UNDEFINED; FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; FRAMEBUFFER_INCOMPLETE_DIMENSIONS = GL.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; @@ -1716,6 +1016,8 @@ public void next() { FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER; FRAMEBUFFER_INCOMPLETE_READ_BUFFER = GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER; FRAMEBUFFER_UNSUPPORTED = GL.GL_FRAMEBUFFER_UNSUPPORTED; + FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = GL.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE; + FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = GL3ES3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS; FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = GL.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE; FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = GL.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME; @@ -1733,9 +1035,12 @@ public void next() { RENDERBUFFER_INTERNAL_FORMAT = GL.GL_RENDERBUFFER_INTERNAL_FORMAT; MULTISAMPLE = GL.GL_MULTISAMPLE; - POINT_SMOOTH = GL2ES1.GL_POINT_SMOOTH; LINE_SMOOTH = GL.GL_LINE_SMOOTH; POLYGON_SMOOTH = GL2GL3.GL_POLYGON_SMOOTH; + + SYNC_GPU_COMMANDS_COMPLETE = GL3ES3.GL_SYNC_GPU_COMMANDS_COMPLETE; + ALREADY_SIGNALED = GL3ES3.GL_ALREADY_SIGNALED; + CONDITION_SATISFIED = GL3ES3.GL_CONDITION_SATISFIED; } /////////////////////////////////////////////////////////// @@ -1894,6 +1199,37 @@ public void unmapBuffer(int target) { ////////////////////////////////////////////////////////////////////////////// + // Synchronization + + @Override + public long fenceSync(int condition, int flags) { + if (gl3es3 != null) { + return gl3es3.glFenceSync(condition, flags); + } else { + throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "fenceSync()")); + } + } + + @Override + public void deleteSync(long sync) { + if (gl3es3 != null) { + gl3es3.glDeleteSync(sync); + } else { + throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "deleteSync()")); + } + } + + @Override + public int clientWaitSync(long sync, int flags, long timeout) { + if (gl3es3 != null) { + return gl3es3.glClientWaitSync(sync, flags, timeout); + } else { + throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "clientWaitSync()")); + } + } + + ////////////////////////////////////////////////////////////////////////////// + // Viewport and Clipping @Override @@ -1903,7 +1239,7 @@ public void depthRangef(float n, float f) { @Override public void viewport(int x, int y, int w, int h) { - float scale = pg.getPixelScale(); + float scale = getPixelScale(); viewportImpl((int)scale * x, (int)(scale * y), (int)(scale * w), (int)(scale * h)); } @@ -1921,6 +1257,11 @@ protected void readPixelsImpl(int x, int y, int width, int height, int format, i gl.glReadPixels(x, y, width, height, format, type, buffer); } + @Override + protected void readPixelsImpl(int x, int y, int width, int height, int format, int type, long offset) { + gl.glReadPixels(x, y, width, height, format, type, 0); + } + ////////////////////////////////////////////////////////////////////////////// // Vertices @@ -1961,7 +1302,7 @@ public void vertexAttrib3fv(int index, FloatBuffer values) { } @Override - public void vertexAttri4fv(int index, FloatBuffer values) { + public void vertexAttrib4fv(int index, FloatBuffer values) { gl2.glVertexAttrib4fv(index, values); } @@ -1970,15 +1311,6 @@ public void vertexAttribPointer(int index, int size, int type, boolean normalize gl2.glVertexAttribPointer(index, size, type, normalized, stride, offset); } - @Override - public void vertexAttribPointer(int index, int size, int type, boolean normalized, int stride, Buffer data) { - if (gl2x != null) { - gl2x.glVertexAttribPointer(index, size, type, normalized, stride, data); - } else { - throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glVertexAttribPointer()")); - } - } - @Override public void enableVertexAttribArray(int index) { gl2.glEnableVertexAttribArray(index); @@ -1990,24 +1322,15 @@ public void disableVertexAttribArray(int index) { } @Override - public void drawArrays(int mode, int first, int count) { + public void drawArraysImpl(int mode, int first, int count) { gl.glDrawArrays(mode, first, count); } @Override - public void drawElements(int mode, int count, int type, int offset) { + public void drawElementsImpl(int mode, int count, int type, int offset) { gl.glDrawElements(mode, count, type, offset); } - @Override - public void drawElements(int mode, int count, int type, Buffer indices) { - if (gl2x != null) { - gl2x.glDrawElements(mode, count, type, indices); - } else { - throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glDrawElements()")); - } - } - ////////////////////////////////////////////////////////////////////////////// // Rasterization @@ -2413,7 +1736,7 @@ public void getProgramiv(int program, int pname, IntBuffer params) { @Override public String getProgramInfoLog(int program) { int[] val = { 0 }; - gl2.glGetShaderiv(program, GL2ES2.GL_INFO_LOG_LENGTH, val, 0); + gl2.glGetProgramiv(program, GL2ES2.GL_INFO_LOG_LENGTH, val, 0); int length = val[0]; if (0 < length) { @@ -2421,7 +1744,7 @@ public String getProgramInfoLog(int program) { gl2.glGetProgramInfoLog(program, length, val, 0, log, 0); return new String(log); } else { - return "Unknow error"; + return "Unknown error"; } } @@ -2431,7 +1754,7 @@ public String getProgramInfoLog(int program) { @Override public void scissor(int x, int y, int w, int h) { - float scale = pg.getPixelScale(); + float scale = getPixelScale(); gl.glScissor((int)scale * x, (int)(scale * y), (int)(scale * w), (int)(scale * h)); // gl.glScissor(x, y, w, h); } @@ -2491,15 +1814,6 @@ public void blendColor(float red, float green, float blue, float alpha) { gl2.glBlendColor(red, green, blue, alpha); } - @Override - public void alphaFunc(int func, float ref) { - if (gl2x != null) { - gl2x.glAlphaFunc(func, ref); - } else { - throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glAlphaFunc()")); - } - } - /////////////////////////////////////////////////////////// // Whole Framebuffer Operations @@ -2524,11 +1838,6 @@ public void stencilMaskSeparate(int face, int mask) { gl2.glStencilMaskSeparate(face, mask); } - @Override - public void clear(int buf) { - gl.glClear(buf); - } - @Override public void clearColor(float r, float g, float b, float a) { gl.glClearColor(r, g, b, a); @@ -2536,7 +1845,7 @@ public void clearColor(float r, float g, float b, float a) { @Override public void clearDepth(float d) { - gl.glClearDepthf(d); + gl.glClearDepth(d); } @Override @@ -2544,6 +1853,11 @@ public void clearStencil(int s) { gl.glClearStencil(s); } + @Override + public void clear(int buf) { + gl.glClear(buf); + } + /////////////////////////////////////////////////////////// // Framebuffers Objects @@ -2624,6 +1938,8 @@ public void blitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX gl2x.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } else if (gl3 != null) { gl3.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); + } else if (gl3es3 != null) { + gl3es3.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } else { throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glBlitFramebuffer()")); } @@ -2635,6 +1951,8 @@ public void renderbufferStorageMultisample(int target, int samples, int format, gl2x.glRenderbufferStorageMultisample(target, samples, format, width, height); } else if (gl3 != null) { gl3.glRenderbufferStorageMultisample(target, samples, format, width, height); + } else if (gl3es3 != null) { + gl3es3.glRenderbufferStorageMultisample(target, samples, format, width, height); } else { throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glRenderbufferStorageMultisample()")); } @@ -2646,6 +1964,8 @@ public void readBuffer(int buf) { gl2x.glReadBuffer(buf); } else if (gl3 != null) { gl3.glReadBuffer(buf); + } else if (gl3es3 != null) { + gl3es3.glReadBuffer(buf); } else { throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glReadBuffer()")); } @@ -2657,6 +1977,11 @@ public void drawBuffer(int buf) { gl2x.glDrawBuffer(buf); } else if (gl3 != null) { gl3.glDrawBuffer(buf); + } else if (gl3es3 != null) { + IntBuffer intBuffer = IntBuffer.allocate(1); + intBuffer.put(buf); + intBuffer.rewind(); + gl3es3.glDrawBuffers(1, intBuffer); } else { throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glDrawBuffer()")); } diff --git a/core/src/processing/opengl/PShader.java b/core/src/processing/opengl/PShader.java index a05531fceb..d5f8f1d531 100644 --- a/core/src/processing/opengl/PShader.java +++ b/core/src/processing/opengl/PShader.java @@ -3,12 +3,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -50,8 +51,12 @@ public class PShader implements PConstants { static protected String pointShaderAttrRegexp = "attribute *vec2 *offset"; + static protected String pointShaderInRegexp = + "in *vec2 *offset;"; static protected String lineShaderAttrRegexp = "attribute *vec4 *direction"; + static protected String lineShaderInRegexp = + "in *vec4 *direction"; static protected String pointShaderDefRegexp = "#define *PROCESSING_POINT_SHADER"; static protected String lineShaderDefRegexp = @@ -102,7 +107,7 @@ public class PShader implements PConstants { protected boolean bound; - protected HashMap uniformValues = null; + protected HashMap uniformValues = null; protected HashMap textures; protected HashMap texUnits; @@ -121,6 +126,7 @@ public class PShader implements PConstants { protected int ppixelsLoc; protected int ppixelsUnit; protected int viewportLoc; + protected int resolutionLoc; // Uniforms only for lines and points protected int perspectiveLoc; @@ -305,24 +311,6 @@ public PShader(PApplet parent, String[] vertSource, String[] fragSource) { } -// @Override -// protected void finalize() throws Throwable { -// try { -// if (glVertex != 0) { -// PGraphicsOpenGL.finalizeGLSLVertShaderObject(glVertex, context); -// } -// if (glFragment != 0) { -// PGraphicsOpenGL.finalizeGLSLFragShaderObject(glFragment, context); -// } -// if (glProgram != 0) { -// PGraphicsOpenGL.finalizeGLSLProgramObject(glProgram, context); -// } -// } finally { -// super.finalize(); -// } -// } - - public void setVertexShader(String vertFilename) { this.vertexFilename = vertFilename; vertexShaderSource = pgl.loadVertexShader(vertFilename); @@ -747,25 +735,25 @@ protected void setUniformTex(int loc, Texture tex) { protected void setUniformImpl(String name, int type, Object value) { - int loc = getUniformLoc(name); - if (-1 < loc) { - if (uniformValues == null) { - uniformValues = new HashMap(); - } - uniformValues.put(loc, new UniformValue(type, value)); - } else { - PGraphics.showWarning("The shader doesn't have a uniform called \"" + - name + "\" OR the uniform was removed during " + - "compilation because it was unused."); + if (uniformValues == null) { + uniformValues = new HashMap(); } + uniformValues.put(name, new UniformValue(type, value)); } protected void consumeUniforms() { if (uniformValues != null && 0 < uniformValues.size()) { int unit = 0; - for (Integer loc: uniformValues.keySet()) { - UniformValue val = uniformValues.get(loc); + for (String name: uniformValues.keySet()) { + int loc = getUniformLoc(name); + if (loc == -1) { + PGraphics.showWarning("The shader doesn't have a uniform called \"" + + name + "\" OR the uniform was removed during " + + "compilation because it was unused."); + continue; + } + UniformValue val = uniformValues.get(name); if (val.type == UniformValue.INT1) { int[] v = ((int[])val.value); pgl.uniform1i(loc, v[0]); @@ -920,10 +908,6 @@ public void init() { protected void create() { context = pgl.getCurrentContext(); glres = new GLResourceShader(this); - -// glProgram = PGraphicsOpenGL.createGLSLProgramObject(context, pgl); -// glVertex = PGraphicsOpenGL.createGLSLVertShaderObject(context, pgl); -// glFragment = PGraphicsOpenGL.createGLSLFragShaderObject(context, pgl); } @@ -967,9 +951,6 @@ protected void validate() { protected boolean contextIsOutdated() { boolean outdated = !pgl.contextIsCurrent(context); if (outdated) { -// PGraphicsOpenGL.removeGLSLProgramObject(glProgram, context); -// PGraphicsOpenGL.removeGLSLVertShaderObject(glVertex, context); -// PGraphicsOpenGL.removeGLSLFragShaderObject(glFragment, context); dispose(); } return outdated; @@ -991,8 +972,6 @@ protected boolean hasFragmentShader() { * @param shaderSource a string containing the shader's code */ protected boolean compileVertexShader() { -// glVertex = PGraphicsOpenGL.createGLSLVertShaderObject(context, pgl); - pgl.shaderSource(glVertex, PApplet.join(vertexShaderSource, "\n")); pgl.compileShader(glVertex); @@ -1012,8 +991,6 @@ protected boolean compileVertexShader() { * @param shaderSource a string containing the shader's code */ protected boolean compileFragmentShader() { -// glFragment = PGraphicsOpenGL.createGLSLFragShaderObject(context, pgl); - pgl.shaderSource(glFragment, PApplet.join(fragmentShaderSource, "\n")); pgl.compileShader(glFragment); @@ -1037,33 +1014,14 @@ protected void dispose() { glProgram = 0; glres = null; } -// if (glVertex != 0) { -// PGraphicsOpenGL.deleteGLSLVertShaderObject(glVertex, context, pgl); -// glVertex = 0; -// } -// if (glFragment != 0) { -// PGraphicsOpenGL.deleteGLSLFragShaderObject(glFragment, context, pgl); -// glFragment = 0; -// } -// if (glProgram != 0) { -// PGraphicsOpenGL.deleteGLSLProgramObject(glProgram, context, pgl); -// glProgram = 0; -// } } static protected int getShaderType(String[] source, int defaultType) { for (int i = 0; i < source.length; i++) { String line = source[i].trim(); - if (PApplet.match(line, pointShaderAttrRegexp) != null) - return PShader.POINT; - else if (PApplet.match(line, lineShaderAttrRegexp) != null) - return PShader.LINE; - else if (PApplet.match(line, pointShaderDefRegexp) != null) - return PShader.POINT; - else if (PApplet.match(line, lineShaderDefRegexp) != null) - return PShader.LINE; - else if (PApplet.match(line, colorShaderDefRegexp) != null) + + if (PApplet.match(line, colorShaderDefRegexp) != null) return PShader.COLOR; else if (PApplet.match(line, lightShaderDefRegexp) != null) return PShader.LIGHT; @@ -1077,6 +1035,18 @@ else if (PApplet.match(line, triShaderAttrRegexp) != null) return PShader.POLY; else if (PApplet.match(line, quadShaderAttrRegexp) != null) return PShader.POLY; + else if (PApplet.match(line, pointShaderDefRegexp) != null) + return PShader.POINT; + else if (PApplet.match(line, lineShaderDefRegexp) != null) + return PShader.LINE; + else if (PApplet.match(line, pointShaderAttrRegexp) != null) + return PShader.POINT; + else if (PApplet.match(line, pointShaderInRegexp) != null) + return PShader.POINT; + else if (PApplet.match(line, lineShaderAttrRegexp) != null) + return PShader.LINE; + else if (PApplet.match(line, lineShaderInRegexp) != null) + return PShader.LINE; } return defaultType; } @@ -1188,6 +1158,7 @@ protected void loadUniforms() { projectionMatLoc = getUniformLoc("projectionMatrix"); viewportLoc = getUniformLoc("viewport"); + resolutionLoc = getUniformLoc("resolution"); ppixelsLoc = getUniformLoc("ppixels"); normalMatLoc = getUniformLoc("normalMatrix"); @@ -1239,6 +1210,12 @@ protected void setCommonUniforms() { setUniformValue(viewportLoc, x, y, w, h); } + if (-1 < resolutionLoc) { + float w = currentPG.viewport.get(2); + float h = currentPG.viewport.get(3); + setUniformValue(resolutionLoc, w, h); + } + if (-1 < ppixelsLoc) { ppixelsUnit = getLastTexUnit() + 1; setUniformValue(ppixelsLoc, ppixelsUnit); @@ -1336,7 +1313,7 @@ protected void unbindTyped() { if (-1 < normalLoc) pgl.disableVertexAttribArray(normalLoc); if (-1 < ppixelsLoc) { - pgl.requestFBOLayer(); + pgl.enableFBOLayer(); pgl.activeTexture(PGL.TEXTURE0 + ppixelsUnit); currentPG.unbindFrontTexture(); pgl.activeTexture(PGL.TEXTURE0); diff --git a/core/src/processing/opengl/PShapeOpenGL.java b/core/src/processing/opengl/PShapeOpenGL.java index 27a68bed4d..c240847512 100644 --- a/core/src/processing/opengl/PShapeOpenGL.java +++ b/core/src/processing/opengl/PShapeOpenGL.java @@ -3,7 +3,9 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 @@ -41,7 +43,6 @@ import java.nio.Buffer; import java.util.Arrays; import java.util.HashSet; -import java.util.Stack; /** * This class holds a 3D model composed of vertices, normals, colors @@ -95,6 +96,7 @@ public class PShapeOpenGL extends PShape { protected HashSet textures; protected boolean strokedTexture; + protected boolean untexChild; // ........................................................ @@ -109,33 +111,16 @@ public class PShapeOpenGL extends PShape { protected VertexBuffer bufPolyEmissive; protected VertexBuffer bufPolyShininess; protected VertexBuffer bufPolyIndex; -// public int glPolyVertex; -// public int glPolyColor; -// public int glPolyNormal; -// public int glPolyTexcoord; -// public int glPolyAmbient; -// public int glPolySpecular; -// public int glPolyEmissive; -// public int glPolyShininess; -// public int glPolyIndex; protected VertexBuffer bufLineVertex; protected VertexBuffer bufLineColor; protected VertexBuffer bufLineAttrib; protected VertexBuffer bufLineIndex; -// public int glLineVertex; -// public int glLineColor; -// public int glLineAttrib; -// public int glLineIndex; protected VertexBuffer bufPointVertex; protected VertexBuffer bufPointColor; protected VertexBuffer bufPointAttrib; protected VertexBuffer bufPointIndex; -// public int glPointVertex; -// public int glPointColor; -// public int glPointAttrib; -// public int glPointIndex; // Testing this field, not use as it might go away... public int glUsage = PGL.STATIC_DRAW; @@ -185,7 +170,8 @@ public class PShapeOpenGL extends PShape { // Geometric transformations. protected PMatrix transform; - protected Stack transformStack; + protected PMatrix transformInv; + protected PMatrix matrixInv; // ........................................................ @@ -411,6 +397,9 @@ public PShapeOpenGL(PGraphicsOpenGL pg, int family) { // GROUP shapes are always marked as ended. shapeCreated = true; } + + // OpenGL supports per-vertex coloring (unlike Java2D) + perVertexStyles = true; } @@ -437,6 +426,8 @@ public void addChild(PShape who) { for (PImage tex: c3d.textures) { addTexture(tex); } + } else { + untexChild(true); } if (c3d.strokedTexture) { strokedTexture(true); @@ -447,6 +438,8 @@ public void addChild(PShape who) { if (c3d.stroke) { strokedTexture(true); } + } else { + untexChild(true); } } @@ -474,6 +467,8 @@ public void addChild(PShape who, int idx) { for (PImage tex: c3d.textures) { addTexture(tex); } + } else { + untexChild(true); } if (c3d.strokedTexture) { strokedTexture(true); @@ -484,6 +479,8 @@ public void addChild(PShape who, int idx) { if (c3d.stroke) { strokedTexture(true); } + } else { + untexChild(true); } } @@ -499,6 +496,8 @@ public void addChild(PShape who, int idx) { @Override public void removeChild(int idx) { super.removeChild(idx); + strokedTexture(false); + untexChild(false); markForTessellation(); } @@ -514,101 +513,6 @@ protected void updateRoot(PShape root) { } -// @Override -// protected void finalize() throws Throwable { -// try { -// finalizePolyBuffers(); -// finalizeLineBuffers(); -// finalizePointBuffers(); -// } finally { -// super.finalize(); -// } -// } - - -// protected void finalizePolyBuffers() { -// if (glPolyVertex != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyVertex, context); -// } -// -// if (glPolyColor != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyColor, context); -// } -// -// if (glPolyNormal != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyNormal, context); -// } -// -// if (glPolyTexcoord != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyTexcoord, context); -// } -// -// if (glPolyAmbient != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyAmbient, context); -// } -// -// if (glPolySpecular != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolySpecular, context); -// } -// -// if (glPolyEmissive != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyEmissive, context); -// } -// -// if (glPolyShininess != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyShininess, context); -// } -// -// for (VertexAttribute attrib: polyAttribs.values()) { -// if (attrib.glName != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(attrib.glName, context); -// } -// } -// -// -// if (glPolyIndex != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPolyIndex, context); -// } -// } - - -// protected void finalizeLineBuffers() { -// if (glLineVertex != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glLineVertex, context); -// } -// -// if (glLineColor != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glLineColor, context); -// } -// -// if (glLineAttrib != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glLineAttrib, context); -// } -// -// if (glLineIndex != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glLineIndex, context); -// } -// } -// -// -// protected void finalizePointBuffers() { -// if (glPointVertex != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPointVertex, context); -// } -// -// if (glPointColor != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPointColor, context); -// } -// -// if (glPointAttrib != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPointAttrib, context); -// } -// -// if (glPointIndex != 0) { -// PGraphicsOpenGL.finalizeVertexBufferObject(glPointIndex, context); -// } -// } - /////////////////////////////////////////////////////////// // @@ -899,7 +803,7 @@ protected void setTextureImpl(PImage tex) { } if (image0 != tex && parent != null) { - ((PShapeOpenGL)parent).removeTexture(tex); + ((PShapeOpenGL)parent).removeTexture(image0, this); } if (parent != null) { ((PShapeOpenGL)parent).addTexture(image); @@ -943,7 +847,7 @@ protected void scaleTextureUV(float uFactor, float vFactor) { protected void addTexture(PImage tex) { if (textures == null) { - textures = new HashSet(); + textures = new HashSet<>(); } textures.add(tex); if (parent != null) { @@ -952,14 +856,14 @@ protected void addTexture(PImage tex) { } - protected void removeTexture(PImage tex) { + protected void removeTexture(PImage tex, PShapeOpenGL caller) { if (textures == null || !textures.contains(tex)) return; // Nothing to remove. - // First check that none of the child shapes - // have texture tex... + // First check that none of the child shapes have texture tex... boolean childHasTex = false; for (int i = 0; i < childCount; i++) { PShapeOpenGL child = (PShapeOpenGL) children[i]; + if (child == caller) continue; if (child.hasTexture(tex)) { childHasTex = true; break; @@ -977,38 +881,76 @@ protected void removeTexture(PImage tex) { // Since this shape and all its child shapes don't contain // tex anymore, we now can remove it from the parent. if (parent != null) { - ((PShapeOpenGL)parent).removeTexture(tex); + ((PShapeOpenGL)parent).removeTexture(tex, this); } } protected void strokedTexture(boolean newValue) { + strokedTexture(newValue, null); + } + + + protected void strokedTexture(boolean newValue, PShapeOpenGL caller) { if (strokedTexture == newValue) return; // Nothing to change. if (newValue) { strokedTexture = true; } else { - // First check that none of the child shapes - // have have a stroked texture... - boolean childHasStrokedTex = false; + // Check that none of the child shapes have a stroked texture... + strokedTexture = false; for (int i = 0; i < childCount; i++) { PShapeOpenGL child = (PShapeOpenGL) children[i]; + if (child == caller) continue; if (child.hasStrokedTexture()) { - childHasStrokedTex = true; + strokedTexture = true; break; } } + } + + // Now we can update the parent shape. + if (parent != null) { + ((PShapeOpenGL)parent).strokedTexture(newValue, this); + } + } + - if (!childHasStrokedTex) { - // ...if not, it is safe to mark this shape as without - // stroked texture. - strokedTexture = false; + protected void untexChild(boolean newValue) { + untexChild(newValue, null); + } + + + protected void untexChild(boolean newValue, PShapeOpenGL caller) { + if (untexChild == newValue) return; // Nothing to change. + + if (newValue) { + untexChild = true; + } else { + // Check if any of the child shapes is not textured... + untexChild = false; + for (int i = 0; i < childCount; i++) { + PShapeOpenGL child = (PShapeOpenGL) children[i]; + if (child == caller) continue; + if (!child.hasTexture()) { + untexChild = true; + break; + } } } // Now we can update the parent shape. if (parent != null) { - ((PShapeOpenGL)parent).strokedTexture(newValue); + ((PShapeOpenGL)parent).untexChild(newValue, this); + } + } + + + protected boolean hasTexture() { + if (family == GROUP) { + return textures != null && 0 < textures.size(); + } else { + return image != null; } } @@ -1392,39 +1334,34 @@ public void applyMatrix(float n00, float n01, float n02, float n03, @Override public void resetMatrix() { - if (shapeCreated && matrix != null && transformStack != null) { + if (shapeCreated && matrix != null && matrixInv != null) { if (family == GROUP) { updateTessellation(); } if (tessellated) { - PMatrix mat = popTransform(); - while (mat != null) { - boolean res = mat.invert(); - if (res) { - applyMatrixImpl(mat); - } else { - PGraphics.showWarning("Transformation applied on the shape cannot be inverted"); - } - mat = popTransform(); - } + applyMatrixImpl(matrixInv); } matrix.reset(); - transformStack.clear(); + matrixInv.reset(); } } protected void transform(int type, float... args) { int dimensions = is3D ? 3 : 2; + boolean invertible = true; checkMatrix(dimensions); if (transform == null) { if (dimensions == 2) { transform = new PMatrix2D(); + transformInv = new PMatrix2D(); } else { transform = new PMatrix3D(); + transformInv = new PMatrix3D(); } } else { transform.reset(); + transformInv.reset(); } int ncoords = args.length; @@ -1438,22 +1375,28 @@ protected void transform(int type, float... args) { case TRANSLATE: if (ncoords == 3) { transform.translate(args[0], args[1], args[2]); + PGraphicsOpenGL.invTranslate((PMatrix3D)transformInv, args[0], args[1], args[2]); } else { transform.translate(args[0], args[1]); + PGraphicsOpenGL.invTranslate((PMatrix2D)transformInv, args[0], args[1]); } break; case ROTATE: if (ncoords == 3) { transform.rotate(args[0], args[1], args[2], args[3]); + PGraphicsOpenGL.invRotate((PMatrix3D)transformInv, args[0], args[1], args[2], args[3]); } else { transform.rotate(args[0]); + PGraphicsOpenGL.invRotate((PMatrix2D)transformInv, -args[0]); } break; case SCALE: if (ncoords == 3) { transform.scale(args[0], args[1], args[2]); + PGraphicsOpenGL.invScale((PMatrix3D)transformInv, args[0], args[1], args[2]); } else { transform.scale(args[0], args[1]); + PGraphicsOpenGL.invScale((PMatrix2D)transformInv, args[0], args[1]); } break; case MATRIX: @@ -1466,32 +1409,20 @@ protected void transform(int type, float... args) { transform.set(args[0], args[1], args[2], args[3], args[4], args[5]); } + transformInv.set(transform); + invertible = transformInv.invert(); break; } - matrix.apply(transform); - pushTransform(); - if (tessellated) applyMatrixImpl(transform); - } - - - protected void pushTransform() { - if (transformStack == null) transformStack = new Stack(); - PMatrix mat; - if (transform instanceof PMatrix2D) { - mat = new PMatrix2D(); + matrix.preApply(transform); + if (invertible) { + matrixInv.apply(transformInv); } else { - mat = new PMatrix3D(); + PGraphics.showWarning("Transformation applied on the shape cannot be inverted"); } - mat.set(transform); - transformStack.push(mat); + if (tessellated) applyMatrixImpl(transform); } - protected PMatrix popTransform() { - if (transformStack == null || transformStack.size() == 0) return null; - return transformStack.pop(); - } - protected void applyMatrixImpl(PMatrix matrix) { if (hasPolys) { tessGeo.applyMatrixOnPolyGeometry(matrix, @@ -1517,11 +1448,29 @@ protected void applyMatrixImpl(PMatrix matrix) { tessGeo.applyMatrixOnPointGeometry(matrix, firstPointVertex, lastPointVertex); root.setModifiedPointVertices(firstPointVertex, lastPointVertex); + root.setModifiedPointAttributes(firstPointVertex, lastPointVertex); } } } + @Override + protected void checkMatrix(int dimensions) { + if (matrix == null) { + if (dimensions == 2) { + matrix = new PMatrix2D(); + matrixInv = new PMatrix2D(); + } else { + matrix = new PMatrix3D(); + matrixInv = new PMatrix3D(); + } + } else if (dimensions == 3 && (matrix instanceof PMatrix2D)) { + matrix = new PMatrix3D(matrix); + matrixInv = new PMatrix3D(matrixInv); + } + } + + /////////////////////////////////////////////////////////// // @@ -1721,7 +1670,10 @@ public void setVertex(int index, float x, float y, float z) { } vertices[index][X] = x; vertices[index][Y] = y; - if (is3D) vertices[index][Z] = z; + if (is3D && vertices[index].length > 2) { + // P3D allows to modify 2D shapes, ignoring the Z coordinate. + vertices[index][Z] = z; + } } else { inGeo.vertices[3 * index + 0] = x; inGeo.vertices[3 * index + 1] = y; @@ -1738,9 +1690,22 @@ public void setVertex(int index, PVector vec) { return; } - inGeo.vertices[3 * index + 0] = vec.x; - inGeo.vertices[3 * index + 1] = vec.y; - inGeo.vertices[3 * index + 2] = vec.z; + if (family == PATH) { + if (vertexCodes != null && vertexCodeCount > 0 && + vertexCodes[index] != VERTEX) { + PGraphics.showWarning(NOT_A_SIMPLE_VERTEX, "setVertex()"); + return; + } + vertices[index][X] = vec.x; + vertices[index][Y] = vec.y; + if (is3D && vertices[index].length > 2) { + vertices[index][Z] = vec.z; + } + } else { + inGeo.vertices[3 * index + 0] = vec.x; + inGeo.vertices[3 * index + 1] = vec.y; + inGeo.vertices[3 * index + 2] = vec.z; + } markForTessellation(); } @@ -1796,10 +1761,11 @@ public void setAttrib(String name, int index, float... values) { return; } - VertexAttribute attrib = polyAttribs.get(name); + VertexAttribute attrib = attribImpl(name, VertexAttribute.OTHER, PGL.FLOAT, + values.length); float[] array = inGeo.fattribs.get(name); for (int i = 0; i < values.length; i++) { - array[attrib.size * index + 0] = values[i]; + array[attrib.size * index + i] = values[i]; } markForTessellation(); } @@ -1812,10 +1778,11 @@ public void setAttrib(String name, int index, int... values) { return; } - VertexAttribute attrib = polyAttribs.get(name); + VertexAttribute attrib = attribImpl(name, VertexAttribute.OTHER, PGL.INT, + values.length); int[] array = inGeo.iattribs.get(name); for (int i = 0; i < values.length; i++) { - array[attrib.size * index + 0] = values[i]; + array[attrib.size * index + i] = values[i]; } markForTessellation(); } @@ -1828,10 +1795,11 @@ public void setAttrib(String name, int index, boolean... values) { return; } - VertexAttribute attrib = polyAttribs.get(name); + VertexAttribute attrib = attribImpl(name, VertexAttribute.OTHER, PGL.BOOL, + values.length); byte[] array = inGeo.battribs.get(name); for (int i = 0; i < values.length; i++) { - array[attrib.size * index + 0] = (byte)(values[i]?1:0); + array[attrib.size * index + i] = (byte)(values[i]?1:0); } markForTessellation(); } @@ -1889,8 +1857,8 @@ public void setFill(boolean fill) { PShapeOpenGL child = (PShapeOpenGL) children[i]; child.setFill(fill); } - } else if (this.fill && !fill) { - setFillImpl(0x0); + } else if (this.fill != fill) { + markForTessellation(); } this.fill = fill; } @@ -2070,20 +2038,31 @@ public void setStroke(boolean stroke) { PShapeOpenGL child = (PShapeOpenGL) children[i]; child.setStroke(stroke); } - } else if (this.stroke != stroke) { - if (this.stroke) { - // Disabling stroke on a shape previously with - // stroke needs a re-tessellation in order to remove - // the additional geometry of lines and/or points. - markForTessellation(); - stroke = false; + this.stroke = stroke; + } else { + setStrokeImpl(stroke); + } + } + + + protected void setStrokeImpl(boolean stroke) { + if (this.stroke != stroke) { + if (stroke) { + // Before there was no stroke, now there is stroke, so current stroke + // color should be copied to the input geometry, and geometry should + // be marked as modified in case it needs to be re-tessellated. + int color = strokeColor; + strokeColor += 1; // Forces a color change + setStrokeImpl(color); } - setStrokeImpl(0x0); + + markForTessellation(); if (is2D() && parent != null) { - ((PShapeOpenGL)parent).strokedTexture(false); + ((PShapeOpenGL)parent).strokedTexture(stroke && image != null); } + + this.stroke = stroke; } - this.stroke = stroke; } @@ -2852,15 +2831,21 @@ protected void initModified() { protected void tessellate() { if (root == this && parent == null) { // Root shape + boolean initAttr = false; if (polyAttribs == null) { polyAttribs = PGraphicsOpenGL.newAttributeMap(); - collectPolyAttribs(); + initAttr = true; } if (tessGeo == null) { tessGeo = PGraphicsOpenGL.newTessGeometry(pg, polyAttribs, PGraphicsOpenGL.RETAINED); } tessGeo.clear(); + + if (initAttr) { + collectPolyAttribs(); + } + for (int i = 0; i < polyAttribs.size(); i++) { VertexAttribute attrib = polyAttribs.get(i); tessGeo.initAttrib(attrib); @@ -2878,6 +2863,7 @@ protected void tessellate() { protected void collectPolyAttribs() { AttributeMap rootAttribs = root.polyAttribs; + tessGeo = root.tessGeo; if (family == GROUP) { for (int i = 0; i < childCount; i++) { @@ -2911,6 +2897,11 @@ protected void tessellateImpl() { lastPointIndexCache = -1; if (family == GROUP) { + if (polyAttribs == null) { + polyAttribs = PGraphicsOpenGL.newAttributeMap(); + collectPolyAttribs(); + } + for (int i = 0; i < childCount; i++) { PShapeOpenGL child = (PShapeOpenGL) children[i]; child.tessellateImpl(); @@ -3369,7 +3360,8 @@ protected void tessellateSphere() { int[] indices = inGeo.addSphere(r, nu, nv, fill, stroke); tessellator.tessellateTriangles(indices); - if (savedDetailU != nu || savedDetailV != nv) { + if ((0 < savedDetailU && savedDetailU != nu) || + (0 < savedDetailV && savedDetailV != nv)) { pg.sphereDetail(savedDetailU, savedDetailV); } } @@ -3933,7 +3925,6 @@ protected void initPolyBuffers() { tessGeo.updatePolyVerticesBuffer(); if (bufPolyVertex == null) -// glPolyVertex = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufPolyVertex = new VertexBuffer(pg, PGL.ARRAY_BUFFER, 4, PGL.SIZEOF_FLOAT); pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolyVertex.glId); pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, @@ -3941,7 +3932,6 @@ protected void initPolyBuffers() { tessGeo.updatePolyColorsBuffer(); if (bufPolyColor == null) -// glPolyColor = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufPolyColor = new VertexBuffer(pg, PGL.ARRAY_BUFFER, 1, PGL.SIZEOF_INT); pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolyColor.glId); pgl.bufferData(PGL.ARRAY_BUFFER, sizei, @@ -3949,7 +3939,6 @@ protected void initPolyBuffers() { tessGeo.updatePolyNormalsBuffer(); if (bufPolyNormal == null) -// glPolyNormal = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufPolyNormal = new VertexBuffer(pg, PGL.ARRAY_BUFFER, 3, PGL.SIZEOF_FLOAT); pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolyNormal.glId); pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, @@ -3957,7 +3946,6 @@ protected void initPolyBuffers() { tessGeo.updatePolyTexCoordsBuffer(); if (bufPolyTexcoord == null) -// glPolyTexcoord = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufPolyTexcoord = new VertexBuffer(pg, PGL.ARRAY_BUFFER, 2, PGL.SIZEOF_FLOAT); pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolyTexcoord.glId); pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef, @@ -3965,7 +3953,6 @@ protected void initPolyBuffers() { tessGeo.updatePolyAmbientBuffer(); if (bufPolyAmbient == null) -// glPolyAmbient = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufPolyAmbient = new VertexBuffer(pg, PGL.ARRAY_BUFFER, 1, PGL.SIZEOF_INT); pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolyAmbient.glId); pgl.bufferData(PGL.ARRAY_BUFFER, sizei, @@ -3973,7 +3960,6 @@ protected void initPolyBuffers() { tessGeo.updatePolySpecularBuffer(); if (bufPolySpecular == null) -// glPolySpecular = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufPolySpecular = new VertexBuffer(pg, PGL.ARRAY_BUFFER, 1, PGL.SIZEOF_INT); pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolySpecular.glId); pgl.bufferData(PGL.ARRAY_BUFFER, sizei, @@ -3981,7 +3967,6 @@ protected void initPolyBuffers() { tessGeo.updatePolyEmissiveBuffer(); if (bufPolyEmissive == null) -// glPolyEmissive = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufPolyEmissive = new VertexBuffer(pg, PGL.ARRAY_BUFFER, 1, PGL.SIZEOF_INT); pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolyEmissive.glId); pgl.bufferData(PGL.ARRAY_BUFFER, sizei, @@ -3989,7 +3974,6 @@ protected void initPolyBuffers() { tessGeo.updatePolyShininessBuffer(); if (bufPolyShininess == null) -// glPolyShininess = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufPolyShininess = new VertexBuffer(pg, PGL.ARRAY_BUFFER, 1, PGL.SIZEOF_FLOAT); pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolyShininess.glId); pgl.bufferData(PGL.ARRAY_BUFFER, sizef, @@ -4001,14 +3985,13 @@ protected void initPolyBuffers() { if (!attrib.bufferCreated()) attrib.createBuffer(pgl); pgl.bindBuffer(PGL.ARRAY_BUFFER, attrib.buf.glId); pgl.bufferData(PGL.ARRAY_BUFFER, attrib.sizeInBytes(size), - tessGeo.polyAttribBuffers.get(name), PGL.STATIC_DRAW); + tessGeo.polyAttribBuffers.get(name), glUsage); } pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); tessGeo.updatePolyIndicesBuffer(); if (bufPolyIndex == null) -// glPolyIndex = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufPolyIndex = new VertexBuffer(pg, PGL.ELEMENT_ARRAY_BUFFER, 1, PGL.SIZEOF_INDEX, true); pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, bufPolyIndex.glId); pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, @@ -4026,7 +4009,6 @@ protected void initLineBuffers() { tessGeo.updateLineVerticesBuffer(); if (bufLineVertex == null) -// glLineVertex = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufLineVertex = new VertexBuffer(pg, PGL.ARRAY_BUFFER, 4, PGL.SIZEOF_FLOAT); pgl.bindBuffer(PGL.ARRAY_BUFFER, bufLineVertex.glId); pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, @@ -4034,7 +4016,6 @@ protected void initLineBuffers() { tessGeo.updateLineColorsBuffer(); if (bufLineColor == null) -// glLineColor = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufLineColor = new VertexBuffer(pg, PGL.ARRAY_BUFFER, 1, PGL.SIZEOF_INT); pgl.bindBuffer(PGL.ARRAY_BUFFER, bufLineColor.glId); pgl.bufferData(PGL.ARRAY_BUFFER, sizei, @@ -4042,7 +4023,6 @@ protected void initLineBuffers() { tessGeo.updateLineDirectionsBuffer(); if (bufLineAttrib == null) -// glLineAttrib = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufLineAttrib = new VertexBuffer(pg, PGL.ARRAY_BUFFER, 4, PGL.SIZEOF_FLOAT); pgl.bindBuffer(PGL.ARRAY_BUFFER, bufLineAttrib.glId); pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, @@ -4052,7 +4032,6 @@ protected void initLineBuffers() { tessGeo.updateLineIndicesBuffer(); if (bufLineIndex == null) -// glLineIndex = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufLineIndex = new VertexBuffer(pg, PGL.ELEMENT_ARRAY_BUFFER, 1, PGL.SIZEOF_INDEX, true); pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, bufLineIndex.glId); pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, @@ -4070,7 +4049,6 @@ protected void initPointBuffers() { tessGeo.updatePointVerticesBuffer(); if (bufPointVertex == null) -// glPointVertex = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufPointVertex = new VertexBuffer(pg, PGL.ARRAY_BUFFER, 4, PGL.SIZEOF_FLOAT); pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPointVertex.glId); pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, @@ -4078,7 +4056,6 @@ protected void initPointBuffers() { tessGeo.updatePointColorsBuffer(); if (bufPointColor == null) -// glPointColor = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufPointColor = new VertexBuffer(pg, PGL.ARRAY_BUFFER, 1, PGL.SIZEOF_INT); pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPointColor.glId); pgl.bufferData(PGL.ARRAY_BUFFER, sizei, @@ -4086,7 +4063,6 @@ protected void initPointBuffers() { tessGeo.updatePointOffsetsBuffer(); if (bufPointAttrib == null) -// glPointAttrib = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufPointAttrib = new VertexBuffer(pg, PGL.ARRAY_BUFFER, 2, PGL.SIZEOF_FLOAT); pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPointAttrib.glId); pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef, @@ -4096,7 +4072,6 @@ protected void initPointBuffers() { tessGeo.updatePointIndicesBuffer(); if (bufPointIndex == null) -// glPointIndex = PGraphicsOpenGL.createVertexBufferObject(context, pgl); bufPointIndex = new VertexBuffer(pg, PGL.ELEMENT_ARRAY_BUFFER, 1, PGL.SIZEOF_INDEX, true); pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, bufPointIndex.glId); pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, @@ -4110,20 +4085,6 @@ protected void initPointBuffers() { protected boolean contextIsOutdated() { boolean outdated = !pgl.contextIsCurrent(context); if (outdated) { - // Removing the VBOs from the renderer's list so they - // doesn't get deleted by OpenGL. The VBOs were already - // automatically disposed when the old context was - // destroyed. - -// PGraphicsOpenGL.removeVertexBufferObject(glPolyVertex, context); -// PGraphicsOpenGL.removeVertexBufferObject(glPolyColor, context); -// PGraphicsOpenGL.removeVertexBufferObject(glPolyNormal, context); -// PGraphicsOpenGL.removeVertexBufferObject(glPolyTexcoord, context); -// PGraphicsOpenGL.removeVertexBufferObject(glPolyAmbient, context); -// PGraphicsOpenGL.removeVertexBufferObject(glPolySpecular, context); -// PGraphicsOpenGL.removeVertexBufferObject(glPolyEmissive, context); -// PGraphicsOpenGL.removeVertexBufferObject(glPolyShininess, context); - bufPolyVertex.dispose(); bufPolyColor.dispose(); bufPolyNormal.dispose(); @@ -4134,171 +4095,23 @@ protected boolean contextIsOutdated() { bufPolyShininess.dispose(); for (VertexAttribute attrib: polyAttribs.values()) { attrib.buf.dispose(); -// PGraphicsOpenGL.removeVertexBufferObject(attrib.glName, context); } -// PGraphicsOpenGL.removeVertexBufferObject(glPolyIndex, context); bufPolyIndex.dispose(); -// PGraphicsOpenGL.removeVertexBufferObject(glLineVertex, context); -// PGraphicsOpenGL.removeVertexBufferObject(glLineColor, context); -// PGraphicsOpenGL.removeVertexBufferObject(glLineAttrib, context); -// PGraphicsOpenGL.removeVertexBufferObject(glLineIndex, context); bufLineVertex.dispose(); bufLineColor.dispose(); bufLineAttrib.dispose(); bufLineIndex.dispose(); -// PGraphicsOpenGL.removeVertexBufferObject(glPointVertex, context); -// PGraphicsOpenGL.removeVertexBufferObject(glPointColor, context); -// PGraphicsOpenGL.removeVertexBufferObject(glPointAttrib, context); -// PGraphicsOpenGL.removeVertexBufferObject(glPointIndex, context); bufPointVertex.dispose(); bufPointColor.dispose(); bufPointAttrib.dispose(); bufPointIndex.dispose(); - - - // The OpenGL resources have been already deleted - // when the context changed. We only need to zero - // them to avoid deleting them again when the GC - // runs the finalizers of the disposed object. -// glPolyVertex = 0; -// glPolyColor = 0; -// glPolyNormal = 0; -// glPolyTexcoord = 0; -// glPolyAmbient = 0; -// glPolySpecular = 0; -// glPolyEmissive = 0; -// glPolyShininess = 0; -// for (VertexAttribute attrib: polyAttribs.values()) attrib.glName = 0; -// glPolyIndex = 0; -// -// glLineVertex = 0; -// glLineColor = 0; -// glLineAttrib = 0; -// glLineIndex = 0; -// -// glPointVertex = 0; -// glPointColor = 0; -// glPointAttrib = 0; -// glPointIndex = 0; } return outdated; } - /////////////////////////////////////////////////////////// - - // - - // Deletion methods - - -// protected void dispose() { -// deletePolyBuffers(); -// deleteLineBuffers(); -// deletePointBuffers(); -// } -// -// -// protected void deletePolyBuffers() { -// if (glPolyVertex != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glPolyVertex, context, pgl); -// glPolyVertex = 0; -// } -// -// if (glPolyColor != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glPolyColor, context, pgl); -// glPolyColor = 0; -// } -// -// if (glPolyNormal != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glPolyNormal, context, pgl); -// glPolyNormal = 0; -// } -// -// if (glPolyTexcoord != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glPolyTexcoord, context, pgl); -// glPolyTexcoord = 0; -// } -// -// if (glPolyAmbient != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glPolyAmbient, context, pgl); -// glPolyAmbient = 0; -// } -// -// if (glPolySpecular != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glPolySpecular, context, pgl); -// glPolySpecular = 0; -// } -// -// if (glPolyEmissive != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glPolyEmissive, context, pgl); -// glPolyEmissive = 0; -// } -// -// if (glPolyShininess != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glPolyShininess, context, pgl); -// glPolyShininess = 0; -// } -// -// for (VertexAttribute attrib: polyAttribs.values()) { -// attrib.deleteBuffer(pgl); -// } -// -// if (glPolyIndex != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glPolyIndex, context, pgl); -// glPolyIndex = 0; -// } -// } -// -// -// protected void deleteLineBuffers() { -// if (glLineVertex != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glLineVertex, context, pgl); -// glLineVertex = 0; -// } -// -// if (glLineColor != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glLineColor, context, pgl); -// glLineColor = 0; -// } -// -// if (glLineAttrib != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glLineAttrib, context, pgl); -// glLineAttrib = 0; -// } -// -// if (glLineIndex != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glLineIndex, context, pgl); -// glLineIndex = 0; -// } -// } -// -// -// protected void deletePointBuffers() { -// if (glPointVertex != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glPointVertex, context, pgl); -// glPointVertex = 0; -// } -// -// if (glPointColor != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glPointColor, context, pgl); -// glPointColor = 0; -// } -// -// if (glPointAttrib != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glPointAttrib, context, pgl); -// glPointAttrib = 0; -// } -// -// if (glPointIndex != 0) { -// PGraphicsOpenGL.deleteVertexBufferObject(glPointIndex, context, pgl); -// glPointIndex = 0; -// } -// } - - /////////////////////////////////////////////////////////// // @@ -4802,7 +4615,6 @@ public void enableStyle() { } - // Applies the styles of g. @Override protected void styles(PGraphics g) { if (g instanceof PGraphicsOpenGL) { @@ -4849,9 +4661,11 @@ protected void styles(PGraphics g) { // Rendering methods + /* public void draw() { draw(pg); } + */ @Override @@ -4876,31 +4690,118 @@ public void draw(PGraphics g) { } render(gl, tex); } - } else { render(gl, image); } - post(gl); } } else { - // The renderer is not PGraphicsOpenGL, which probably - // means that the draw() method is being called by the - // recorder. We just use the default drawing from the - // parent class. - super.draw(g); + if (family == GEOMETRY) { + inGeoToVertices(); + } + pre(g); + drawImpl(g); + post(g); + } + } + + + private void inGeoToVertices() { + vertexCount = 0; + vertexCodeCount = 0; + if (inGeo.codeCount == 0) { + for (int i = 0; i < inGeo.vertexCount; i++) { + int index = 3 * i; + float x = inGeo.vertices[index++]; + float y = inGeo.vertices[index ]; + super.vertex(x, y); + } + } else { + int v; + float x, y; + float cx, cy; + float x2, y2, x3, y3, x4, y4; + int idx = 0; + boolean insideContour = false; + + for (int j = 0; j < inGeo.codeCount; j++) { + switch (inGeo.codes[j]) { + + case VERTEX: + v = 3 * idx; + x = inGeo.vertices[v++]; + y = inGeo.vertices[v ]; + super.vertex(x, y); + + idx++; + break; + + case QUADRATIC_VERTEX: + v = 3 * idx; + cx = inGeo.vertices[v++]; + cy = inGeo.vertices[v]; + + v = 3 * (idx + 1); + x3 = inGeo.vertices[v++]; + y3 = inGeo.vertices[v]; + + super.quadraticVertex(cx, cy, x3, y3); + + idx += 2; + break; + + case BEZIER_VERTEX: + v = 3 * idx; + x2 = inGeo.vertices[v++]; + y2 = inGeo.vertices[v ]; + + v = 3 * (idx + 1); + x3 = inGeo.vertices[v++]; + y3 = inGeo.vertices[v ]; + + v = 3 * (idx + 2); + x4 = inGeo.vertices[v++]; + y4 = inGeo.vertices[v ]; + + super.bezierVertex(x2, y2, x3, y3, x4, y4); + + idx += 3; + break; + + case CURVE_VERTEX: + v = 3 * idx; + x = inGeo.vertices[v++]; + y = inGeo.vertices[v ]; + + super.curveVertex(x, y); + + idx++; + break; + + case BREAK: + if (insideContour) { + super.endContourImpl(); + } + super.beginContourImpl(); + insideContour = true; + } + } + if (insideContour) { + super.endContourImpl(); + } } } // Returns true if some child shapes below this one either - // use different texture maps or have stroked textures, + // use different texture maps (or only one texture is used by some while + // others are untextured), or have stroked textures, // so they cannot rendered in a single call. // Or accurate 2D mode is enabled, which forces each // shape to be rendered separately. protected boolean fragmentedGroup(PGraphicsOpenGL g) { return g.getHint(DISABLE_OPTIMIZED_STROKE) || - (textures != null && 1 < textures.size()) || + (textures != null && (1 < textures.size() || untexChild)) || strokedTexture; } diff --git a/core/src/processing/opengl/PSurfaceJOGL.java b/core/src/processing/opengl/PSurfaceJOGL.java index 6f57da4a55..a9de3f0b82 100644 --- a/core/src/processing/opengl/PSurfaceJOGL.java +++ b/core/src/processing/opengl/PSurfaceJOGL.java @@ -1,18 +1,53 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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, version 2.1. + + 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.opengl; import java.awt.Component; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; -//import java.awt.Dimension; import java.awt.Point; -//import java.awt.Frame; import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; - +import java.awt.image.BufferedImage; +import java.awt.image.DataBufferInt; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.ImageIcon; + +import com.jogamp.common.util.IOUtil; import com.jogamp.common.util.IOUtil.ClassResources; import com.jogamp.nativewindow.NativeSurface; import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.nativewindow.util.PixelRectangle; import com.jogamp.opengl.GLAnimatorControl; import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.GLCapabilities; @@ -20,17 +55,17 @@ import com.jogamp.opengl.GLException; import com.jogamp.opengl.GLProfile; import com.jogamp.nativewindow.MutableGraphicsConfiguration; +import com.jogamp.nativewindow.WindowClosingProtocol; import com.jogamp.newt.Display; -import com.jogamp.newt.MonitorDevice; +import com.jogamp.newt.Display.PointerIcon; import com.jogamp.newt.NewtFactory; import com.jogamp.newt.Screen; import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.event.InputEvent; -//import com.jogamp.newt.event.WindowAdapter; -//import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.util.FPSAnimator; + import processing.core.PApplet; import processing.core.PConstants; import processing.core.PGraphics; @@ -38,44 +73,41 @@ import processing.core.PSurface; import processing.event.KeyEvent; import processing.event.MouseEvent; -import processing.opengl.PGraphicsOpenGL; -import processing.opengl.PGL; + public class PSurfaceJOGL implements PSurface { /** Selected GL profile */ public static GLProfile profile; - PJOGL pgl; + public PJOGL pgl; + + protected GLWindow window; + protected FPSAnimator animator; + protected Rectangle screenRect; - GLWindow window; - FPSAnimator animator; - Rectangle screenRect; + private Thread drawExceptionHandler; - PApplet sketch; - PGraphics graphics; + protected PApplet sketch; + protected PGraphics graphics; - int sketchX; - int sketchY; - int sketchWidth; - int sketchHeight; + protected int sketchWidth0; + protected int sketchHeight0; + protected int sketchWidth; + protected int sketchHeight; - Display display; - Screen screen; - List monitors; - MonitorDevice displayDevice; - Throwable drawException; - Object waitObject = new Object(); + protected Display display; + protected Screen screen; + protected Rectangle displayRect; + protected Throwable drawException; + private final Object drawExceptionMutex = new Object(); - NewtCanvasAWT canvas; - boolean placedWindow = false; - boolean requestedStart = false; + protected NewtCanvasAWT canvas; - float[] currentPixelScale = {0, 0}; + protected int windowScaleFactor; - boolean presentMode = false; - float offsetX; - float offsetY; + protected float[] currentPixelScale = {0, 0}; + protected boolean external = false; public PSurfaceJOGL(PGraphics graphics) { this.graphics = graphics; @@ -97,12 +129,10 @@ public void initOffscreen(PApplet sketch) { } - public void initFrame(PApplet sketch) {/*, int backgroundColor, - int deviceIndex, boolean fullScreen, - boolean spanDisplays) {*/ + public void initFrame(PApplet sketch) { this.sketch = sketch; initIcons(); - initScreen(); + initDisplay(); initGL(); initWindow(); initListeners(); @@ -111,91 +141,64 @@ public void initFrame(PApplet sketch) {/*, int backgroundColor, public Object getNative() { -// if (canvas == null) { -// initOffscreen(sketch); -// } -// return canvas; return window; } - protected void initScreen() { + protected void initDisplay() { display = NewtFactory.createDisplay(null); display.addReference(); screen = NewtFactory.createScreen(display, 0); screen.addReference(); - monitors = new ArrayList(); GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] awtDevices = environment.getScreenDevices(); - List newtDevices = screen.getMonitorDevices(); - - // AWT and NEWT name devices in different ways, depending on the platform, - // and also appear to order them in different ways. The following code - // tries to address the differences. - if (PApplet.platform == PConstants.LINUX) { - for (GraphicsDevice device: awtDevices) { - String did = device.getIDstring(); - String[] parts = did.split("\\."); - String id1 = ""; - if (1 < parts.length) { - id1 = parts[1].trim(); - } - MonitorDevice monitor = null; - int id0 = newtDevices.size() > 0 ? newtDevices.get(0).getId() : 0; - for (int i = 0; i < newtDevices.size(); i++) { - MonitorDevice mon = newtDevices.get(i); - String mid = String.valueOf(mon.getId() - id0); - if (id1.equals(mid)) { - monitor = mon; - break; - } - } - if (monitor != null) { - monitors.add(monitor); - } - } - } else { // All the other platforms... - for (GraphicsDevice device: awtDevices) { - String did = device.getIDstring(); - String[] parts = did.split("Display"); - String id1 = ""; - if (1 < parts.length) { - id1 = parts[1].trim(); - } - MonitorDevice monitor = null; - for (int i = 0; i < newtDevices.size(); i++) { - MonitorDevice mon = newtDevices.get(i); - String mid = String.valueOf(mon.getId()); - if (id1.equals(mid)) { - monitor = mon; - break; - } - } - if (monitor == null) { - // Didn't find a matching monitor, try using less stringent id check - for (int i = 0; i < newtDevices.size(); i++) { - MonitorDevice mon = newtDevices.get(i); - String mid = String.valueOf(mon.getId()); - if (-1 < did.indexOf(mid)) { - monitor = mon; - break; - } - } - } - if (monitor != null) { - monitors.add(monitor); + + GraphicsDevice awtDisplayDevice = null; + int displayNum = sketch.sketchDisplay(); + if (displayNum > 0) { // if -1, use the default device + if (displayNum <= awtDevices.length) { + awtDisplayDevice = awtDevices[displayNum-1]; + } else { + System.err.format("Display %d does not exist, " + + "using the default display instead.%n", displayNum); + for (int i = 0; i < awtDevices.length; i++) { + System.err.format("Display %d is %s%n", i+1, awtDevices[i]); } } + } else if (0 < awtDevices.length) { + awtDisplayDevice = awtDevices[0]; } + + if (awtDisplayDevice == null) { + awtDisplayDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + } + + displayRect = awtDisplayDevice.getDefaultConfiguration().getBounds(); } + protected void initGL() { // System.out.println("*******************************"); if (profile == null) { - if (PJOGL.profile == 2) { + if (PJOGL.profile == 1) { + try { + profile = GLProfile.getGL2ES1(); + } catch (GLException ex) { + profile = GLProfile.getMaxFixedFunc(true); + } + } else if (PJOGL.profile == 2) { try { profile = GLProfile.getGL2ES2(); + + // workaround for https://jogamp.org/bugzilla/show_bug.cgi?id=1347 + if (!profile.isHardwareRasterizer()) { + GLProfile hardware = GLProfile.getMaxProgrammable(true); + if (hardware.isGL2ES2()) { + profile = hardware; + } + } + } catch (GLException ex) { profile = GLProfile.getMaxProgrammable(true); } @@ -229,48 +232,71 @@ protected void initGL() { // caps.setPBuffer(false); // caps.setFBO(false); - pgl.reqNumSamples = PGL.smoothToSamples(graphics.smooth); +// pgl.reqNumSamples = PGL.smoothToSamples(graphics.smooth); caps.setSampleBuffers(true); - caps.setNumSamples(pgl.reqNumSamples); + caps.setNumSamples(PGL.smoothToSamples(graphics.smooth)); caps.setBackgroundOpaque(true); caps.setOnscreen(true); - pgl.capabilities = caps; + pgl.setCaps(caps); } protected void initWindow() { - window = GLWindow.create(screen, pgl.capabilities); - if (displayDevice == null) { - displayDevice = window.getMainMonitor(); - } + window = GLWindow.create(screen, pgl.getCaps()); - int displayNum = sketch.sketchDisplay(); - if (displayNum > 0) { // if -1, use the default device - if (displayNum <= monitors.size()) { - displayDevice = monitors.get(displayNum - 1); - } else { - System.err.format("Display %d does not exist, " + - "using the default display instead.%n", displayNum); - for (int i = 0; i < monitors.size(); i++) { - System.err.format("Display %d is %s%n", i+1, monitors.get(i)); - } - } - } + // Make sure that we pass the window close through to exit(), otherwise + // we're likely to have OpenGL try to shut down halfway through rendering + // a frame. Particularly problematic for complex/slow apps. + // https://github.com/processing/processing/issues/4690 + window.setDefaultCloseOperation(WindowClosingProtocol.WindowClosingMode.DO_NOTHING_ON_CLOSE); + +// if (displayDevice == null) { +// +// +// } else { +// window = GLWindow.create(displayDevice.getScreen(), pgl.getCaps()); +// } + + windowScaleFactor = PApplet.platform == PConstants.MACOSX ? + 1 : sketch.pixelDensity; boolean spanDisplays = sketch.sketchDisplay() == PConstants.SPAN; screenRect = spanDisplays ? - new Rectangle(0, 0, screen.getWidth(), screen.getHeight()) : - new Rectangle(0, 0, - displayDevice.getViewportInWindowUnits().getWidth(), - displayDevice.getViewportInWindowUnits().getHeight()); + new Rectangle(screen.getX(), screen.getY(), screen.getWidth(), screen.getHeight()) : + new Rectangle((int) displayRect.getX(), (int) displayRect.getY(), + (int) displayRect.getWidth(), + (int) displayRect.getHeight()); // Set the displayWidth/Height variables inside PApplet, so that they're // usable and can even be returned by the sketchWidth()/Height() methods. sketch.displayWidth = screenRect.width; sketch.displayHeight = screenRect.height; + sketchWidth0 = sketch.sketchWidth(); + sketchHeight0 = sketch.sketchHeight(); + + /* + // Trying to fix + // https://github.com/processing/processing/issues/3401 + if (sketch.displayWidth < sketch.width || + sketch.displayHeight < sketch.height) { + int w = sketch.width; + int h = sketch.height; + if (sketch.displayWidth < w) { + w = sketch.displayWidth; + } + if (sketch.displayHeight < h) { + h = sketch.displayHeight; + } +// sketch.setSize(w, h - 22 - 22); +// graphics.setSize(w, h - 22 - 22); + System.err.println("setting width/height to " + w + " " + h); + } + */ + sketchWidth = sketch.sketchWidth(); sketchHeight = sketch.sketchHeight(); +// System.out.println("init: " + sketchWidth + " " + sketchHeight); boolean fullScreen = sketch.sketchFullScreen(); // Removing the section below because sometimes people want to do the @@ -288,12 +314,14 @@ protected void initWindow() { */ if (fullScreen || spanDisplays) { - sketchWidth = screenRect.width; - sketchHeight = screenRect.height; + sketchWidth = screenRect.width / windowScaleFactor; + sketchHeight = screenRect.height / windowScaleFactor; } + sketch.setSize(sketchWidth, sketchHeight); + float[] reqSurfacePixelScale; - if (graphics.is2X()) { + if (graphics.is2X() && PApplet.platform == PConstants.MACOSX) { // Retina reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; @@ -303,18 +331,17 @@ protected void initWindow() { ScalableSurface.IDENTITY_PIXELSCALE }; } window.setSurfaceScale(reqSurfacePixelScale); - window.setSize(sketchWidth, sketchHeight); + window.setSize(sketchWidth * windowScaleFactor, sketchHeight * windowScaleFactor); + window.setResizable(false); setSize(sketchWidth, sketchHeight); - sketchX = displayDevice.getViewportInWindowUnits().getX(); - sketchY = displayDevice.getViewportInWindowUnits().getY(); if (fullScreen) { PApplet.hideMenuBar(); - window.setTopLevelPosition(sketchX, sketchY); - placedWindow = true; if (spanDisplays) { - window.setFullscreen(monitors); + window.setFullscreen(screen.getMonitorDevices()); } else { - window.setFullscreen(true); + window.setUndecorated(true); + window.setTopLevelPosition((int) displayRect.getX(), (int) displayRect.getY()); + window.setTopLevelSize((int) displayRect.getWidth(), (int) displayRect.getHeight()); } } } @@ -334,7 +361,20 @@ protected void initListeners() { protected void initAnimator() { -// System.err.println("1. create animator"); + if (PApplet.platform == PConstants.WINDOWS) { + // Force Windows to keep timer resolution high by + // sleeping for time which is not a multiple of 10 ms. + // See section "Clocks and Timers on Windows": + // https://blogs.oracle.com/dholmes/entry/inside_the_hotspot_vm_clocks + Thread highResTimerThread = new Thread(() -> { + try { + Thread.sleep(Long.MAX_VALUE); + } catch (InterruptedException ignore) { } + }, "HighResTimerThread"); + highResTimerThread.setDaemon(true); + highResTimerThread.start(); + } + animator = new FPSAnimator(window, 60); drawException = null; animator.setUncaughtExceptionHandler(new GLAnimatorControl.UncaughtExceptionHandler() { @@ -342,82 +382,245 @@ protected void initAnimator() { public void uncaughtException(final GLAnimatorControl animator, final GLAutoDrawable drawable, final Throwable cause) { - synchronized (waitObject) { -// System.err.println("Caught exception: " + cause.getMessage()); + synchronized (drawExceptionMutex) { drawException = cause; - waitObject.notify(); + drawExceptionMutex.notify(); } } }); - new Thread(new Runnable() { + drawExceptionHandler = new Thread(new Runnable() { public void run() { - synchronized (waitObject) { + synchronized (drawExceptionMutex) { try { - if (drawException == null) waitObject.wait(); - } catch (InterruptedException e) { - e.printStackTrace(); - } -// System.err.println("Caught exception: " + drawException.getMessage()); - if (drawException != null) { - Throwable cause = drawException.getCause(); - if (cause instanceof ThreadDeath) { -// System.out.println("caught ThreadDeath"); -// throw (ThreadDeath)cause; - } else if (cause instanceof RuntimeException) { - throw (RuntimeException)cause; - } else { - throw new RuntimeException(cause); + while (drawException == null) { + drawExceptionMutex.wait(); + } + // System.err.println("Caught exception: " + drawException.getMessage()); + if (drawException != null) { + Throwable cause = drawException.getCause(); + if (cause instanceof ThreadDeath) { + // System.out.println("caught ThreadDeath"); + // throw (ThreadDeath)cause; + } else if (cause instanceof RuntimeException) { + throw (RuntimeException) cause; + } else if (cause instanceof UnsatisfiedLinkError) { + throw new UnsatisfiedLinkError(cause.getMessage()); + } else if (cause == null) { + throw new RuntimeException(drawException.getMessage()); + } else { + throw new RuntimeException(cause); + } } + } catch (InterruptedException e) { + return; } } } - }).start(); + }); + drawExceptionHandler.start(); } @Override - public void setTitle(String title) { - window.setTitle(title); + public void setTitle(final String title) { + display.getEDTUtil().invoke(false, new Runnable() { + @Override + public void run() { + window.setTitle(title); + } + }); } @Override - public void setVisible(boolean visible) { - window.setVisible(visible); + public void setVisible(final boolean visible) { + display.getEDTUtil().invoke(false, new Runnable() { + @Override + public void run() { + window.setVisible(visible); + } + }); } @Override - public void setResizable(boolean resizable) { - // TODO Auto-generated method stub + public void setResizable(final boolean resizable) { + display.getEDTUtil().invoke(false, new Runnable() { + @Override + public void run() { + window.setResizable(resizable); + } + }); } public void setIcon(PImage icon) { - // TODO Auto-generated method stub + PGraphics.showWarning("Window icons for OpenGL sketches can only be set in settings()\n" + + "using PJOGL.setIcon(filename)."); + } + + + @Override + public void setAlwaysOnTop(final boolean always) { + display.getEDTUtil().invoke(false, new Runnable() { + @Override + public void run() { + window.setAlwaysOnTop(always); + } + }); } protected void initIcons() { - final int[] sizes = { 16, 32, 48, 64, 128, 256, 512 }; - String[] iconImages = new String[sizes.length]; - for (int i = 0; i < sizes.length; i++) { - iconImages[i] = "/icon/icon-" + sizes[i] + ".png"; + IOUtil.ClassResources res = null; + if (PJOGL.icons == null || PJOGL.icons.length == 0) { + // Default Processing icons + final int[] sizes = { 16, 32, 48, 64, 128, 256, 512 }; + String[] iconImages = new String[sizes.length]; + for (int i = 0; i < sizes.length; i++) { + iconImages[i] = "/icon/icon-" + sizes[i] + ".png"; + } + res = new ClassResources(iconImages, + PApplet.class.getClassLoader(), + PApplet.class); + } else { + // Loading custom icons from user-provided files. + String[] iconImages = new String[PJOGL.icons.length]; + for (int i = 0; i < PJOGL.icons.length; i++) { + iconImages[i] = resourceFilename(PJOGL.icons[i]); + } + + res = new ClassResources(iconImages, + sketch.getClass().getClassLoader(), + sketch.getClass()); } - NewtFactory.setWindowIcons(new ClassResources(PApplet.class, iconImages)); + NewtFactory.setWindowIcons(res); } -// private void setFrameCentered() { -// } + @SuppressWarnings("resource") + private String resourceFilename(String filename) { + // The code below comes from PApplet.createInputRaw() with a few adaptations + InputStream stream = null; + 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(sketch.dataPath(filename)); + if (!file.exists()) { + // next see if it's just in the sketch folder + file = sketch.sketchFile(filename); + } + + if (file.exists() && !file.isDirectory()) { + 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) { } + } + + stream = new FileInputStream(file); + if (stream != null) { + stream.close(); + return file.getCanonicalPath(); + } + + // have to break these out because a general Exception might + // catch the RuntimeException being thrown above + } catch (IOException ioe) { + } catch (SecurityException se) { } + + ClassLoader cl = sketch.getClass().getClassLoader(); + + try { + // 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")) { + stream.close(); + return "data/" + filename; + } + } + + // 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")) { + stream.close(); + return filename; + } + } + } catch (IOException e) { } + + 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 { + String path = sketch.dataPath(filename); + stream = new FileInputStream(path); + if (stream != null) { + stream.close(); + return path; + } + } catch (IOException e2) { } + + try { + String path = sketch.sketchPath(filename); + stream = new FileInputStream(path); + if (stream != null) { + stream.close(); + return path; + } + } catch (Exception e) { } // ignored + + try { + stream = new FileInputStream(filename); + if (stream != null) { + stream.close(); + return filename; + } + } catch (IOException e1) { } + + } catch (SecurityException se) { } // online, whups + + } catch (Exception e) { + //die(e.getMessage(), e); + e.printStackTrace(); + } + + return ""; + } @Override public void placeWindow(int[] location, int[] editorLocation) { -// Dimension dim = new Dimension(sketchWidth, sketchHeight); -// int contentW = Math.max(sketchWidth, MIN_WINDOW_WIDTH); -// int contentH = Math.max(sketchHeight, MIN_WINDOW_HEIGHT); + + if (sketch.sketchFullScreen()) { + return; + } int x = window.getX() - window.getInsets().getLeftWidth(); int y = window.getY() - window.getInsets().getTopHeight(); @@ -438,6 +641,7 @@ public void placeWindow(int[] location, int[] editorLocation) { window.setTopLevelPosition(locationX - w, 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 @@ -447,34 +651,19 @@ public void placeWindow(int[] location, int[] editorLocation) { if ((locationX + w > sketch.displayWidth - 33) || (locationY + h > sketch.displayHeight - 33)) { // otherwise center on screen - locationX = (sketch.displayWidth - w) / 2; - locationY = (sketch.displayHeight - h) / 2; + */ + locationX = (sketch.displayWidth - w) / 2; + locationY = (sketch.displayHeight - h) / 2; + /* } + */ window.setTopLevelPosition(locationX, locationY); } } else { // just center on screen // Can't use frame.setLocationRelativeTo(null) because it sends the // frame to the main display, which undermines the --display setting. - int sketchX = displayDevice.getViewportInWindowUnits().getX(); - int sketchY = displayDevice.getViewportInWindowUnits().getY(); -// System.err.println("just center on the screen at " + sketchX + screenRect.x + (screenRect.width - sketchWidth) / 2 + ", " + -// sketchY + screenRect.y + (screenRect.height - sketchHeight) / 2); - // -// System.err.println(" Display starts at " + sketchX + ", " + sketchY); -// System.err.println(" Screen rect pos: " + screenRect.x + ", " + screenRect.y); -// System.err.println(" Screen rect w/h: " + screenRect.width + ", " + screenRect.height); -// System.err.println(" Sketch w/h: " + sketchWidth + ", " + sketchHeight); - -// int w = sketchWidth; -// int h = sketchHeight; -// if (graphics.is2X()) { -// w /= 2; -// h /= 2; -// } - - window.setTopLevelPosition(sketchX + screenRect.x + (screenRect.width - sketchWidth) / 2, - sketchY + screenRect.y + (screenRect.height - sketchHeight) / 2); - + window.setTopLevelPosition(screenRect.x + (screenRect.width - sketchWidth) / 2, + screenRect.y + (screenRect.height - sketchHeight) / 2); } Point frameLoc = new Point(x, y); @@ -483,79 +672,52 @@ public void placeWindow(int[] location, int[] editorLocation) { // closed. Awesome. http://dev.processing.org/bugs/show_bug.cgi?id=1508 window.setTopLevelPosition(frameLoc.x, 30); } - - placedWindow = true; - if (requestedStart) startThread(); -// canvas.setBounds((contentW - sketchWidth)/2, -// (contentH - sketchHeight)/2, -// sketchWidth, sketchHeight); } public void placePresent(int stopColor) { - -// if (presentMode) { -// System.err.println("Present mode"); -// System.err.println("WILL USE FBO"); - presentMode = pgl.presentMode = true; - offsetX = pgl.offsetX = 0.5f * (screenRect.width - sketchWidth); - offsetY = pgl.offsetY = 0.5f * (screenRect.height - sketchHeight); - pgl.requestFBOLayer(); - - window.setSize(screenRect.width, screenRect.height); + float scale = getPixelScale(); + pgl.initPresentMode(0.5f * (screenRect.width/scale - sketchWidth), + 0.5f * (screenRect.height/scale - sketchHeight), stopColor); PApplet.hideMenuBar(); - window.setTopLevelPosition(sketchX + screenRect.x, - sketchY + screenRect.y); -// window.setTopLevelPosition(0, 0); - window.setFullscreen(true); - - - placedWindow = true; - if (requestedStart) startThread(); -// } + window.setUndecorated(true); + window.setTopLevelPosition((int) displayRect.getX(), (int) displayRect.getY()); + window.setTopLevelSize((int) displayRect.getWidth(), (int) displayRect.getHeight()); } public void setupExternalMessages() { - // TODO Auto-generated method stub - + external = true; } public void startThread() { if (animator != null) { - if (placedWindow) { - window.setVisible(true); - animator.start(); - requestedStart = false; - } else { - // The GL window is not visible until it has been placed, so we cannot - // start the animator because it requires the window to be visible. - requestedStart = true; - // Need this assignment to bypass the while loop in runSketch, otherwise - // the programs hangs waiting for defaultSize to be false, but it never - // happens because the animation thread is not yet running to avoid showing - // the window in the wrong place: - // https://github.com/processing/processing/issues/3308 -// sketch.defaultSize = false; - } + animator.start(); } } + public void pauseThread() { if (animator != null) { animator.pause(); } } + public void resumeThread() { if (animator != null) { animator.resume(); } } + public boolean stopThread() { + if (drawExceptionHandler != null) { + drawExceptionHandler.interrupt(); + drawExceptionHandler = null; + } if (animator != null) { return animator.stop(); } else { @@ -563,6 +725,7 @@ public boolean stopThread() { } } + public boolean isStopped() { if (animator != null) { return !animator.isAnimating(); @@ -572,51 +735,68 @@ public boolean isStopped() { } - public void setLocation(int x, int y) { - if (window != null) { - window.setTopLevelPosition(x, y); - } + public void setLocation(final int x, final int y) { + display.getEDTUtil().invoke(false, new Runnable() { + @Override + public void run() { + window.setTopLevelPosition(x, y); + } + }); } - public void setSize(int width, int height) { - if (width == sketch.width && height == sketch.height) { - return; - } + public void setSize(int wide, int high) { + if (pgl.presentMode()) return; + // When the surface is set to resizable via surface.setResizable(true), + // a crash may occur if the user sets the window to size zero. + // https://github.com/processing/processing/issues/5052 + if (high <= 0) { + high = 1; + } + if (wide <= 0) { + wide = 1; + } -// if (animator.isAnimating()) { -// System.err.println("3. set size"); + boolean changed = sketch.width != wide || sketch.height != high; - if (!presentMode) { -// sketch.width = width; -// sketch.height = height; - sketch.setSize(width, height); - sketchWidth = width; - sketchHeight = height; - graphics.setSize(width, height); - window.setSize(width, height); - } + sketchWidth = wide; + sketchHeight = high; + sketch.setSize(wide, high); + graphics.setSize(wide, high); -// } + if (changed) { + window.setSize(wide * windowScaleFactor, high * windowScaleFactor); + } } + public float getPixelScale() { - if (graphics.is2X()) { - // Even if the graphics are retina, the user might have moved the window - // into a non-retina monitor, so we need to check - window.getCurrentSurfaceScale(currentPixelScale); - return currentPixelScale[0]; - } else { + if (graphics.pixelDensity == 1) { return 1; } + + if (PApplet.platform == PConstants.MACOSX) { + return getCurrentPixelScale(); + } + + return 2; + } + + private float getCurrentPixelScale() { + // Even if the graphics are retina, the user might have moved the window + // into a non-retina monitor, so we need to check + window.getCurrentSurfaceScale(currentPixelScale); + return currentPixelScale[0]; } + public Component getComponent() { return canvas; } + public void setSmooth(int level) { pgl.reqNumSamples = level; GLCapabilities caps = new GLCapabilities(profile); @@ -632,7 +812,19 @@ public void setSmooth(int level) { config.setChosenCapabilities(caps); } + public void setFrameRate(float fps) { + if (fps < 1) { + PGraphics.showWarning( + "The OpenGL renderer cannot have a frame rate lower than 1.\n" + + "Your sketch will run at 1 frame per second."); + fps = 1; + } else if (fps > 1000) { + PGraphics.showWarning( + "The OpenGL renderer cannot have a frame rate higher than 1000.\n" + + "Your sketch will run at 1000 frames per second."); + fps = 1000; + } if (animator != null) { animator.stop(); animator.setFPS((int)fps); @@ -641,43 +833,61 @@ public void setFrameRate(float fps) { } } + public void requestFocus() { - if (window != null) { - window.requestFocus(); - } + display.getEDTUtil().invoke(false, new Runnable() { + @Override + public void run() { + window.requestFocus(); + } + }); } + class DrawListener implements GLEventListener { public void display(GLAutoDrawable drawable) { - pgl.getGL(drawable); -// System.out.println(" - " + sketch.frameCount); - sketch.handleDraw(); + if (display.getEDTUtil().isCurrentThreadEDT()) { + // For some reason, the first two frames of the animator are run on the + // EDT, skipping rendering Processing's frame in that case. + return; + } - if (sketch.frameCount == 1) { + if (sketch.frameCount == 0) { + if (sketchWidth < sketchWidth0 || sketchHeight < sketchHeight0) { + PGraphics.showWarning("The sketch has been automatically resized to fit the screen resolution"); + } +// System.out.println("display: " + window.getWidth() + " "+ window.getHeight() + " - " + sketchWidth + " " + sketchHeight); requestFocus(); } + if (!sketch.finished) { + pgl.getGL(drawable); + int pframeCount = sketch.frameCount; + sketch.handleDraw(); + if (pframeCount == sketch.frameCount || sketch.finished) { + // This hack allows the FBO layer to be swapped normally even if + // the sketch is no looping or finished because it does not call draw(), + // otherwise background artifacts may occur (depending on the hardware/drivers). + pgl.beginRender(); + pgl.endRender(sketch.sketchWindowColor()); + } + PGraphicsOpenGL.completeFinishedPixelTransfers(); + } + if (sketch.exitCalled()) { -// System.out.println("exit"); - animator.stop(); - sketch.dispose(); + PGraphicsOpenGL.completeAllPixelTransfers(); + + sketch.dispose(); // calls stopThread(), which stops the animator. sketch.exitActual(); } } public void dispose(GLAutoDrawable drawable) { -// pgl.getGL(drawable); -// System.out.println("dispose"); - sketch.dispose(); -// if (sketch.exitCalled()) { -// sketch.exitActual(); -// } +// sketch.dispose(); } public void init(GLAutoDrawable drawable) { -// System.err.println("2. init drawable"); pgl.getGL(drawable); pgl.init(drawable); sketch.start(); -// setSize(sketchWidth, sketchHeight); int c = graphics.backgroundColor; pgl.clearColor(((c >> 16) & 0xff) / 255f, @@ -688,62 +898,46 @@ public void init(GLAutoDrawable drawable) { } public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) { - -// final float[] valReqSurfacePixelScale = window.getRequestedSurfaceScale(new float[2]); - window.getCurrentSurfaceScale(currentPixelScale); -// final float[] nativeSurfacePixelScale = window.getMaximumSurfaceScale(new float[2]); -// System.err.println("[set PixelScale post]: "+ -// valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ -// hasSurfacePixelScale[0]+"x"+hasSurfacePixelScale[1]+" (has), "+ -// nativeSurfacePixelScale[0]+"x"+nativeSurfacePixelScale[1]+" (native)"); - - - - -// System.out.println("reshape: " + w + ", " + h); + pgl.resetFBOLayer(); pgl.getGL(drawable); -// if (!graphics.is2X() && 1 < hasSurfacePixelScale[0]) { -// setSize(w/2, h/2); -// } else { -// setSize(w, h); -// } - setSize((int)(w/currentPixelScale[0]), (int)(h/currentPixelScale[1])); + float scale = PApplet.platform == PConstants.MACOSX ? + getCurrentPixelScale() : getPixelScale(); + setSize((int) (w / scale), (int) (h / scale)); } } + protected class NEWTWindowListener implements com.jogamp.newt.event.WindowListener { public NEWTWindowListener() { super(); } @Override public void windowGainedFocus(com.jogamp.newt.event.WindowEvent arg0) { -// pg.parent.focusGained(null); -// System.err.println("gain focus"); sketch.focused = true; sketch.focusGained(); } @Override public void windowLostFocus(com.jogamp.newt.event.WindowEvent arg0) { -// pg.parent.focusLost(null); -// System.err.println("lost focus"); sketch.focused = false; sketch.focusLost(); } @Override public void windowDestroyNotify(com.jogamp.newt.event.WindowEvent arg0) { -// System.err.println("bye"); - PSurfaceJOGL.this.sketch.dispose(); - PSurfaceJOGL.this.sketch.exitActual(); + sketch.exit(); } @Override public void windowDestroyed(com.jogamp.newt.event.WindowEvent arg0) { + sketch.exit(); } @Override public void windowMoved(com.jogamp.newt.event.WindowEvent arg0) { + if (external) { + sketch.frameMoved(window.getX(), window.getY()); + } } @Override @@ -752,15 +946,10 @@ public void windowRepaint(com.jogamp.newt.event.WindowUpdateEvent arg0) { @Override public void windowResized(com.jogamp.newt.event.WindowEvent arg0) { -// System.err.println("resized"); -// System.err.println(window.hasFocus()); -// window.removeMouseListener(mouseListener); -// mouseListener = new NEWTMouseListener(); -// window.addMouseListener(mouseListener); } - } + // NEWT mouse listener protected class NEWTMouseListener extends com.jogamp.newt.event.MouseAdapter { public NEWTMouseListener() { @@ -802,6 +991,7 @@ public void mouseExited(com.jogamp.newt.event.MouseEvent e) { } } + // NEWT key listener protected class NEWTKeyListener extends com.jogamp.newt.event.KeyAdapter { public NEWTKeyListener() { @@ -820,6 +1010,7 @@ public void keyTyped(com.jogamp.newt.event.KeyEvent e) { } } + protected void nativeMouseEvent(com.jogamp.newt.event.MouseEvent nativeEvent, int peAction) { int modifiers = nativeEvent.getModifiers(); @@ -830,59 +1021,51 @@ protected void nativeMouseEvent(com.jogamp.newt.event.MouseEvent nativeEvent, InputEvent.ALT_MASK); int peButton = 0; - if ((modifiers & InputEvent.BUTTON1_MASK) != 0) { - peButton = PConstants.LEFT; - } else if ((modifiers & InputEvent.BUTTON2_MASK) != 0) { - peButton = PConstants.CENTER; - } else if ((modifiers & InputEvent.BUTTON3_MASK) != 0) { - peButton = PConstants.RIGHT; - } - - if (PApplet.platform == PConstants.MACOSX) { - //if (nativeEvent.isPopupTrigger()) { - if ((modifiers & InputEvent.CTRL_MASK) != 0) { + switch (nativeEvent.getButton()) { + case com.jogamp.newt.event.MouseEvent.BUTTON1: + peButton = PConstants.LEFT; + break; + case com.jogamp.newt.event.MouseEvent.BUTTON2: + peButton = PConstants.CENTER; + break; + case com.jogamp.newt.event.MouseEvent.BUTTON3: peButton = PConstants.RIGHT; - } + break; } int peCount = 0; if (peAction == MouseEvent.WHEEL) { - peCount = nativeEvent.isShiftDown() ? (int)nativeEvent.getRotation()[0] : - (int)nativeEvent.getRotation()[1]; + // Invert wheel rotation count so it matches JAVA2D's + // https://github.com/processing/processing/issues/3840 + peCount = -(nativeEvent.isShiftDown() ? (int)nativeEvent.getRotation()[0]: + (int)nativeEvent.getRotation()[1]); } else { peCount = nativeEvent.getClickCount(); } - window.getCurrentSurfaceScale(currentPixelScale); - int sx = (int)(nativeEvent.getX()/currentPixelScale[0]); - int sy = (int)(nativeEvent.getY()/currentPixelScale[1]); - int mx = sx - (int)offsetX; - int my = sy - (int)offsetY; - - if (presentMode) { + int scale; + if (PApplet.platform == PConstants.MACOSX) { + scale = (int) getCurrentPixelScale(); + } else { + scale = (int) getPixelScale(); + } + int sx = nativeEvent.getX() / scale; + int sy = nativeEvent.getY() / scale; + int mx = sx; + int my = sy; + + if (pgl.presentMode()) { + mx -= (int)pgl.presentX; + my -= (int)pgl.presentY; if (peAction == KeyEvent.RELEASE && - 20 < sx && sx < 20 + 100 && - screenRect.height - 70 < sy && sy < screenRect.height - 20) { -// System.err.println("clicked on exit button"); -// if (externalMessages) { -// System.err.println(PApplet.EXTERNAL_QUIT); -// System.err.flush(); // important -// } -// animator.stop(); + pgl.insideStopButton(sx, sy - screenRect.height / windowScaleFactor)) { sketch.exit(); -// window.destroy(); } - if (mx < 0 || sketchWidth < mx || my < 0 || sketchHeight < my) { return; } } -// if (!graphics.is2X() && 1 < hasSurfacePixelScale[0]) { -// x /= 2; -// y /= 2; -// } - MouseEvent me = new MouseEvent(nativeEvent, nativeEvent.getWhen(), peAction, peModifiers, mx, my, @@ -892,6 +1075,7 @@ protected void nativeMouseEvent(com.jogamp.newt.event.MouseEvent nativeEvent, sketch.postEvent(me); } + protected void nativeKeyEvent(com.jogamp.newt.event.KeyEvent nativeEvent, int peAction) { int peModifiers = nativeEvent.getModifiers() & @@ -907,7 +1091,9 @@ protected void nativeKeyEvent(com.jogamp.newt.event.KeyEvent nativeEvent, keyCode = mapToPConst(code); keyChar = PConstants.CODED; } else if (isHackyKey(code)) { - keyCode = code; + // we can return only one char for ENTER, let it be \n everywhere + keyCode = code == com.jogamp.newt.event.KeyEvent.VK_ENTER ? + PConstants.ENTER : code; keyChar = hackToChar(code, nativeEvent.getKeyChar()); } else { keyCode = code; @@ -944,6 +1130,7 @@ protected void nativeKeyEvent(com.jogamp.newt.event.KeyEvent nativeEvent, } } + private static boolean isPCodedKey(short code) { return code == com.jogamp.newt.event.KeyEvent.VK_UP || code == com.jogamp.newt.event.KeyEvent.VK_DOWN || @@ -955,41 +1142,60 @@ private static boolean isPCodedKey(short code) { code == com.jogamp.newt.event.KeyEvent.VK_WINDOWS; } + // Why do we need this mapping? // Relevant discussion and links here: // http://forum.jogamp.org/Newt-wrong-keycode-for-key-td4033690.html#a4033697 // (I don't think this is a complete solution). private static int mapToPConst(short code) { - if (code == com.jogamp.newt.event.KeyEvent.VK_UP) { - return PConstants.UP; - } else if (code == com.jogamp.newt.event.KeyEvent.VK_DOWN) { - return PConstants.DOWN; - } else if (code == com.jogamp.newt.event.KeyEvent.VK_LEFT) { - return PConstants.LEFT; - } else if (code == com.jogamp.newt.event.KeyEvent.VK_RIGHT) { - return PConstants.RIGHT; - } else if (code == com.jogamp.newt.event.KeyEvent.VK_ALT) { - return PConstants.ALT; - } else if (code == com.jogamp.newt.event.KeyEvent.VK_CONTROL) { - return PConstants.CONTROL; - } else if (code == com.jogamp.newt.event.KeyEvent.VK_SHIFT) { - return PConstants.SHIFT; - } else if (code == com.jogamp.newt.event.KeyEvent.VK_WINDOWS) { - return java.awt.event.KeyEvent.VK_META; - } - return code; + switch (code) { + case com.jogamp.newt.event.KeyEvent.VK_UP: + return PConstants.UP; + case com.jogamp.newt.event.KeyEvent.VK_DOWN: + return PConstants.DOWN; + case com.jogamp.newt.event.KeyEvent.VK_LEFT: + return PConstants.LEFT; + case com.jogamp.newt.event.KeyEvent.VK_RIGHT: + return PConstants.RIGHT; + case com.jogamp.newt.event.KeyEvent.VK_ALT: + return PConstants.ALT; + case com.jogamp.newt.event.KeyEvent.VK_CONTROL: + return PConstants.CONTROL; + case com.jogamp.newt.event.KeyEvent.VK_SHIFT: + return PConstants.SHIFT; + case com.jogamp.newt.event.KeyEvent.VK_WINDOWS: + return java.awt.event.KeyEvent.VK_META; + default: + return code; + } } + private static boolean isHackyKey(short code) { - return code == com.jogamp.newt.event.KeyEvent.VK_BACK_SPACE || - code == com.jogamp.newt.event.KeyEvent.VK_TAB; + switch (code) { + case com.jogamp.newt.event.KeyEvent.VK_BACK_SPACE: + case com.jogamp.newt.event.KeyEvent.VK_TAB: + case com.jogamp.newt.event.KeyEvent.VK_ENTER: + case com.jogamp.newt.event.KeyEvent.VK_ESCAPE: + case com.jogamp.newt.event.KeyEvent.VK_DELETE: + return true; + } + return false; } + private static char hackToChar(short code, char def) { - if (code == com.jogamp.newt.event.KeyEvent.VK_BACK_SPACE) { - return '\b'; - } else if (code == com.jogamp.newt.event.KeyEvent.VK_TAB) { - return '\t'; + switch (code) { + case com.jogamp.newt.event.KeyEvent.VK_BACK_SPACE: + return PConstants.BACKSPACE; + case com.jogamp.newt.event.KeyEvent.VK_TAB: + return PConstants.TAB; + case com.jogamp.newt.event.KeyEvent.VK_ENTER: + return PConstants.ENTER; + case com.jogamp.newt.event.KeyEvent.VK_ESCAPE: + return PConstants.ESC; + case com.jogamp.newt.event.KeyEvent.VK_DELETE: + return PConstants.DELETE; } return def; } @@ -998,39 +1204,105 @@ private static char hackToChar(short code, char def) { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - public void setCursor(int kind) { - PGraphics.showWarning("Cursor types not yet supported in OpenGL, provide your cursor image"); + class CursorInfo { + PImage image; + int x, y; + + CursorInfo(PImage image, int x, int y) { + this.image = image; + this.x = x; + this.y = y; + } + + void set() { + setCursor(image, x, y); + } } + static Map cursors = new HashMap<>(); + static Map cursorNames = new HashMap<>(); + static { + cursorNames.put(PConstants.ARROW, "arrow"); + cursorNames.put(PConstants.CROSS, "cross"); + cursorNames.put(PConstants.WAIT, "wait"); + cursorNames.put(PConstants.MOVE, "move"); + cursorNames.put(PConstants.HAND, "hand"); + cursorNames.put(PConstants.TEXT, "text"); + } - public void setCursor(PImage image, int hotspotX, int hotspotY) { - final Display disp = window.getScreen().getDisplay(); - disp.createNative(); -// BufferedImage jimg = (BufferedImage)image.getNative(); -// IntBuffer buf = IntBuffer.wrap(jimg.getRGB(0, 0, jimg.getWidth(), jimg.getHeight(), -// null, 0, jimg.getWidth())); -// -// final PixelRectangle pixelrect = new PixelRectangle.GenericPixelRect(srcFmt, new Dimension(width, height), -// srcStrideBytes, srcIsGLOriented, srcPixels); -// -// PointerIcon pi = disp.createPointerIcon(PixelRectangle pixelrect, -// hotspotX, -// hotspotY); -// -// window.setPointerIcon(pi); + public void setCursor(int kind) { + if (!cursorNames.containsKey(kind)) { + PGraphics.showWarning("Unknown cursor type: " + kind); + return; + } + CursorInfo cursor = cursors.get(kind); + if (cursor == null) { + String name = cursorNames.get(kind); + if (name != null) { + ImageIcon icon = + new ImageIcon(getClass().getResource("cursors/" + name + ".png")); + PImage img = new PImage(icon.getImage()); + // Most cursors just use the center as the hotspot... + int x = img.width / 2; + int y = img.height / 2; + // ...others are more specific + if (kind == PConstants.ARROW) { + x = 10; y = 7; + } else if (kind == PConstants.HAND) { + x = 12; y = 8; + } else if (kind == PConstants.TEXT) { + x = 16; y = 22; + } + cursor = new CursorInfo(img, x, y); + cursors.put(kind, cursor); + } + } + if (cursor != null) { + cursor.set(); + } else { + PGraphics.showWarning("Cannot load cursor type: " + kind); + } + } + + public void setCursor(PImage image, int hotspotX, int hotspotY) { + Display disp = window.getScreen().getDisplay(); + BufferedImage bimg = (BufferedImage)image.getNative(); + DataBufferInt dbuf = (DataBufferInt)bimg.getData().getDataBuffer(); + int[] ipix = dbuf.getData(); + ByteBuffer pixels = ByteBuffer.allocate(ipix.length * 4); + pixels.asIntBuffer().put(ipix); + PixelFormat format = PixelFormat.ARGB8888; + final Dimension size = new Dimension(bimg.getWidth(), bimg.getHeight()); + PixelRectangle pixelrect = new PixelRectangle.GenericPixelRect(format, size, 0, false, pixels); + final PointerIcon pi = disp.createPointerIcon(pixelrect, hotspotX, hotspotY); + display.getEDTUtil().invoke(false, new Runnable() { + @Override + public void run() { + window.setPointerVisible(true); + window.setPointerIcon(pi); + } + }); } + public void showCursor() { - if (window != null) { - window.setPointerVisible(true); - } + display.getEDTUtil().invoke(false, new Runnable() { + @Override + public void run() { + window.setPointerVisible(true); + } + }); } + public void hideCursor() { - if (window != null) { - window.setPointerVisible(false); - } + display.getEDTUtil().invoke(false, new Runnable() { + @Override + public void run() { + window.setPointerVisible(false); + } + }); } } diff --git a/core/src/processing/opengl/Texture.java b/core/src/processing/opengl/Texture.java index 446a993492..4cc51ba645 100644 --- a/core/src/processing/opengl/Texture.java +++ b/core/src/processing/opengl/Texture.java @@ -1,12 +1,15 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + /* Part of the Processing project - http://processing.org - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -169,18 +172,6 @@ public Texture(PGraphicsOpenGL pg, int width, int height, Object params) { } -// @Override -// protected void finalize() throws Throwable { -// try { -// if (glName != 0) { -// PGraphicsOpenGL.finalizeTextureObject(glName, context); -// } -// } finally { -// super.finalize(); -// } -// } - - //////////////////////////////////////////////////////////// // Init, resize methods @@ -255,8 +246,7 @@ public void init(int width, int height, public void resize(int wide, int high) { - // Marking the texture object as finalized so it is deleted - // when creating the new texture. + // Disposing current resources. dispose(); // Creating new texture with the appropriate size. @@ -350,6 +340,8 @@ public void set(int[] pixels, int x, int y, int w, int h, int format) { loadPixels(w * h); convertToRGBA(pixels, format, w, h); + if (invertedX) flipArrayOnX(rgbaPixels, 1); + if (invertedY) flipArrayOnY(rgbaPixels, 1); updatePixelBuffer(rgbaPixels); pgl.texSubImage2D(glTarget, 0, x, y, w, h, PGL.RGBA, PGL.UNSIGNED_BYTE, pixelBuffer); @@ -1189,10 +1181,6 @@ protected void dispose() { glres = null; glName = 0; } -// if (glName != 0) { -// PGraphicsOpenGL.finalizeTextureObject(glName, context); -// glName = 0; -// } } @@ -1238,10 +1226,10 @@ protected void copyTexture(Texture tex, int x, int y, int w, int h, // FBO copy: pg.pushFramebuffer(); pg.setFramebuffer(tempFbo); - // Clear the color buffer to make sure that the alpha channel is set to - // full transparency - pgl.clearColor(0, 0, 0, 0); - pgl.clear(PGL.COLOR_BUFFER_BIT); + // Replaces anything that this texture might contain in the area being + // replaced by the new one. + pg.pushStyle(); + pg.blendMode(REPLACE); if (scale) { // Rendering tex into "this", and scaling the source rectangle // to cover the entire destination region. @@ -1257,8 +1245,10 @@ protected void copyTexture(Texture tex, int x, int y, int w, int h, 0, 0, tempFbo.width, tempFbo.height, 1, x, y, x + w, y + h, x, y, x + w, y + h); } + pgl.flush(); // Needed to make sure that the change in this texture is + // available immediately. + pg.popStyle(); pg.popFramebuffer(); - updateTexels(x, y, w, h); } @@ -1278,6 +1268,10 @@ protected void copyTexture(int texTarget, int texName, // FBO copy: pg.pushFramebuffer(); pg.setFramebuffer(tempFbo); + // Replaces anything that this texture might contain in the area being + // replaced by the new one. + pg.pushStyle(); + pg.blendMode(REPLACE); if (scale) { // Rendering tex into "this", and scaling the source rectangle // to cover the entire destination region. @@ -1293,6 +1287,9 @@ protected void copyTexture(int texTarget, int texName, 0, 0, tempFbo.width, tempFbo.height, x, y, w, h, x, y, w, h); } + pgl.flush(); // Needed to make sure that the change in this texture is + // available immediately. + pg.popStyle(); pg.popFramebuffer(); updateTexels(x, y, w, h); } diff --git a/core/src/processing/opengl/VertexBuffer.java b/core/src/processing/opengl/VertexBuffer.java index db390c219d..6315ba067a 100644 --- a/core/src/processing/opengl/VertexBuffer.java +++ b/core/src/processing/opengl/VertexBuffer.java @@ -1,7 +1,32 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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, version 2.1. + + 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.opengl; import processing.opengl.PGraphicsOpenGL.GLResourceVertexBuffer; +// TODO: need to combine with PGraphicsOpenGL.VertexAttribute public class VertexBuffer { static protected final int INIT_VERTEX_BUFFER_SIZE = 256; static protected final int INIT_INDEX_BUFFER_SIZE = 512; diff --git a/core/src/processing/opengl/cursors/arrow.png b/core/src/processing/opengl/cursors/arrow.png new file mode 100644 index 0000000000..c727ed4fcb Binary files /dev/null and b/core/src/processing/opengl/cursors/arrow.png differ diff --git a/core/src/processing/opengl/cursors/cross.png b/core/src/processing/opengl/cursors/cross.png new file mode 100644 index 0000000000..58d96ba352 Binary files /dev/null and b/core/src/processing/opengl/cursors/cross.png differ diff --git a/core/src/processing/opengl/cursors/hand.png b/core/src/processing/opengl/cursors/hand.png new file mode 100644 index 0000000000..a291c5c314 Binary files /dev/null and b/core/src/processing/opengl/cursors/hand.png differ diff --git a/core/src/processing/opengl/cursors/license.txt b/core/src/processing/opengl/cursors/license.txt new file mode 100644 index 0000000000..e022dc9cdd --- /dev/null +++ b/core/src/processing/opengl/cursors/license.txt @@ -0,0 +1,27 @@ +These files are based on the DMZ Cursors package, +used with permission from Jakub Steiner +11 September 2015 + + +The MIT License (MIT) + +Copyright (c) 2006 Jakub Steiner +Copyright (c) 2006 Novell, Inc. + +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. + +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/core/src/processing/opengl/cursors/move.png b/core/src/processing/opengl/cursors/move.png new file mode 100644 index 0000000000..e8060df5fb Binary files /dev/null and b/core/src/processing/opengl/cursors/move.png differ diff --git a/core/src/processing/opengl/cursors/text.png b/core/src/processing/opengl/cursors/text.png new file mode 100644 index 0000000000..56965c31b7 Binary files /dev/null and b/core/src/processing/opengl/cursors/text.png differ diff --git a/core/src/processing/opengl/cursors/wait.png b/core/src/processing/opengl/cursors/wait.png new file mode 100644 index 0000000000..82638fb45d Binary files /dev/null and b/core/src/processing/opengl/cursors/wait.png differ diff --git a/core/src/processing/opengl/shaders/ColorFrag.glsl b/core/src/processing/opengl/shaders/ColorFrag.glsl index d5d23ae229..59adfdad3e 100644 --- a/core/src/processing/opengl/shaders/ColorFrag.glsl +++ b/core/src/processing/opengl/shaders/ColorFrag.glsl @@ -1,11 +1,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,7 +18,7 @@ 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 - */ +*/ #ifdef GL_ES precision mediump float; diff --git a/core/src/processing/opengl/shaders/ColorVert.glsl b/core/src/processing/opengl/shaders/ColorVert.glsl index 3736ffd2eb..6e8820c220 100644 --- a/core/src/processing/opengl/shaders/ColorVert.glsl +++ b/core/src/processing/opengl/shaders/ColorVert.glsl @@ -1,11 +1,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +18,7 @@ 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 - */ - -#define PROCESSING_COLOR_SHADER +*/ uniform mat4 transformMatrix; diff --git a/core/src/processing/opengl/shaders/LightFrag.glsl b/core/src/processing/opengl/shaders/LightFrag.glsl index b566c8e5b7..b9cd44726a 100644 --- a/core/src/processing/opengl/shaders/LightFrag.glsl +++ b/core/src/processing/opengl/shaders/LightFrag.glsl @@ -1,11 +1,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,8 +18,8 @@ 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 - */ - +*/ + #ifdef GL_ES precision mediump float; precision mediump int; diff --git a/core/src/processing/opengl/shaders/LightVert-brcm.glsl b/core/src/processing/opengl/shaders/LightVert-brcm.glsl new file mode 100644 index 0000000000..b96caa4b3b --- /dev/null +++ b/core/src/processing/opengl/shaders/LightVert-brcm.glsl @@ -0,0 +1,154 @@ +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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, version 2.1. + + 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 +*/ + +uniform mat4 modelviewMatrix; +uniform mat4 transformMatrix; +uniform mat3 normalMatrix; + +uniform int lightCount; +uniform vec4 lightPosition[8]; +uniform vec3 lightNormal[8]; +uniform vec3 lightAmbient[8]; +uniform vec3 lightDiffuse[8]; +uniform vec3 lightSpecular[8]; +uniform vec3 lightFalloff[8]; +uniform vec2 lightSpot[8]; + +attribute vec4 position; +attribute vec4 color; +attribute vec3 normal; + +attribute vec4 ambient; +attribute vec4 specular; +attribute vec4 emissive; +attribute float shininess; + +varying vec4 vertColor; +varying vec4 backVertColor; + +const float zero_float = 0.0; +const float one_float = 1.0; +const vec3 zero_vec3 = vec3(0.0); +const vec3 minus_one_vec3 = vec3(0.0-1.0); + +float falloffFactor(vec3 lightPos, vec3 vertPos, vec3 coeff) { + vec3 lpv = lightPos - vertPos; + vec3 dist = vec3(one_float); + dist.z = dot(lpv, lpv); + dist.y = sqrt(dist.z); + return one_float / dot(dist, coeff); +} + +float spotFactor(vec3 lightPos, vec3 vertPos, vec3 lightNorm, float minCos, float spotExp) { + vec3 lpv = normalize(lightPos - vertPos); + vec3 nln = minus_one_vec3 * lightNorm; + float spotCos = dot(nln, lpv); + return spotCos <= minCos ? zero_float : pow(spotCos, spotExp); +} + +float lambertFactor(vec3 lightDir, vec3 vecNormal) { + return max(zero_float, dot(lightDir, vecNormal)); +} + +float blinnPhongFactor(vec3 lightDir, vec3 vertPos, vec3 vecNormal, float shine) { + vec3 np = normalize(vertPos); + vec3 ldp = normalize(lightDir - np); + return pow(max(zero_float, dot(ldp, vecNormal)), shine); +} + +void main() { + // Vertex in clip coordinates + gl_Position = transformMatrix * position; + + // Vertex in eye coordinates + vec3 ecVertex = vec3(modelviewMatrix * position); + + // Normal vector in eye coordinates + vec3 ecNormal = normalize(normalMatrix * normal); + vec3 ecNormalInv = ecNormal * minus_one_vec3; + + // Light calculations + vec3 totalAmbient = vec3(0, 0, 0); + + vec3 totalFrontDiffuse = vec3(0, 0, 0); + vec3 totalFrontSpecular = vec3(0, 0, 0); + + vec3 totalBackDiffuse = vec3(0, 0, 0); + vec3 totalBackSpecular = vec3(0, 0, 0); + + // prevent register allocation failure by limiting ourselves to + // two lights for now + for (int i = 0; i < 2; i++) { + if (lightCount == i) break; + + vec3 lightPos = lightPosition[i].xyz; + bool isDir = lightPosition[i].w < one_float; + float spotCos = lightSpot[i].x; + float spotExp = lightSpot[i].y; + + vec3 lightDir; + float falloff; + float spotf; + + if (isDir) { + falloff = one_float; + lightDir = minus_one_vec3 * lightNormal[i]; + } else { + falloff = falloffFactor(lightPos, ecVertex, lightFalloff[i]); + lightDir = normalize(lightPos - ecVertex); + } + + spotf = spotExp > zero_float ? spotFactor(lightPos, ecVertex, lightNormal[i], + spotCos, spotExp) + : one_float; + + if (any(greaterThan(lightAmbient[i], zero_vec3))) { + totalAmbient += lightAmbient[i] * falloff; + } + + if (any(greaterThan(lightDiffuse[i], zero_vec3))) { + totalFrontDiffuse += lightDiffuse[i] * falloff * spotf * + lambertFactor(lightDir, ecNormal); + totalBackDiffuse += lightDiffuse[i] * falloff * spotf * + lambertFactor(lightDir, ecNormalInv); + } + + if (any(greaterThan(lightSpecular[i], zero_vec3))) { + totalFrontSpecular += lightSpecular[i] * falloff * spotf * + blinnPhongFactor(lightDir, ecVertex, ecNormal, shininess); + totalBackSpecular += lightSpecular[i] * falloff * spotf * + blinnPhongFactor(lightDir, ecVertex, ecNormalInv, shininess); + } + } + + // Calculating final color as result of all lights (plus emissive term). + // Transparency is determined exclusively by the diffuse component. + vertColor = vec4(totalAmbient, 0) * ambient + + vec4(totalFrontDiffuse, 1) * color + + vec4(totalFrontSpecular, 0) * specular + + vec4(emissive.rgb, 0); + + backVertColor = vec4(totalAmbient, 0) * ambient + + vec4(totalBackDiffuse, 1) * color + + vec4(totalBackSpecular, 0) * specular + + vec4(emissive.rgb, 0); +} \ No newline at end of file diff --git a/core/src/processing/opengl/shaders/LightVert-vc4.glsl b/core/src/processing/opengl/shaders/LightVert-vc4.glsl index 38366fee1a..ba79726767 100644 --- a/core/src/processing/opengl/shaders/LightVert-vc4.glsl +++ b/core/src/processing/opengl/shaders/LightVert-vc4.glsl @@ -1,11 +1,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +18,7 @@ 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 - */ - -#define PROCESSING_LIGHT_SHADER +*/ uniform mat4 modelviewMatrix; uniform mat4 transformMatrix; @@ -96,12 +96,12 @@ void main() { vec3 totalBackSpecular = vec3(0, 0, 0); // prevent register allocation failure by limiting ourselves to - // two lights for now - for (int i = 0; i < 2; i++) { + // four lights for now + for (int i = 0; i < 4; i++) { if (lightCount == i) break; vec3 lightPos = lightPosition[i].xyz; - bool isDir = zero_float < lightPosition[i].w; + bool isDir = lightPosition[i].w < one_float; float spotCos = lightSpot[i].x; float spotExp = lightSpot[i].y; diff --git a/core/src/processing/opengl/shaders/LightVert.glsl b/core/src/processing/opengl/shaders/LightVert.glsl index 0c351aab7d..470fd4b23c 100644 --- a/core/src/processing/opengl/shaders/LightVert.glsl +++ b/core/src/processing/opengl/shaders/LightVert.glsl @@ -1,11 +1,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +18,7 @@ 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 - */ - -#define PROCESSING_LIGHT_SHADER +*/ uniform mat4 modelviewMatrix; uniform mat4 transformMatrix; @@ -29,7 +29,7 @@ uniform vec4 lightPosition[8]; uniform vec3 lightNormal[8]; uniform vec3 lightAmbient[8]; uniform vec3 lightDiffuse[8]; -uniform vec3 lightSpecular[8]; +uniform vec3 lightSpecular[8]; uniform vec3 lightFalloff[8]; uniform vec2 lightSpot[8]; @@ -47,8 +47,7 @@ varying vec4 backVertColor; const float zero_float = 0.0; const float one_float = 1.0; -const vec3 zero_vec3 = vec3(0.0); -const vec3 minus_one_vec3 = vec3(0.0-1.0); +const vec3 zero_vec3 = vec3(0); float falloffFactor(vec3 lightPos, vec3 vertPos, vec3 coeff) { vec3 lpv = lightPos - vertPos; @@ -60,7 +59,7 @@ float falloffFactor(vec3 lightPos, vec3 vertPos, vec3 coeff) { float spotFactor(vec3 lightPos, vec3 vertPos, vec3 lightNorm, float minCos, float spotExp) { vec3 lpv = normalize(lightPos - vertPos); - vec3 nln = minus_one_vec3 * lightNorm; + vec3 nln = -one_float * lightNorm; float spotCos = dot(nln, lpv); return spotCos <= minCos ? zero_float : pow(spotCos, spotExp); } @@ -84,7 +83,7 @@ void main() { // Normal vector in eye coordinates vec3 ecNormal = normalize(normalMatrix * normal); - vec3 ecNormalInv = ecNormal * minus_one_vec3; + vec3 ecNormalInv = ecNormal * -one_float; // Light calculations vec3 totalAmbient = vec3(0, 0, 0); @@ -99,7 +98,7 @@ void main() { if (lightCount == i) break; vec3 lightPos = lightPosition[i].xyz; - bool isDir = zero_float < lightPosition[i].w; + bool isDir = lightPosition[i].w < one_float; float spotCos = lightSpot[i].x; float spotExp = lightSpot[i].y; @@ -109,7 +108,7 @@ void main() { if (isDir) { falloff = one_float; - lightDir = minus_one_vec3 * lightNormal[i]; + lightDir = -one_float * lightNormal[i]; } else { falloff = falloffFactor(lightPos, ecVertex, lightFalloff[i]); lightDir = normalize(lightPos - ecVertex); diff --git a/core/src/processing/opengl/shaders/LineFrag.glsl b/core/src/processing/opengl/shaders/LineFrag.glsl index dc08a3fa20..09fffcb85c 100644 --- a/core/src/processing/opengl/shaders/LineFrag.glsl +++ b/core/src/processing/opengl/shaders/LineFrag.glsl @@ -1,11 +1,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,7 +18,7 @@ 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 - */ +*/ #ifdef GL_ES precision mediump float; diff --git a/core/src/processing/opengl/shaders/LineVert.glsl b/core/src/processing/opengl/shaders/LineVert.glsl index d16f4d519c..50946ba5ae 100644 --- a/core/src/processing/opengl/shaders/LineVert.glsl +++ b/core/src/processing/opengl/shaders/LineVert.glsl @@ -1,11 +1,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,7 +18,7 @@ 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 - */ +*/ #define PROCESSING_LINE_SHADER @@ -32,54 +34,67 @@ attribute vec4 color; attribute vec4 direction; varying vec4 vertColor; - -vec3 clipToWindow(vec4 clip, vec4 viewport) { - vec3 post_div = clip.xyz / clip.w; - vec2 xypos = (post_div.xy + vec2(1.0, 1.0)) * 0.5 * viewport.zw; - return vec3(xypos, post_div.z * 0.5 + 0.5); -} - -vec4 windowToClipVector(vec2 window, vec4 viewport, float clip_w) { - vec2 xypos = (window / viewport.zw) * 2.0; - return vec4(xypos, 0.0, 0.0) * clip_w; -} void main() { vec4 posp = modelviewMatrix * position; - + vec4 posq = modelviewMatrix * (position + vec4(direction.xyz, 0)); + // Moving vertices slightly toward the camera // to avoid depth-fighting with the fill triangles. // Discussed here: // http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=252848 posp.xyz = posp.xyz * scale; - vec4 clipp = projectionMatrix * posp; + posq.xyz = posq.xyz * scale; + + vec4 p = projectionMatrix * posp; + vec4 q = projectionMatrix * posq; + + // formula to convert from clip space (range -1..1) to screen space (range 0..[width or height]) + // screen_p = (p.xy/p.w + <1,1>) * 0.5 * viewport.zw + + // prevent division by W by transforming the tangent formula (div by 0 causes + // the line to disappear, see https://github.com/processing/processing/issues/5183) + // t = screen_q - screen_p + // + // tangent is normalized and we don't care which direction it points to (+-) + // t = +- normalize( screen_q - screen_p ) + // t = +- normalize( (q.xy/q.w+<1,1>)*0.5*viewport.zw - (p.xy/p.w+<1,1>)*0.5*viewport.zw ) + // + // extract common factor, <1,1> - <1,1> cancels out + // t = +- normalize( (q.xy/q.w - p.xy/p.w) * 0.5 * viewport.zw ) + // + // convert to common divisor + // t = +- normalize( ((q.xy*p.w - p.xy*q.w) / (p.w*q.w)) * 0.5 * viewport.zw ) + // + // remove the common scalar divisor/factor, not needed due to normalize and +- + // (keep viewport - can't remove because it has different components for x and y + // and corrects for aspect ratio, see https://github.com/processing/processing/issues/5181) + // t = +- normalize( (q.xy*p.w - p.xy*q.w) * viewport.zw ) + + vec2 tangent = (q.xy*p.w - p.xy*q.w) * viewport.zw; + + // don't normalize zero vector (line join triangles and lines perpendicular to the eye plane) + tangent = length(tangent) == 0.0 ? vec2(0.0, 0.0) : normalize(tangent); + + // flip tangent to normal (it's already normalized) + vec2 normal = vec2(-tangent.y, tangent.x); + float thickness = direction.w; - - if (thickness != 0.0) { - vec4 posq = posp + modelviewMatrix * vec4(direction.xyz, 0); - posq.xyz = posq.xyz * scale; - vec4 clipq = projectionMatrix * posq; - - vec3 window_p = clipToWindow(clipp, viewport); - vec3 window_q = clipToWindow(clipq, viewport); - vec3 tangent = window_q - window_p; - - vec2 perp = normalize(vec2(-tangent.y, tangent.x)); - vec2 offset = perp * thickness; - - if (0 < perspective) { - // Perspective correction (lines will look thiner as they move away - // from the view position). - gl_Position.xy = clipp.xy + offset.xy; - gl_Position.zw = clipp.zw; - } else { - // No perspective correction. - vec4 offsetp = windowToClipVector(offset, viewport, clipp.w); - gl_Position = clipp + offsetp; - } - } else { - gl_Position = clipp; - } - + vec2 offset = normal * thickness; + + // Perspective --- + // convert from world to clip by multiplying with projection scaling factor + // to get the right thickness (see https://github.com/processing/processing/issues/5182) + // invert Y, projections in Processing invert Y + vec2 perspScale = (projectionMatrix * vec4(1, -1, 0, 0)).xy; + + // No Perspective --- + // multiply by W (to cancel out division by W later in the pipeline) and + // convert from screen to clip (derived from clip to screen above) + vec2 noPerspScale = p.w / (0.5 * viewport.zw); + + gl_Position.xy = p.xy + offset.xy * mix(noPerspScale, perspScale, float(perspective > 0)); + gl_Position.zw = p.zw; + vertColor = color; } diff --git a/core/src/processing/opengl/shaders/MaskFrag.glsl b/core/src/processing/opengl/shaders/MaskFrag.glsl index 508a39649d..74fad83a9d 100644 --- a/core/src/processing/opengl/shaders/MaskFrag.glsl +++ b/core/src/processing/opengl/shaders/MaskFrag.glsl @@ -1,11 +1,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2012-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,7 +18,7 @@ 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 - */ +*/ #ifdef GL_ES precision mediump float; diff --git a/core/src/processing/opengl/shaders/PointFrag.glsl b/core/src/processing/opengl/shaders/PointFrag.glsl index d5d23ae229..59adfdad3e 100644 --- a/core/src/processing/opengl/shaders/PointFrag.glsl +++ b/core/src/processing/opengl/shaders/PointFrag.glsl @@ -1,11 +1,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,7 +18,7 @@ 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 - */ +*/ #ifdef GL_ES precision mediump float; diff --git a/core/src/processing/opengl/shaders/PointVert.glsl b/core/src/processing/opengl/shaders/PointVert.glsl index c677ce75bc..8249e9076f 100644 --- a/core/src/processing/opengl/shaders/PointVert.glsl +++ b/core/src/processing/opengl/shaders/PointVert.glsl @@ -1,11 +1,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +18,7 @@ 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 - */ - -#define PROCESSING_POINT_SHADER +*/ uniform mat4 projectionMatrix; uniform mat4 modelviewMatrix; @@ -32,24 +32,25 @@ attribute vec2 offset; varying vec4 vertColor; -vec4 windowToClipVector(vec2 window, vec4 viewport, float clipw) { - vec2 xypos = (window / viewport.zw) * 2.0; - return vec4(xypos, 0.0, 0.0) * clipw; -} - void main() { vec4 pos = modelviewMatrix * position; vec4 clip = projectionMatrix * pos; - - if (0 < perspective) { - // Perspective correction (points will look thiner as they move away - // from the view position). - gl_Position = clip + projectionMatrix * vec4(offset.xy, 0, 0); - } else { - // No perspective correction. - vec4 offset = windowToClipVector(offset.xy, viewport, clip.w); - gl_Position = clip + offset; - } + + // Perspective --- + // convert from world to clip by multiplying with projection scaling factor + // invert Y, projections in Processing invert Y + vec2 perspScale = (projectionMatrix * vec4(1, -1, 0, 0)).xy; + + // formula to convert from clip space (range -1..1) to screen space (range 0..[width or height]) + // screen_p = (p.xy/p.w + <1,1>) * 0.5 * viewport.zw + + // No Perspective --- + // multiply by W (to cancel out division by W later in the pipeline) and + // convert from screen to clip (derived from clip to screen above) + vec2 noPerspScale = clip.w / (0.5 * viewport.zw); + + gl_Position.xy = clip.xy + offset.xy * mix(noPerspScale, perspScale, float(perspective > 0)); + gl_Position.zw = clip.zw; vertColor = color; -} \ No newline at end of file +} diff --git a/core/src/processing/opengl/shaders/TexFrag.glsl b/core/src/processing/opengl/shaders/TexFrag.glsl index f041e61d13..5e236ee915 100644 --- a/core/src/processing/opengl/shaders/TexFrag.glsl +++ b/core/src/processing/opengl/shaders/TexFrag.glsl @@ -1,11 +1,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,7 +18,7 @@ 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 - */ +*/ #ifdef GL_ES precision mediump float; diff --git a/core/src/processing/opengl/shaders/TexLightFrag.glsl b/core/src/processing/opengl/shaders/TexLightFrag.glsl index f423e49d30..1e9cc7e194 100644 --- a/core/src/processing/opengl/shaders/TexLightFrag.glsl +++ b/core/src/processing/opengl/shaders/TexLightFrag.glsl @@ -1,11 +1,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,8 +18,7 @@ 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 - */ - +*/ #ifdef GL_ES precision mediump float; precision mediump int; diff --git a/core/src/processing/opengl/shaders/TexLightVert-brcm.glsl b/core/src/processing/opengl/shaders/TexLightVert-brcm.glsl new file mode 100644 index 0000000000..51e88ab056 --- /dev/null +++ b/core/src/processing/opengl/shaders/TexLightVert-brcm.glsl @@ -0,0 +1,160 @@ +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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, version 2.1. + + 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 +*/ + +uniform mat4 modelviewMatrix; +uniform mat4 transformMatrix; +uniform mat3 normalMatrix; +uniform mat4 texMatrix; + +uniform int lightCount; +uniform vec4 lightPosition[8]; +uniform vec3 lightNormal[8]; +uniform vec3 lightAmbient[8]; +uniform vec3 lightDiffuse[8]; +uniform vec3 lightSpecular[8]; +uniform vec3 lightFalloff[8]; +uniform vec2 lightSpot[8]; + +attribute vec4 position; +attribute vec4 color; +attribute vec3 normal; +attribute vec2 texCoord; + +attribute vec4 ambient; +attribute vec4 specular; +attribute vec4 emissive; +attribute float shininess; + +varying vec4 vertColor; +varying vec4 backVertColor; +varying vec4 vertTexCoord; + +const float zero_float = 0.0; +const float one_float = 1.0; +const vec3 zero_vec3 = vec3(0.0); +const vec3 minus_one_vec3 = vec3(0.0-1.0); + +float falloffFactor(vec3 lightPos, vec3 vertPos, vec3 coeff) { + vec3 lpv = lightPos - vertPos; + vec3 dist = vec3(one_float); + dist.z = dot(lpv, lpv); + dist.y = sqrt(dist.z); + return one_float / dot(dist, coeff); +} + +float spotFactor(vec3 lightPos, vec3 vertPos, vec3 lightNorm, float minCos, float spotExp) { + vec3 lpv = normalize(lightPos - vertPos); + vec3 nln = minus_one_vec3 * lightNorm; + float spotCos = dot(nln, lpv); + return spotCos <= minCos ? zero_float : pow(spotCos, spotExp); +} + +float lambertFactor(vec3 lightDir, vec3 vecNormal) { + return max(zero_float, dot(lightDir, vecNormal)); +} + +float blinnPhongFactor(vec3 lightDir, vec3 vertPos, vec3 vecNormal, float shine) { + vec3 np = normalize(vertPos); + vec3 ldp = normalize(lightDir - np); + return pow(max(zero_float, dot(ldp, vecNormal)), shine); +} + +void main() { + // Vertex in clip coordinates + gl_Position = transformMatrix * position; + + // Vertex in eye coordinates + vec3 ecVertex = vec3(modelviewMatrix * position); + + // Normal vector in eye coordinates + vec3 ecNormal = normalize(normalMatrix * normal); + vec3 ecNormalInv = ecNormal * minus_one_vec3; + + // Light calculations + vec3 totalAmbient = vec3(0, 0, 0); + + vec3 totalFrontDiffuse = vec3(0, 0, 0); + vec3 totalFrontSpecular = vec3(0, 0, 0); + + vec3 totalBackDiffuse = vec3(0, 0, 0); + vec3 totalBackSpecular = vec3(0, 0, 0); + + // prevent register allocation failure by limiting ourselves to + // two lights for now + for (int i = 0; i < 2; i++) { + if (lightCount == i) break; + + vec3 lightPos = lightPosition[i].xyz; + bool isDir = lightPosition[i].w < one_float; + float spotCos = lightSpot[i].x; + float spotExp = lightSpot[i].y; + + vec3 lightDir; + float falloff; + float spotf; + + if (isDir) { + falloff = one_float; + lightDir = minus_one_vec3 * lightNormal[i]; + } else { + falloff = falloffFactor(lightPos, ecVertex, lightFalloff[i]); + lightDir = normalize(lightPos - ecVertex); + } + + spotf = spotExp > zero_float ? spotFactor(lightPos, ecVertex, lightNormal[i], + spotCos, spotExp) + : one_float; + + if (any(greaterThan(lightAmbient[i], zero_vec3))) { + totalAmbient += lightAmbient[i] * falloff; + } + + if (any(greaterThan(lightDiffuse[i], zero_vec3))) { + totalFrontDiffuse += lightDiffuse[i] * falloff * spotf * + lambertFactor(lightDir, ecNormal); + totalBackDiffuse += lightDiffuse[i] * falloff * spotf * + lambertFactor(lightDir, ecNormalInv); + } + + if (any(greaterThan(lightSpecular[i], zero_vec3))) { + totalFrontSpecular += lightSpecular[i] * falloff * spotf * + blinnPhongFactor(lightDir, ecVertex, ecNormal, shininess); + totalBackSpecular += lightSpecular[i] * falloff * spotf * + blinnPhongFactor(lightDir, ecVertex, ecNormalInv, shininess); + } + } + + // Calculating final color as result of all lights (plus emissive term). + // Transparency is determined exclusively by the diffuse component. + vertColor = vec4(totalAmbient, 0) * ambient + + vec4(totalFrontDiffuse, 1) * color + + vec4(totalFrontSpecular, 0) * specular + + vec4(emissive.rgb, 0); + + backVertColor = vec4(totalAmbient, 0) * ambient + + vec4(totalBackDiffuse, 1) * color + + vec4(totalBackSpecular, 0) * specular + + vec4(emissive.rgb, 0); + + // Calculating texture coordinates, with r and q set both to one + vertTexCoord = texMatrix * vec4(texCoord, 1.0, 1.0); +} diff --git a/core/src/processing/opengl/shaders/TexLightVert-vc4.glsl b/core/src/processing/opengl/shaders/TexLightVert-vc4.glsl index daa4680fb2..f54277e812 100644 --- a/core/src/processing/opengl/shaders/TexLightVert-vc4.glsl +++ b/core/src/processing/opengl/shaders/TexLightVert-vc4.glsl @@ -1,11 +1,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +18,7 @@ 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 - */ - -#define PROCESSING_TEXLIGHT_SHADER +*/ uniform mat4 modelviewMatrix; uniform mat4 transformMatrix; @@ -99,12 +99,12 @@ void main() { vec3 totalBackSpecular = vec3(0, 0, 0); // prevent register allocation failure by limiting ourselves to - // two lights for now - for (int i = 0; i < 2; i++) { + // four lights for now + for (int i = 0; i < 4; i++) { if (lightCount == i) break; vec3 lightPos = lightPosition[i].xyz; - bool isDir = zero_float < lightPosition[i].w; + bool isDir = lightPosition[i].w < one_float; float spotCos = lightSpot[i].x; float spotExp = lightSpot[i].y; diff --git a/core/src/processing/opengl/shaders/TexLightVert.glsl b/core/src/processing/opengl/shaders/TexLightVert.glsl index 478c91ca22..6ef7d4bb7c 100644 --- a/core/src/processing/opengl/shaders/TexLightVert.glsl +++ b/core/src/processing/opengl/shaders/TexLightVert.glsl @@ -1,11 +1,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +18,7 @@ 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 - */ - -#define PROCESSING_TEXLIGHT_SHADER +*/ uniform mat4 modelviewMatrix; uniform mat4 transformMatrix; @@ -30,7 +30,7 @@ uniform vec4 lightPosition[8]; uniform vec3 lightNormal[8]; uniform vec3 lightAmbient[8]; uniform vec3 lightDiffuse[8]; -uniform vec3 lightSpecular[8]; +uniform vec3 lightSpecular[8]; uniform vec3 lightFalloff[8]; uniform vec2 lightSpot[8]; @@ -50,8 +50,7 @@ varying vec4 vertTexCoord; const float zero_float = 0.0; const float one_float = 1.0; -const vec3 zero_vec3 = vec3(0.0); -const vec3 minus_one_vec3 = vec3(0.0-1.0); +const vec3 zero_vec3 = vec3(0); float falloffFactor(vec3 lightPos, vec3 vertPos, vec3 coeff) { vec3 lpv = lightPos - vertPos; @@ -63,7 +62,7 @@ float falloffFactor(vec3 lightPos, vec3 vertPos, vec3 coeff) { float spotFactor(vec3 lightPos, vec3 vertPos, vec3 lightNorm, float minCos, float spotExp) { vec3 lpv = normalize(lightPos - vertPos); - vec3 nln = minus_one_vec3 * lightNorm; + vec3 nln = -one_float * lightNorm; float spotCos = dot(nln, lpv); return spotCos <= minCos ? zero_float : pow(spotCos, spotExp); } @@ -87,7 +86,7 @@ void main() { // Normal vector in eye coordinates vec3 ecNormal = normalize(normalMatrix * normal); - vec3 ecNormalInv = ecNormal * minus_one_vec3; + vec3 ecNormalInv = ecNormal * -one_float; // Light calculations vec3 totalAmbient = vec3(0, 0, 0); @@ -102,7 +101,7 @@ void main() { if (lightCount == i) break; vec3 lightPos = lightPosition[i].xyz; - bool isDir = zero_float < lightPosition[i].w; + bool isDir = lightPosition[i].w < one_float; float spotCos = lightSpot[i].x; float spotExp = lightSpot[i].y; @@ -112,7 +111,7 @@ void main() { if (isDir) { falloff = one_float; - lightDir = minus_one_vec3 * lightNormal[i]; + lightDir = -one_float * lightNormal[i]; } else { falloff = falloffFactor(lightPos, ecVertex, lightFalloff[i]); lightDir = normalize(lightPos - ecVertex); diff --git a/core/src/processing/opengl/shaders/TexVert.glsl b/core/src/processing/opengl/shaders/TexVert.glsl index 87f101536a..3bc62e32fa 100644 --- a/core/src/processing/opengl/shaders/TexVert.glsl +++ b/core/src/processing/opengl/shaders/TexVert.glsl @@ -1,11 +1,13 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-13 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2004-12 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 version 2.1 as published by the Free Software Foundation. + License as published by the Free Software Foundation, version 2.1. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +18,7 @@ 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 - */ - -#define PROCESSING_TEXTURE_SHADER +*/ uniform mat4 transformMatrix; uniform mat4 texMatrix; diff --git a/core/todo.txt b/core/todo.txt index 0fe001eaa8..8055db170c 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,99 +1,49 @@ -0243 core (3.0b5) - -jakub -X keyTyped() not firing with P2D and P3D -X https://github.com/processing/processing/issues/3582 -X https://github.com/processing/processing/pull/3652 - - -known issues -_ P2D and P3D windows behave strangely when larger than the screen size -_ https://github.com/processing/processing/issues/3401 - - -docs -_ note that full screen and present are now different -_ on Export to Application, this has an impact -_ update wiki/docs to say "don't override sketchXxxx() methods" - - -3.0 final -_ move blending calculations from PImage into PGraphics -_ tricky because that means moving blend_resize() as well -_ and should that live in PGraphics or be its own class or ?? -_ move AWT image loading into PImageAWT -_ look into how GL and FX will handle from there -_ run only the necessary pieces on the EDT -_ in part because FX doesn't even use the EDT -_ re-check the Linux frame visibility stuff -_ try using Frame instead of JFrame -_ default sketch location using insets incorrectly -_ use the BufferStrategy directly from the Frame object? -_ might fix performance issues w/ Presentation mode -_ sketch placement (window insets) not properly set on Linux -_ https://github.com/processing/processing/issues/2063 - - -javafx -_ static mode sketches (draw once and halt w/o closing window) -_ fix display handling, line up the device order with AWT -_ https://docs.oracle.com/javafx/2/api/javafx/stage/Screen.html -_ noLoop() -_ keyChar and keyCode are super wonky and unlike AWT -_ https://github.com/processing/processing/issues/3290 -_ what's the way to do this after the deprecation? -_ if this is going to be the default renderer, has to be ironed out -_ displayWidth, displayHeight, full screen, display number -_ present mode not working at all -_ stage in the center, clear the rest of the screen -_ createGraphics() should probably create PGraphicsJava2D -_ or is Canvas specific to the PGraphics, and we get another Context2D? -_ http://docs.oracle.com/javafx/2/api/javafx/scene/canvas/Canvas.html -_ loadPixels() (also 2x) -_ text and fonts? -_ maybe helpful: https://wiki.openjdk.java.net/display/OpenJFX/Font+Setup -_ updatePixels() -_ save() and saveFrame() -_ get() and set() -_ clip/noClip -_ https://github.com/processing/processing/issues/3274 -_ getNative() in PImage problematic because it gives back a BufferedImage -_ move loadImage() into PGraphics, with AWT version the default? -_ or pass createImage() through to renderer? -_ implement frameRate() -_ implement external messages (moving the window) -_ implement PSurfaceFX.setIcon() -_ javafx not supported with ARM (so we're screwed on raspberry pi) -_ https://www.linkedin.com/pulse/oracle-just-removed-javafx-support-arm-jan-snelders - - -opengl -_ Use PBOs for async texture copy -_ https://github.com/processing/processing/issues/3569 -_ filter(PShader) broken in HiDPI mode -_ https://github.com/processing/processing/issues/3577 -_ hard crash at 1920x1080, mirrored, Casey's GT 650M 1GB -_ window loses focus after maximizing -_ https://github.com/processing/processing/issues/3339 -_ Implement standard cursor types in OpenGL -_ https://github.com/processing/processing/issues/3554 - - -opengl questions -_ issues with how JOGL handles window layout/sizing -_ https://github.com/processing/processing/issues/3401 -_ exitCalled() and exitActual made public by Andres, breaks Python -_ also not API we want to expose, so sort this out -_ or maybe we're fine b/c now FX2D needs it as well -_ when did setPath() sneak into PShape? API is nothing like anything else -_ probably from the material stuff, but we need to fix that -_ why is createShape() implemented 4x (for P2D, P3D, and 2x versions)? -_ shouldn't be static, run it from the renderer, that's point of createXxx() -_ public createShape() method that takes another shape as param? -_ should just be the constructor doing this, or copy() - - -full screen +0271 (3.5.5 unlikely) + +contribs +X getShape() - Type of vertex was wrong for Cubic +X https://github.com/processing/processing/pull/6092 + + +_ size() issues on Mojave? +_ https://github.com/processing/processing/issues/5791 +_ use exit event to set mouseY to 0 on macOS +_ https://github.com/processing/processing/pull/5796/files +_ possible fix for precision issues with PDF +_ https://github.com/processing/processing/issues/5801#issuecomment-466632459 + + +high-ish +_ add separator option to loadTable() +_ https://github.com/processing/processing/issues/5068 +_ make setting the window icon automatic, based on files in local dirs +X https://github.com/processing/processing/issues/5123 +X https://github.com/processing/processing/pull/5202 +_ need to make this work behind the scenes instead +_ create icon.png or have an 'icons' folder with multiple sizes +_ don't override the window icon w/ p5 logo if already set +_ NullPointerException at java.awt.Window.init(Window.java:497) when using Airplay +_ https://github.com/processing/processing/issues/5620 +_ try to catch the NPE and warn the user about what's happening +_ requestSize() and xxxxTitle() (to diminish use of 'surface') +_ mostly held up by cross-renderer inconsistency with these +_ textAlign(CENTER) and pixelDensity(2) aligning incorrectly with Java2D +_ https://github.com/processing/processing/issues/4020 +_ calling textSize() fixes it, only hpapens with the default font +_ incorrect textWidth() with pixelDensity(2) when textFont() not used +_ https://github.com/processing/processing/issues/5768 + + +retina/hi-dpi/sizing +_ implement sketch scaling into PApplet +_ https://github.com/processing/processing/issues/4897 +_ Sketches on Windows don't take UI sizing into account +_ https://github.com/processing/processing/issues/4894 +_ Sketches on Linux don't take UI scaling into account +_ https://github.com/processing/processing/issues/4895 +_ gohai says "xrdb -query" or "xdpyinfo" might work +_ should fullScreen() set width and height to displayWidth/Height +_ or is that being set/unset used for any state info? _ present window draws in stages (OS X) _ crash on startup when "Mirror Displays" selected (cantfix?) _ suspect that this is a specific chipset since Oracle didn't reproduce @@ -101,31 +51,28 @@ _ AMD Radeon HD 6770M was in the Oracle bug report _ https://github.com/processing/processing/issues/2186 _ https://bugs.openjdk.java.net/browse/JDK-8027391 _ test with JG's 13" retina laptop -_ Ubuntu Unity prevents full screen from working properly -_ https://github.com/processing/processing/issues/3158 -_ fullScreen(SPAN) reported not working (cannot reproduce) -X probably need to re-query for displays each time opening prefs -X what happens when a screen is added after p5 has started? -_ https://github.com/processing/processing/issues/3381 -graphics -_ need to be able to call pixelDensity(2) before beginDraw() -_ add pixelDensity() method to PImage/PGraphics -_ pixelDensity(2) does: pixelWidth = width; width /= 2; pixelDensity = 2; -_ this works for both PGraphics and images (though they're a little backwards) -_ for PGraphics it comes early enough -_ should the re-alloc of the drawing surface happen in beginDraw() -_ that way it won't blit to the screen until we have a fresh redraw? -_ otherwise it'll also be resizing on another thread.. badness -_ how to allocation image object w/ createGraphics() (since no surface) -_ createGraphics() currently broken in Java2D -_ size() command not working to do a resize -_ need a programmatic way to set size -_ deal with applySettings() change (maybe not a problem?) -_ check on performance of the new EDT setup -_ present mode is 30-40% slower than windowed -_ w/ this example: https://github.com/processing/processing/issues/2423 +misc +_ should we drop the 'default' prefix from the ex handler so it's not static? +_ http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.html +_ Switch to getModifiersEx() and fix the AWT modifiers used in PSurfaceAWT +_ this is an easy fix, but need to check impact elsewhere +_ does anything else rely on these modifiers? +_ try using Frame instead of JFrame +_ default sketch location using insets incorrectly +_ use the BufferStrategy directly from the Frame object? +_ might fix performance issues w/ Presentation mode +_ sketch placement (window insets) not properly set on Linux +_ https://github.com/processing/processing/issues/2063 +_ note in docs that full screen and present are now different +_ on Export to Application, this has an impact +_ SVG only exports last frame +_ possibly because Java2D is disposing the Graphics2D in between? +_ https://github.com/processing/processing/issues/3753 +_ when calling exit(), if sketch has halted w/ exception, force the quit +_ otherwise have to double-quit with cmd-q on OS X +_ simple test case: using size() inside setup() from Eclipse data @@ -145,43 +92,20 @@ _ row count and array size are combined.. need to break apart _ match and iterators _ add match version that returns table that's only a pointer to original _ save the constructor for the version that actually copies data -_ the table pointer version will be speedy and allow chaining +_ the table pointer version will be speedy and allow chaining -high -_ point() rendering differently in 2.0.3 and 2.1 -_ https://github.com/processing/processing/issues/2278 -_ internally, we probably have to call set() if it's a 1 pixel point -_ but that's going to be a mess.. need to first check the CTM -_ tint() not working in PDF (regression between 2.0.3 and 2.1) -_ https://github.com/processing/processing/issues/2428 -_ finish PFont.getShape() implementation -_ needs to have a way to set width/height properly -_ draw(s) doesn't work on the returned PShape -_ y-location of frame might be negative, but that might be ok -_ right now, on Windows it moves it on-screen (b/c of previous bug reports) -_ may be cause of some of the display placement issues w/ multiple displays -_ seem to recall one of the bugs mentioning stacked displays -_ need to change to iterate through display rectangles -_ may be related to full-screen bug filed recently -_ closing a sketch window manually (not hitting Stop) not killing sketch -_ at least with the Java2D renderer -_ don't override the window icon w/ p5 logo if already set - - -retina/hidpi -_ How do images behave when pixelDensity(2) is set? -_ https://github.com/processing/processing/issues/3364 -_ no high-dpi support for core on Windows -_ https://github.com/processing/processing/issues/2411 -_ retina sketches slow to start -_ https://github.com/processing/processing/issues/2357 -_ zero alpha values still a problem with retina renderer -_ https://github.com/processing/processing/issues/2030 - - -decisions/misc -_ Separately, if we wanted, we could add a method that can safely do drawing calls, but that won't be any faster or make use of more processors the way that `thread()` does. +discussion/decisions +_ how to handle the touch api +_ can't do MouseEvent et al with Android +_ http://dvcs.w3.org/hg/webevents/raw-file/tip/touchevents.html +_ http://www.html5rocks.com/en/mobile/touch.html +_ decision: go with what looks like javascript/ios +_ touchEvent(), gestureEvent()? +_ size() function that scales to screen, keeps aspect, re-scales mouse coords +_ add screen(PVector), model(PVector) and world(PVector)? +_ maybe screenVec()? or screenXYZ()? +_ Separately, if we wanted, we could add a method that can safely do drawing calls, but that won't be any faster or make use of more processors the way that `thread()` does. _ need reference update for createShape() _ though we need to verify the behavior here _ createShape(RECT) uses x/y/w/h, and optionally adds a mode param @@ -204,12 +128,9 @@ _ fix the registered methods doc, stop/dispose working _ Casey needs to nudge people about libraries, so we need to fix this _ pause(), resume(), start(), stop() clarifications _ dispose/stop not great w/ libraries yet -_ PShape complete refactoring _ proper touch events _ touch event doesn't make sense for mouseMove on desktop, hover on Android _ probably go with pointer: more universal for touch/mouse -_ high-level touch events (swipe, et al) -_ if Andres is done, they go in, if not then 3.0 _ move away from loadPixels _ add options for image.save() (or saveImage?) _ add quality=[0,1] for jpeg images @@ -222,16 +143,16 @@ _ public float textWidth(char[] chars, int start, int length) _ add version of math functions that use doubles? _ what other methods should work with doubles? all math functions? _ seems like internal (mostly static) things, but not graphics api -_ new PGraphics(... OutputStream) +_ new PGraphics(... OutputStream) _ https://github.com/processing/processing/issues/285 _ already added for PDF, just need to work out the API _ if save() returns boolean, does saveFrame()? _ also need to copy this over to android _ "translate, or this variation of it" when using text(s, x, y, z) accidentally _ change to be the text command -_ size() and resize() and whatever? +_ size() and resize() and whatever? _ should be setSize(), but that's odd for image files -_ -> resize() is fine with PImage and PGraphics... +_ -> resize() is fine with PImage and PGraphics... _ we may be inheriting the resize() from Java -> make it final? _ add resize().. make it call setSize(). _ also needs to do a redraw if noLoop() has been called @@ -265,7 +186,7 @@ _ have to pass PApplet just to make the rendering work to both renderers _ should instead be a renderer that splits things out _ wrap exceptions with die() and warn() methods _ this way, people can make use of exceptions if they would rather -_ or shut them off if they don't want to +_ or shut them off if they don't want to _ also need to explain exception handling in general _ https://github.com/processing/processing/issues/222 _ bring PConstants back in line w/ previous 1.5 (can't renumber) @@ -278,21 +199,20 @@ _ add reference/docs for urlEncode() and urlDecode() _ add explanation to the reference about using beginRecord() with fonts _ pdf.textMode(SHAPE) _ also set the font *after* the record has started -_ maybe should instead make textMode(SHAPE) the norm? +_ maybe should instead make textMode(SHAPE) the norm? _ and people can change it to textMode(MODEL) if they want? _ http://dev.processing.org/bugs/show_bug.cgi?id=1535 (no gcode) _ explain the new PGL interface _ decide how disconnectEvent should actually be handled (and name?) -_ was disconnect always there? +_ was disconnect always there? _ will need documentation _ negative indices so that we can work relative to the end in data classes? -_ add Double and Long versions of the data classes? _ add requestFocus() method to PApplet (or surface?) -o destroy() removed, but bring back? is that better than dispose()? -_ destroy() only called dispose(), so no difference -_ Python Mode has a hook for when it's called -_ probably should also check to make sure PApplet running JVM 8 -_ or compile against 1.8 and force it? +_ point() rendering differently in 2.0.3 and 2.1 +_ https://github.com/processing/processing/issues/2278 +_ internally, we probably have to call set() if it's a 1 pixel point +_ but that's going to be a mess.. need to first check the CTM +_ discussion from Jakub in the report @@ -312,7 +232,7 @@ _ http://www.javalobby.org/forums/thread.jspa?threadID=16867&tstart=0 _ http://www.gamedev.net/page/resources/_/technical/general-programming/java-games-active-rendering-r2418 -CORE / stop() +CORE / stop() _ in PApplet.main(), windowClosing() should probably be calling 'exit()' _ or rather, we should never call System.exit(0), ja? @@ -342,7 +262,7 @@ _ if not looping, need to do it immediately _ does stop() unwind the thread, or does the thread unwind call stop? _ browser will call start() and stop() methods _ need to figure out start/stop signals coming from the browser -_ is it dispose/destroy? +_ is it dispose/destroy? _ when closing a sketch via the close box, make sure stop() getting called _ test to see if it's working _ what's up with stop() vs exit()? @@ -356,21 +276,33 @@ _ noloop ref even says that redraw will be called on resize, make sure it is _ focus not coming through, ESC no longer working(?) _ hitting cmd-q when an applet is running quits p5 (on macosx) _ but cmd-q when running externally is ok because it just quits -_ is there a way to catch cmd-q when running a sketch? +_ is there a way to catch cmd-q when running a sketch? _ so that it could avoid quitting if the sketch hasn't been stopped _ or if the sketch window is foremost -_ maybe a hack where a new menubar is added? +_ maybe a hack where a new menubar is added? +o destroy() removed, but bring back? is that better than dispose()? +_ destroy() only called dispose(), so no difference +_ Python Mode has a hook for when it's called CORE / PFont and text() +_ finish PFont.getShape() implementation +_ needs to have a way to set width/height properly +_ draw(s) doesn't work on the returned PShape +_ y-location of frame might be negative, but that might be ok +_ right now, on Windows it moves it on-screen (b/c of previous bug reports) +_ may be cause of some of the display placement issues w/ multiple displays +_ seem to recall one of the bugs mentioning stacked displays +_ need to change to iterate through display rectangles +_ may be related to full-screen bug filed recently +_ when doing createFont, can we add it to the os fonts available? _ font rotation (native font problem?) with natives? _ https://github.com/processing/processing/issues/731 _ Text rotation, placement and font metrics incorrect when scaled _ https://github.com/processing/processing/issues/2167 - _ remove subsetting stuff from PFont? -_ or use hint(ENABLE_FONT_SUBSETTING)? +_ or use hint(ENABLE_FONT_SUBSETTING)? _ what's the difference with ascent on loadFont vs. createFont? _ svg fonts _ would be nifty if we could convert on the fly to ttf for speed... @@ -384,7 +316,7 @@ _ book example 25-03 _ accessors inside PFont need a lot of work _ improve font metrics _ http://java.sun.com/products/java-media/2D/reference/faqs/index.html#Q_How_do_I_obtain_font_metrics -_ font encoding issues +_ font encoding issues _ java seems to force straight windows encoding.. (problem for pi fonts) _ opentype/cff fonts don't work with live loading from the app _ many (all?) opentype fonts won't show up or aren't supported @@ -397,11 +329,11 @@ _ make screen space fonts use get/set as well? _ too much to debug on their own _ unfortunately tint not set with setImpl, but... _ not having kerning really blows -_ could this be pulled from the OpenType font stuff? +_ could this be pulled from the OpenType font stuff? _ it could be placed at the end of the file _ not having fractional widths on small fonts really blows _ screen space text looks crappy -_ working with vector fonts? +_ working with vector fonts? _ need to be able to handle shapes within shapes (reverse winding) _ ftgl: main code is in FTVectoriser _ uses gluTessBeginContour and gluTessEndContour @@ -416,29 +348,39 @@ CORE / PImage _ TGA files writing strangely _ https://github.com/processing/processing/issues/2096 - -_ don't grab pixels of java2d images unless asked -_ this is the difference between a lot of loadPixels() and not -_ so important to have it in before beta if that's the change -_ https://github.com/processing/processing/issues/99 _ loadPixels() implementation needs to be in PApplet, not PGraphics -_ this is a tricky thing to implement because of how OpenGL is handled - +_ this is a tricky thing to implement because of how OpenGL is handled _ loadImage() should use the faster loading methods _ hint(DISABLE_IMAGE_CACHING) _ add a note to the loadImage() reference page _ figure out why 1024x768 image takes 3.5 seconds to load _ would using a BufferedImage work better? _ is the image actually a BufferedImage so PixelGrabber is a waste? - _ deprecate the blend() function - +_ move blending calculations from PImage into PGraphics +_ tricky because that means moving blend_resize() as well +_ and should that live in PGraphics or be its own class or ?? _ implement unified means to specify smoothing level for image scaling _ https://github.com/processing/processing/issues/204 +CORE / PGraphics + +_ need to be able to call pixelDensity(2) before beginDraw() +_ add pixelDensity() method to PImage/PGraphics +_ pixelDensity(2) does: pixelWidth = width; width /= 2; pixelDensity = 2; +_ this works for both PGraphics and images (though they're a little backwards) +_ for PGraphics it comes early enough +_ should the re-alloc of the drawing surface happen in beginDraw() +_ that way it won't blit to the screen until we have a fresh redraw? +_ otherwise it'll also be resizing on another thread.. badness +_ how to allocation image object w/ createGraphics() (since no surface) + + CORE / PShape +_ TRIANGLE_STRIP not working correctly with createShape() and default renderer +_ https://github.com/processing/processing/issues/4678 _ major refactoring for PShape/PShapeOpenGL _ https://github.com/processing/processing/issues/1623 _ PShape should be cached as well @@ -456,7 +398,7 @@ _ trying to remember why primitive was changed to kind? (better name?) _ these aren't per-vertex: _ get/setStrokeWeight _ get/setAmbient -_ get/setEmissive +_ get/setEmissive _ get/setShininess _ boolean isGL() -> now removed _ unapproved (made protected) @@ -467,7 +409,6 @@ _ void setParams() _ void setPath() _ colorCalc() methods added to PShape.. should just be used from PGraphics _ loadShape() needs to live in PApplet -_ make PShapeOpenGL a cache object _ don't allow things inside begin/endShape() that aren't possible _ better lockout inside beginShape() to keep other things from happening _ don't allow you to draw stroked items unless stroke() is called @@ -513,13 +454,76 @@ _ PShape getVertex() not implemented properly for SVG files _ https://github.com/processing/processing/issues/1596 -CORE / PVector +FX2D / Issues + +_ many shift- keys not working properly in FX2D (added a test sketch) +_ https://github.com/processing/processing/issues/5317 +_ Fix Java 11 incompatibilities inside PSurfaceFX +_ https://github.com/processing/processing/issues/5286 +_ Hitting ESC in FX2D app on macOS throws IllegalStateException +_ https://github.com/processing/processing/issues/5249 +_ wrong window size with fullScreen() +_ https://github.com/processing/processing/issues/4737 +_ menu bar not hiding properly in exported applications with FX2D +_ https://github.com/processing/processing/issues/4527 +_ hideMenuBar() called from setup() works fine +_ just call it around setup time? +_ the --hide-stop option not working (FX only? traces?) +_ make wiki about quirks +_ starving the thread makes things really slow down +_ keyPressed() is always uppercase, keyTyped() will be correct +_ do we really need setTextFont/Size when we already have Impl? +_ need keyPressed() to do lower and upper case +_ static mode sketches (draw once and halt w/o closing window) +_ fix display handling, line up the device order with AWT +_ https://docs.oracle.com/javafx/2/api/javafx/stage/Screen.html +_ noLoop() +_ present mode not working at all +_ stage in the center, clear the rest of the screen +_ createGraphics() should probably create PGraphicsJava2D +_ or is Canvas specific to the PGraphics, and we get another Context2D? +_ http://docs.oracle.com/javafx/2/api/javafx/scene/canvas/Canvas.html +_ loadPixels() (also 2x) +_ text and fonts? +_ maybe helpful: https://wiki.openjdk.java.net/display/OpenJFX/Font+Setup +_ updatePixels() +_ save() and saveFrame() +_ get() and set() +_ clip/noClip +_ https://github.com/processing/processing/issues/3274 +_ getNative() in PImage problematic because it gives back a BufferedImage +_ move loadImage() into PGraphics, with AWT version the default +_ or pass createImage() through to renderer? +_ implement external messages (moving the window) +_ implement PSurfaceFX.setIcon() +_ javafx not supported with ARM (so we're screwed on raspberry pi) +_ https://www.linkedin.com/pulse/oracle-just-removed-javafx-support-arm-jan-snelders + + +OPENGL / Known Issues -_ add screen(PVector), model(PVector) and world(PVector)? -_ maybe screenVec()? or screenXYZ()? +_ window must close when using file dialogs with OpenGL on Windows +_ https://github.com/processing/processing/issues/3831 +_ window loses focus after maximizing +_ https://github.com/processing/processing/issues/3339 -CORE / OpenGL (Andres) +OPENGL / Questions + +_ option to disable OpenGL ES on Linux? +_ https://github.com/processing/processing/issues/4584 +_ exitCalled() and exitActual made public by Andres, breaks Python +_ also not API we want to expose, so sort this out +_ or maybe we're fine b/c now FX2D needs it as well +_ when did setPath() sneak into PShape? API is nothing like anything else +_ probably from the material stuff, but we need to fix that +_ why is createShape() implemented 4x (for P2D, P3D, and 2x versions)? +_ shouldn't be static, run it from the renderer, that's point of createXxx() +_ public createShape() method that takes another shape as param? +_ should just be the constructor doing this, or copy() + + +OPENGL / Andres _ textureWrap(CLAMP / REPEAT) _ simple NPE in OpenGL causes really large, not useful, stack trace @@ -536,29 +540,14 @@ _ InvScreenX, Y, Z to convert screen (mouse) coordinates to model coordinates _ https://github.com/processing/processing/issues/1609 -CORE / Mac OS X - -_ set the application name to sketch name (not processing.core.PApplet) -_ System.setProperty("com.apple.mrj.application.apple.menu.about.name", ...) -_ -Xdock:name= -_ -Xdock:icon= - - -CORE / Events - -_ Implement a way to disable automatic key repeat -_ https://github.com/processing/processing/issues/1622 -_ touch events.. can't do MouseEvent et al with Android -_ http://dvcs.w3.org/hg/webevents/raw-file/tip/touchevents.html -_ http://www.html5rocks.com/en/mobile/touch.html -_ decision: go with what looks like javascript/ios -_ touchEvent(), gestureEvent()? - - LIBRARIES / PDF +_ tint() not working in PDF (regression between 2.0.3 and 2.1) +_ https://github.com/processing/processing/issues/2428 +_ Implement blendMode() for PDF +_ https://github.com/processing/processing/issues/5438 _ beginRecord() doesn't use current settings of the sketch -_ sometimes reported as a bug, but probably not a good way to +_ sometimes reported as a bug, but probably not a good way to _ consistently carry these over _ pdf sketches exiting before writing has finished _ people have to call exit() (so that dispose() is called in particular) @@ -566,7 +555,7 @@ _ when using noLoop() and the PDF renderer, sketch should exit gracefully _ because isDisplayable() returns false, there's no coming back from noLoop -LIBRARIES / Video +LIBRARIES / Video _ remove dispose() being used in the Movie and Capture _ added warning notes, but shouldn't be necessary @@ -591,7 +580,7 @@ _ can we use String... for options? or does it screw up the method signature? _ and would we have to always concatenate arrays to prepend extensions, etc _ include Instant and Interval? (or just Time and TimeSpan) _ it's going to be File or Reader (mostly BufferedReader) everywhere -_ though TableODS needs an InputStream... +_ though TableODS needs an InputStream... _ and XML could use InputStream if we hope to be able to reflect doc encoding _ ok, so File, Reader, and InputStream (where needed) _ setMissingXxxx() -> should this live in PApplet? be static? @@ -608,7 +597,7 @@ _ that way we can do what's most efficient _ then we add keyIterator() and others to handle the other case (deletion) _ blogs.oracle.com/CoreJavaTechTips/entry/using_enhanced_for_loops_with _ means that JSON.keys() -> JSON.keyIterator(), JSON.keySet() -> JSON.keys() -_ what should they all return? +_ what should they all return? _ remove -> true/false based on whether it found something? _ remove all -> the number removed? _ List: remove(), append(), index(), etc all use values @@ -647,7 +636,7 @@ _ i.e. get unique tables based on a particular column _ or, get uniques, then grab rows that match a name in a particular col _ create table from TableRow iterator...allows for subset and find _ downside is types are not included -_ getMaxFloat() (whole table) or getMaxFloat(col) +_ getMaxFloat() (whole table) or getMaxFloat(col) _ that's max(getFloatColumn(n)) _ also important b/c can leave out missing values _ dictionary support @@ -658,6 +647,7 @@ _ getInt() on categorial to return index? _ getCategories() and getCategory() methods to query names? + //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// @@ -671,20 +661,17 @@ _ that way, methods could use the information when reading _ loadBytes() needs optimization _ don't bother using a buffering stream, just handle internally. gah! _ can loadBytes() be improved by querying file size first? -_ background +_ background _ this would require a new version of createInput(), which would query _ the URL (or file) for an actual file size. the size is not always _ available, so it can't be relied upon, but would help in some cases. _ loadBytes() is used for images.. ouch -_ might be worth doing a test to see if it actually would help at all +_ might be worth doing a test to see if it actually would help at all _ before rewriting all of createInput() LATER (post 2.0) -_ handle repeat key events -_ and/or holding keys down and discerning repeats -_ https://github.com/processing/processing/issues/1622 _ fillMode(NONZERO) and fillMode(ODD) to replace solid(boolean)? _ create PVec2D and PVec3D as separate classes _ gui priorities @@ -698,18 +685,15 @@ _ . Textblock _ \ Knob _ \ Progress bar _ \ Toggle -_ implement JSON class -_ http://www.xml.com/lpt/a/1658 -_ http://www.json.org/java/ _ add shader support _ createColor() instead of color()? _ route all exceptions through PException and catch method _ advanced users can override the method if they want _ or you can set an option to have PExceptions be raised -_ decision: just copy & paste the serial/net code.. +_ decision: just copy & paste the serial/net code.. _ until we can find a more compelling example _ actual shape api for things like rectangles and whatnot? -_ should we kill import xxxx syntax for libraries? +_ should we kill import xxxx syntax for libraries? _ just give up and use a gui for it _ cons: copy & paste breaks _ pro: there's no guaranteed 1:1 between packages and single libraries diff --git a/done.txt b/done.txt index 83b2f07c79..ef2420519b 100644 --- a/done.txt +++ b/done.txt @@ -1,3 +1,1528 @@ +0270 (3.5.4) +X use ctrl-page up/down for tabs on Windows +X https://github.com/processing/processing/issues/5794 +X fix potential highlighting issue that wasn't selecting portions of text +X update AppBundler to use newer SDK, recompile +X edit build.xml files and appbundler to preserve more attributes +X don't remove entries from Recent menu on Save As +X https://github.com/processing/processing/issues/5902 +o NPE in buildCoreModes() on startup +o https://github.com/processing/processing/issues/5823 +X not clear what was wrong here + +contrib manager +X contrib listing names should not be case sensitive +X libs in all caps appeared above those in lowercase +X ignore library subfolders +X don't unzip __MACOSX files with contribs +X don't do library subfolders +X show error when .properties file is missing from contribs +X clean up a lot of bad temp file handling in the contrib manager +X https://github.com/processing/processing/issues/5845 +X https://github.com/processing/processing/issues/5960 +X NPE in installPreviouslyFailed() on startup +X https://github.com/processing/processing/issues/5482 +X https://github.com/processing/processing/issues/5916 + +contribs +X tweak mode not working +X https://github.com/processing/processing/issues/5805 +X https://github.com/processing/processing/pull/5909 + + +0269 (3.5.3) +X added reference for circle(), square(), push(), pop() +X has the reference.zip file been fixed? (yep) +X redo key command for Windows screwed up +X https://github.com/processing/processing/issues/5773 +X fix an editor problem with plain text (css, etc) files +X https://github.com/processing/processing/issues/5628 +X default to using Desktop methods for URLs and files when available on Linux +X also cover a few weird cases that were failing silently +X The package "META" does not exist when .class files found in META-INF folder +X https://github.com/processing/processing/issues/5778 + +contrib +X update translation of "sketch" for Russian speakers +X https://github.com/processing/processing/pull/5673 + +cleaning +o modify line number color when no lines extend that far? +o https://github.com/processing/processing/pull/4560 +o when opening new editor window, open on the same display as current +o https://github.com/processing/processing/issues/4526 +X closing as dupe of the other issue + + +0268 (3.5.2) +X shortcuts not working on Windows/Linux (using meta) +X https://github.com/processing/processing/issues/5763 +X update https://github.com/processing/processing/wiki/Localization#shortcuts-and-key-bindings + + +0267 (3.5.1) +X size() command not working properly +X https://github.com/processing/processing/issues/5759 + + +0266 (3.5) +X update to Java 8u192 +o processing-java doesn't handle sketch exceptions by quitting the sketch +X https://github.com/processing/processing/issues/5375 +X this is by design/follows PDE behavior +X fix the link to the FAQ in the menu +X https://github.com/processing/processing/issues/5729 +X update to Java 8u202 +X "Sketch disappeared" infinite pop up dialogs +X https://github.com/processing/processing/pull/4808 +X https://github.com/processing/processing/issues/4805 +X text("test", 10, 10); is still slow with lots of fonts +X https://bugs.openjdk.java.net/browse/JDK-8179209 +X added a note to the Known Issues section in the Changes wiki +X update the about screen to 2019 +o report of a library or tool (probably includes 2.x? 1.x?) breaking things +o NoSuchFieldError: useNativeSelect +X https://github.com/processing/processing/issues/4821 +X closed, no response +X problems with non-US keyboards and some shortcuts +X https://github.com/processing/processing/issues/2199 +X https://github.com/processing/processing/wiki/Localization#shortcuts-and-key-bindings +o Determine new keyboard shortcut for Step Out +X https://github.com/processing/processing/issues/3538 +X all set based on #2199 +X settings() present and pixelDensity() is in setup(), nothing set/no error +X https://github.com/processing/processing/issues/4703 + +cleaning +X Could not initialize class com.sun.jna.Native on startup (Windows) +X https://github.com/processing/processing/issues/4929 +X closed earlier; fixed as best we could +X sharing usage metrics about libraries +X https://github.com/processing/processing/issues/4708 +X Determine shortcut for Export vs Use Selection for Find +X https://github.com/processing/processing/issues/2985 +o swap font smoothing for tab size? +o implement simple table for prefs? +X still requires restart of the software, so problematic +X need docs for translations +X https://github.com/processing/processing/issues/4018 +X setting a bad font/size in preferences.txt causes a crash on startup +X https://github.com/processing/processing/issues/4085 +o https://github.com/processing/processing/pull/4087 +X can't reproduce with current code + +contrib +X Updated russian translation, now can choose russian in preferences +X https://github.com/processing/processing/pull/5619 +X Turkish translation updates +X https://github.com/processing/processing/pull/5636 +X Examples dialog causes high CPU load +X https://github.com/processing/processing/issues/5246 +X https://github.com/processing/processing/pull/5654 +X console hiding button +X https://github.com/processing/processing/pull/5115 +X NullPointerException in Contribution Manager when installing +X https://github.com/processing/processing/issues/5524 +X https://github.com/processing/processing/pull/5742 +X Improvements to appdata.xml for Linux +X https://github.com/processing/processing/pull/5604 + +jakub +X Fix sketch exception getting hidden by warning +X https://github.com/processing/processing/pull/5486 +X https://github.com/processing/processing/issues/5412 +X EventQueue problems with "could not find sketch size" message +X https://github.com/processing/processing/issues/4893 +X https://github.com/processing/processing/pull/5708 +X https://github.com/processing/processing/issues/5030 (duplicate) +X size(0, 0) just freezes instead of showing an error +X https://github.com/processing/processing/issues/5233 (duplicate) + + +0265 (3.4) +X make it possible to override theme.txt with a file in the sketchbook folder +X https://github.com/processing/processing/issues/5445 +X https://github.com/processing/processing/wiki/Dark-Theme-for-PDE +X add 2018 to p5 launch screen +X also update the bmp version +X redesign the Rename window to be less ugly +X Close the Rename window when ESC pressed +X https://github.com/processing/processing/issues/5391 +X Set default operation for Rename window +X https://github.com/processing/processing/issues/5400 +X add select/copy to the status bar +X https://github.com/processing/processing/issues/5271 +o possible fix (just copies on click) +o https://github.com/processing/processing/pull/5345 +X in the docs: modify 'search.format=' in preferences.txt +X refactoring inside the completion code +X https://github.com/processing/processing/commit/7e3661e9f7a6df1569c8bebc683e7742f50caa25 +X https://github.com/processing/processing/commit/20c6f86c0d600806c991962eb208548ac45e9e2a +X https://github.com/processing/processing/commit/8dda8a4d02bc9a1d15e81fee3e6c183e4076a40e +X https://github.com/processing/processing/commit/ff7dc4d5094ccf1cc35189c9412adda93153b436 +X add pyde as a supported extension +X https://github.com/jdf/processing.py/issues/284 +o update to launch4j 3.11? +o http://launch4j.sourceforge.net/changelog.html +X update to Java 8u172 +X show alternate error message on windows when JNA breaks or core.jar is missing +X https://github.com/processing/processing/issues/5537 +X https://github.com/processing/processing/issues/4929 +X https://github.com/processing/processing/issues/5442 +X https://www.microsoft.com/en-us/wdsi/filesubmission +X update to Java 8u181 +X https://github.com/processing/processing/pull/5586 +X Contributed libraries/examples/etc that redirect to https are failing download +X https://github.com/processing/processing/issues/5554 + +welcome +o just remove the welcome dialog; but what should the default behavior be? +o or should it only show up for people who have used <=2 but not 3? +X click "show this welcome" text to check/uncheck the box +X https://github.com/processing/processing/issues/3912 +X submit the form (as if 'get started' clicked) when closing the window +X whether hitting ESC or the close box on the window +X https://github.com/processing/processing/issues/3911 +o Welcome dialog rewritten in Swing +X https://github.com/processing/processing/pull/5210 + +gohai +X additional I/O improvements +X https://github.com/processing/processing/pull/5581 +X rpi regressions in 3.3.7.1 +X https://github.com/processing/processing/issues/5582 +X OpenGL ES: Fix GLSL version number for 1.00 +X https://github.com/processing/processing/pull/5583 +X Add ADS1X15 Analog-to-Digital converter example +X https://github.com/processing/processing/pull/5590 + +gohai (from 3.3.7.1 special release) +X IO: pinMode() can now set pull-up and pull-down resistors on Raspbian +X thanks to @xranby for 64-bit help +X several new examples +X https://github.com/processing/processing/pull/5566 +X IO: New example sketch showing how to use a MPR121 capacitive touch sensor +X fun tutorial by @msurguy forthcoming +X IO: New example sketch showing how to use a BME280 environmental sensor +X contributed by @OlivierLD +X IO: New example sketch showing how to use a TSL2561 light sensor +X contributed by @OlivierLD +X IO: New example sketch showing how to use a PCA9685 Servo & PWM controller +X contributed by @OlivierLD +X IO: pinMode() got faster +X https://github.com/processing/processing/pull/5557 +X IO: I2C now supports talking to slower devices, such as Arduino boards +X https://github.com/processing/processing/pull/5567 +X Support for ARM Mali graphics was added to P2D/P3D +X thanks to seongwook from the forums for his help during bringup +X https://github.com/processing/processing/pull/5485 +X P3D now supports up to 4 lights on Pi using their OpenGL driver +X Serial library now supports Raspbian's port naming (such as "/dev/serial0") +X Enable exporting of Windows applications on ARM +X https://github.com/processing/processing/pull/5488 +X https://github.com/processing/processing/issues/5287 +X clarify SimpleInput example +X https://github.com/processing/processing/pull/5558 + +jakub +X Make sure editor is updated after reloading changes +X https://github.com/processing/processing/pull/5487 +X https://github.com/processing/processing/issues/5466 + +contrib +X updates to Japanese translation +X https://github.com/processing/processing/pull/5263 +X added Russian translation +X https://github.com/processing/processing/pull/5451 +X make "loadXML(String)" handle "file not found" +X https://github.com/processing/processing/pull/5144 +X Update java.lang.UnsupportedClassVersionError message +X https://github.com/processing/processing/pull/5459 + + +0264 (3.3.7) +X downloading the jre broken again +X https://github.com/processing/processing/issues/5284 +X the old 144 link must have been removed +X NullPointerException in ContributionManager.deleteFlagged() +X https://github.com/processing/processing/issues/5342 +X move to Java 8u162 +X menu bars broken in High Sierra +X https://github.com/processing/processing/issues/5272 +X no more responses, had to close +X include newlines at end of files (i.e. when saving .pde files) +X https://github.com/processing/processing/issues/5327 +X explanation: https://stackoverflow.com/a/729795 +X http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 +X Rename dialog is unusable on high density screen +X https://github.com/processing/processing/issues/5368 +X windows defender blocks processing 3.3.6 +X https://github.com/processing/processing/issues/5329 +X this should be fixed, simply by a new release + +jakub +X Fix scrub comments for empty block comment /**/ +X https://github.com/processing/processing/pull/5265 +X https://github.com/processing/processing/issues/5219 +X Fix error checker crash when className contains [ or ] +X https://github.com/processing/processing/pull/5304 +X major fixes for the net library +X https://github.com/processing/processing/pull/5378 +X https://github.com/processing/processing/issues/4419 +X https://github.com/processing/processing/issues/5360 +X https://github.com/processing/processing/issues/3970 +X https://github.com/processing/processing/pull/5389 +X Output java files in UTF-8 and force compiler to use UTF-8 +X https://github.com/processing/processing/pull/5436 +X PdePreprocessor change is breaking current source +X https://github.com/processing/processing/issues/5413 + +contrib +X detect errors from curved quotation marks +X https://github.com/processing/processing/issues/5133 +X https://github.com/processing/processing/pull/5152 +X Refactor to use a few Java 8 features +X https://github.com/processing/processing/pull/5134 +X Remove "Pipe Organ" from exec javadoc +X https://github.com/processing/processing/pull/5282 +X typo in Italian translation +X https://github.com/processing/processing/issues/5365 + + +0263 (3.3.6) +X update to Java 8u144 +X fix issue with call to remove value instead of key in mode contrib hash +X this was only in the code used by the command line mode loader +o data folder not exporting on macOS? +o https://github.com/processing/processing/issues/5207 +X confirmed working with LoadDisplayImage example + +contrib +X add Italian translation +X https://github.com/processing/processing/pull/5169 +X Wrong tab for missing brace +X https://github.com/processing/processing/pull/5180 +X https://github.com/processing/processing/issues/5165 +X typo in German translation +X https://github.com/processing/processing/pull/5195 +X https://github.com/processing/processing/issues/5187 +X movie maker a little broken +X https://github.com/processing/processing/issues/5168 +X https://github.com/processing/processing/pull/5230 +X Add more build products to linux/.gitignore +X https://github.com/processing/processing/pull/5229 +X add issue template to the repo +X https://github.com/processing/processing/issues/5239 +X https://github.com/processing/processing/pull/5245 + +jakub +X Fix comment/uncomment adding slashes at wrong indent +X https://github.com/processing/processing/issues/5171 +X https://github.com/processing/processing/pull/5185 +X Add JavaFX runtime to error checker class path +X https://github.com/processing/processing/pull/5186 + + +0262 (3.3.5) +X use native Linux file choosers by default +X https://github.com/processing/processing/issues/5122 +X Console window losing text +X https://github.com/processing/processing/issues/5110 +X Linux 64-bit issues +X https://github.com/processing/processing/issues/5111 + +contrib +X display=-1 regression ("could not parse" message) +X https://github.com/processing/processing/issues/5118 +X https://github.com/processing/processing/pull/5141 + + +0261 (3.3.4) +X redo console handling to not use Timer, fixing freeze-up problems +o https://github.com/processing/processing/pull/4935 +X https://github.com/processing/processing/issues/4825 +X clean up error message for sketchbook location +X https://github.com/processing/processing/issues/4942 +X Application Exports report as "Damaged" on macOS Sierra +X https://github.com/processing/processing/issues/4705 +X could provide script to un-quarrantine +X xattr -d -r com.apple.quarantine +X https://github.com/steakknife/unsign +X https://developer.apple.com/library/content/technotes/tn2318 +X 'run sketches on display' message shows up on clean install +X should ant run launch the .app so that launchsvcs stuff works properly? +X double-clicking a .pde file won't open the app correctly +X add 'ant app' target, at least for macOS +X add null check to sketch loading +X discovered during https://github.com/processing/processing/issues/4980 + +gohai +X IO library updates +X https://github.com/processing/processing/pull/5044 +X Consider $SUDO_USER on Linux for locating the sketchbook folder +X https://github.com/processing/processing/pull/5055 +o https://github.com/processing/processing/pull/5054 + +jakub +X more updates to the change detector +X https://github.com/processing/processing/pull/5075 + +contrib +X Make the change detector not reload the sketch +X https://github.com/processing/processing/issues/4713 +X https://github.com/processing/processing/pull/5021 +X https://github.com/processing/processing/pull/4849 +X Warn user to use L when creating a number constant that won't fit into an int +X https://github.com/processing/processing/issues/4878 +X https://github.com/processing/processing/pull/5077 +X add install/uninstall scripts for Linux and correct mime types for IDE +X https://github.com/processing/processing/pull/5106 + + +0260 (3.3.3) +X no changes to the PDE for 3.3.3 + + +0259 (3.3.2) +X no changes to the PDE in this release + + +0258 (3.3.1) +X fix the JRE downloader +X https://gist.github.com/P7h/9741922 +X http://stackoverflow.com/q/10268583 +X move to 8u131 +X add another warning for a bad NVIDIA driver +X https://github.com/processing/processing/issues/4997 +X Gap between tab headers and text area at 125% and 150% scaling on Windows +X https://github.com/processing/processing/issues/4902 +X Math.ceil() helps +X Small tooltip text on high-dpi screens +X https://github.com/processing/processing/issues/4914 +X make the Error Table extend white to the bottom +X was making a gray box on Windows, probably Linux too +X some line heights are wrong on hidpi +X usage window +X examples window +X sketchbook window +X https://github.com/processing/processing/issues/4936 +X https://github.com/processing/processing/issues/5007 +X get rid of error message when exporting sketches with the video library +X https://github.com/processing/processing/issues/4971 +X use dialog font for processing.sans if using a non- or quirky Roman language +X make this a parameter of the language translation + +jakub +X Fix preprocessing of code with double backslash in string or char literal +X https://github.com/processing/processing/issues/4903 +X https://github.com/processing/processing/pull/4907 +X Ugly button images at 125% and 150% scaling on Windows +X https://github.com/processing/processing/issues/4901 +X https://github.com/processing/processing/pull/4906 +X Fix breakpoints in inner classes +X https://github.com/processing/processing/pull/5008 +X https://github.com/processing/processing/issues/2946 +X Fix preproc skipping one char after a block comment +X https://github.com/processing/processing/issues/4995 +X https://github.com/processing/processing/pull/4999 +X Synchronize input event processing +X https://github.com/processing/processing/pull/4998 +X Scrub comments: skip the second chracter in the escape sequence +X https://github.com/processing/processing/pull/5019 +X https://github.com/processing/processing/issues/5016 + +gohai +X Add support for 64-bit ARM boards +X https://github.com/processing/processing/pull/5002 +X Hardware I/O updates for ARM +X https://github.com/processing/processing/pull/4931 + +contrib +X Added Arabic translation +X https://github.com/processing/processing/pull/4970 +X add Jump to Declaration +X https://github.com/processing/processing/pull/4707 +X https://github.com/processing/processing/issues/4668 + +awaiting confirmation (fixed in 3.3) +X visual artifacts on Windows 10 when using menus +X https://github.com/processing/processing/issues/4700 +X Broken characters in the Welcome Page and the Contribution Manager +X https://github.com/processing/processing/issues/4747 +X looks like a failure to load the Source Sans font +X what happens if font loading fails? +X are there conflicts between version in lib and OS? +o are we still installing fonts into ext? +o fixed by rolling back to 8u92, broken since 8u102 in 3.1.2 +X NVIDIA driver problems (and means to check) +X https://github.com/processing/processing/issues/4853 +X blank window on startup where the "Welcome" screen should be +X this may be fixed (removed invokeLater() on startup), unconfirmed +X https://github.com/processing/processing/issues/3933 +X Olivia hasn't seen it, closing +X amazing blurry editor window +X https://github.com/processing/processing/issues/4892 + + +0257 (3.3) +X check for already-exported folders before trying to remove them +X was spewing 'file not found' errors into the console +X PDE and sketches are 2x smaller on high-res Windows machines +X https://github.com/processing/processing/issues/2411 +o System.setProperty("sun.java2d.dpiaware", "false"); +X though that seems broken in Java 8: http://superuser.com/a/1007783 +X until we fix it.. +o call this from JNA? https://msdn.microsoft.com/en-us/library/windows/desktop/dn302122(v=vs.85).aspx +o or modify the manifest/app? https://msdn.microsoft.com/en-us/library/windows/desktop/dn469266%28v=vs.85%29.aspx +o hidpi scaling via font changes? +o http://stackoverflow.com/a/34152675 +X hi-dpi support on Linux +X https://github.com/processing/processing/issues/4183 + +cleaning +X Contribution Manager does not show all libraries until filter cleared +X https://github.com/processing/processing/issues/4840 +X fixed in 3.2.4 + +unconfirmed +X visual artifacts on Windows 10 when using menus +X https://github.com/processing/processing/issues/4700 +X Broken characters in the Welcome Page and the Contribution Manager +_ https://github.com/processing/processing/issues/4747 +X looks like a failure to load the Source Sans font +X what happens if font loading fails? +X are there conflicts between version in lib and OS? +o are we still installing fonts into ext? +o fixed by rolling back to 8u92, broken since 8u102 in 3.1.2 +X NVIDIA driver problems (and means to check) +_ https://github.com/processing/processing/issues/4853 +X blank window on startup where the "Welcome" screen should be +X this may be fixed (removed invokeLater() on startup), unconfirmed +X https://github.com/processing/processing/issues/3933 + + +0256 (3.2.4) +X only require reference.zip (and internet connection) when building dist +X set text style properly for Contribution Manager error message +X Detect changes to 'hosts' file in case users modify/remove localhost +X https://github.com/processing/processing/issues/4738 +X No sketch window opens after hitting Run if hosts file changed +X https://github.com/processing/processing/issues/1868 +X https://github.com/processing/processing/issues/3123 +X https://github.com/processing/processing/issues/4735 +X move the DEBUG flag into an external file or preferences.txt +X will help us with debugging w/ others as well +X change to debug.txt; too confusing with the folder thing +X replace java.util.logging code with built-in logging +X split gui and non-gui portions of console for earlier startup +X split EditorConsole into gui and non-gui code? +X otherwise System.err/out not going to a file unless we have GUI +X also can't debug before the GUI shows up +o gracefully recover from proxy problems +X https://github.com/processing/processing/issues/1601 +X JRE download fails during ant build +X https://github.com/processing/processing/issues/4823 +X changed headerType to console (make sure changed back) +X Spaces not handled correctly in when installing "processing-java" on macOS +X https://github.com/processing/processing/issues/4779 + +contrib +X Added the remove filter feature +X https://github.com/processing/processing/pull/3890 +X ctrl-J (for debugger) is inserting newline +X https://github.com/processing/processing/issues/3830 +X Replace keyChar with keyCode to prevent new line error when debugging +X https://github.com/processing/processing/pull/4806 +X https://github.com/processing/processing/issues/4804 + +jakub +X println(int(byte(245))) throwing error +X https://github.com/processing/processing/issues/4652 +X https://github.com/processing/processing/pull/4744 +X 'web colors' next to each other fail to parse in certain situations +X https://github.com/processing/processing/issues/4752 +X https://github.com/processing/processing/pull/4753 +X Pasting code from editor to empty editor produces Exception +X https://github.com/processing/processing/issues/4522 +X https://github.com/processing/processing/pull/4761 +X possible infinite loop on modified externally +X https://github.com/processing/processing/issues/3965 +X https://github.com/processing/processing/pull/4762 +X Report missing brace in correct tab, suppress other errors until fixed +X https://github.com/processing/processing/pull/4777 +X https://github.com/processing/processing/issues/4702 +X Improvements to sketch launching and stopping +X https://github.com/processing/processing/pull/4848 +X several Contribution Manager fixes +X https://github.com/processing/processing/pull/4844 +X Add missing equals() and hashCode() to Contribution +X https://github.com/processing/processing/pull/4843 +X Contribution Manager does not show all libraries until filter cleared +X https://github.com/processing/processing/pull/4843 +X https://github.com/processing/processing/issues/4840 +X Mode, requiring update, appears in Updates tab but not in Modes tab +X https://github.com/processing/processing/issues/4822 +X also fixed w/ https://github.com/processing/processing/pull/4843 +X Syntax highlighting issues (fixed with #4761) +X https://github.com/processing/processing/issues/4286 +X sketchbook window doesn't update when sketches are added, renamed, etc +X https://github.com/processing/processing/issues/2944 +X https://github.com/processing/processing/pull/4842 + +cleaning +X clean up 'ant doc' target to remove warnings +X https://github.com/processing/processing/issues/1492 +X fixed in 3.1.1 +X Horizontal scrollbar does not scroll textarea all the way +X https://github.com/processing/processing/issues/3591 +X mostly fixed in 3.0b7, opting to wait for RSyntaxArea or whatever +X possible PR for updating sketchbook stuff +o https://github.com/processing/processing/pull/3081 +X should be covered by other fixes +X longer PR about sketchbook stuff, but closed +X https://github.com/processing/processing/pull/3178 +X closed back in April 2015, issue was all over the place +X fix encodings, line endings, and mime types in the repo +X https://github.com/processing/processing/issues/2955 +X fixed 2015-11 https://github.com/processing/processing/pull/2977 +X need to handle the 2.x to 3.x sketchbook transition +X prefs are the same file, but sketchbook location pref is different +o performance +o video stinks.. java2d stinks.. macs stink +o note in the 'drawing in 2d' section of faq +o fastest machine possible +o turn off hyperthreading in the bios +o nice gfx card only helps opengl +o dual processor not particularly useful, unless you make more threads +o but making more threads is often more work than is useful +X too out of date +X why adding .0001 to a float doesn't work +X and how they're imprecise in general (use nf) +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1130877990 +X long since added to the FAQ +X infinite "file changed" popups +X https://github.com/processing/processing/issues/3965 +o https://github.com/processing/processing/pull/4037 +X https://github.com/processing/processing/pull/4037 + + +0255 (3.2.3) +X ensure that update.id is set before checking for contrib updates +X if prettyVersion is blank (or null?), just use version (Firmata) +X clicking "Update" button in contrib manager shows non-retina version of icon +X https://github.com/processing/processing/issues/4715 +o problem is because AquaButtonUI is calling getImage() (not getIcon()) +o can be debugging from inside the getIconX() code in Toolkit +X just needed to use setPressedIcon(), setDisabledIcon() +X also found some other issues around the icon handling +X fix the library reporting scripts on the server +X missing version number putting 'null' in the ui +X https://github.com/processing/processing-docs/issues/478 +X https://github.com/processing/processing/issues/4696 +X https://github.com/processing/processing/pull/4712 +o replace appbundler with the Java 8 packager +o appbundler is no longer being developed by Oracle, switch to "packager" +X https://github.com/processing/processing/issues/3071 +X major clean-ups to the Contribution Manager code +X warn user to restart browser when it hangs on macOS +X https://github.com/fathominfo/processing-p5js-mode/issues/4 + +contribs +X Up-to-date status disappears after filter is removed +X https://github.com/processing/processing/issues/4084 +X Updates tab blank after adding, removing, updating a contribution +X https://github.com/processing/processing/issues/4082 +X https://github.com/processing/processing/issues/4704 +X Fixes the removal of redundant contribution and update related issues +X https://github.com/processing/processing/pull/4086 + + +0254 (3.2.2) +X Find in reference for size() opens StringList.size() +X https://github.com/processing/processing/issues/4224 +X though that's still imperfect: +X https://github.com/processing/processing/issues/4655 +X limit rollovers on EditorStatus to the text portion +X clicking the status area when it has a url is problematic +X because it's also the vertical separator +X at least change it to only cover the text? +X add a rollover so people know what it's doing? +X switch to 8u112 for building +X switch down to 8u111 because of different build numbers +X https://github.com/processing/processing/commit/8a3a183f327a5ee680e1932dd9f123491f75a8b9 +X more font tweaks to make mono fonts work properly after #4639 +X update the Linux notes based on where we land on this +X https://github.com/processing/processing/wiki/Supported-Platforms#linux +X "Could not open the url" when clicking on the error message +X https://github.com/processing/processing/issues/4695 +X fix extensions handling in CFBundleDocument code from appbundler +X https://github.com/processing/processing/issues/4615 +X update launch4j to 3.9 +X https://sourceforge.net/projects/launch4j/files/launch4j-3/3.9/ +X exported application doesn't work with latest jre +X https://github.com/processing/processing/issues/4682 +X string comparison fix +X https://github.com/processing/processing/issues/4670 + +gohai +X Simplify font situation to make it possible to use vanilla JRE trees +X https://github.com/processing/processing/pull/4639 +X Trivial updates for ARM +X https://github.com/processing/processing/pull/4640 +X Remove all the extra hoops for loading fonts +X https://github.com/processing/processing/pull/4641 + +contrib +X Chinese translation updates +X https://github.com/processing/processing/pull/4661 +X Spanish translation updates +X https://github.com/processing/processing/pull/4697 +X Spanish "open sketch folder" fix +X https://github.com/processing/processing/pull/4710 +X Contribution Manager showing 'null' for PeasyCam version +X https://github.com/processing/processing/pull/4712 +X https://github.com/processing/processing/issues/4696 + + +0253 (3.2.1) +X "Could not replace preferences.old" error message +X https://github.com/processing/processing/issues/4626 +X Version 3.2 won't run from paths with spaces on Windows +X https://github.com/processing/processing/issues/4623 +X might be ext.dirs trouble with spaces in path names? +X or the backwards slashes? +X fixes for Python Mode crashing on startup +X disable ext.dirs on Linux export and set jna.nosys as well +X Java not included properly with 32-bit Linux export +X JavaInputHandler not registering + + +0252 (3.2) +X Processing .jar files in CLASSPATH can cause startup crash +X https://github.com/processing/processing/issues/4128 +X Remove java.ext.dirs on startup to avoid conflicts and startup errors +X https://github.com/processing/processing/issues/4608 +X https://github.com/processing/processing/issues/4470 +X https://github.com/processing/processing/issues/4566 +X https://github.com/processing/processing/issues/4492 +X https://github.com/processing/processing/issues/4128 +X https://github.com/processing/processing/issues/4503 +X test ext.dirs working on Linux (use js example) +X test ext.dirs on exported app on Linux +X test ext.dirs working on Windows (use js example) +X modify ext.dirs for exported apps on Windows +X see if CLASSPATH can be set to screw up p5 +X works fine on OS X, couldn't reproduce on Linux +X rewrite Util.listFiles() because it wasn't working properly +X add 2016 to about-1x and about-2x +o saying "no" to save changes is the same as "cancel" on windows? +X can't reproduce +X add printStackTrace() method that can be overridden +X https://github.com/processing/processing/issues/222 +X write preferences.txt using a temporary file +X also save the previous version as preferences.old +X https://github.com/processing/processing/issues/4614 + +mode work +X add template support for Modes +X Move general PDE code out of JavaMode and into general base classes +X https://github.com/processing/processing/issues/4606 +X change PdeInputHandler constructor +X check whether this breaks other Modes before releasing +X added extra constructor to keep things working +X change PdeKeywords to PdeTokenMarker +X doesn't seem to cause any breakage, but will keep an eye out +X added getSketchbookTemplatesFolder() to Base +o move template subst code to Util +X add Mode.requireExampleCompatibility() +X in Mode: TokenMarker getTokenMarker(SketchCode code) +X passes through to no args version if not overridden +X note this in revisions.txt +X implement templates +X write short docs +X https://github.com/processing/processing/wiki/Templates +X https://github.com/processing/processing/issues/4306 +X https://github.com/processing/processing/issues/4352 + +contrib +X use HTML to print +X https://github.com/processing/processing/pull/4369 +X https://github.com/processing/processing/issues/213 +X https://github.com/processing/processing/issues/50 + +input method work from Tsuyoshi Fukuda (tyfkda) +X Simplify conditional branch +X https://github.com/processing/processing/pull/4589 +X Enable input method support by default on Japanese/Korean/Chinese systems +X https://github.com/processing/processing/pull/4598 +X Set sketch as modified when any character committed using input method +X https://github.com/processing/processing/pull/4599 +X Insert characters by InputMethod at one time +X https://github.com/processing/processing/pull/4594 +X Insert string when it is committed +X https://github.com/processing/processing/pull/4602 +X Set text color for InputMethod +X https://github.com/processing/processing/pull/4593 + +jakub +X NullPointerException in SketchCode.getDocumentText() +X https://github.com/processing/processing/issues/4555 +o https://github.com/processing/processing/pull/4547 +X https://github.com/processing/processing/pull/4596 +X Error checker now adds 'public' to all default access methods +X https://github.com/processing/processing/pull/4597 +X https://github.com/processing/processing/issues/4583 + +earlier +X display "1" is not correct in 2.1.2 +X https://github.com/processing/processing/issues/2502 +o cut/copy/paste while saving a sketch on goes to the editor, not save dialog +o https://github.com/processing/processing/issues/1035 +o problem with focus traversal and native windows on OS X +o using JFileChooser fixes the problem (but is ugly) +X can't find this one anymore + + +0251 (3.1.2) +X update to Java 8u102 build 14 + +gohai +X IO: Fix drawing for SPIAnalogDigital examples +X https://github.com/processing/processing/pull/4480 +X Update JVM warning text on Linux +X https://github.com/processing/processing/pull/4512 +X undo the 8u91 workaround, add Mesa warning for ARM +X https://github.com/processing/processing/pull/4508 +X IO: We want motors, they said (implements SoftwareServo) +X https://github.com/processing/processing/pull/4546 +X Add a temporary workaround for the CHIP to deal with cursor problems +X https://github.com/processing/processing/pull/4554 +X Fix the Downloader so that builds work again +X https://github.com/processing/processing/issues/4496 +X https://github.com/processing/processing/pull/4511 + +jakub +X Return of the error check toggle +X https://github.com/processing/processing/pull/4491 +X https://github.com/processing/processing/issues/4485 +X problems when running PDE from network locations +X lots of reports about a failure to launch on Windows +X seems related to running from network drives +X https://github.com/processing/processing/issues/4417 +X https://github.com/processing/processing/pull/4582 +X https://github.com/processing/processing/issues/4476 + +contrib +X updates to Japanese translation +X https://github.com/processing/processing/pull/4564 +X Make preferences button wider for Japanese +X https://github.com/processing/processing/pull/4558 +X Show warning message if Mode cannot be changed +X https://github.com/processing/processing/pull/4559 + +fixed in 3.1.1 +X debugger deadlocks when choosing "Step Into" on println() +X https://github.com/processing/processing/issues/3923 +X Suggestions switch scope to first import +X https://github.com/processing/processing/issues/4016 +X loadImage() immediately after saveFrame() foiled by async default +X https://github.com/processing/processing/issues/4218 +X the hint() mostly works, but gross to use a hint frequently + + +0250 (3.1.1) +X Out of date Modes will hang Processing 3 on startup or when changing Modes +X Prevent bad Mode from taking down the environment +X https://github.com/processing/processing/issues/4467 +X fix up "ant clean" task +X remove work folder on linux and windows +X remove macosx dist zips + +contribs +X Undo is a little "jerky" in insert mode +X https://github.com/processing/processing/issues/4302 +X https://github.com/processing/processing/pull/4310 +X "Replace" and "Replace All" do not undo in a single step +X https://github.com/processing/processing/issues/4303 +X https://github.com/processing/processing/pull/4310 +X Comment/uncomment removes indenting +X https://github.com/processing/processing/issues/4249 +X https://github.com/processing/processing/pull/4313 +X remove poorly implemented "rectangular selection" support from the editor +X https://github.com/processing/processing/pull/4462 +X https://github.com/processing/processing/pull/4326 +X https://github.com/processing/processing/issues/4250 +X Fix error messages from Javadocs +X https://github.com/processing/processing/pull/4191 +X https://github.com/processing/processing/issues/1492 +X Loader is not visible when opening the Updates tab +X https://github.com/processing/processing/issues/4088 +X https://github.com/processing/processing/pull/4089 + +jakub +X Make Comment/Uncomment trigger on numpad slash +X https://github.com/processing/processing/pull/4457 +X Hex values throwing errors in 3.1 +X https://github.com/processing/processing/issues/4458 +X https://github.com/processing/processing/pull/4460 +X Fix up cmd-click/ctrl-click behavior, add preference to disable it +X https://github.com/processing/processing/issues/4466 +X https://github.com/processing/processing/pull/4472 +X Make undo/redo mark all affected tabs as modified +X https://github.com/processing/processing/pull/4479 + +gohai +X Prevent InvocationTargetException when running processing-java +X https://github.com/processing/processing/pull/4453 +X https://github.com/processing/processing/issues/4452 +X Switch back to JRE 8u77 on ARM to fix GL video library performance +X https://github.com/processing/processing/pull/4454 + +earlier +X complex text input issues (may be fixed with PR) +X https://github.com/processing/processing/issues/3860 +X https://github.com/processing/processing/issues/3475 +o fixed in 3.0.2 +X contrib: Allow Movie Maker to cope with bad files +X https://github.com/processing/processing/issues/2727 +X https://github.com/processing/processing/pull/3635 +o fixed prior to 3.0? + + +0249 (3.1) +o arrow keys aren't working in the examples window +X was working fine with most recent build.. weird +X spend a lot of time trying to get non-8bit charsets on Windows +o https://github.com/processing/processing/issues/3543 + +contribs +X Grab bag of smaller, mainly ARM-related updates +X https://github.com/processing/processing/pull/4300 +X IDE code disappearing due to a concurrency bug +X https://github.com/processing/processing/issues/4322 +X https://github.com/processing/processing/pull/4325 +X Fix non-ARM Linux deb build process +X https://github.com/processing/processing/issues/4308 +X https://github.com/processing/processing/pull/4309 +X Empty sketchbook message when sketchbook is empty +X https://github.com/processing/processing/pull/4311 +X processing-java output as UTF-8 makes Windows unhappy +X https://github.com/processing/processing/issues/1633 +X https://github.com/processing/processing/pull/4350 +X Add support for symlinks to exported applications in linux +X https://github.com/processing/processing/issues/4318 +X https://github.com/processing/processing/pull/4319 +X Added Ukrainian localization +X https://github.com/processing/processing/pull/4343 +X Non-western language hint text for toolbar buttons not correctly displayed +X https://github.com/processing/processing/issues/2886 +X load fallback font for CJK (Chinese, Japanese and Korean) +X https://github.com/processing/processing/pull/4348 +X Added readBytes(max) to net library +X https://github.com/processing/processing/pull/4320 +X Added readBytes(max) to serial library +X https://github.com/processing/processing/pull/4321 +X Improve error message "The nested type cannot hide an enclosing type" +X https://github.com/processing/processing/issues/4228 +X https://github.com/processing/processing/pull/4337 +X https://github.com/processing/processing/pull/4451 +X Multi-line comments ending in '**/' cause ArrayIndexOutOfBoundsException +X https://github.com/processing/processing/issues/4397 +X https://github.com/processing/processing/pull/4402 + +jakub +X Update app to Java 8 +X https://github.com/processing/processing/pull/4383 +X more Java 8 updates +X https://github.com/processing/processing/pull/4388 +X update minimum JRE version for Windows +X https://github.com/processing/processing/pull/4389 +X update JDT to 4.5.2 +X https://github.com/processing/processing/pull/4387 +X JavaMode cleanup +X https://github.com/processing/processing/pull/4390 +X tabs aren't working properly (several bugs?) +X https://github.com/processing/processing/issues/3975 +X https://github.com/processing/processing/pull/4410 +X file paths not decoding properly +X https://github.com/processing/processing/issues/4417 +X https://github.com/processing/processing/pull/4426 +X double check that this is working on OS X +X check whether it fixes the Windows startup problem +X Java Mode refactoring +X https://github.com/processing/processing/pull/4440 +X jump to variable declaration miss +X https://github.com/processing/processing/issues/4287 +X Numbers in scientific notation not recognized as floats in 3.0 +X https://github.com/processing/processing/issues/4190 +X Adding .java files to sketch causes the Error Checker to weird out +X https://github.com/processing/processing/issues/4368 +X "Show usage..." does not locate keywords on correct line +X https://github.com/processing/processing/issues/3988 +X PPS: threading enhancement +X https://github.com/processing/processing/pull/4442 +X Move PDEX listeners from JavaEditor to PDEX +X https://github.com/processing/processing/pull/4446 +X https://github.com/processing/processing/pull/4447 +X handleCtrlClick misbehaving +X https://github.com/processing/processing/issues/4281 +X Fix listeners not firing on first preprocessing run +X https://github.com/processing/processing/pull/4450 +X Remove some unnecessary calls from rename +X https://github.com/processing/processing/pull/4449 + +gottfried +X Add automatic mipmap support to GLES2 +X https://github.com/processing/processing/pull/4416 +X Add a few IO library examples +X https://github.com/processing/processing/pull/4384 +X Be more verbose with drawExceptions with cause null +X https://github.com/processing/processing/pull/4432 +X Ignore memory options when exporting for ARM +X https://github.com/processing/processing/pull/4406 +X update JNA to 4.2.0 +X https://github.com/processing/processing/pull/4443 +X Add two Raspberry Pi related fixes to JOGL +X https://github.com/processing/processing/pull/4379 +X https://github.com/sgothel/jogl/pull/96 +X https://github.com/sgothel/jogl/pull/97 + + +0248 (3.0.2) +X move to Java 8u74, also fixes JavaFX issue +X actually require OS X 10.8.5 (was set to 10.7) +X the Wiki said 10.8.3 required for 3.0, but has since been updated + +contribs +X add "full screen" option to the Editor on OS X +X https://github.com/processing/processing/issues/3993 +X https://github.com/processing/processing/pull/4078 +X add install script for site for ARM +X https://github.com/processing/processing/pull/4110 +X search/replace shouldn't include the string being replaced +X https://github.com/processing/processing/issues/4270 +X https://github.com/processing/processing/pull/4271 +X 'Background Color when Presenting' not visible on Preferences window +X https://github.com/processing/processing/issues/4272 +X https://github.com/processing/processing/pull/4278 +X Fix minor autoformatter bugs (enums not working) +X https://github.com/processing/processing/issues/4185 +X https://github.com/processing/processing/pull/4200 +X Update Source Code Pro and Source Sans Pro fonts to the latest versions +X https://github.com/processing/processing/pull/4150 +X https://github.com/processing/processing/issues/3836 +X Minor fixes for Java Mode +X https://github.com/processing/processing/pull/4114 +X Add i18n support for the PopUp menu +X https://github.com/processing/processing/pull/4060 +X Add Turkish to the list of languages +X https://github.com/processing/processing/pull/4073 +X Make the error message for stack overflows clearer +X https://github.com/processing/processing/pull/4152 +X get rid of dt_socket message, making command line run a little better +X https://github.com/processing/processing/issues/4098 +X https://github.com/processing/processing/pull/4103 +X message when reference is find out on nothing selected +X https://github.com/processing/processing/pull/4296 +X better handling of quotes in command line args +X https://github.com/processing/processing/pull/4145 +X https://github.com/processing/processing/issues/3996 +X https://github.com/processing/processing/issues/4119 +X fix crashing bugs when user's name has non-ASCII characters +X https://github.com/processing/processing/pull/4204 +X ARM updates to include GPIO numbers and images of wiring diagrams +X https://github.com/processing/processing/pull/4297 +X https://github.com/processing/processing/pull/4298 +X Icon instead of an "X" for the "could not connect" message +X https://github.com/processing/processing/issues/3706 +X https://github.com/processing/processing/pull/4096 +X https://github.com/processing/processing/pull/4055 +X Several fixes for Chinese/Japanese/Korean InputMethod support +X https://github.com/processing/processing/pull/4293 +X https://github.com/processing/processing/issues/2968 +X https://github.com/processing/processing/issues/3475 +X https://github.com/processing/processing/issues/3860 +X Add download indicator to the Contribution Manager +X https://github.com/processing/processing/pull/4154 +X https://github.com/processing/processing/issues/4105 + +jakub +X Workaround for JRE bug freezing the PDE during code completion +X https://github.com/processing/processing/pull/4079 +X Debugger fixes +X prevent NPE because ui was not updated on AWT +X https://github.com/processing/processing/pull/4117 +X fix NPE when stepping into static method +X https://github.com/processing/processing/issues/3590 +X step button works correctly when SHIFT or ALT is pressed +X https://github.com/processing/processing/issues/4116 +X More editor fixes +X https://github.com/processing/processing/pull/4113 +X Tooltip over variable decl has wrong style and content +X https://github.com/processing/processing/issues/3940 +X May have fixed? NullPointerException in initiateToolTip() +X https://github.com/processing/processing/issues/3286 +X "String index out of range" error with bracket handling in the editor +X https://github.com/processing/processing/issues/1940 + + +0247 (3.0.1) +X NullPointerException in ContributionManager.deleteTemp() +X https://github.com/processing/processing/issues/4026 + +contribs +X Tweak Mode sometimes freezes while running, require a force quit +X https://github.com/processing/processing/issues/3928 +X https://github.com/processing/processing/pull/4014 +X Tweak Mode: Some numbers ignored in second tab +X https://github.com/processing/processing/issues/4017 +X https://github.com/processing/processing/pull/4023 +X Update Japanese translation +X https://github.com/processing/processing/pull/3956 +X https://github.com/processing/processing/pull/3971 +X processing-java stealing focus even with --build flag +X https://github.com/processing/processing/issues/3996 +X https://github.com/processing/processing/pull/3998 +X updates for serial +X https://github.com/processing/processing/pull/4015 + +jakub +X Include Example packs into update count +X https://github.com/processing/processing/pull/3932 +X Editor objects are staying in memory +X https://github.com/processing/processing/issues/3930 +X https://github.com/processing/processing/pull/3934 +X https://github.com/processing/processing/issues/3929 +X Library path for Error Checker and Suggestions +X https://github.com/processing/processing/pull/3989 +X https://github.com/processing/processing/issues/3924 +X A serious error occurred while trying to create a new editor window +X https://github.com/processing/processing/issues/3974 +X https://github.com/processing/processing/pull/4001 +X Export - fix java not being embedded on 64bit +X https://github.com/processing/processing/pull/4005 +X Add error checker document listeners to all tabs +X https://github.com/processing/processing/pull/4009 +X Fix memory leak in Recent +X https://github.com/processing/processing/pull/4044 +X Error checker update (also enables switch on String objects) +X https://github.com/processing/processing/issues/4034 +X https://github.com/processing/processing/pull/4042 +X Fix occasional exception while editing text +X https://github.com/processing/processing/pull/4043 +X Prevent preprocessor from crashing when setup() has no body +X https://github.com/processing/processing/pull/4045 + +arm/pi +X Medium-sized I/O updates +X https://github.com/processing/processing/pull/3997 +X add i/o library for rpi +X https://github.com/processing/processing/pull/3985 +o make sure naming, etc is all correct + + +0246 the holy land (3.0) +X "Saving" messages never clear on "Save As" +X https://github.com/processing/processing/issues/3861 +X error checker/suggestions fixes +X https://github.com/processing/processing/pull/3871 +X https://github.com/processing/processing/pull/3879 +X contributions filter is ignored after clicking Install +X https://github.com/processing/processing/issues/3826 +X https://github.com/processing/processing/pull/3872 +X https://github.com/processing/processing/pull/3883 +X Exception in thread "Contribution List Downloader" +X https://github.com/processing/processing/issues/3882 +X https://github.com/processing/processing/pull/3884 +X Hide useless error in error checker +X https://github.com/processing/processing/pull/3887 +X grab bag of CM work from Jakub +X https://github.com/processing/processing/issues/3895 +X https://github.com/processing/processing/pull/3897 +X Clean up delete dir function +X https://github.com/processing/processing/pull/3910 +X don't follow symlinks when deleting directories +X https://github.com/processing/processing/pull/3916 +X show number of updates available in the footer +X https://github.com/processing/processing/issues/3518 +X https://github.com/processing/processing/pull/3896 +X https://github.com/processing/processing/pull/3901 +o total number of updates available is not correct? (may be fixed) +o ArrayIndexOutOfBoundsException freak out when clicking the header line +o think this was on name, with libraries, but not sure +X should be fixed with the updates from Jakub +X error checker updates for toggle and listeners +X https://github.com/processing/processing/pull/3915 +X file file counting in the change detector +X https://github.com/processing/processing/pull/3917 +X https://github.com/processing/processing/issues/3898 +X https://github.com/processing/processing/issues/3387 +X Windows suggests "Documents" as a new location for the 3.0 sketchbook +X maybe prevent users from accepting that? +X https://github.com/processing/processing/issues/3920 + +gui +X distinguish errors and warnings +X https://github.com/processing/processing/issues/3406 +X make breakpoints more prominent +X https://github.com/processing/processing/issues/3307 (comp is set) +X clean up statusMessage() inside JavaEditor +o do we want to bring back the delays? +X implement side gradient on the editor +X if fewer lines in sketch than can be shown in window, show ticks adjacent +X error/warning location is awkward when no scroll bar is in use +X when only one screen-full, show ticks at exact location +X simpler/less confusing to not show at all? +X MarkerColumn.recalculateMarkerPositions() +X https://github.com/processing/processing/pull/3903 +X Update status error/warning when changing the line +X https://github.com/processing/processing/pull/3907 +X Update status error/warning when changing the line +X when moving away from an error/warning line, de-select it below +X selecting a warning should also show the warning in the status area +X https://github.com/processing/processing/pull/3907 +X clicking an error or warning should give the focus back to the editor +X https://github.com/processing/processing/pull/3905 +X replace startup/about screen (1x and 2x versions) +X change 'alpha' to correct name +X also change the revision in the "about processing" dialog +X https://github.com/processing/processing/issues/3665 +X implement splash screen on OS X +X http://www.randelshofer.ch/oop/javasplash/javasplash.html +X also implement special retina version +X Fix placement and visual design when showing error on hover +X https://github.com/processing/processing/issues/3173 +X implement custom tooltip for error/warning hover +X applies to both MarkerColumn and JavaTextAreaPainter +X make gutter of console match error list +X https://github.com/processing/processing/issues/3904 +o bring back the # of updates on the update tab +o use this instead of the 'icon' stuff? +o or in addition, since only the 'updates' tab has it +X https://github.com/processing/processing/issues/3855 +X for updates available, have it be clickable to open the manager +X fix the design of the completions window +X remove extra border around the outside +X change font +X add 2x version of the icons +X change selection highlight color +o put some margin around it +X https://github.com/processing/processing/issues/3906 +X completion panel +X what should the background color be? +X test fg/bg color on other operating systems +J fix icon sizes/design +X set a better minimum size for the number of updates available + +earlier/cleaning +X list with contrib types separated is really wonky +o do we keep the list? +o does it even work for different contrib types? +X cleaned this up in the last release +X remove the dated releases from download.processing.org +X new Android release (EditorButton constructor changed) +o JavaEditor has several null colors, remove color support +o once the design is complete and we for sure do not need color +X remove deprecated methods +X do the right thing on passing around List vs ArrayList and others +o wonder if "Save As" is causing the problems with auto-reload +X found and fixed +X look at the sound library https://github.com/wirsing/ProcessingSound +o sound is not yet supported on Windows +X implement the new gui + + +0245 (3.0b7) +X add jar files from 'code' folder to the library path +X Code editor wrongly detects errors for libraries in code folder +X https://github.com/processing/processing/issues/3732 +o dim out the Run button if there are compile errors detected +o the AST checker has better error message handling for those cases +o and hitting Run replaces the useful error with something weird +X https://github.com/processing/processing/issues/3408 +X not great because the error checker runs more slowly than your typing +X SVG not highlighting as a keyword +X https://github.com/processing/processing/issues/3752 +X implement 2x versions of icons +X https://github.com/processing/processing/issues/3478 +X foundation icon in list +X foundation icon below next to description when lib selected +X icons on the install/update/remove buttons +X search eyeglass icon +X available/installed/incompatible icons +o change Tool API because it's not one Editor per Tool anymore? +X or just change the documentation? +X updated the FAQ and tool template +X change the Tool API after all, since none of the tools have been updated +X https://github.com/processing/processing/wiki/Tool-Basics +X items still show up in "Recent" if they no longer exist (on startup) +X checked code and this seems to be fine / can't reproduce +X show hover text when the mouse is over the 'debug' button +X update EditorButton rollover label when pressing shift or alt +X welcome screen shows coffee cup icon on Windows +o Hitting enter on code completion completes and then creates a new line +X https://github.com/processing/processing/issues/3741 +X ctrl-space first inserts space, then deletes it, with completion +X https://github.com/processing/processing/issues/3847 +o finish the gui +X https://github.com/processing/processing/issues/3072 +X closing in favor of specific issues +X fix the bold in the welcome window to not use fake bold + +sketch modified +X sketch modified externally with FAT32 volumes on OS X +X https://github.com/processing/processing/issues/3387 +X might have this fixed with the larger time window +X need to check if "save as" thing is causing trouble +X "Your sketch has been modified externally" with encrypted OS X volumes +X https://github.com/processing/processing/issues/3650 +o add this to the preferences? +o use watcher service after all? +o https://docs.oracle.com/javase/tutorial/essential/io/notification.html + +jna problems +X UnsatisfiedLinkError on startup "Access is denied" on Windows 10 +X https://github.com/processing/processing/issues/3800 +X administrator, but using Microsoft account to log in +X JNA errors on startup when run from an account w/ non-ASCII characters +X https://github.com/processing/processing/issues/3624 +X set jna.tmpdir (or java.io.tmpdir) to another location +X https://github.com/twall/jna/issues/124 +X https://github.com/twall/jna/issues/238 +X Sun says they won't fix: user locale and system locale probably different: +X https://bugs.openjdk.java.net/browse/JDK-8017274 +X https://bugs.openjdk.java.net/browse/JDK-4958170 +X https://github.com/twall/jna/blob/master/test/com/sun/jna/JNALoadTest.java +X http://happygiraffe.net/blog/2009/09/24/java-platform-encoding/ +X fix: get sun.jnu.encoding and make sure the user name is supported in it? +X and if not, put up a warning for the user? +X http://www.oracle.com/us/technologies/java/locale-140624.html + +manager +X CM: Clicking item in Libraries list throws exception +X https://github.com/processing/processing/issues/3667 +X CM: Libraries missing descriptions and PFoundation credit +X https://github.com/processing/processing/issues/3688 +X use real version of bold font, rather than the fake version +X remove the "v" from the version numbers in the updates tab +X fix bold version used in the description below, when an item is selected +X manager needs a frame title +X remove tooltip that repeats the contents of the tab labels +X add extra space to the right of the buttons to line up w/ the scrollbar +X CM: Button formatting +X https://github.com/processing/processing/issues/3643 +o Contributions Manager UI design +X https://github.com/processing/processing/issues/3482 +X closing in favor of separate issues +X updates tab has ugly horizontal line at top +X CM selected tabs are too tall +X https://github.com/processing/processing/issues/3598 +X why the aqua background when opening the window? +X get rid of gross italic subheads on the Updates page +X "update all" is too far too the right +X other buttons were out of whack as well +X remove focus blue from the scrollable list +X don't focus the window on the search box on opening +X status/name/author table header is alternating color +X area above scroll bar looks like more scroll bar +X table header is the wrong font + +watcher +X prevent re-prompting users when they say "no" to "sketch modified" message +X add more preferences for editor.watcher +X cleaning up the logic in the watcher + +akarshit +X prevent "updating" to a still-incompatible version of a contrib +X https://github.com/processing/processing/issues/3801 +X https://github.com/processing/processing/pull/3805 +X Tools are getting redundantly added when installing new tool +X https://github.com/processing/processing/issues/3818 +X https://github.com/processing/processing/pull/3820 +X after clicking 'install' it's still possible to click it again +X https://github.com/processing/processing/issues/3806 +X https://github.com/processing/processing/pull/3817 +X CM list should be sortable by status and author name +X https://github.com/processing/processing/issues/3608 +X "update all" button appears to do nothing in library manager +X https://github.com/processing/processing/issues/3837 +X https://github.com/processing/processing/pull/3842 + +jakub +X Make preprocessor scope-aware +X https://github.com/processing/processing/issues/3799 +X https://github.com/processing/processing/pull/3810 +X massive auto-complete/error checker fixes +X https://github.com/processing/processing/issues/3812 +X https://github.com/processing/processing/pull/3845 +X https://github.com/processing/processing/pull/3856 +X Red error underline is sometimes at wrong location +X https://github.com/processing/processing/issues/3759 +X https://github.com/processing/processing/pull/3848 +X using "new color()" instead of "color()" results in "color type detected" +X happens when user does 'new color' instead of 'color' +X https://github.com/processing/processing/issues/3739 +X https://github.com/processing/processing/pull/3850 + + +0244 (3.0b6) +o 3.0b4 demos fail to create PDF files +o https://github.com/processing/processing/issues/3708 +X problem was that the example was creating files inside Processing.app +X Casey reports that exported app still asks to download Java +X could this be a JOGL bug (linking against the app stub?) +X ran otool -L on the binaries and saw nothing +X deal with ConcurrentModificationException in Editor +X "Error repainting line range" and ConcurrentModificationException +X https://github.com/processing/processing/issues/3726 +X repairs to prevent memory leak in EditorConsole +o Claim that an exported application does not copy data directory +X https://github.com/processing/processing/issues/3777 +X copying just fine +X remove old versions of processing-java when installing on OS X +X https://github.com/processing/processing/issues/3786 +X confusion when // tweak is used +X https://github.com/processing/processing/issues/3742 +X change to /// tweak instead +X don't allow breakpoints to be set on blank lines +X https://github.com/processing/processing/issues/3765 + +jakub +X Error/warning location visualisation not updating when editor resizes +X https://github.com/processing/processing/issues/3619 +X https://github.com/processing/processing/pull/3778 +X "unexpected token" on anonymous instance of parameterized Comparator +X https://github.com/processing/processing/issues/533 +X https://github.com/processing/processing/pull/3780 + +contribs +X Code auto-complete not working when Box2D library imported +X https://github.com/processing/processing/issues/3720 + +gsoc +X CM: Category dropdown alignment +X https://github.com/processing/processing/issues/3644 +X https://github.com/processing/processing/pull/3666 +X https://github.com/processing/processing/pull/3669 +X finalize CM tab order +X https://github.com/processing/processing/issues/3613 +X https://github.com/processing/processing/pull/3714 + +fixed in b5, but unconfirmed at press time +X CM - Focus is shifted out of the filter field when something is searched +X https://github.com/processing/processing/issues/3682 +X https://github.com/processing/processing/pull/3701 +X CM - info panel text color +X https://github.com/processing/processing/issues/3642 +X https://github.com/processing/processing/pull/3695 +X https://github.com/processing/processing/pull/3696 +X CM - Filter field display +X https://github.com/processing/processing/issues/3689 +X https://github.com/processing/processing/pull/3698 +X Update buttom enabled when updates are present and background is set +X https://github.com/processing/processing/issues/3614 +X https://github.com/processing/processing/pull/3694 +X Fix info panel text color and alignment in CM +X https://github.com/processing/processing/issues/3642 +X https://github.com/processing/processing/pull/3684 +X Ready to add contributed example packages? +X https://github.com/processing/processing/issues/2953 + +earlier +X EXC_BAD_ACCESS inside AppleIntelHD5000GraphicsGLDriver when starting 3.0a8+ +X https://github.com/processing/processing/issues/3359 +X Hard crash on startup inside strlen call when using 3.0a8+ on OS X +X https://github.com/processing/processing/issues/3360 + + +0243 (3.0b5) +X processing-java isn't working in OS X 10.11 El Capitan +X https://github.com/processing/processing/issues/3497 +o probably have to add the script/Processing.app location to user's path +X line selected for errors is off by one or two +X https://github.com/processing/processing/issues/3654 +X PDE window leaks undisposed Timer objects even when closed +X https://github.com/processing/processing/issues/3655 +X prompt to install Xcode coming up on Export to Application +X http://stackoverflow.com/questions/15371925/how-to-check-if-command-line-tools-is-installed +X "xcode-select -p" returns 0 if they exist (and the dir) or 2 if they don't +X no special case added for 10.8, but it's on the way out +X move processing.mode.java.pdex.XQErrorTable to processing.ui.ErrorTable +X need to make the list abstract, also "scroll to line" feature +X fix red in sidebar, the squiggly line beneath code +X live error checking complains about F instead of f after floats +X https://github.com/processing/processing/issues/3707 +X NoClassDefError with CLibrary and getenv when switching to Android Mode +X https://github.com/processing/processing/issues/3704 + +contribs +X Undo does not move to the correct location in the editor window +X https://github.com/processing/processing/issues/707 +X https://github.com/processing/processing/pull/3660 +X Undo sometimes causes the editor to go blank +X https://github.com/processing/processing/issues/3003 +X https://github.com/processing/processing/pull/3693 +X https://github.com/processing/processing/pull/3702 +X Miscellaneous language improvements +X https://github.com/processing/processing/pull/3700 + +gsoc +X Foundation libraries disapear from CM after restart +X https://github.com/processing/processing/issues/3659 +X https://github.com/processing/processing/pull/3663 +X CM scrolls to bottom of window after updating the list +o https://github.com/processing/processing/issues/3248 +o https://github.com/processing/processing/pull/3328 +X no longer issue in the new release +X CM blue bar missing +X https://github.com/processing/processing/issues/3599 +X https://github.com/processing/processing/pull/3636 +X CM column widths change with selection +X https://github.com/processing/processing/issues/3609 +X https://github.com/processing/processing/pull/3675 +X remove category dropdown from CM except when viewing libraries +X https://github.com/processing/processing/issues/3668 +X https://github.com/processing/processing/pull/3676 +X Right-clicking popup menu closes instead of shifting its location +X https://github.com/processing/processing/issues/3649 +X Use 1x or 2x icons in the CM +X https://github.com/processing/processing/pull/3681 +X Shifted the text right a little bit +X https://github.com/processing/processing/pull/3696 +X No underline and no blue color +X https://github.com/processing/processing/pull/3695 +X Make auto-format into a compund edit +X https://github.com/processing/processing/pull/3693 +X Focus is shifted out of the filter field after CM search +X https://github.com/processing/processing/issues/3682 +X https://github.com/processing/processing/pull/3701 + +earlier/cleaning +X modify build to insert these after antlr run: +X @SuppressWarnings({"unused", "cast"}) +X or get the updated ANTLR, which likely would support it +o scrollable stack trace +o http://www.javalobby.org/java/forums/t19012.html +X disable the Export button if no platforms selected on Export to Application + +cleaning/libraries +o different name for 'lib' folder because of libraries folder? +o avoid some confusion for when describing the libraries folder to users +X could have library developers update compatability note +X so they would need to test library and say "compatible with 0110" +X before it would automatically update or show as an update +o need an "install library" option to deal with urls.. +X need better platform designation setup for libs +X library installation should use the sketchbook folder, not the p5 folder +o actually enforce this, give users a warning about other libs +o versioning info +o http://java.sun.com/j2se/1.5.0/docs/guide/extensions/versioning.html +X changing the sketchbook folder will make libraries show up +o but it won't reload the library mapping table +o set DYLD_LIBRARY_PATH to include .dylib and other framework stuff +o java.library.path will only handle .jnilib stuff + + 0242 (3.0b4) X Fix NullPointerException with some sketches that have no size() command X https://github.com/processing/processing/issues/3585 @@ -73,7 +1598,7 @@ X Comment/Uncomment should ignore leading whitespace X https://github.com/processing/processing/issues/1961 X Export unsaved sketch > agree to save prompt > export doesn't finish X https://github.com/processing/processing/issues/2724 -X Add disconnectEvent() to Server +X Add disconnectEvent() to Server X https://github.com/processing/processing/issues/2133 X False positive for mixing active/static mode in Tweak Mode 3.0 alpha 5 X https://github.com/processing/processing/issues/3140 @@ -125,7 +1650,7 @@ o Invalid code signature on OS X X https://github.com/processing/processing/issues/3575 X cannot reproduce -gsoc +gsoc X Breakpoints don't 'jump' after hitting Enter on blank line X https://github.com/processing/processing/issues/3552 X https://github.com/processing/processing/pull/3571 @@ -414,7 +1939,7 @@ X https://github.com/processing/processing/issues/498 X should be able to build p5 without a JDK install, just a JRE X https://github.com/processing/processing/issues/1840 X need to have ecj.jar accessible to ant, then modify build.xml to use this: -X X http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-ant_javac_adapter.htm @@ -525,7 +2050,7 @@ X https://github.com/processing/processing/issues/3209 X sketchbook window is completely empty w/ no sketches X requires restart of p5 before it updates X https://github.com/processing/processing/issues/3214 -X Replace & Find was reading "Find & Replace" +X Replace & Find was reading "Find & Replace" X https://github.com/processing/processing/issues/3247 X "one file added to sketch" message when two files added X turned out to be really messy ProgressFrame code @@ -539,7 +2064,7 @@ X https://github.com/processing/processing/wiki/Running-without-a-Display X write up code guidelines for project X make proper Eclipse style prefs to reinforce X https://github.com/processing/processing/wiki/Style-Guidelines -X change preproc to write settings() method instead of sketchXxxx() +X change preproc to write settings() method instead of sketchXxxx() cleaning X better text editor / live debugging (integrate Eclipse JDT) @@ -626,7 +2151,7 @@ X https://github.com/processing/processing/pull/3216 0233 (3.0a6) X post a note about the "help" stuff X https://github.com/processing/processing/labels/help -X Deal with ctrl-alt-n regression +X Deal with ctrl-alt-n regression X https://github.com/processing/processing/issues/2979 X don't add a ^M to files when writing X https://github.com/processing/processing/issues/3014 @@ -664,7 +2189,7 @@ X was because of the readSettings() change integration of pdex/debug o make the tabs have a default minimum size o multiple sizes as they get smaller (web browser style) -X merge experimental into the main Java mode +X merge experimental into the main Java mode X thereby removing Java 2.0 mode from the next release X otherwise redoing the design for 2 modes X changed JLS4 to JLS8 (but make sure it doesn't introduce anything too weird) @@ -697,7 +2222,7 @@ o update ld and windres: https://github.com/processing/processing/tree/master/ o also xstream.jar https://github.com/processing/processing/tree/master/java/application/launch4j/lib earlier -X any problems with new code signing crap? +X any problems with new code signing crap? X issues raised around the symlink (just replace with a copy of the binary?) X fixed the short-term problem, filed an issue for the rest X https://developer.apple.com/library/prerelease/mac/technotes/tn2206/_index.html#//apple_ref/doc/uid/DTS40007919-CH1-TNTAG205 @@ -826,7 +2351,7 @@ X https://github.com/processing/processing/issues/3133 X https://github.com/processing/processing/pull/3177 X Fix ColorChooser cursor X https://github.com/processing/processing/pull/3186 -X Improve Spanish localization +X Improve Spanish localization X https://github.com/processing/processing/pull/3185 X internationalization of editor error messages and greek translations X https://github.com/processing/processing/pull/3189 @@ -897,7 +2422,7 @@ pulls (net) X NullPointerException message when Server writes to a disconnected client X https://github.com/processing/processing/issues/2577 X https://github.com/processing/processing/pull/2578 -X Implement the active() method for Serial and Server +X Implement the active() method for Serial and Server X https://github.com/processing/processing/issues/2364 X https://github.com/processing/processing/pull/2588 @@ -942,7 +2467,7 @@ X closed by Dan post-3.0a3 X move sketchbook into its own window X move recent into the sketchbook menu X try installing 10.7.3 on Mac Mini and check whether things run -X make sure it's only running on 64-bit machines? +X make sure it's only running on 64-bit machines? gsoc X remove dependency on oscp5 library for tweak mode @@ -1094,7 +2619,7 @@ X fix "No such file or directory" error when exporting an application on OSX X this also resulted in the application not being signed at all X https://github.com/processing/processing/issues/2614 X this is a fairly major issue... -X possible to open a sketch multiple times +X possible to open a sketch multiple times X by double-clicking one of its files instead of the main pde file X user opens non-main pde of already open sketch, it'll open again X https://github.com/processing/processing/issues/2506 @@ -1111,7 +2636,7 @@ X some aren't being removed properly X fix the build scripts to include the examples X https://github.com/processing/processing/issues/2652 X all examples are out of "processing/java" and are now in "processing-docs/content/". The Book examples have been removed entirely from our repositories. -o "Platform is ${platform}" message during 'ant clean' +o "Platform is ${platform}" message during 'ant clean' o on OS X, but not Windows (haven't checked Linux) X this was in pdex/build.xml X remove welcome message from the sound library @@ -1153,7 +2678,7 @@ X https://github.com/processing/processing/pull/2657 pulls X insert tabs properly when prefs set for tabs mode X https://github.com/processing/processing/pull/2607 -X improve look of Nimbus LAF +X improve look of Nimbus LAF X https://github.com/processing/processing/pull/2671 earlier @@ -1166,7 +2691,7 @@ X https://github.com/processing/processing/issues/2141 o double-clicking a .pde file doesn't open properly on OS X o https://github.com/processing/processing/issues/2639 X moving p5 examples to the web repo -X move examples into web repo +X move examples into web repo o OS X not opening a sketch at all on pde double-click? (though opening the app) X Chinese text is overlapped in Processing 2.1 editor X https://github.com/processing/processing/issues/2173 @@ -1187,7 +2712,7 @@ X https://github.com/processing/processing/issues/2545 earlier X cpu usage when nothing happening (unmarked duplicate) -X https://github.com/processing/processing/issues/1074 +X https://github.com/processing/processing/issues/1074 gsoc X Line coloring incorrect for filtered contribution listings @@ -1235,7 +2760,7 @@ X missing 'version' in contrib causes NPE X https://github.com/processing/processing/issues/2517 X bring back setIcon(Frame) for PDE X and others X https://github.com/processing/processing-experimental/issues/64 -X how was PDE X able to crash 2.2? +X how was PDE X able to crash 2.2? X add additional code to rework how this is handled X Auto Format patch mess X https://github.com/processing/processing/pull/2271 @@ -1277,7 +2802,7 @@ X fix for Windows command line X fix for Linux launcher X fix for Linux export X fix for Linux command line -X fix for OS X launcher +X fix for OS X launcher X fix for OS X export X fix for OS X command line X import static causes exception (with fix) @@ -1424,7 +2949,7 @@ G Handle the UnsatisfiedLinkError when loading the native library fails G https://github.com/processing/processing/pull/2266 fixed in 2.1 -X init() not called on tools until later +X init() not called on tools until later X https://github.com/processing/processing/issues/1859 X Finish changes so the PDE can use an unmodified JRE X https://github.com/processing/processing/issues/1840 @@ -1432,8 +2957,8 @@ X https://github.com/processing/processing/issues/1840 0223 pde (2.1) X reset font smoothing for everyone to its default by changing the pref -X To reset everyone's default, replaced editor.antialias with editor.smooth -X for 2.1. Fonts are unusably gross on OS X (and Linux) w/o smoothing and +X To reset everyone's default, replaced editor.antialias with editor.smooth +X for 2.1. Fonts are unusably gross on OS X (and Linux) w/o smoothing and X the Oracle JVM, and many longtime users have anti-aliasing turned off. X https://github.com/processing/processing/issues/2164 X https://github.com/processing/processing/issues/2160 @@ -1505,7 +3030,7 @@ X spacing problem with large sizes (on retina?) X not just retina, was problem with non-mono text from Java X control text size in console o why aren't prefs from theme.txt showing up in preferences.txt? hrm -o or rather, why can't they be overridden? +o or rather, why can't they be overridden? X because theme.txt data is a different animal / that's part of the point X should fonts at least be in prefs.txt? X http://code.google.com/p/processing/issues/detail?id=226 @@ -1533,7 +3058,7 @@ X had already been closed X serial ports missing from list (OS X) X http://code.google.com/p/processing/issues/detail?id=52 X also was marked fixed... -X Serial.write problem with Bluetooth SPP virtual serial port +X Serial.write problem with Bluetooth SPP virtual serial port X http://code.google.com/p/processing/issues/detail?id=318 X was marked duplicate of #52 X Serial silently fails when invalid port entered as string @@ -1665,7 +3190,7 @@ X fix submitted by hamoid 0220 pde (2.0.2) -X fix "less less" typo +X fix "less less" typo X https://github.com/processing/processing/issues/1928 X slash breaks syntax highlighting (with spaces) X https://github.com/processing/processing/issues/1681 @@ -1683,11 +3208,11 @@ X https://github.com/processing/processing/issues/1908 X Update JNA from 3.2.4 to 3.5.2 X https://maven.java.net/content/repositories/releases/net/java/dev/jna/jna/3.5.2/jna-3.5.2.jar X https://maven.java.net/content/repositories/releases/net/java/dev/jna/platform/3.5.2/platform-3.5.2.jar -X problem with associating .pde files +X problem with associating .pde files X https://github.com/processing/processing/issues/286 X http://code.google.com/p/processing/issues/detail?id=247 o In regedit: Navigate to Computer\HKEY_CLASSES_ROOT\Applications and find your .exe name. Navigate under its name to shell>open>command. In the Default change its location to the actual location of the executable, hit okay and then try and reassociate the file type as you normally would. -X UnsatisfiedLinkError causes huge message... +X UnsatisfiedLinkError causes huge message... X error report cleanups haven't been fixed yet X reported by Dan X this should be better now @@ -1805,7 +3330,7 @@ o check if libraries folder does not exist o check to see if other libraries are installed X warn user about moving libraries and restarting X add "pretty menu name" to the export.txt file -o move export.txt to xml? +o move export.txt to xml? X nah, it's only flat information X tools -> get library X library url: [ http://blahblah.org/something ] @@ -1885,7 +3410,7 @@ o also send pull request for Florian manager X "New version available" mesage is showing html tags around it X https://github.com/processing/processing/issues/1684 -X shift color of installed items when selected +X shift color of installed items when selected X was ugly gray over selection color X fix layout of the update button X get update text to align vertically @@ -1899,7 +3424,7 @@ X MovieMaker tool will not start on Windows 8 X make a little less fragile by not launching as separate process X http://code.google.com/p/processing/issues/detail?id=1447 X clean up the code and interface for the Movie Maker tool -X http://code.google.com/p/processing/issues/detail?id=836 +X http://code.google.com/p/processing/issues/detail?id=836 X on Windows, the Help menu seems to start with a separator X add 6u37 as the Java runtime o TextAreaDefaults - is editable in use? @@ -1923,7 +3448,7 @@ X NSHighResolutionCapable X true X add basics of retina support to the toolbar and header X getDefaultToolkit().getDesktopProperty("apple.awt.contentScaleFactor"); -X paper over ArrayIndexOutOfBoundsException in JEditTextArea.xToOffset() +X paper over ArrayIndexOutOfBoundsException in JEditTextArea.xToOffset() X Fix IllegalStateException on Windows/Linux in Save prompt X happened when hitting ESC or otherwise closing the window X "Find in Reference" largely broken in 2.0b7 @@ -1932,7 +3457,7 @@ X discern variable vs function with Find in Reference X if no selection, attempt to expand the selection for Find in Reference X add cmd-shift-O to "Open Examples" on OS X with no window open X go through vida examples to make sure extra imports are not being used -o do command line to run through all examples? +o do command line to run through all examples? X remove Quaqua X http://code.google.com/p/processing/issues/detail?id=1509 X remove separate launch of QT movie creator @@ -1996,7 +3521,7 @@ tool manager X from Casey X list in the PDE would be updated automatically by querying a web service X list on the website would be generated using the same web service -X All I would need to do is update web/contrib_generate/sources.conf +X All I would need to do is update web/contrib_generate/sources.conf X and the rest would happen automatically. X general cleanup of the visuals/layout X extra files still being left around during install @@ -2016,7 +3541,7 @@ X http://code.google.com/p/processing/issues/detail?id=1387 0215 pde (2.0b7) -X "expecting EOF, found 'import'" on previously working sketch +X "expecting EOF, found 'import'" on previously working sketch X http://code.google.com/p/processing/issues/detail?id=1376 X changing default imports to only cover those we have in the reference X also on the Android side as well @@ -2077,7 +3602,7 @@ X http://code.google.com/p/processing/issues/detail?id=1426 X double textMode() error message with P3D: X textMode(SCREEN) has been removed from Processing 2.0. X textMode(256) is not supported by this renderer. -X errors that cannot be placed (i.e. missing brace) +X errors that cannot be placed (i.e. missing brace) X this makes things to jump to the last tab X also happens with stray characters sometimes... X casey: accidentally typing a letter at the top of the tab @@ -2143,7 +3668,7 @@ X (stubbing things in for artwork update later) 0212 pde (2.0b4) -M implement find & replace over multiple tabs +M implement find & replace over multiple tabs M http://code.google.com/p/processing/issues/detail?id=25 M added to the projects list X change all build.xml files to use Java 6 as both source and target @@ -2212,7 +3737,7 @@ X make Mode menu into a radio button, so it cannot be de-selected X http://code.google.com/p/processing/issues/detail?id=1227 X no response with registerMethod keyEvent when key pressed or released X http://code.google.com/p/processing/issues/detail?id=1225 -o running at size(7000, 4000) followed by size(100, 100) +o running at size(7000, 4000) followed by size(100, 100) X http://code.google.com/p/processing/issues/detail?id=1213 X won't fix, too hairy and messy X clean up handling of untitled sketches @@ -2233,7 +3758,7 @@ X no changes 0209 pde (2.0b1) X require Mac OS X 10.6.8 as the minimum -X replace/find need to dim out the buttons +X replace/find need to dim out the buttons X i.e. hitting 'replace' multiple times causes weirdness X and replace/replace+find buttons shouldn't be active until after a find X http://code.google.com/p/processing/issues/detail?id=1056 @@ -2255,11 +3780,11 @@ X problem was 'extends' after 'implements' X "Open" dialog on Linux wasn't showing directories X http://code.google.com/p/processing/issues/detail?id=1151 X switch Platform to just use java.awt.Desktop classes -X for Java 1.6, replace com.apple.eio.FileManager.openURL(url); +X for Java 1.6, replace com.apple.eio.FileManager.openURL(url); X with java.awt.Desktop.browse() and java.awt.Desktop.open() X causes a deprecation warning whenever building on osx o instead of "show sketch folder" method, use: -The com.apple.eio.FileManager now has two new desktop interaction methods, revealInFinder(File) and moveToTrash(File). You can use revealInFinder() to open a Finder window in the parent directory of of a file and select it. You can use moveToTrash() to move a file to the most appropriate Trash directory for the volume that contains that file. +The com.apple.eio.FileManager now has two new desktop interaction methods, revealInFinder(File) and moveToTrash(File). You can use revealInFinder() to open a Finder window in the parent directory of of a file and select it. You can use moveToTrash() to move a file to the most appropriate Trash directory for the volume that contains that file. X added 64-bit RXTX for Mac OS X X http://blog.iharder.net/2009/08/18/rxtx-java-6-and-librxtxserial-jnilib-on-intel-mac-os-x/ X bufferUntil() with values above 127 do not work properly @@ -2289,18 +3814,18 @@ o shift-tab with no selection should go back two spaces cleaning o switching into present mode in info.plist o LSUIPresentationMode -o 4 +o 4 o errors with serial and libraries Exception in thread "Thread-2" java.lang.NoClassDefFoundError: processing/core/PApplet - at processing.serial.Serial.(Serial.java:156) + 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. +/System/Library/Extensions. F add processing.js export tool from florian F http://github.com/fjenett/processingjstool/ F http://github.com/fjenett/processingjstool/zipball/v0.0.6 @@ -2356,7 +3881,7 @@ o this would take care of nasty macosx 1.4 vs 1.5 issues o /System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Commands/java o /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Commands/java o /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Commands/java -o canonical path for +o canonical path for o /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK o will return 1.5.0 (or maybe 1.6 for others?) X nope, just using a local JRE/JDK from now on @@ -2381,7 +3906,7 @@ X http://code.google.com/p/processing/issues/detail?id=72 X doesn't seem to be a problem on modern machines X in rebuild sketch menu - disable subfolders working as libraries X if a sketch, don't allow subfolders -o or maybe just that libraries must be in the root? +o or maybe just that libraries must be in the root? o nah, cuz that would mean can't make subfolder called "libraries" X no longer possible since separate libraries folder is in use X is the 'hide' option for code dumb? i've never used it @@ -2402,8 +3927,8 @@ X http://code.google.com/p/processing/issues/detail?id=32 X http://code.google.com/p/processing/issues/detail?id=958 X decided not to: simple workaround available o setting sketchbook to a folder on a network mounted drive -o does this work? test on both on mac and pc.. -o or if not, should recommend people against it +o does this work? test on both on mac and pc.. +o or if not, should recommend people against it o (i.e. folders disappearing if net has trouble) X http://code.google.com/p/processing/issues/detail?id=33 X decided wontfix, nobody has ever followed up @@ -2447,7 +3972,7 @@ o http://dev.processing.org/bugs/show_bug.cgi?id=562 X Monaco can no longer be disabled X modes have their own methods for digging through sketch & libraries folders o therefore it need only check the sketch.txt file to see if it's ok -o (between android and java) +o (between android and java) o but more importantly, if it's something totally different (.py) then o that'll be ok, and work fine o need another extension for the p5 py stuff @@ -2548,7 +4073,7 @@ o don't re-open new window on top of another X changing how this is handled X detect mode and library example folders for recent menu o with the same sketch open, a handleOpen() might open a second on top of it -X should be fixed up +X should be fixed up applets o tool to run in appletviewer? sun.applet.Main is appletviewer @@ -2559,11 +4084,11 @@ o courseware o export sketch as applet when uploading o save sketch zip files o have a means to load them from "teacher" version of p5 -o figure out how to use the +o figure out how to use the o items from the 'code' folder not included with applet export o add tool to "Add custom html to sketch" -o that copies applet.html, -o opens sketch folder, +o that copies applet.html, +o opens sketch folder, o and gives info about what to do next (how to edit) o http://dev.processing.org/bugs/show_bug.cgi?id=143 @@ -2602,7 +4127,7 @@ X not seen for a while, closed o multiple entries in file menu o http://dev.processing.org/bugs/show_bug.cgi?id=1260 X should be fixed, not seen -o "src/processing/xxxx/Xxxxxxxx.java uses unchecked or unsafe operations." +o "src/processing/xxxx/Xxxxxxxx.java uses unchecked or unsafe operations." X http://code.google.com/p/processing/issues/detail?id=101 o use pack200/unpack200 to make p5 download smaller X http://code.google.com/p/processing/issues/detail?id=95 @@ -2641,7 +4166,7 @@ X export and export to application fail with umlauts in folder name X http://dev.processing.org/bugs/show_bug.cgi?id=252 X fixed in 0140, but no confirmation o stop button needs to update itself and work properly -o also editor buttons to light up and clear properly +o also editor buttons to light up and clear properly X http://dev.processing.org/bugs/show_bug.cgi?id=396 o need someone to go out and test all scenarios of this X this particular version was fixed (though broken again later) @@ -2684,8 +4209,8 @@ X marked cantfix o using a processing keyword as a variable name gives unhelpful error message X http://dev.processing.org/bugs/show_bug.cgi?id=213 X fixed issue specific to handleDisplay -o not enough args for triangle (or args in general) -o throws out bizarre message +o not enough args for triangle (or args in general) +o throws out bizarre message o http://dev.processing.org/bugs/show_bug.cgi?id=17 X fixed up later X expecting RPAREN messages are ugly @@ -2693,7 +4218,7 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=15 o unchecking 'use external editor' sketch should not set modified o dangerous if a version that hasn't been re-loaded has possibility o to overwrite. i.e. make a change and save in external editor, -o don't actually +o don't actually o comments shown as code / code shown as comments o http://code.google.com/p/processing/issues/detail?id=164 X merged into new editor issue @@ -2701,7 +4226,7 @@ o program sometimes goes gray because it thinks everything is in a comment o http://code.google.com/p/processing/issues/detail?id=564 X merged into new editor issue o failed export still copies random files -o Failed compile on Export or Export to Application +o Failed compile on Export or Export to Application o still creates folder and leaves mess behind X http://dev.processing.org/bugs/show_bug.cgi?id=1050 X opted not to fix (rationale in the report) @@ -2755,8 +4280,8 @@ o http://dev.processing.org/bugs/show_bug.cgi?id=114 o when drawing large video, the two triangles for the rect are out of sync o only shows up in P3D o pause and frameRate aren't working -o framerate does set the frequency which movieEvent will be called, -o but it is not setting the "available" field corrrectly. +o framerate does set the frequency which movieEvent will be called, +o but it is not setting the "available" field corrrectly. o in fact, speed() should be used to set the rate, not frameRate o sketch .zip file in casey's email message X http://dev.processing.org/bugs/show_bug.cgi?id=370 @@ -2768,11 +4293,11 @@ o include a separate video class to handle just playback o video playback can be much faster if not messing with pixels o could instead use texsubimage in opengl, etc o only supports tint() (to set alpha or color) and drawing? just drawing? -o stop button won't kill a video sketch (bug 150 example does this) +o stop button won't kill a video sketch (bug 150 example does this) X although ESC seems to work? (not sure, didn't test) o or audio won't stop even after hitting stop o when an exception comes through during cameraEvent, not printed -o need to show an actual stack trace (InvocationTargetEx) +o need to show an actual stack trace (InvocationTargetEx) o because otherwise it's impossible to debug this stuff o video library not working on export to web o http://dev.processing.org/bugs/show_bug.cgi?id=1421 @@ -2787,7 +4312,7 @@ o fix "reply" garbage added o fix "back to bug# 778" o remove patch designation o make severity a radio button (people aren't using it) -o change to just ( ) Problem ( ) Feature Request (remove 'severity') +o change to just ( ) Problem ( ) Feature Request (remove 'severity') o remove 'platform' dropdown o specify some versions? also add back a "target version" for fix? o explanation of P1 through P5 @@ -2813,7 +4338,7 @@ o layout problems with attachments page o http://dev.processing.org/bugs/show_bug.cgi?id=254 o layout problems with logout page o http://dev.processing.org/bugs/show_bug.cgi?id=255 -o bug duplicate text field doesn't retain focus +o bug duplicate text field doesn't retain focus o http://dev.processing.org/bugs/show_bug.cgi?id=256 o finish putting all the bugs into bugzilla o add a notation to the bugs site re: reading the faq and searching first @@ -2924,7 +4449,7 @@ X and fixed again for non-greedy regex X make note of when library is not available (serial) with error msg X i.e. if running in 64-bit mode on OS X, can't do serial X update to Java 6u29 for Linux and Windows (OS X now updated) -X don't show library conflict warning until someone tries to build +X don't show library conflict warning until someone tries to build X with code that actually calls on one of those packages X too many people seem to think this is an error X work on code to quit if multiple instances are running @@ -3043,7 +4568,7 @@ o add deployJava.js to local sketch folder (causes internet requirement) X http://code.google.com/p/processing/issues/detail?id=650 X http://www.java.com/js/deployJava.js X bad idea, since it adds 17k to every download -X make examples window respond to ESC +X make examples window respond to ESC X and double-click events to expand/collapse nodes X examples window placed off-screen when PDE window is maximized X http://code.google.com/p/processing/issues/detail?id=669 @@ -3053,7 +4578,7 @@ X New/Rename Tab commands inhibited when Console/Message Area is hidden X http://code.google.com/p/processing/issues/detail?id=745 X make sketch.properties usable elsewhere by loading/reloading X http://code.google.com/p/processing/issues/detail?id=722 -X Export to Application reports "Could not copy source file:" +X Export to Application reports "Could not copy source file:" X http://code.google.com/p/processing/issues/detail?id=638 X automatically insert the 'import processing.opengl' when P3D used X add support for automatically including OpenGL when asking for P3D @@ -3063,8 +4588,8 @@ X http://code.google.com/p/processing/issues/detail?id=747 cleanup X how is autoformat doing? good now -X catch 1.5 code in libraries - is this still an issue for 1.6 on 1.5? -X Exception in thread "main" java.lang.UnsupportedClassVersionError: quicktime/QTException (Unsupported major.minor version 49.0) +X catch 1.5 code in libraries - is this still an issue for 1.6 on 1.5? +X Exception in thread "main" java.lang.UnsupportedClassVersionError: quicktime/QTException (Unsupported major.minor version 49.0) o javascript and liveconnect to preload applets o http://code.google.com/p/processing/issues/detail?id=66 X let's not bother @@ -3075,7 +4600,7 @@ o package cc.arduino.* X no thanks, they've abandoned it o add page numbers and file name to printing in p5 o also add something to control the font & font size -X -> jer: "can we put fax support in there too?" +X -> jer: "can we put fax support in there too?" o prevent people from setting the font size too small in the editor o how do we figure out what "too small" is? X -> everyone thinks this is funny @@ -3127,7 +4652,7 @@ X http://code.google.com/p/processing/issues/detail?id=627 X file-save stops running sketch X http://dev.processing.org/bugs/show_bug.cgi?id=810 X http://code.google.com/p/processing/issues/detail?id=100 -X fix bug in loadfile2 example +X fix bug in loadfile2 example X http://code.google.com/p/processing/issues/detail?id=522 o when running with external editor, hide the editor text area o http://dev.processing.org/bugs/show_bug.cgi?id=20 @@ -3148,7 +4673,7 @@ X run the javadoc for 1.5 X remove opengl2 for 1.5 and examples for the final 1.5 X need to get a new stable release out there, the docs/ref are out of sync -from peter n lewis +from peter n lewis X Use Selection For Find X http://code.google.com/p/processing/issues/detail?id=571 X double-clicking whitespace selects adjacent chars @@ -3295,7 +4820,7 @@ o can make full screen work via Info.plist key o http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1135921427;start=7#7 X added to export defaults in a much earlier version X when running externally, set window frame title to the sketch name -X is this only a problem on macosx? +X is this only a problem on macosx? console, preferences X removed build.path from preferences.txt @@ -3443,7 +4968,7 @@ X don't keep repeating them 0190 (pre) X be more specific about linux/sun/java error messages X allow 'oracle' in java version name string -X the open button on the toolbar is goofed up +X the open button on the toolbar is goofed up X http://code.google.com/p/processing/issues/detail?id=323 X changed how "Save As" works, now copies everything in the folder X but ignores applet, application.*, screen-* files/folders @@ -3453,9 +4978,9 @@ X also fixed unicode entities earlier X add warning message when not using a version of sun java w/ p5 on linux -X Ctrl-Z will undo, but not scroll to where the undo happens. +X Ctrl-Z will undo, but not scroll to where the undo happens. X is this now somehow fixed? (or only on os x?) -X so user thinks nothing is happening and overundo. +X so user thinks nothing is happening and overundo. X http://dev.processing.org/bugs/show_bug.cgi?id=35 X http://code.google.com/p/processing/issues/detail?id=15 @@ -3473,7 +4998,7 @@ X update the about screens (about.jpg and about.bmp) 0187 pde (pre) X don't require an editor window to be open at all times X The com.apple.eawt.Application now has a setDefaultMenuBar(JMenuBar) method -X that sets a default menu bar when no other Frames are open. +X that sets a default menu bar when no other Frames are open. X could check for availability of method X and if it's there, don't require people to quit X Prevent horizontal scroll offset from disappearing @@ -3483,7 +5008,7 @@ o http://dev.processing.org/bugs/show_bug.cgi?id=23 X Fix NullPointerException when making a new sketch on non-English systems X http://code.google.com/p/processing/issues/detail?id=283 X show warning message on linux if sun java is not in use -X there isn't a perfect way to detect whether sun java is in use, +X there isn't a perfect way to detect whether sun java is in use, X so please report false positives (or negatives, for that matter) X bad strlen() problem in windows launcher.cpp X http://code.google.com/p/processing/issues/detail?id=303 @@ -3504,7 +5029,7 @@ X thanks to Larry Kyrala X http://dev.processing.org/bugs/show_bug.cgi?id=1549 X fix for PDF library to support createFont() on Linux X http://dev.processing.org/bugs/show_bug.cgi?id=1566 -X thanks to Matthias Breuer +X thanks to Matthias Breuer X add option to change the formatting for untitled sketch naming X http://dev.processing.org/bugs/show_bug.cgi?id=1091 X Can't input full-width space when Japanese IME is on. @@ -3528,7 +5053,7 @@ X http://code.google.com/p/processing/issues/detail?id=245 0184 pde (pre) X other libraries that use opengl weren't using the jnlp launcher -X fix OpenGL detection in sketches so that proper version of +X fix OpenGL detection in sketches so that proper version of X export template is used X http://dev.processing.org/bugs/show_bug.cgi?id=1530 X single-line html comments not handled properly on export @@ -3631,11 +5156,11 @@ J casting problems in the parser J straighten out int() -> toInt() conversions J float u = float(x)/width; works. J float u = (float(x)/width); doesn't work: "unexpected token: float". -J float u = (x/float(width)); works! +J float u = (x/float(width)); works! J http://dev.processing.org/bugs/show_bug.cgi?id=4 J return (int(5.5)) causes an error J preprocessor error if last line of code is a comment with no CR after it, -J an OutOfMemoryError wants to happen, +J an OutOfMemoryError wants to happen, J but right now there's a hack to add a CR in PdePreprocessor J http://dev.processing.org/bugs/show_bug.cgi?id=5 J preproc can't handle labels to break/continue nested loops @@ -3721,7 +5246,7 @@ X fix this for windows and linux X PApplet.main() overwritten X http://dev.processing.org/bugs/show_bug.cgi?id=1446 o need to do a better job of error handling inside main() -X applets now use the deployjava.js file +X applets now use the deployjava.js file X not opengl, but the others do X NullPointerException in JOGLAppletLanucher with Java 6 Update 18 on Windows X switching to more efficient JNLP export @@ -3735,7 +5260,7 @@ X processing 0142 japanese input problem X http://dev.processing.org/bugs/show_bug.cgi?id=854 X update JNA to version 3.2.4 to support Windows 7 64-bit X http://dev.processing.org/bugs/show_bug.cgi?id=1424 -X fix LITERAL_class in PDE code (help from Christian Thiemann) +X fix LITERAL_class in PDE code (help from Christian Thiemann) X http://dev.processing.org/bugs/show_bug.cgi?id=1466 X replace applet.html and applet-opengl.html X http://dev.processing.org/bugs/show_bug.cgi?id=1057 @@ -3903,7 +5428,7 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=1260 X try adding a space to the name of the help menu for beachball problems X this works, might be useful to make the switch (done) X remove isManagingFocus problem inside JEditTextArea -X IDE crashed when changing color scheme on windows +X IDE crashed when changing color scheme on windows X http://dev.processing.org/bugs/show_bug.cgi?id=1237 X space in front of linux shell script prevents it from running X http://dev.processing.org/bugs/show_bug.cgi?id=1250 @@ -3922,7 +5447,7 @@ X update to java 6u14 on linux 0165 pde (1.0.3) -X no changes in this release +X no changes in this release 0164 pde (1.0.2) @@ -3965,11 +5490,11 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=986 0163 pde (1.0.1) X ArrayIndexOutOfBoundsException with File > New (Processing 1.0) -X maybe a /tmp permissions problem? +X maybe a /tmp permissions problem? X are we not checking errors properly on this route? X http://dev.processing.org/bugs/show_bug.cgi?id=1067 X need to look into why this didn't give a better error message -X "[JavaAppLauncher Error] CallStaticVoidMethod() threw an exception" +X "[JavaAppLauncher Error] CallStaticVoidMethod() threw an exception" X on startup with OS X X http://dev.processing.org/bugs/show_bug.cgi?id=1063 X http://dev.processing.org/bugs/show_bug.cgi?id=1078 @@ -3984,13 +5509,13 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=1073 X "space-import-space-quote-semicolon" Causes Error in String or Comment X http://dev.processing.org/bugs/show_bug.cgi?id=1064 X the changes page doesn't have a toc entry for the 1.0 release notes -X add minim to the changes page +X add minim to the changes page 0162 pde (1.0) X update revisions.html X write revisions.txt -X in 0149, removed /System/Library/Java +X in 0149, removed /System/Library/Java X http://dev.processing.org/bugs/show_bug.cgi?id=1045 X do we need to shore up server setup for 1.0 release pounding? o what's the deal with disk space? @@ -4118,7 +5643,7 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=886 X rename GettingStarted_Shape example invalid -o launch4j "An error occurred while starting the application" +o launch4j "An error occurred while starting the application" o http://dev.processing.org/bugs/show_bug.cgi?id=986 o tabs menu not working on osx ppc (can't confirm) o http://dev.processing.org/bugs/show_bug.cgi?id=993 @@ -4146,9 +5671,9 @@ X bug report: X create a new sketch, write something in it X create a new tab, name it "something.java", write something into it X rename main tab (sketch) to "something" (without ".java") -X the contents in the files are not the same, but the main-tab is -X showing the contents of the .java tab, so if you press save -X you will overwrite your original code from the main-tab. +X the contents in the files are not the same, but the main-tab is +X showing the contents of the .java tab, so if you press save +X you will overwrite your original code from the main-tab. X com.sun.jdi.AbsentInformationException when running a sketch X http://dev.processing.org/bugs/show_bug.cgi?id=971 @@ -4161,7 +5686,7 @@ X include javac? would this be a good solution for linux? X http://dev.processing.org/bugs/show_bug.cgi?id=8 X an empty .java tab will throw an error X http://dev.processing.org/bugs/show_bug.cgi?id=10 -X warn about writing non-1.1 code. +X warn about writing non-1.1 code. X http://dev.processing.org/bugs/show_bug.cgi?id=11 X java.lang.NoClassDefFoundError: quicktime/std/StdQTException X people not installing qt? no QTJAVA set? @@ -4169,7 +5694,7 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=669 o simulate this by removing qtjava.zip, then make a handler for it o which will open the reference for it X use the registry key, and warn the user when it's not there -X mouse wheel broken in the text editor? (windows jdk 1.5?) +X mouse wheel broken in the text editor? (windows jdk 1.5?) X http://dev.processing.org/bugs/show_bug.cgi?id=24 @@ -4260,7 +5785,7 @@ o sketch must be saved to use a constructor X http://dev.processing.org/bugs/show_bug.cgi?id=929 X reference bug, example cannot have same name as an inner class -structural +structural X processing.candy has been removed X processing.xml is now part of core.jar, no need to import X user-contributed tools and libraries should only be placed in the sketchbook @@ -4277,13 +5802,13 @@ X createInput() (nee openStream), createInputRaw(), createOutput() cleanup o how to grab the java2d object from PGraphics2D -o example for using mediatracker to load images -o simple example for threaded image loading "load several" +o example for using mediatracker to load images +o simple example for threaded image loading "load several" o (rather than blocking on each) o maybe add a loadImages(String files[]) function? o use a MediaTracker that's shared, so that while an image is still o loading, other calls to loadImage might be able to add things to the -o queue. or maybe beginImage() and endImage()? or a mode that lets +o queue. or maybe beginImage() and endImage()? or a mode that lets o you wait for the images to download (size is zero until they're ready) o MediaTracker blocking is prolly making jar download really slow o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1089914280 @@ -4399,13 +5924,13 @@ o 3 column input file o regexp to find, to replace, human readable description o (void\s+)loop(\s+{) -> $1draw$2 (maintain all whitespace stuff) o "The loop() method is now called draw() as of beta" -o "angleMode no longer exists, use radians() around your angles" +o "angleMode no longer exists, use radians() around your angles" o (comment out the line) X this would only fix the minor stuff, not the important stuff X it also has a lot of potential problems and corner cases X just not worth the effort X tools api -X need to support the basic set of functions that are expected +X need to support the basic set of functions that are expected X to be used, otherwise it's gonna be total hell when we make a real api X getEditor() X get/setSelStart/End @@ -4431,7 +5956,7 @@ X no, bad idea.. don't want a zillion submenus on things 0146 pde -X fix problem with comment/uncomment and indent/outdent +X fix problem with comment/uncomment and indent/outdent X when no selection, and on the first pos of the line X on comment/uncomment, need to check if *all* lines are commented X otherwise should be comment (never uncomment unless all selected) @@ -4443,11 +5968,11 @@ X also highlighting the correct line X Exceptions not being reported properly to the PDE X lines with errors not highlighting X http://dev.processing.org/bugs/show_bug.cgi?id=877 -X was ok in 0144, but 0145 things broke +X was ok in 0144, but 0145 things broke X probably b/c not catching ex inside the run() method X getMessage() not sufficient for exceptions coming through X get actual message text, plus the exception itself -X now using actual sketch name (instead of temp name) +X now using actual sketch name (instead of temp name) X this should be safe since launching an external vm to run X make the p5 icon show up for the window X when launching a new sketch @@ -4463,7 +5988,7 @@ X http://processing.org/bugs/show_bug.cgi?id=42 X exceptions in draw() apps aren't caught X the program resize(200, 200); just does nothing (doesn't complain) X http://dev.processing.org/bugs/show_bug.cgi?id=81 -X exception in setup() on external app doesn't kill run button +X exception in setup() on external app doesn't kill run button X also doesn't kill external vm X http://dev.processing.org/bugs/show_bug.cgi?id=79 X fixed in the 0140s @@ -4521,7 +6046,7 @@ o this is particularly bad with threaded applications 0143 pde X fixed build problems with macosx and linux, thanks to reports -o need to compare with localized version of javac strings +o need to compare with localized version of javac strings X http://dev.processing.org/bugs/show_bug.cgi?id=828 X just moving to ecj instead of javac X preproc code showing through since it's on line 0: @@ -4559,7 +6084,7 @@ o 2) its mod date is earlier than when p5 0125 was installed o point the user to Tools -> Reload sketch with local encoding o then re-save the file to update the mod date o ...or, when first running p5 0125, offer to update sketches -o this is a bad idea--since it's probably +o this is a bad idea--since it's probably X need to set a default charset for use in files (utf8) X add option to change charset or specify as part of loading X need to specify the default encoding @@ -4581,12 +6106,12 @@ X can't seem to verify this X occasional division by zero on windows X http://dev.processing.org/bugs/show_bug.cgi?id=777 X should be fixed, but need to verify once a release candidate is ready -X two fixes for readBytesUntil() and bufferUntil() +X two fixes for readBytesUntil() and bufferUntil() X also not calling serialEvent() X http://dev.processing.org/bugs/show_bug.cgi?id=96 X fix goof with console preference in preferences.txt X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1213042400 -X need to add usequartz when running externally? +X need to add usequartz when running externally? X no, tested and it seems to be working cleaning @@ -4640,14 +6165,14 @@ X xml.getIntAttribute() returns a float X http://dev.processing.org/bugs/show_bug.cgi?id=790 X include memory settings with exported applications on macosx X http://dev.processing.org/bugs/show_bug.cgi?id=803 -X error highlighting broken +X error highlighting broken X http://dev.processing.org/bugs/show_bug.cgi?id=795 0138 pde X importing a library results in "expecting EOF, found ..." error X http://dev.processing.org/bugs/show_bug.cgi?id=788 -X remove console variable from preferences.txt +X remove console variable from preferences.txt X run only works with primary window in 0136, 0137 X http://dev.processing.org/bugs/show_bug.cgi?id=784 X throwing a stackoverflowexception because the console is broken @@ -4660,7 +6185,7 @@ X remove debug messages from export 0137 pde -X move to multiple jars whenever +X move to multiple jars whenever X 1) a lib is in use, 2) code folder, 3) multiple files X remove oro.jar dependency (not needed with PApplet.match) X this is kind of messy and requires a bit of testing to ensure proper @@ -4672,7 +6197,7 @@ X applet export fails with opengl/code folder X http://dev.processing.org/bugs/show_bug.cgi?id=714 X synchronized (something) { } is horking up the preproc X http://dev.processing.org/bugs/show_bug.cgi?id=136 -o inside the preproc +o inside the preproc o change the arrays of default imports (now using 1.5+, so no 1.1,1.3,1.4) X don't bother, they're cumulative X improvements to the linux startup script @@ -4697,13 +6222,13 @@ X fixed in newer qtjava o http://dev.processing.org/bugs/show_bug.cgi?id=496 X add to p5 app bundle X mention re: apple slowness -X -Dapple.awt.graphics.UseQuartz=true +X -Dapple.awt.graphics.UseQuartz=true X net library dies unceremoniously on "Connection Refused" X just need to catch another exception X http://dev.processing.org/bugs/show_bug.cgi?id=751 X ctrl-/ to comment block X eeepc support for environment: -X splitPane.setMinimumSize(new Dimension(600, 600)); +X splitPane.setMinimumSize(new Dimension(600, 600)); X change to: splitPane.setMinimumSize(new Dimension(600, 400)); o prolly need to have a param for this guy X switch to nanoxml instead of nanoxml-lite (29k vs. 5k) @@ -4711,19 +6236,19 @@ X check against ods X http://dev.processing.org/bugs/show_bug.cgi?id=757 X space after OPENGL param breaks export X http://dev.processing.org/bugs/show_bug.cgi?id=769 -X svg demos are broken +X svg demos are broken X because of weird ENTITY setup X because of weird (default?) filling problem X remove support for random .class files in code and library folders X need to put everything in jar files X opengl currently broken in svn (probably the native libs not included?) -X mistakes wrt 'library.path' +X mistakes wrt 'library.path' X also, don't add /library/ for each lib to the classpath X remove unused libraries from default run path X note that this will hose svg b/c xml not available X so when this change is made, the lib depends needs to be implemented too -X changing to java 1.5 +X changing to java 1.5 o switch to java 1.4.2_16 on linux and windows (now that osx is there?) X change to 1.5+ (instead of 1.4*) in Info.plist for Processing.app X updated linux to java 1.5.0_15 @@ -4763,7 +6288,7 @@ X change software to point at correct reference locations 0135 pde -o opening a file from right-click in osx +o opening a file from right-click in osx o opens the new thing directly behind an untitled document X improve how fonts are parsed from the preferences file X this was causing strange errors as prefs files became corrupted @@ -4788,14 +6313,14 @@ o "reload sketchbook" option o "show sketchbook folder" X start removing pre-1.4 support X multiple windows -o what happens when p5 is launched without all its pieces? +o what happens when p5 is launched without all its pieces? o both on windows and mac... is there a way put up useful message o if everything moved into the .app file, how do you add applet.html? o can we use useragent to determine whether java 1.4 is in use? o for mac, could see if it's an old safari (1.3) or firefox (also 1.3) o for windows, the classid will take care of it all (firefox too?) o for linux, everyone's using 1.4/1.5 anyway -X rewrite section on versions of java +X rewrite section on versions of java X we're dropping support for anything before 1.4 X and don't recommend anything before 1.4.2 X we'll support 1.5 a little more now, but only libraries, not syntax @@ -4879,7 +6404,7 @@ X when new/open from menu, creates a new window o don't bug the user about new release of p5 when they have it o add prefs option for "latest version run" o something also to track--people going to older releases -X keeping this behavior, it's also the only way to know you're +X keeping this behavior, it's also the only way to know you're X running the wrong version when you accidentally open an oldie X createFont() needs to run 1.3+, and not in applets X where is the bug reference for this.. and can it be fixed? @@ -4969,7 +6494,7 @@ X move examples folder to top-level menu X move open menu to its own X BGraphics, BImage, void loop() -> give an error saying it's old code X better yet, only do this when "not found" errors come up -X need to fix changes.html because it lists out of date alpha->beta changes +X need to fix changes.html because it lists out of date alpha->beta changes X added getChild(name/path), getChildren(name/path) to xml library o add notes about these to the reference o needs a better example that includes subitems @@ -5067,7 +6592,7 @@ X add documentation X add() or addFrame()? X find/replace - replace should do auto find next(?) X or have a replace & find button -X placing "replace" next to "find" ... (hitting "replace all" by accident) +X placing "replace" next to "find" ... (hitting "replace all" by accident) X have a button "replace & find next" X http://dev.processing.org/bugs/show_bug.cgi?id=68 X only rebuild sketchbook on "save as" or "rename" of sketch @@ -5092,7 +6617,7 @@ X do a trim() on the selection for find in reference X reorganize find in reference commands X add setDTR() method from tom hulbert X moviemaker is broken -X updatePixels reference was cut off +X updatePixels reference was cut off X double-check this after rebuild of reference X examples X animated sprite example should use tabs @@ -5123,12 +6648,12 @@ X slight improvements to some preproc/compiler error messages X http://dev.processing.org/bugs/show_bug.cgi?id=12 X http://dev.processing.org/bugs/show_bug.cgi?id=13 X http://dev.processing.org/bugs/show_bug.cgi?id=15 -X deal with strange problem with KeyListener and {} on same line +X deal with strange problem with KeyListener and {} on same line X http://dev.processing.org/bugs/show_bug.cgi?id=484 -X copy custom applet.html file on "Save As" +X copy custom applet.html file on "Save As" X http://dev.processing.org/bugs/show_bug.cgi?id=485 o preferences file gone corrupt (on osx only?) -o changing font size, +o changing font size, o http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1160057791 X http://dev.processing.org/bugs/show_bug.cgi?id=406 o temporarily added log4j and jalopy (for the autoformatter) @@ -5190,7 +6715,7 @@ X finish draw(x, y, c, d) 0121 pde -X fix button fatness on osx +X fix button fatness on osx X quaqua already takes care of this for us X implement page setup and print X pretty printing of code in project @@ -5249,7 +6774,7 @@ X add PGraphicsOpenGL change to revisions.txt and the changes faq 0116 pde -o including function outlines in the code? +o including function outlines in the code? o i.e. make setup() and draw() for people? seems silly.. not much to do o when importing a library, insert 'captureEvent'? o again, seems to fraught with potential problems @@ -5285,13 +6810,13 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=233 o external apps should inherit memory settings from p5 itself X too confusing to set the memory in two places X or perhaps, have a setting in the ide for it -o and allow a checkbox for "always run externally" +o and allow a checkbox for "always run externally" X that way people don't have to adjust the memory settings for p5 itself X perhaps the memory setting should be enabled/disabled X that way if it's enabled, will always run externally o menu weirdness (benelek) o when you've got a menu open, move a cursor over the text area -o and back over the menu, the text-area cursor type remains. +o and back over the menu, the text-area cursor type remains. X mark this as wontfix, since it's just a java bug X http://dev.processing.org/bugs/show_bug.cgi?id=30 X remove the second movie from the movie playback example @@ -5360,7 +6885,7 @@ X add more information about setting the memory X move memory setting to troubleshooting page on bugs db X the source code to the libs are included X this makes them easy to modify (in another app) -X or you can remove the package statements and embed them +X or you can remove the package statements and embed them X serial is a little trickier since you'd have to put stuff in code/ X windows, may need to install new version of video drivers X add to opengl doc/faq @@ -5396,7 +6921,7 @@ X move troubleshooting page to the reference faq / platforms X add notes about running processing on various platforms -o directions for rebuilding jikes, etc (where is this?) +o directions for rebuilding jikes, etc (where is this?) o and then link to posts on the discourse site about how to do it faq / export @@ -5452,7 +6977,7 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=315 0111 pde X switch back to rev b3 of jogl so that applets will work -X fix color picker: +X fix color picker: X http://dev.processing.org/bugs/show_bug.cgi?id=308 X also add esc/ctrl-w for closing the picker X update information on mactels in the faq, also java 1.6 @@ -5486,12 +7011,12 @@ X adding dxf library to distribution X fix bug with drag & drop of files to sketch on macosx X need space between bullet points in faq css X also need the absolute url stuff to work -X add discourse formatter tool +X add discourse formatter tool 0107 pde X fix yet another save bug, context menu paste/cut not setting modified -X undoing to the code's original state won't unset it as "modified" +X undoing to the code's original state won't unset it as "modified" X http://dev.processing.org/bugs/show_bug.cgi?id=248 @@ -5508,7 +7033,7 @@ X removed "yep yep yep" when using "Create Font" X p5 not saving changes on quit, even if you say 'yes' X http://dev.processing.org/bugs/show_bug.cgi?id=276 _ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1139519266 -X update osx for intel binary (if necessary) +X update osx for intel binary (if necessary) X if running on 10.4, univerals jikes installed in /usr/bin/jikes X updated the jikes included with p5 to be the universal version X add notes to the faq about status @@ -5565,7 +7090,7 @@ X make editor save button highlight on ctrl-s X same goes for the other editor buttons X http://dev.processing.org/bugs/show_bug.cgi?id=242 X deal with "could not delete stderr.txt" messages -X probably screwed up the temp folder stuff +X probably screwed up the temp folder stuff X build folder is randomized, being recreated on each build X mark temp build folder for deletion on exit X properly remove console files on exit @@ -5576,9 +7101,9 @@ X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action tab handling X indent/outdent with curly braces -X tab to just indent lines properly, +X tab to just indent lines properly, X rather than having it convert to spaces -X need a smarter handler (rather than the editor listener) +X need a smarter handler (rather than the editor listener) X could look at previous line for its indent X and when hitting } do a proper outdent (if only spaces before it) X http://dev.processing.org/bugs/show_bug.cgi?id=22 @@ -5686,7 +7211,7 @@ X console text selection immediately de-selects X suspect console is updated every 250 ms even when the app isn't running X simplest to just not update the console if nothing is waiting in buffer X http://dev.processing.org/bugs/show_bug.cgi?id=180 -X problem with using qtjava is probably the quotes.. +X problem with using qtjava is probably the quotes.. X remove them because they're matching quotes elsewhere X drag & drop implementation to add files to sketch X http://dev.processing.org/bugs/show_bug.cgi?id=21 @@ -5709,7 +7234,7 @@ X need to figure out threading etc X problem with it launching a new thread for every single update! X http://processing.org/bugs/show_bug.cgi?id=19 X make a note that video doesn't currently work in applets in the faq -X scanning sketchbook folder may be extremely slow +X scanning sketchbook folder may be extremely slow X when lots of frames saved out, takes forever to scan the folder X some dumb sorting code was responsible X and each file was being treated as a directory. oops. @@ -5722,9 +7247,9 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=48 o auto-run the javadoc in dist.sh o doctor a copy of the css file to use p5 defaults o and re-copy the css in after generating the doc each time -X timing fix introduce regression on linux +X timing fix introduce regression on linux X extra (NUL?) chars are added -X i.e. on first run, the ten blank lines each have a li'l box +X i.e. on first run, the ten blank lines each have a li'l box X http://dev.processing.org/bugs/show_bug.cgi?id=118 X faq: "my applet doesn't work on export"... where to check for errors X very common: cached version is being used @@ -5739,18 +7264,18 @@ fixed in previous releases X closing window w/o first hitting stop() causes freak out X opengl gives an OutOfMemoryError X java2d just goes into a lock -X could also be code that's in an infinite loop (i.e. text error) +X could also be code that's in an infinite loop (i.e. text error) X which then causes a full lock X something really bad happened with println() in this release X perhaps only without a code folder and/or running in java2d mode? -X this may also be what's hosing +X this may also be what's hosing X external apps don't stop at all when 'stop' is hit X worker thread is halting the app ala code folder bug -X could this be dealt with by using nio? +X could this be dealt with by using nio? X host environment will be running 1.4 so... o make note that changing screen config requires restart of processing o static { checkScreens(); } -o static void PApplet.checkScreens() { } +o static void PApplet.checkScreens() { } o to run explicitly later o this seems too complicated.. just make people restart o convert spaces to underscores and vice versa for sketch/tab names @@ -5759,7 +7284,7 @@ o only needs to be underscored when passed off to java o although then if people *want* underscores, there's gonna be trouble o http://dev.processing.org/bugs/show_bug.cgi?id=76 o if in full java mode -o if extends PApplet.. or rather, put PApplet cast into a +o if extends PApplet.. or rather, put PApplet cast into a o try/catch block.. if it doesn't work, try applet. if that o doesn't work, try using the class' main() to run it X not gonna do this, p5 is not a java editor @@ -5778,11 +7303,11 @@ X buglist.cgi X replace the platform column with the os column (uses icons for os) X sorting based on any of the headings gives an error X "102 bugs found. 102 bugs found." -X remove the severity column +X remove the severity column X it's normal or enhanced, and enhanced is already gray -X make os into: Mac OS, Windows, Linux, Other +X make os into: Mac OS, Windows, Linux, Other X while other categories might exist, it's too confusing for minimal benefit -o make things that are P5 into "enhancement" +o make things that are P5 into "enhancement" o unless a P6 can be added? or something called "enhancement"? X is there a way to list "all" bugs (especially sorted by priority?) X or at least the first 20 listed by priority? @@ -5812,7 +7337,7 @@ X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115787397;start=0 X wasn't using runner stop button color X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Suggestions;action=display;num=1116166897;start=0 -X fix up the video crap because nobody reads the faq +X fix up the video crap because nobody reads the faq X and no cameras means that the list comes back null X can't seem to find build dir on operating systems w/ non-ascii chars X or rather, when user accounts have non-ascii chars in the name @@ -5843,7 +7368,7 @@ X not seen for a long time o this may be fixed? o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1076358432;start=0 o package processing.app for PdeBase, PdeEditor.. -o if NullPointerEx on a line that includes a "pixels[" +o if NullPointerEx on a line that includes a "pixels[" o give an error message saying "you may need to call loadPixels" discuss with casey @@ -5863,7 +7388,7 @@ X we've attempted for less confusion over speed in some cases X get(), set() and red() et al are one such example X web colors with alpha: 0xffcc0080 or unhex("ffcc0080") `X the draw() method must exist, otherwise the sketch won't run -X i.e. can't just have mousePressed() +X i.e. can't just have mousePressed() o make a sketch that shows loading from the web o make another sketch that shows loading from a file X make notes about preproc @@ -5959,15 +7484,15 @@ o System.err was getting cut off before finishing o no transformations before background() is called o implementation specific, may cause trouble o must call depth() for 3D applications -o lights cannot be enabled/disabled throughout +o lights cannot be enabled/disabled throughout o lighting will be based on what's left at endFrame() X images should be a power of 2, or call modified() -X document the use of "die" +X document the use of "die" X can override the method to do your own handling X sketches no longer require a "data" folder X example that uses loop/noLoop, or redraw? X talk to creas about making html files for bugs, readme, revisions. -X or how they should relate to the 'faq'.. readme -> faq? +X or how they should relate to the 'faq'.. readme -> faq? X loadImage() mixed case problems @@ -5997,7 +7522,7 @@ X righthand max isn't being updated for that second line X or it's getting written over by the line below it X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1113932608 X include platform information when checking for updates -X send over the int as long hex number? +X send over the int as long hex number? X 64 bits hex is gonna be 16 digits.. much cleaner o when people are running 1.5, warn them? o if p5 is running 1.5, let them know to use the standard install @@ -6006,9 +7531,9 @@ X nah, this seems like overkill.. problems haven't been *that* bad (yet) X make sure that when running ext, using the local java X macosx 10.2 needs libiconv to run jikes X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114113204;start=0 -o either compile jikes not to use it: +o either compile jikes not to use it: o http://jikes.sourceforge.net/faq/dev-win32.shtml -o or maybe include an installer: +o or maybe include an installer: o http://www.bluem.net/downloads/libiconv_en/ o gnu page for libiconv o http://www.gnu.org/software/libiconv/ @@ -6047,15 +7572,15 @@ X wontstart wasn't properly linked X watch out for upper/lowercase changes X methods and functions always start lowercase, and have inner caps X faq - java 1.5 -X seems to run things more slowly.. +X seems to run things more slowly.. X if using p5 standard, will be running 1.4 X but if 1.5 installed, browser will probably use that X opengl only runs with 1.4 X opengl not tested for applets X to get to opengl functions, put this after size: X GL gl = ((PGraphicsGL)g).gl; -X and then can make opengl calls. this is not supported, -X and if things don't work, sorry. +X and then can make opengl calls. this is not supported, +X and if things don't work, sorry. X faq - known bugs X 1 pixel stroke weight in opengl (temporary) X make clear that P2D is not working if not clear enough @@ -6093,7 +7618,7 @@ X a bunch of stuff from revisions.txt on 84 and 82 o how to deal with bugs, since there are so many known... save as... bugs -X always make sure that the sketch folder still exists +X always make sure that the sketch folder still exists X otherwise editor gets into a weird state (v74) if a project folder is made (with save as), and then deleted while processing is still open, there is an error (of course). but @@ -6106,7 +7631,7 @@ saving a project over an already existing project does not get rid of the .pde files that arent overwritten. not sure if this is feature or bug, but it took me by surprise. it seemed to only overwrite .pde files with the same name, but everything else in that project folder -stays as is. +stays as is. X sketch renaming fixed X rename, change, was asking about the old sketch name @@ -6124,7 +7649,7 @@ File>Open some other file File>Open original file file is empty. the only way to make File>Save As actually save new files, as far as i -can tell, is to Save As once, make at least one change, then Save. +can tell, is to Save As once, make at least one change, then Save. X fix hide/unhide bug... just was dumb code create a new sketch @@ -6140,7 +7665,7 @@ where did "a_2" go ? 0083 pde X move everything to packages, and start auto-javadoc X how to get preproc to automatically prepend packages -o only build preproc from preproc/make.sh? +o only build preproc from preproc/make.sh? o and check in the preproc'd code to cvs? X need to add classes dir to cp for jikes make (on win and linux) X get both versions of size() properly detected on export @@ -6185,9 +7710,9 @@ o should loadPixels be grabPixels? (nope) saturday evening X update processing/build/howto.txt X add 'make' to list of things that should be installed -X update libraries/howto.txt +X update libraries/howto.txt o should we queue lib events until the end of loop? -X nope, libraries can handle that themselves, +X nope, libraries can handle that themselves, X and queue events by registering for draw or whatever they'd like X lib could call queueEvent with the args X then call them inside post() @@ -6235,7 +7760,7 @@ o fix for 78 since not sure when simon's new version is happening X requires because uses 3D.. oh well o "draw" is not highlighted as a keyword.. other keywords? o draw(), PGraphics(), NO_DEPTH_TEST, PMovie(), PMovie.repeat() -o PClient(), PClient.available(), PClient.read(), +o PClient(), PClient.available(), PClient.read(), o PServer(), PServer.dispose(), PServer.write(), attach(), length o round() is not colored @@ -6289,7 +7814,7 @@ X include "you need to install java" text on default export page X make compatible with jikes 1.22 X fix all warnings generated by the new jikes X update windows version of jikes.exe -X update macosx version of jikes +X update macosx version of jikes X get source and build on osx (or is it shipped by default?) X make sure that fink is not in the path when building X what are the args to configure a release version? @@ -6331,7 +7856,7 @@ X is PdeEditorHeader one pixel too tall X move the tabs over just slightly X resize box intrudes on the scroller for the console area X need to set grow boxes intruding to false -X 1.3 version (deprecated): +X 1.3 version (deprecated): X -Dcom.apple.mrj.application.growbox.intrudes=false X 1.4 version (much nicer): -Dapple.awt.showGrowBox=false X add mkdmg script to macosx build process @@ -6371,11 +7896,11 @@ X also put something in lib/preferences.txt for default location X this way a course admin can change the default location o need to check if volume is read-only, notify and quit if it is o people are trying to run off the disk image -o actually that should be fine.. +o actually that should be fine.. o but make sure the prefs location can be written o need to pay attention to when running from read-only drive o reported by brandenberg -o "p5 will launch from the disk image, but will +o "p5 will launch from the disk image, but will o not draw the sketch name bar doesn't appear" X include preferences.txt option to write to p5 folder first X this can be altered by instructors and re-packaged @@ -6384,7 +7909,7 @@ X put 'play' on a SwingWorker thread X test this on a pc to see how it goes, especially with opengl X doesn't seem to help anything X PdeRuntime -> SystemOutSiphon, removed MIN_PRIORITY setting -o hack to not use console on the code folder +o hack to not use console on the code folder o no errors will propogate, but it should run fine X lib/build should not be a subfolder of p5 X p5 environment installed to /Applications on lab machines @@ -6392,7 +7917,7 @@ X instead use a temp folder X maybe when running on lab machines in that case, always java mode? X or is it possible to add to java.class.path while app is running? X have to use a special class loader -X new class loader for single files +X new class loader for single files X if more than one class defined, forces it to run externally X (basically any time it sees "class" in the code.. X may be subject to errors, but errs on side of just running ext) @@ -6409,7 +7934,7 @@ X make preproc only build once (across osx, windows, linux) X preproc: making all functions public that have no specifier X this will make draw() etc all much easier X as well as the library events -X focusGained/focusLost was added.. +X focusGained/focusLost was added.. o if a data file is in the sketch (not data) folder export breaks o works fine in the editor, but on export gets a nullpointer ex X no way around this, because needs to be able to read from local dir @@ -6437,10 +7962,10 @@ X serialEvent, clientEvent, serverEvent X if videoEvent exists, don't auto-read? X though for serial this would only grab the last byte X video bug on osx? an error message when quitting video sketches: -X java.io.IOException: Bad file descriptor -X at java.io.FileInputStream.readBytes(Native Method) etc... ). +X java.io.IOException: Bad file descriptor +X at java.io.FileInputStream.readBytes(Native Method) etc... ). o bring back some form of beginSerial/beginVideo -o openSerial(), serial().. +o openSerial(), serial().. o should it prompt or use the first available if none specified? X run library destroy after hitting 'stop' X quicktime audio doesn't stop after hitting 'stop' @@ -6464,7 +7989,7 @@ X keypressed hanging on applets with a code folder X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1081450102 X problems running external vm/vm is hanging X seems to be happening because of virus scanning software (norton) -o may need to launch the applet (using 'start') +o may need to launch the applet (using 'start') o and talk over a socket instead X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1067867520;start=0 X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1067643186 @@ -6479,18 +8004,18 @@ output to the console and see if it'll still crash. run via a disconnected process, using "cmd /c start java", the thing will never hang. in that instance, the process terminates almost immediately, and no i/o needs to happen (since it's a cmd prompt that -never shows up). +never shows up). * it could also be a graphics sync bug that just gets more testy because the environment, a second java process, is running at the same time. mis.newPixels() may hork since it's over in the applet's thread, and it might be calling repaint() or Toolkit.sync() to update the -image on-screen. +image on-screen. * shows up on key presses.. not sure if this is because of the actual key press, or if it's because they're often accompanied by a println() * blank spaces in filenames/parent folder often cause trouble.. not sure if related. same for PATH and CLASSPATH. * some virus scanning software, particularly older NAV versions cause -the trouble. +the trouble. 0074 pde @@ -6524,14 +8049,14 @@ X uppercase being capitalized before lowercase X need to mix case.. use toLowerCase before compare X add a little gap on editor frame at the left X http://processing.org/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1097363967;start=0 -X add to readme or bugs.. +X add to readme or bugs.. X menus that are too long just get clipped on the screen X can't be fixed because it's a java/os issue X also strange menu behavior for popups, especially on osx we can't fix o if applet.html is present, open that in the editor too. o or do we make people use dreamweaver? o nixed by casey, we're not dreamweaver -X macosx not exporting core.jar +X macosx not exporting core.jar X the jar is buried Contents/Resources/Java X don't enable externalRuntime with multiple code files that are pde X no longer separate classes @@ -6549,7 +8074,7 @@ X remove grow box from applet frame macosx X verify that export is working from processing.app -o check into ryan's macosx java bug.. +o check into ryan's macosx java bug.. o see why coords are going negative @@ -6570,11 +8095,11 @@ X sketch is changing before the "save changes?" is complete X as a result, 'cancel' does nothing X always ask save changes, even if nothing changed -040620 sunday +040620 sunday X remove 'sketchbook.prompt' (comment it out) X not really needed X remove prompt stuff from the preferences panel -X clean up the "more options" in prefs panel +X clean up the "more options" in prefs panel X to use JLabel instead of JTextArea X font was wrong on windows X start working on "save as" @@ -6615,7 +8140,7 @@ X reads sketchbook properly from other folder X but creates a new folder for new sketches to go into X sketchbook.dir not properly read or written X install sketchbook into another location on person's machine -X use System.getProperty("user.home"); +X use System.getProperty("user.home"); X remove the 'default' for sketchbook X bring this up on bboard and get votes X win2k: my documents, macosx: ~/Documents, linux: ~/sketchbook @@ -6664,14 +8189,14 @@ X sometimes nice just to have it create an unnamed sketch quickly X shift-new will always prompt with filedialog X dashes shouldn't be allowed in filenames for sketches X actually, lost the naming stuff because now using FileDialog -X this also needs to be checked when building the sketch menu +X this also needs to be checked when building the sketch menu X rewrite sketchbook.clean() X prompt user if they don't have it set to auto X add a pref to the preferences window 040622 monday late night X set handleOpen to use editor as its parent frame -X what happens when the .pde file isn't named +X what happens when the .pde file isn't named X the same as the enclosing folder? X maybe put up a window saying no way, and ask: X ( ) rename enclosing or ( ) add a subfolder @@ -6679,7 +8204,7 @@ X or maybe even ( ) rename the sketch file X also double-check to see if there *is* a proper pde in the folder X in which case, default to that (maybe show a message?) X it's useful to have loose .pde files be runnable.. -X i.e. when double-clicking on them.. downloaded off web.. +X i.e. when double-clicking on them.. downloaded off web.. X but need to deal with simply, not providing a new exception case X begin writing 'new text file' @@ -6723,7 +8248,7 @@ X what should the prefs file be named? X horizontal buttons? need final decision [yes] X remove underscores from the tab title? X nope, casey says not necessary -X need nice yes/no dialog boxes, also +X need nice yes/no dialog boxes, also o does "Open" go at the beginning or end of the sketch popup X we need opengl support in there X otherwise we're going to be stuck behind director @@ -6751,7 +8276,7 @@ X add .java to file name in the tab X change name of prefs to Processing Preferences.txt X implement clone for BImage X api name changes for imaging functions -X constant SUBSTRACT -> SUBTRACT +X constant SUBSTRACT -> SUBTRACT 040707 afternoon X minor bug with when setting sketchbook to a bad location @@ -6789,7 +8314,7 @@ X modify preproc to handle "void setup" -> "public void setup" o preproc bug: text(String.valueOf(i+1), left + i*20, top); o unexpected token "String" X make more things public (i.e. pixels) -X get casting working properly.. int() maps to toInt()? +X get casting working properly.. int() maps to toInt()? X what is performance hit for this thing? X remove substitute_image/font X remove String casting @@ -6835,7 +8360,7 @@ X processing.serial -> PSerial, [PUsb] other stuff / cleaning up X don't allow apostrophe (i.e. casey's_cells) when naming sketch! -X when exporting applet, line numbers will be off.. +X when exporting applet, line numbers will be off.. o when not exporting with new preproc code, imports all on same line o make preproc keep track of how many lines were added X rewrite video, net, serial libraries to be separate @@ -6861,7 +8386,7 @@ o ability to include other .java and .pde code from sketchbook folder o 'add files' for .java or .pde pulls into the folder X split to take strings (ie. for ", ") o image(BImage, x, y, float scale) (found in illustrator stuff) -o begin/end.. beginSerial/endSerial -> +o begin/end.. beginSerial/endSerial -> o openSerial/closeSerial ? o startSerial/stopSerial X punting on api @@ -6899,8 +8424,8 @@ X load that before the other stuff X -> was already implemented like that o fix the problem causing all the "couldn't delete" messages o class naming from dan -o If you name a class the same name as the sketch project, -o you get an error about contained classes with duplicate names +o If you name a class the same name as the sketch project, +o you get an error about contained classes with duplicate names o when you try to export for web. o quick fix inside PdeRuntime o if (loop == false) and (draw == false) then provide an error @@ -6922,7 +8447,7 @@ shape class Something { void setup() { // not used, or called on first draw - // but maybe required (even if behind the scenes) + // but maybe required (even if behind the scenes) // so that this can use "implements ShapeInterface" } @@ -6945,7 +8470,7 @@ shape(ShapeInterface o) { X run java mode when large 'data' folder is in use X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1081542378 -X fixed one bug in PdeRuntime error message stuff +X fixed one bug in PdeRuntime error message stuff X was this the big one? a big one? 040715 late @@ -6970,15 +8495,15 @@ X i.e. cut -> new file -> paste doesn't mark any as changed X "include all chars" and all the bugs it represents X working on datatype conversions -040717 +040717 o dll and jnilib files have to be in the p5 folder (confirmed by amit) -o there should be other places that they work.. +o there should be other places that they work.. o could even copy the dll to the p5 folder from the code folder o already fixed with LD_LIBRARY_PATH stuff 040902 -X building Processing from scratch -X not able to write "preferences.txt" on the first run +X building Processing from scratch +X not able to write "preferences.txt" on the first run 040903 X examples should be in a submenu of open @@ -6993,14 +8518,14 @@ o need to be able to select between which to include o auto-resolve by saying java.* wins, others ask X make built-in libraries read-only -040912 -X several menu changes as discussed with casey +040912 +X several menu changes as discussed with casey X (capitalization, export/export app, tools) X add preference for showing library stuff 040913 morning X figure out why user libraries not being added -X in lib mode, show internal libraries as part of the 'open' menu +X in lib mode, show internal libraries as part of the 'open' menu X make a note that p5 has to be restarted for libs X import all libraries into classpath X all libs found during sketchbook build + all libs in libraries @@ -7014,7 +8539,7 @@ X "Processing" folder not properly created on new install X add noLoop() to static mode apps X remove "loop" from special inserts on preproc -040921 afternoon +040921 afternoon o when running externally, build into sketch folder? X add all imported libs to hash table of jars @@ -7040,7 +8565,7 @@ X errorMessage in PSerial/PClient/PServer are all using System.out X write handler for loop() error, warning user to rename loop to draw X c:/fry/processing/build/windows/work/lib/build/Temporary_1452_9170.java:29:6:29:11: Semantic Error: The method "void loop();" with default access cannot replace the accessible method "void loop();" with public access declared in type "processing.core.PApplet". -040925 +040925 X change how export.txt works X make p2 dist for amit X break out BSerial as separate object like BVideo @@ -7055,7 +8580,7 @@ o http://docs.info.apple.com/article.html?artnum=93414&sessionID=anonymous%7C2 o "Type quicktime.std.stdQTConstants was not found" o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1066358763 o http://docs.info.apple.com/article.html?artnum=120255 -X split classes to BVideo and BMovie ? +X split classes to BVideo and BMovie ? X don't force install of qtjava X this requires a separate version of bagel that doesn't use video X or a version that loads video dynamically. that kinda sucks. @@ -7084,7 +8609,7 @@ X selecting input source (wintv board and quickcam installed.. problem) network o don't send unicode data -X when you stop the client, it freezes +X when you stop the client, it freezes X until you quit the processing running the server X (the server starts and stops fine) X add constants for building NET, move stuff around in bagel dir @@ -7102,7 +8627,7 @@ X remove fonts from distribution X be able to link against, but not export, certain parts of lib X jsyn.jar not needed on export, netscape libs not needed on export o crap.. libraries need to be in packages for this to work -o but annoying: attach("simong.particlesystem.ParticleSystem") +o but annoying: attach("simong.particlesystem.ParticleSystem") X disable "export application" X font builder X properly update the font on new selection @@ -7147,7 +8672,7 @@ X go through the board and move messages X a garbage filled classpath can cause trouble X http://processing.org/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1096302833;start=0 X processing won't start.. -X people with non-ascii chars in the folder name +X people with non-ascii chars in the folder name X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1062794781;start=0 X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1067764732 X other errors with spinning and not doing much @@ -7174,7 +8699,7 @@ X update to new shell runner (old mrj guy was ancient) 0070p7 X fix run.bat and run-expert.bat X remove library path debug message -X catch error message for "quicktime.std" +X catch error message for "quicktime.std" X move packages to processing.video, processing.serial, etc. X need to update the set of new examples X make sure the library features are disabled by default @@ -7192,7 +8717,7 @@ X update with other examples 0070p8 (final) X height for applets wasn't working properly X debug font stuff in processing.core -X mbox wasn't set properly (not a power of 2) +X mbox wasn't set properly (not a power of 2) X debug framerate() stuff with noLoop() X re-enabled printarr(Object[]) X remove SystemOutSiphon: i just died message @@ -7205,7 +8730,7 @@ X examples updated 0069 pde -X font builder +X font builder X crashing on small sizes for many fonts X make the text area not selectable or highlightable X add a few more rows @@ -7363,7 +8888,7 @@ X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs 0066 X BImage.replicate for straight 1:1 copy, blend() for blended version -X remove the blendMode function because it's confusing +X remove the blendMode function because it's confusing X big changes to image code from toxi X repaired smoothing so that it doesn't crush the last line X bresenham ellipses/circle ignore alpha @@ -7385,7 +8910,7 @@ X if saveas/rename names match, use renameTo X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1066495952;start=0 X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1066497131;start=0 X include JSObject with p5's pde.jar -X jaws.jar is already included on mac.. +X jaws.jar is already included on mac.. X check to see if ok on pc (empty project -> new JSObject()) X files are in jaws.jar: JSObject, JSException and JSUtil X curvePoint not initializing @@ -7419,7 +8944,7 @@ X fix SMOOTH_IMAGES problem with how text had been modified X include version number in the about box X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1064220242 X Ctrl-B will beautify the code and send the cursor back to the -X beginning of the the text. Then you have to scroll back to +X beginning of the the text. Then you have to scroll back to X where you were... ok, so maybe I am a heavy user of Ctrl-B. X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1064220242;start=0 @@ -7435,9 +8960,9 @@ X removed the cancel button 0063 X beautify menu became disabled when moved X BImage(int width, int height) constructor -X trying to track down sluggishness with applets.. +X trying to track down sluggishness with applets.. X beginShape/endShape.. 3D scenes with boxes.. -X newPixels is in BGraphics.endFrame, +X newPixels is in BGraphics.endFrame, X screen.drawImage is in BApplet.paint X need to move both to BApplet.paint() X external applet stuff @@ -7494,7 +9019,7 @@ X open applet folder after exporting sketch X switch back to red instead of yellow for errors. whups. from carlos' contract, but implemented by fry -X get font things sewn up +X get font things sewn up X create a simple generator for grayscale bdf fonts X document the change and make several of them X font smoothing (unless hint SMOOTH_IMAGES enabled) is broken @@ -7565,16 +9090,16 @@ X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=BugFixes;action=display; X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1062483060;start=0 X if there's a bug in bagel, PdeRuntime.message() ignores it X just says "NullPointerException" but provides no info -X now at least spews the exception +X now at least spews the exception X removed ugly white borders from ui on macosx java 1.3 X is there anything better that can be done for osx java 1.3 X setInsets() to zero or something? -X font.stringWidth -> font.width(char c) or width(String s) +X font.stringWidth -> font.width(char c) or width(String s) X removed extra push()/pop() in text(String s) that may save time X bezier error, goes up at the end X also when using bezierMode, doesn't draw the first vertex X size(300,200); -X bezier(0,100,width/3,100,2*width/3,100,3*width/3,100); +X bezier(0,100,width/3,100,2*width/3,100,3*width/3,100); X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1064166242;start=0 X add note to tga spec X http://organicbit.com/closecombat/formats/tga.html @@ -7599,12 +9124,12 @@ X resize is maybe goofy, so just size() for all? X color() with alpha now works properly X removed SMOOTH_IMAGES X removed shearX and shearY -X toxi image code (!) +X toxi image code (!) X need background(BImage) and scaling, copy area, etc. X vertex(x, y, u, v) and vertex(x, y, z, u, v) X don't cast color() X since more important for color(v1, v2, v3) to work -X getPixel/setPixel -> get/set.. +X getPixel/setPixel -> get/set.. X get(x, y, w, h) is nice but no set(x,y,w,h) X though set(x,y,w,h) could be nice X and copy() to copy a section of pixels @@ -7636,11 +9161,11 @@ X some flag to know whether applet is online or not X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1051758365;start=0 X colorMode is defaulting to 255, 255, 255, 1.. oops X though setting it differently hoses everything (clears everything) -X setup (200, 200) causes the default size to be used +X setup (200, 200) causes the default size to be used X be able to draw something inside setup (?) X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1044689650;start=0 X no time to ask for "save changes" before quit -X PdeEditor, around line 910.. not blocking until input +X PdeEditor, around line 910.. not blocking until input X read up on how to properly block for input in a java app X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1064165653;start=0 X do not delete sketch folder if empty sketch but non-empty data dir @@ -7672,9 +9197,9 @@ X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=BugFixes;action=display; fixes because of dmose parser dm X move to antlr -dm X float z= float(x) + float(y); +dm X float z= float(x) + float(y); dm X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1062471182;start=0 -dm X compiler barfs on: float[] moo = new int[10]; +dm X compiler barfs on: float[] moo = new int[10]; dm X although no error comes through to p5 (benelek) dm X this was a kjc error, so it's fixed with jikes dm X int() doesn't work inside other functions @@ -7687,7 +9212,7 @@ dm X setup( ){} has an error, setup(){} does not dm X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1062461971;start=0 dm X weird comments bug (// on last line causes oro trouble) dm X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1062462227;start=0 -dm X unexpected token 'void' in letters sketch.. +dm X unexpected token 'void' in letters sketch.. dm X being parsed as static mode app dm X extra parens confusing things (toxi message) bf X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1064165730;start=0 @@ -7736,7 +9261,7 @@ X textureImage() -> texture() X textureMode() IMAGE_SPACE or NORMAL_SPACE X vertexNormal() -> normal(); X vertexTexture -> vertex(... u, v); -X bezier(... t) -> bezierPoint() +X bezier(... t) -> bezierPoint() X curveTangent and bezierTangent are in there X curve(... t) -> curvePoint() X bezierMode -> bezierSegments @@ -7760,8 +9285,8 @@ X ALIGN_XXXX becuase LEFT already used for keys X implement text(int something) and text(float something) o and perhaps others? X textSpace SCREEN_SPACE and OBJECT_SPACE -X strokeMode/strokeWidth -> -X strokeWeight, strokeJoin, strokeMiter +X strokeMode/strokeWidth -> +X strokeWeight, strokeJoin, strokeMiter X param(), online(), and status() functions X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1064166444;start=0 @@ -7815,7 +9340,7 @@ o jre icon not appearing in the systray o http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1030538508 o getting mouse movement outside the window o http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1051916278;start=0 -X building releases from scratch +X building releases from scratch X this is a useful developer task before release X build all releases from a clean cvs X tries to make work/ without bagel serial existing and blows up @@ -7846,13 +9371,13 @@ X optimize color() when in colorMode(RGB, 255) to just pack the int X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1062072434;start=0 X imageMode() shouldn't affect fonts X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1060207942;start=0 -X replacing spaces with underscores.. +X replacing spaces with underscores.. X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1062103523;start=0 X patch keyTyped event instead of keyPressed X remove reference in readme about macosx problem w/ it X test on macosx X test on linux -X Event.consume() doesn't work on entry fields +X Event.consume() doesn't work on entry fields X manifests itself in sketch naming, can't be constrained X may not be the case under swing? X it's probably because of keyTyped() being the important one @@ -7875,7 +9400,7 @@ X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs known issues/bugs * quicktime for java is *required* on windows.. it's installed by -default on macosx, and not used at all on linux. +default on macosx, and not used at all on linux. * QTJAVA environment variable is used to find quicktime. if that's not properly set, then you won't be able to run. * lots of 'cannot delete ...' messages @@ -7924,7 +9449,7 @@ X write proper build instructions for bagel X email about bagel doesn't have proper build instructions X need to install cygwin, set CLASSPATH to build X specific version of jikes (currently) -X make mac version require head/tail from fink ? +X make mac version require head/tail from fink ? X test to see if /sw/bin/head exists, if so use it X get dmose's new launcher running X cleanup cvs bunk @@ -7983,12 +9508,12 @@ X removes a random ArrayIndexOutOfBoundsException X Thread.stop is deprecated (and has been since 1.2) X http://java.sun.com/products/jdk/1.2/docs/guide/misc/threadPrimitiveDeprecation.html X remove finished in favor of just setting thread to null in BApplet -X check to see if setting threads to null works on windows +X check to see if setting threads to null works on windows X the multiple thread killing code was in there for a reason -X not tested on macos9.. +X not tested on macos9.. X hiding the cursor. noCursor(), cursor()/cursor(ARROW), cursor(HAND), cursor(CROSS), cursor(image_file) X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1059485109 -X default size of console is bad.. +X default size of console is bad.. o prolly need to stuff in 4 blank lines o runtime exceptions not coming through on either mac or windows X works fine on windows @@ -8032,20 +9557,20 @@ X seems that file names changed between 1.3 and 1.4 X sorted this issue out, now it's re-enabled X change default font for jdk 1.4 X reference launching working properly -X reference doesn't launch on mac (mKoser) +X reference doesn't launch on mac (mKoser) X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1038424448 -X tweak for java 1.4 +X tweak for java 1.4 X need to add a line to the properties file o include a note about this in the readme, include url for download o connect.apple.com X bug on p5 bboard: http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1037829938;start=0 running 1.4 from the command line: -/System/Library/Frameworks/JavaVM.framework/Versions/1.4.1/Commands/java +/System/Library/Frameworks/JavaVM.framework/Versions/1.4.1/Commands/java Info.plist, setting JVMVersion -* 1.3.1 - only use JDK 1.3.1, even if later versions are available. +* 1.3.1 - only use JDK 1.3.1, even if later versions are available. * 1.3* - use any version of JDK 1.3.x. Do not use JDK 1.4 even if it's dflt. -* 1.3+ - use the latest JDK version from JDK 1.3 onward, up to default JDK. -* 1.4+ - use JDK 1.4 or later, even if an earlier JDK is the default. +* 1.3+ - use the latest JDK version from JDK 1.3 onward, up to default JDK. +* 1.4+ - use JDK 1.4 or later, even if an earlier JDK is the default. o and then edit Info.plist to include the following lines: o JVMVersion 1.3.1 X control-click (right-click?) for macosx doesn't show popup @@ -8060,7 +9585,7 @@ X currently the only fix is to switch to java 1.3 X update the readme to note that macos9 is suspended X why doesn't processing.app work anymore X machine was screwy -X perlin noise 1D. noise() +X perlin noise 1D. noise() X double-check to see if wheel mouse is working X macosx quit handler takes over ctrl-q X so file->quit doesn't get called on close @@ -8092,7 +9617,7 @@ X puts a couple dots on random lines X modify build scripts for rxtx on osx X libs from 2.1.6 download for osx seem to work X write script to handle installation, etc. -X (maybe do this from inside p5?) +X (maybe do this from inside p5?) X get jikes118 in there.. also in cvs o add note to instructions for how to use X change Proce55ing.app to Processing.app @@ -8147,7 +9672,7 @@ dm X write handlers for jikes-style of error messages post-0057c1 -X deal with spaces in user.dir (!) +X deal with spaces in user.dir (!) X affects reference, and prolly compiling too X alt key pressed spews errors about components X prolly because of swing/awt component problems @@ -8179,7 +9704,7 @@ X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs X String wasn't colored, so added parts of java.lang X BFont was allocating too much memory for fonts (found by arielm) X modified all scripts to unpack the new reference -X simage() has been enabled again +X simage() has been enabled again X https://sourceforge.net/tracker/index.php?func=detail&aid=750867&group_id=63445&atid=504000 X image_mode has been ironed out X https://sourceforge.net/tracker/index.php?func=detail&aid=750886&group_id=63445&atid=504000 @@ -8231,7 +9756,7 @@ bf X reported by benelek hb X patch for server makes netEvent messages -moved to sourceforge by arielm +moved to sourceforge by arielm BAGEL / Bugs @@ -8242,7 +9767,7 @@ BAGEL / Bugs b _ image(img, x, y) in CENTER_DIAMETER is actually center radius b _ should make sure that x, y just makes it proper size - b _ simage() is screwy.. + b _ simage() is screwy.. b _ its invocation is broken (image_mode can't be two things at once) b _ doesn't actually use image_mode for placement b _ also doesn't support RGBA @@ -8264,7 +9789,7 @@ BAGEL / Bugs b _ single pixel lines have no alpha and no z b _ fix all the random line types to support alpha - b _ anti-aliasing. smooth(), noSmooth() + b _ anti-aliasing. smooth(), noSmooth() b _ need to verify that this works consistently throughout b _ alpha. fill(r, g, b, a), stroke(r, g, b, a), @@ -8279,7 +9804,7 @@ X use nfs (number format signed), with a bool for + or spc X does a[3] == Float.NaN work? (for testing with splitFloats) X no, if NaN, then comparison will always return false X sort() functions for arrays of ints, floats, doubles, and Strings -X add casey to sourceforge with admin privileges as 'reas' +X add casey to sourceforge with admin privileges as 'reas' X fix wheel mouse handler so that it works under jdk 1.3 X no difference between 1.3 and 1.4 code X add WheelHandler to cvs @@ -8314,7 +9839,7 @@ X image of 256x256 doesn't draw the last line of pixels X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1045697665;start=0 X weird line in showing in the center of an image X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1044901171;start=0 -X color() should work for alpha.. +X color() should work for alpha.. X also #rrggbbaa X http://proce55ing.net/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1049141984 X blend() (or any other 'final' functions) is causing trouble @@ -8337,17 +9862,17 @@ X modelX or objectX could do the amit style thing X creas says object X better access to projX et al X what's a better name? calcX? or write to an array? -X projectX, projectY, .. or projectedX ? +X projectX, projectY, .. or projectedX ? X also projectSize should just be project() X smooth() and noSmooth() X possible dist() and constrain() functions -X reas: I like people making these themselves and then later +X reas: I like people making these themselves and then later X they can be added to their code libraries X join() like split X also add additional item for NaN data X add doubles and longs for genome stuff X numberFormat (formerly zeroPad) -X numberFormat(float num, int left, int right) +X numberFormat(float num, int left, int right) X zero means any number of digits, don't pad X numberFormat(int num, int left) for 27 -> 0027 X camera work @@ -8460,10 +9985,10 @@ X new colors chosen by casey (replace pde.properties and buttons.gif) / works in 'insert' mode X just disabled it ever hiding.. we'll see if it fixes X flush() after every println() -X incremental printout +X incremental printout X uncovered bug with long line lengths in console / pmouseX problem reported by casey (in bugs.txt) -o images don't load during setup [reas] +o images don't load during setup [reas] X //This is not a problem -- Casey X framerate() and framerate(15) X delay() should sleep the thread [glen murphy] @@ -8474,13 +9999,13 @@ X add framerate to colored things list MISC (pruned from crusty todo list) -X text editor? jedit's textarea class? hmm? hmm? // Yeah for jedit! +X text editor? jedit's textarea class? hmm? hmm? // Yeah for jedit! X document imageMode, planeMode, ellipseMode X 'rot' example not working in release 18 X make note in documentation about getting access to pixel array X pixels[] is in ProcessingApplet X build a linux/x86 release -X fix buzz.pl to not create ../../bagel +X fix buzz.pl to not create ../../bagel X how to use ssh identity file to maintain auth for brancusi X write dist.bat for releases X don't forget to update 'export' dir with processing releases @@ -8491,7 +10016,7 @@ X bug in paren balancing X paren problems comes from overusing parens (too many closing) X image[first[i], 0, 0) hitting last paren causes jump to top X beautify is broken // I think this is fixed -X sketch: sketch-000 is dumb +X sketch: sketch-000 is dumb X // Just number successively 0001, 0002 like a digital camera X color won't set for fonts //This works o 'image' is too generic a variable to have inside BApplet @@ -8517,12 +10042,12 @@ X include note in the readme that 1.4 is not supported X is sketch.properties saving properly under macosx? X text in editor is anti-aliased, allow to turn off (franklin_mint) X also make text courier instead of monospaced -public void paint(Graphics g) -{ - Graphics2D g2 = (Graphics2D) g; - g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, - RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); - super.paint(g2); +public void paint(Graphics g) +{ + Graphics2D g2 = (Graphics2D) g; + g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + super.paint(g2); } pde @@ -8540,24 +10065,24 @@ X add -Xmx128m -Xms128m because people running out of memory (pitaru) X tried with a 3k x 1k image and things broke o maybe command line read properties from a file in lib -macos9 +macos9 X do some font tweaking (monaco 9 or 10 might be good) 0047 X reported by fdb and brendanberg -After creating about 27 sketches, proce55ing (0046 on OS X) no longer would startup, giving me the following error: -Exception in thread "main" java.lang.NullPointerException - at PdeBase.addSketches(PdeBase.java:598 ) - at PdeBase.addSketches(PdeBase.java:615) - at PdeBase.rebuildSketchbookMenu(PdeBase.java:575) - at PdeBase.(PdeBase.java:362) - at PdeBase.main(PdeBase.java:102) -Removing all sketches would solve the problem. +After creating about 27 sketches, proce55ing (0046 on OS X) no longer would startup, giving me the following error: +Exception in thread "main" java.lang.NullPointerException + at PdeBase.addSketches(PdeBase.java:598 ) + at PdeBase.addSketches(PdeBase.java:615) + at PdeBase.rebuildSketchbookMenu(PdeBase.java:575) + at PdeBase.(PdeBase.java:362) + at PdeBase.main(PdeBase.java:102) +Removing all sketches would solve the problem. / lots of problems in moving sketches over - i managed to run p5 from the applications folder once, but i think when i moved my sketches over from 0044 it broke: "uncaught exception in main method: java.lang.NullPointerException" - i tried reinstalling and running 'java -cp lib:lib/build: ...' and it worked fine (and would open from the icon afterwards) -again, after i moved my sketches over it broke permanently... + i managed to run p5 from the applications folder once, but i think when i moved my sketches over from 0044 it broke: "uncaught exception in main method: java.lang.NullPointerException" + i tried reinstalling and running 'java -cp lib:lib/build: ...' and it worked fine (and would open from the icon afterwards) +again, after i moved my sketches over it broke permanently... / 46 dies when run from desktop on some machines [jes] / spaces in the dir name? o is sketch.properties getting mangled on the mac? @@ -8629,7 +10154,7 @@ X method to set a folder for the sketchbook X when trying to use serial, provide error if things not installed -0046 +0046 X install new swing-based textarea with syntax highlighting X improve the flicker problems (re-enable backing store?) X set better defaults for coloring @@ -8670,20 +10195,20 @@ X preprocessor tweaks X "http://acg.media.mit.edu" doesn't work because of // X "color.jpg" -> "int.jpg" causes trouble X why does this line cause an error? -// String url = "http:\u002f\u002fwww.Proce55ing.net"; +// String url = "http:\u002f\u002fwww.Proce55ing.net"; X it's not in the preprocessor, but kopi seems to be having trouble -X seems that file i/o may be picking up lots of extra \r +X seems that file i/o may be picking up lots of extra \r X perhaps when doing setText, it's goobering things up -X when renaming a sketch, select the text in the field, -X so you can type the new name immediately. +X when renaming a sketch, select the text in the field, +X so you can type the new name immediately. X added 'rename' command X also the default for clicking on the sketch's title o option to rename when doing a 'save as' (remove old files) X remove .class files on save as [dimitre] X remove .jar, .class, and .java files from the 'applet' dir -When I am working in a project and I save it with another name, -all the old files are copyied to new directory, and some of the old -unused .class files and images remains inside new project JAR files. +When I am working in a project and I save it with another name, +all the old files are copyied to new directory, and some of the old +unused .class files and images remains inside new project JAR files. X serial port X better message for PortInUseException (full explanation) X better message for when serial port code not available/not installed @@ -8693,42 +10218,42 @@ X this was previous unknown, but likely several found it (!) X macosx - check to see if swing is working properly X macosx - update build script to work with new layout X Add an Edit menu containing Undo/Redo/Cut/Copy/Paste/Select - All. It's standard Mac behaviour. + All. It's standard Mac behaviour. X long list from frederik (fdb) -X If the cursor is at the last character of the last line of the - text area, moving the cursor up or down using the arrow keys throws - the following exception: - java.lang.ArrayIndexOutOfBoundsException - at PdeEditorListener.keyPressed(PdeEditorListener.java:86) - at java.awt.Component.processKeyEvent(Component.java:3673) +X If the cursor is at the last character of the last line of the + text area, moving the cursor up or down using the arrow keys throws + the following exception: + java.lang.ArrayIndexOutOfBoundsException + at PdeEditorListener.keyPressed(PdeEditorListener.java:86) + at java.awt.Component.processKeyEvent(Component.java:3673) X If the cursor is at the last character of the first line of the text area, moving the cursor up using the arrow keys throws the same - exception. However, moving the cursor down doesn't throw one. + exception. However, moving the cursor down doesn't throw one. X Double-clicking a word doesn't select it, but the character after - it. (however, sometimes the behaviour is correct) + it. (however, sometimes the behaviour is correct) X Scrolling action when using cursor keys is not consistent with other editors: The window should only scroll when it needs to; it now tries - to keep the cursor on the current line. (or one line below it) + to keep the cursor on the current line. (or one line below it) X Using Apple-shift-arrowLeft to select from the cursor pos to the beginning of the line, selects one character too little at the right side. Apple-shift-arrowRight has the same issue (selects one char too - little at the left side). + little at the left side). X Using Apple-shift-arrowDown selects only from the beginning of this line to the end of the following line. It doesn't extend the selection when pressed twice. It also selects the line under the - current line. + current line. X Pressing the tab key moves to the bottom of the text area. X hopefully fixed, but needs to be tested -? Select All (Apple-A) closes the application - (Ctrl-Q) on Azerty-keyboards -X use date in the sketch name sketch_021104 +? Select All (Apple-A) closes the application + (Ctrl-Q) on Azerty-keyboards +X use date in the sketch name sketch_021104 X with a _2 if needed or '021104a' '021104b' etc X when using save as, allow to remove the old (numbered) sketch X better default size than 300x300 when starting up first time X bug report from the site resizing the editor window in Mac OS X leaves the status bar in place. The result is an editor window with a grey bar layered on top, -obscuring the editable text. +obscuring the editable text. X fix default fonts, font size on mac X fix lots of annoying crap about highlighting lines on errors X re-enable console, add synchronized (hrmph) @@ -8771,7 +10296,7 @@ X for now, disallow the / or : characters X there was a bug that required a noop() b/c of jikes or 1.3 problems X is problem w/ beautify that it has no menu event handler? X write event handler, and make sure it doesn't work for external ed -X don't popup offscreen if editor window is way left. +X don't popup offscreen if editor window is way left. X just make sure the x coord > 10 or so (if not presenting) X if so, pop up window 50, 50 from upper left corner X if it still won't fit, center the window on screen @@ -8808,7 +10333,7 @@ X escape on presentation mode--no key events seem to be coming through X make default font size for editor the next size smaller X include names of all people who submitted bugs X use self-extractor and make sure no 8.3 filenames -X use a .dmg to distribute +X use a .dmg to distribute X make sure no DS_Store files are included @@ -8860,7 +10385,7 @@ X remove projects if created but nothing happens to them X maybe do this on open or quit? X first a syntax error, when fixed, causes NullPointerException  X quitting the app makes things all better. argh. -X this just started with version37, it happens extrememely +X this just started with version37, it happens extrememely X frequently and should be easy to reproduce the error X images with imageMode set for simage() weren't working @@ -8884,7 +10409,7 @@ X some method for getting list of serial ports X pde menu item for listing serial ports available o could just println them to the console X import javax.comm stuff as standard in kjc (but not export) -X can't get fonts to load - tested working ok +X can't get fonts to load - tested working ok X bagel complaint: could not load font Univerx76.vlw.gz X why the x? what's going on? X try using serial on macosx @@ -8947,7 +10472,7 @@ X how to make double-clickable version for osx X might be as simple as combined jar with manifest and symlink X jar doesn't like opening pde.properties b/c getClass fails X app title comes up as PdeBase -X -Xdock:name property or +X -Xdock:name property or X com.apple.mrj.application.apple.menu.about.name (gulp) X -XDock:icon (lowercase dock?) to set icon, or X .icns file in the Contents/Resources of the bundle @@ -8957,7 +10482,7 @@ X serial works poorly for starting/stopping applets X appears to be fixed through use of static object in bagel X breaks on every 2nd run when using serial apps (or others?) X try calling gc on stop as well -X make it simpler to build the code.. +X make it simpler to build the code.. X buzz.pl actually no longer needed (no ifdefs) o use a regular makefile for everything X getResource stuff breaks, sketch.properties can't save @@ -9004,7 +10529,7 @@ X tested, seems to be fine? X console - convert tabs to spaces o line wrapping (but save info for resize? noo..) X fix to line numbers being off for KjcEngine exception highlights -X changed error color slightly for console to fit status error +X changed error color slightly for console to fit status error X size() not being called in setup is gonna cause lots of headaches X hack: put exception handler around setup and re-call if necessary X linefeeds were wrong in BApplet @@ -9015,7 +10540,7 @@ X mark each as 'save', 'autosave', 'failed' or 'successful' compile X also include a timestamp X if a selection is made from the menu: X autosave, replace text, mark as edited -X if there have been no edits, and last thing was hist change, +X if there have been no edits, and last thing was hist change, X should *not* do another autosave X ensure this by historyLast being set on change.. heh. nice. X write message to people who signed up for p5 alpha @@ -9036,11 +10561,11 @@ X same under windows, just wasn't being set properly before X header font needed to be set each time as well X introduce pde.properties_OSNAME X tested to make sure it joins with the other pde.properties ok -X setPixel(i, j, #99CC00); +X setPixel(i, j, #99CC00); X not working anymore Syntax error: unexpected token: CC00 -X problem was substitute only worked along with = +X problem was substitute only worked along with = X perl should be ok to be cygwin perl.. try deinstalling activestate -o should fix paren balancing bug.. +o should fix paren balancing bug.. X just disable by default for alpha o background() not working X checked but couldn't duplicate @@ -9066,7 +10591,7 @@ X just removed the listeners on the window.. don't seem to be needed 0035 -X fixed a NullPointerException on startup +X fixed a NullPointerException on startup X when sketch.properties didn't exist, shouldn't print error X fix status standard message color text color X mousePressed() not working, also mouseReleased @@ -9112,7 +10637,7 @@ X in progress working on presentation mode 0032 already finished -X need to update PdeKeyListener for new ui.. +X need to update PdeKeyListener for new ui.. X remove open, add d for duplicate, r for rename, others ? X 'open' button is a switch-to button X pops up list of everything in the sketchbook @@ -9162,7 +10687,7 @@ X make close() work to kill applet in kjc X save window x, y, width, height to pde.properties on exit X stderr in red color X 'data' directory for all media -X make included media part of the .jar file +X make included media part of the .jar file X it's really a pain to use external files in processing X getStream sucks (zach rewrote) X should be able to work for application or applets @@ -9305,7 +10830,7 @@ X font file names are getting mangled on mac (too long) X new set of fonts, make sure the names are ok -0024 +0024 X bug fixes (lighting was broken) @@ -9335,7 +10860,7 @@ o also problem filling on beginShape() triangle stuff X z coordinates are backwards from gl (at least from mazo) X looked into it, this doesn't appear to be the case.. X how did this happen? what's the appropriate way to fix? -X in gl, positive z goes into the screen +X in gl, positive z goes into the screen X may be able to do a scale(0, 0, -1) that doesn't affect dims X then when dims set to 3, will fix the z coords X this will also affect zbuffer ordering @@ -9348,9 +10873,9 @@ X introduce pImage, pFont, pGraphics, pConstants (pSound) 0019 questions answered.. -X is day, month, year overkill inside processingapplet? +X is day, month, year overkill inside processingapplet? X decided no -X loadImage or getImage? +X loadImage or getImage? X loadImage sounds better to ben and casey X circle/square functions X doesn't seem necessary @@ -9373,7 +10898,7 @@ X beginShape() defaults to POLYGON X introduce constants for other poly modes X add ellipseMode(), rectMode() X CENTER_RADIUS, CENTER_DIAMETER, CORNER, TWO_CORNERS -X bezier and catmullrom aren't setting ndim to at least two +X bezier and catmullrom aren't setting ndim to at least two X ?? not sure why they would X translate(x, y) doesn't seem to affect a rect() X flat_rect was being used where ndim was 2, not 0 @@ -9422,7 +10947,7 @@ X switched to ibm java vm 0014 -X fix z coordinate, ndims not being set to 3 +X fix z coordinate, ndims not being set to 3 X put bezierCurve and catmullRomCurve back in X examples - setting background using a full screen image X uses System.arraycopy for speed @@ -9438,14 +10963,14 @@ X may have fixed OutOfMemoryError problems X run.bat had included -ms256m -mx256m -0013 +0013 X ellipse draws in the opposite direction of the origin X actually fix the bug with extends X wasn't included in previous release X option to set full screen background color X uses fullscreen.bgcolor in lib/pde.properties X remove 'colorScale' from the default program in pde -X fix color cube applet +X fix color cube applet X make it run in current version of processing X fix background from showing up black X screenGrab() code (single frame to tif) @@ -9484,14 +11009,14 @@ X got rid of colorscale and using colormode for all instead X make changes in documentation X 'ellipse' instead of 'oval'? X make note in documentation -X catmullrom is broken +X catmullrom is broken X write documentation for new curve functions o make note in docs about removal of LINE from LINES X setting origins X should shapes draw from center or from upper left? X should ovals use radius or diameter? X should shapes use x1, y1 - x2, y2 or x, y, w, h? -X nice to have a random number generator between -1..1 +X nice to have a random number generator between -1..1 X as well as an integer random; instead of just 0..1 X show creas how to get access to cvs X documentation says 'mouseDown' even though it's 'mousePressed' @@ -9511,9 +11036,9 @@ X worked fine for me 0009 X bagel fixes -X beginShape(POINTS) is not working, no marks are appearing +X beginShape(POINTS) is not working, no marks are appearing X this was a pain in the ass to fix -X beginShape(LINE_LOOP) is not looping around +X beginShape(LINE_LOOP) is not looping around X stroked POLYGON should emulate a LINE_LOOP X fill white, stroke black, background white default in bagel X remove duplicates: LINE/LINES etc @@ -9563,7 +11088,7 @@ X or copy bagel's image, and kill that too? 0004 -X put debugging stuff back into Kjc (i disabled some stuff) +X put debugging stuff back into Kjc (i disabled some stuff) 0001 diff --git a/java/.settings/org.eclipse.jdt.core.prefs b/java/.settings/org.eclipse.jdt.core.prefs index d17b6724d1..a698e59674 100644 --- a/java/.settings/org.eclipse.jdt.core.prefs +++ b/java/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,12 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.compliance=1.8 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.7 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/java/application/Info.plist.tmpl b/java/application/Info.plist.tmpl index 9cc224c08f..1fbe138595 100644 --- a/java/application/Info.plist.tmpl +++ b/java/application/Info.plist.tmpl @@ -38,7 +38,7 @@ @@sketch@@ LSMinimumSystemVersion - 10.7.3 + 10.8.5 NSHighResolutionCapable @@ -60,7 +60,8 @@ JVMOptions @@jvm_options_list@@ - -Xdock:icon=Contents/Resources/sketch.icns + -Xdock:icon=$APP_ROOT/Contents/Resources/sketch.icns + -Djava.library.path=$APP_ROOT/Contents/Java -Dapple.laf.useScreenMenuBar=true -Dcom.apple.macos.use-file-dialog-packages=true -Dcom.apple.macos.useScreenMenuBar=true diff --git a/java/application/launch4j/bin/ld-linux-armv6hf b/java/application/launch4j/bin/ld-linux-armv6hf new file mode 100755 index 0000000000..032cd917a8 Binary files /dev/null and b/java/application/launch4j/bin/ld-linux-armv6hf differ diff --git a/java/application/launch4j/bin/windres-linux-armv6hf b/java/application/launch4j/bin/windres-linux-armv6hf new file mode 100755 index 0000000000..41b2223800 Binary files /dev/null and b/java/application/launch4j/bin/windres-linux-armv6hf differ diff --git a/java/application/launch4j/head/guihead.o b/java/application/launch4j/head/guihead.o index 9cc215d9ac..7cff132218 100644 Binary files a/java/application/launch4j/head/guihead.o and b/java/application/launch4j/head/guihead.o differ diff --git a/java/application/launch4j/head/head.o b/java/application/launch4j/head/head.o index a8522f7c83..d5d63d6666 100644 Binary files a/java/application/launch4j/head/head.o and b/java/application/launch4j/head/head.o differ diff --git a/java/application/launch4j/launch4j.jar b/java/application/launch4j/launch4j.jar index 7b3d72287c..6daad70f7a 100644 Binary files a/java/application/launch4j/launch4j.jar and b/java/application/launch4j/launch4j.jar differ diff --git a/java/build.xml b/java/build.xml index 7c76ace140..0fda9c2c55 100644 --- a/java/build.xml +++ b/java/build.xml @@ -1,15 +1,15 @@ - + - + - + @@ -23,12 +23,12 @@ - - - - - - + + + + + + @@ -37,9 +37,9 @@ - + @@ -49,28 +49,24 @@ - + - + - + - + @@ -86,37 +82,37 @@ - - + + https://github.com/processing/processing/issues/1792 --> - + debug="on" + nowarn="true" + compiler="org.eclipse.jdt.core.JDTCompilerAdapter"> - diff --git a/java/keywords.txt b/java/keywords.txt index 079ddb7aff..b71cbf66ba 100644 --- a/java/keywords.txt +++ b/java/keywords.txt @@ -1,17 +1,18 @@ -# THE TEXT BELOW IS HAND WRITTEN AND FOUND IN THE FILE "keywords_base.txt" -# IN THE PROCESSING-DOCS REPO. DON'T EDITS THE keywords.txt FILE DIRECTLY. +# THIS TEXT IS FROM keywords_base.txt IN THE PROCESSING-DOCS REPO: +# https://github.com/processing/processing-docs/blob/master/generate/keywords_base.txt +# MAKE CHANGES THERE: DO NOT EDIT THE keywords.txt FILE DIRECTLY. -# For an explanation of these tags, see Token.java +# For an explanation of these tags, see Token.java # trunk/processing/app/src/processing/app/syntax/Token.java ADD LITERAL2 blend_ -ALIGN_CENTER LITERAL2 -ALIGN_LEFT LITERAL2 -ALIGN_RIGHT LITERAL2 +ALIGN_CENTER LITERAL2 +ALIGN_LEFT LITERAL2 +ALIGN_RIGHT LITERAL2 ALPHA LITERAL2 ALPHA_MASK LITERAL2 ALT LITERAL2 -AMBIENT LITERAL2 +AMBIENT LITERAL2 ARC LITERAL2 createShape_ ARROW LITERAL2 cursor_ ARGB LITERAL2 @@ -24,7 +25,7 @@ BLUR LITERAL2 filter_ BOTTOM LITERAL2 textAlign_ BOX LITERAL2 createShape_ BURN LITERAL2 blend_ -CENTER LITERAL2 +CENTER LITERAL2 CHATTER LITERAL2 CHORD LITERAL2 arc_ CLAMP LITERAL2 @@ -83,11 +84,12 @@ ERODE LITERAL2 filter_ ESC LITERAL2 keyCode EXCLUSION LITERAL2 blend_ EXIT LITERAL2 +FX2D LITERAL2 size_ GIF LITERAL2 GRAY LITERAL2 filter_ GREEN_MASK LITERAL2 GROUP LITERAL2 -HALF LITERAL2 +HALF LITERAL2 HALF_PI LITERAL2 HALF_PI HAND LITERAL2 cursor_ HARD_LIGHT LITERAL2 blend_ @@ -96,8 +98,7 @@ HSB LITERAL2 colorMode_ IMAGE LITERAL2 textureMode_ INVERT LITERAL2 filter_ JAVA2D LITERAL2 size_ -JPEG LITERAL2 -JFX LITERAL2 size_ +JPEG LITERAL2 LEFT LITERAL2 keyCode LIGHTEST LITERAL2 blend_ LINE LITERAL2 createShape_ @@ -105,18 +106,18 @@ LINES LITERAL2 beginShape_ LINUX LITERAL2 MACOSX LITERAL2 MAX_FLOAT LITERAL2 -MAX_INT LITERAL2 +MAX_INT LITERAL2 MIN_FLOAT LITERAL2 MIN_INT LITERAL2 MITER LITERAL2 stokeJoin_ MODEL LITERAL2 textMode_ MOVE LITERAL2 cursor_ MULTIPLY LITERAL2 blend_ -NORMAL LITERAL2 +NORMAL LITERAL2 NORMALIZED LITERAL2 textureMode_ NO_DEPTH_TEST LITERAL2 NTSC LITERAL2 -ONE LITERAL2 +ONE LITERAL2 OPAQUE LITERAL2 filter_ OPEN LITERAL2 ORTHOGRAPHIC LITERAL2 @@ -127,13 +128,13 @@ P2D LITERAL2 size_ P3D LITERAL2 size_ PERSPECTIVE LITERAL2 PI LITERAL2 PI -PIE LITERAL2 +PIE LITERAL2 PIXEL_CENTER LITERAL2 POINT LITERAL2 -POINTS LITERAL2 +POINTS LITERAL2 POSTERIZE LITERAL2 filter_ PRESS LITERAL2 -PROBLEM LITERAL2 +PROBLEM LITERAL2 PROJECT LITERAL2 strokeCap_ QUAD LITERAL2 createShape_ QUAD_STRIP LITERAL2 beginShape_ @@ -146,22 +147,23 @@ RECT LITERAL2 RED_MASK LITERAL2 RELEASE LITERAL2 REPEAT LITERAL2 -REPLACE LITERAL2 +REPLACE LITERAL2 RETURN LITERAL2 RGB LITERAL2 colorMode_ RIGHT LITERAL2 keyCode ROUND LITERAL2 strokeCap_ SCREEN LITERAL2 blend_ -SECAM LITERAL2 +SECAM LITERAL2 SHAPE LITERAL2 textMode_ SHIFT LITERAL2 -SPAN LITERAL2 fullScreen_ +SPAN LITERAL2 fullScreen_ SPECULAR LITERAL2 SPHERE LITERAL2 createShape_ SOFT_LIGHT LITERAL2 blend_ SQUARE LITERAL2 strokeCap_ SUBTRACT LITERAL2 blend_ -SVIDEO LITERAL2 +SVG LITERAL2 +SVIDEO LITERAL2 TAB LITERAL2 keyCode TARGA LITERAL2 TAU LITERAL2 TAU @@ -180,17 +182,17 @@ TWO LITERAL2 TWO_PI LITERAL2 TWO_PI UP LITERAL2 keyCode WAIT LITERAL2 cursor_ -WHITESPACE LITERAL2 +WHITESPACE LITERAL2 # Java keywords (void, import, , etc.) - + abstract KEYWORD1 break KEYWORD1 break class KEYWORD1 class continue KEYWORD1 continue -default KEYWORD1 default -enum KEYWORD1 +default KEYWORD1 default +enum KEYWORD1 extends KEYWORD1 extends false KEYWORD1 false final KEYWORD1 final @@ -198,17 +200,17 @@ finally KEYWORD1 implements KEYWORD1 implements import KEYWORD1 import instanceof KEYWORD1 -interface KEYWORD1 +interface KEYWORD1 native KEYWORD1 new KEYWORD1 new null KEYWORD1 null -package KEYWORD1 +package KEYWORD1 private KEYWORD1 private -protected KEYWORD1 +protected KEYWORD1 public KEYWORD1 public static KEYWORD1 static -strictfp KEYWORD1 -throws KEYWORD1 +strictfp KEYWORD1 +throws KEYWORD1 transient KEYWORD1 true KEYWORD1 true void KEYWORD1 void @@ -219,7 +221,7 @@ volatile KEYWORD1 assert KEYWORD6 case KEYWORD6 case -return KEYWORD6 return +return KEYWORD6 return super KEYWORD6 super this KEYWORD6 this throw KEYWORD6 @@ -229,18 +231,17 @@ throw KEYWORD6 Array KEYWORD5 Array ArrayList KEYWORD5 ArrayList -Boolean KEYWORD5 -Byte KEYWORD5 +Boolean KEYWORD5 +Byte KEYWORD5 BufferedReader KEYWORD5 BufferedReader -Character KEYWORD5 +Character KEYWORD5 Class KEYWORD5 class -Double KEYWORD5 -Float KEYWORD5 -Integer KEYWORD5 +Float KEYWORD5 +Integer KEYWORD5 HashMap KEYWORD5 HashMap PrintWriter KEYWORD5 PrintWriter String KEYWORD5 String -StringBuffer KEYWORD5 +StringBuffer KEYWORD5 StringBuilder KEYWORD5 Thread KEYWORD5 boolean KEYWORD5 boolean @@ -251,7 +252,6 @@ double KEYWORD5 double float KEYWORD5 float int KEYWORD5 int long KEYWORD5 long -short KEYWORD5 # Flow structures @@ -314,13 +314,20 @@ substring FUNCTION2 String_substring_ toLowerCase FUNCTION2 String_toLowerCase_ toUpperCase FUNCTION2 String_toUpperCase_ +getDouble FUNCTION2 +getLong FUNCTION2 +getColumnTitles FUNCTION2 +getColumnTypes FUNCTION2 +getColumnType FUNCTION2 +setDouble FUNCTION2 +setLong FUNCTION2 + length KEYWORD2 String # Temporary additions 3 September 2012 as the reference is getting updated - -end FUNCTION1 -addChild FUNCTION1 +#end FUNCTION1 +#addChild FUNCTION1 # Operators are without KEYWORDS @@ -369,542 +376,563 @@ PVector FUNCTION1 PVector ArrayList FUNCTION1 ArrayList HashMap FUNCTION1 HashMap +# pixelHeight is not generating correctly: https://github.com/processing/processing-docs/issues/260 + +pixelHeight KEYWORD4 pixelHeight -# THE TEXT ABOVE IS HAND-WRITTEN AND FOUND IN THE FILE "keywords_base.txt" + +# THE TEXT ABOVE IS HAND-WRITTEN AND FOUND IN THE FILE "keywords_base.txt" in processing/processing-docs/generate +# # THE TEXT BELOW IS AUTO-GENERATED # -# SO DON'T -# TOUCH IT +# SO +# DON'T +# TOUCH +# IT -abs FUNCTION1 abs_ -acos FUNCTION1 acos_ -alpha FUNCTION1 alpha_ -ambient FUNCTION1 ambient_ -ambientLight FUNCTION1 ambientLight_ -append FUNCTION1 append_ -applyMatrix FUNCTION1 applyMatrix_ -arc FUNCTION1 arc_ -arrayCopy FUNCTION1 arrayCopy_ -asin FUNCTION1 asin_ -atan FUNCTION1 atan_ -atan2 FUNCTION1 atan2_ -background FUNCTION1 background_ -beginCamera FUNCTION1 beginCamera_ -beginContour FUNCTION1 beginContour_ -beginRaw FUNCTION1 beginRaw_ -beginRecord FUNCTION1 beginRecord_ -beginShape FUNCTION1 beginShape_ -bezier FUNCTION1 bezier_ -bezierDetail FUNCTION1 bezierDetail_ +JSONObject KEYWORD5 JSONObject +cross FUNCTION2 PVector_cross_ +hasValue FUNCTION2 StringList_hasValue_ +PVector KEYWORD5 PVector +endCamera FUNCTION1 endCamera_ +min FUNCTION1 min_ +printCamera FUNCTION1 printCamera_ +strokeWeight FUNCTION1 strokeWeight_ +scale FUNCTION1 scale_ +copy FUNCTION2 PImage_copy_ +get FUNCTION2 IntList_get_ +mouseDragged FUNCTION4 mouseDragged +setString FUNCTION2 JSONArray_setString_ +setString FUNCTION2 TableRow_setString_ +keyReleased FUNCTION4 keyReleased +frameRate FUNCTION1 frameRate_ +PShape KEYWORD5 PShape +hasKey FUNCTION2 FloatDict_hasKey_ +randomSeed FUNCTION1 randomSeed_ +sortReverse FUNCTION2 FloatList_sortReverse_ +getParent FUNCTION2 XML_getParent_ +loadPixels FUNCTION2 PImage_loadPixels_ +save FUNCTION2 PImage_save_ +increment FUNCTION2 IntList_increment_ +hue FUNCTION1 hue_ bezierPoint FUNCTION1 bezierPoint_ -bezierTangent FUNCTION1 bezierTangent_ -bezierVertex FUNCTION1 bezierVertex_ -binary FUNCTION1 binary_ -blend FUNCTION1 blend_ -blendColor FUNCTION1 blendColor_ -blendMode FUNCTION1 blendMode_ -blue FUNCTION1 blue_ -box FUNCTION1 box_ -brightness FUNCTION1 brightness_ -camera FUNCTION1 camera_ -ceil FUNCTION1 ceil_ -clear FUNCTION1 clear_ -clip FUNCTION1 clip_ -color FUNCTION1 color_ -colorMode FUNCTION1 colorMode_ -concat FUNCTION1 concat_ -constrain FUNCTION1 constrain_ -copy FUNCTION1 copy_ -cos FUNCTION1 cos_ -createFont FUNCTION1 createFont_ -createGraphics FUNCTION1 createGraphics_ -createImage FUNCTION1 createImage_ -createInput FUNCTION1 createInput_ -createOutput FUNCTION1 createOutput_ -createReader FUNCTION1 createReader_ -createShape FUNCTION1 createShape_ -createWriter FUNCTION1 createWriter_ +getFloat FUNCTION2 JSONArray_getFloat_ +degrees FUNCTION1 degrees_ +loadPixels FUNCTION1 loadPixels_ cursor FUNCTION1 cursor_ -curve FUNCTION1 curve_ +beginContour FUNCTION1 beginContour_ +loadTable FUNCTION1 loadTable_ +keyPressed KEYWORD4 keyPressed +resetMatrix FUNCTION2 PShape_resetMatrix_ +dist FUNCTION1 dist_ +sub FUNCTION2 IntList_sub_ +removeColumn FUNCTION2 Table_removeColumn_ +updatePixels FUNCTION1 updatePixels_ +set FUNCTION2 FloatDict_set_ +disableStyle FUNCTION2 PShape_disableStyle_ +saveStream FUNCTION1 saveStream_ +mask FUNCTION2 PImage_mask_ +set FUNCTION2 StringList_set_ +createWriter FUNCTION1 createWriter_ +join FUNCTION1 join_ +findRow FUNCTION2 Table_findRow_ +append FUNCTION2 IntList_append_ +loadXML FUNCTION1 loadXML_ +splice FUNCTION1 splice_ +mult FUNCTION2 IntList_mult_ +mult FUNCTION2 PVector_mult_ +noiseDetail FUNCTION1 noiseDetail_ curveDetail FUNCTION1 curveDetail_ -curvePoint FUNCTION1 curvePoint_ -curveTangent FUNCTION1 curveTangent_ -curveTightness FUNCTION1 curveTightness_ -curveVertex FUNCTION1 curveVertex_ +textLeading FUNCTION1 textLeading_ +noCursor FUNCTION1 noCursor_ +sphere FUNCTION1 sphere_ day FUNCTION1 day_ -degrees FUNCTION1 degrees_ -directionalLight FUNCTION1 directionalLight_ -displayDensity FUNCTION1 displayDensity_ -displayHeight KEYWORD4 displayHeight -displayWidth KEYWORD4 displayWidth -dist FUNCTION1 dist_ -draw FUNCTION4 draw -ellipse FUNCTION1 ellipse_ -ellipseMode FUNCTION1 ellipseMode_ -emissive FUNCTION1 emissive_ -endCamera FUNCTION1 endCamera_ -endContour FUNCTION1 endContour_ -endRaw FUNCTION1 endRaw_ -endRecord FUNCTION1 endRecord_ -endShape FUNCTION1 endShape_ -exit FUNCTION1 exit_ -exp FUNCTION1 exp_ +month FUNCTION1 month_ +IntDict KEYWORD5 IntDict +popMatrix FUNCTION1 popMatrix_ +size FUNCTION2 StringList_size_ +loadImage FUNCTION1 loadImage_ +shininess FUNCTION1 shininess_ +setJSONArray FUNCTION2 JSONObject_setJSONArray_ +values FUNCTION2 IntDict_values_ +scale FUNCTION2 PShape_scale_ +ceil FUNCTION1 ceil_ +getFloat FUNCTION2 TableRow_getFloat_ +randomGaussian FUNCTION1 randomGaussian_ +setContent FUNCTION2 XML_setContent_ +size FUNCTION1 size_ +clear FUNCTION2 StringList_clear_ +mouseX KEYWORD4 mouseX expand FUNCTION1 expand_ -fill FUNCTION1 fill_ -filter FUNCTION1 filter_ -FloatDict KEYWORD5 FloatDict -add FUNCTION2 FloatDict_add_ -clear FUNCTION2 FloatDict_clear_ -div FUNCTION2 FloatDict_div_ -get FUNCTION2 FloatDict_get_ -hasKey FUNCTION2 FloatDict_hasKey_ -keyArray FUNCTION2 FloatDict_keyArray_ -keys FUNCTION2 FloatDict_keys_ -mult FUNCTION2 FloatDict_mult_ -remove FUNCTION2 FloatDict_remove_ -set FUNCTION2 FloatDict_set_ -size FUNCTION2 FloatDict_size_ -sortKeys FUNCTION2 FloatDict_sortKeys_ -sortKeysReverse FUNCTION2 FloatDict_sortKeysReverse_ -sortValues FUNCTION2 FloatDict_sortValues_ -sortValuesReverse FUNCTION2 FloatDict_sortValuesReverse_ -sub FUNCTION2 FloatDict_sub_ -valueArray FUNCTION2 FloatDict_valueArray_ -values FUNCTION2 FloatDict_values_ -FloatList KEYWORD5 FloatList -add FUNCTION2 FloatList_add_ -append FUNCTION2 FloatList_append_ +sort FUNCTION2 Table_sort_ +setBoolean FUNCTION2 JSONArray_setBoolean_ +pushMatrix FUNCTION1 pushMatrix_ +mouseY KEYWORD4 mouseY +lerpColor FUNCTION1 lerpColor_ array FUNCTION2 FloatList_array_ -clear FUNCTION2 FloatList_clear_ -div FUNCTION2 FloatList_div_ -get FUNCTION2 FloatList_get_ -hasValue FUNCTION2 FloatList_hasValue_ -max FUNCTION2 FloatList_max_ -min FUNCTION2 FloatList_min_ +ellipse FUNCTION1 ellipse_ +stroke FUNCTION1 stroke_ +imageMode FUNCTION1 imageMode_ +settings FUNCTION4 settings +pixelWidth FUNCTION4 pixelWidth +getName FUNCTION2 XML_getName_ +setVertex FUNCTION2 PShape_setVertex_ mult FUNCTION2 FloatList_mult_ remove FUNCTION2 FloatList_remove_ -reverse FUNCTION2 FloatList_reverse_ -set FUNCTION2 FloatList_set_ -shuffle FUNCTION2 FloatList_shuffle_ -size FUNCTION2 FloatList_size_ -sort FUNCTION2 FloatList_sort_ -sortReverse FUNCTION2 FloatList_sortReverse_ -sub FUNCTION2 FloatList_sub_ -floor FUNCTION1 floor_ +createGraphics FUNCTION1 createGraphics_ +min FUNCTION2 IntList_min_ +rows FUNCTION2 Table_rows_ focused KEYWORD4 focused -frameCount KEYWORD4 frameCount -frameRate KEYWORD4 frameRate -frameRate FUNCTION1 frameRate_ -frustum FUNCTION1 frustum_ -fullScreen FUNCTION1 fullScreen_ +endContour FUNCTION1 endContour_ +hasValue FUNCTION2 IntList_hasValue_ +setString FUNCTION2 Table_setString_ +sortKeysReverse FUNCTION2 FloatDict_sortKeysReverse_ +saveStrings FUNCTION1 saveStrings_ +resetMatrix FUNCTION1 resetMatrix_ +set FUNCTION2 PImage_set_ +add FUNCTION2 IntList_add_ +removeChild FUNCTION2 XML_removeChild_ +key KEYWORD4 key +requestImage FUNCTION1 requestImage_ +array FUNCTION2 StringList_array_ +saveBytes FUNCTION1 saveBytes_ get FUNCTION1 get_ -green FUNCTION1 green_ -HALF_PI LITERAL2 HALF_PI -hex FUNCTION1 hex_ -hint FUNCTION1 hint_ +emissive FUNCTION1 emissive_ +getColumnCount FUNCTION2 Table_getColumnCount_ +noStroke FUNCTION1 noStroke_ +textureWrap FUNCTION1 textureWrap_ +addChild FUNCTION2 XML_addChild_ +setMag FUNCTION2 PVector_setMag_ +FloatDict KEYWORD5 FloatDict +matchRow FUNCTION2 Table_matchRow_ +div FUNCTION2 FloatList_div_ +getBoolean FUNCTION2 JSONObject_getBoolean_ +vertex FUNCTION1 vertex_ +setFloat FUNCTION2 JSONObject_setFloat_ +copy FUNCTION2 PVector_copy_ +remove FUNCTION2 StringDict_remove_ +lower FUNCTION2 StringList_lower_ +format FUNCTION2 XML_format_ +setStroke FUNCTION2 PShape_setStroke_ +clear FUNCTION2 FloatList_clear_ +isNull FUNCTION2 JSONObject_isNull_ +mousePressed FUNCTION4 mousePressed +sortValuesReverse FUNCTION2 FloatDict_sortValuesReverse_ +sortValuesReverse FUNCTION2 StringDict_sortValuesReverse_ +selectInput FUNCTION1 selectInput_ +lerp FUNCTION2 PVector_lerp_ +div FUNCTION2 IntList_div_ +sort FUNCTION2 FloatList_sort_ +setInt FUNCTION2 JSONArray_setInt_ +createReader FUNCTION1 createReader_ +strokeJoin FUNCTION1 strokeJoin_ hour FUNCTION1 hour_ -hue FUNCTION1 hue_ -image FUNCTION1 image_ -imageMode FUNCTION1 imageMode_ -IntDict KEYWORD5 IntDict -add FUNCTION2 IntDict_add_ -clear FUNCTION2 IntDict_clear_ -div FUNCTION2 IntDict_div_ -get FUNCTION2 IntDict_get_ -hasKey FUNCTION2 IntDict_hasKey_ -increment FUNCTION2 IntDict_increment_ -keyArray FUNCTION2 IntDict_keyArray_ -keys FUNCTION2 IntDict_keys_ -mult FUNCTION2 IntDict_mult_ -remove FUNCTION2 IntDict_remove_ -set FUNCTION2 IntDict_set_ -size FUNCTION2 IntDict_size_ -sortKeys FUNCTION2 IntDict_sortKeys_ -sortKeysReverse FUNCTION2 IntDict_sortKeysReverse_ -sortValues FUNCTION2 IntDict_sortValues_ +getRowCount FUNCTION2 Table_getRowCount_ +hasAttribute FUNCTION2 XML_hasAttribute_ +setFloat FUNCTION2 TableRow_setFloat_ +values FUNCTION2 FloatDict_values_ +getInt FUNCTION2 TableRow_getInt_ +getString FUNCTION2 JSONObject_getString_ +round FUNCTION1 round_ +strokeCap FUNCTION1 strokeCap_ +sortKeysReverse FUNCTION2 StringDict_sortKeysReverse_ +ortho FUNCTION1 ortho_ +getVertexCount FUNCTION2 PShape_getVertexCount_ +parseJSONObject FUNCTION1 parseJSONObject_ +textFont FUNCTION1 textFont_ +clear FUNCTION1 clear_ +getChildren FUNCTION2 XML_getChildren_ +loadBytes FUNCTION1 loadBytes_ +ambient FUNCTION1 ambient_ sortValuesReverse FUNCTION2 IntDict_sortValuesReverse_ -sub FUNCTION2 IntDict_sub_ -valueArray FUNCTION2 IntDict_valueArray_ -values FUNCTION2 IntDict_values_ -IntList KEYWORD5 IntList -add FUNCTION2 IntList_add_ -append FUNCTION2 IntList_append_ -array FUNCTION2 IntList_array_ -clear FUNCTION2 IntList_clear_ -div FUNCTION2 IntList_div_ -get FUNCTION2 IntList_get_ -hasValue FUNCTION2 IntList_hasValue_ -increment FUNCTION2 IntList_increment_ -max FUNCTION2 IntList_max_ -min FUNCTION2 IntList_min_ -mult FUNCTION2 IntList_mult_ +keyTyped FUNCTION4 keyTyped +HALF_PI LITERAL2 HALF_PI +loadFont FUNCTION1 loadFont_ +frameRate FUNCTION1 frameRate_ +map FUNCTION1 map_ +min FUNCTION2 FloatList_min_ +mag FUNCTION1 mag_ +minute FUNCTION1 minute_ +beginRecord FUNCTION1 beginRecord_ +add FUNCTION2 FloatList_add_ +alpha FUNCTION1 alpha_ +clear FUNCTION2 StringDict_clear_ +noClip FUNCTION1 noClip_ +TWO_PI LITERAL2 TWO_PI +normalize FUNCTION2 PVector_normalize_ +abs FUNCTION1 abs_ remove FUNCTION2 IntList_remove_ +saveXML FUNCTION1 saveXML_ +blend FUNCTION2 PImage_blend_ +sortKeys FUNCTION2 FloatDict_sortKeys_ +blue FUNCTION1 blue_ reverse FUNCTION2 IntList_reverse_ -set FUNCTION2 IntList_set_ -shuffle FUNCTION2 IntList_shuffle_ -size FUNCTION2 IntList_size_ -sort FUNCTION2 IntList_sort_ -sortReverse FUNCTION2 IntList_sortReverse_ -sub FUNCTION2 IntList_sub_ -join FUNCTION1 join_ -JSONArray KEYWORD5 JSONArray -append FUNCTION2 JSONArray_append_ -getBoolean FUNCTION2 JSONArray_getBoolean_ -getFloat FUNCTION2 JSONArray_getFloat_ -getInt FUNCTION2 JSONArray_getInt_ +getContent FUNCTION2 XML_getFloatContent_ +keys FUNCTION2 StringDict_keys_ +clear FUNCTION2 FloatDict_clear_ +year FUNCTION1 year_ +nfc FUNCTION1 nfc_ +rotate FUNCTION1 rotate_ +getChild FUNCTION2 XML_getChild_ +parseJSONArray FUNCTION1 parseJSONArray_ +pixels KEYWORD4 pixels getIntArray FUNCTION2 JSONArray_getIntArray_ +saveFrame FUNCTION1 saveFrame_ +getFloat FUNCTION2 JSONObject_getFloat_ +size FUNCTION2 StringDict_size_ +splitTokens FUNCTION1 splitTokens_ +mult FUNCTION2 IntDict_mult_ +atan FUNCTION1 atan_ +setName FUNCTION2 XML_setName_ +XML KEYWORD5 XML +circle FUNCTION1 circle_ +bezierDetail FUNCTION1 bezierDetail_ +draw FUNCTION4 draw +getContent FUNCTION2 XML_getContent_ +cos FUNCTION1 cos_ +sq FUNCTION1 sq_ +TAU LITERAL2 TAU +delay FUNCTION1 delay_ +fullScreen FUNCTION1 fullScreen_ +endRaw FUNCTION1 endRaw_ +setVisible FUNCTION2 PShape_setVisible_ +increment FUNCTION2 IntDict_increment_ +shuffle FUNCTION2 IntList_shuffle_ getJSONArray FUNCTION2 JSONArray_getJSONArray_ -getJSONObject FUNCTION2 JSONArray_getJSONObject_ -getString FUNCTION2 JSONArray_getString_ -getStringArray FUNCTION2 JSONArray_getStringArray_ -remove FUNCTION2 JSONArray_remove_ -setBoolean FUNCTION2 JSONArray_setBoolean_ +translate FUNCTION1 translate_ +sort FUNCTION2 IntList_sort_ setFloat FUNCTION2 JSONArray_setFloat_ -setInt FUNCTION2 JSONArray_setInt_ -setJSONArray FUNCTION2 JSONArray_setJSONArray_ -setJSONObject FUNCTION2 JSONArray_setJSONObject_ -setString FUNCTION2 JSONArray_setString_ -size FUNCTION2 JSONArray_size_ -JSONObject KEYWORD5 JSONObject -getBoolean FUNCTION2 JSONObject_getBoolean_ -getFloat FUNCTION2 JSONObject_getFloat_ -getInt FUNCTION2 JSONObject_getInt_ -getJSONArray FUNCTION2 JSONObject_getJSONArray_ -getJSONObject FUNCTION2 JSONObject_getJSONObject_ -getString FUNCTION2 JSONObject_getString_ +nfp FUNCTION1 nfp_ +upper FUNCTION2 StringList_upper_ +setInt FUNCTION2 TableRow_setInt_ +hasKey FUNCTION2 IntDict_hasKey_ +blendMode FUNCTION1 blendMode_ +sin FUNCTION1 sin_ +mouseButton KEYWORD4 mouseButton +QUARTER_PI LITERAL2 QUARTER_PI +clip FUNCTION1 clip_ +sub FUNCTION2 FloatList_sub_ +getInt FUNCTION2 JSONArray_getInt_ +getBoolean FUNCTION2 JSONArray_getBoolean_ +set FUNCTION2 IntDict_set_ +displayHeight KEYWORD4 displayHeight +findRows FUNCTION2 Table_findRows_ +hex FUNCTION1 hex_ +TableRow KEYWORD5 TableRow +PI LITERAL2 PI +updatePixels FUNCTION2 PImage_updatePixels_ +beginShape FUNCTION1 beginShape_ +StringDict KEYWORD5 StringDict +mult FUNCTION2 FloatDict_mult_ +append FUNCTION2 FloatList_append_ +trim FUNCTION1 trim_ +pmouseX KEYWORD4 pmouseX +textDescent FUNCTION1 textDescent_ +createShape FUNCTION1 createShape_ +keyArray FUNCTION2 FloatDict_keyArray_ +get FUNCTION2 FloatList_get_ +getStringColumn FUNCTION2 Table_getStringColumn_ +pmouseY KEYWORD4 pmouseY +pixels KEYWORD2 PImage_pixels +nfs FUNCTION1 nfs_ setBoolean FUNCTION2 JSONObject_setBoolean_ -setFloat FUNCTION2 JSONObject_setFloat_ -setInt FUNCTION2 JSONObject_setInt_ -setJSONArray FUNCTION2 JSONObject_setJSONArray_ -setJSONObject FUNCTION2 JSONObject_setJSONObject_ -setString FUNCTION2 JSONObject_setString_ -key KEYWORD4 key -keyCode KEYWORD4 keyCode +JSONArray KEYWORD5 JSONArray +displayDensity FUNCTION1 displayDensity_ +createFont FUNCTION1 createFont_ +applyMatrix FUNCTION1 applyMatrix_ keyPressed FUNCTION4 keyPressed -keyPressed KEYWORD4 keyPressed -keyReleased FUNCTION4 keyReleased -keyTyped FUNCTION4 keyTyped -launch FUNCTION1 launch_ -lerp FUNCTION1 lerp_ -lerpColor FUNCTION1 lerpColor_ -lightFalloff FUNCTION1 lightFalloff_ -lights FUNCTION1 lights_ -lightSpecular FUNCTION1 lightSpecular_ -line FUNCTION1 line_ -loadBytes FUNCTION1 loadBytes_ -loadFont FUNCTION1 loadFont_ -loadImage FUNCTION1 loadImage_ -loadJSONArray FUNCTION1 loadJSONArray_ -loadJSONObject FUNCTION1 loadJSONObject_ -loadPixels FUNCTION1 loadPixels_ -loadShader FUNCTION1 loadShader_ -loadShape FUNCTION1 loadShape_ -loadStrings FUNCTION1 loadStrings_ -loadTable FUNCTION1 loadTable_ -loadXML FUNCTION1 loadXML_ -log FUNCTION1 log_ -loop FUNCTION1 loop_ -mag FUNCTION1 mag_ -map FUNCTION1 map_ -match FUNCTION1 match_ +getColumnTitle FUNCTION2 TableRow_getColumnTitle_ +getString FUNCTION2 XML_getString_ +point FUNCTION1 point_ +background FUNCTION1 background_ +pixelDensity FUNCTION1 pixelDensity_ +set FUNCTION2 PVector_set_ +triangle FUNCTION1 triangle_ +rect FUNCTION1 rect_ +shape FUNCTION1 shape_ +saveTable FUNCTION1 saveTable_ matchAll FUNCTION1 matchAll_ +get FUNCTION2 StringDict_get_ +noLights FUNCTION1 noLights_ max FUNCTION1 max_ -millis FUNCTION1 millis_ -min FUNCTION1 min_ -minute FUNCTION1 minute_ -modelX FUNCTION1 modelX_ -modelY FUNCTION1 modelY_ -modelZ FUNCTION1 modelZ_ -month FUNCTION1 month_ -mouseButton KEYWORD4 mouseButton -mouseClicked FUNCTION4 mouseClicked -mouseDragged FUNCTION4 mouseDragged -mouseMoved FUNCTION4 mouseMoved -mousePressed FUNCTION4 mousePressed -mousePressed KEYWORD4 mousePressed -mouseReleased FUNCTION1 mouseReleased_ +keys FUNCTION2 FloatDict_keys_ mouseWheel FUNCTION4 mouseWheel -mouseX KEYWORD4 mouseX -mouseY KEYWORD4 mouseY -nf FUNCTION1 nf_ -nfc FUNCTION1 nfc_ -nfp FUNCTION1 nfp_ -nfs FUNCTION1 nfs_ -noClip FUNCTION1 noClip_ -noCursor FUNCTION1 noCursor_ -noFill FUNCTION1 noFill_ -noise FUNCTION1 noise_ -noiseDetail FUNCTION1 noiseDetail_ -noiseSeed FUNCTION1 noiseSeed_ -noLights FUNCTION1 noLights_ -noLoop FUNCTION1 noLoop_ -norm FUNCTION1 norm_ -normal FUNCTION1 normal_ -noSmooth FUNCTION1 noSmooth_ -noStroke FUNCTION1 noStroke_ -noTint FUNCTION1 noTint_ -ortho FUNCTION1 ortho_ -parseXML FUNCTION1 parseXML_ -perspective FUNCTION1 perspective_ -PFont KEYWORD5 PFont -list FUNCTION1 PFont_list_ -PGraphics KEYWORD5 PGraphics -beginDraw FUNCTION2 PGraphics_beginDraw_ -endDraw FUNCTION2 PGraphics_endDraw_ -PI LITERAL2 PI +set FUNCTION1 set_ PImage KEYWORD5 PImage -blend FUNCTION2 PImage_blend_ -copy FUNCTION2 PImage_copy_ -filter FUNCTION2 PImage_filter_ +printProjection FUNCTION1 printProjection_ +popStyle FUNCTION1 popStyle_ +lerp FUNCTION1 lerp_ +clearRows FUNCTION2 Table_clearRows_ +perspective FUNCTION1 perspective_ +print FUNCTION1 print_ get FUNCTION2 PImage_get_ -loadPixels FUNCTION2 PImage_loadPixels_ -mask FUNCTION2 PImage_mask_ -pixels KEYWORD2 PImage_pixels -resize FUNCTION2 PImage_resize_ -save FUNCTION2 PImage_save_ -set FUNCTION2 PImage_set_ -updatePixels FUNCTION2 PImage_updatePixels_ -pixelDensity FUNCTION1 pixelDensity_ -pixelHeight FUNCTION1 pixelHeight_ -pixels KEYWORD4 pixels -pixelWidth KEYWORD4 pixelWidth -pmouseX KEYWORD4 pmouseX -pmouseY KEYWORD4 pmouseY -point FUNCTION1 point_ -pointLight FUNCTION1 pointLight_ -popMatrix FUNCTION1 popMatrix_ -popStyle FUNCTION1 popStyle_ -pow FUNCTION1 pow_ -print FUNCTION1 print_ -printArray FUNCTION1 printArray_ -printCamera FUNCTION1 printCamera_ -println FUNCTION1 println_ -printMatrix FUNCTION1 printMatrix_ -printProjection FUNCTION1 printProjection_ -PShader KEYWORD5 PShader -PShader FUNCTION2 PShader_set_ -PShape KEYWORD5 PShape +addColumn FUNCTION2 Table_addColumn_ +fill FUNCTION1 fill_ +loadJSONObject FUNCTION1 loadJSONObject_ +filter FUNCTION2 PImage_filter_ +getFloat FUNCTION2 Table_getFloat_ +redraw FUNCTION1 redraw_ +sortKeys FUNCTION2 StringDict_sortKeys_ +textAlign FUNCTION1 textAlign_ +append FUNCTION2 StringList_append_ +bezier FUNCTION1 bezier_ +size FUNCTION2 FloatDict_size_ addChild FUNCTION2 PShape_addChild_ -beginContour FUNCTION2 PShape_beginContour_ -beginShape FUNCTION2 PShape_beginShape_ -disableStyle FUNCTION2 PShape_disableStyle_ -enableStyle FUNCTION2 PShape_enableStyle_ -endContour FUNCTION2 PShape_endContour_ -endShape FUNCTION2 PShape_endShape_ -getChild FUNCTION2 PShape_getChild_ -getChildCount FUNCTION2 PShape_getChildCount_ -getVertex FUNCTION2 PShape_getVertex_ -getVertexCount FUNCTION2 PShape_getVertexCount_ -isVisible FUNCTION2 PShape_isVisible_ -resetMatrix FUNCTION2 PShape_resetMatrix_ -rotate FUNCTION2 PShape_rotate_ -rotateX FUNCTION2 PShape_rotateX_ -rotateY FUNCTION2 PShape_rotateY_ -rotateZ FUNCTION2 PShape_rotateZ_ -scale FUNCTION2 PShape_scale_ -setVertex FUNCTION2 PShape_setVertex_ -setVisible FUNCTION2 PShape_setVisible_ -translate FUNCTION2 PShape_translate_ -pushMatrix FUNCTION1 pushMatrix_ -pushStyle FUNCTION1 pushStyle_ -PVector KEYWORD5 PVector -add FUNCTION2 PVector_add_ +setFloat FUNCTION2 XML_setFloat_ +smooth FUNCTION1 smooth_ +blendColor FUNCTION1 blendColor_ +displayWidth KEYWORD4 displayWidth angleBetween FUNCTION2 PVector_angleBetween_ -array FUNCTION2 PVector_array_ -copy FUNCTION2 PVector_copy_ -cross FUNCTION2 PVector_cross_ -dist FUNCTION2 PVector_dist_ +removeRow FUNCTION2 Table_removeRow_ div FUNCTION2 PVector_div_ -dot FUNCTION2 PVector_dot_ -fromAngle FUNCTION2 PVector_fromAngle_ -get FUNCTION2 PVector_get_ -heading FUNCTION2 PVector_heading_ -lerp FUNCTION2 PVector_lerp_ -limit FUNCTION2 PVector_limit_ -mag FUNCTION2 PVector_mag_ -magSq FUNCTION2 PVector_magSq_ -mult FUNCTION2 PVector_mult_ -normalize FUNCTION2 PVector_normalize_ -random2D FUNCTION2 PVector_random2D_ -random3D FUNCTION2 PVector_random3D_ +println FUNCTION1 println_ +add FUNCTION2 FloatDict_add_ +brightness FUNCTION1 brightness_ +loadJSONArray FUNCTION1 loadJSONArray_ +tan FUNCTION1 tan_ +printMatrix FUNCTION1 printMatrix_ +lights FUNCTION1 lights_ +loadShape FUNCTION1 loadShape_ +random FUNCTION1 random_ +shuffle FUNCTION2 FloatList_shuffle_ rotate FUNCTION2 PVector_rotate_ -set FUNCTION2 PVector_set_ -setMag FUNCTION2 PVector_setMag_ -sub FUNCTION2 PVector_sub_ -quad FUNCTION1 quad_ +getJSONObject FUNCTION2 JSONObject_getJSONObject_ quadraticVertex FUNCTION1 quadraticVertex_ -QUARTER_PI LITERAL2 QUARTER_PI +sort FUNCTION2 StringList_sort_ +bezierVertex FUNCTION1 bezierVertex_ +exp FUNCTION1 exp_ +setJSONArray FUNCTION2 JSONArray_setJSONArray_ +setString FUNCTION2 JSONObject_setString_ +textureMode FUNCTION1 textureMode_ +specular FUNCTION1 specular_ +noSmooth FUNCTION1 noSmooth_ +pow FUNCTION1 pow_ +blend FUNCTION1 blend_ +listChildren FUNCTION2 XML_listChildren_ +keyArray FUNCTION2 IntDict_keyArray_ +green FUNCTION1 green_ +magSq FUNCTION2 PVector_magSq_ +listAttributes FUNCTION2 XML_listAttributes_ +createOutput FUNCTION1 createOutput_ +div FUNCTION2 IntDict_div_ +isNull FUNCTION2 JSONArray_isNull_ +getContent FUNCTION2 XML_getIntContent_ +setString FUNCTION2 XML_setString_ +get FUNCTION2 StringList_get_ +translate FUNCTION2 PShape_translate_ +concat FUNCTION1 concat_ +bezierTangent FUNCTION1 bezierTangent_ +mouseReleased FUNCTION4 mouseReleased +arrayCopy FUNCTION1 arrayCopy_ +beginCamera FUNCTION1 beginCamera_ +asin FUNCTION1 asin_ +remove FUNCTION2 IntDict_remove_ +lightFalloff FUNCTION1 lightFalloff_ +color FUNCTION1 color_ +shader FUNCTION1 shader_ +size FUNCTION2 IntDict_size_ +beginShape FUNCTION2 PShape_beginShape_ +getStringArray FUNCTION2 JSONArray_getStringArray_ +reverse FUNCTION2 FloatList_reverse_ +get FUNCTION2 FloatDict_get_ +rotateZ FUNCTION1 rotateZ_ +sortValues FUNCTION2 FloatDict_sortValues_ radians FUNCTION1 radians_ -random FUNCTION1 random_ -randomGaussian FUNCTION1 randomGaussian_ -randomSeed FUNCTION1 randomSeed_ -rect FUNCTION1 rect_ -rectMode FUNCTION1 rectMode_ -red FUNCTION1 red_ -redraw FUNCTION1 redraw_ -requestImage FUNCTION1 requestImage_ -resetMatrix FUNCTION1 resetMatrix_ -resetShader FUNCTION1 resetShader_ +keyArray FUNCTION2 StringDict_keyArray_ +curveTightness FUNCTION1 curveTightness_ +filter FUNCTION1 filter_ +getChildCount FUNCTION2 PShape_getChildCount_ +setJSONObject FUNCTION2 JSONArray_setJSONObject_ +heading FUNCTION2 PVector_heading_ +keys FUNCTION2 IntDict_keys_ +PFont KEYWORD5 PFont +noFill FUNCTION1 noFill_ +noise FUNCTION1 noise_ +acos FUNCTION1 acos_ +frameCount KEYWORD4 frameCount +curvePoint FUNCTION1 curvePoint_ +sort FUNCTION1 sort_ reverse FUNCTION1 reverse_ -rotate FUNCTION1 rotate_ -rotateX FUNCTION1 rotateX_ -rotateY FUNCTION1 rotateY_ -rotateZ FUNCTION1 rotateZ_ -round FUNCTION1 round_ -saturation FUNCTION1 saturation_ -save FUNCTION1 save_ -saveBytes FUNCTION1 saveBytes_ -saveFrame FUNCTION1 saveFrame_ -saveJSONArray FUNCTION1 saveJSONArray_ -saveJSONObject FUNCTION1 saveJSONObject_ -saveStream FUNCTION1 saveStream_ -saveStrings FUNCTION1 saveStrings_ -saveTable FUNCTION1 saveTable_ -saveXML FUNCTION1 saveXML_ -scale FUNCTION1 scale_ -screenX FUNCTION1 screenX_ -screenY FUNCTION1 screenY_ -screenZ FUNCTION1 screenZ_ +sphereDetail FUNCTION1 sphereDetail_ +sortReverse FUNCTION2 IntList_sortReverse_ +constrain FUNCTION1 constrain_ +frustum FUNCTION1 frustum_ +list FUNCTION1 PFont_list_ +max FUNCTION2 IntList_max_ +mag FUNCTION2 PVector_mag_ +sub FUNCTION2 FloatDict_sub_ second FUNCTION1 second_ -selectFolder FUNCTION1 selectFolder_ -selectInput FUNCTION1 selectInput_ -selectOutput FUNCTION1 selectOutput_ -set FUNCTION1 set_ -settings FUNCTION4 settings -setup FUNCTION4 setup -shader FUNCTION1 shader_ -shape FUNCTION1 shape_ -shapeMode FUNCTION1 shapeMode_ +set FUNCTION2 IntList_set_ +valueArray FUNCTION2 IntDict_valueArray_ +binary FUNCTION1 binary_ +StringList KEYWORD5 StringList +isVisible FUNCTION2 PShape_isVisible_ +push FUNCTION1 push_ +normal FUNCTION1 normal_ +PShader FUNCTION2 PShader_set_ +append FUNCTION2 JSONArray_append_ +pop FUNCTION1 pop_ shearX FUNCTION1 shearX_ +saveJSONObject FUNCTION1 saveJSONObject_ +enableStyle FUNCTION2 PShape_enableStyle_ +rotateY FUNCTION1 rotateY_ +rotateX FUNCTION1 rotateX_ +endShape FUNCTION1 endShape_ +sortKeys FUNCTION2 IntDict_sortKeys_ shearY FUNCTION1 shearY_ -shininess FUNCTION1 shininess_ -shorten FUNCTION1 shorten_ -sin FUNCTION1 sin_ -size FUNCTION1 size_ -smooth FUNCTION1 smooth_ -sort FUNCTION1 sort_ -specular FUNCTION1 specular_ -sphere FUNCTION1 sphere_ -sphereDetail FUNCTION1 sphereDetail_ -splice FUNCTION1 splice_ -split FUNCTION1 split_ -splitTokens FUNCTION1 splitTokens_ -spotLight FUNCTION1 spotLight_ -sq FUNCTION1 sq_ +shapeMode FUNCTION1 shapeMode_ +norm FUNCTION1 norm_ +saveJSONArray FUNCTION1 saveJSONArray_ +match FUNCTION1 match_ +values FUNCTION2 StringDict_values_ +sortValues FUNCTION2 StringDict_sortValues_ +floor FUNCTION1 floor_ +quad FUNCTION1 quad_ +pixelHeight FUNCTION1 pixelHeight_ +parseXML FUNCTION1 parseXML_ +exit FUNCTION1 exit_ +texture FUNCTION1 texture_ +clear FUNCTION2 IntDict_clear_ +size FUNCTION2 JSONArray_size_ +setup FUNCTION4 setup +getJSONObject FUNCTION2 JSONArray_getJSONObject_ +modelX FUNCTION1 modelX_ +dot FUNCTION2 PVector_dot_ +rotateX FUNCTION2 PShape_rotateX_ +valueArray FUNCTION2 FloatDict_valueArray_ +selectFolder FUNCTION1 selectFolder_ +random3D FUNCTION2 PVector_random3D_ sqrt FUNCTION1 sqrt_ -StringDict KEYWORD5 StringDict -clear FUNCTION2 StringDict_clear_ -get FUNCTION2 StringDict_get_ -hasKey FUNCTION2 StringDict_hasKey_ -keyArray FUNCTION2 StringDict_keyArray_ -keys FUNCTION2 StringDict_keys_ -remove FUNCTION2 StringDict_remove_ +sortReverse FUNCTION2 StringList_sortReverse_ +limit FUNCTION2 PVector_limit_ +log FUNCTION1 log_ +remove FUNCTION2 FloatDict_remove_ +shuffle FUNCTION2 StringList_shuffle_ +curveTangent FUNCTION1 curveTangent_ +unhex FUNCTION1 unhex_ +array FUNCTION2 IntList_array_ +size FUNCTION2 FloatList_size_ +remove FUNCTION2 StringList_remove_ +get FUNCTION2 PVector_get_ +createInput FUNCTION1 createInput_ set FUNCTION2 StringDict_set_ -size FUNCTION2 StringDict_size_ -sortKeys FUNCTION2 StringDict_sortKeys_ -sortKeysReverse FUNCTION2 StringDict_sortKeysReverse_ -sortValues FUNCTION2 StringDict_sortValues_ -sortValuesReverse FUNCTION2 StringDict_sortValuesReverse_ +thread FUNCTION1 thread_ +max FUNCTION2 FloatList_max_ +sub FUNCTION2 IntDict_sub_ +beginRaw FUNCTION1 beginRaw_ +set FUNCTION2 FloatList_set_ +getInt FUNCTION2 JSONObject_getInt_ +fromAngle FUNCTION2 PVector_fromAngle_ +rotateY FUNCTION2 PShape_rotateY_ +modelY FUNCTION1 modelY_ +ambientLight FUNCTION1 ambientLight_ +getJSONArray FUNCTION2 JSONObject_getJSONArray_ valueArray FUNCTION2 StringDict_valueArray_ -values FUNCTION2 StringDict_values_ -StringList KEYWORD5 StringList -append FUNCTION2 StringList_append_ -array FUNCTION2 StringList_array_ -clear FUNCTION2 StringList_clear_ -get FUNCTION2 StringList_get_ -hasValue FUNCTION2 StringList_hasValue_ -lower FUNCTION2 StringList_lower_ -remove FUNCTION2 StringList_remove_ -reverse FUNCTION2 StringList_reverse_ -set FUNCTION2 StringList_set_ -shuffle FUNCTION2 StringList_shuffle_ -size FUNCTION2 StringList_size_ -sort FUNCTION2 StringList_sort_ -sortReverse FUNCTION2 StringList_sortReverse_ -upper FUNCTION2 StringList_upper_ -stroke FUNCTION1 stroke_ -strokeCap FUNCTION1 strokeCap_ -strokeJoin FUNCTION1 strokeJoin_ -strokeWeight FUNCTION1 strokeWeight_ -subset FUNCTION1 subset_ -Table KEYWORD5 Table -addColumn FUNCTION2 Table_addColumn_ -addRow FUNCTION2 Table_addRow_ -clearRows FUNCTION2 Table_clearRows_ -findRow FUNCTION2 Table_findRow_ -findRows FUNCTION2 Table_findRows_ -getColumnCount FUNCTION2 Table_getColumnCount_ -getFloat FUNCTION2 Table_getFloat_ -getInt FUNCTION2 Table_getInt_ -getRow FUNCTION2 Table_getRow_ -getRowCount FUNCTION2 Table_getRowCount_ -getString FUNCTION2 Table_getString_ -getStringColumn FUNCTION2 Table_getStringColumn_ -matchRow FUNCTION2 Table_matchRow_ -matchRows FUNCTION2 Table_matchRows_ -removeColumn FUNCTION2 Table_removeColumn_ -removeRow FUNCTION2 Table_removeRow_ -removeTokens FUNCTION2 Table_removeTokens_ -rows FUNCTION2 Table_rows_ -setFloat FUNCTION2 Table_setFloat_ setInt FUNCTION2 Table_setInt_ -setString FUNCTION2 Table_setString_ -trim FUNCTION2 Table_trim_ -TableRow KEYWORD5 TableRow -getFloat FUNCTION2 TableRow_getFloat_ -getInt FUNCTION2 TableRow_getInt_ +rectMode FUNCTION1 rectMode_ +arc FUNCTION1 arc_ +setInt FUNCTION2 XML_setInt_ +getRow FUNCTION2 Table_getRow_ getString FUNCTION2 TableRow_getString_ -setFloat FUNCTION2 TableRow_setFloat_ -setInt FUNCTION2 TableRow_setInt_ -setString FUNCTION2 TableRow_setString_ -tan FUNCTION1 tan_ -TAU LITERAL2 TAU -text FUNCTION1 text_ -textAlign FUNCTION1 textAlign_ -textAscent FUNCTION1 textAscent_ -textDescent FUNCTION1 textDescent_ -textFont FUNCTION1 textFont_ -textLeading FUNCTION1 textLeading_ +noTint FUNCTION1 noTint_ +clear FUNCTION2 IntList_clear_ +beginContour FUNCTION2 PShape_beginContour_ +matchRows FUNCTION2 Table_matchRows_ +setFill FUNCTION2 PShape_setFill_ +shorten FUNCTION1 shorten_ +dist FUNCTION2 PVector_dist_ +unbinary FUNCTION1 unbinary_ +IntList KEYWORD5 IntList +toString FUNCTION2 XML_toString_ +get FUNCTION2 IntDict_get_ +getString FUNCTION2 JSONArray_getString_ +line FUNCTION1 line_ +sortValues FUNCTION2 IntDict_sortValues_ +mousePressed KEYWORD4 mousePressed +colorMode FUNCTION1 colorMode_ +loop FUNCTION1 loop_ +saturation FUNCTION1 saturation_ +sub FUNCTION2 PVector_sub_ +rotateZ FUNCTION2 PShape_rotateZ_ +beginDraw FUNCTION2 PGraphics_beginDraw_ +directionalLight FUNCTION1 directionalLight_ +hasValue FUNCTION2 FloatList_hasValue_ +modelZ FUNCTION1 modelZ_ +endContour FUNCTION2 PShape_endContour_ +setInt FUNCTION2 JSONObject_setInt_ +nf FUNCTION1 nf_ +size FUNCTION2 IntList_size_ +loadStrings FUNCTION1 loadStrings_ textMode FUNCTION1 textMode_ +camera FUNCTION1 camera_ +removeTokens FUNCTION2 Table_removeTokens_ +div FUNCTION2 FloatDict_div_ +screenY FUNCTION1 screenY_ +sortKeysReverse FUNCTION2 IntDict_sortKeysReverse_ textSize FUNCTION1 textSize_ -texture FUNCTION1 texture_ -textureMode FUNCTION1 textureMode_ -textureWrap FUNCTION1 textureWrap_ -textWidth FUNCTION1 textWidth_ -thread FUNCTION1 thread_ +rotate FUNCTION2 PShape_rotate_ +split FUNCTION1 split_ +Table KEYWORD5 Table +addRow FUNCTION2 Table_addRow_ +mouseClicked FUNCTION4 mouseClicked +ellipseMode FUNCTION1 ellipseMode_ +resetShader FUNCTION1 resetShader_ +hasChildren FUNCTION2 XML_hasChildren_ +append FUNCTION1 append_ +square FUNCTION1 square_ +getFloat FUNCTION2 XML_getFloat_ +textAscent FUNCTION1 textAscent_ +endShape FUNCTION2 PShape_endShape_ +box FUNCTION1 box_ +millis FUNCTION1 millis_ +curve FUNCTION1 curve_ +setFloat FUNCTION2 Table_setFloat_ +spotLight FUNCTION1 spotLight_ +resize FUNCTION2 PImage_resize_ +add FUNCTION2 IntDict_add_ +screenX FUNCTION1 screenX_ +curveVertex FUNCTION1 curveVertex_ +getChild FUNCTION2 PShape_getChild_ +getString FUNCTION2 Table_getString_ +printArray FUNCTION1 printArray_ +selectOutput FUNCTION1 selectOutput_ +endRecord FUNCTION1 endRecord_ +noiseSeed FUNCTION1 noiseSeed_ +hasKey FUNCTION2 StringDict_hasKey_ +endDraw FUNCTION2 PGraphics_endDraw_ +PGraphics KEYWORD5 PGraphics +pointLight FUNCTION1 pointLight_ +screenZ FUNCTION1 screenZ_ +array FUNCTION2 PVector_array_ +getVertex FUNCTION2 PShape_getVertex_ +save FUNCTION1 save_ +remove FUNCTION2 JSONArray_remove_ +loadShader FUNCTION1 loadShader_ +reverse FUNCTION2 StringList_reverse_ +keyCode KEYWORD4 keyCode +subset FUNCTION1 subset_ +image FUNCTION1 image_ tint FUNCTION1 tint_ -translate FUNCTION1 translate_ -triangle FUNCTION1 triangle_ -trim FUNCTION1 trim_ -TWO_PI LITERAL2 TWO_PI -unbinary FUNCTION1 unbinary_ -unhex FUNCTION1 unhex_ -updatePixels FUNCTION1 updatePixels_ -vertex FUNCTION1 vertex_ -XML KEYWORD5 XML -addChild FUNCTION2 XML_addChild_ -format FUNCTION2 XML_format_ getAttributeCount FUNCTION2 XML_getAttributeCount_ -getChild FUNCTION2 XML_getChild_ -getChildren FUNCTION2 XML_getChildren_ -getContent FUNCTION2 XML_getContent_ -getFloat FUNCTION2 XML_getFloat_ -getContent FUNCTION2 XML_getFloatContent_ +text FUNCTION1 text_ +mouseMoved FUNCTION4 mouseMoved +launch FUNCTION1 launch_ +PShader KEYWORD5 PShader +pushStyle FUNCTION1 pushStyle_ +textWidth FUNCTION1 textWidth_ +red FUNCTION1 red_ +lightSpecular FUNCTION1 lightSpecular_ +copy FUNCTION1 copy_ +atan2 FUNCTION1 atan2_ +add FUNCTION2 PVector_add_ +random2D FUNCTION2 PVector_random2D_ getInt FUNCTION2 XML_getInt_ -getContent FUNCTION2 XML_getIntContent_ -getName FUNCTION2 XML_getName_ -getParent FUNCTION2 XML_getParent_ -getString FUNCTION2 XML_getString_ -hasAttribute FUNCTION2 XML_hasAttribute_ -hasChildren FUNCTION2 XML_hasChildren_ -listAttributes FUNCTION2 XML_listAttributes_ -listChildren FUNCTION2 XML_listChildren_ -removeChild FUNCTION2 XML_removeChild_ -setContent FUNCTION2 XML_setContent_ -setFloat FUNCTION2 XML_setFloat_ -setInt FUNCTION2 XML_setInt_ -setName FUNCTION2 XML_setName_ -setString FUNCTION2 XML_setString_ -toString FUNCTION2 XML_toString_ -year FUNCTION1 year_ +createImage FUNCTION1 createImage_ +trim FUNCTION2 Table_trim_ +getColumnCount FUNCTION2 TableRow_getColumnCount_ +FloatList KEYWORD5 FloatList +attrib FUNCTION1 attrib_ +noLoop FUNCTION1 noLoop_ +setJSONObject FUNCTION2 JSONObject_setJSONObject_ +getInt FUNCTION2 Table_getInt_ diff --git a/java/libraries/dxf/.settings/org.eclipse.jdt.core.prefs b/java/libraries/dxf/.settings/org.eclipse.jdt.core.prefs index 2770cf1bf3..87b7a7a3a6 100644 --- a/java/libraries/dxf/.settings/org.eclipse.jdt.core.prefs +++ b/java/libraries/dxf/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,13 @@ -#Sat Nov 12 10:56:00 CST 2011 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/java/libraries/dxf/build.xml b/java/libraries/dxf/build.xml index bc3d8ec478..f5c0ed021e 100644 --- a/java/libraries/dxf/build.xml +++ b/java/libraries/dxf/build.xml @@ -13,8 +13,8 @@ - + *

    * 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.*;
    @@ -104,7 +104,7 @@
      * 
    * 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. diff --git a/java/libraries/io/build.xml b/java/libraries/io/build.xml new file mode 100644 index 0000000000..0e9e102344 --- /dev/null +++ b/java/libraries/io/build.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/libraries/io/examples/AnalogDigital_I2C_ADS1X15/ADS1X15.pde b/java/libraries/io/examples/AnalogDigital_I2C_ADS1X15/ADS1X15.pde new file mode 100644 index 0000000000..91caaf94ab --- /dev/null +++ b/java/libraries/io/examples/AnalogDigital_I2C_ADS1X15/ADS1X15.pde @@ -0,0 +1,107 @@ +import processing.io.I2C; + +// ADS1015 and ADS1115 are Analog-to-Digital converters using I2C +// they have four channels and 12 and 16 bits of resolution respectively +// datasheets: http://www.ti.com/lit/ds/symlink/ads1015.pdf +// http://www.ti.com/lit/ds/symlink/ads1115.pdf + +class ADS1015 extends ADS1X15 { + ADS1015(String dev, int address) { + super(dev, address); + bitShift = 4; + conversionDelay = 1; + } + + // returns a number between -1.0 and 1.0 + float analogRead(int channel) { + return readSingleEnded(channel) / 2047.0; + } +} + +class ADS1115 extends ADS1X15 { + ADS1115(String dev, int address) { + super(dev, address); + bitShift = 0; + conversionDelay = 8; + } + + // returns a number between -1.0 and 1.0 + float analogRead(int channel) { + return readSingleEnded(channel) / 32767.0; + } +} + + +class ADS1X15 extends I2C { + int address; + int bitShift; // bits to shift the result to the right + int conversionDelay; // in ms + int channel; // last channel used + int range; // see below + + // possible voltage ranges + static final int INTERNAL_6V144 = 0; // +/- 6.144V + static final int INTERNAL_4V096 = 1; // +/- 4.096V (library default) + static final int INTERNAL_2V048 = 2; // +/- 2.048V + static final int INTERNAL_1V024 = 3; // +/- 1.024V + static final int INTERNAL_0V512 = 4; // +/- 0.512V + static final int INTERNAL_0V256 = 5; // +/- 0.256V + + ADS1X15(String dev, int address) { + super(dev); + this.address = address; + this.channel = -1; + this.range = INTERNAL_4V096; + } + + // be careful not to make the input voltage exceed VCC + 0.3V + // this is regardless of the selected input range + void analogReference(int type) { + if (type < 0 || 7 < type) { + throw new RuntimeException("Invalid range setting"); + } + range = type; + } + + int readSingleEnded(int channel) { + if (channel < 0 || 3 < channel) { + System.err.println("The channel needs to be from 0 to 3"); + throw new IllegalArgumentException("Unexpected channel"); + } + + if (channel != this.channel) { + int config = 0x0183; // start with the default value from datasheet + config &= ~0x100; // enable continuous readings + config |= (range << 9); // set selected range (gain) + config |= (1 << 14) | (channel << 12); // set single-ended and channel + config |= (1 << 15); // start a single conversion + writeRegister(0x01, config); // write to the configuration register at 0x01 + + // when the channel switched we need to wait for the upcoming + // conversion to finish + delay(conversionDelay); + + // save the channel so that we don't need to do the same for + // subsequent reads from the same channel + this.channel = channel; + } + + return readS16(0x00) >> bitShift; // read from the conversion register at 0x00 + // the ADS1015 will have its 12-bit result in the upper bits, shift those right by four + } + + protected void writeRegister(int register, int value) { + beginTransmission(address); + write(register); + write(value >> 8); + write(value & 0xFF); + endTransmission(); + } + + protected int readS16(int register) { + beginTransmission(address); + write(register); + byte[] in = read(2); + return (in[0] << 8) | in[1]; + } +} diff --git a/java/libraries/io/examples/AnalogDigital_I2C_ADS1X15/AnalogDigital_I2C_ADS1X15.pde b/java/libraries/io/examples/AnalogDigital_I2C_ADS1X15/AnalogDigital_I2C_ADS1X15.pde new file mode 100644 index 0000000000..31e5cec7bb --- /dev/null +++ b/java/libraries/io/examples/AnalogDigital_I2C_ADS1X15/AnalogDigital_I2C_ADS1X15.pde @@ -0,0 +1,38 @@ +import processing.io.*; +ADS1015 adc; +// or, alternatively: +// ADS1115 adc; + +// see setup.png in the sketch folder for wiring details + +void setup() { + //printArray(I2C.list()); + + adc = new ADS1015("i2c-1", 0x48); + //adc = new ADS1115("i2c-1", 0x48); + + // this sets the measuring range to +/- 4.096 Volts + // other ranges supported by this chip: + // INTERNAL_6V144, INTERNAL_2V048, INTERNAL_1V024, + // INTERNAL_0V512, INTERNAL_0V256 + adc.analogReference(ADS1X15.INTERNAL_4V096); + + // Important: do not attempt to measure voltages higher than + // the supply voltage (VCC) + 0.3V, meaning that 3.6V is the + // absolut maximum voltage on the Raspberry Pi. This is + // irrespective of the analogReference() setting above. +} + +void draw() { + // this will return a number between 0 and 1 + // (as long as your voltage is positive) + float measured = adc.analogRead(0); + + // multiply with the selected range to get the absolut voltage + float volts = measured * 4.096; + println("Analog Input 0 is " + volts + "V"); + + background(255); + fill(measured * 255); + ellipse(width/2, height/2, width * 0.75, width * 0.75); +} diff --git a/java/libraries/io/examples/AnalogDigital_I2C_ADS1X15/setup.png b/java/libraries/io/examples/AnalogDigital_I2C_ADS1X15/setup.png new file mode 100644 index 0000000000..f57950d7fa Binary files /dev/null and b/java/libraries/io/examples/AnalogDigital_I2C_ADS1X15/setup.png differ diff --git a/java/libraries/io/examples/AnalogDigital_SPI_MCP3001/AnalogDigital_SPI_MCP3001.pde b/java/libraries/io/examples/AnalogDigital_SPI_MCP3001/AnalogDigital_SPI_MCP3001.pde new file mode 100644 index 0000000000..fd7e49dff0 --- /dev/null +++ b/java/libraries/io/examples/AnalogDigital_SPI_MCP3001/AnalogDigital_SPI_MCP3001.pde @@ -0,0 +1,20 @@ +import processing.io.*; +MCP3001 adc; + +// see setup.png in the sketch folder for wiring details + +void setup() { + //printArray(SPI.list()); + adc = new MCP3001(SPI.list()[0]); +} + +void draw() { + // this will return a number between 0 and 1 + float measured = adc.analogRead(); + + // multiply with the supply voltage to get an absolute value + float volts = 3.3 * measured; + println("Analog Input is " + volts + "V"); + + background(measured * 255); +} diff --git a/java/libraries/io/examples/AnalogDigital_SPI_MCP3001/MCP3001.pde b/java/libraries/io/examples/AnalogDigital_SPI_MCP3001/MCP3001.pde new file mode 100644 index 0000000000..2ffecaddb7 --- /dev/null +++ b/java/libraries/io/examples/AnalogDigital_SPI_MCP3001/MCP3001.pde @@ -0,0 +1,23 @@ +import processing.io.SPI; + +// MCP3001 is a Analog-to-Digital converter using SPI +// datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/21293C.pdf + +class MCP3001 extends SPI { + + MCP3001(String dev) { + super(dev); + settings(500000, SPI.MSBFIRST, SPI.MODE0); + } + + // returns a number between 0.0 and 1.0 + float analogRead() { + // dummy write, actual values don't matter + byte[] out = { 0, 0 }; + byte[] in = transfer(out); + // some input bit shifting according to the datasheet p. 16 + int val = ((in[0] & 0x1f) << 5) | ((in[1] & 0xf8) >> 3); + // val is between 0 and 1023 + return val/1023.0; + } +} diff --git a/java/libraries/io/examples/AnalogDigital_SPI_MCP3001/setup.png b/java/libraries/io/examples/AnalogDigital_SPI_MCP3001/setup.png new file mode 100644 index 0000000000..c52f67ffe3 Binary files /dev/null and b/java/libraries/io/examples/AnalogDigital_SPI_MCP3001/setup.png differ diff --git a/java/libraries/io/examples/AnalogDigital_SPI_MCP3008/AnalogDigital_SPI_MCP3008.pde b/java/libraries/io/examples/AnalogDigital_SPI_MCP3008/AnalogDigital_SPI_MCP3008.pde new file mode 100644 index 0000000000..2e3ea417d3 --- /dev/null +++ b/java/libraries/io/examples/AnalogDigital_SPI_MCP3008/AnalogDigital_SPI_MCP3008.pde @@ -0,0 +1,22 @@ +import processing.io.*; +MCP3008 adc; + +// see setup.png in the sketch folder for wiring details + +void setup() { + //printArray(SPI.list()); + adc = new MCP3008(SPI.list()[0]); +} + +void draw() { + // this will return a number between 0 and 1 + float measured = adc.analogRead(0); + + // multiply with the supply voltage to get an absolute value + float volts = 3.3 * measured; + println("Analog Input 0 is " + volts + "V"); + + background(255); + fill(measured * 255); + ellipse(width/2, height/2, width * 0.75, width * 0.75); +} diff --git a/java/libraries/io/examples/AnalogDigital_SPI_MCP3008/MCP3008.pde b/java/libraries/io/examples/AnalogDigital_SPI_MCP3008/MCP3008.pde new file mode 100644 index 0000000000..1c003d97e4 --- /dev/null +++ b/java/libraries/io/examples/AnalogDigital_SPI_MCP3008/MCP3008.pde @@ -0,0 +1,28 @@ +import processing.io.SPI; + +// MCP3008 is a Analog-to-Digital converter using SPI +// other than the MCP3001, this has 8 input channels +// datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/21295d.pdf + +class MCP3008 extends SPI { + + MCP3008(String dev) { + super(dev); + settings(500000, SPI.MSBFIRST, SPI.MODE0); + } + + // returns a number between 0.0 and 1.0 + float analogRead(int channel) { + if (channel < 0 || 7 < channel) { + System.err.println("The channel needs to be from 0 to 7"); + throw new IllegalArgumentException("Unexpected channel"); + } + byte[] out = { 0, 0, 0 }; + // encode the channel number in the first byte + out[0] = (byte)(0x18 | channel); + byte[] in = transfer(out); + int val = ((in[1] & 0x03) << 8) | (in[2] & 0xff); + // val is between 0 and 1023 + return val/1023.0; + } +} diff --git a/java/libraries/io/examples/AnalogDigital_SPI_MCP3008/setup.png b/java/libraries/io/examples/AnalogDigital_SPI_MCP3008/setup.png new file mode 100755 index 0000000000..92d1b69d32 Binary files /dev/null and b/java/libraries/io/examples/AnalogDigital_SPI_MCP3008/setup.png differ diff --git a/java/libraries/io/examples/Compass_I2C_HMC6352/Compass_I2C_HMC6352.pde b/java/libraries/io/examples/Compass_I2C_HMC6352/Compass_I2C_HMC6352.pde new file mode 100644 index 0000000000..921fe47cb4 --- /dev/null +++ b/java/libraries/io/examples/Compass_I2C_HMC6352/Compass_I2C_HMC6352.pde @@ -0,0 +1,19 @@ +import processing.io.*; +HMC6352 compass; + +// see setup.png in the sketch folder for wiring details + +void setup() { + // the module's I2C address can be changed by modifying values in its EEPROM + // 0x21 is however the default address + + //printArray(I2C.list()); + compass = new HMC6352("i2c-1", 0x21); +} + +void draw() { + background(255); + float deg = compass.heading(); + println(deg + " degrees"); + line(width/2, height/2, width/2+sin(radians(deg))*width/2, height/2-cos(radians(deg))*height/2); +} diff --git a/java/libraries/io/examples/Compass_I2C_HMC6352/HMC6352.pde b/java/libraries/io/examples/Compass_I2C_HMC6352/HMC6352.pde new file mode 100644 index 0000000000..ff925ac3a5 --- /dev/null +++ b/java/libraries/io/examples/Compass_I2C_HMC6352/HMC6352.pde @@ -0,0 +1,38 @@ +import processing.io.I2C; + +// HMC6352 is a digital compass using I2C +// datasheet: https://www.sparkfun.com/datasheets/Components/HMC6352.pdf + +class HMC6352 extends I2C { + int address; + + HMC6352(String dev, int address) { + super(dev); + this.address = address; + setHeadingMode(); + } + + void setHeadingMode() { + beginTransmission(address); + // command byte for writing to EEPROM + write(0x77); + // address of the output data control byte + write(0x4e); + // give us the plain heading + write(0x00); + endTransmission(); + } + + float heading() { + beginTransmission(address); + // command byte for reading the data + write(0x41); + byte[] in = read(2); + endTransmission(); + // put bytes together to tenth of degrees + // & 0xff makes sure the byte is not interpreted as a negative value + int deg = (in[0] & 0xff) << 8 | (in[1] & 0xff); + // return degrees + return deg / 10.0; + } +} diff --git a/java/libraries/io/examples/Compass_I2C_HMC6352/setup.png b/java/libraries/io/examples/Compass_I2C_HMC6352/setup.png new file mode 100644 index 0000000000..2e322cb83c Binary files /dev/null and b/java/libraries/io/examples/Compass_I2C_HMC6352/setup.png differ diff --git a/java/libraries/io/examples/DigitalAnalog_I2C_MCP4725/DigitalAnalog_I2C_MCP4725.pde b/java/libraries/io/examples/DigitalAnalog_I2C_MCP4725/DigitalAnalog_I2C_MCP4725.pde new file mode 100644 index 0000000000..2c69daec46 --- /dev/null +++ b/java/libraries/io/examples/DigitalAnalog_I2C_MCP4725/DigitalAnalog_I2C_MCP4725.pde @@ -0,0 +1,12 @@ +import processing.io.*; +MCP4725 dac; + +void setup() { + //printArray(I2C.list()); + dac = new MCP4725(I2C.list()[0], 0x60); +} + +void draw() { + background(map(mouseX, 0, width, 0, 255)); + dac.setAnalog(map(mouseX, 0, width, 0.0, 1.0)); +} diff --git a/java/libraries/io/examples/DigitalAnalog_I2C_MCP4725/MCP4725.pde b/java/libraries/io/examples/DigitalAnalog_I2C_MCP4725/MCP4725.pde new file mode 100644 index 0000000000..67c50175fa --- /dev/null +++ b/java/libraries/io/examples/DigitalAnalog_I2C_MCP4725/MCP4725.pde @@ -0,0 +1,27 @@ +import processing.io.I2C; + +// MCP4725 is a Digital-to-Analog converter using I2C +// datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/22039d.pdf + +class MCP4725 extends I2C { + int address; + + // there can be more than one device connected to the bus + // as long as they have different addresses + MCP4725(String dev, int address) { + super(dev); + this.address = address; + } + + // outputs voltages from 0V to the supply voltage + // (works with 3.3V and 5V) + void setAnalog(float fac) { + fac = constrain(fac, 0.0, 1.0); + // convert to 12 bit value + int val = int(4095 * fac); + beginTransmission(address); + write(val >> 8); + write(val & 255); + endTransmission(); + } +} diff --git a/java/libraries/io/examples/Display_I2C_SSD1306/Display_I2C_SSD1306.pde b/java/libraries/io/examples/Display_I2C_SSD1306/Display_I2C_SSD1306.pde new file mode 100644 index 0000000000..e16e6542a6 --- /dev/null +++ b/java/libraries/io/examples/Display_I2C_SSD1306/Display_I2C_SSD1306.pde @@ -0,0 +1,22 @@ +import processing.io.*; + +// 0.96" 128x64 OLED display ("SKU 346540") +SSD1306 oled; + +void setup() { + size(128, 64); + + // the display can be set to one of these two addresses: 0x3c (default) or 0x3d + // (they might be listed as 0x7a and 0x7b on the circuit board) + + // you might need to use a different interface on other SBCs + oled = new SSD1306("i2c-1", 0x3c); +} + +void draw() { + background(0); + stroke(255); + line(0, 0, 127, 63); + line(0, 63, 127, 0); + oled.sendImage(get()); +} diff --git a/java/libraries/io/examples/Display_I2C_SSD1306/SSD1306.pde b/java/libraries/io/examples/Display_I2C_SSD1306/SSD1306.pde new file mode 100644 index 0000000000..dee79a0276 --- /dev/null +++ b/java/libraries/io/examples/Display_I2C_SSD1306/SSD1306.pde @@ -0,0 +1,118 @@ +import processing.io.I2C; + +// SSD1306 is a small, inexpensive 128x64 pixels monochrome OLED display +// available online as "0.96" 128x64 OLED display", SKU 346540 +// or from Adafruit +// datasheet: https://www.adafruit.com/datasheets/SSD1306.pdf + +class SSD1306 extends I2C { + int address; + + // there can be more than one device connected to the bus + // as long as they have different addresses + SSD1306(String dev, int address) { + super(dev); + this.address = address; + init(); + } + + protected void init() { + writeCommand(0xae); // turn display off + writeCommand(0xa8, 0x3f); // set multiplex ratio to the highest setting + writeCommand(0x8d, 0x14); // enable charge pump + writeCommand(0x20, 0x00); // set memory addressing mode to horizontal + writeCommand(0xd5, 0x80); // set display clock divide ratio & oscillator frequency to default + writeCommand(0xd3, 0x00); // no display offset + writeCommand(0x40 | 0x00); // set default display start line + + // use the following two lines to flip the display + writeCommand(0xa0 | 0x01); // set segment re-map + writeCommand(0xc8); // set COM output scan direction + + writeCommand(0xda, 0x12); // set COM pins hardware configuration + writeCommand(0xd9, 0xf1); // set pre-charge period to 241x DCLK + writeCommand(0xdB, 0x40); // set VCOMH deselect level + writeCommand(0xa4); // display RAM content (not all-on) + writeCommand(0xa6); // set normal (not-inverted) display + + // set this since we don't have access to the OLED's reset pins (?) + writeCommand(0x21, 0, 127); // set column address + writeCommand(0x22, 0, 7); // set page address + + writeCommand(0x81, 0xcf); // set contrast + writeCommand(0x2e); // deactivate scroll + writeCommand(0xaf); // turn display on + } + + void invert(boolean inverted) { + if (inverted) { + writeCommand(0xa7); + } else { + writeCommand(0xa6); + } + } + + void sendImage(PImage img) { + sendImage(img, 0, 0); + } + + void sendImage(PImage img, int startX, int startY) { + byte[] frame = new byte[1024]; + img.loadPixels(); + for (int y=startY; y < height && y-startY < 64; y++) { + for (int x=startX; x < width && x-startX < 128; x++) { + if (128 <= brightness(img.pixels[y*img.width+x])) { + // this isn't the normal (scanline) mapping, but 8 pixels below each other at a time + // white pixels have their bit turned on + frame[x + (y/8)*128] |= (1 << (y % 8)); + } + } + } + sendFramebuffer(frame); + } + + void sendFramebuffer(byte[] buf) { + if (buf.length != 1024) { + System.err.println("The framebuffer should be 1024 bytes long, with one bit per pixel"); + throw new IllegalArgumentException("Unexpected buffer size"); + } + + writeCommand(0x00 | 0x0); // set start address + writeCommand(0x10 | 0x0); // set higher column start address + writeCommand(0x40 | 0x0); // set start line + + // send the frame buffer as 16 byte long packets + for (int i=0; i < buf.length/16; i++) { + super.beginTransmission(address); + super.write(0x40); // indicates data write + for (int j=0; j < 16; j++) { + super.write(buf[i*16+j]); + } + super.endTransmission(); + } + } + + protected void writeCommand(int arg1) { + super.beginTransmission(address); + super.write(0x00); // indicates command write + super.write(arg1); + super.endTransmission(); + } + + protected void writeCommand(int arg1, int arg2) { + super.beginTransmission(address); + super.write(0x00); + super.write(arg1); + super.write(arg2); + super.endTransmission(); + } + + protected void writeCommand(int arg1, int arg2, int arg3) { + super.beginTransmission(address); + super.write(0x00); + super.write(arg1); + super.write(arg2); + super.write(arg3); + super.endTransmission(); + } +} diff --git a/java/libraries/io/examples/Environment_I2C_BME280/BME280.pde b/java/libraries/io/examples/Environment_I2C_BME280/BME280.pde new file mode 100644 index 0000000000..572e6d7013 --- /dev/null +++ b/java/libraries/io/examples/Environment_I2C_BME280/BME280.pde @@ -0,0 +1,407 @@ +import processing.io.I2C; + +// BME280 is an integrated environmental sensor +// It can measure temperature, pressure and humidity +// datasheet: https://cdn-shop.adafruit.com/datasheets/BST-BME280_DS001-10.pdf +// code contributed by @OlivierLD + +public class BME280 extends I2C { + + public final static int BME280_I2CADDR = 0x77; // this is the default I2C address + public final static int DEFAULT_ADDR = BME280_I2CADDR; + + // Operating Modes + public final static int BME280_OSAMPLE_1 = 1; + public final static int BME280_OSAMPLE_2 = 2; + public final static int BME280_OSAMPLE_4 = 3; + public final static int BME280_OSAMPLE_8 = 4; + public final static int BME280_OSAMPLE_16 = 5; + + // BME280 Registers + public final static int BME280_REGISTER_DIG_T1 = 0x88; // Trimming parameter registers + public final static int BME280_REGISTER_DIG_T2 = 0x8A; + public final static int BME280_REGISTER_DIG_T3 = 0x8C; + + public final static int BME280_REGISTER_DIG_P1 = 0x8E; + public final static int BME280_REGISTER_DIG_P2 = 0x90; + public final static int BME280_REGISTER_DIG_P3 = 0x92; + public final static int BME280_REGISTER_DIG_P4 = 0x94; + public final static int BME280_REGISTER_DIG_P5 = 0x96; + public final static int BME280_REGISTER_DIG_P6 = 0x98; + public final static int BME280_REGISTER_DIG_P7 = 0x9A; + public final static int BME280_REGISTER_DIG_P8 = 0x9C; + public final static int BME280_REGISTER_DIG_P9 = 0x9E; + + public final static int BME280_REGISTER_DIG_H1 = 0xA1; + public final static int BME280_REGISTER_DIG_H2 = 0xE1; + public final static int BME280_REGISTER_DIG_H3 = 0xE3; + public final static int BME280_REGISTER_DIG_H4 = 0xE4; + public final static int BME280_REGISTER_DIG_H5 = 0xE5; + public final static int BME280_REGISTER_DIG_H6 = 0xE6; + public final static int BME280_REGISTER_DIG_H7 = 0xE7; + + public final static int BME280_REGISTER_CHIPID = 0xD0; + public final static int BME280_REGISTER_VERSION = 0xD1; + public final static int BME280_REGISTER_SOFTRESET = 0xE0; + + public final static int BME280_REGISTER_CONTROL_HUM = 0xF2; + public final static int BME280_REGISTER_CONTROL = 0xF4; + public final static int BME280_REGISTER_CONFIG = 0xF5; + public final static int BME280_REGISTER_PRESSURE_DATA = 0xF7; + public final static int BME280_REGISTER_TEMP_DATA = 0xFA; + public final static int BME280_REGISTER_HUMIDITY_DATA = 0xFD; + + private int dig_T1 = 0; + private int dig_T2 = 0; + private int dig_T3 = 0; + + private int dig_P1 = 0; + private int dig_P2 = 0; + private int dig_P3 = 0; + private int dig_P4 = 0; + private int dig_P5 = 0; + private int dig_P6 = 0; + private int dig_P7 = 0; + private int dig_P8 = 0; + private int dig_P9 = 0; + + private int dig_H1 = 0; + private int dig_H2 = 0; + private int dig_H3 = 0; + private int dig_H4 = 0; + private int dig_H5 = 0; + private int dig_H6 = 0; + + private float tFine = 0.0f; + + private int address; + private int mode = BME280_OSAMPLE_8; + private float standardSeaLevelPressure = 101325.0f; // in Pa (1013.25 hPa) + + protected float temp = 0.0f; // most recent sensor readings, set by update() + protected float press = 0.0f; + protected float hum = 0.0f; + + + public BME280(String dev) { + this(dev, DEFAULT_ADDR); + } + + public BME280(String dev, int address) { + super(dev); + this.address = address; + + // Soft reset + command(BME280_REGISTER_SOFTRESET, (byte)0xB6); + // Wait for the chip to wake up + delay(300); + + try { + readCalibrationData(); + // showCalibrationData(); + } catch (Exception ex) { + ex.printStackTrace(); + } + + command(BME280_REGISTER_CONTROL, (byte)0x3F); + tFine = 0.0f; + } + + + /** + * Read and update all sensors values + */ + public void update() { + // The order used to read the data is important! + // 1.temperature, 2.pressure (analog to altitude), 3.humidity. + + try { + temp = readTemperature(); + } catch (Exception ex) { + System.err.println(ex.getMessage()); + ex.printStackTrace(); + } + + try { + press = readPressure(); + } catch (Exception ex) { + System.err.println(ex.getMessage()); + ex.printStackTrace(); + } + + try { + hum = readHumidity(); + } catch (Exception ex) { + System.err.println(ex.getMessage()); + ex.printStackTrace(); + } + } + + /** + * Returns the temperature in degrees celsius + */ + public float temperature() { + return temp; + } + + /** + * Returns the pressure in Pa + */ + public float pressure() { + return press; + } + + /** + * Returns the altitude in meters + * @param pressure as returned by pressure() + */ + public float altitude(float pressure) { + double altitude = 0.0; + if (standardSeaLevelPressure != 0) { + altitude = 44330.0 * (1.0 - Math.pow(pressure / standardSeaLevelPressure, 0.1903)); + } + return (float)altitude; + } + + /** + * Returns the altitude in meters + * @param pressure as returned by pressure() in Pa + * @param temperature as returned by temperature() in Celcius + */ + public float altitude(float pressure, float temperature) { + double altitude = 0.0; + if (standardSeaLevelPressure != 0) { + altitude = ((Math.pow(standardSeaLevelPressure / pressure, 1 / 5.257) - 1) * (temperature + 273.25)) / 0.0065; + } + return (float)altitude; + } + + /** + * Returns the humidity in percent + */ + public float humidity() { + return hum; + } + + /** + * Set the standard sea level pressure used for calculating altitude() + * Defaults to 101325 Pa (1013.25 hPa) + */ + public void setStandardSeaLevelPressure(float pressure) { + standardSeaLevelPressure = pressure; + } + + + protected float readTemperature() { + // Returns the compensated temperature in degrees celcius + float UT = readRawTemp(); + float var1 = 0.0f; + float var2 = 0.0f; + float temp = 0.0f; + + // Read raw temp before aligning it with the calibration values + var1 = (UT / 16384.0f - dig_T1 / 1024.0f) * (float) dig_T2; + var2 = ((UT / 131072.0f - dig_T1 / 8192.0f) * (UT / 131072.0f - dig_T1 / 8192.0f)) * (float) dig_T3; + tFine = (int) (var1 + var2); + temp = (var1 + var2) / 5120.0f; + // println("DBG: Calibrated temperature = " + temp + " C"); + return temp; + } + + protected float readPressure() { + // Returns the compensated pressure in Pascal + int adc = readRawPressure(); + // println("ADC:" + adc + ", tFine:" + tFine); + float var1 = (tFine / 2.0f) - 64000.0f; + float var2 = var1 * var1 * (dig_P6 / 32768.0f); + var2 = var2 + var1 * dig_P5 * 2.0f; + var2 = (var2 / 4.0f) + (dig_P4 * 65536.0f); + var1 = (dig_P3 * var1 * var1 / 524288.0f + dig_P2 * var1) / 524288.0f; + var1 = (1.0f + var1 / 32768.0f) * dig_P1; + if (var1 == 0f) { + return 0.0f; + } + float p = 1048576.0f - adc; + p = ((p - var2 / 4096.0f) * 6250.0f) / var1; + var1 = dig_P9 * p * p / 2147483648.0f; + var2 = p * dig_P8 / 32768.0f; + p = p + (var1 + var2 + dig_P7) / 16.0f; + // println("DBG: Pressure = " + p + " Pa"); + return p; + } + + protected float readHumidity() { + // Returns the compensated humidity in percent + int adc = readRawHumidity(); + float h = tFine - 76800.0f; + h = (adc - (dig_H4 * 64.0f + dig_H5 / 16384.8f * h)) * + (dig_H2 / 65536.0f * (1.0f + dig_H6 / 67108864.0f * h * (1.0f + dig_H3 / 67108864.0f * h))); + h = h * (1.0f - dig_H1 * h / 524288.0f); + if (h > 100) { + h = 100; + } else if (h < 0) { + h = 0; + } + // println("DBG: Humidity = " + h); + return h; + } + + + private void readCalibrationData() { + // Reads the calibration data from the IC + dig_T1 = readU16LE(BME280_REGISTER_DIG_T1); + dig_T2 = readS16LE(BME280_REGISTER_DIG_T2); + dig_T3 = readS16LE(BME280_REGISTER_DIG_T3); + + dig_P1 = readU16LE(BME280_REGISTER_DIG_P1); + dig_P2 = readS16LE(BME280_REGISTER_DIG_P2); + dig_P3 = readS16LE(BME280_REGISTER_DIG_P3); + dig_P4 = readS16LE(BME280_REGISTER_DIG_P4); + dig_P5 = readS16LE(BME280_REGISTER_DIG_P5); + dig_P6 = readS16LE(BME280_REGISTER_DIG_P6); + dig_P7 = readS16LE(BME280_REGISTER_DIG_P7); + dig_P8 = readS16LE(BME280_REGISTER_DIG_P8); + dig_P9 = readS16LE(BME280_REGISTER_DIG_P9); + + dig_H1 = readU8(BME280_REGISTER_DIG_H1); + dig_H2 = readS16LE(BME280_REGISTER_DIG_H2); + dig_H3 = readU8(BME280_REGISTER_DIG_H3); + dig_H6 = readS8(BME280_REGISTER_DIG_H7); + + int h4 = readS8(BME280_REGISTER_DIG_H4); + h4 = (h4 << 24) >> 20; + dig_H4 = h4 | (readU8(BME280_REGISTER_DIG_H5) & 0x0F); + + int h5 = readS8(BME280_REGISTER_DIG_H6); + h5 = (h5 << 24) >> 20; + dig_H5 = h5 | (readU8(BME280_REGISTER_DIG_H5) >> 4 & 0x0F); + } + + private String displayRegister(int reg) { + return String.format("0x%s (%d)", lpad(Integer.toHexString(reg & 0xFFFF).toUpperCase(), 4, "0"), reg); + } + + private void showCalibrationData() { + // Displays the calibration values for debugging purposes + println("======================"); + println("DBG: T1 = " + displayRegister(dig_T1)); + println("DBG: T2 = " + displayRegister(dig_T2)); + println("DBG: T3 = " + displayRegister(dig_T3)); + println("----------------------"); + println("DBG: P1 = " + displayRegister(dig_P1)); + println("DBG: P2 = " + displayRegister(dig_P2)); + println("DBG: P3 = " + displayRegister(dig_P3)); + println("DBG: P4 = " + displayRegister(dig_P4)); + println("DBG: P5 = " + displayRegister(dig_P5)); + println("DBG: P6 = " + displayRegister(dig_P6)); + println("DBG: P7 = " + displayRegister(dig_P7)); + println("DBG: P8 = " + displayRegister(dig_P8)); + println("DBG: P9 = " + displayRegister(dig_P9)); + println("----------------------"); + println("DBG: H1 = " + displayRegister(dig_H1)); + println("DBG: H2 = " + displayRegister(dig_H2)); + println("DBG: H3 = " + displayRegister(dig_H3)); + println("DBG: H4 = " + displayRegister(dig_H4)); + println("DBG: H5 = " + displayRegister(dig_H5)); + println("DBG: H6 = " + displayRegister(dig_H6)); + println("======================"); + } + + private void command(int reg, byte val) { + super.beginTransmission(address); + super.write(reg); + super.write(val); + super.endTransmission(); + } + + private int readRawTemp() { + // Returns the raw (uncompensated) temperature + int meas = mode; + // println(String.format("readRawTemp: 1 - meas=%d", meas)); + command(BME280_REGISTER_CONTROL_HUM, (byte) meas); // HUM ? + meas = mode << 5 | mode << 2 | 1; + // println(String.format("readRawTemp: 2 - meas=%d", meas)); + command(BME280_REGISTER_CONTROL, (byte) meas); + + double sleepTime = 0.00125 + 0.0023 * (1 << mode); + sleepTime = sleepTime + 0.0023 * (1 << mode) + 0.000575; + sleepTime = sleepTime + 0.0023 * (1 << mode) + 0.000575; + delay((int)Math.round(sleepTime * 1000)); + int msb = readU8(BME280_REGISTER_TEMP_DATA); + int lsb = readU8(BME280_REGISTER_TEMP_DATA + 1); + int xlsb = readU8(BME280_REGISTER_TEMP_DATA + 2); + int raw = ((msb << 16) | (lsb << 8) | xlsb) >> 4; + // println("DBG: Raw Temp: " + (raw & 0xFFFF) + ", " + raw + String.format(", msb: 0x%04X lsb: 0x%04X xlsb: 0x%04X", msb, lsb, xlsb)); + return raw; + } + + private int readRawPressure() { + // Returns the raw (uncompensated) pressure + int msb = readU8(BME280_REGISTER_PRESSURE_DATA); + int lsb = readU8(BME280_REGISTER_PRESSURE_DATA + 1); + int xlsb = readU8(BME280_REGISTER_PRESSURE_DATA + 2); + int raw = ((msb << 16) | (lsb << 8) | xlsb) >> 4; + // println("DBG: Raw Press: " + (raw & 0xFFFF) + ", " + raw + String.format(", msb: 0x%04X lsb: 0x%04X xlsb: 0x%04X", msb, lsb, xlsb)); + return raw; + } + + private int readRawHumidity() { + // Returns the raw (uncompensated) humidity + int msb = readU8(BME280_REGISTER_HUMIDITY_DATA); + int lsb = readU8(BME280_REGISTER_HUMIDITY_DATA + 1); + int raw = (msb << 8) | lsb; + return raw; + } + + private int readU16LE(int register) { + super.beginTransmission(address); + super.write((byte)register); + byte[] ba = super.read(2); + super.endTransmission(); + return ((ba[1] & 0xFF) << 8) + (ba[0] & 0xFF); // Little Endian + } + + private int readS16LE(int register) { + super.beginTransmission(address); + super.write((byte)register); + byte[] ba = super.read(2); + super.endTransmission(); + + int lo = ba[0] & 0xFF; + int hi = ba[1] & 0xFF; + if (hi > 127) + hi -= 256; + return (hi << 8) + lo; // Little Endian + } + + private int readU8(int register) { + super.beginTransmission(address); + super.write(register); + byte[] ba = super.read(1); + super.endTransmission(); + return (int)(ba[0] & 0xFF); + } + + private int readS8(int register) { + int val = readU8(register); + if (val > 127) + val -= 256; + return val; + } + + private String rpad(String s, int len, String pad) { + String str = s; + while (str.length() < len) { + str += pad; + } + return str; + } + + private String lpad(String s, int len, String pad) { + String str = s; + while (str.length() < len) { + str = pad + str; + } + return str; + } +} diff --git a/java/libraries/io/examples/Environment_I2C_BME280/Environment_I2C_BME280.pde b/java/libraries/io/examples/Environment_I2C_BME280/Environment_I2C_BME280.pde new file mode 100644 index 0000000000..a5ec80602c --- /dev/null +++ b/java/libraries/io/examples/Environment_I2C_BME280/Environment_I2C_BME280.pde @@ -0,0 +1,29 @@ +import processing.io.*; +BME280 bme280; + +// see setup.png in the sketch folder for wiring details + +void setup() { + size(720, 320); + textSize(72); + + //printArray(I2C.list()); + bme280 = new BME280("i2c-1", 0x77); +} + +void draw() { + background(0); + stroke(255); + + bme280.update(); + float temp = bme280.temperature(); + float hum = bme280.humidity(); + float press = bme280.pressure(); + text(String.format("Temp: %.02f\272C", temp), 10, 75); + text(String.format("Hum: %.02f %%", hum), 10, 150); + text(String.format("Press: %.02f hPa", press / 100f), 10, 225); + + // pressure can be used to calculate the altitude like so + float alt = bme280.altitude(press, temp); + text(String.format("Alt: %.02f m", alt), 10, 300); +} diff --git a/java/libraries/io/examples/Environment_I2C_BME280/setup.png b/java/libraries/io/examples/Environment_I2C_BME280/setup.png new file mode 100644 index 0000000000..cb37a3a60e Binary files /dev/null and b/java/libraries/io/examples/Environment_I2C_BME280/setup.png differ diff --git a/java/libraries/io/examples/Interrupt/Interrupt.pde b/java/libraries/io/examples/Interrupt/Interrupt.pde new file mode 100644 index 0000000000..15bdc4cce1 --- /dev/null +++ b/java/libraries/io/examples/Interrupt/Interrupt.pde @@ -0,0 +1,25 @@ +import processing.io.*; +color bgcolor = 0; + +// GPIO numbers refer to different phyiscal pins on various boards +// On the Raspberry Pi GPIO 4 is physical pin 7 on the header +// see setup.png in the sketch folder for wiring details + +void setup() { + GPIO.pinMode(4, GPIO.INPUT); + GPIO.attachInterrupt(4, this, "pinEvent", GPIO.RISING); +} + +void draw() { + background(bgcolor); +} + +// this function will be called whenever GPIO 4 is brought from LOW to HIGH +void pinEvent(int pin) { + println("Received interrupt"); + if (bgcolor == 0) { + bgcolor = color(255); + } else { + bgcolor = color(0); + } +} diff --git a/java/libraries/io/examples/Interrupt/setup.png b/java/libraries/io/examples/Interrupt/setup.png new file mode 100644 index 0000000000..eb0a0039d2 Binary files /dev/null and b/java/libraries/io/examples/Interrupt/setup.png differ diff --git a/java/libraries/io/examples/LedCounter/LedCounter.pde b/java/libraries/io/examples/LedCounter/LedCounter.pde new file mode 100644 index 0000000000..3cd440b195 --- /dev/null +++ b/java/libraries/io/examples/LedCounter/LedCounter.pde @@ -0,0 +1,39 @@ +import processing.io.*; +LED leds[]; + +// the Raspberry Pi has two build-in LEDs we can control +// led0 (green) and led1 (red) + +void setup() { + String available[] = LED.list(); + print("Available: "); + println(available); + + // create an object for each LED and store it in an array + leds = new LED[available.length]; + for (int i=0; i < available.length; i++) { + leds[i] = new LED(available[i]); + } + + frameRate(1); +} + +void draw() { + // make the LEDs count in binary + for (int i=0; i < leds.length; i++) { + if ((frameCount & (1 << i)) != 0) { + leds[i].brightness(1.0); + } else { + leds[i].brightness(0.0); + } + } + println(frameCount); +} + +void keyPressed() { + // cleanup + for (int i=0; i < leds.length; i++) { + leds[i].close(); + } + exit(); +} diff --git a/java/libraries/io/examples/Light_I2C_TSL2561/Light_I2C_TSL2561.pde b/java/libraries/io/examples/Light_I2C_TSL2561/Light_I2C_TSL2561.pde new file mode 100644 index 0000000000..c6c9a28ec7 --- /dev/null +++ b/java/libraries/io/examples/Light_I2C_TSL2561/Light_I2C_TSL2561.pde @@ -0,0 +1,27 @@ +import processing.io.*; +TSL2561 sensor; + +// see setup.png in the sketch folder for wiring details + +// this variable will contain the measured brightness +// Lux (lx) is the unit of illuminance +float lux; + +void setup() { + size(700, 100); + textSize(72); + //printArray(I2C.list()); + sensor = new TSL2561("i2c-1", 0x39); +} + +void draw() { + background(0); + stroke(255); + lux = sensor.lux(); + text(String.format("Light: %.02f Lux", lux), 10, 75); +} + +void dispose() { + // turn the sensor off + sensor.stop(); +} diff --git a/java/libraries/io/examples/Light_I2C_TSL2561/TSL2561.pde b/java/libraries/io/examples/Light_I2C_TSL2561/TSL2561.pde new file mode 100644 index 0000000000..775b9d02ca --- /dev/null +++ b/java/libraries/io/examples/Light_I2C_TSL2561/TSL2561.pde @@ -0,0 +1,187 @@ +import processing.io.I2C; + +// TSL2561 is light sensor using I2C +// datasheet: https://cdn-shop.adafruit.com/datasheets/TSL2561.pdf +// code contributed by @OlivierLD + +public class TSL2561 extends I2C { + + public final static int TSL2561_ADDRESS = 0x39; + + public final static int TSL2561_ADDRESS_LOW = 0x29; + public final static int TSL2561_ADDRESS_FLOAT = 0x39; + public final static int TSL2561_ADDRESS_HIGH = 0x49; + + public final static int TSL2561_COMMAND_BIT = 0x80; + public final static int TSL2561_WORD_BIT = 0x20; + public final static int TSL2561_CONTROL_POWERON = 0x03; + public final static int TSL2561_CONTROL_POWEROFF = 0x00; + + public final static int TSL2561_REGISTER_CONTROL = 0x00; + public final static int TSL2561_REGISTER_TIMING = 0x01; + public final static int TSL2561_REGISTER_CHAN0_LOW = 0x0C; + public final static int TSL2561_REGISTER_CHAN0_HIGH = 0x0D; + public final static int TSL2561_REGISTER_CHAN1_LOW = 0x0E; + public final static int TSL2561_REGISTER_CHAN1_HIGH = 0x0F; + public final static int TSL2561_REGISTER_ID = 0x0A; + + public final static int TSL2561_GAIN_1X = 0x00; + public final static int TSL2561_GAIN_16X = 0x10; + + public final static int TSL2561_INTEGRATIONTIME_13MS = 0x00; // rather 13.7ms + public final static int TSL2561_INTEGRATIONTIME_101MS = 0x01; + public final static int TSL2561_INTEGRATIONTIME_402MS = 0x02; + + public final static double TSL2561_LUX_K1C = 0.130; // (0x0043) // 0.130 * 2^RATIO_SCALE + public final static double TSL2561_LUX_B1C = 0.0315; // (0x0204) // 0.0315 * 2^LUX_SCALE + public final static double TSL2561_LUX_M1C = 0.0262; // (0x01ad) // 0.0262 * 2^LUX_SCALE + public final static double TSL2561_LUX_K2C = 0.260; // (0x0085) // 0.260 * 2^RATIO_SCALE + public final static double TSL2561_LUX_B2C = 0.0337; // (0x0228) // 0.0337 * 2^LUX_SCALE + public final static double TSL2561_LUX_M2C = 0.0430; // (0x02c1) // 0.0430 * 2^LUX_SCALE + public final static double TSL2561_LUX_K3C = 0.390; // (0x00c8) // 0.390 * 2^RATIO_SCALE + public final static double TSL2561_LUX_B3C = 0.0363; // (0x0253) // 0.0363 * 2^LUX_SCALE + public final static double TSL2561_LUX_M3C = 0.0529; // (0x0363) // 0.0529 * 2^LUX_SCALE + public final static double TSL2561_LUX_K4C = 0.520; // (0x010a) // 0.520 * 2^RATIO_SCALE + public final static double TSL2561_LUX_B4C = 0.0392; // (0x0282) // 0.0392 * 2^LUX_SCALE + public final static double TSL2561_LUX_M4C = 0.0605; // (0x03df) // 0.0605 * 2^LUX_SCALE + public final static double TSL2561_LUX_K5C = 0.65; // (0x014d) // 0.65 * 2^RATIO_SCALE + public final static double TSL2561_LUX_B5C = 0.0229; // (0x0177) // 0.0229 * 2^LUX_SCALE + public final static double TSL2561_LUX_M5C = 0.0291; // (0x01dd) // 0.0291 * 2^LUX_SCALE + public final static double TSL2561_LUX_K6C = 0.80; // (0x019a) // 0.80 * 2^RATIO_SCALE + public final static double TSL2561_LUX_B6C = 0.0157; // (0x0101) // 0.0157 * 2^LUX_SCALE + public final static double TSL2561_LUX_M6C = 0.0180; // (0x0127) // 0.0180 * 2^LUX_SCALE + public final static double TSL2561_LUX_K7C = 1.3; // (0x029a) // 1.3 * 2^RATIO_SCALE + public final static double TSL2561_LUX_B7C = 0.00338; // (0x0037) // 0.00338 * 2^LUX_SCALE + public final static double TSL2561_LUX_M7C = 0.00260; // (0x002b) // 0.00260 * 2^LUX_SCALE + public final static double TSL2561_LUX_K8C = 1.3; // (0x029a) // 1.3 * 2^RATIO_SCALE + public final static double TSL2561_LUX_B8C = 0.000; // (0x0000) // 0.000 * 2^LUX_SCALE + public final static double TSL2561_LUX_M8C = 0.000; // (0x0000) // 0.000 * 2^LUX_SCALE + + private int gain = TSL2561_GAIN_1X; + private int integration = TSL2561_INTEGRATIONTIME_402MS; + private int pause = 800; + + private int address; + + + public TSL2561(String dev) { + this(dev, TSL2561_ADDRESS); + } + + public TSL2561(String dev, int address) { + super(dev); + this.address = address; + start(); + } + + public void start() { + command(TSL2561_COMMAND_BIT, (byte) TSL2561_CONTROL_POWERON); + } + + public void stop() { + command(TSL2561_COMMAND_BIT, (byte) TSL2561_CONTROL_POWEROFF); + } + + public void setGain() { + setGain(TSL2561_GAIN_1X); + } + + public void setGain(int gain) { + setGain(gain, TSL2561_INTEGRATIONTIME_402MS); + } + + public void setGain(int gain, int integration) { + if (gain != TSL2561_GAIN_1X && gain != TSL2561_GAIN_16X) { + throw new IllegalArgumentException("Invalid gain value"); + } + if (gain != this.gain || integration != this.integration) { + command(TSL2561_COMMAND_BIT | TSL2561_REGISTER_TIMING, (byte) (gain | integration)); + //println("Setting low gain"); + this.gain = gain; + this.integration = integration; + delay(pause); // pause for integration (pause must be bigger than integration time) + } + } + + /** + * Read visible+IR diode from the I2C device + */ + public int readFull() { + int reg = TSL2561_COMMAND_BIT | TSL2561_REGISTER_CHAN0_LOW; + return readU16(reg); + } + + /** + * Read IR only diode from the I2C device + */ + public int readIR() { + int reg = TSL2561_COMMAND_BIT | TSL2561_REGISTER_CHAN1_LOW; + return readU16(reg); + } + + /** + * Device lux range 0.1 - 40,000+ + * see https://learn.adafruit.com/tsl2561/overview + */ + public float lux() { + int ambient = this.readFull(); + int ir = this.readIR(); + + //println("IR Result: " + ir); + //println("Ambient Result: " + ambient); + + if (ambient >= 0xffff || ir >= 0xffff) { + throw new RuntimeException("Gain too high, values exceed range"); + } + double ratio = (ir / (float) ambient); + + /* + * For the values below, see https://github.com/adafruit/_TSL2561/blob/master/_TSL2561_U.h + */ + float lux = 0.0f; + if ((ratio >= 0) && (ratio <= TSL2561_LUX_K4C)) { + lux = (float)((TSL2561_LUX_B1C * ambient) - (0.0593 * ambient * (Math.pow(ratio, 1.4)))); + } else if (ratio <= TSL2561_LUX_K5C) { + lux = (float)((TSL2561_LUX_B5C * ambient) - (TSL2561_LUX_M5C * ir)); + } else if (ratio <= TSL2561_LUX_K6C) { + lux = (float)((TSL2561_LUX_B6C * ambient) - (TSL2561_LUX_M6C * ir)); + } else if (ratio <= TSL2561_LUX_K7C) { + lux = (float)((TSL2561_LUX_B7C * ambient) - (TSL2561_LUX_M7C * ir)); + } else if (ratio > TSL2561_LUX_K8C) { + lux = 0.0f; + } + return lux; + } + + + private void command(int register, byte value) { + beginTransmission(address); + write(register); + write(value); + endTransmission(); + } + + private int readU8(int register) { + beginTransmission(this.address); + write(register); + byte[] ba = read(1); + endTransmission(); + return (int)(ba[0] & 0xFF); + } + + private int readU16(int register) { + int lo = readU8(register); + int hi = readU8(register + 1); + int result = (hi << 8) + lo; // Big Endian + //println("(U16) I2C: Device " + toHex(TSL2561_ADDRESS) + " returned " + toHex(result) + " from reg " + toHex(register)); + return result; + } + + private String toHex(int i) { + String s = Integer.toString(i, 16).toUpperCase(); + while (s.length() % 2 != 0) { + s = "0" + s; + } + return "0x" + s; + } +} diff --git a/java/libraries/io/examples/Light_I2C_TSL2561/setup.png b/java/libraries/io/examples/Light_I2C_TSL2561/setup.png new file mode 100644 index 0000000000..a0b33fefbe Binary files /dev/null and b/java/libraries/io/examples/Light_I2C_TSL2561/setup.png differ diff --git a/java/libraries/io/examples/Servo_I2C_PCA9685/PCA9685.pde b/java/libraries/io/examples/Servo_I2C_PCA9685/PCA9685.pde new file mode 100644 index 0000000000..67ea815a4f --- /dev/null +++ b/java/libraries/io/examples/Servo_I2C_PCA9685/PCA9685.pde @@ -0,0 +1,148 @@ +import processing.io.I2C; + +// PCA9685 is a 16-channel servo/PWM driver +// datasheet: https://cdn-shop.adafruit.com/datasheets/PCA9685.pdf +// code contributed by @OlivierLD + +public class PCA9685 extends I2C { + public final static int PCA9685_ADDRESS = 0x40; + + // registers used + public final static int MODE1 = 0x00; + public final static int PRESCALE = 0xFE; + public final static int LED0_ON_L = 0x06; + public final static int LED0_ON_H = 0x07; + public final static int LED0_OFF_L = 0x08; + public final static int LED0_OFF_H = 0x09; + + private int address; + private int freq = 200; // 200 Hz default frequency (after power-up) + private boolean hasFreqSet = false; // whether a different frequency has been set + private int minPulses[] = new int[16]; + private int maxPulses[] = new int[16]; + + + public PCA9685(String dev) { + this(dev, PCA9685_ADDRESS); + } + public PCA9685(String dev, int address) { + super(dev); + this.address = address; + // reset device + command(MODE1, (byte) 0x00); + } + + + public void attach(int channel) { + // same as on Arduino + attach(channel, 544, 2400); + } + + public void attach(int channel, int minPulse, int maxPulse) { + if (channel < 0 || 15 < channel) { + throw new IllegalArgumentException("Channel must be between 0 and 15"); + } + minPulses[channel] = minPulse; + maxPulses[channel] = maxPulse; + + // set the PWM frequency to be the same as on Arduino + if (!hasFreqSet) { + frequency(50); + } + } + + public void write(int channel, float angle) { + if (channel < 0 || 15 < channel) { + throw new IllegalArgumentException("Channel must be between 0 and 15"); + } + if (angle < 0 || 180 < angle) { + throw new IllegalArgumentException("Angle must be between 0 and 180"); + } + int us = (int)(minPulses[channel] + (angle/180.0) * (maxPulses[channel]-minPulses[channel])); + + double pulseLength = 1000000; // 1s = 1,000,000 us per pulse + pulseLength /= freq; // 40..1000 Hz + pulseLength /= 4096; // 12 bits of resolution + int pulse = us; + pulse /= pulseLength; + // println(pulseLength + " us per bit, pulse:" + pulse); + pwm(channel, 0, pulse); + } + + public boolean attached(int channel) { + if (channel < 0 || 15 < channel) { + return false; + } + return (maxPulses[channel] != 0) ? true : false; + } + + public void detach(int channel) { + pwm(channel, 0, 0); + minPulses[channel] = 0; + maxPulses[channel] = 0; + } + + + /** + * @param freq 40..1000 Hz + */ + public void frequency(int freq) { + this.freq = freq; + float preScaleVal = 25000000.0f; // 25MHz + preScaleVal /= 4096.0; // 4096: 12-bit + preScaleVal /= freq; + preScaleVal -= 1.0; + // println("Setting PWM frequency to " + freq + " Hz"); + // println("Estimated pre-scale: " + preScaleVal); + double preScale = Math.floor(preScaleVal + 0.5); + // println("Final pre-scale: " + preScale); + byte oldmode = (byte) readU8(MODE1); + byte newmode = (byte) ((oldmode & 0x7F) | 0x10); // sleep + command(MODE1, newmode); // go to sleep + command(PRESCALE, (byte) (Math.floor(preScale))); + command(MODE1, oldmode); + delay(5); + command(MODE1, (byte) (oldmode | 0x80)); + hasFreqSet = true; + } + + /** + * @param channel 0..15 + * @param on cycle offset to turn output on (0..4095) + * @param off cycle offset to turn output off again (0..4095) + */ + public void pwm(int channel, int on, int off) { + if (channel < 0 || 15 < channel) { + throw new IllegalArgumentException("Channel must be between 0 and 15"); + } + if (on < 0 || 4095 < on) { + throw new IllegalArgumentException("On must be between 0 and 4095"); + } + if (off < 0 || 4095 < off) { + throw new IllegalArgumentException("Off must be between 0 and 4095"); + } + if (off < on) { + throw new IllegalArgumentException("Off must be greater than On"); + } + command(LED0_ON_L + 4 * channel, (byte) (on & 0xFF)); + command(LED0_ON_H + 4 * channel, (byte) (on >> 8)); + command(LED0_OFF_L + 4 * channel, (byte) (off & 0xFF)); + command(LED0_OFF_H + 4 * channel, (byte) (off >> 8)); + } + + + private void command(int register, byte value) { + beginTransmission(address); + write(register); + write(value); + endTransmission(); + } + + private byte readU8(int register) { + beginTransmission(address); + write(register); + byte[] ba = read(1); + endTransmission(); + return (byte)(ba[0] & 0xFF); + } +} diff --git a/java/libraries/io/examples/Servo_I2C_PCA9685/Servo_I2C_PCA9685.pde b/java/libraries/io/examples/Servo_I2C_PCA9685/Servo_I2C_PCA9685.pde new file mode 100644 index 0000000000..ede995bc5e --- /dev/null +++ b/java/libraries/io/examples/Servo_I2C_PCA9685/Servo_I2C_PCA9685.pde @@ -0,0 +1,41 @@ +import processing.io.*; +PCA9685 servos; + +// see setup.png in the sketch folder for wiring details + +void setup() { + size(400, 300); + //printArray(I2C.list()); + servos = new PCA9685("i2c-1", 0x40); + + // different servo motors will vary in the pulse width they expect + // the lines below set the pulse width for 0 degrees to 544 microseconds (μs) + // and the pulse width for 180 degrees to 2400 microseconds + // these values match the defaults of the Servo library on Arduino + // but you might need to modify this for your particular servo still + servos.attach(0, 544, 2400); + servos.attach(1, 544, 2400); +} + +void draw() { + background(0); + stroke(255); + strokeWeight(3); + + // we don't go right to the edge to prevent + // making the servo unhappy + float angle = 90 + sin(frameCount / 100.0)*85; + servos.write(0, angle); + float y = map(angle, 0, 180, 0, height); + line(0, y, width/2, y); + + angle = 90 + cos(frameCount / 100.0)*85; + servos.write(1, 90 + cos(frameCount / 100.0)*85); + y = map(angle, 0, 180, 0, height); + line(width/2, y, width, y); +} + +void dispose() { + servos.detach(0); + servos.detach(1); +} diff --git a/java/libraries/io/examples/Servo_I2C_PCA9685/setup.png b/java/libraries/io/examples/Servo_I2C_PCA9685/setup.png new file mode 100644 index 0000000000..77b0b74bf0 Binary files /dev/null and b/java/libraries/io/examples/Servo_I2C_PCA9685/setup.png differ diff --git a/java/libraries/io/examples/SimpleI2C/SimpleI2C.pde b/java/libraries/io/examples/SimpleI2C/SimpleI2C.pde new file mode 100644 index 0000000000..75a5bacccf --- /dev/null +++ b/java/libraries/io/examples/SimpleI2C/SimpleI2C.pde @@ -0,0 +1,30 @@ +import processing.io.*; +I2C i2c; + +// MCP4725 is a Digital-to-Analog converter using I2C +// datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/22039d.pdf + +// also see DigitalAnalog_I2C_MCP4725 for how to write the +// same sketch in an object-oriented way + +void setup() { + //printArray(I2C.list()); + i2c = new I2C(I2C.list()[0]); +} + +void draw() { + background(map(mouseX, 0, width, 0, 255)); + setAnalog(map(mouseX, 0, width, 0.0, 1.0)); +} + +// outputs voltages from 0V to the supply voltage +// (works with 3.3V and 5V) +void setAnalog(float fac) { + fac = constrain(fac, 0.0, 1.0); + // convert to 12 bit value + int val = int(4095 * fac); + i2c.beginTransmission(0x60); + i2c.write(val >> 8); + i2c.write(val & 255); + i2c.endTransmission(); +} diff --git a/java/libraries/io/examples/SimpleInput/SimpleInput.pde b/java/libraries/io/examples/SimpleInput/SimpleInput.pde new file mode 100644 index 0000000000..5b6f5687a6 --- /dev/null +++ b/java/libraries/io/examples/SimpleInput/SimpleInput.pde @@ -0,0 +1,24 @@ +import processing.io.*; + +// GPIO numbers refer to different phyiscal pins on various boards +// On the Raspberry Pi GPIO 4 is physical pin 7 on the header +// see setup.png in the sketch folder for wiring details + +void setup() { + // INPUT_PULLUP enables the built-in pull-up resistor for this pin + // left alone, the pin will read as HIGH + // connected to ground (via e.g. a button or switch) it will read LOW + GPIO.pinMode(4, GPIO.INPUT_PULLUP); +} + +void draw() { + if (GPIO.digitalRead(4) == GPIO.LOW) { + // button is pressed + fill(255); + } else { + // button is not pressed + fill(204); + } + stroke(255); + ellipse(width/2, height/2, width*0.75, height*0.75); +} diff --git a/java/libraries/io/examples/SimpleInput/setup.png b/java/libraries/io/examples/SimpleInput/setup.png new file mode 100644 index 0000000000..eb0a0039d2 Binary files /dev/null and b/java/libraries/io/examples/SimpleInput/setup.png differ diff --git a/java/libraries/io/examples/SimpleOutput/SimpleOutput.pde b/java/libraries/io/examples/SimpleOutput/SimpleOutput.pde new file mode 100644 index 0000000000..af5e05d05a --- /dev/null +++ b/java/libraries/io/examples/SimpleOutput/SimpleOutput.pde @@ -0,0 +1,25 @@ +import processing.io.*; +boolean ledOn = false; + +// GPIO numbers refer to different phyiscal pins on various boards +// On the Raspberry Pi GPIO 4 is physical pin 7 on the header +// see setup.png in the sketch folder for wiring details + +void setup() { + GPIO.pinMode(4, GPIO.OUTPUT); + frameRate(0.5); +} + +void draw() { + // make the LED blink + ledOn = !ledOn; + if (ledOn) { + GPIO.digitalWrite(4, GPIO.LOW); + fill(204); + } else { + GPIO.digitalWrite(4, GPIO.HIGH); + fill(255); + } + stroke(255); + ellipse(width/2, height/2, width*0.75, height*0.75); +} diff --git a/java/libraries/io/examples/SimpleOutput/setup.png b/java/libraries/io/examples/SimpleOutput/setup.png new file mode 100644 index 0000000000..8438aba843 Binary files /dev/null and b/java/libraries/io/examples/SimpleOutput/setup.png differ diff --git a/java/libraries/io/examples/SimpleResistorSensor/SimpleResistorSensor.pde b/java/libraries/io/examples/SimpleResistorSensor/SimpleResistorSensor.pde new file mode 100644 index 0000000000..874b699e92 --- /dev/null +++ b/java/libraries/io/examples/SimpleResistorSensor/SimpleResistorSensor.pde @@ -0,0 +1,56 @@ +import processing.io.*; + +// using a capacitor that gets charged and discharged, while +// measuring the time it takes, is an inexpensive way to +// read the value of an (analog) resistive sensor, such as +// a photocell +// kudos to ladyada for the original tutorial + +// see setup.png in the sketch folder for wiring details + +int max = 0; +int min = 9999; + +void setup() { +} + +void draw() { + int val = sensorRead(4); + println(val); + + // track largest and smallest reading, to get a sense + // how we compare + if (max < val) { + max = val; + } + if (val < min) { + min = val; + } + + // convert current reading into a number between 0.0 and 1.0 + float frac = map(val, min, max, 0.0, 1.0); + + background(255 * frac); +} + +int sensorRead(int pin) { + // discharge the capacitor + GPIO.pinMode(pin, GPIO.OUTPUT); + GPIO.digitalWrite(pin, GPIO.LOW); + delay(100); + // now the capacitor should be empty + + // measure the time takes to fill it + // up to ~ 1.4V again + GPIO.pinMode(pin, GPIO.INPUT); + int start = millis(); + while (GPIO.digitalRead(pin) == GPIO.LOW) { + // wait + } + + // return the time elapsed + // this will vary based on the value of the + // resistive sensor (lower resistance will + // make the capacitor charge faster) + return millis() - start; +} diff --git a/java/libraries/io/examples/SimpleResistorSensor/setup.png b/java/libraries/io/examples/SimpleResistorSensor/setup.png new file mode 100644 index 0000000000..bcad94501f Binary files /dev/null and b/java/libraries/io/examples/SimpleResistorSensor/setup.png differ diff --git a/java/libraries/io/examples/SimpleSPI/SimpleSPI.pde b/java/libraries/io/examples/SimpleSPI/SimpleSPI.pde new file mode 100644 index 0000000000..a1b4e2b08d --- /dev/null +++ b/java/libraries/io/examples/SimpleSPI/SimpleSPI.pde @@ -0,0 +1,25 @@ +import processing.io.*; +SPI spi; + +// MCP3001 is a Analog-to-Digital converter using SPI +// datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/21293C.pdf +// see setup.png in the sketch folder for wiring details + +// also see AnalogDigital_SPI_MCP3001 for how to write the +// same sketch in an object-oriented way + +void setup() { + //printArray(SPI.list()); + spi = new SPI(SPI.list()[0]); + spi.settings(500000, SPI.MSBFIRST, SPI.MODE0); +} + +void draw() { + // dummy write, actual values don't matter + byte[] out = { 0, 0 }; + byte[] in = spi.transfer(out); + // some input bit shifting according to the datasheet p. 16 + int val = ((in[0] & 0x1f) << 5) | ((in[1] & 0xf8) >> 3); + // val is between 0 and 1023 + background(map(val, 0, 1023, 0, 255)); +} diff --git a/java/libraries/io/examples/SimpleSPI/setup.png b/java/libraries/io/examples/SimpleSPI/setup.png new file mode 100644 index 0000000000..c52f67ffe3 Binary files /dev/null and b/java/libraries/io/examples/SimpleSPI/setup.png differ diff --git a/java/libraries/io/examples/SoftwareServoSweep/SoftwareServoSweep.pde b/java/libraries/io/examples/SoftwareServoSweep/SoftwareServoSweep.pde new file mode 100644 index 0000000000..a09d52ab1b --- /dev/null +++ b/java/libraries/io/examples/SoftwareServoSweep/SoftwareServoSweep.pde @@ -0,0 +1,34 @@ +import processing.io.*; + +// see setup.png in the sketch folder for wiring details +// for more reliable operation it is recommended to power +// the servo from an external power source, see setup_better.png + +SoftwareServo servo1; +SoftwareServo servo2; + +void setup() { + size(400, 300); + servo1 = new SoftwareServo(this); + servo1.attach(17); + servo2 = new SoftwareServo(this); + servo2.attach(4); +} + +void draw() { + background(0); + stroke(255); + strokeWeight(3); + + // we don't go right to the edge to prevent + // making the servo unhappy + float angle = 90 + sin(frameCount / 100.0)*85; + servo1.write(angle); + float y = map(angle, 0, 180, 0, height); + line(0, y, width/2, y); + + angle = 90 + cos(frameCount / 100.0)*85; + servo2.write(90 + cos(frameCount / 100.0)*85); + y = map(angle, 0, 180, 0, height); + line(width/2, y, width, y); +} diff --git a/java/libraries/io/examples/SoftwareServoSweep/setup.png b/java/libraries/io/examples/SoftwareServoSweep/setup.png new file mode 100644 index 0000000000..2370f37575 Binary files /dev/null and b/java/libraries/io/examples/SoftwareServoSweep/setup.png differ diff --git a/java/libraries/io/examples/SoftwareServoSweep/setup_better.png b/java/libraries/io/examples/SoftwareServoSweep/setup_better.png new file mode 100644 index 0000000000..7931e0db2b Binary files /dev/null and b/java/libraries/io/examples/SoftwareServoSweep/setup_better.png differ diff --git a/java/libraries/io/examples/Touch_I2C_MPR121/MPR121.pde b/java/libraries/io/examples/Touch_I2C_MPR121/MPR121.pde new file mode 100644 index 0000000000..0ef023820b --- /dev/null +++ b/java/libraries/io/examples/Touch_I2C_MPR121/MPR121.pde @@ -0,0 +1,112 @@ +import processing.io.I2C; + +// MPR121 is a capacitive-touch sensor controller with 12 channels +// datasheet: https://www.nxp.com/docs/en/data-sheet/MPR121.pdf + +class MPR121 extends I2C { + int address; + int touched; + + // registers used (there are more) + static final int EFD0LB = 0x04; // ELE0 Electrode Filtered Data LSB + static final int E0TTH = 0x41; // ELE0 Touch Threshold + static final int E0RTH = 0x42; // ELE0 Release Threshold + static final int E0BV = 0x1e; // ELE0 Baseline Value + static final int MHDR = 0x2b; // MHD Rising + static final int NHDR = 0x2c; // NHD Amount Rising + static final int NCLR = 0x2d; // NCL Rising + static final int MHDF = 0x2f; // MHD Falling + static final int NHDF = 0x30; // NHD Amount Falling + static final int NCLF = 0x31; // NCL Falling + static final int CDT = 0x5d; // Filter/Global CDT Configuration + static final int ECR = 0x5e; // Electrode Configuration + static final int SRST = 0x80; // Soft Reset + + // there can be more than one device connected to the bus + // as long as they have different addresses + // possible addresses: 0x5a (default) - 0x5d + MPR121(String dev, int address) { + super(dev); + this.address = address; + reset(); + } + + void update() { + beginTransmission(address); + write(0x00); + byte[] in = read(2); + // & 0xff makes sure the byte is not interpreted as a negative value + touched = (in[1] & 0xff) << 8 | (in[0] & 0xff); + } + + boolean touched(int channel) { + if (channel < 0 || 11 < channel) { + return false; + } + if ((touched & (1 << channel)) != 0) { + return true; + } else { + return false; + } + } + + void threshold(int touch, int release) { + for (int i=0; i < 12; i++) { + threshold(touch, release, i); + } + } + + void threshold(int touch, int release, int channel) { + if (channel < 0 || 11 < channel) { + return; + } + touch = constrain(touch, 0, 255); + release = constrain(release, 0, 255); + writeRegister(E0TTH + 2*channel, touch); + writeRegister(E0RTH + 2*channel, release); + } + + int analogRead(int channel) { + if (channel < 0 || 11 < channel) { + return 0; + } + beginTransmission(address); + write(EFD0LB + 2*channel); + byte[] in = read(2); + return (in[1] & 0xff) << 8 | (in[0] & 0xff); + } + + int analogReadBaseline(int channel) { + if (channel < 0 || 11 < channel) { + return 0; + } + beginTransmission(address); + write(E0BV + channel); + byte[] in = read(1); + return (in[0] & 0xff) << 2; + } + + void reset() { + writeRegister(SRST, 0x63); + delay(1); + threshold(12, 6); + // set baseline filtering control registers (see p. 12) + writeRegister(MHDR, 0x01); + writeRegister(NHDR, 0x01); + writeRegister(NCLR, 0x0e); + writeRegister(MHDF, 0x01); + writeRegister(NHDF, 0x05); + writeRegister(NCLF, 0x01); + // change sample interval to 1ms period from default 16ms + writeRegister(CDT, 0x20); + // start sampling + writeRegister(ECR, 0x8f); + } + + void writeRegister(int register, int value) { + beginTransmission(address); + write(register); + write(value); + endTransmission(); + } +} diff --git a/java/libraries/io/examples/Touch_I2C_MPR121/Touch_I2C_MPR121.pde b/java/libraries/io/examples/Touch_I2C_MPR121/Touch_I2C_MPR121.pde new file mode 100644 index 0000000000..58f69ad1c1 --- /dev/null +++ b/java/libraries/io/examples/Touch_I2C_MPR121/Touch_I2C_MPR121.pde @@ -0,0 +1,26 @@ +import processing.io.*; +MPR121 touch; + +// see setup.png in the sketch folder for wiring details + +void setup() { + size(600, 200); + //printArray(I2C.list()); + touch = new MPR121("i2c-1", 0x5a); +} + +void draw() { + background(204); + noStroke(); + + touch.update(); + + for (int i=0; i < 12; i++) { + if (touch.touched(i)) { + fill(255, 0, 0); + } else { + fill(255, 255, 255); + } + ellipse((width/12) * (i+0.5), height/2, 20, 20); + } +} diff --git a/java/libraries/io/examples/Touch_I2C_MPR121/setup.png b/java/libraries/io/examples/Touch_I2C_MPR121/setup.png new file mode 100644 index 0000000000..65bb7a04b2 Binary files /dev/null and b/java/libraries/io/examples/Touch_I2C_MPR121/setup.png differ diff --git a/java/libraries/io/library.properties b/java/libraries/io/library.properties new file mode 100644 index 0000000000..519c34193f --- /dev/null +++ b/java/libraries/io/library.properties @@ -0,0 +1,9 @@ +name = Hardware I/O +authors = The Processing Foundation +url = http://processing.org/reference/libraries/io/index.html +categories = Hardware +sentence = Access peripherals on the Raspberry Pi and other Linux-based computers. +paragraph = For other platforms, this is solely provided in order to build and export sketches that require processing.io. +version = 1 +prettyVersion = 1 +minRevision = 247 diff --git a/java/libraries/io/library/export.txt b/java/libraries/io/library/export.txt new file mode 100644 index 0000000000..4626bbfb3f --- /dev/null +++ b/java/libraries/io/library/export.txt @@ -0,0 +1 @@ +name = Hardware I/O for Raspberry Pi and other Linux-based computers diff --git a/java/libraries/io/library/linux-arm64/libprocessing-io.so b/java/libraries/io/library/linux-arm64/libprocessing-io.so new file mode 100755 index 0000000000..9659c68af3 Binary files /dev/null and b/java/libraries/io/library/linux-arm64/libprocessing-io.so differ diff --git a/java/libraries/io/library/linux-armv6hf/libprocessing-io.so b/java/libraries/io/library/linux-armv6hf/libprocessing-io.so new file mode 100755 index 0000000000..9d272c4d86 Binary files /dev/null and b/java/libraries/io/library/linux-armv6hf/libprocessing-io.so differ diff --git a/java/libraries/io/library/linux32/libprocessing-io.so b/java/libraries/io/library/linux32/libprocessing-io.so new file mode 100755 index 0000000000..acc2bd6032 Binary files /dev/null and b/java/libraries/io/library/linux32/libprocessing-io.so differ diff --git a/java/libraries/io/library/linux64/libprocessing-io.so b/java/libraries/io/library/linux64/libprocessing-io.so new file mode 100755 index 0000000000..4c2d715886 Binary files /dev/null and b/java/libraries/io/library/linux64/libprocessing-io.so differ diff --git a/java/libraries/io/src/native/Makefile b/java/libraries/io/src/native/Makefile new file mode 100644 index 0000000000..6a2c003738 --- /dev/null +++ b/java/libraries/io/src/native/Makefile @@ -0,0 +1,20 @@ +TARGET := libprocessing-io.so +OBJS := impl.o +CC := gcc + +# prefix with -m32 to compile for linux32 +CFLAGS := -std=gnu99 -fPIC -g -ffast-math +CFLAGS += -I$(shell dirname $(shell realpath $(shell which javac)))/../include +CFLAGS += -I$(shell dirname $(shell realpath $(shell which javac)))/../include/linux +LDFLAGS := -shared + +$(TARGET): $(OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ + +iface.h: + javah -classpath .. -o iface.h processing.io.NativeInterface + +clean: + rm -f $(TARGET) $(OBJS) + +.PHONY: iface.h clean diff --git a/java/libraries/io/src/native/iface.h b/java/libraries/io/src/native/iface.h new file mode 100644 index 0000000000..74decc1852 --- /dev/null +++ b/java/libraries/io/src/native/iface.h @@ -0,0 +1,133 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class processing_io_NativeInterface */ + +#ifndef _Included_processing_io_NativeInterface +#define _Included_processing_io_NativeInterface +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: processing_io_NativeInterface + * Method: openDevice + * Signature: (Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_openDevice + (JNIEnv *, jclass, jstring); + +/* + * Class: processing_io_NativeInterface + * Method: getError + * Signature: (I)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_processing_io_NativeInterface_getError + (JNIEnv *, jclass, jint); + +/* + * Class: processing_io_NativeInterface + * Method: closeDevice + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_closeDevice + (JNIEnv *, jclass, jint); + +/* + * Class: processing_io_NativeInterface + * Method: readFile + * Signature: (Ljava/lang/String;[B)I + */ +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_readFile + (JNIEnv *, jclass, jstring, jbyteArray); + +/* + * Class: processing_io_NativeInterface + * Method: writeFile + * Signature: (Ljava/lang/String;[B)I + */ +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_writeFile + (JNIEnv *, jclass, jstring, jbyteArray); + +/* + * Class: processing_io_NativeInterface + * Method: raspbianGpioMemRead + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_raspbianGpioMemRead + (JNIEnv *, jclass, jint); + +/* + * Class: processing_io_NativeInterface + * Method: raspbianGpioMemWrite + * Signature: (III)I + */ +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_raspbianGpioMemWrite + (JNIEnv *, jclass, jint, jint, jint); + +/* + * Class: processing_io_NativeInterface + * Method: raspbianGpioMemWrite + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_raspbianGpioMemSetPinBias + (JNIEnv *, jclass, jint, jint); + +/* + * Class: processing_io_NativeInterface + * Method: pollDevice + * Signature: (Ljava/lang/String;I)I + */ +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_pollDevice + (JNIEnv *, jclass, jstring, jint); + +/* + * Class: processing_io_NativeInterface + * Method: transferI2c + * Signature: (II[B[B)I + */ +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_transferI2c + (JNIEnv *, jclass, jint, jint, jbyteArray, jbyteArray); + +/* + * Class: processing_io_NativeInterface + * Method: servoStartThread + * Signature: (III)J + */ +JNIEXPORT jlong JNICALL Java_processing_io_NativeInterface_servoStartThread + (JNIEnv *, jclass, jint, jint, jint); + +/* + * Class: processing_io_NativeInterface + * Method: servoUpdateThread + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_servoUpdateThread + (JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: processing_io_NativeInterface + * Method: servoStopThread + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_servoStopThread + (JNIEnv *, jclass, jlong); + +/* + * Class: processing_io_NativeInterface + * Method: setSpiSettings + * Signature: (IIII)I + */ +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_setSpiSettings + (JNIEnv *, jclass, jint, jint, jint, jint); + +/* + * Class: processing_io_NativeInterface + * Method: transferSpi + * Signature: (I[B[B)I + */ +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_transferSpi + (JNIEnv *, jclass, jint, jbyteArray, jbyteArray); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/java/libraries/io/src/native/impl.c b/java/libraries/io/src/native/impl.c new file mode 100644 index 0000000000..522aa310fa --- /dev/null +++ b/java/libraries/io/src/native/impl.c @@ -0,0 +1,489 @@ +/* + Copyright (c) The Processing Foundation 2015 + Hardware I/O library developed by Gottfried Haider as part of GSoC 2015 + + 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 +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "iface.h" + + +static const int servo_pulse_oversleep = 35; // amount of uS to account for when sleeping + + +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_openDevice + (JNIEnv *env, jclass cls, jstring _fn) +{ + const char *fn = (*env)->GetStringUTFChars(env, _fn, JNI_FALSE); + int file = open(fn, O_RDWR); + (*env)->ReleaseStringUTFChars(env, _fn, fn); + if (file < 0) { + return -errno; + } else { + return file; + } +} + + +JNIEXPORT jstring JNICALL Java_processing_io_NativeInterface_getError + (JNIEnv *env, jclass cls, jint _errno) +{ + char *msg = strerror(abs(_errno)); + if (msg) { + return (*env)->NewStringUTF(env, msg); + } else { + return NULL; + } +} + + +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_closeDevice + (JNIEnv *env, jclass cls, jint handle) +{ + if (close(handle) < 0) { + return -errno; + } else { + return 0; + } +} + + +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_readFile + (JNIEnv *env, jclass cls, jstring _fn, jbyteArray _in) +{ + const char *fn = (*env)->GetStringUTFChars(env, _fn, JNI_FALSE); + int file = open(fn, O_RDONLY); + (*env)->ReleaseStringUTFChars(env, _fn, fn); + if (file < 0) { + return -errno; + } + + jbyte *in = (*env)->GetByteArrayElements(env, _in, NULL); + int len = read(file, in, (*env)->GetArrayLength(env, _in)); + if (len < 0) { + len = -errno; + } + (*env)->ReleaseByteArrayElements(env, _in, in, 0); + + close(file); + return len; +} + + +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_writeFile + (JNIEnv *env, jclass cls, jstring _fn, jbyteArray _out) +{ + const char *fn = (*env)->GetStringUTFChars(env, _fn, JNI_FALSE); + int file = open(fn, O_WRONLY); + (*env)->ReleaseStringUTFChars(env, _fn, fn); + if (file < 0) { + return -errno; + } + + jbyte *out = (*env)->GetByteArrayElements(env, _out, JNI_FALSE); + int len = write(file, out, (*env)->GetArrayLength(env, _out)); + if (len < 0) { + len = -errno; + } + (*env)->ReleaseByteArrayElements(env, _out, out, JNI_ABORT); + + close(file); + return len; +} + + +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_raspbianGpioMemRead + (JNIEnv *env, jclass cls, jint offset) +{ + // validate offset + if (4096 <= offset) { + return -EINVAL; + } + + int file = open("/dev/gpiomem", O_RDWR|O_SYNC); + if (file < 0) { + return -errno; + } + + uint32_t *mem = mmap(NULL, 4096, PROT_READ, MAP_SHARED, file, 0); + if (mem == MAP_FAILED) { + close(file); + return -errno; + } + + uint32_t value = mem[offset]; + + munmap(mem, 4096); + close(file); + return value; +} + + +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_raspbianGpioMemWrite + (JNIEnv *env, jclass cls, jint offset, jint mask, jint value) +{ + // validate offset + if (4096 <= offset) { + return -EINVAL; + } + + int file = open("/dev/gpiomem", O_RDWR|O_SYNC); + if (file < 0) { + return -errno; + } + + uint32_t *mem = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, file, 0); + if (mem == MAP_FAILED) { + close(file); + return -errno; + } + + mem[offset] = (mem[offset] & ~mask) | (value & mask); + + munmap(mem, 4096); + close(file); + return 1; // number of bytes written +} + + +#define BCM2835_GPPUD_OFFSET (0x94 >> 2) +#define BCM2835_GPPUDCLK0_OFFSET (0x98 >> 2) +#define BCM2835_GPPUDCLK1_OFFSET (0x9c >> 2) + +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_raspbianGpioMemSetPinBias + (JNIEnv *env, jclass cls, jint gpio, jint mode) +{ + int ret = 0; // success + + int file = open("/dev/gpiomem", O_RDWR|O_SYNC); + if (file < 0) { + return -errno; + } + + uint32_t *mem = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, file, 0); + if (mem == MAP_FAILED) { + close(file); + return -errno; + } + + // validate arguments + if (gpio < 0 || 53 < gpio) { + ret = -EINVAL; + goto out; + } + + // see BCM2835 datasheet, p. 101 + uint32_t pud; + if (mode == 0) { + pud = 0; // floating + } else if (mode == 2) { + pud = 2; // pull-up + } else if (mode == 3) { + pud = 1; // pull-down + } else { + ret = -EINVAL; + goto out; + } + + /* + * From the BCM2835 datasheet, p. 101: + * + * The following sequence of events is required: + * 1. Write to GPPUD to set the required control signal (i.e. Pull-up or + * Pull-Down or neither to remove the current Pull-up/down) + * 2. Wait 150 cycles – this provides the required set-up time for the + * control signal + * 3. Write to GPPUDCLK0/1 to clock the control signal into the GPIO pads + * you wish to modify – NOTE only the pads which receive a clock will + * be modified, all others will retain their previous state. + * 4. Wait 150 cycles – this provides the required hold time for the + * control signal + * 5. Write to GPPUD to remove the control signal + * 6. Write to GPPUDCLK0/1 to remove the clock + */ + + // python-gpiozero uses a delay of 214 ns, so we do the same + struct timespec wait; + wait.tv_sec = 0; + wait.tv_nsec = 214; + + mem[BCM2835_GPPUD_OFFSET] = pud; + nanosleep(&wait, NULL); + if (gpio < 32) { + mem[BCM2835_GPPUDCLK0_OFFSET] = 1 << gpio; + } else { + mem[BCM2835_GPPUDCLK1_OFFSET] = 1 << (gpio-32); + } + nanosleep(&wait, NULL); + mem[BCM2835_GPPUD_OFFSET] = 0; + if (gpio < 32) { + mem[BCM2835_GPPUDCLK0_OFFSET] = 0; + } else { + mem[BCM2835_GPPUDCLK1_OFFSET] = 0; + } + +out: + munmap(mem, 4096); + close(file); + return ret; +} + + +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_pollDevice + (JNIEnv *env, jclass cls, jstring _fn, jint timeout) +{ + const char *fn = (*env)->GetStringUTFChars(env, _fn, JNI_FALSE); + int file = open(fn, O_RDONLY|O_NONBLOCK); + (*env)->ReleaseStringUTFChars(env, _fn, fn); + if (file < 0) { + return -errno; + } + + // dummy read + char tmp; + while (0 < read(file, &tmp, 1)); + + struct pollfd fds[1]; + memset(fds, 0, sizeof(fds)); + fds[0].fd = file; + fds[0].events = POLLPRI|POLLERR; + + // and wait + int ret = poll(fds, 1, timeout); + close(file); + + if (ret < 0) { + return -errno; + } else if (ret == 0) { + // timeout + return 0; + } else if (fds[0].revents & POLLPRI) { + // interrupt + return 1; + } else { + // POLLERR? + return -ENOMSG; + } +} + + +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_transferI2c + (JNIEnv *env, jclass cls, jint handle, jint slave, jbyteArray _out, jbyteArray _in) +{ + struct i2c_rdwr_ioctl_data packets; + struct i2c_msg msgs[2]; + jbyte *out, *in; + + packets.msgs = msgs; + packets.nmsgs = 0; + + if (_out != NULL) { + msgs[packets.nmsgs].addr = slave; + msgs[packets.nmsgs].flags = 0; + msgs[packets.nmsgs].len = (*env)->GetArrayLength(env, _out); + out = (*env)->GetByteArrayElements(env, _out, NULL); + msgs[packets.nmsgs].buf = out; + packets.nmsgs++; + } + if (_in != NULL) { + msgs[packets.nmsgs].addr = slave; + msgs[packets.nmsgs].flags = I2C_M_RD; // I2C_M_RECV_LEN is not supported + msgs[packets.nmsgs].len = (*env)->GetArrayLength(env, _in); + in = (*env)->GetByteArrayElements(env, _in, NULL); + msgs[packets.nmsgs].buf = in; + packets.nmsgs++; + } + + // set the timeout to 100ms - this helps slow devices such as the + // Arduino Uno to keep up + ioctl(handle, I2C_TIMEOUT, 10); + int ret = ioctl(handle, I2C_RDWR, &packets); + if (ret < 0) { + ret = -errno; + } + + if (_out != NULL) { + (*env)->ReleaseByteArrayElements(env, _out, out, JNI_ABORT); + } + if (_in != NULL) { + (*env)->ReleaseByteArrayElements(env, _in, in, 0); + } + + return ret; +} + + +typedef struct { + int fd; + pthread_t thread; + int pulse; + int period; +} SERVO_STATE_T; + + +static void* servoThread(void *ptr) { + SERVO_STATE_T *state = (SERVO_STATE_T*)ptr; + struct timespec on, off; + on.tv_sec = 0; + off.tv_sec = 0; + + do { + write(state->fd, "1", 1); + + on.tv_nsec = state->pulse * 1000; + nanosleep(&on, NULL); + + write(state->fd, "0", 1); + + off.tv_nsec = (state->period - state->pulse) * 1000; + nanosleep(&off, NULL); + } while (1); +} + + +JNIEXPORT jlong JNICALL Java_processing_io_NativeInterface_servoStartThread + (JNIEnv *env, jclass cls, jint gpio, jint pulse, jint period) +{ + char path[26 + 19 + 1]; + int fd; + pthread_t thread; + + // setup struct holding our state + SERVO_STATE_T *state = malloc(sizeof(SERVO_STATE_T)); + if (!state) { + return -ENOMEM; + } + memset(state, 0, sizeof(*state)); + state->pulse = (pulse - servo_pulse_oversleep > 0) ? pulse - servo_pulse_oversleep : 0; + // we're obviously also oversleeping in the general period case + // but other than the pulse, this doesn't seem to be crucial with servos + state->period = period; + + // open gpio + sprintf(path, "/sys/class/gpio/gpio%d/value", gpio); + state->fd = open(path, O_WRONLY); + if (state->fd < 0) { + free(state); + return -errno; + } + + // start thread + int ret = pthread_create(&state->thread, NULL, servoThread, state); + if (ret != 0) { + free(state); + return -ret; + } + + // set scheduling policy and priority + struct sched_param param; + param.sched_priority = 75; + ret = pthread_setschedparam(state->thread, SCHED_FIFO, ¶m); + if (ret != 0) { + fprintf(stderr, "Error setting thread policy: %s\n", strerror(ret)); + } + + return (intptr_t)state; +} + + +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_servoUpdateThread + (JNIEnv *env, jclass cls, jlong handle, jint pulse, jint period) +{ + SERVO_STATE_T *state = (SERVO_STATE_T*)(intptr_t)handle; + state->pulse = (pulse - servo_pulse_oversleep > 0) ? pulse - servo_pulse_oversleep : 0; + state->period = period; + return 0; +} + + +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_servoStopThread + (JNIEnv *env, jclass cls, jlong handle) +{ + SERVO_STATE_T *state = (SERVO_STATE_T*)(intptr_t)handle; + + // signal thread to stop + pthread_cancel(state->thread); + pthread_join(state->thread, NULL); + + close(state->fd); + free(state); + return 0; +} + + +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_setSpiSettings + (JNIEnv *env, jclass cls, jint handle, jint _maxSpeed, jint dataOrder, jint mode) +{ + uint8_t tmp; + uint32_t maxSpeed; + + tmp = (uint8_t)mode; + int ret = ioctl(handle, SPI_IOC_WR_MODE, &tmp); + if (ret < 0) { + return ret; + } + + tmp = (uint8_t)dataOrder; + ret = ioctl(handle, SPI_IOC_WR_LSB_FIRST, &tmp); + if (ret < 0) { + return ret; + } + + maxSpeed = (uint32_t)_maxSpeed; + ret = ioctl(handle, SPI_IOC_WR_MAX_SPEED_HZ, &maxSpeed); + if (ret < 0) { + return ret; + } + + return 0; +} + + +JNIEXPORT jint JNICALL Java_processing_io_NativeInterface_transferSpi + (JNIEnv *env, jclass cls, jint handle, jbyteArray _out, jbyteArray _in) +{ + jbyte* out = (*env)->GetByteArrayElements(env, _out, NULL); + jbyte* in = (*env)->GetByteArrayElements(env, _in, NULL); + + struct spi_ioc_transfer xfer = { + .tx_buf = (unsigned long)out, + .rx_buf = (unsigned long)in, + .len = MIN((*env)->GetArrayLength(env, _out), (*env)->GetArrayLength(env, _in)), + }; + + int ret = ioctl(handle, SPI_IOC_MESSAGE(1), &xfer); + + (*env)->ReleaseByteArrayElements(env, _out, out, JNI_ABORT); + (*env)->ReleaseByteArrayElements(env, _in, in, 0); + + return ret; +} diff --git a/java/libraries/io/src/processing/io/GPIO.java b/java/libraries/io/src/processing/io/GPIO.java new file mode 100644 index 0000000000..711aafd808 --- /dev/null +++ b/java/libraries/io/src/processing/io/GPIO.java @@ -0,0 +1,529 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Copyright (c) The Processing Foundation 2015 + Hardware I/O library developed by Gottfried Haider as part of GSoC 2015 + + 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.io; + +import processing.core.*; +import processing.io.NativeInterface; + +import java.lang.reflect.Method; +import java.util.BitSet; +import java.util.HashMap; +import java.util.Map; + + +/** + * @webref + */ +public class GPIO { + + // those constants are generally the same as in Arduino.h + public static final int INPUT = 0; + public static final int OUTPUT = 1; + public static final int INPUT_PULLUP = 2; + public static final int INPUT_PULLDOWN = 3; + + public static final int LOW = 0; + public static final int HIGH = 1; + + public static final int NONE = 0; + /** + * trigger when level changes + */ + public static final int CHANGE = 1; + /** + * trigger when level changes from high to low + */ + public static final int FALLING = 2; + /** + * trigger when level changes from low to high + */ + public static final int RISING = 3; + + protected static Map irqThreads = new HashMap(); + protected static boolean serveInterrupts = true; + protected static BitSet values = new BitSet(); + + + static { + NativeInterface.loadLibrary(); + } + + + public static void analogWrite(int pin, int value) { + // currently this can't be done in a non-platform-specific way + // the best way forward would be implementing a generic, "soft" + // PWM in the kernel that uses high resolution timers, similiar + // to the patch Bill Gatliff posted, which unfortunately didn't + // get picked up, see + // https://dev.openwrt.org/browser/trunk/target/linux/generic/files/drivers/pwm/gpio-pwm.c?rev=35328 + + // additionally, there currently doesn't seem to be a way to link + // a PWM channel back to the GPIO pin it is associated with + + // alternatively, this could be implemented in user-space to some + // degree + // see http://stackoverflow.com/a/13371570/3030124 + // see http://raspberrypi.stackexchange.com/a/304 + throw new RuntimeException("Not yet implemented"); + } + + + /** + * Calls a function when the value of an input pin changes + * @param pin GPIO pin + * @param parent typically use "this" + * @param method name of sketch method to call + * @param mode when to call: GPIO.CHANGE, GPIO.FALLING or GPIO.RISING + * @see noInterrupts + * @see interrupts + * @see releaseInterrupt + * @webref + */ + public static void attachInterrupt(int pin, PApplet parent, String method, int mode) { + if (irqThreads.containsKey(pin)) { + throw new RuntimeException("You must call releaseInterrupt before attaching another interrupt on the same pin"); + } + + enableInterrupt(pin, mode); + + final int irqPin = pin; + final PApplet irqObject = parent; + final Method irqMethod; + try { + irqMethod = parent.getClass().getMethod(method, int.class); + } catch (NoSuchMethodException e) { + throw new RuntimeException("Method " + method + " does not exist"); + } + + // it might be worth checking how Java threads compare to pthreads in terms + // of latency + Thread t = new Thread(new Runnable() { + public void run() { + boolean gotInterrupt = false; + try { + do { + try { + if (waitForInterrupt(irqPin, 100)) { + gotInterrupt = true; + } + if (gotInterrupt && serveInterrupts) { + irqMethod.invoke(irqObject, irqPin); + gotInterrupt = false; + } + // if we received an interrupt while interrupts were disabled + // we still deliver it the next time interrupts get enabled + // not sure if everyone agrees with this logic though + } catch (RuntimeException e) { + // make sure we're not busy spinning on error + Thread.sleep(100); + } + } while (!Thread.currentThread().isInterrupted()); + } catch (Exception e) { + // terminate the thread on any unexpected exception that might occur + System.err.println("Terminating interrupt handling for pin " + irqPin + " after catching: " + e.getMessage()); + } + } + }, "GPIO" + pin + " IRQ"); + + t.setPriority(Thread.MAX_PRIORITY); + t.start(); + + irqThreads.put(pin, t); + } + + + /** + * Checks if the GPIO pin number can be valid + * + * Board-specific classes, such as RPI, assign -1 to pins that carry power, + * ground and the like. + * @param pin GPIO pin + */ + protected static void checkValidPin(int pin) { + if (pin < 0) { + throw new RuntimeException("Operation not supported on this pin"); + } + } + + + /** + * Returns the value of an input pin + * @param pin GPIO pin + * @return GPIO.HIGH (1) or GPIO.LOW (0) + * @see pinMode + * @see digitalWrite + * @webref + */ + public static int digitalRead(int pin) { + checkValidPin(pin); + + if (NativeInterface.isSimulated()) { + return LOW; + } + + String fn = String.format("/sys/class/gpio/gpio%d/value", pin); + byte in[] = new byte[2]; + int ret = NativeInterface.readFile(fn, in); + if (ret < 0) { + throw new RuntimeException(NativeInterface.getError(ret)); + } else if (1 <= ret && in[0] == '0') { + return LOW; + } else if (1 <= ret && in[0] == '1') { + return HIGH; + } else { + System.err.print("Read " + ret + " bytes"); + if (0 < ret) { + System.err.format(", first byte is 0x%02x" + in[0]); + } + System.err.println(); + throw new RuntimeException("Unexpected value"); + } + } + + + /** + * Sets an output pin to be either high or low + * @param pin GPIO pin + * @param value GPIO.HIGH (1) or GPIO.LOW (0) + * @see pinMode + * @see digitalRead + * @webref + */ + public static void digitalWrite(int pin, int value) { + checkValidPin(pin); + + String out; + if (value == LOW) { + // values are also stored in a bitmap to make it possible to set a + // default level per pin before enabling the output + values.clear(pin); + out = "0"; + } else if (value == HIGH) { + values.set(pin); + out = "1"; + } else { + System.err.println("Only GPIO.LOW and GPIO.HIGH, 0 and 1, or true and false, can be used."); + throw new IllegalArgumentException("Illegal value"); + } + + if (NativeInterface.isSimulated()) { + return; + } + + String fn = String.format("/sys/class/gpio/gpio%d/value", pin); + int ret = NativeInterface.writeFile(fn, out); + if (ret < 0) { + if (ret != -2) { // ENOENT, pin might not yet be exported + throw new RuntimeException(NativeInterface.getError(ret)); + } + } + } + + + /** + * @param value true or false + */ + public static void digitalWrite(int pin, boolean value) { + if (value) { + digitalWrite(pin, HIGH); + } else { + digitalWrite(pin, LOW); + } + } + + + /** + * Disables an interrupt for an input pin + * @param pin GPIO pin + * @see enableInterrupt + * @see waitForInterrupt + */ + protected static void disableInterrupt(int pin) { + enableInterrupt(pin, NONE); + } + + + /** + * Enables an interrupt for an input pin + * @param pin GPIO pin + * @param mode what to wait for: GPIO.CHANGE, GPIO.FALLING or GPIO.RISING + * @see waitForInterrupt + * @see disableInterrupt + */ + protected static void enableInterrupt(int pin, int mode) { + checkValidPin(pin); + + String out; + if (mode == NONE) { + out = "none"; + } else if (mode == CHANGE) { + out = "both"; + } else if (mode == FALLING) { + out = "falling"; + } else if (mode == RISING) { + out = "rising"; + } else { + throw new IllegalArgumentException("Unknown mode"); + } + + if (NativeInterface.isSimulated()) { + return; + } + + String fn = String.format("/sys/class/gpio/gpio%d/edge", pin); + int ret = NativeInterface.writeFile(fn, out); + if (ret < 0) { + if (ret == -2) { // ENOENT + System.err.println("Make sure your called pinMode on the input pin"); + } + throw new RuntimeException(NativeInterface.getError(ret)); + } + } + + + /** + * Allows interrupts to happen + * @see attachInterrupt + * @see noInterrupts + * @see releaseInterrupt + * @webref + */ + public static void interrupts() { + serveInterrupts = true; + } + + + /** + * Prevents interrupts from happpening + * @see attachInterrupt + * @see interrupts + * @see releaseInterrupt + * @webref + */ + public static void noInterrupts() { + serveInterrupts = false; + } + + + /** + * Configures a pin to act either as input or output + * @param pin GPIO pin + * @param mode GPIO.INPUT, GPIO.INPUT_PULLUP, GPIO.INPUT_PULLDOWN, or GPIO.OUTPUT + * @see digitalRead + * @see digitalWrite + * @see releasePin + * @webref + */ + public static void pinMode(int pin, int mode) { + checkValidPin(pin); + + if (NativeInterface.isSimulated()) { + return; + } + + // export pin through sysfs + String fn = "/sys/class/gpio/export"; + int ret = NativeInterface.writeFile(fn, Integer.toString(pin)); + if (ret < 0) { + if (ret == -2) { // ENOENT + System.err.println("Make sure your kernel is compiled with GPIO_SYSFS enabled"); + } + if (ret == -22) { // EINVAL + System.err.println("GPIO pin " + pin + " does not seem to be available on your platform"); + } + if (ret != -16) { // EBUSY, returned when the pin is already exported + throw new RuntimeException(fn + ": " + NativeInterface.getError(ret)); + } + } + + // set direction and default level for outputs + fn = String.format("/sys/class/gpio/gpio%d/direction", pin); + String out; + if (mode == INPUT) { + out = "in"; + + // attempt to disable any pre-set pullups on the Raspberry Pi + NativeInterface.raspbianGpioMemSetPinBias(pin, mode); + + } else if (mode == OUTPUT) { + if (values.get(pin)) { + out = "high"; + } else { + out = "low"; + } + } else if (mode == INPUT_PULLUP || mode == INPUT_PULLDOWN) { + out = "in"; + + // attempt to set pullups on the Raspberry Pi + ret = NativeInterface.raspbianGpioMemSetPinBias(pin, mode); + if (ret == -2) { // NOENT + System.err.println("Setting pullup or pulldown resistors is currently only supported on the Raspberry Pi running Raspbian. Continuing without."); + } else if (ret < 0) { + System.err.println("Error setting pullup or pulldown resistors: " + NativeInterface.getError(ret) + ". Continuing without."); + } + // currently this can't be done in a non-platform-specific way, see + // http://lists.infradead.org/pipermail/linux-rpi-kernel/2015-August/002146.html + + } else { + throw new IllegalArgumentException("Unknown mode"); + } + + // we need to give udev some time to change the file permissions behind our back + // retry for 500ms when writing to the file fails with -EACCES + long start = System.currentTimeMillis(); + do { + ret = NativeInterface.writeFile(fn, out); + if (ret == -13) { + Thread.yield(); + } + } while (ret == -13 && System.currentTimeMillis()-start < 500); + + if (ret < 0) { + throw new RuntimeException(fn + ": " + NativeInterface.getError(ret)); + } + } + + + /** + * Stops listening for interrupts on an input pin + * @param pin GPIO pin + * @see attachInterrupt + * @see noInterrupts + * @see interrupts + * @webref + */ + public static void releaseInterrupt(int pin) { + Thread t = irqThreads.get(pin); + if (t == null) { + return; + } + + t.interrupt(); + try { + t.join(); + } catch (InterruptedException e) { + System.err.println("Error joining thread in releaseInterrupt: " + e.getMessage()); + } + t = null; + irqThreads.remove(pin); + + disableInterrupt(pin); + } + + + /** + * Gives ownership of a pin back to the operating system + * @param pin GPIO pin + * @see pinMode + * @webref + */ + public static void releasePin(int pin) { + checkValidPin(pin); + + if (NativeInterface.isSimulated()) { + return; + } + + String fn = "/sys/class/gpio/unexport"; + int ret = NativeInterface.writeFile(fn, Integer.toString(pin)); + if (ret < 0) { + if (ret == -2) { // ENOENT + System.err.println("Make sure your kernel is compiled with GPIO_SYSFS enabled"); + } + // EINVAL is returned when trying to unexport pins that weren't exported to begin with, ignore this case + if (ret != -22) { + throw new RuntimeException(NativeInterface.getError(ret)); + } + } + } + + + /** + * Waits for the value of an input pin to change + * @param pin GPIO pin + * @param mode what to wait for: GPIO.CHANGE, GPIO.FALLING or GPIO.RISING + * @webref + */ + public static void waitFor(int pin, int mode) { + waitFor(pin, mode, -1); + } + + + /** + * Waits for the value of an input pin to change + * + * This function will throw a RuntimeException in case of a timeout. + * @param timeout don't wait more than timeout milliseconds + * @webref + */ + public static void waitFor(int pin, int mode, int timeout) { + enableInterrupt(pin, mode); + if (waitForInterrupt(pin, timeout) == false) { + throw new RuntimeException("Timeout occurred"); + } + } + + + public static boolean waitForInterrupt(int pin, int mode, int timeout) { + throw new RuntimeException("The waitForInterrupt function has been renamed to waitFor. Please update your sketch accordingly."); + } + + + /** + * Waits for the value of an input pin to change + * + * Make sure to setup the interrupt with enableInterrupt() before calling + * this function. A timeout value of -1 waits indefinitely. + * @param pin GPIO pin + * @param timeout don't wait more than timeout milliseconds + * @return true if the interrupt occured, false if the timeout occured + * @see enableInterrupt + * @see disableInterrupt + */ + protected static boolean waitForInterrupt(int pin, int timeout) { + checkValidPin(pin); + + if (NativeInterface.isSimulated()) { + // pretend the interrupt happens after 200ms + try { + Thread.sleep(200); + } catch (InterruptedException e) {} + return true; + } + + String fn = String.format("/sys/class/gpio/gpio%d/value", pin); + int ret = NativeInterface.pollDevice(fn, timeout); + if (ret < 0) { + if (ret == -2) { // ENOENT + System.err.println("Make sure your called pinMode on the input pin"); + } + throw new RuntimeException(NativeInterface.getError(ret)); + } else if (ret == 0) { + // timeout + return false; + } else { + // interrupt + return true; + } + } +} diff --git a/java/libraries/io/src/processing/io/I2C.java b/java/libraries/io/src/processing/io/I2C.java new file mode 100644 index 0000000000..2e5dedb4e5 --- /dev/null +++ b/java/libraries/io/src/processing/io/I2C.java @@ -0,0 +1,262 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Copyright (c) The Processing Foundation 2015 + Hardware I/O library developed by Gottfried Haider as part of GSoC 2015 + + 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.io; + +import processing.io.NativeInterface; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; + + +/** + * @webref + */ +public class I2C { + + protected String dev; + protected int handle; + protected int slave; + protected byte[] out; + protected boolean transmitting; + + + /** + * Opens an I2C interface as master + * @param dev interface name + * @see list + * @webref + */ + public I2C(String dev) { + NativeInterface.loadLibrary(); + this.dev = dev; + + if (NativeInterface.isSimulated()) { + return; + } + + handle = NativeInterface.openDevice("/dev/" + dev); + if (handle < 0) { + throw new RuntimeException(NativeInterface.getError(handle)); + } + } + + + /** + * Begins a transmission to an attached device + * @see write + * @see read + * @see endTransmission + * @webref + */ + public void beginTransmission(int slave) { + // addresses 120 (0x78) to 127 are additionally reserved + if (0x78 <= slave) { + System.err.println("beginTransmission expects a 7 bit address, try shifting one bit to the right"); + throw new IllegalArgumentException("Illegal address"); + } + this.slave = slave; + transmitting = true; + out = null; + } + + + /** + * Closes the I2C device + * @webref + */ + public void close() { + if (NativeInterface.isSimulated()) { + return; + } + + NativeInterface.closeDevice(handle); + handle = 0; + } + + + protected void finalize() throws Throwable { + try { + close(); + } finally { + super.finalize(); + } + } + + + /** + * Ends the current transmissions + * @see beginTransmission + * @see write + * @webref + */ + public void endTransmission() { + if (!transmitting) { + // silently ignore this case + return; + } + + if (NativeInterface.isSimulated()) { + return; + } + + // implement these flags if needed: https://github.com/raspberrypi/linux/blob/rpi-patches/Documentation/i2c/i2c-protocol + int ret = NativeInterface.transferI2c(handle, slave, out, null); + transmitting = false; + out = null; + if (ret < 0) { + if (ret == -5 | ret == -121) { // EIO | EREMOTEIO + System.err.println("The device did not respond. Check the cabling and whether you are using the correct address."); + } + throw new RuntimeException(NativeInterface.getError(ret)); + } + } + + + /** + * Lists all available I2C interfaces + * @return String array + * @webref + */ + public static String[] list() { + if (NativeInterface.isSimulated()) { + // as on the Raspberry Pi + return new String[]{ "i2c-1" }; + } + + ArrayList devs = new ArrayList(); + File dir = new File("/dev"); + File[] files = dir.listFiles(); + if (files != null) { + for (File file : files) { + if (file.getName().startsWith("i2c-")) { + devs.add(file.getName()); + } + } + } + // listFiles() does not guarantee ordering + String[] tmp = devs.toArray(new String[devs.size()]); + Arrays.sort(tmp); + return tmp; + } + + + /** + * Reads bytes from the attached device + * @param len number of bytes to read + * @return bytes read from device + * @see beginTransmission + * @see write + * @see endTransmission + * @webref + */ + public byte[] read(int len) { + if (!transmitting) { + throw new RuntimeException("beginTransmisson has not been called"); + } + + byte[] in = new byte[len]; + + if (NativeInterface.isSimulated()) { + return in; + } + + int ret = NativeInterface.transferI2c(handle, slave, out, in); + transmitting = false; + out = null; + if (ret < 0) { + if (ret == -5 | ret == -121) { // EIO | EREMOTEIO + System.err.println("The device did not respond. Check the cabling and whether you are using the correct address."); + } + throw new RuntimeException(NativeInterface.getError(ret)); + } + + return in; + } + + + /** + * Adds bytes to be written to the device + * @param out bytes to be written + * @see beginTransmission + * @see read + * @see endTransmission + * @webref + */ + public void write(byte[] out) { + if (!transmitting) { + throw new RuntimeException("beginTransmisson has not been called"); + } + + if (this.out == null) { + this.out = out; + } else { + byte[] tmp = new byte[this.out.length + out.length]; + System.arraycopy(this.out, 0, tmp, 0, this.out.length); + System.arraycopy(out, 0, tmp, this.out.length, out.length); + this.out = tmp; + } + } + + + /** + * Adds bytes to be written to the attached device + * @param out string to be written + * @see beginTransmission + * @see read + * @see endTransmission + */ + public void write(String out) { + write(out.getBytes()); + } + + + /** + * Adds a byte to be written to the attached device + * @param out single byte to be written, e.g. numeric literal (0 to 255, or -128 to 127) + * @see beginTransmission + * @see read + * @see endTransmission + */ + public void write(int out) { + if (out < -128 || 255 < out) { + System.err.println("The write function can only operate on a single byte at a time. Call it with a value from 0 to 255, or -128 to 127."); + throw new RuntimeException("Argument does not fit into a single byte"); + } + byte[] tmp = new byte[1]; + tmp[0] = (byte)out; + write(tmp); + } + + /** + * Adds a byte to be written to the attached device + * @param out single byte to be written + * @see beginTransmission + * @see read + * @see endTransmission + */ + public void write(byte out) { + // cast to (unsigned) int + write(out & 0xff); + } +} diff --git a/java/libraries/io/src/processing/io/LED.java b/java/libraries/io/src/processing/io/LED.java new file mode 100644 index 0000000000..32925e6ea8 --- /dev/null +++ b/java/libraries/io/src/processing/io/LED.java @@ -0,0 +1,177 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Copyright (c) The Processing Foundation 2015 + Hardware I/O library developed by Gottfried Haider as part of GSoC 2015 + + 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.io; + +import processing.io.NativeInterface; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; + + +/** + * @webref + */ +public class LED { + + protected String dev; + protected int maxBrightness; + protected int prevBrightness; + protected String prevTrigger; + + + /** + * Opens a LED device + * @param dev device name + * @see list + * @webref + */ + public LED(String dev) { + NativeInterface.loadLibrary(); + this.dev = dev; + + if (NativeInterface.isSimulated()) { + return; + } + + // read maximum brightness + try { + Path path = Paths.get("/sys/class/leds/" + dev + "/max_brightness"); + String tmp = new String(Files.readAllBytes(path)); + maxBrightness = Integer.parseInt(tmp.trim()); + } catch (Exception e) { + System.err.println(e.getMessage()); + throw new RuntimeException("Unable to read maximum brightness"); + } + + // read current trigger setting to be able to restore it later + try { + Path path = Paths.get("/sys/class/leds/" + dev + "/trigger"); + String tmp = new String(Files.readAllBytes(path)); + int start = tmp.indexOf('['); + int end = tmp.indexOf(']', start); + if (start != -1 && end != -1) { + prevTrigger = tmp.substring(start+1, end); + } + } catch (Exception e) { + System.err.println(e.getMessage()); + throw new RuntimeException("Unable to read trigger setting"); + } + + // read current brightness to be able to restore it later + try { + Path path = Paths.get("/sys/class/leds/" + dev + "/brightness"); + String tmp = new String(Files.readAllBytes(path)); + prevBrightness = Integer.parseInt(tmp.trim()); + } catch (Exception e) { + System.err.println(e.getMessage()); + throw new RuntimeException("Unable to read current brightness"); + } + + // disable trigger + String fn = "/sys/class/leds/" + dev + "/trigger"; + int ret = NativeInterface.writeFile(fn, "none"); + if (ret < 0) { + if (ret == -13) { // EACCES + System.err.println("You might need to install a custom udev rule to allow regular users to modify /sys/class/leds/*."); + } + throw new RuntimeException(NativeInterface.getError(ret)); + } + } + + + /** + * Sets the brightness + * @param bright 0.0 (off) to 1.0 (maximum) + * @webref + */ + public void brightness(float bright) { + if (bright < 0.0 || 1.0 < bright) { + System.err.println("Brightness must be between 0.0 and 1.0."); + throw new IllegalArgumentException("Illegal argument"); + } + + if (NativeInterface.isSimulated()) { + return; + } + + String fn = "/sys/class/leds/" + dev + "/brightness"; + int ret = NativeInterface.writeFile(fn, Integer.toString((int)(bright * maxBrightness))); + if (ret < 0) { + throw new RuntimeException(fn + ": " + NativeInterface.getError(ret)); + } + } + + + /** + * Restores the previous state + * @webref + */ + public void close() { + if (NativeInterface.isSimulated()) { + return; + } + + // restore previous settings + String fn = "/sys/class/leds/" + dev + "/brightness"; + int ret = NativeInterface.writeFile(fn, Integer.toString(prevBrightness)); + if (ret < 0) { + throw new RuntimeException(fn + ": " + NativeInterface.getError(ret)); + } + + fn = "/sys/class/leds/" + dev + "/trigger"; + ret = NativeInterface.writeFile(fn, prevTrigger); + if (ret < 0) { + throw new RuntimeException(fn + ": " + NativeInterface.getError(ret)); + } + } + + + /** + * Lists all available LED devices + * @return String array + * @webref + */ + public static String[] list() { + if (NativeInterface.isSimulated()) { + // as on the Raspberry Pi + return new String[]{ "led0", "led1" }; + } + + ArrayList devs = new ArrayList<>(); + File dir = new File("/sys/class/leds"); + File[] files = dir.listFiles(); + if (files != null) { + for (File file : files) { + devs.add(file.getName()); + } + } + // listFiles() does not guarantee ordering + String[] tmp = devs.toArray(new String[devs.size()]); + Arrays.sort(tmp); + return tmp; + } +} diff --git a/java/libraries/io/src/processing/io/NativeInterface.java b/java/libraries/io/src/processing/io/NativeInterface.java new file mode 100644 index 0000000000..a05a71ecd5 --- /dev/null +++ b/java/libraries/io/src/processing/io/NativeInterface.java @@ -0,0 +1,78 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Copyright (c) The Processing Foundation 2015 + Hardware I/O library developed by Gottfried Haider as part of GSoC 2015 + + 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.io; + + +public class NativeInterface { + + protected static boolean loaded = false; + protected static boolean alwaysSimulate = false; + + public static void loadLibrary() { + if (!loaded) { + if (isSimulated()) { + System.err.println("The Processing I/O library is not supported on this platform. Instead of values from actual hardware ports, your sketch will only receive stand-in values that allow you to test the remainder of its functionality."); + } else { + System.loadLibrary("processing-io"); + } + loaded = true; + } + } + + public static void alwaysSimulate() { + alwaysSimulate = true; + } + + public static boolean isSimulated() { + return alwaysSimulate || + !"Linux".equals(System.getProperty("os.name")); + } + + + public static native int openDevice(String fn); + public static native String getError(int errno); + public static native int closeDevice(int handle); + + // the following two functions were done in native code to get access to the + // specifc error number (errno) that might occur + public static native int readFile(String fn, byte[] in); + public static native int writeFile(String fn, byte[] out); + public static int writeFile(String fn, String out) { + return writeFile(fn, out.getBytes()); + } + + /* GPIO */ + public static native int raspbianGpioMemRead(int offset); + public static native int raspbianGpioMemWrite(int offset, int mask, int value); + public static native int raspbianGpioMemSetPinBias(int gpio, int mode); + public static native int pollDevice(String fn, int timeout); + /* I2C */ + public static native int transferI2c(int handle, int slave, byte[] out, byte[] in); + /* SoftwareServo */ + public static native long servoStartThread(int gpio, int pulse, int period); + public static native int servoUpdateThread(long handle, int pulse, int period); + public static native int servoStopThread(long handle); + /* SPI */ + public static native int setSpiSettings(int handle, int maxSpeed, int dataOrder, int mode); + public static native int transferSpi(int handle, byte[] out, byte[] in); +} diff --git a/java/libraries/io/src/processing/io/PWM.java b/java/libraries/io/src/processing/io/PWM.java new file mode 100644 index 0000000000..c33c9107cb --- /dev/null +++ b/java/libraries/io/src/processing/io/PWM.java @@ -0,0 +1,214 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Copyright (c) The Processing Foundation 2015 + Hardware I/O library developed by Gottfried Haider as part of GSoC 2015 + + 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.io; + +import processing.io.NativeInterface; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; + + +/** + * @webref + */ +public class PWM { + + int channel; + String chip; + + + /** + * Opens a PWM channel + * @param channel PWM channel + * @see list + * @webref + */ + public PWM(String channel) { + NativeInterface.loadLibrary(); + + int pos = channel.indexOf("/pwm"); + if (pos == -1) { + throw new IllegalArgumentException("Unsupported channel"); + } + chip = channel.substring(0, pos); + this.channel = Integer.parseInt(channel.substring(pos+4)); + + if (NativeInterface.isSimulated()) { + return; + } + + // export channel through sysfs + String fn = "/sys/class/pwm/" + chip + "/export"; + int ret = NativeInterface.writeFile(fn, Integer.toString(this.channel)); + if (ret < 0) { + if (ret == -2) { // ENOENT + System.err.println("Make sure your kernel is compiled with PWM_SYSFS enabled and you have the necessary PWM driver for your platform"); + } + // XXX: check + if (ret == -22) { // EINVAL + System.err.println("PWM channel " + channel + " does not seem to be available on your platform"); + } + // XXX: check + if (ret != -16) { // EBUSY, returned when the pin is already exported + throw new RuntimeException(fn + ": " + NativeInterface.getError(ret)); + } + } + + // delay to give udev a chance to change the file permissions behind our back + // there should really be a cleaner way for this + try { + Thread.sleep(500); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + + + /** + * Disables the PWM output + * @webref + */ + public void clear() { + if (NativeInterface.isSimulated()) { + return; + } + + String fn = String.format("/sys/class/pwm/%s/pwm%d/enable", chip, channel); + int ret = NativeInterface.writeFile(fn, "0"); + if (ret < 0) { + throw new RuntimeException(NativeInterface.getError(ret)); + } + } + + + /** + * Gives ownership of a channel back to the operating system + * @webref + */ + public void close() { + if (NativeInterface.isSimulated()) { + return; + } + + // XXX: implicit clear()? + // XXX: also check GPIO + + String fn = "/sys/class/pwm/" + chip + "/unexport"; + int ret = NativeInterface.writeFile(fn, Integer.toString(channel)); + if (ret < 0) { + if (ret == -2) { // ENOENT + System.err.println("Make sure your kernel is compiled with PWM_SYSFS enabled and you have the necessary PWM driver for your platform"); + } + // XXX: check + // EINVAL is also returned when trying to unexport pins that weren't exported to begin with + throw new RuntimeException(NativeInterface.getError(ret)); + } + } + + + /** + * Lists all available PWM channels + * @return String array + * @webref + */ + public static String[] list() { + if (NativeInterface.isSimulated()) { + return new String[]{ "pwmchip0/pwm0", "pwmchip0/pwm1" }; + } + + ArrayList devs = new ArrayList(); + File dir = new File("/sys/class/pwm"); + File[] chips = dir.listFiles(); + if (chips != null) { + for (File chip : chips) { + // get the number of supported channels + try { + Path path = Paths.get("/sys/class/pwm/" + chip.getName() + "/npwm"); + String tmp = new String(Files.readAllBytes(path)); + int npwm = Integer.parseInt(tmp.trim()); + for (int i=0; i < npwm; i++) { + devs.add(chip.getName() + "/pwm" + i); + } + } catch (Exception e) { + } + } + } + // listFiles() does not guarantee ordering + String[] tmp = devs.toArray(new String[devs.size()]); + Arrays.sort(tmp); + return tmp; + } + + + /** + * Enables the PWM output + * @param period cycle period in Hz + * @param duty duty cycle, 0.0 (always off) to 1.0 (always on) + * @webref + */ + public void set(int period, float duty) { + if (NativeInterface.isSimulated()) { + return; + } + + // set period + String fn = fn = String.format("/sys/class/pwm/%s/pwm%d/period", chip, channel); + // convert to nanoseconds + int ret = NativeInterface.writeFile(fn, String.format("%d", (int)(1000000000 / period))); + if (ret < 0) { + throw new RuntimeException(fn + ": " + NativeInterface.getError(ret)); + } + + // set duty cycle + fn = fn = String.format("/sys/class/pwm/%s/pwm%d/duty_cycle", chip, channel); + if (duty < 0.0 || 1.0 < duty) { + System.err.println("Duty cycle must be between 0.0 and 1.0."); + throw new IllegalArgumentException("Illegal argument"); + } + // convert to nanoseconds + ret = NativeInterface.writeFile(fn, String.format("%d", (int)((1000000000 * duty) / period))); + if (ret < 0) { + throw new RuntimeException(fn + ": " + NativeInterface.getError(ret)); + } + + // enable output + fn = String.format("/sys/class/pwm/%s/pwm%d/enable", chip, channel); + ret = NativeInterface.writeFile(fn, "1"); + if (ret < 0) { + throw new RuntimeException(fn + ": " + NativeInterface.getError(ret)); + } + } + + + /** + * Enables the PWM output with a preset period of 1 kHz + * @webref + */ + public void set(float duty) { + set(1000, duty); + } +} diff --git a/java/libraries/io/src/processing/io/SPI.java b/java/libraries/io/src/processing/io/SPI.java new file mode 100644 index 0000000000..b1a8369eac --- /dev/null +++ b/java/libraries/io/src/processing/io/SPI.java @@ -0,0 +1,226 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Copyright (c) The Processing Foundation 2015 + Hardware I/O library developed by Gottfried Haider as part of GSoC 2015 + + 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.io; + +import processing.io.NativeInterface; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + + +/** + * @webref + */ +public class SPI { + + /** + * CPOL=0, CPHA=0, most common + */ + public static final int MODE0 = 0; + /** + * CPOL=0, CPHA=1 + */ + public static final int MODE1 = 1; + /** + * CPOL=1, CPHA=0 + */ + public static final int MODE2 = 2; + /** + * CPOL=1, CPHA=1 + */ + public static final int MODE3 = 3; + /** + * most significant bit first, most common + */ + public static final int MSBFIRST = 0; + /** + * least significant bit first + */ + public static final int LSBFIRST = 1; + + protected int dataOrder = 0; + protected String dev; + protected int handle; + protected int maxSpeed = 500000; + protected int mode = 0; + protected static Map settings = new HashMap(); + + + /** + * Opens an SPI interface as master + * @param dev device name + * @see list + * @webref + */ + public SPI(String dev) { + NativeInterface.loadLibrary(); + this.dev = dev; + + if (NativeInterface.isSimulated()) { + return; + } + + handle = NativeInterface.openDevice("/dev/" + dev); + if (handle < 0) { + throw new RuntimeException(NativeInterface.getError(handle)); + } + } + + + /** + * Closes the SPI interface + * @webref + */ + public void close() { + if (NativeInterface.isSimulated()) { + return; + } + + NativeInterface.closeDevice(handle); + handle = 0; + } + + + protected void finalize() throws Throwable { + try { + close(); + } finally { + super.finalize(); + } + } + + + /** + * Lists all available SPI interfaces + * @return String array + * @webref + */ + public static String[] list() { + if (NativeInterface.isSimulated()) { + // as on the Raspberry Pi + return new String[]{ "spidev0.0", "spidev0.1" }; + } + + ArrayList devs = new ArrayList(); + File dir = new File("/dev"); + File[] files = dir.listFiles(); + if (files != null) { + for (File file : files) { + if (file.getName().startsWith("spidev")) { + devs.add(file.getName()); + } + } + } + // listFiles() does not guarantee ordering + String[] tmp = devs.toArray(new String[devs.size()]); + Arrays.sort(tmp); + return tmp; + } + + + /** + * Configures the SPI interface + * @param maxSpeed maximum transmission rate in Hz, 500000 (500 kHz) is a resonable default + * @param dataOrder whether data is send with the first- or least-significant bit first (SPI.MSBFIRST or SPI.LSBFIRST, the former is more common) + * @param mode SPI.MODE0 to SPI.MODE3 + * @webref + */ + public void settings(int maxSpeed, int dataOrder, int mode) { + this.maxSpeed = maxSpeed; + this.dataOrder = dataOrder; + this.mode = mode; + } + + + /** + * Transfers data over the SPI bus + * @param out bytes to send + * @return bytes read in (array is the same length as out) + * @webref + */ + public byte[] transfer(byte[] out) { + if (NativeInterface.isSimulated()) { + return new byte[out.length]; + } + + // track the current setting per device across multiple instances + String curSettings = maxSpeed + "-" + dataOrder + "-" + mode; + if (!curSettings.equals(settings.get(dev))) { + int ret = NativeInterface.setSpiSettings(handle, maxSpeed, dataOrder, mode); + if (ret < 0) { + System.err.println(NativeInterface.getError(handle)); + throw new RuntimeException("Error updating device configuration"); + } + settings.put(dev, curSettings); + } + + byte[] in = new byte[out.length]; + int transferred = NativeInterface.transferSpi(handle, out, in); + if (transferred < 0) { + throw new RuntimeException(NativeInterface.getError(transferred)); + } else if (transferred < out.length) { + throw new RuntimeException("Fewer bytes transferred than requested: " + transferred); + } + return in; + } + + + /** + * Transfers data over the SPI bus + * @param out string to send + * @return bytes read in (array is the same length as out) + */ + public byte[] transfer(String out) { + return transfer(out.getBytes()); + } + + + /** + * Transfers data over the SPI bus + * @param out single byte to send, e.g. numeric literal (0 to 255, or -128 to 127) + * @return bytes read in (array is the same length as out) + */ + public byte[] transfer(int out) { + if (out < -128 || 255 < out) { + System.err.println("The transfer function can only operate on a single byte at a time. Call it with a value from 0 to 255, or -128 to 127."); + throw new RuntimeException("Argument does not fit into a single byte"); + } + byte[] tmp = new byte[1]; + tmp[0] = (byte)out; + return transfer(tmp); + } + + + /** + * Transfers data over the SPI bus + * @param out single byte to send + * @return bytes read in (array is the same length as out) + */ + public byte[] transfer(byte out) { + // cast to (unsigned) int + return transfer(out & 0xff); + } +} diff --git a/java/libraries/io/src/processing/io/SoftwareServo.java b/java/libraries/io/src/processing/io/SoftwareServo.java new file mode 100644 index 0000000000..db5cbdcbef --- /dev/null +++ b/java/libraries/io/src/processing/io/SoftwareServo.java @@ -0,0 +1,162 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Copyright (c) The Processing Foundation 2015 + Hardware I/O library developed by Gottfried Haider + + 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.io; + +import processing.core.*; + + +/** + * @webref + */ +public class SoftwareServo { + + public static final int DEFAULT_MIN_PULSE = 544; + public static final int DEFAULT_MAX_PULSE = 2400; + + protected int pin = -1; // gpio number (-1 .. not attached) + protected long handle = -1; // native thread id (<0 .. not started) + protected int period = 20000; // 20 ms (50 Hz) + protected int minPulse = 0; // minimum pulse width in microseconds + protected int maxPulse = 0; // maximum pulse width in microseconds + protected int pulse = 0; // current pulse in microseconds + + + /** + * Opens a servo motor + * @param parent typically use "this" + * @webref + */ + public SoftwareServo(PApplet parent) { + NativeInterface.loadLibrary(); + } + + + /** + * Closes a servo motor + * @webref + */ + public void close() { + detach(); + } + + + protected void finalize() throws Throwable { + try { + close(); + } finally { + super.finalize(); + } + } + + + /** + * Attaches a servo motor to a GPIO pin + * @param pin GPIO pin + * @webref + */ + public void attach(int pin) { + detach(); + this.pin = pin; + this.minPulse = DEFAULT_MIN_PULSE; + this.maxPulse = DEFAULT_MAX_PULSE; + } + + + /** + * Attaches a servo motor to a GPIO pin using custom pulse widths + * @param minPulse minimum pulse width in microseconds (default: 544, same as on Arduino) + * @param maxPulse maximum pulse width in microseconds (default: 2400, same as on Arduino) + * @webref + */ + public void attach(int pin, int minPulse, int maxPulse) { + detach(); + this.pin = pin; + this.minPulse = minPulse; + this.maxPulse = maxPulse; + } + + + /** + * Moves a servo motor to a given orientation + * @param angle angle in degrees (controls speed and direction on continuous-rotation servos) + * @webref + */ + public void write(float angle) { + if (attached() == false) { + System.err.println("You need to call attach(pin) before write(angle)."); + throw new RuntimeException("Servo is not attached"); + } + + if (angle < 0 || 180 < angle) { + System.err.println("Only degree values between 0 and 180 can be used."); + throw new IllegalArgumentException("Illegal value"); + } + pulse = (int)(minPulse + (angle/180.0) * (maxPulse-minPulse)); + + if (handle < 0) { + // start a new thread + GPIO.pinMode(pin, GPIO.OUTPUT); + if (NativeInterface.isSimulated()) { + return; + } + handle = NativeInterface.servoStartThread(pin, pulse, period); + if (handle < 0) { + throw new RuntimeException(NativeInterface.getError((int)handle)); + } + } else { + // thread already running + int ret = NativeInterface.servoUpdateThread(handle, pulse, period); + if (ret < 0) { + throw new RuntimeException(NativeInterface.getError(ret)); + } + } + } + + + /** + * Returns whether a servo motor is attached to a pin + * @return true if attached, false is not + * @webref + */ + public boolean attached() { + return (pin != -1); + } + + + /** + * Detatches a servo motor from a GPIO pin + * @webref + */ + public void detach() { + if (0 <= handle) { + // stop thread + int ret = NativeInterface.servoStopThread(handle); + GPIO.pinMode(pin, GPIO.INPUT); + handle = -1; + pin = -1; + if (ret < 0) { + throw new RuntimeException(NativeInterface.getError(ret)); + } + } + } +} diff --git a/java/libraries/net/.settings/org.eclipse.jdt.core.prefs b/java/libraries/net/.settings/org.eclipse.jdt.core.prefs index a11eccb8d4..ac3ca93e5c 100644 --- a/java/libraries/net/.settings/org.eclipse.jdt.core.prefs +++ b/java/libraries/net/.settings/org.eclipse.jdt.core.prefs @@ -1,15 +1,22 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false +org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false +org.eclipse.jdt.core.formatter.align_with_spaces=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 @@ -18,24 +25,39 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=36 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 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_relational_operator=0 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 +org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=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 @@ -44,6 +66,7 @@ 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_statement_group_in_switch=0 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 @@ -53,34 +76,40 @@ 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_lambda_body=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.align_tags_descriptions_grouped=false +org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false 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.count_line_length_from_starting_position=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=false +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.indent_tag_description=false org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=1 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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 @@ -93,6 +122,7 @@ 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_annotation_on_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert @@ -102,6 +132,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=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 @@ -115,11 +146,15 @@ 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_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=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_bitwise_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 @@ -146,9 +181,14 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declar 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_switch_case_expressions=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_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_not_operator=do not 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 @@ -173,13 +213,20 @@ 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_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=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_bitwise_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 @@ -223,9 +270,13 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_decla 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_switch_case_expressions=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_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=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 @@ -262,9 +313,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser 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_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=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 @@ -276,20 +330,59 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_decla org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never 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_enum_constant_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false +org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.lineSplit=80 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines 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.text_block_indentation=0 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true +org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true +org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/java/libraries/net/.settings/org.eclipse.jdt.ui.prefs b/java/libraries/net/.settings/org.eclipse.jdt.ui.prefs index 7f5ba1ed84..66aaa0890e 100644 --- a/java/libraries/net/.settings/org.eclipse.jdt.ui.prefs +++ b/java/libraries/net/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,3 @@ eclipse.preferences.version=1 formatter_profile=_processing -formatter_settings_version=12 +formatter_settings_version=18 diff --git a/java/libraries/net/build.xml b/java/libraries/net/build.xml index ccf7f14402..9ee83b9d5d 100644 --- a/java/libraries/net/build.xml +++ b/java/libraries/net/build.xml @@ -13,8 +13,8 @@ - freeBack) { + // not enough space at the back + int bufferLength = bufferLast - bufferIndex; + byte[] targetBuffer = buffer; + if (bufferLength + readCount > buffer.length) { + // can't fit even after compacting, resize the buffer + // find the next power of two which can fit everything in + int newSize = Integer.highestOneBit(bufferLength + readCount - 1) << 1; + if (newSize > MAX_BUFFER_SIZE) { + // buffer is full because client is not reading (fast enough) + System.err.println("Client: can't receive more data, buffer is full. " + + "Make sure you read the data from the client."); + stop(); + return; + } + targetBuffer = new byte[newSize]; + } + // compact the buffer (either in-place or into the new bigger buffer) + System.arraycopy(buffer, bufferIndex, targetBuffer, 0, bufferLength); + bufferLast -= bufferIndex; + bufferIndex = 0; + buffer = targetBuffer; } - buffer[bufferLast++] = (byte)value; + // copy all newly read bytes into the buffer + System.arraycopy(readBuffer, 0, buffer, bufferLast, readCount); + bufferLast += readCount; } // now post an event if (clientEventMethod != null) { try { - clientEventMethod.invoke(parent, new Object[] { this }); - } catch (Exception e) { - System.err.println("error, disabling clientEvent() for " + host); - e.printStackTrace(); - clientEventMethod = null; + clientEventMethod.invoke(parent, this); + } catch (Exception e) { + System.err.println("error, disabling clientEvent() for " + host); + Throwable cause = e; + // unwrap the exception if it came from the user code + if (e instanceof InvocationTargetException && e.getCause() != null) { + cause = e.getCause(); + } + cause.printStackTrace(); + clientEventMethod = null; } } } @@ -261,8 +306,15 @@ public void run() { /** - * Return true if this client is still active and hasn't run + * ( begin auto-generated from Client_active.xml ) + * + * Returns true if this client is still active and hasn't run * into any trouble. + * + * ( end auto-generated ) + * @webref client:client + * @brief Returns true if this client is still active + * @usage application */ public boolean active() { return (thread != null); @@ -299,7 +351,9 @@ public String ip() { * @brief Returns the number of bytes in the buffer waiting to be read */ public int available() { - return (bufferLast - bufferIndex); + synchronized (bufferLock) { + return (bufferLast - bufferIndex); + } } @@ -314,8 +368,10 @@ public int available() { * @brief Clears the buffer */ public void clear() { - bufferLast = 0; - bufferIndex = 0; + synchronized (bufferLock) { + bufferLast = 0; + bufferIndex = 0; + } } @@ -332,9 +388,9 @@ public void clear() { * @brief Returns a value from the buffer */ public int read() { - if (bufferIndex == bufferLast) return -1; + synchronized (bufferLock) { + if (bufferIndex == bufferLast) return -1; - synchronized (buffer) { int outgoing = buffer[bufferIndex++] & 0xff; if (bufferIndex == bufferLast) { // rewind bufferIndex = 0; @@ -357,8 +413,10 @@ public int read() { * @brief Returns the next byte in the buffer as a char */ public char readChar() { - if (bufferIndex == bufferLast) return (char)(-1); - return (char) read(); + synchronized (bufferLock) { + if (bufferIndex == bufferLast) return (char) (-1); + return (char) read(); + } } @@ -385,9 +443,9 @@ public char readChar() { * @brief Reads everything in the buffer */ public byte[] readBytes() { - if (bufferIndex == bufferLast) return null; + synchronized (bufferLock) { + if (bufferIndex == bufferLast) return null; - synchronized (buffer) { int length = bufferLast - bufferIndex; byte outgoing[] = new byte[length]; System.arraycopy(buffer, bufferIndex, outgoing, 0, length); @@ -399,6 +457,36 @@ public byte[] readBytes() { } + /** + *

    Advanced

    + * Return a byte array of anything that's in the serial buffer + * up to the specified maximum number of bytes. + * 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). + * + * @param max the maximum number of bytes to read + */ + public byte[] readBytes(int max) { + synchronized (bufferLock) { + if (bufferIndex == bufferLast) return null; + + int length = bufferLast - bufferIndex; + if (length > max) length = max; + byte outgoing[] = new byte[length]; + System.arraycopy(buffer, bufferIndex, outgoing, 0, length); + + bufferIndex += length; + if (bufferIndex == bufferLast) { + bufferIndex = 0; // rewind + bufferLast = 0; + } + + return outgoing; + } + } + + /** *

    Advanced

    * Grab whatever is in the serial buffer, and stuff it into a @@ -412,9 +500,9 @@ public byte[] readBytes() { * @param bytebuffer passed in byte array to be altered */ public int readBytes(byte bytebuffer[]) { - if (bufferIndex == bufferLast) return 0; + synchronized (bufferLock) { + if (bufferIndex == bufferLast) return 0; - synchronized (buffer) { int length = bufferLast - bufferIndex; if (length > bytebuffer.length) length = bytebuffer.length; System.arraycopy(buffer, bufferIndex, bytebuffer, 0, length); @@ -450,10 +538,11 @@ public int readBytes(byte bytebuffer[]) { * @param interesting character designated to mark the end of the data */ public byte[] readBytesUntil(int interesting) { - if (bufferIndex == bufferLast) return null; byte what = (byte)interesting; - synchronized (buffer) { + synchronized (bufferLock) { + if (bufferIndex == bufferLast) return null; + int found = -1; for (int k = bufferIndex; k < bufferLast; k++) { if (buffer[k] == what) { @@ -491,10 +580,11 @@ public byte[] readBytesUntil(int interesting) { * @param byteBuffer passed in byte array to be altered */ public int readBytesUntil(int interesting, byte byteBuffer[]) { - if (bufferIndex == bufferLast) return 0; byte what = (byte)interesting; - synchronized (buffer) { + synchronized (bufferLock) { + if (bufferIndex == bufferLast) return 0; + int found = -1; for (int k = bufferIndex; k < bufferLast; k++) { if (buffer[k] == what) { @@ -539,8 +629,9 @@ public int readBytesUntil(int interesting, byte byteBuffer[]) { * @brief Returns the buffer as a String */ public String readString() { - if (bufferIndex == bufferLast) return null; - return new String(readBytes()); + byte b[] = readBytes(); + if (b == null) return null; + return new String(b); } diff --git a/java/libraries/net/src/processing/net/Server.java b/java/libraries/net/src/processing/net/Server.java index 8edc6cd9c1..61a877202a 100644 --- a/java/libraries/net/src/processing/net/Server.java +++ b/java/libraries/net/src/processing/net/Server.java @@ -52,10 +52,11 @@ public class Server implements Runnable { PApplet parent; Method serverEventMethod; - Thread thread; + volatile Thread thread; ServerSocket server; int port; - + + protected final Object clientsLock = new Object[0]; /** Number of clients currently connected. */ public int clientCount; /** Array of client objects, useful length is determined by clientCount. */ @@ -72,8 +73,6 @@ public Server(PApplet parent, int port) { /** - * @param parent typically use "this" - * @param port port used to transfer data * @param host when multiple NICs are in use, the ip (or name) to bind from */ public Server(PApplet parent, int port, String host) { @@ -99,9 +98,7 @@ public Server(PApplet parent, int port, String host) { // which is called when a new guy connects try { serverEventMethod = - parent.getClass().getMethod("serverEvent", - new Class[] { Server.class, - Client.class }); + parent.getClass().getMethod("serverEvent", Server.class, Client.class); } catch (Exception e) { // no such method, or an error.. which is fine, just ignore } @@ -127,26 +124,30 @@ public Server(PApplet parent, int port, String host) { */ public void disconnect(Client client) { client.stop(); - int index = clientIndex(client); - if (index != -1) { - removeIndex(index); + synchronized (clientsLock) { + int index = clientIndex(client); + if (index != -1) { + removeIndex(index); + } } } protected void removeIndex(int index) { - clientCount--; - // shift down the remaining clients - for (int i = index; i < clientCount; i++) { - clients[i] = clients[i+1]; + synchronized (clientsLock) { + clientCount--; + // shift down the remaining clients + for (int i = index; i < clientCount; i++) { + clients[i] = clients[i + 1]; + } + // mark last empty var for garbage collection + clients[clientCount] = null; } - // mark last empty var for garbage collection - clients[clientCount] = null; } protected void disconnectAll() { - synchronized (clients) { + synchronized (clientsLock) { for (int i = 0; i < clientCount; i++) { try { clients[i].stop(); @@ -161,26 +162,36 @@ protected void disconnectAll() { protected void addClient(Client client) { - if (clientCount == clients.length) { - clients = (Client[]) PApplet.expand(clients); + synchronized (clientsLock) { + if (clientCount == clients.length) { + clients = (Client[]) PApplet.expand(clients); + } + clients[clientCount++] = client; } - clients[clientCount++] = client; } protected int clientIndex(Client client) { - for (int i = 0; i < clientCount; i++) { - if (clients[i] == client) { - return i; + synchronized (clientsLock) { + for (int i = 0; i < clientCount; i++) { + if (clients[i] == client) { + return i; + } } + return -1; } - return -1; } /** - * Return true if this server is still active and hasn't run + * ( begin auto-generated from Server_active.xml ) + * + * Returns true if this server is still active and hasn't run * into any trouble. + * + * ( end auto-generated ) + * @webref server:server + * @brief Return true if this server is still active. */ public boolean active() { return thread != null; @@ -213,7 +224,7 @@ static public String ip() { * @usage application */ public Client available() { - synchronized (clients) { + synchronized (clientsLock) { int index = lastAvailable + 1; if (index >= clientCount) index = 0; @@ -282,19 +293,25 @@ public void dispose() { } + @Override public void run() { while (Thread.currentThread() == thread) { try { Socket socket = server.accept(); Client client = new Client(parent, socket); - synchronized (clients) { + synchronized (clientsLock) { addClient(client); if (serverEventMethod != null) { try { - serverEventMethod.invoke(parent, new Object[] { this, client }); + serverEventMethod.invoke(parent, this, client); } catch (Exception e) { System.err.println("Disabling serverEvent() for port " + port); - e.printStackTrace(); + Throwable cause = e; + // unwrap the exception if it came from the user code + if (e instanceof InvocationTargetException && e.getCause() != null) { + cause = e.getCause(); + } + cause.printStackTrace(); serverEventMethod = null; } } @@ -308,9 +325,6 @@ public void run() { e.printStackTrace(); thread = null; } - try { - Thread.sleep(8); - } catch (InterruptedException ex) { } } } @@ -327,39 +341,45 @@ public void run() { * @param data data to write */ public void write(int data) { // will also cover char - int index = 0; - while (index < clientCount) { - if (clients[index].active()) { - clients[index].write(data); - index++; - } else { - removeIndex(index); + synchronized (clientsLock) { + int index = 0; + while (index < clientCount) { + if (clients[index].active()) { + clients[index].write(data); + index++; + } else { + removeIndex(index); + } } } } public void write(byte data[]) { - int index = 0; - while (index < clientCount) { - if (clients[index].active()) { - clients[index].write(data); - index++; - } else { - removeIndex(index); + synchronized (clientsLock) { + int index = 0; + while (index < clientCount) { + if (clients[index].active()) { + clients[index].write(data); + index++; + } else { + removeIndex(index); + } } } } public void write(String data) { - int index = 0; - while (index < clientCount) { - if (clients[index].active()) { - clients[index].write(data); - index++; - } else { - removeIndex(index); + synchronized (clientsLock) { + int index = 0; + while (index < clientCount) { + if (clients[index].active()) { + clients[index].write(data); + index++; + } else { + removeIndex(index); + } } } } diff --git a/java/libraries/pdf/.settings/org.eclipse.jdt.core.prefs b/java/libraries/pdf/.settings/org.eclipse.jdt.core.prefs index f3b4e11d65..02a284792f 100644 --- a/java/libraries/pdf/.settings/org.eclipse.jdt.core.prefs +++ b/java/libraries/pdf/.settings/org.eclipse.jdt.core.prefs @@ -1,15 +1,22 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false +org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false +org.eclipse.jdt.core.formatter.align_with_spaces=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 @@ -18,24 +25,39 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=36 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 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_relational_operator=0 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 +org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=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 @@ -44,6 +66,7 @@ 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_statement_group_in_switch=0 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 @@ -53,32 +76,38 @@ 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_lambda_body=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.align_tags_descriptions_grouped=false +org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=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.count_line_length_from_starting_position=false org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_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.indent_tag_description=false org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=1 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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 @@ -90,6 +119,7 @@ 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_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert @@ -99,6 +129,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=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 @@ -112,11 +143,15 @@ 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_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=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_bitwise_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 @@ -143,9 +178,14 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declar 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_switch_case_expressions=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_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_not_operator=do not 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 @@ -170,13 +210,20 @@ 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_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=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_bitwise_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 @@ -220,9 +267,13 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_decla 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_switch_case_expressions=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_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=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 @@ -259,9 +310,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser 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_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=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 @@ -273,20 +327,59 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_decla org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never 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_enum_constant_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false +org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.lineSplit=80 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines 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.text_block_indentation=0 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true +org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true +org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/java/libraries/pdf/.settings/org.eclipse.jdt.ui.prefs b/java/libraries/pdf/.settings/org.eclipse.jdt.ui.prefs index 0d6ea5b9dd..24dec57837 100644 --- a/java/libraries/pdf/.settings/org.eclipse.jdt.ui.prefs +++ b/java/libraries/pdf/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,4 @@ eclipse.preferences.version=1 formatter_profile=_processing -formatter_settings_version=12 +formatter_settings_version=18 org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/java/libraries/pdf/build.xml b/java/libraries/pdf/build.xml index fbff90478b..13a472c60a 100644 --- a/java/libraries/pdf/build.xml +++ b/java/libraries/pdf/build.xml @@ -13,8 +13,8 @@ - - getProperties(String portName) { return SerialPortList.getPortProperties(portName); } + /** + * @generate Serial_last.xml + *

    Advanced

    + * 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. + * @webref serial:serial + * @usage web_application + */ public int last() { if (inBuffer == readOffset) { return -1; @@ -218,19 +277,34 @@ public int last() { } } - + + /** + * @generate Serial_lastChar.xml + * @webref serial:serial + * @usage web_application + */ public char lastChar() { return (char)last(); } - + + /** + * @generate Serial_list.xml + * @webref serial + * @usage web_application + */ public static String[] list() { // returns list sorted alphabetically, thus cu.* comes before tty.* // this was different with RXTX return SerialPortList.getPortNames(); } - + + /** + * @generate Serial_read.xml + * @webref serial:serial + * @usage web_application + */ public int read() { if (inBuffer == readOffset) { return -1; @@ -246,7 +320,12 @@ public int read() { } } - + + /** + * @generate Serial_readBytes.xml + * @webref serial:serial + * @usage web_application + */ public byte[] readBytes() { if (inBuffer == readOffset) { return null; @@ -262,6 +341,47 @@ public byte[] readBytes() { } + /** + *

    Advanced

    + * Return a byte array of anything that's in the serial buffer + * up to the specified maximum number of bytes. + * 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). + * + * @param max the maximum number of bytes to read + */ + public byte[] readBytes(int max) { + if (inBuffer == readOffset) { + return null; + } + + synchronized (buffer) { + int length = inBuffer - readOffset; + if (length > max) length = max; + byte[] ret = new byte[length]; + System.arraycopy(buffer, readOffset, ret, 0, length); + + readOffset += length; + if (inBuffer == readOffset) { + inBuffer = 0; + readOffset = 0; + } + return ret; + } + } + + + /** + *

    Advanced

    + * 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[] dest) { if (inBuffer == readOffset) { return 0; @@ -283,6 +403,12 @@ public int readBytes(byte[] dest) { } + /** + * @generate Serial_readBytesUntil.xml + * @webref serial:serial + * @usage web_application + * @param inByte character designated to mark the end of the data + */ public byte[] readBytesUntil(int inByte) { if (inBuffer == readOffset) { return null; @@ -313,7 +439,15 @@ public byte[] readBytesUntil(int inByte) { } } - + + /** + *

    Advanced

    + * If dest[] 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. + * @param dest passed in byte array to be altered + */ public int readBytesUntil(int inByte, byte[] dest) { if (inBuffer == readOffset) { return 0; @@ -350,12 +484,22 @@ public int readBytesUntil(int inByte, byte[] dest) { } } - + + /** + * @generate Serial_readChar.xml + * @webref serial:serial + * @usage web_application + */ public char readChar() { return (char) read(); } - + + /** + * @generate Serial_readString.xml + * @webref serial:serial + * @usage web_application + */ public String readString() { if (inBuffer == readOffset) { return null; @@ -363,7 +507,18 @@ public String readString() { return new String(readBytes()); } - + + /** + * @generate Serial_readStringUntil.xml + *

    Advanced

    + * 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. + * + * @webref serial:serial + * @usage web_application + * @param inByte character designated to mark the end of the data + */ public String readStringUntil(int inByte) { byte temp[] = readBytesUntil(inByte); if (temp == null) { @@ -374,6 +529,12 @@ public String readStringUntil(int inByte) { } + /** + * @generate serialEvent.xml + * @webref serial:events + * @usage web_application + * @param event the port where new data is available + */ public void serialEvent(SerialPortEvent event) { if (event.getEventType() == SerialPortEvent.RXCHAR) { int toRead; @@ -423,7 +584,10 @@ public void serialEvent(SerialPortEvent event) { } } - + + /** + * Set the DTR line + */ public void setDTR(boolean state) { // there is no way to influence the behavior of the DTR line when opening the serial port // this means that at least on Linux and OS X, Arduino devices are always reset @@ -434,7 +598,10 @@ public void setDTR(boolean state) { } } - + + /** + * Set the RTS line + */ public void setRTS(boolean state) { try { port.setRTS(state); @@ -443,7 +610,12 @@ public void setRTS(boolean state) { } } - + + /** + * @generate Serial_stop.xml + * @webref serial:serial + * @usage web_application + */ public void stop() { try { port.closePort(); @@ -454,7 +626,10 @@ public void stop() { readOffset = 0; } - + + /** + * @param src data to write + */ public void write(byte[] src) { try { // this might block if the serial device is not yet ready (esp. tty devices under OS X) @@ -465,7 +640,12 @@ public void write(byte[] src) { } } - + + /** + *

    Advanced

    + * This will handle both ints, bytes and chars transparently. + * @param src data to write + */ public void write(int src) { try { port.writeInt(src); @@ -474,7 +654,25 @@ public void write(int src) { } } - + + /** + * @generate Serial_write.xml + *

    Advanced

    + * 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. + * + * @webref serial:serial + * @usage web_application + * @param src data to write + */ public void write(String src) { try { port.writeString(src); diff --git a/java/libraries/svg/build.xml b/java/libraries/svg/build.xml index e75f87dd76..54cd9c2075 100644 --- a/java/libraries/svg/build.xml +++ b/java/libraries/svg/build.xml @@ -13,8 +13,8 @@ - (); - ifWhileForFlags = new Stack(); + doWhileFlags = new Stack<>(); + ifWhileForFlags = new Stack<>(); chars = cleanText.toCharArray(); @@ -587,6 +589,7 @@ public String format(final String source) { break; } + // In a simple enum, there's not necessarily a `;` to end the statement. inStatementFlag = false; curlyLvl--; @@ -606,6 +609,7 @@ public String format(final String source) { trimRight(result); result.append('\n'); + overflowFlag = false; // Would normally be done in writeIndentedLine. printIndentation(); result.append(c); if (peek() == ';') result.append(nextChar()); @@ -637,25 +641,48 @@ public String format(final String source) { break; case '"': + case '“': + case '”': case '\'': + case '‘': + case '’': inStatementFlag = true; - buf.append(c); + char realQuote = c; + if (c == '“' || c == '”') realQuote = '"'; + if (c == '‘' || c == '’') realQuote = '\''; + buf.append(realQuote); + + char otherQuote = c; + if (c == '“') otherQuote = '”'; + if (c == '”') otherQuote = '“'; + if (c == '‘') otherQuote = '’'; + if (c == '’') otherQuote = '‘'; + char cc = nextChar(); - while (!EOF && cc != c) { + // In a proper string, all the quotes tested are c. In a curly-quoted + // string, there are three possible end quotes: c, its reverse, and + // the correct straight quote. + while (!EOF && cc != otherQuote && cc != realQuote && cc != c) { buf.append(cc); if (cc == '\\') { buf.append(cc = nextChar()); } - if (cc == '\n') { - writeIndentedLine(); - startFlag = true; - } + + // Syntax error: unterminated string. Leave \n in nextChar, so it + // feeds back into the loop. + if (peek() == '\n') break; cc = nextChar(); } - buf.append(cc); - if (readForNewLine()) { - // push a newline into the stream - chars[pos--] = '\n'; + if (cc == otherQuote || cc == realQuote || cc == c) { + buf.append(realQuote); + if (readForNewLine()) { + // push a newline into the stream + chars[pos--] = '\n'; + } + } else { + // We've had a syntax error if the string wasn't terminated by EOL/ + // EOF, just abandon this statement. + inStatementFlag = false; } break; @@ -728,10 +755,14 @@ else if (forFlag) { inStatementFlag = false; arrayLevel = -1; // Unlikely to be needed; just in case. - //Same format for case, default, and other labels. - tabs--; - writeIndentedLine(); - tabs++; + // Same format for case, default, and other labels. + if (tabs > 0) { + tabs--; + writeIndentedLine(); + tabs++; + } else { + writeIndentedLine(); + } readForNewLine(); writeIndentedLine(); diff --git a/java/src/processing/mode/java/Commander.java b/java/src/processing/mode/java/Commander.java index 83c2f8bc17..8cb7c1c478 100644 --- a/java/src/processing/mode/java/Commander.java +++ b/java/src/processing/mode/java/Commander.java @@ -101,12 +101,19 @@ public Commander(String[] args) { int task = HELP; boolean embedJava = true; - // Turns out the output goes as MacRoman or something else useless. - // http://code.google.com/p/processing/issues/detail?id=1418 try { - systemOut = new PrintStream(System.out, true, "UTF-8"); - systemErr = new PrintStream(System.err, true, "UTF-8"); - + if (Platform.isWindows()) { + // On Windows, it needs to use the default system encoding. + // https://github.com/processing/processing/issues/1633 + systemOut = new PrintStream(System.out, true); + systemErr = new PrintStream(System.err, true); + } else { + // On OS X, the output goes as MacRoman or something else useless. + // http://code.google.com/p/processing/issues/detail?id=1418 + // (Not sure about Linux, but this has worked since 2.0) + systemOut = new PrintStream(System.out, true, "UTF-8"); + systemErr = new PrintStream(System.err, true, "UTF-8"); + } } catch (UnsupportedEncodingException e) { e.printStackTrace(); System.exit(1); @@ -387,7 +394,7 @@ static void printCommandLine(PrintStream out) { // out.println(" Otherwise specify 0 or leave it out."); out.println(); - out.println("The --build, --run, --present, or --export will be the final parameter"); + out.println("The --build, --run, --present, or --export must be the final parameter"); out.println("passed to Processing. Arguments passed following one of those four will"); out.println("be passed through to the sketch itself, and therefore available to the"); out.println("sketch via the 'args' field. To pass options understood by PApplet.main(),"); diff --git a/java/src/processing/mode/java/Compiler.java b/java/src/processing/mode/java/Compiler.java index c62b4c000a..cfe9eb97d9 100644 --- a/java/src/processing/mode/java/Compiler.java +++ b/java/src/processing/mode/java/Compiler.java @@ -39,7 +39,7 @@ public class Compiler { static HashMap importSuggestions; static { - importSuggestions = new HashMap(); + importSuggestions = new HashMap<>(); importSuggestions.put("Arrays", "java.util.Arrays"); importSuggestions.put("Collections", "java.util.Collections"); importSuggestions.put("Date", "java.util.Date"); @@ -54,7 +54,7 @@ public class Compiler { * @param sketch Sketch object to be compiled, used for placing exceptions * @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. + * @throws SketchException Only if there's a problem. Only then. */ static public boolean compile(JavaBuild build) throws SketchException { @@ -68,6 +68,7 @@ static public boolean compile(JavaBuild build) throws SketchException { //"-noExit", // not necessary for ecj "-source", "1.7", "-target", "1.7", + "-encoding", "utf8", "-classpath", build.getClassPath(), "-nowarn", // we're not currently interested in warnings (works in ecj) "-d", build.getBinFolder().getAbsolutePath() // output the classes in the buildPath @@ -166,6 +167,8 @@ public void close() { } exception = new SketchException(errorMessage); } + String[] parts = null; + if (errorMessage.startsWith("The import ") && errorMessage.endsWith("cannot be resolved")) { // The import poo cannot be resolved @@ -188,7 +191,8 @@ public void close() { } "You might be missing a library."); System.err.println("Libraries must be " + "installed in a folder named 'libraries' " + - "inside the 'sketchbook' folder."); + "inside the sketchbook folder " + + "(see the Preferences window)."); } } @@ -211,8 +215,8 @@ public void close() { } String suggestion = importSuggestions.get(what); if (suggestion != null) { System.err.println("You may need to add \"import " + suggestion + ";\" to the top of your sketch."); - System.err.println("To make sketches more portable, imports that are not part of the Processing API have been removed from Processing 2.0."); - System.err.println("See the changes page for more information: http://wiki.processing.org/w/Changes"); + System.err.println("To make sketches more portable, imports that are not part of the Processing API were removed in Processing 2."); + System.err.println("See the changes page for more information: https://github.com/processing/processing/wiki/Changes"); } } @@ -252,9 +256,18 @@ public void close() { } // "Duplicate nested type xxx" // "Duplicate local variable xxx" + } else if (null != (parts = PApplet.match(errorMessage, + "literal (\\S*) of type (\\S*) is out of range"))) { + if ("int".equals(parts[2])) { + exception.setMessage("The type int can't handle numbers that big. Try " + + parts[1] + "L to upgrade to long."); + } else { + // I'd like to give an essay on BigInteger and BigDecimal, but + // this margin is too narrow to contain it. + exception.setMessage("Even the type " + parts[2] + " can't handle " + + parts[1] + ". Research big numbers in Java."); + } } 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 diff --git a/java/src/processing/mode/java/Debugger.java b/java/src/processing/mode/java/Debugger.java index 9f79a1fee3..7b37a96f96 100644 --- a/java/src/processing/mode/java/Debugger.java +++ b/java/src/processing/mode/java/Debugger.java @@ -2,7 +2,8 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2012-15 The Processing Foundation + + Copyright (c) 2012-19 The Processing Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 @@ -29,25 +30,24 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.swing.JTree; // needed for javadocs import javax.swing.tree.DefaultMutableTreeNode; +import processing.app.Messages; +import processing.app.RunnerListenerEdtAdapter; import processing.app.Sketch; import processing.app.SketchCode; import processing.mode.java.debug.*; -import processing.mode.java.pdex.VMEventListener; -import processing.mode.java.pdex.VMEventReader; import processing.mode.java.runner.Runner; -public class Debugger implements VMEventListener { +public class Debugger { /// editor window, acting as main view protected JavaEditor editor; @@ -71,28 +71,28 @@ public class Debugger implements VMEventListener { protected ReferenceType mainClass; /// holds all loaded classes in the debuggee VM - protected Set classes = new HashSet(); + protected Set classes = new LinkedHashSet<>(); /// listeners for class load events - protected List classLoadListeners = - new ArrayList(); + protected List classLoadListeners = new ArrayList<>(); /// path to the src folder of the current build protected String srcPath; /// list of current breakpoints - protected List breakpoints = - new ArrayList(); + protected List breakpoints = new ArrayList<>(); /// the step request we are currently in, or null if not in a step protected StepRequest requestedStep; /// maps line number changes at runtime (orig -> changed) - protected Map runtimeLineChanges = - new HashMap(); + protected Map runtimeLineChanges = new HashMap<>(); /// tab filenames which already have been tracked for runtime changes - protected Set runtimeTabsTracked = new HashSet(); + protected Set runtimeTabsTracked = new HashSet<>(); + + /// VM event listener + protected VMEventListener vmEventListener = this::vmEvent; public Debugger(JavaEditor editor) { @@ -127,24 +127,12 @@ public ReferenceType getMainClass() { /** - * Get the {@link ReferenceType} for a class name. - * @param name the class name - * @return the {@link ReferenceType} or null if not found - * (e.g. not yet loaded) + * Get the main and nested {@link ReferenceType}s for the sketch. + * @return a list of main and nested {@link ReferenceType}s, + * empty list if nothing found (e.g. not yet loaded) */ - public ReferenceType getClass(String name) { - if (name == null) { - return null; - } - if (name.equals(mainClassName)) { - return mainClass; - } - for (ReferenceType rt : classes) { - if (rt.name().equals(name)) { - return rt; - } - } - return null; + public Set getClasses() { + return classes; } @@ -197,32 +185,32 @@ public synchronized void startDebug() { Sketch sketch = editor.getSketch(); JavaBuild build = new JavaBuild(sketch); - log(Level.INFO, "building sketch: {0}", sketch.getName()); + log("building sketch: " + sketch.getName()); //LineMapping.addLineNumbers(sketch); // annotate // mainClassName = build.build(false); mainClassName = build.build(true); //LineMapping.removeLineNumbers(sketch); // annotate - log(Level.INFO, "class: {0}", mainClassName); + log("class: " + mainClassName); // folder with assembled/preprocessed src srcPath = build.getSrcFolder().getPath(); - log(Level.INFO, "build src: {0}", srcPath); + log("build src: " + srcPath); // folder with compiled code (.class files) - log(Level.INFO, "build bin: {0}", build.getBinFolder().getPath()); + log("build bin: " + build.getBinFolder().getPath()); if (mainClassName != null) { // generate the source line mapping //lineMap = LineMapping.generateMapping(srcPath + File.separator + mainClassName + ".java"); - log(Level.INFO, "launching debuggee runtime"); - runtime = new Runner(build, editor); + log("launching debuggee runtime"); + runtime = new Runner(build, new RunnerListenerEdtAdapter(editor)); VirtualMachine vm = runtime.debug(null); // non-blocking if (vm == null) { - log(Level.SEVERE, "error 37: launch failed"); + loge("error 37: launch failed", null); } // start receiving vm events - VMEventReader eventThread = new VMEventReader(vm.eventQueue(), this); + VMEventReader eventThread = new VMEventReader(vm.eventQueue(), vmEventListener); eventThread.start(); startTrackingLineChanges(); @@ -241,7 +229,12 @@ public synchronized void startDebug() { public synchronized void stopDebug() { editor.variableInspector().lock(); if (runtime != null) { - log(Level.INFO, "closing runtime"); + Messages.log("closing runtime"); + + for (LineBreakpoint bp : breakpoints) { + bp.detach(); + } + runtime.close(); runtime = null; //build = null; @@ -385,7 +378,7 @@ synchronized void setBreakpoint(LineID line) { return; } breakpoints.add(new LineBreakpoint(line, this)); - log(Level.INFO, "set breakpoint on line {0}", line); + log("set breakpoint on line " + line); } @@ -413,16 +406,16 @@ void removeBreakpoint(int lineIdx) { if (bp != null) { bp.remove(); breakpoints.remove(bp); - log(Level.INFO, "removed breakpoint {0}", bp); + log("removed breakpoint " + bp); } } /** Remove all breakpoints. */ synchronized void clearBreakpoints() { - //TODO: handle busy-ness correctly + // TODO: handle busy-ness correctly if (isBusy()) { - log(Level.WARNING, "busy"); + log("busy"); return; } @@ -438,9 +431,9 @@ synchronized void clearBreakpoints() { * @param tabFilename the tab's file name */ synchronized void clearBreakpoints(String tabFilename) { - //TODO: handle busy-ness correctly + // TODO: handle busy-ness correctly if (isBusy()) { - log(Level.WARNING, "busy"); + log("busy"); return; } @@ -477,10 +470,15 @@ LineBreakpoint breakpointOnLine(LineID line) { */ synchronized void toggleBreakpoint(int lineIdx) { LineID line = editor.getLineIDInCurrentTab(lineIdx); + int index = line.lineIdx(); if (hasBreakpoint(line)) { - removeBreakpoint(line.lineIdx()); + removeBreakpoint(index); } else { - setBreakpoint(line.lineIdx()); + // Make sure the line contains actual code before setting the break + // https://github.com/processing/processing/issues/3765 + if (editor.getLineText(index).trim().length() != 0) { + setBreakpoint(index); + } } } @@ -515,7 +513,7 @@ protected boolean hasBreakpoint(LineID line) { * @return the list of breakpoints in the given tab */ synchronized List getBreakpoints(String tabFilename) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (LineBreakpoint bp : breakpoints) { if (bp.lineID().fileName().equals(tabFilename)) { list.add(bp); @@ -530,10 +528,15 @@ synchronized List getBreakpoints(String tabFilename) { * ({@link VMEventReader}) * @param es Incoming set of events from VM */ - @Override public synchronized void vmEvent(EventSet es) { + VirtualMachine vm = vm(); + if (vm != null && vm != es.virtualMachine()) { + // This is no longer VM we are interested in, + // we already cleaned up and run different VM now. + return; + } for (Event e : es) { - log(Level.INFO, "*** VM Event: {0}", e.toString()); + log("*** VM Event: " + e); if (e instanceof VMStartEvent) { vmStartEvent(); @@ -556,21 +559,25 @@ public synchronized void vmEvent(EventSet es) { } } + private void createClassPrepareRequest(String name) { + ClassPrepareRequest classPrepareRequest = runtime.vm().eventRequestManager().createClassPrepareRequest(); + classPrepareRequest.addClassFilter(name); + classPrepareRequest.enable(); + } + private void vmStartEvent() { // break on main class load - log(Level.INFO, "requesting event on main class load: {0}", mainClassName); - ClassPrepareRequest mainClassPrepare = runtime.vm().eventRequestManager().createClassPrepareRequest(); - mainClassPrepare.addClassFilter(mainClassName); - mainClassPrepare.enable(); - + log("requesting event on main class load: " + mainClassName); + createClassPrepareRequest(mainClassName); + createClassPrepareRequest(mainClassName + "$*"); // break on loading custom classes for (SketchCode tab : editor.getSketch().getCode()) { if (tab.isExtension("java")) { - log(Level.INFO, "requesting event on class load: {0}", tab.getPrettyName()); - ClassPrepareRequest customClassPrepare = runtime.vm().eventRequestManager().createClassPrepareRequest(); - customClassPrepare.addClassFilter(tab.getPrettyName()); - customClassPrepare.enable(); + log("requesting event on class load: " + tab.getPrettyName()); + String name = tab.getPrettyName(); + createClassPrepareRequest(name); + createClassPrepareRequest(name + "$*"); } } runtime.vm().resume(); @@ -585,11 +592,12 @@ private void vmClassPrepareEvent(ClassPrepareEvent ce) { if (rt.name().equals(mainClassName)) { //printType(rt); mainClass = rt; - log(Level.INFO, "main class load: {0}", rt.name()); + classes.add(rt); + log("main class load: " + rt.name()); started = true; // now that main class is loaded, we're started } else { classes.add(rt); // save loaded classes - log(Level.INFO, "class load: {0}", rt.name()); + log("class load: {0}" + rt.name()); } // notify listeners @@ -656,7 +664,12 @@ public void run() { // disallow stepping into invisible lines if (!locationIsVisible(se.location())) { // TODO: this leads to stepping, should it run on the EDT? - stepOutIntoViewOrContinue(); + javax.swing.SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + stepOutIntoViewOrContinue(); + } + }); } } @@ -687,7 +700,7 @@ protected void stepOutIntoViewOrContinue() { continueDebug(); } catch (IncompatibleThreadStateException ex) { - log(Level.SEVERE, null, ex); + logitse(ex); } } @@ -741,7 +754,7 @@ protected void printStackTrace(ThreadReference t) { System.out.println(i++ + ": " + f.toString()); } } catch (IncompatibleThreadStateException ex) { - log(Level.SEVERE, null, ex); + logitse(ex); } } @@ -850,9 +863,9 @@ protected void printLocalVariables(ThreadReference t) { } } } catch (IncompatibleThreadStateException ex) { - log(Level.SEVERE, null, ex); + logitse(ex); } catch (AbsentInformationException ex) { - System.out.println("local variable information not available"); + log("local variable information not available"); } } @@ -869,7 +882,7 @@ protected void updateVariableInspector(ThreadReference t) { try { if (t.frameCount() == 0) { // TODO: needs to be handled in a better way: - log(Level.WARNING, "call stack empty"); + log("call stack empty"); } else { final VariableInspector vi = editor.variableInspector(); // first get data @@ -894,7 +907,7 @@ public void run() { }); } } catch (IncompatibleThreadStateException ex) { - log(Level.SEVERE, null, ex); + logitse(ex); } } @@ -909,10 +922,11 @@ protected String thisName(ThreadReference t) { if (!t.isSuspended() || t.frameCount() == 0) { return ""; } - return t.frame(0).thisObject().referenceType().name(); + ObjectReference ref = t.frame(0).thisObject(); + return ref == null ? "" : ref.referenceType().name(); } catch (IncompatibleThreadStateException ex) { - log(Level.SEVERE, null, ex); + logitse(ex); return ""; } } @@ -932,7 +946,7 @@ protected String currentLocation(ThreadReference t) { return locationToString(t.frame(0).location()); } catch (IncompatibleThreadStateException ex) { - log(Level.SEVERE, null, ex); + logitse(ex); return ""; } } @@ -961,7 +975,7 @@ protected String locationToString(Location loc) { */ protected List getLocals(ThreadReference t, int depth) { //System.out.println("getting locals"); - List vars = new ArrayList(); + List vars = new ArrayList<>(); try { if (t.frameCount() > 0) { StackFrame sf = t.frame(0); @@ -976,9 +990,9 @@ protected List getLocals(ThreadReference t, int depth) { } } } catch (IncompatibleThreadStateException ex) { - log(Level.SEVERE, null, ex); + logitse(ex); } catch (AbsentInformationException ex) { - log(Level.WARNING, "local variable information not available", ex); + loge("local variable information not available", ex); } return vars; } @@ -1001,9 +1015,9 @@ protected List getThisFields(ThreadReference t, int depth, return getFields(thisObj, depth, includeInherited); } } catch (IncompatibleThreadStateException ex) { - log(Level.SEVERE, null, ex); + logitse(ex); } - return new ArrayList(); + return new ArrayList<>(); } @@ -1018,7 +1032,7 @@ protected List getThisFields(ThreadReference t, int depth, protected List getFields(Value value, int depth, int maxDepth, boolean includeInherited) { // remember: Value <- ObjectReference, ArrayReference - List vars = new ArrayList(); + List vars = new ArrayList<>(); if (depth <= maxDepth) { if (value instanceof ArrayReference) { return getArrayFields((ArrayReference) value); @@ -1060,7 +1074,7 @@ public List getFields(Value value, int maxDepth, boolean includeIn * @return list of array fields */ protected List getArrayFields(ArrayReference array) { - List fields = new ArrayList(); + List fields = new ArrayList<>(); if (array != null) { String arrayType = array.type().name(); if (arrayType.endsWith("[]")) { @@ -1084,13 +1098,13 @@ protected List getArrayFields(ArrayReference array) { * @return call stack as list of {@link DefaultMutableTreeNode}s */ protected List getStackTrace(ThreadReference t) { - List stack = new ArrayList(); + List stack = new ArrayList<>(); try { for (StackFrame f : t.frames()) { stack.add(new DefaultMutableTreeNode(locationToString(f.location()))); } } catch (IncompatibleThreadStateException ex) { - log(Level.SEVERE, null, ex); + logitse(ex); } return stack; } @@ -1112,18 +1126,18 @@ protected void printThis(ThreadReference t) { } else { StackFrame sf = t.frame(0); ObjectReference thisObject = sf.thisObject(); - if (this != null) { + if (thisObject != null) { ReferenceType type = thisObject.referenceType(); System.out.println("fields in this (" + type.name() + "):"); for (Field f : type.visibleFields()) { System.out.println(f.typeName() + " " + f.name() + " = " + thisObject.getValue(f)); } - } else { // TODO [this is not reachable - fry] + } else { System.out.println("can't get this (in native or static method)"); } } } catch (IncompatibleThreadStateException ex) { - log(Level.SEVERE, null, ex); + logitse(ex); } } @@ -1142,7 +1156,7 @@ protected void printSourceLocation(ThreadReference t) { printSourceLocation(l); } } catch (IncompatibleThreadStateException ex) { - log(Level.SEVERE, null, ex); + logitse(ex); } } @@ -1158,7 +1172,7 @@ protected void printSourceLocation(Location l) { System.out.println(getSourceLine(l.sourcePath(), l.lineNumber(), 2)); } catch (AbsentInformationException ex) { - log(Level.SEVERE, null, ex); + log("absent information", ex); } } @@ -1172,7 +1186,7 @@ protected void printSourceLocation(Location l) { */ protected String getSourceLine(String filePath, int lineNo, int radius) { if (lineNo == -1) { - log(Level.SEVERE, "invalid line number: {0}", lineNo); + loge("invalid line number: " + lineNo, null); return ""; } //System.out.println("getting line: " + lineNo); @@ -1203,7 +1217,7 @@ protected String getSourceLine(String filePath, int lineNo, int radius) { return f.getName() + ":" + lineNo; } catch (IOException ex) { - log(Level.SEVERE, null, ex); + loge("other io exception", ex); return ""; } } @@ -1240,7 +1254,7 @@ protected LineID locationToLineID(Location l) { return javaToSketchLine(new LineID(l.sourceName(), l.lineNumber() - 1)); } catch (AbsentInformationException ex) { - log(Level.SEVERE, null, ex); + loge("absent information", ex); return null; } } @@ -1376,12 +1390,79 @@ protected void stopTrackingLineChanges() { } - static private void log(Level level, String msg) { - Logger.getLogger(Debugger.class.getName()).log(level, msg); + private void log(String msg, Object... args) { + if (args != null && args.length != 0) { + Messages.logf(getClass().getName() + " " + msg, args); + } else { + Messages.log(getClass().getName() + " " + msg); + } + } + + + private void loge(String msg, Throwable t) { + if (t != null) { + Messages.loge(getClass().getName() + " " + msg, t); + } else { + Messages.loge(getClass().getName() + " " + msg); + } + } + + + static private void logitse(Throwable t) { + Messages.loge("incompatible thread state?", t); + } + + + /** + * Interface for VM callbacks. + */ + protected interface VMEventListener { + /** + * Receive an event from the VM. Events are sent in batches. See + * documentation of EventSet for more information. + * @param es Set of events + */ + void vmEvent(EventSet es); } - static private void log(Level level, String msg, Object obj) { - Logger.getLogger(Debugger.class.getName()).log(level, msg, obj); + /** + * Reader Thread for VM Events. Constantly monitors a VMs EventQueue for new + * events and forwards them to an VMEventListener. + * + * @author Martin Leopold + */ + protected static class VMEventReader extends Thread { + EventQueue eventQueue; + VMEventListener listener; + + /** + * Construct a VMEventReader. Needs to be kicked off with start() once + * constructed. + * + * @param eventQueue The queue to read events from. Can be obtained from a + * VirtualMachine via eventQueue(). + * @param listener the listener to forward events to. + */ + public VMEventReader(EventQueue eventQueue, VMEventListener listener) { + super("VM Event Thread"); + this.eventQueue = eventQueue; + this.listener = listener; + } + + @Override + public void run() { + try { + while (true) { + EventSet eventSet = eventQueue.remove(); + listener.vmEvent(eventSet); + // for (Event e : eventSet) { System.out.println("VM Event: " + e.toString()); } + } + } catch (VMDisconnectedException e) { + Messages.log("VMEventReader quit on VM disconnect"); + } catch (Exception e) { + Messages.loge("VMEventReader quit", e); + } + } } } diff --git a/java/src/processing/mode/java/ErrorColumn.java b/java/src/processing/mode/java/ErrorColumn.java deleted file mode 100644 index 44f1c34f66..0000000000 --- a/java/src/processing/mode/java/ErrorColumn.java +++ /dev/null @@ -1,318 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -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. -*/ - -package processing.mode.java; - -import java.awt.Color; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.RenderingHints; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseMotionAdapter; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.swing.JPanel; -import javax.swing.SwingWorker; -import javax.swing.text.BadLocationException; - -import processing.app.SketchCode; -import processing.app.Util; -import processing.mode.java.pdex.ErrorCheckerService; -import processing.mode.java.pdex.ErrorMarker; -import processing.mode.java.pdex.Problem; -import processing.app.Language; - -/** - * The bar on the left of the text area which displays all errors as rectangles.
    - *
    - * All errors and warnings of a sketch are drawn on the bar, clicking on one, - * scrolls to the tab and location. Error messages displayed on hover. Markers - * are not in sync with the error line. Similar to eclipse's right error bar - * which displays the overall errors in a document - * - * @author Manindra Moharana <me@mkmoharana.com> - * - */ -public class ErrorColumn extends JPanel { - /** - * Preferred height of the component - */ - protected int preferredHeight; - - /** - * Preferred height of the component - */ - protected int preferredWidth = 12; - - /** - * Height of marker - */ - public static final int errorMarkerHeight = 4; - - /** - * Color of Error Marker - */ - public Color errorColor; // = new Color(0xED2630); - - /** - * Color of Warning Marker - */ - public Color warningColor; // = new Color(0xFFC30E); - - /** - * Background color of the component - */ - public Color backgroundColor; // = new Color(0x2C343D); - - /** - * JavaEditor instance - */ - protected JavaEditor editor; - - /** - * ErrorCheckerService instance - */ - protected ErrorCheckerService errorCheckerService; - - /** - * Stores error markers displayed PER TAB along the error bar. - */ - protected List errorPoints = - Collections.synchronizedList(new ArrayList()); - - /** - * Stores previous list of error markers. - */ - protected ArrayList errorPointsOld = new ArrayList(); - - public void paintComponent(Graphics g) { - Graphics2D g2d = (Graphics2D) g; - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - g.setColor(backgroundColor); - g.fillRect(0, 0, getWidth(), getHeight()); - - for (ErrorMarker emarker : errorPoints) { - if (emarker.getType() == ErrorMarker.Error) { - g.setColor(errorColor); - } else { - g.setColor(warningColor); - } - g.fillRect(2, emarker.getY(), (getWidth() - 3), errorMarkerHeight); - } - } - - - public Dimension getPreferredSize() { - return new Dimension(preferredWidth, preferredHeight); - } - - - public Dimension getMinimumSize() { - return getPreferredSize(); - } - - - public ErrorColumn(JavaEditor editor, int height, JavaMode mode) { - this.editor = editor; - this.preferredHeight = height; - this.errorCheckerService = editor.errorCheckerService; - - errorColor = mode.getColor("errorbar.errorcolor"); //, errorColor); - warningColor = mode.getColor("errorbar.warningcolor"); //, warningColor); - //backgroundColor = mode.getColor("errorbar.backgroundcolor"); //, backgroundColor); - backgroundColor = mode.getColor("gutter.bgcolor"); - - addListeners(); - } - - /** - * Update error markers in the error bar. - * - * @param problems - * - List of problems. - */ - synchronized public void updateErrorPoints(final List problems) { - // NOTE TO SELF: ErrorMarkers are calculated for the present tab only - // Error Marker index in the arraylist is LOCALIZED for current tab. - // Also, need to do the update in the UI thread via SwingWorker to prevent - // concurrency issues. - final int fheight = this.getHeight(); - SwingWorker worker = new SwingWorker() { - - protected Object doInBackground() throws Exception { - SketchCode sc = editor.getSketch().getCurrentCode(); - int totalLines = 0, currentTab = editor.getSketch() - .getCurrentCodeIndex(); - try { - totalLines = Util.countLines(sc.getDocument() - .getText(0, sc.getDocument().getLength())) + 1; - } catch (BadLocationException e) { - e.printStackTrace(); - } - // System.out.println("Total lines: " + totalLines); - synchronized (errorPoints) { - errorPointsOld.clear(); - for (ErrorMarker marker : errorPoints) { - errorPointsOld.add(marker); - } - errorPoints.clear(); - - // Each problem.getSourceLine() will have an extra line added - // because of - // class declaration in the beginning as well as default imports - synchronized (problems) { - for (Problem problem : problems) { - if (problem.getTabIndex() == currentTab) { - // Ratio of error line to total lines - float y = (problem.getLineNumber() + 1) - / ((float) totalLines); - // Ratio multiplied by height of the error bar - y *= fheight - 15; // -15 is just a vertical offset - errorPoints - .add(new ErrorMarker(problem, (int) y, - problem.isError() ? ErrorMarker.Error - : ErrorMarker.Warning)); - // System.out.println("Y: " + y); - } - } - } - } - return null; - } - - protected void done() { - repaint(); - } - }; - - try { - worker.execute(); // I eat concurrency bugs for breakfast. - } catch (Exception exp) { - System.out.println("Errorbar update markers is slacking." - + exp.getMessage()); - // e.printStackTrace(); - } - } - - /** - * Check if new errors have popped up in the sketch since the last check - * - * @return true - if errors have changed - */ - public boolean errorPointsChanged() { - if (errorPointsOld.size() != errorPoints.size()) { - editor.getTextArea().repaint(); - // System.out.println("2 Repaint " + System.currentTimeMillis()); - return true; - } - - else { - for (int i = 0; i < errorPoints.size(); i++) { - if (errorPoints.get(i).getY() != errorPointsOld.get(i).getY()) { - editor.getTextArea().repaint(); - // System.out.println("3 Repaint " + - // System.currentTimeMillis()); - return true; - } - } - } - return false; - } - - /** - * Add various mouse listeners. - */ - protected void addListeners() { - - addMouseListener(new MouseAdapter() { - - // Find out which error/warning the user has clicked - // and then scroll to that - @Override - public void mouseClicked(final MouseEvent e) { - SwingWorker worker = new SwingWorker() { - - protected Object doInBackground() throws Exception { - for (ErrorMarker eMarker : errorPoints) { - // -2 and +2 are extra allowance, clicks in the - // vicinity of the markers register that way - if (e.getY() >= eMarker.getY() - 2 - && e.getY() <= eMarker.getY() + 2 + errorMarkerHeight) { - errorCheckerService.scrollToErrorLine(eMarker.getProblem()); - return null; - } - } - return null; - } - }; - - try { - worker.execute(); - } catch (Exception exp) { - System.out.println("Errorbar mouseClicked is slacking." - + exp.getMessage()); - // e.printStackTrace(); - } - - } - }); - - // Tooltip on hover - addMouseMotionListener(new MouseMotionAdapter() { - public void mouseMoved(final MouseEvent evt) { - SwingWorker worker = new SwingWorker() { - - protected Object doInBackground() throws Exception { - for (ErrorMarker eMarker : errorPoints) { - if (evt.getY() >= eMarker.getY() - 2 && - evt.getY() <= eMarker.getY() + 2 + errorMarkerHeight) { - Problem p = eMarker.getProblem(); - String msg = ((p.isError() - ? Language.text("editor.status.error") - : Language.text("editor.status.warning")) + ": " - + p.getMessage()); - - setToolTipText(msg); - setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - break; - } - } - return null; - } - }; - - try { - worker.execute(); - } catch (Exception exp) { - System.out - .println("Errorbar mousemoved Worker is slacking." - + exp.getMessage()); - // e.printStackTrace(); - } - } - }); - } -} diff --git a/java/src/processing/mode/java/JavaBuild.java b/java/src/processing/mode/java/JavaBuild.java index 7ae63a736e..85413a4eae 100644 --- a/java/src/processing/mode/java/JavaBuild.java +++ b/java/src/processing/mode/java/JavaBuild.java @@ -3,6 +3,7 @@ /* Part of the Processing project - http://processing.org +Copyright (c) 2012-19 The Processing Foundation Copyright (c) 2004-12 Ben Fry and Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology @@ -23,22 +24,39 @@ package processing.mode.java; import java.io.*; -import java.util.*; -import java.util.zip.*; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipOutputStream; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DefaultLogger; import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectHelper; -import processing.app.*; +import processing.app.Base; +import processing.app.Language; +import processing.app.Library; +import processing.app.Messages; +import processing.app.Mode; +import processing.app.Platform; +import processing.app.Preferences; +import processing.app.Sketch; +import processing.app.SketchCode; +import processing.app.SketchException; +import processing.app.Util; import processing.app.exec.ProcessHelper; -import processing.core.*; +import processing.core.PApplet; +import processing.core.PConstants; import processing.data.StringList; import processing.data.XML; -import processing.mode.java.preproc.*; - -// Would you believe there's a java.lang.Compiler class? I wouldn't. +import processing.mode.java.pdex.SourceUtils; +import processing.mode.java.preproc.PdePreprocessor; +import processing.mode.java.preproc.PreprocessorResult; +import processing.mode.java.preproc.SurfaceInfo; public class JavaBuild { @@ -68,7 +86,7 @@ public class JavaBuild { private String javaLibraryPath; /** List of library folders, as figured out during preprocessing. */ - private ArrayList importedLibraries; + private List importedLibraries; public JavaBuild(Sketch sketch) { @@ -77,51 +95,6 @@ public JavaBuild(Sketch sketch) { } - /** - * 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 { - - /** * Run the build inside a temporary build folder. Used for run/present. * @return null if compilation failed, main class name if not @@ -145,17 +118,11 @@ public String build(File srcFolder, File binFolder, boolean sizeWarning) throws this.srcFolder = srcFolder; this.binFolder = binFolder; -// Base.openFolder(srcFolder); -// Base.openFolder(binFolder); - // run the preprocessor String classNameFound = preprocess(srcFolder, sizeWarning); // compile the program. errors will happen as a RunnerException // that will bubble up to whomever called build(). -// Compiler compiler = new Compiler(this); -// String bootClasses = System.getProperty("sun.boot.class.path"); -// if (compiler.compile(this, srcFolder, binFolder, primaryClassName, getClassPath(), bootClasses)) { if (Compiler.compile(this)) { sketchClassName = classNameFound; return classNameFound; @@ -184,11 +151,6 @@ public String getSketchClassName() { * @param buildPath Location to copy all the .java files * @return null if compilation failed, main class name if not */ -// public String preprocess() throws SketchException { -// return preprocess(sketch.makeTempFolder()); -// } - - public String preprocess(File srcFolder, boolean sizeWarning) throws SketchException { return preprocess(srcFolder, null, new PdePreprocessor(sketch.getName()), sizeWarning); } @@ -260,11 +222,14 @@ public String preprocess(File srcFolder, // Remove the entries being moved to settings(). They will be re-inserted // by writeFooter() when it emits the settings() method. - if (sizeInfo != null && sizeInfo.hasSettings()) { -// String sizeStatement = sizeInfo.getStatement(); + // If the user already has a settings() method, don't mess with anything. + // https://github.com/processing/processing/issues/4703 + if (!PdePreprocessor.hasSettingsMethod(bigCode.toString()) && + sizeInfo != null && sizeInfo.hasSettings()) { for (String stmt : sizeInfo.getStatements()) { -// if (sizeStatement != null) { - //System.out.format("size stmt is '%s'%n", sizeStatement); + // Don't remove newlines (and while you're at it, just keep spaces) + // https://github.com/processing/processing/issues/3654 + stmt = stmt.trim(); int index = bigCode.indexOf(stmt); if (index != -1) { bigCode.delete(index, index + stmt.length()); @@ -281,19 +246,18 @@ public String preprocess(File srcFolder, File outputFolder = (packageName == null) ? srcFolder : new File(srcFolder, packageName.replace('.', '/')); outputFolder.mkdirs(); -// Base.openFolder(outputFolder); final File java = new File(outputFolder, sketch.getName() + ".java"); - final PrintWriter stream = new PrintWriter(new FileWriter(java)); try { - result = preprocessor.write(stream, bigCode.toString(), codeFolderPackages); - } finally { - stream.close(); + final PrintWriter writer = PApplet.createWriter(java); + try { + result = preprocessor.write(writer, bigCode.toString(), codeFolderPackages); + } finally { + writer.close(); + } + } catch (RuntimeException re) { + re.printStackTrace(); + throw new SketchException("Could not write " + java.getAbsolutePath()); } - } catch (FileNotFoundException fnfe) { - fnfe.printStackTrace(); - String msg = "Build folder disappeared or could not be written"; - throw new SketchException(msg); - } 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 @@ -303,40 +267,34 @@ public String preprocess(File srcFolder, // then search through for anyone else whose preprocName is null, // since they've also been combined into the main pde. int errorFile = findErrorFile(errorLine); -// System.out.println("error line is " + errorLine + ", file is " + errorFile); errorLine -= sketch.getCode(errorFile).getPreprocOffset(); -// System.out.println(" preproc offset for that file: " + sketch.getCode(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(); - //System.out.println(java.getAbsolutePath()); -// System.out.println(bigCode); - - if (msg.contains("expecting RCURLY")) { - //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 SketchException("Found one too many { characters " + - "without a } to match it.", - errorFile, errorLine, re.getColumn(), false); - } - - if (msg.contains("expecting LCURLY")) { - System.err.println(msg); - String suffix = "."; - String[] m = PApplet.match(msg, "found ('.*')"); - if (m != null) { - suffix = ", not " + m[1] + "."; + if (msg.contains("expecting RCURLY") || msg.contains("expecting LCURLY")) { + for (int i = 0; i < sketch.getCodeCount(); i++) { + SketchCode sc = sketch.getCode(i); + if (sc.isExtension("pde")) { + String s = sc.getProgram(); + int[] braceTest = SourceUtils.checkForMissingBraces( + SourceUtils.scrubCommentsAndStrings(s) + "\n", 0, s.length()+1); + if (braceTest[0] == 0) continue; + + // Completely ignoring the errorFile/errorLine given since it's + // likely to be the wrong tab. For the same reason, I'm not showing + // the result of PApplet.match(msg, "found ('.*')") on missing + // LCURLY. + throw new SketchException(braceTest[0] > 0 + ? "Found an extra { character without a } to match it." + : "Found an extra } character without a { to match it.", + i, braceTest[1], braceTest[2], false); + } } - throw new SketchException("Was expecting a { character" + suffix, - errorFile, errorLine, re.getColumn(), false); + // If we're still here, there's the right brackets, just not in the + // right place. Passing on the original error. + throw new SketchException( + msg.replace("LCURLY", "{").replace("RCURLY", "}"), + errorFile, errorLine, re.getColumn(), false); } if (msg.indexOf("expecting RBRACK") != -1) { @@ -377,9 +335,30 @@ public String preprocess(File srcFolder, // 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 locationRegex = "^line (\\d+):(\\d+):\\s"; + String message = tsre.getMessage(); + String[] m; + + if (null != (m = PApplet.match(tsre.toString(), + "unexpected char: (.*)"))) { + char c = 0; + if (m[1].startsWith("0x")) { // Hex + c = (char) PApplet.unhex(m[1].substring(2)); + } else if (m[1].length() == 3) { // Quoted + c = m[1].charAt(1); + } else if (m[1].length() == 1) { // Alone + c = m[1].charAt(0); + } + if (c == '\u201C' || c == '\u201D' || // “” + c == '\u2018' || c == '\u2019') { // ‘’ + message = Language.interpolate("editor.status.bad_curly_quote", c); + } else if (c != 0) { + message = "Not expecting symbol " + m[1] + + ", which is " + Character.getName(c) + "."; + } + } - String[] matches = PApplet.match(tsre.toString(), mess); + String[] matches = PApplet.match(tsre.toString(), locationRegex); if (matches != null) { int errorLine = Integer.parseInt(matches[1]) - 1; int errorColumn = Integer.parseInt(matches[2]); @@ -394,7 +373,7 @@ public String preprocess(File srcFolder, } errorLine -= sketch.getCode(errorFile).getPreprocOffset(); - throw new SketchException(tsre.getMessage(), + throw new SketchException(message, errorFile, errorLine, errorColumn); } else { @@ -417,7 +396,7 @@ public String preprocess(File srcFolder, // grab the imports from the code just preprocessed - importedLibraries = new ArrayList(); + importedLibraries = new ArrayList<>(); Library core = mode.getCoreLibrary(); if (core != null) { importedLibraries.add(core); @@ -425,26 +404,19 @@ public String preprocess(File srcFolder, javaLibraryPath += File.pathSeparator + core.getNativePath(); } -// System.out.println("extra imports: " + result.extraImports); for (String item : result.extraImports) { -// System.out.println("item = '" + item + "'"); // 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); -// System.out.print(entry + " => "); if (item.startsWith("static ")) { // import static - https://github.com/processing/processing/issues/8 - // Remove more stuff. int dot2 = item.lastIndexOf('.'); entry = entry.substring(7, (dot2 == -1) ? entry.length() : dot2); -// System.out.println(entry); } -// System.out.println("library searching for " + entry); Library library = mode.getLibrary(entry); -// System.out.println(" found " + library); if (library != null) { if (!importedLibraries.contains(library)) { @@ -473,7 +445,6 @@ public String preprocess(File srcFolder, } } } -// PApplet.println(PApplet.split(libraryPath, File.pathSeparatorChar)); // Finally, add the regular Java CLASSPATH. This contains everything // imported by the PDE itself (core.jar, pde.jar, quaqua.jar) which may @@ -521,11 +492,11 @@ public String preprocess(File srcFolder, } else { if (packageMatch == null) { // use the default package name, since mixing with package-less code will break - packageMatch = new String[] { packageName }; + packageMatch = new String[] { "", packageName }; // add the package name to the source before writing it javaCode = "package " + packageName + ";" + javaCode; } - File packageFolder = new File(srcFolder, packageMatch[0].replace('.', '/')); + File packageFolder = new File(srcFolder, packageMatch[1].replace('.', File.separatorChar)); packageFolder.mkdirs(); Util.saveFile(javaCode, new File(packageFolder, filename)); } @@ -545,6 +516,7 @@ public String preprocess(File srcFolder, return result.className; } + /** * Returns true if this package isn't part of a library (it's a system import * or something like that). Don't bother complaining about java.* or javax.* @@ -556,26 +528,13 @@ public String preprocess(File srcFolder, protected boolean ignorableImport(String pkg) { if (pkg.startsWith("java.")) return true; if (pkg.startsWith("javax.")) return true; + if (pkg.startsWith("javafx.")) return true; if (pkg.startsWith("processing.core.")) return true; if (pkg.startsWith("processing.data.")) return true; if (pkg.startsWith("processing.event.")) return true; if (pkg.startsWith("processing.opengl.")) return true; -// if (pkg.startsWith("com.jogamp.")) return true; - -// // ignore core, data, and opengl packages -// String[] coreImports = preprocessor.getCoreImports(); -// for (int i = 0; i < coreImports.length; i++) { -// String imp = coreImports[i]; -// if (imp.endsWith(".*")) { -// imp = imp.substring(0, imp.length() - 2); -// } -// if (pkg.startsWith(imp)) { -// return true; -// } -// } - return false; } @@ -642,61 +601,11 @@ public boolean getFoundMain() { * Get the list of imported libraries. Used by external tools like Android mode. * @return list of library folders connected to this sketch. */ - public ArrayList getImportedLibraries() { + public List getImportedLibraries() { return importedLibraries; } - /** - * Map an error from a set of processed .java files back to its location - * in the actual sketch. - * @param message The error message. - * @param filename The .java file where the exception was found. - * @param line Line number of the .java file for the exception (1-indexed) - * @return A RunnerException to be sent to the editor, or null if it wasn't - * possible to place the exception to the sketch code. - */ -// public RunnerException placeExceptionAlt(String message, -// String filename, int line) { -// String appletJavaFile = appletClassName + ".java"; -// SketchCode errorCode = null; -// if (filename.equals(appletJavaFile)) { -// for (SketchCode code : getCode()) { -// if (code.isExtension("pde")) { -// if (line >= code.getPreprocOffset()) { -// errorCode = code; -// } -// } -// } -// } else { -// for (SketchCode code : getCode()) { -// if (code.isExtension("java")) { -// if (filename.equals(code.getFileName())) { -// errorCode = code; -// } -// } -// } -// } -// int codeIndex = 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 -// line -= getCode(codeIndex).getPreprocOffset(); -// -// // lineNumber is 1-indexed, but editor wants zero-indexed -// line--; -// -// // getMessage() will be what's shown in the editor -// RunnerException exception = -// new RunnerException(message, codeIndex, line, -1); -// exception.hideStackTrace(); -// return exception; -// } -// return null; -// } - - /** * Map an error from a set of processed .java files back to its location * in the actual sketch. @@ -793,21 +702,31 @@ protected boolean exportApplication() throws IOException, SketchException { Preferences.getBoolean("export.application.embed_java"); if (Preferences.getBoolean(JavaEditor.EXPORT_PREFIX + platformName)) { + final int bits = Platform.getNativeBits(); + final String arch = Platform.getNativeArch(); + if (Library.hasMultipleArch(platform, importedLibraries)) { - // export the 32-bit version - folder = new File(sketch.getFolder(), "application." + platformName + "32"); - if (!exportApplication(folder, platform, "32", embedJava && Platform.getNativeBits() == 32 && "x86".equals(Platform.getNativeArch()))) { - return false; + // Don't try to export 32-bit on macOS, because it doesn't exist. + if (platform != PConstants.MACOSX) { + // export the 32-bit version + folder = new File(sketch.getFolder(), "application." + platformName + "32"); + if (!exportApplication(folder, platform, "32", embedJava && (bits == 32) && ("x86".equals(arch) || "i386".equals(arch)))) { + return false; + } } // export the 64-bit version folder = new File(sketch.getFolder(), "application." + platformName + "64"); - if (!exportApplication(folder, platform, "64", embedJava && Platform.getNativeBits() == 64 && "x86".equals(Platform.getNativeArch()))) { + if (!exportApplication(folder, platform, "64", embedJava && (bits == 64) && "amd64".equals(arch))) { return false; } if (platform == PConstants.LINUX) { - // export the armv6hf version as well + // export the arm versions as well folder = new File(sketch.getFolder(), "application.linux-armv6hf"); - if (!exportApplication(folder, platform, "armv6hf", embedJava && Platform.getNativeBits() == 32 && "arm".equals(Platform.getNativeArch()))) { + if (!exportApplication(folder, platform, "armv6hf", embedJava && (bits == 32) && "arm".equals(arch))) { + return false; + } + folder = new File(sketch.getFolder(), "application.linux-arm64"); + if (!exportApplication(folder, platform, "arm64", embedJava && (bits == 64) && "aarch64".equals(arch))) { return false; } } @@ -820,31 +739,6 @@ protected boolean exportApplication() throws IOException, SketchException { } } - /* - File folder = null; - String platformName = Base.getPlatformName(); - boolean embedJava = Preferences.getBoolean("export.application.embed_java"); - if (Library.hasMultipleArch(PApplet.platform, importedLibraries)) { - if (Base.getNativeBits() == 32) { - // export the 32-bit version - folder = new File(sketch.getFolder(), "application." + platformName + "32"); - if (!exportApplication(folder, PApplet.platform, 32, embedJava)) { - return false; - } - } else if (Base.getNativeBits() == 64) { - // export the 64-bit version - folder = new File(sketch.getFolder(), "application." + platformName + "64"); - if (!exportApplication(folder, PApplet.platform, 64, embedJava)) { - return false; - } - } - } else { // just make a single one for this platform - folder = new File(sketch.getFolder(), "application." + platformName); - if (!exportApplication(folder, PApplet.platform, 0, embedJava)) { - return false; - } - } - */ return true; // all good } @@ -911,7 +805,8 @@ protected boolean exportApplication(File destFolder, File macosFolder = new File(contentsFolder, "MacOS"); macosFolder.mkdirs(); - Util.copyFile(new File(contentsOrig, "MacOS/Processing"), + // This is an unsigned copy of the app binary (see build/build.xml) + Util.copyFile(mode.getContentFile("application/mac-app-stub"), new File(contentsFolder, "MacOS/" + sketch.getName())); File pkgInfo = new File(contentsFolder, "PkgInfo"); @@ -932,30 +827,6 @@ protected boolean exportApplication(File destFolder, Util.copyFile(mode.getContentFile("application/sketch.icns"), new File(resourcesFolder, "sketch.icns")); - /* - 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 }); - } - */ } else if (exportPlatform == PConstants.LINUX) { if (embedJava) { Util.copyDirNative(Platform.getJavaHome(), new File(destFolder, "java")); @@ -973,30 +844,9 @@ protected boolean exportApplication(File destFolder, if (!jarFolder.exists()) jarFolder.mkdirs(); - /* - /// on windows, copy the exe file - - if (exportPlatform == PConstants.WINDOWS) { - if (exportBits == 64) { - // We don't yet have a 64-bit launcher, so this is a workaround for now. - File batFile = new File(destFolder, sketch.getName() + ".bat"); - PrintWriter writer = PApplet.createWriter(batFile); - writer.println("@echo off"); - String javaPath = embedJava ? ".\\java\\bin\\java.exe" : "java"; - writer.println(javaPath + " -Djna.nosys=true -Djava.ext.dirs=lib -Djava.library.path=lib " + sketch.getName()); - writer.flush(); - writer.close(); - } else { - Base.copyFile(mode.getContentFile("application/template.exe"), - new File(destFolder, sketch.getName() + ".exe")); - } - } - */ - - /// start copying all jar files - Vector jarListVector = new Vector(); + StringList jarList = new StringList(); /// create the main .jar file @@ -1053,7 +903,7 @@ protected boolean exportApplication(File destFolder, File exportFile = new File(codeList[i]); String exportFilename = exportFile.getName(); Util.copyFile(exportFile, new File(jarFolder, exportFilename)); - jarListVector.add(exportFilename); + jarList.append(exportFilename); } else { // cp += codeList[i] + File.pathSeparator; } @@ -1063,7 +913,7 @@ protected boolean exportApplication(File destFolder, zos.flush(); zos.close(); - jarListVector.add(sketch.getName() + ".jar"); + jarList.append(sketch.getName() + ".jar"); /// add contents of 'library' folders to the export @@ -1083,7 +933,7 @@ protected boolean exportApplication(File destFolder, } else if (exportName.toLowerCase().endsWith(".zip") || exportName.toLowerCase().endsWith(".jar")) { Util.copyFile(exportFile, new File(jarFolder, exportName)); - jarListVector.add(exportName); + jarList.append(exportName); } else { // Starting with 2.0a2 put extra export files (DLLs, plugins folder, @@ -1096,40 +946,49 @@ protected boolean exportApplication(File destFolder, /// create platform-specific CLASSPATH based on included jars - String jarList[] = new String[jarListVector.size()]; - jarListVector.copyInto(jarList); - StringBuilder exportClassPath = new StringBuilder(); - + String exportClassPath = null; if (exportPlatform == PConstants.MACOSX) { - for (int i = 0; i < jarList.length; i++) { - if (i != 0) exportClassPath.append(":"); - exportClassPath.append("$JAVAROOT/" + jarList[i]); - } + exportClassPath = "$JAVAROOT/" + jarList.join(":$JAVAROOT/"); } else if (exportPlatform == PConstants.WINDOWS) { - for (int i = 0; i < jarList.length; i++) { - if (i != 0) exportClassPath.append(","); - exportClassPath.append(jarList[i]); - } - } else { - exportClassPath.append("$APPDIR"); - for (int i = 0; i < jarList.length; i++) { - exportClassPath.append(":$APPDIR/lib/" + jarList[i]); - } + exportClassPath = jarList.join(","); + } else if (exportPlatform == PConstants.LINUX) { + // why is $APPDIR at the front of this list? + exportClassPath = "$APPDIR" + + ":$APPDIR/lib/" + jarList.join(":$APPDIR/lib/"); } /// figure out run options for the VM - List runOptions = new ArrayList(); - if (Preferences.getBoolean("run.options.memory")) { - runOptions.add("-Xms" + Preferences.get("run.options.memory.initial") + "m"); - runOptions.add("-Xmx" + Preferences.get("run.options.memory.maximum") + "m"); + StringList runOptions = new StringList(); + + // Set memory options, except for ARM where we're more memory-constrained + // compared to the machine being used to build/export the sketch + // https://github.com/processing/processing/pull/4406 + if (Preferences.getBoolean("run.options.memory") && + !exportVariant.equals("armv6hf")) { + runOptions.append("-Xms" + Preferences.get("run.options.memory.initial") + "m"); + runOptions.append("-Xmx" + Preferences.get("run.options.memory.maximum") + "m"); } // https://github.com/processing/processing/issues/2239 - runOptions.add("-Djna.nosys=true"); + runOptions.append("-Djna.nosys=true"); + // https://github.com/processing/processing/issues/4608 + if (embedJava) { + // if people don't embed Java, it might be a mess, but what can we do? + if (exportPlatform == PConstants.MACOSX) { + runOptions.append("-Djava.ext.dirs=$APP_ROOT/Contents/PlugIns/jdk" + + PApplet.javaVersionName + + ".jdk/Contents/Home/jre/lib/ext"); + } else if (exportPlatform == PConstants.WINDOWS) { + runOptions.append("-Djava.ext.dirs=\"%EXEDIR%\\java\\lib\\ext\""); + } else if (exportPlatform == PConstants.LINUX) { + runOptions.append("-Djava.ext.dirs=\"$APPDIR/java/lib/ext\""); + } + } + // https://github.com/processing/processing/issues/2559 if (exportPlatform == PConstants.WINDOWS) { - runOptions.add("-Djava.library.path=\"%EXEDIR%\\lib\""); + runOptions.append("-Djava.library.path=\"%EXEDIR%\\lib\""); } @@ -1183,7 +1042,7 @@ protected boolean exportApplication(File destFolder, pw.close(); // attempt to code sign if the Xcode tools appear to be installed - if (Platform.isMacOS() && new File("/usr/bin/codesign_allocate").exists()) { + if (Platform.isMacOS() && isXcodeInstalled()) { if (embedJava) { ProcessHelper.ffs("codesign", "--force", "--sign", "-", jdkPath); } @@ -1231,36 +1090,13 @@ protected boolean exportApplication(File destFolder, if (embedJava) { jre.addChild("path").setContent("java"); } - jre.addChild("minVersion").setContent("1.7.0_40"); + // Need u74 for a major JavaFX issue (upside-down display) + // https://github.com/processing/processing/issues/3795 + jre.addChild("minVersion").setContent("1.8.0_74"); for (String opt : runOptions) { jre.addChild("opt").setContent(opt); } - /* - XML config = launch4j.addChild("config"); - config.setString("headerType", "gui"); - File exeFile = new File(destFolder, sketch.getName() + ".exe"); - config.setString("outfile", exeFile.getAbsolutePath()); - config.setString("dontWrapJar", "true"); - config.setString("jarPath", "lib\\" + jarList[0]); - - File iconFile = mode.getContentFile("application/sketch.ico"); - config.addChild("icon").setContent(iconFile.getAbsolutePath()); - - XML clazzPath = config.addChild("classPath"); - clazzPath.setString("mainClass", sketch.getName()); - for (int i = 1; i < jarList.length; i++) { - String jarName = jarList[i]; - clazzPath.addChild("cp").setContent("lib\\" + jarName); - } - XML jre = config.addChild("jre"); - jre.setString("minVersion", "1.7.0_40"); - //PApplet.join(runOptions.toArray(new String[0]), " ") - for (String opt : runOptions) { - jre.addChild("opt").setContent(opt); - } - */ - config.save(configFile); project.save(buildFile); if (!buildWindowsLauncher(buildFile, "windows")) { @@ -1277,18 +1113,23 @@ protected boolean exportApplication(File destFolder, // 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 + pw.print("APPDIR=$(readlink -f \"$0\")\n"); // allow symlinks + pw.print("APPDIR=$(dirname \"$APPDIR\")\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"); + if (embedJava) { // https://github.com/processing/processing/issues/2349 pw.print("$APPDIR/java/bin/"); } - String runOptionsStr = - PApplet.join(runOptions.toArray(new String[0]), " "); + String runOptionsStr = runOptions.join(" "); pw.print("java " + runOptionsStr + " -Djava.library.path=\"$APPDIR:$APPDIR/lib\"" + + // these aren't included here since they're added elsewhere + // (and only included when Java is embedded) + //" -Djava.ext.dirs=\"$APPDIR/java/lib/ext\"" + + //" -Djna.nosys=true" + " -cp \"" + exportClassPath + "\"" + " " + sketch.getName() + " \"$@\"\n"); @@ -1331,6 +1172,23 @@ protected boolean exportApplication(File destFolder, } + static Boolean xcodeInstalled; + + static protected boolean isXcodeInstalled() { + if (xcodeInstalled == null) { + // http://stackoverflow.com/questions/15371925 + Process p = PApplet.launch("xcode-select", "-p"); + int result = -1; + try { + result = p.waitFor(); + } catch (InterruptedException e) { } + // returns 0 if installed, 2 if not (-1 if exception) + xcodeInstalled = (result == 0); + } + return xcodeInstalled; + } + + /** * Run the launch4j build.xml file through ant to create the exe. * Most of this code was lifted from Android mode. diff --git a/java/src/processing/mode/java/JavaEditor.java b/java/src/processing/mode/java/JavaEditor.java index 68121f518c..6b87398c15 100644 --- a/java/src/processing/mode/java/JavaEditor.java +++ b/java/src/processing/mode/java/JavaEditor.java @@ -4,52 +4,37 @@ import java.awt.event.*; import java.beans.*; import java.io.*; -import java.nio.charset.Charset; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.swing.*; import javax.swing.border.*; -import javax.swing.event.MenuEvent; -import javax.swing.event.MenuListener; -import javax.swing.table.TableModel; +import javax.swing.event.*; +import javax.swing.text.BadLocationException; import javax.swing.text.Document; -import org.eclipse.jdt.core.compiler.IProblem; - import processing.core.PApplet; import processing.data.StringList; import processing.app.*; -import processing.app.contrib.AvailableContribution; -import processing.app.contrib.Contribution; -import processing.app.contrib.ContributionListing; -import processing.app.contrib.ContributionManager; -import processing.app.contrib.ToolContribution; +import processing.app.contrib.*; import processing.app.syntax.JEditTextArea; +import processing.app.syntax.PdeTextArea; import processing.app.syntax.PdeTextAreaDefaults; -import processing.app.ui.About; -import processing.app.ui.ColorChooser; -import processing.app.ui.Editor; -import processing.app.ui.EditorException; -import processing.app.ui.EditorFooter; -import processing.app.ui.EditorHeader; -import processing.app.ui.EditorState; -import processing.app.ui.EditorToolbar; +import processing.app.ui.*; import processing.app.ui.Toolkit; -import processing.app.ui.Welcome; import processing.mode.java.debug.LineBreakpoint; import processing.mode.java.debug.LineHighlight; import processing.mode.java.debug.LineID; -import processing.mode.java.pdex.ErrorCheckerService; -import processing.mode.java.pdex.ErrorMarker; -import processing.mode.java.pdex.ErrorMessageSimplifier; +import processing.mode.java.pdex.PreprocessingService; +import processing.mode.java.pdex.ImportStatement; import processing.mode.java.pdex.JavaTextArea; -import processing.mode.java.pdex.Problem; -import processing.mode.java.pdex.XQErrorTable; +import processing.mode.java.pdex.PDEX; +import processing.mode.java.pdex.JavaProblem; +import processing.mode.java.pdex.SourceUtils; +import processing.mode.java.preproc.PdePreprocessor; import processing.mode.java.runner.Runner; import processing.mode.java.tweak.ColorControlBox; import processing.mode.java.tweak.Handle; @@ -63,23 +48,16 @@ public class JavaEditor extends Editor { // Runner associated with this editor window private Runner runtime; - // Need to sort through the rest of these additions... + private boolean runtimeLaunchRequested; + private final Object runtimeLock = new Object[0]; - protected Color breakpointColor; - protected Color currentLineColor; - protected Color breakpointMarkerColor; - protected Color currentLineMarkerColor; + // Need to sort through the rest of these additions [fry] - protected List breakpointedLines = - new ArrayList(); + protected final List breakpointedLines = new ArrayList<>(); protected LineHighlight currentLine; // where the debugger is suspended protected final String breakpointMarkerComment = " //<>//"; protected JMenu debugMenu; -// JCheckBoxMenuItem enableDebug; -// boolean debugEnabled; -// JMenuItem enableDebug; - protected JMenuItem debugItem; protected Debugger debugger; protected boolean debugEnabled; @@ -87,22 +65,13 @@ public class JavaEditor extends Editor { protected VariableInspector inspector; protected JMenuItem inspectorItem; -// private EditorToolbar javaToolbar; -// private DebugToolbar debugToolbar; - - private ErrorColumn errorBar; - -// protected XQConsoleToggle btnShowConsole; -// protected XQConsoleToggle btnShowErrors; - protected JScrollPane errorTableScrollPane; -// protected JPanel consoleProblemsPane; - protected XQErrorTable errorTable; static final int ERROR_TAB_INDEX = 0; private boolean hasJavaTabs; private boolean javaTabWarned; - protected ErrorCheckerService errorCheckerService; + protected PreprocessingService preprocessingService; + protected PDEX pdex; protected JavaEditor(Base base, String path, EditorState state, @@ -113,46 +82,6 @@ protected JavaEditor(Base base, String path, EditorState state, debugger = new Debugger(this); inspector = new VariableInspector(this); - // Add show usage option - JMenuItem showUsageItem = new JMenuItem("Show Usage..."); - showUsageItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - handleShowUsage(); - } - }); - getTextArea().getRightClickPopup().add(showUsageItem); - - // add refactor option - JMenuItem renameItem = new JMenuItem("Rename..."); - renameItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - handleRefactor(); - } - }); - - // TODO: Add support for word select on right click and rename. - // ta.customPainter.addMouseListener(new MouseAdapter() { - // public void mouseClicked(MouseEvent evt) { - // System.out.println(evt); - // } - // }); - textarea.getRightClickPopup().add(renameItem); - // set action on frame close - // addWindowListener(new WindowAdapter() { - // @Override - // public void windowClosing(WindowEvent e) { - // onWindowClosing(e); - // } - // }); - - Toolkit.setMenuMnemonics(textarea.getRightClickPopup()); - - // load settings from theme.txt - breakpointColor = mode.getColor("breakpoint.bgcolor"); - breakpointMarkerColor = mode.getColor("breakpoint.marker.color"); - currentLineColor = mode.getColor("currentline.bgcolor"); - currentLineMarkerColor = mode.getColor("currentline.marker.color"); - // set breakpoints from marker comments for (LineID lineID : stripBreakpointComments()) { //System.out.println("setting: " + lineID); @@ -162,11 +91,8 @@ public void actionPerformed(ActionEvent e) { getSketch().setModified(false); hasJavaTabs = checkForJavaTabs(); - //initializeErrorChecker(); - - errorCheckerService = new ErrorCheckerService(this); - new Thread(errorCheckerService).start(); + /* // hack to add a JPanel to the right-hand side of the text area JPanel textAndError = new JPanel(); // parent is a vertical box with the toolbar, the header, and the text area @@ -174,14 +100,18 @@ public void actionPerformed(ActionEvent e) { // remove the text area temporarily box.remove(2); textAndError.setLayout(new BorderLayout()); - errorBar = new ErrorColumn(this, textarea.getMinimumSize().height, jmode); - textAndError.add(errorBar, BorderLayout.EAST); - textarea.setBounds(0, 0, errorBar.getX() - 1, textarea.getHeight()); + errorColumn = new MarkerColumn(this, textarea.getMinimumSize().height); + textAndError.add(errorColumn, BorderLayout.EAST); + textarea.setBounds(0, 0, errorColumn.getX() - 1, textarea.getHeight()); textAndError.add(textarea); // add our hacked version back to the editor box.add(textAndError); + */ - getJavaTextArea().setMode(jmode); + preprocessingService = new PreprocessingService(this); + pdex = new PDEX(this, preprocessingService); + + Toolkit.setMenuMnemonics(textarea.getRightClickPopup()); // ensure completion is hidden when editor loses focus addWindowFocusListener(new WindowFocusListener() { @@ -194,6 +124,11 @@ public void windowGainedFocus(WindowEvent e) { } } + public PdePreprocessor createPreprocessor(final String sketchName) { + return new PdePreprocessor(sketchName); + } + + protected JEditTextArea createTextArea() { return new JavaTextArea(new PdeTextAreaDefaults(mode), this); } @@ -204,6 +139,9 @@ public EditorToolbar createToolbar() { } + private int previousTabCount = 1; + + // TODO: this is a clumsy way to get notified when tabs get added/deleted // Override the parent call to add hook to the rebuild() method public EditorHeader createHeader() { return new EditorHeader(this) { @@ -211,7 +149,25 @@ public void rebuild() { super.rebuild(); // after Rename and New Tab, we may have new .java tabs - hasJavaTabs = checkForJavaTabs(); + boolean newHasJavaTabs = checkForJavaTabs(); + boolean hasJavaTabsChanged = hasJavaTabs != newHasJavaTabs; + hasJavaTabs = newHasJavaTabs; + + if (preprocessingService != null) { + if (hasJavaTabsChanged) { + preprocessingService.handleHasJavaTabsChange(hasJavaTabs); + pdex.hasJavaTabsChanged(hasJavaTabs); + if (hasJavaTabs) { + setProblemList(Collections.emptyList()); + } + } + + int currentTabCount = sketch.getCodeCount(); + if (currentTabCount != previousTabCount) { + previousTabCount = currentTabCount; + pdex.sketchChanged(); + } + } } }; } @@ -219,58 +175,8 @@ public void rebuild() { @Override public EditorFooter createFooter() { -// //JPanel consolePanel = new JPanel(); -// JTabbedPane footer = new JTabbedPane(JTabbedPane.BOTTOM); -//// tabPane.setUI(new BasicTabbedPaneUI()); -// footer.setUI(new SimpleTabbedPaneUI()); -//// tabPane.setUI(new SillyTabbedPaneUI()); -//// tabPane.setUI(new PlasticTabbedPaneUI()); -//// tabPane.setBorder(BorderFactory.createEmptyBorder()); -//// tabPane.setBackground(Color.RED); - -// EditorFooter footer = new EditorFooter(this); EditorFooter footer = super.createFooter(); - - // Adding Error Table in a scroll pane - errorTableScrollPane = new JScrollPane(); - errorTable = new XQErrorTable(this); - // errorTableScrollPane.setBorder(new EmptyBorder(2, 2, 2, 2)); -// errorTableScrollPane.setBorder(new EtchedBorder()); - errorTableScrollPane.setBorder(BorderFactory.createEmptyBorder()); -// errorTableScrollPane.setBorder(new EmptyBorder(0, Editor.LEFT_GUTTER, 0, 0)); - errorTableScrollPane.setViewportView(errorTable); - -// // Adding toggle console button -//// consolePanel.remove(2); // removes the line status -// JPanel lineStatusPanel = new JPanel(); -// lineStatusPanel.setLayout(new BorderLayout()); -// btnShowConsole = new XQConsoleToggle(this, Language.text("editor.footer.console"), mode.getInteger("linestatus.height")); -// btnShowErrors = new XQConsoleToggle(this, Language.text("editor.footer.errors"), mode.getInteger("linestatus.height")); -// btnShowConsole.addMouseListener(btnShowConsole); -// btnShowErrors.addMouseListener(btnShowErrors); - -// JPanel toggleButtonPanel = new JPanel(new BorderLayout()); -// toggleButtonPanel.add(btnShowConsole, BorderLayout.EAST); -// toggleButtonPanel.add(btnShowErrors, BorderLayout.WEST); -// lineStatusPanel.add(toggleButtonPanel, BorderLayout.EAST); -//// lineStatus.setBounds(0, 0, toggleButtonPanel.getX() - 1, -//// toggleButtonPanel.getHeight()); -//// lineStatusPanel.add(lineStatus); -// consolePanel.add(lineStatusPanel, BorderLayout.SOUTH); -// lineStatusPanel.repaint(); - -// // Adding JPanel with CardLayout for Console/Problems Toggle -//// consolePanel.remove(1); // removes the console itself -// consoleProblemsPane = new JPanel(new CardLayout()); -// consoleProblemsPane.add(errorTableScrollPane, Language.text("editor.footer.errors")); -// consoleProblemsPane.add(super.createConsolePanel(), Language.text("editor.footer.console")); -// consolePanel.add(consoleProblemsPane, BorderLayout.CENTER); - -// console = new EditorConsole(this); -// footer.addPanel(Language.text("editor.footer.console"), console); - footer.addPanel(errorTableScrollPane, Language.text("editor.footer.errors"), "/lib/footer/error"); - - //return consolePanel; + addErrorTable(footer); return footer; } @@ -316,7 +222,7 @@ public void actionPerformed(ActionEvent e) { stopItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (isDebuggerEnabled()) { - Logger.getLogger(JavaEditor.class.getName()).log(Level.INFO, "Invoked 'Stop' menu item"); + Messages.log("Invoked 'Stop' menu item"); debugger.stopDebug(); } else { handleStop(); @@ -355,7 +261,7 @@ public void actionPerformed(ActionEvent e) { menu.add(item); } - item = new JMenuItem("Welcome to Processing 3"); + item = new JMenuItem(Language.text("menu.help.welcome")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { @@ -390,6 +296,8 @@ public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) { if (textarea.isSelectionActive()) { handleFindReference(); + } else { + statusNotice(Language.text("editor.status.find_reference.select_word_first")); } } }); @@ -404,17 +312,17 @@ public void actionPerformed(ActionEvent e) { @Override public void menuSelected(MenuEvent e) { - boolean isCoreLibMenuItemAdded = false; - boolean isContribLibMenuItemAdded = false; - // Adding this in case references are included in a core library, - // or other core libraries are incuded in future - isCoreLibMenuItemAdded = addLibReferencesToSubMenu(mode.coreLibraries, libRefSubmenu); + // or other core libraries are included in the future + boolean isCoreLibMenuItemAdded = + addLibReferencesToSubMenu(mode.coreLibraries, libRefSubmenu); - if (isCoreLibMenuItemAdded && !mode.contribLibraries.isEmpty()) + if (isCoreLibMenuItemAdded && !mode.contribLibraries.isEmpty()) { libRefSubmenu.addSeparator(); + } - isContribLibMenuItemAdded = addLibReferencesToSubMenu(mode.contribLibraries, libRefSubmenu); + boolean isContribLibMenuItemAdded = + addLibReferencesToSubMenu(mode.contribLibraries, libRefSubmenu); if (!isContribLibMenuItemAdded && !isCoreLibMenuItemAdded) { JMenuItem emptyMenuItem = new JMenuItem(Language.text("menu.help.empty")); @@ -422,8 +330,8 @@ public void menuSelected(MenuEvent e) { emptyMenuItem.setFocusable(false); emptyMenuItem.setFocusPainted(false); libRefSubmenu.add(emptyMenuItem); - } - else if (!isContribLibMenuItemAdded && !mode.coreLibraries.isEmpty()) { + + } else if (!isContribLibMenuItemAdded && !mode.coreLibraries.isEmpty()) { //re-populate the menu to get rid of terminal separator libRefSubmenu.removeAll(); addLibReferencesToSubMenu(mode.coreLibraries, libRefSubmenu); @@ -452,10 +360,10 @@ public void menuSelected(MenuEvent e) { boolean isCoreToolMenuItemAdded = false; boolean isContribToolMenuItemAdded = false; - List contribTools = getToolContribs(); + List contribTools = base.getToolContribs(); // Adding this in in case a reference folder is added for MovieMaker, or in case // other core tools are introduced later - isCoreToolMenuItemAdded = addToolReferencesToSubMenu(getCoreTools(), toolRefSubmenu); + isCoreToolMenuItemAdded = addToolReferencesToSubMenu(base.getCoreTools(), toolRefSubmenu); if (isCoreToolMenuItemAdded && !contribTools.isEmpty()) toolRefSubmenu.addSeparator(); @@ -474,7 +382,7 @@ public void menuSelected(MenuEvent e) { else if (!isContribToolMenuItemAdded && !contribTools.isEmpty()) { // re-populate the menu to get rid of terminal separator toolRefSubmenu.removeAll(); - addToolReferencesToSubMenu(getCoreTools(), toolRefSubmenu); + addToolReferencesToSubMenu(base.getCoreTools(), toolRefSubmenu); } } @@ -1035,7 +943,7 @@ public void propertyChange(PropertyChangeEvent e) { Object value = optionPane.getValue(); if (value.equals(exportButton)) { return jmode.handleExportApplication(sketch); - } else if (value.equals(cancelButton) || value.equals(Integer.valueOf(-1))) { + } else if (value.equals(cancelButton) || value.equals(-1)) { // closed window by hitting Cancel or ESC statusNotice(Language.text("export.notice.exporting.cancel")); } @@ -1153,49 +1061,49 @@ public void handleRun() { debugger.continueDebug(); } else { - new Thread(new Runnable() { - public void run() { - prepareRun(); - try { - toolbar.activateRun(); - //runtime = jmode.handleRun(sketch, JavaEditor.this); - runtime = jmode.handleLaunch(sketch, JavaEditor.this, false); - } catch (Exception e) { - statusError(e); - } - } - }).start(); + handleLaunch(false, false); } } public void handlePresent() { - new Thread(new Runnable() { - public void run() { - prepareRun(); - try { - toolbar.activateRun(); - //runtime = jmode.handlePresent(sketch, JavaEditor.this); - runtime = jmode.handleLaunch(sketch, JavaEditor.this, true); - } catch (Exception e) { - statusError(e); - } - } - }).start(); + handleLaunch(true, false); } public void handleTweak() { - new Thread(new Runnable() { - public void run() { - prepareRun(); - try { -// toolbar.activate(JavaToolbar.RUN); - toolbar.activateRun(); - runtime = jmode.handleTweak(sketch, JavaEditor.this); - } catch (Exception e) { - statusError(e); + autoSave(); + + if (sketch.isModified()) { + Messages.showMessage(Language.text("menu.file.save"), + Language.text("tweak_mode.save_before_tweak")); + return; + } + + handleLaunch(false, true); + } + + protected void handleLaunch(boolean present, boolean tweak) { + prepareRun(); + toolbar.activateRun(); + synchronized (runtimeLock) { + runtimeLaunchRequested = true; + } + new Thread(() -> { + try { + synchronized (runtimeLock) { + if (runtimeLaunchRequested) { + runtimeLaunchRequested = false; + RunnerListener listener = new RunnerListenerEdtAdapter(JavaEditor.this); + if (!tweak) { + runtime = jmode.handleLaunch(sketch, listener, present); + } else { + runtime = jmode.handleTweak(sketch, listener, JavaEditor.this); + } + } } + } catch (Exception e) { + EventQueue.invokeLater(() -> statusError(e)); } }).start(); } @@ -1210,23 +1118,24 @@ public void handleStop() { debugger.stopDebug(); } else { -// toolbar.activate(JavaToolbar.STOP); toolbar.activateStop(); try { - //jmode.handleStop(); - if (runtime != null) { - runtime.close(); // kills the window - runtime = null; - // } else { - // System.out.println("runtime is null"); + synchronized (runtimeLock) { + if (runtimeLaunchRequested) { + // Cancel the launch before the runtime was created + runtimeLaunchRequested = false; + } + if (runtime != null) { + // Cancel the launch after the runtime was created + runtime.close(); // kills the window + runtime = null; + } } } catch (Exception e) { statusError(e); } -// toolbar.deactivate(JavaToolbar.RUN); -// toolbar.deactivate(JavaToolbar.STOP); toolbar.deactivateStop(); toolbar.deactivateRun(); @@ -1238,32 +1147,42 @@ public void handleStop() { public void handleStep(int modifiers) { if (modifiers == 0) { - Logger.getLogger(getClass().getName()).log(Level.INFO, "Invoked 'Step Over' menu item"); + Messages.log("Invoked 'Step Over' menu item"); debugger.stepOver(); - } else if ((modifiers & KeyEvent.SHIFT_DOWN_MASK) != 0) { - Logger.getLogger(getClass().getName()).log(Level.INFO, "Invoked 'Step Into' menu item"); + } else if ((modifiers & ActionEvent.SHIFT_MASK) != 0) { + Messages.log("Invoked 'Step Into' menu item"); debugger.stepInto(); - } else if ((modifiers & KeyEvent.ALT_DOWN_MASK) != 0) { - Logger.getLogger(getClass().getName()).log(Level.INFO, "Invoked 'Step Out' menu item"); + } else if ((modifiers & ActionEvent.ALT_MASK) != 0) { + Messages.log("Invoked 'Step Out' menu item"); debugger.stepOut(); } } public void handleContinue() { - Logger.getLogger(JavaEditor.class.getName()).log(Level.INFO, "Invoked 'Continue' menu item"); + Messages.log("Invoked 'Continue' menu item"); debugger.continueDebug(); } - /** Toggle a breakpoint on the current line. */ - public void toggleBreakpoint() { - debugger.toggleBreakpoint(getCurrentLineID().lineIdx()); + public void onRunnerExiting(Runner runner) { + synchronized (runtimeLock) { + if (this.runtime == runner) { + deactivateRun(); + } + } } +// /** Toggle a breakpoint on the current line. */ +// public void toggleBreakpoint() { +// toggleBreakpoint(getCurrentLineID().lineIdx()); +// } + + + @Override public void toggleBreakpoint(int lineIndex) { debugger.toggleBreakpoint(lineIndex); } @@ -1345,6 +1264,24 @@ public void handleImportLibrary(String libraryName) { } + @Override + public void librariesChanged() { + preprocessingService.notifyLibrariesChanged(); + } + + + @Override + public void codeFolderChanged() { + preprocessingService.notifyCodeFolderChanged(); + } + + + @Override + public void sketchChanged() { + preprocessingService.notifySketchChanged(); + } + + public void statusError(String what) { super.statusError(what); // new Exception("deactivating RUN").printStackTrace(); @@ -1355,9 +1292,9 @@ public void statusError(String what) { public void internalCloseRunner() { // Added temporarily to dump error log. TODO: Remove this later [mk29] - if (JavaMode.errorLogsEnabled) { - writeErrorsToFile(); - } + //if (JavaMode.errorLogsEnabled) { + // writeErrorsToFile(); + //} handleStop(); } @@ -1382,108 +1319,12 @@ public void dispose() { if (inspector != null) { inspector.dispose(); } - errorCheckerService.stopThread(); + preprocessingService.dispose(); + pdex.dispose(); super.dispose(); } - /** - * Writes all error messages to a csv file. - * For analytics purposes only. - */ - private void writeErrorsToFile() { - if (errorCheckerService.tempErrorLog.size() == 0) return; - - try { - System.out.println("Writing errors"); - StringBuilder sb = new StringBuilder(); - sb.append("Sketch: " + getSketch().getFolder() + ", " - + new java.sql.Timestamp(new java.util.Date().getTime()) - + "\nComma in error msg is substituted with ^ symbol\nFor separating arguments in error args | symbol is used\n"); - sb.append("ERROR TYPE, ERROR ARGS, ERROR MSG\n"); - - for (String errMsg : errorCheckerService.tempErrorLog.keySet()) { - IProblem ip = errorCheckerService.tempErrorLog.get(errMsg); - if (ip != null) { - sb.append(ErrorMessageSimplifier.getIDName(ip.getID())); - sb.append(','); - sb.append("{"); - for (int i = 0; i < ip.getArguments().length; i++) { - sb.append(ip.getArguments()[i]); - if (i < ip.getArguments().length-1) - sb.append("| "); - } - sb.append("}"); - sb.append(','); - sb.append(ip.getMessage().replace(',', '^')); - sb.append("\n"); - } - } - System.out.println(sb); - File opFile = new File(getSketch().getFolder(), "ErrorLogs" - + File.separator + "ErrorLog_" + System.currentTimeMillis() + ".csv"); - PApplet.saveStream(opFile, new ByteArrayInputStream(sb.toString() - .getBytes(Charset.defaultCharset()))); - } catch (Exception e) { - System.err.println("Failed to save log file for sketch " + getSketch().getName()); - e.printStackTrace(); - } - } - - - /* - private AtomicBoolean debugToolbarEnabled; - - public boolean isDebugToolbarEnabled() { - return debugToolbarEnabled != null && debugToolbarEnabled.get(); - } - - - /// Toggles between java mode and debug mode toolbar - protected void switchToolbars(){ - final EditorToolbar nextToolbar; - if(debugToolbarEnabled.get()){ - // switch to java - if(javaToolbar == null) - javaToolbar = createToolbar(); - nextToolbar = javaToolbar; - debugToolbarEnabled.set(false); - Base.log("Switching to Java Mode Toolbar"); - } - else{ - // switch to debug - if(debugToolbar == null) - debugToolbar = new DebugToolbar(this, getBase()); - nextToolbar = debugToolbar; - debugToolbarEnabled.set(true); - Base.log("Switching to Debugger Toolbar"); - } - - SwingUtilities.invokeLater(new Runnable() { - public void run() { - Box upper = (Box)splitPane.getComponent(0); - upper.remove(0); - upper.add(nextToolbar, 0); - upper.validate(); - nextToolbar.repaint(); - toolbar = nextToolbar; - // The toolbar responds to shift down/up events - // in order to show the alt version of toolbar buttons. - // With toolbar switch, KeyListener has to be changed as well - for (KeyListener kl : textarea.getKeyListeners()) { - if(kl instanceof EditorToolbar) - { - textarea.removeKeyListener(kl); - textarea.addKeyListener(toolbar); - break; - } - } - textarea.repaint(); - } - }); - } - */ - /** * Creates the debug menu. Includes ActionListeners for the menu items. * Intended for adding to the menu bar. @@ -1543,7 +1384,7 @@ public void actionPerformed(ActionEvent e) { // }); // debugMenu.add(item); - item = Toolkit.newJMenuItem(Language.text("menu.debug.step"), KeyEvent.VK_J); + item = Toolkit.newJMenuItemExt("menu.debug.step"); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleStep(0); @@ -1552,19 +1393,19 @@ public void actionPerformed(ActionEvent e) { debugMenu.add(item); item.setEnabled(false); - item = Toolkit.newJMenuItemShift(Language.text("menu.debug.step_into"), KeyEvent.VK_J); + item = Toolkit.newJMenuItemExt("menu.debug.step_into"); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - handleStep(KeyEvent.SHIFT_DOWN_MASK); + handleStep(ActionEvent.SHIFT_MASK); } }); debugMenu.add(item); item.setEnabled(false); - item = Toolkit.newJMenuItemAlt(Language.text("menu.debug.step_out"), KeyEvent.VK_J); + item = Toolkit.newJMenuItemExt("menu.debug.step_out"); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - handleStep(KeyEvent.ALT_DOWN_MASK); + handleStep(ActionEvent.ALT_MASK); } }); debugMenu.add(item); @@ -1576,8 +1417,9 @@ public void actionPerformed(ActionEvent e) { Toolkit.newJMenuItem(Language.text("menu.debug.toggle_breakpoint"), 'B'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - Logger.getLogger(JavaEditor.class.getName()).log(Level.INFO, "Invoked 'Toggle Breakpoint' menu item"); - toggleBreakpoint(); + Messages.log("Invoked 'Toggle Breakpoint' menu item"); + // TODO wouldn't getCaretLine() do the same thing with less effort? + toggleBreakpoint(getCurrentLineID().lineIdx()); } }); debugMenu.add(item); @@ -1665,32 +1507,12 @@ public void actionPerformed(ActionEvent e) { // }); // debugMenu.add(item); - /* - item = Toolkit.newJMenuItem(Language.text("menu.debug.show_sketch_outline"), KeyEvent.VK_L); - item.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - Base.log("Show Sketch Outline:"); - errorCheckerService.getASTGenerator().showSketchOutline(); - } - }); - debugMenu.add(item); - - item = Toolkit.newJMenuItem(Language.text("menu.debug.show_tabs_list"), KeyEvent.VK_Y); - item.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - Base.log("Show Tab Outline:"); - errorCheckerService.getASTGenerator().showTabOutline(); - } - }); - debugMenu.add(item); - */ - return debugMenu; } + @Override public boolean isDebuggerEnabled() { - //return enableDebug.isSelected(); return debugEnabled; } @@ -1731,7 +1553,7 @@ public JMenu buildModeMenu() { * removed from. */ protected List stripBreakpointComments() { - List bps = new ArrayList(); + List bps = new ArrayList<>(); // iterate over all tabs Sketch sketch = getSketch(); for (int i = 0; i < sketch.getCodeCount(); i++) { @@ -1799,48 +1621,15 @@ protected void addBreakpointComments(String tabFilename) { tab.setProgram(code); tab.save(); } catch (IOException ex) { - Logger.getLogger(JavaEditor.class.getName()).log(Level.SEVERE, null, ex); + Messages.loge(null, ex); } } @Override public boolean handleSave(boolean immediately) { - //System.out.println("handleSave " + immediately); - - //log("handleSave, viewing autosave? " + viewingAutosaveBackup); - /* If user wants to save a backup, the backup sketch should get - * copied to the main sketch directory, simply reload the main sketch. - */ - if(viewingAutosaveBackup){ - /* - File files[] = autosaver.getSketchBackupFolder().listFiles(); - File src = autosaver.getSketchBackupFolder(), dst = autosaver - .getActualSketchFolder(); - for (File f : files) { - log("Copying " + f.getAbsolutePath() + " to " + dst.getAbsolutePath()); - try { - if (f.isFile()) { - f.delete(); - Base.copyFile(f, new File(dst + File.separator + f.getName())); - } else { - Base.removeDir(f); - Base.copyDir(f, new File(dst + File.separator + f.getName())); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - File sk = autosaver.getActualSketchFolder(); - Base.removeDir(autosaver.getAutoSaveDir()); - //handleOpenInternal(sk.getAbsolutePath() + File.separator + sk.getName() + ".pde"); - getBase().handleOpen(sk.getAbsolutePath() + File.separator + sk.getName() + ".pde"); - //viewingAutosaveBackup = false; - */ - } - // note modified tabs - final List modified = new ArrayList(); + final List modified = new ArrayList<>(); for (int i = 0; i < getSketch().getCodeCount(); i++) { SketchCode tab = getSketch().getCode(i); if (tab.isModified()) { @@ -1871,9 +1660,6 @@ public void run() { } - private boolean viewingAutosaveBackup; - - /** * Set text contents of a specific tab. Updates underlying document and text * area. Clears Breakpoints. @@ -1969,8 +1755,8 @@ public JavaTextArea getJavaTextArea() { } - public ErrorCheckerService getErrorChecker() { - return errorCheckerService; + public PreprocessingService getPreprocessingService() { + return preprocessingService; } @@ -1983,7 +1769,7 @@ public void prepareRun() { autoSave(); super.prepareRun(); downloadImports(); - errorCheckerService.quickErrorCheck(); + preprocessingService.cancel(); } @@ -1993,24 +1779,23 @@ public void prepareRun() { * them. */ protected void downloadImports() { - String importRegex = errorCheckerService.importRegexp; - String tabCode; for (SketchCode sc : sketch.getCode()) { if (sc.isExtension("pde")) { - tabCode = sc.getProgram(); + String tabCode = sc.getProgram(); - String[][] pieces = PApplet.matchAll(tabCode, importRegex); + List imports = SourceUtils.parseProgramImports(tabCode); - if (pieces != null) { - ArrayList importHeaders = new ArrayList(); - for (String[] importStatement : pieces) { - importHeaders.add(importStatement[2]); + if (!imports.isEmpty()) { + ArrayList importHeaders = new ArrayList<>(); + for (ImportStatement importStatement : imports) { + importHeaders.add(importStatement.getFullClassName()); } - List installLibsHeaders = getNotInstalledAvailableLibs(importHeaders); + List installLibsHeaders = + getNotInstalledAvailableLibs(importHeaders); if (!installLibsHeaders.isEmpty()) { StringBuilder libList = new StringBuilder("Would you like to install them now?"); for (AvailableContribution ac : installLibsHeaders) { - libList.append("\n • " + ac.getName()); + libList.append("\n • ").append(ac.getName()); } int option = Messages.showYesNoQuestion(this, Language.text("contrib.import.dialog.title"), @@ -2018,8 +1803,7 @@ protected void downloadImports() { libList.toString()); if (option == JOptionPane.YES_OPTION) { - ContributionManager.downloadAndInstallOnImport(base, - installLibsHeaders); + ContributionManager.downloadAndInstallOnImport(base, installLibsHeaders); } } } @@ -2035,16 +1819,18 @@ protected void downloadImports() { * @param importHeaders */ private List getNotInstalledAvailableLibs(ArrayList importHeadersList) { - Map importMap = ContributionListing.getInstance().librariesByImportHeader; - ArrayList libList = new ArrayList(); + Map importMap = + ContributionListing.getInstance().getLibrariesByImportHeader(); + List libList = new ArrayList<>(); for (String importHeaders : importHeadersList) { int dot = importHeaders.lastIndexOf('.'); String entry = (dot == -1) ? importHeaders : importHeaders.substring(0, dot); - if (entry.startsWith("java.") || entry.startsWith("javax.") - || entry.startsWith("processing.")) { - continue;// null; + if (entry.startsWith("java.") || + entry.startsWith("javax.") || + entry.startsWith("processing.")) { + continue; } Library library = null; @@ -2177,13 +1963,8 @@ protected void activateRun() { * To initiate a "stop" action, call handleStop() instead. */ public void deactivateRun() { -// if (toolbar instanceof DebugToolbar){ -// toolbar.deactivate(DebugToolbar.RUN); -// } else { -// toolbar.deactivate(JavaToolbar.RUN); toolbar.deactivateRun(); debugItem.setEnabled(true); -// } } @@ -2233,7 +2014,7 @@ public void toggleDebug() { for (Component item : debugMenu.getMenuComponents()) { if (item instanceof JMenuItem && item != debugItem) { - ((JMenuItem) item).setEnabled(debugEnabled); + item.setEnabled(debugEnabled); } } } @@ -2298,8 +2079,8 @@ public void setCurrentLine(LineID line) { // scroll to line, by setting the cursor cursorToLineStart(line.lineIdx()); // highlight line - currentLine = new LineHighlight(line.lineIdx(), currentLineColor, this); - currentLine.setMarker(getJavaTextArea().currentLineMarker, currentLineMarkerColor); + currentLine = new LineHighlight(line.lineIdx(), this); + currentLine.setMarker(PdeTextArea.STEP_MARKER); currentLine.setPriority(10); // fixes current line being hidden by the breakpoint when moved down } @@ -2327,8 +2108,8 @@ public void clearCurrentLine() { * @param lineID the line id to highlight as breakpointed */ public void addBreakpointedLine(LineID lineID) { - LineHighlight hl = new LineHighlight(lineID, breakpointColor, this); - hl.setMarker(getJavaTextArea().breakpointMarker, breakpointMarkerColor); + LineHighlight hl = new LineHighlight(lineID, this); + hl.setMarker(PdeTextArea.BREAK_MARKER); breakpointedLines.add(hl); // repaint current line if it's on this line if (currentLine != null && currentLine.getLineID().equals(lineID)) { @@ -2337,17 +2118,6 @@ public void addBreakpointedLine(LineID lineID) { } - /** - * Add highlight for a breakpointed line on the current tab. - * @param lineIdx the line index on the current tab to highlight as - * breakpointed - */ - //TODO: remove and replace by {@link #addBreakpointedLine(LineID lineID)} - public void addBreakpointedLine(int lineIdx) { - addBreakpointedLine(getLineIDInCurrentTab(lineIdx)); - } - - /** * Remove a highlight for a breakpointed line. Needs to be on the current tab. * @param lineIdx the line index on the current tab to remove a breakpoint @@ -2384,7 +2154,6 @@ public void clearBreakpointedLines() { breakpointedLines.clear(); // remove all breakpoints // fix highlights not being removed when tab names have // changed due to opening a new sketch in same editor - getJavaTextArea().clearLineBgColors(); // force clear all highlights getJavaTextArea().clearGutterText(); // repaint current line @@ -2433,19 +2202,23 @@ public boolean isInCurrentTab(LineID line) { */ @Override public void setCode(SketchCode code) { + Document oldDoc = code.getDocument(); + //System.out.println("tab switch: " + code.getFileName()); // set the new document in the textarea, etc. need to do this first super.setCode(code); + Document newDoc = code.getDocument(); + if (oldDoc != newDoc && pdex != null) { + pdex.documentChanged(newDoc); + } + // set line background colors for tab final JavaTextArea ta = getJavaTextArea(); // can be null when setCode is called the first time (in constructor) if (ta != null) { - // clear all line backgrounds - ta.clearLineBgColors(); // clear all gutter text ta.clearGutterText(); - // load appropriate line backgrounds for tab // first paint breakpoints if (breakpointedLines != null) { for (LineHighlight hl : breakpointedLines) { @@ -2464,19 +2237,21 @@ public void setCode(SketchCode code) { if (getDebugger() != null && getDebugger().isStarted()) { getDebugger().startTrackingLineChanges(); } + if (errorColumn != null) { + errorColumn.repaint(); + } } /** * Get a tab by its file name. - * @param fileName the filename to search for. - * @return the {@link SketchCode} object representing the tab, or null if - * not found + * @param filename the filename to search for. + * @return the {@link SketchCode} object for the tab, or null if not found */ - public SketchCode getTab(String fileName) { + public SketchCode getTab(String filename) { Sketch s = getSketch(); for (SketchCode c : s.getCode()) { - if (c.getFileName().equals(fileName)) { + if (c.getFileName().equals(filename)) { return c; } } @@ -2498,22 +2273,10 @@ public SketchCode getCurrentTab() { * @return the document object */ public Document currentDocument() { - //return ta.getDocument(); return getCurrentTab().getDocument(); } -// /** -// * Event Handler for double clicking in the left hand gutter area. -// * @param lineIdx the line (0-based) that was double clicked -// */ -// public void gutterDblClicked(int lineIdx) { -// if (debugger != null) { -// debugger.toggleBreakpoint(lineIdx); -// } -// } - - public void statusBusy() { statusNotice(Language.text("editor.status.debug.busy")); } @@ -2524,139 +2287,128 @@ public void statusHalted() { } - public static final int STATUS_EMPTY = 100, STATUS_COMPILER_ERR = 200, - STATUS_WARNING = 300, STATUS_INFO = 400, STATUS_ERR = 500; - public int statusMessageType = STATUS_EMPTY; - public String statusMessage; - public void statusMessage(final String what, int type){ - // Don't re-display the old message again - if (type != STATUS_EMPTY) { - if (what.equals(statusMessage) && type == statusMessageType) { - return; - } - } - statusMessage = new String(what); - statusMessageType = type; - switch (type) { - case STATUS_COMPILER_ERR: - case STATUS_ERR: - super.statusError(what); - break; - case STATUS_INFO: - case STATUS_WARNING: - statusNotice(what); - break; - } - // Don't need to clear compiler error messages - if (type == STATUS_COMPILER_ERR) return; + /** + * Updates the error table in the Error Window. + * Overridden to handle the fugly import suggestions text. + */ + @Override + public void updateErrorTable(List problems) { + errorTable.clearRows(); - // Clear the message after a delay - SwingWorker s = new SwingWorker() { - @Override - protected Object doInBackground() throws Exception { - try { - Thread.sleep(2 * 1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - statusEmpty(); - return null; + for (Problem p : problems) { + JavaProblem jp = (JavaProblem) p; + String message = p.getMessage(); + if (JavaMode.importSuggestEnabled && + jp.getImportSuggestions() != null && + jp.getImportSuggestions().length > 0) { + message += " (double-click for suggestions)"; } - }; - s.execute(); - } - - public void statusEmpty(){ - statusMessage = null; - statusMessageType = STATUS_EMPTY; - super.statusEmpty(); - } - - -// /** -// * Initializes and starts Error Checker Service -// */ -// private void initializeErrorChecker() { -// Thread errorCheckerThread = null; -// -// if (errorCheckerThread == null) { -// errorCheckerService = new ErrorCheckerService(this); -// errorCheckerThread = new Thread(errorCheckerService); -// try { -// errorCheckerThread.start(); -// } catch (Exception e) { -// Base.loge("Error Checker Service not initialized", e); -// } -// } -// } - - - public void updateErrorBar(List problems) { - errorBar.updateErrorPoints(problems); - } - - - public List getErrorPoints() { - return errorBar.errorPoints; - } - - - public void repaintErrorBar() { - errorBar.repaint(); + errorTable.addRow(p, message, + sketch.getCode(jp.getTabIndex()).getPrettyName(), + Integer.toString(p.getLineNumber() + 1)); + // Added +1 because lineNumbers internally are 0-indexed + } } - public void showConsole() { - footer.setPanel(console); + @Override + public void errorTableDoubleClick(Object item) { + JavaProblem p = (JavaProblem) item; + +// MouseEvent evt = null; + String[] suggs = p.getImportSuggestions(); + if (suggs != null && suggs.length > 0) { +// String t = p.getMessage() + "(Import Suggestions available)"; +// FontMetrics fm = getFontMetrics(getFont()); +// int x1 = fm.stringWidth(p.getMessage()); +// int x2 = fm.stringWidth(t); +// if (evt.getX() > x1 && evt.getX() < x2) { + String[] list = p.getImportSuggestions(); + String className = list[0].substring(list[0].lastIndexOf('.') + 1); + String[] temp = new String[list.length]; + for (int i = 0; i < list.length; i++) { + temp[i] = "Import '" + className + "' (" + list[i] + ")"; + } + // showImportSuggestion(temp, evt.getXOnScreen(), evt.getYOnScreen() - 3 * getFont().getSize()); + Point mouse = MouseInfo.getPointerInfo().getLocation(); + showImportSuggestion(temp, mouse.x, mouse.y); + } else { + errorTableClick(item); + } } -// /** Toggle between Console and Errors List */ -// public void showProblemListView(String buttonName) { -//// CardLayout cl = (CardLayout) consoleProblemsPane.getLayout(); -//// cl.show(consoleProblemsPane, buttonName); -//// ((JTabbedPane) consolePanel).setSelectedIndex(ERROR_TAB_INDEX); -// footer.setPanel(errorTableScrollPane); -// } - + JFrame frmImportSuggest; - /** Updates the error table */ - synchronized public boolean updateTable(final TableModel tableModel) { - return errorTable.updateTable(tableModel); - } + private void showImportSuggestion(String[] list, int x, int y) { + if (frmImportSuggest != null) { +// frmImportSuggest.setVisible(false); +// frmImportSuggest = null; + return; + } + final JList classList = new JList<>(list); + classList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + frmImportSuggest = new JFrame(); + frmImportSuggest.setUndecorated(true); + frmImportSuggest.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + JPanel panel = new JPanel(); + panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); + panel.setBackground(Color.WHITE); + frmImportSuggest.setBackground(Color.WHITE); + panel.add(classList); + JLabel label = new JLabel("

    (Click to insert)
    "); + label.setBackground(Color.WHITE); + label.setHorizontalTextPosition(SwingConstants.LEFT); + panel.add(label); + panel.validate(); + frmImportSuggest.getContentPane().add(panel); + frmImportSuggest.pack(); + + classList.addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + if (classList.getSelectedValue() != null) { + try { + String t = classList.getSelectedValue().trim(); + Messages.log(t); + int x = t.indexOf('('); + String impString = "import " + t.substring(x + 1, t.indexOf(')')) + ";\n"; + int ct = getSketch().getCurrentCodeIndex(); + getSketch().setCurrentCode(0); + getTextArea().getDocument().insertString(0, impString, null); + getSketch().setCurrentCode(ct); + } catch (BadLocationException ble) { + Messages.log("Failed to insert import"); + ble.printStackTrace(); + } + } + frmImportSuggest.setVisible(false); + frmImportSuggest.dispose(); + frmImportSuggest = null; + } + }); - /** - * Handle whether the tiny red error indicator is shown near - * the error button at the bottom of the PDE - */ - public void updateErrorToggle() { - footer.setNotification(errorTableScrollPane, - JavaMode.errorCheckEnabled && - errorCheckerService.hasErrors()); -// String title = Language.text("editor.footer.errors"); -// if (JavaMode.errorCheckEnabled && errorCheckerService.hasErrors()) { -// title += "*"; -// } -// ((JTabbedPane) footer).setTitleAt(ERROR_TAB_INDEX, title); -//// btnShowErrors.updateMarker(JavaMode.errorCheckEnabled && -//// errorCheckerService.hasErrors(), -//// errorBar.errorColor); - } + frmImportSuggest.addWindowFocusListener(new WindowFocusListener() { + @Override + public void windowLostFocus(WindowEvent e) { + if (frmImportSuggest != null) { + frmImportSuggest.dispose(); + frmImportSuggest = null; + } + } - /** Handle refactor operation */ - private void handleRefactor() { - Messages.log("Caret at:" + textarea.getLineText(textarea.getCaretLine())); - errorCheckerService.getASTGenerator().handleRefactor(); - } + @Override + public void windowGainedFocus(WindowEvent e) { + } + }); - /** Handle show usage operation */ - private void handleShowUsage() { - Messages.log("Caret at:" + textarea.getLineText(textarea.getCaretLine())); - errorCheckerService.getASTGenerator().handleShowUsage(); + frmImportSuggest.setLocation(x, y); + frmImportSuggest.setBounds(x, y, 250, 100); + frmImportSuggest.pack(); + frmImportSuggest.setVisible(true); } @@ -2687,13 +2439,14 @@ private boolean checkForJavaTabs() { } + @Override protected void applyPreferences() { super.applyPreferences(); if (jmode != null) { jmode.loadPreferences(); Messages.log("Applying prefs"); // trigger it once to refresh UI - errorCheckerService.runManualErrorCheck(); + pdex.preferencesChanged(); } } @@ -2807,7 +2560,7 @@ protected void initBaseCode() { baseCode = new String[code.length]; for (int i = 0; i < code.length; i++) { - baseCode[i] = new String(code[i].getSavedProgram()); + baseCode[i] = code[i].getSavedProgram(); } } @@ -3029,11 +2782,9 @@ static private String replaceString(String str, int start, int end, String put) //private int howManyInts(ArrayList handles[]) static private int howManyInts(List> handles) { int count = 0; - //for (int i=0; i list : handles) { - //for (Handle n : handles[i]) { for (Handle n : list) { - if (n.type == "int" || n.type == "hex" || n.type == "webcolor") { + if ("int".equals(n.type) || "hex".equals(n.type) || "webcolor".equals(n.type)) { count++; } } @@ -3045,11 +2796,9 @@ static private int howManyInts(List> handles) { //private int howManyFloats(ArrayList handles[]) static private int howManyFloats(List> handles) { int count = 0; - //for (int i=0; i list : handles) { - //for (Handle n : handles[i]) { for (Handle n : list) { - if (n.type == "float") { + if ("float".equals(n.type)) { count++; } } diff --git a/java/src/processing/mode/java/JavaInputHandler.java b/java/src/processing/mode/java/JavaInputHandler.java index 9b5dec864d..0c02a4418c 100644 --- a/java/src/processing/mode/java/JavaInputHandler.java +++ b/java/src/processing/mode/java/JavaInputHandler.java @@ -40,7 +40,6 @@ * continuing to hack this class. */ public class JavaInputHandler extends PdeInputHandler { - private Editor editor; /** ctrl-alt on windows and linux, cmd-alt on mac os x */ static final int CTRL_ALT = ActionEvent.ALT_MASK | @@ -48,7 +47,7 @@ public class JavaInputHandler extends PdeInputHandler { public JavaInputHandler(Editor editor) { - this.editor = editor; + super(editor); } @@ -160,12 +159,12 @@ public boolean handlePressed(KeyEvent event) { textarea.setSelectedText(spaces(tabSize)); event.consume(); - } else if (!Preferences.getBoolean("editor.tabs.expand")) { + } else { // !Preferences.getBoolean("editor.tabs.expand") textarea.setSelectedText("\t"); event.consume(); } - } else if (c == 10 || c == 13) { // auto-indent + } else if (code == 10 || code == 13) { // auto-indent if (Preferences.getBoolean("editor.indent")) { char contents[] = textarea.getText().toCharArray(); int tabSize = Preferences.getInteger("editor.tabs.size"); @@ -324,6 +323,11 @@ public boolean handleTyped(KeyEvent event) { event.consume(); return true; } + // https://github.com/processing/processing/issues/3847 + if (c == KeyEvent.VK_SPACE) { + event.consume(); + return true; + } } return false; } diff --git a/java/src/processing/mode/java/JavaMode.java b/java/src/processing/mode/java/JavaMode.java index 76911232da..54a70462bb 100644 --- a/java/src/processing/mode/java/JavaMode.java +++ b/java/src/processing/mode/java/JavaMode.java @@ -30,10 +30,8 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import java.util.logging.FileHandler; -import java.util.logging.Handler; -import java.util.logging.Level; -import java.util.logging.Logger; + +import javax.swing.SwingUtilities; import processing.app.*; import processing.app.ui.Editor; @@ -54,7 +52,7 @@ public Editor createEditor(Base base, String path, public JavaMode(Base base, File folder) { super(base, folder); - initLogger(); +// initLogger(); loadPreferences(); } @@ -115,33 +113,6 @@ public Library getCoreLibrary() { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - /* - public Runner handleRun(Sketch sketch, - RunnerListener listener) throws SketchException { - final JavaEditor editor = (JavaEditor) listener; - editor.errorCheckerService.quickErrorCheck(); -// if (enableTweak) { -// enableTweak = false; -// return handleTweak(sketch, listener, false); -// } else { - return handleLaunch(sketch, listener, false); -// } - } - - - public Runner handlePresent(Sketch sketch, - RunnerListener listener) throws SketchException { - final JavaEditor editor = (JavaEditor) listener; - editor.errorCheckerService.quickErrorCheck(); -// if (enableTweak) { -// enableTweak = false; -// return handleTweak(sketch, listener, true); -// } else { - return handleLaunch(sketch, listener, true); -// } - } - */ - /** Handles the standard Java "Run" or "Present" */ public Runner handleLaunch(Sketch sketch, RunnerListener listener, @@ -169,17 +140,7 @@ public void run() { /** Start a sketch in tweak mode */ public Runner handleTweak(Sketch sketch, - RunnerListener listener) throws SketchException { -// final boolean present) throws SketchException { - final JavaEditor editor = (JavaEditor) listener; -// editor.errorCheckerService.quickErrorCheck(); // done in prepareRun() - - if (isSketchModified(sketch)) { - editor.deactivateRun(); - Messages.showMessage(Language.text("menu.file.save"), - Language.text("tweak_mode.save_before_tweak")); - return null; - } + RunnerListener listener, JavaEditor editor) throws SketchException { // first try to build the unmodified code JavaBuild build = new JavaBuild(sketch); @@ -216,17 +177,27 @@ public void run() { // } // next lines are executed when the sketch quits if (launchInteractive) { - editor.initEditorCode(parser.allHandles, false); - editor.stopTweakMode(parser.allHandles); + // fix swing deadlock issue: https://github.com/processing/processing/issues/3928 + SwingUtilities.invokeLater(new Runnable() { + public void run() { + editor.initEditorCode(parser.allHandles, false); + editor.stopTweakMode(parser.allHandles); + } + }); } } }).start(); if (launchInteractive) { - // replace editor code with baseCode - editor.initEditorCode(parser.allHandles, false); - editor.updateInterface(parser.allHandles, parser.colorBoxes); - editor.startTweakMode(); + // fix swing deadlock issue: https://github.com/processing/processing/issues/3928 + SwingUtilities.invokeLater(new Runnable() { + public void run() { + // replace editor code with baseCode + editor.initEditorCode(parser.allHandles, false); + editor.updateInterface(parser.allHandles, parser.colorBoxes); + editor.startTweakMode(); + } + }); } return runtime; } @@ -234,6 +205,7 @@ public void run() { } + /* // TODO Why is this necessary? Why isn't Sketch.isModified() used? static private boolean isSketchModified(Sketch sketch) { for (SketchCode sc : sketch.getCode()) { @@ -243,6 +215,7 @@ static private boolean isSketchModified(Sketch sketch) { } return false; } + */ // public void handleStop() { @@ -265,10 +238,13 @@ public boolean handleExportApplication(Sketch sketch) throws SketchException, IO } + /** + * Any modes that extend JavaMode can override this method to add additional + * JARs to be included in the classpath for code completion and error checking + * @return searchPath: file-paths separated by File.pathSeparatorChar + */ public String getSearchPath() { - return System.getProperty("java.class.path") + - File.pathSeparatorChar + System.getProperty("java.home") + - File.separator + "lib" + File.separator + "rt.jar"; + return getCoreLibrary().getJarPath(); } @@ -276,7 +252,7 @@ public String getSearchPath() { // Merged from ExperimentalMode - + /* void initLogger() { final boolean VERBOSE_LOGGING = true; final int LOG_SIZE = 512 * 1024; // max log file size (in bytes) @@ -306,6 +282,7 @@ void initLogger() { Logger.getLogger(JavaMode.class.getName()).log(Level.SEVERE, null, ex); } } + */ //ImageIcon classIcon, fieldIcon, methodIcon, localVarIcon; @@ -329,6 +306,7 @@ void initLogger() { static public volatile boolean defaultAutoSaveEnabled = true; static public volatile boolean ccTriggerEnabled = false; static public volatile boolean importSuggestEnabled = true; + static public volatile boolean inspectModeHotkeyEnabled = true; static public int autoSaveInterval = 3; //in minutes @@ -339,17 +317,19 @@ void initLogger() { static public final String prefErrorCheck = "pdex.errorCheckEnabled"; static public final String prefWarnings = "pdex.warningsEnabled"; - static public final String prefCodeCompletionEnabled = "pdex.completion"; - static public final String prefCCTriggerEnabled = "pdex.completion.trigger"; static public final String prefDebugOP = "pdex.dbgOutput"; static public final String prefErrorLogs = "pdex.writeErrorLogs"; static public final String prefAutoSaveInterval = "pdex.autoSaveInterval"; static public final String prefAutoSave = "pdex.autoSave.autoSaveEnabled"; static public final String prefAutoSavePrompt = "pdex.autoSave.promptDisplay"; static public final String prefDefaultAutoSave = "pdex.autoSave.autoSaveByDefault"; - static public final String prefImportSuggestEnabled = "pdex.importSuggestEnabled"; static public final String suggestionsFileName = "suggestions.txt"; + static public final String COMPLETION_PREF = "pdex.completion"; + static public final String COMPLETION_TRIGGER_PREF = "pdex.completion.trigger"; + static public final String SUGGEST_IMPORTS_PREF = "pdex.suggest.imports"; + static public final String INSPECT_MODE_HOTKEY_PREF = "pdex.inspectMode.hotkey"; + // static volatile public boolean enableTweak = false; /** @@ -363,7 +343,7 @@ public void loadPreferences() { ensurePrefsExist(); errorCheckEnabled = Preferences.getBoolean(prefErrorCheck); warningsEnabled = Preferences.getBoolean(prefWarnings); - codeCompletionsEnabled = Preferences.getBoolean(prefCodeCompletionEnabled); + codeCompletionsEnabled = Preferences.getBoolean(COMPLETION_PREF); // DEBUG = Preferences.getBoolean(prefDebugOP); errorLogsEnabled = Preferences.getBoolean(prefErrorLogs); autoSaveInterval = Preferences.getInteger(prefAutoSaveInterval); @@ -371,8 +351,9 @@ public void loadPreferences() { autoSaveEnabled = Preferences.getBoolean(prefAutoSave); autoSavePromptEnabled = Preferences.getBoolean(prefAutoSavePrompt); defaultAutoSaveEnabled = Preferences.getBoolean(prefDefaultAutoSave); - ccTriggerEnabled = Preferences.getBoolean(prefCCTriggerEnabled); - importSuggestEnabled = Preferences.getBoolean(prefImportSuggestEnabled); + ccTriggerEnabled = Preferences.getBoolean(COMPLETION_TRIGGER_PREF); + importSuggestEnabled = Preferences.getBoolean(SUGGEST_IMPORTS_PREF); + inspectModeHotkeyEnabled = Preferences.getBoolean(INSPECT_MODE_HOTKEY_PREF); loadSuggestionsMap(); } @@ -381,7 +362,7 @@ public void savePreferences() { Messages.log("Saving PDEX prefs"); Preferences.setBoolean(prefErrorCheck, errorCheckEnabled); Preferences.setBoolean(prefWarnings, warningsEnabled); - Preferences.setBoolean(prefCodeCompletionEnabled, codeCompletionsEnabled); + Preferences.setBoolean(COMPLETION_PREF, codeCompletionsEnabled); // Preferences.setBoolean(prefDebugOP, DEBUG); Preferences.setBoolean(prefErrorLogs, errorLogsEnabled); Preferences.setInteger(prefAutoSaveInterval, autoSaveInterval); @@ -389,8 +370,9 @@ public void savePreferences() { Preferences.setBoolean(prefAutoSave, autoSaveEnabled); Preferences.setBoolean(prefAutoSavePrompt, autoSavePromptEnabled); Preferences.setBoolean(prefDefaultAutoSave, defaultAutoSaveEnabled); - Preferences.setBoolean(prefCCTriggerEnabled, ccTriggerEnabled); - Preferences.setBoolean(prefImportSuggestEnabled, importSuggestEnabled); + Preferences.setBoolean(COMPLETION_TRIGGER_PREF, ccTriggerEnabled); + Preferences.setBoolean(SUGGEST_IMPORTS_PREF, importSuggestEnabled); + Preferences.setBoolean(INSPECT_MODE_HOTKEY_PREF, inspectModeHotkeyEnabled); } public void loadSuggestionsMap() { @@ -441,8 +423,8 @@ public void ensurePrefsExist() { Preferences.setBoolean(prefErrorCheck, errorCheckEnabled); if (Preferences.get(prefWarnings) == null) Preferences.setBoolean(prefWarnings, warningsEnabled); - if (Preferences.get(prefCodeCompletionEnabled) == null) - Preferences.setBoolean(prefCodeCompletionEnabled, codeCompletionsEnabled); + if (Preferences.get(COMPLETION_PREF) == null) + Preferences.setBoolean(COMPLETION_PREF, codeCompletionsEnabled); if (Preferences.get(prefDebugOP) == null) // Preferences.setBoolean(prefDebugOP, DEBUG); if (Preferences.get(prefErrorLogs) == null) @@ -457,10 +439,12 @@ public void ensurePrefsExist() { Preferences.setBoolean(prefAutoSavePrompt, autoSavePromptEnabled); if (Preferences.get(prefDefaultAutoSave) == null) Preferences.setBoolean(prefDefaultAutoSave, defaultAutoSaveEnabled); - if (Preferences.get(prefCCTriggerEnabled) == null) - Preferences.setBoolean(prefCCTriggerEnabled, ccTriggerEnabled); - if (Preferences.get(prefImportSuggestEnabled) == null) - Preferences.setBoolean(prefImportSuggestEnabled, importSuggestEnabled); + if (Preferences.get(COMPLETION_TRIGGER_PREF) == null) + Preferences.setBoolean(COMPLETION_TRIGGER_PREF, ccTriggerEnabled); + if (Preferences.get(SUGGEST_IMPORTS_PREF) == null) + Preferences.setBoolean(SUGGEST_IMPORTS_PREF, importSuggestEnabled); + if (Preferences.get(INSPECT_MODE_HOTKEY_PREF) == null) + Preferences.setBoolean(INSPECT_MODE_HOTKEY_PREF, inspectModeHotkeyEnabled); } diff --git a/java/src/processing/mode/java/JavaToolbar.java b/java/src/processing/mode/java/JavaToolbar.java index 2576856989..db178be1da 100644 --- a/java/src/processing/mode/java/JavaToolbar.java +++ b/java/src/processing/mode/java/JavaToolbar.java @@ -22,11 +22,11 @@ import java.awt.event.ActionEvent; import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.List; import javax.swing.Box; +import javax.swing.JLabel; import processing.app.Language; import processing.app.ui.Editor; @@ -59,7 +59,7 @@ public List createButtons() { final String runText = debug ? Language.text("toolbar.debug") : Language.text("toolbar.run"); - runButton = new EditorButton(mode, + runButton = new EditorButton(this, "/lib/toolbar/run", runText, Language.text("toolbar.present")) { @@ -71,20 +71,20 @@ public void actionPerformed(ActionEvent e) { outgoing.add(runButton); if (debug) { - stepButton = new EditorButton(mode, + stepButton = new EditorButton(this, "/lib/toolbar/step", Language.text("menu.debug.step"), Language.text("menu.debug.step_into"), Language.text("menu.debug.step_out")) { @Override public void actionPerformed(ActionEvent e) { - final int mask = KeyEvent.SHIFT_DOWN_MASK | KeyEvent.ALT_DOWN_MASK; + final int mask = ActionEvent.SHIFT_MASK | ActionEvent.ALT_MASK; jeditor.handleStep(e.getModifiers() & mask); } }; outgoing.add(stepButton); - continueButton = new EditorButton(mode, + continueButton = new EditorButton(this, "/lib/toolbar/continue", Language.text("menu.debug.continue")) { @Override @@ -95,7 +95,7 @@ public void actionPerformed(ActionEvent e) { outgoing.add(continueButton); } - stopButton = new EditorButton(mode, + stopButton = new EditorButton(this, "/lib/toolbar/stop", Language.text("toolbar.stop")) { @Override @@ -109,19 +109,21 @@ public void actionPerformed(ActionEvent e) { } - public void addModeButtons(Box box) { - EditorButton debugButton = new EditorButton(mode, "/lib/toolbar/debug", - Language.text("toolbar.debug")) { - + @Override + public void addModeButtons(Box box, JLabel label) { + EditorButton debugButton = + new EditorButton(this, "/lib/toolbar/debug", + Language.text("toolbar.debug")) { @Override public void actionPerformed(ActionEvent e) { jeditor.toggleDebug(); } }; -// debugButton.setReverse(); + if (((JavaEditor) editor).isDebuggerEnabled()) { debugButton.setSelected(true); } +// debugButton.setRolloverLabel(label); box.add(debugButton); addGap(box); } @@ -167,53 +169,3 @@ protected void deactivateStep() { repaint(); } } - - -/* -public class JavaToolbar extends EditorToolbar { - static protected final int RUN = 0; - static protected final int STOP = 1; - - - public JavaToolbar(Editor editor, Base base) { - super(editor, base); - } - - - public void init() { - Image[][] images = loadImages(); - for (int i = 0; i < 2; i++) { - addButton(getTitle(i, false), getTitle(i, true), images[i], false); - } - } - - - static public String getTitle(int index, boolean shift) { - switch (index) { - case RUN: return !shift ? Language.text("toolbar.run") : Language.text("toolbar.present"); - case STOP: return Language.text("toolbar.stop"); - } - return null; - } - - - public void handlePressed(MouseEvent e, int sel) { - boolean shift = e.isShiftDown(); - JavaEditor jeditor = (JavaEditor) editor; - - switch (sel) { - case RUN: - if (shift) { - jeditor.handlePresent(); - } else { - jeditor.handleRun(); - } - break; - - case STOP: - jeditor.handleStop(); - break; - } - } -} -*/ \ No newline at end of file diff --git a/java/src/processing/mode/java/VariableInspector.java b/java/src/processing/mode/java/VariableInspector.java index d82aff12f9..66eeba869a 100644 --- a/java/src/processing/mode/java/VariableInspector.java +++ b/java/src/processing/mode/java/VariableInspector.java @@ -26,8 +26,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.swing.*; import javax.swing.event.TreeExpansionEvent; @@ -40,17 +38,12 @@ import com.sun.jdi.Value; import processing.app.Language; +import processing.app.Messages; import processing.app.Mode; import processing.mode.java.debug.VariableNode; public class VariableInspector extends JDialog { -// static public final int GAP = 13; - -// EditorButton continueButton; -// EditorButton stepButton; -// EditorButton breakpointButton; - // The tray will be placed at this amount from the top of the editor window, // and extend to this amount from the bottom of the editor window. static final int VERTICAL_OFFSET = 64; @@ -88,7 +81,7 @@ public class VariableInspector extends JDialog { // protected Debugger dbg; /// list of expanded tree paths. (using list to maintain the order of expansion) - protected List expandedNodes = new ArrayList(); + protected List expandedNodes = new ArrayList<>(); public VariableInspector(final JavaEditor editor) { @@ -251,10 +244,10 @@ Container createScrollPane() { //System.out.println("renderer: " + tree.getDefaultRenderer(String.class).getClass()); //System.out.println("editor: " + tree.getDefaultEditor(String.class).getClass()); - callStack = new ArrayList(); - locals = new ArrayList(); - thisFields = new ArrayList(); - declaredThisFields = new ArrayList(); + callStack = new ArrayList<>(); + locals = new ArrayList<>(); + thisFields = new ArrayList<>(); + declaredThisFields = new ArrayList<>(); // Remove ugly (and unused) focus border on OS X scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); @@ -441,11 +434,12 @@ public void setValueFor(Object o, int i, Object o1) { break; } } catch (NumberFormatException ex) { - Logger.getLogger(VariableRowModel.class.getName()).log(Level.INFO, "invalid value entered for {0}: {1}", new Object[]{var.getName(), stringValue}); + Messages.log(getClass().getName() + " invalid value entered for " + + var.getName() + " -> " + stringValue); } if (value != null) { var.setValue(value); - Logger.getLogger(VariableRowModel.class.getName()).log(Level.INFO, "new value set: {0}", var.getStringValue()); + Messages.log(getClass().getName() + " new value set: " + var.getStringValue()); } } @@ -465,10 +459,10 @@ public String getColumnName(int i) { */ class OutlineRenderer implements RenderDataProvider { Icon[][] icons; - static final int ICON_SIZE = 16; // icon size (square, size=width=height) + static final int ICON_SIZE = 16; OutlineRenderer() { - icons = loadIcons("theme/var-icons.gif"); + icons = loadIcons("theme/variables-1x.png"); } /** @@ -483,7 +477,7 @@ private ImageIcon[][] loadIcons(String fileName) { Mode mode = editor.getMode(); File file = mode.getContentFile(fileName); if (!file.exists()) { - Logger.getLogger(OutlineRenderer.class.getName()).log(Level.SEVERE, "icon file not found: {0}", file.getAbsolutePath()); + Messages.log(getClass().getName(), "icon file not found: " + file.getAbsolutePath()); return null; } Image allIcons = mode.loadImage(fileName); @@ -702,7 +696,7 @@ public void treeCollapsed(TreeExpansionEvent tee) { // first remove all children of collapsed path // this makes sure children do not appear before parents in the list. // (children can't be expanded before their parents) - List removalList = new ArrayList(); + List removalList = new ArrayList<>(); for (TreePath path : expandedNodes) { if (path.getParentPath().equals(tee.getPath())) { removalList.add(path); @@ -917,7 +911,7 @@ protected TreePath synthesizePath(TreePath path) { * @return the filtered list. */ protected List filterNodes(List nodes, VariableNodeFilter filter) { - List filtered = new ArrayList(); + List filtered = new ArrayList<>(); for (VariableNode node : nodes) { if (filter.accept(node)) { filtered.add(node); diff --git a/java/src/processing/mode/java/debug/ArrayFieldNode.java b/java/src/processing/mode/java/debug/ArrayFieldNode.java index ec5423729a..8d527573e1 100644 --- a/java/src/processing/mode/java/debug/ArrayFieldNode.java +++ b/java/src/processing/mode/java/debug/ArrayFieldNode.java @@ -1,21 +1,22 @@ /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation + Part of the Processing project - http://processing.org -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. + Copyright (c) 2012-16 The Processing Foundation -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. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + version 2, as published by the Free Software Foundation. -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. + 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.mode.java.debug; @@ -24,45 +25,36 @@ import com.sun.jdi.ClassNotLoadedException; import com.sun.jdi.InvalidTypeException; import com.sun.jdi.Value; -import java.util.logging.Level; -import java.util.logging.Logger; + +import processing.app.Messages; /** * Specialized {@link VariableNode} for representing single fields in an array. * Overrides {@link #setValue} to properly change the value of the encapsulated * array field. - * - * @author Martin Leopold */ public class ArrayFieldNode extends VariableNode { - - protected ArrayReference array; - protected int index; - - /** - * Construct an {@link ArrayFieldNode}. - * - * @param name the name - * @param type the type - * @param value the value - * @param array a reference to the array - * @param index the index inside the array - */ - public ArrayFieldNode(String name, String type, Value value, ArrayReference array, int index) { - super(name, type, value); - this.array = array; - this.index = index; - } - - @Override - public void setValue(Value value) { - try { - array.setValue(index, value); - } catch (InvalidTypeException ex) { - Logger.getLogger(ArrayFieldNode.class.getName()).log(Level.SEVERE, null, ex); - } catch (ClassNotLoadedException ex) { - Logger.getLogger(ArrayFieldNode.class.getName()).log(Level.SEVERE, null, ex); - } - this.value = value; + protected ArrayReference array; + protected int index; + + + /** + * Construct an {@link ArrayFieldNode}. + */ + public ArrayFieldNode(String name, String type, Value value, ArrayReference array, int index) { + super(name, type, value); + this.array = array; + this.index = index; + } + + + @Override + public void setValue(Value value) { + try { + array.setValue(index, value); + } catch (InvalidTypeException | ClassNotLoadedException ex) { + Messages.loge(null, ex); } + this.value = value; + } } diff --git a/java/src/processing/mode/java/debug/ClassLoadListener.java b/java/src/processing/mode/java/debug/ClassLoadListener.java index bee6ffa471..1dd4a288d5 100644 --- a/java/src/processing/mode/java/debug/ClassLoadListener.java +++ b/java/src/processing/mode/java/debug/ClassLoadListener.java @@ -1,40 +1,38 @@ /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation + Part of the Processing project - http://processing.org -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. + Copyright (c) 2012-16 The Processing Foundation -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. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + version 2, as published by the Free Software Foundation. -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. + 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.mode.java.debug; import com.sun.jdi.ReferenceType; + /** * Listener to be notified when a class is loaded in the debugger. Used by * {@link LineBreakpoint}s to activate themselves as soon as the respective * class is loaded. - * - * @author Martin Leopold */ public interface ClassLoadListener { - /** - * Event handler called when a class is loaded. - * - * @param theClass the class - */ - public void classLoaded(ReferenceType theClass); + /** + * Event handler called when a class is loaded. + */ + public void classLoaded(ReferenceType theClass); } diff --git a/java/src/processing/mode/java/debug/FieldNode.java b/java/src/processing/mode/java/debug/FieldNode.java index 76b4bc2ad1..cae4d7178b 100644 --- a/java/src/processing/mode/java/debug/FieldNode.java +++ b/java/src/processing/mode/java/debug/FieldNode.java @@ -2,11 +2,12 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2012-15 The Processing Foundation - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 - as published by the Free Software Foundation. + Copyright (c) 2012-16 The Processing Foundation + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -14,8 +15,8 @@ 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. + 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.mode.java.debug; @@ -25,46 +26,40 @@ import com.sun.jdi.InvalidTypeException; import com.sun.jdi.ObjectReference; import com.sun.jdi.Value; -import java.util.logging.Level; -import java.util.logging.Logger; + +import processing.app.Messages; /** * Specialized {@link VariableNode} for representing fields. Overrides * {@link #setValue} to properly change the value of the encapsulated field. - * - * @author Martin Leopold */ public class FieldNode extends VariableNode { - protected Field field; - protected ObjectReference obj; + protected Field field; + protected ObjectReference obj; + + + /** + * Construct a {@link FieldNode}. + * @param obj a reference to the object containing the field + */ + public FieldNode(String name, String type, Value value, Field field, + ObjectReference obj) { + super(name, type, value); + this.field = field; + this.obj = obj; + } - - /** - * Construct a {@link FieldNode}. - * - * @param name the name - * @param type the type - * @param value the value - * @param field the field - * @param obj a reference to the object containing the field - */ - public FieldNode(String name, String type, Value value, Field field, ObjectReference obj) { - super(name, type, value); - this.field = field; - this.obj = obj; - } - - @Override - public void setValue(Value value) { - try { - obj.setValue(field, value); - } catch (InvalidTypeException ex) { - Logger.getLogger(FieldNode.class.getName()).log(Level.SEVERE, null, ex); - } catch (ClassNotLoadedException ex) { - Logger.getLogger(FieldNode.class.getName()).log(Level.SEVERE, null, ex); - } - this.value = value; + @Override + public void setValue(Value value) { + try { + obj.setValue(field, value); + } catch (InvalidTypeException ite) { + Messages.loge(null, ite); + } catch (ClassNotLoadedException cnle) { + Messages.loge(null, cnle); } + this.value = value; + } } diff --git a/java/src/processing/mode/java/debug/LineBreakpoint.java b/java/src/processing/mode/java/debug/LineBreakpoint.java index 5272270e5e..a5372553da 100644 --- a/java/src/processing/mode/java/debug/LineBreakpoint.java +++ b/java/src/processing/mode/java/debug/LineBreakpoint.java @@ -1,28 +1,27 @@ /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation + Part of the Processing project - http://processing.org -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. + Copyright (c) 2012-16 The Processing Foundation -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. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + version 2, as published by the Free Software Foundation. -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. + 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.mode.java.debug; import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; import processing.app.Messages; import processing.mode.java.Debugger; @@ -30,203 +29,227 @@ import com.sun.jdi.AbsentInformationException; import com.sun.jdi.Location; import com.sun.jdi.ReferenceType; +import com.sun.jdi.VMDisconnectedException; import com.sun.jdi.request.BreakpointRequest; + /** * Model/Controller of a line breakpoint. Can be set before or while debugging. * Adds a highlight using the debuggers view ({@link DebugEditor}). - * - * @author Martin Leopold */ public class LineBreakpoint implements ClassLoadListener { - - protected Debugger dbg; // the debugger - protected LineID line; // the line this breakpoint is set on - protected BreakpointRequest bpr; // the request on the VM's event request manager - protected ReferenceType theClass; // the class containing this breakpoint, null when not yet loaded - - /** - * Create a {@link LineBreakpoint}. If in a debug session, will try to - * immediately set the breakpoint. If not in a debug session or the - * corresponding class is not yet loaded the breakpoint will activate on - * class load. - * - * @param line the line id to create the breakpoint on - * @param dbg the {@link Debugger} - */ - public LineBreakpoint(LineID line, Debugger dbg) { - this.line = line; - line.startTracking(dbg.getEditor().getTab(line.fileName()).getDocument()); - this.dbg = dbg; - theClass = dbg.getClass(className()); // try to get the class immediately, may return null if not yet loaded - set(); // activate the breakpoint (show highlight, attach if debugger is running) - Logger.getLogger(LineBreakpoint.class.getName()).log(Level.INFO, "LBP Created " +toString() + " class: " + className(), new Object[]{}); + protected Debugger dbg; // the debugger + protected LineID line; // the line this breakpoint is set on + protected BreakpointRequest bpr; // the request on the VM's event request manager + protected String className; + + + /** + * Create a {@link LineBreakpoint}. If in a debug session, will try to + * immediately set the breakpoint. If not in a debug session or the + * corresponding class is not yet loaded the breakpoint will activate on + * class load. + * + * @param line the line id to create the breakpoint on + * @param dbg the {@link Debugger} + */ + public LineBreakpoint(LineID line, Debugger dbg) { + this.line = line; + line.startTracking(dbg.getEditor().getTab(line.fileName()).getDocument()); + this.dbg = dbg; + this.className = className(); + set(); // activate the breakpoint (show highlight, attach if debugger is running) + Messages.log("LBP Created " + toString() + " class: " + this.className); + } + + + /** + * Create a {@link LineBreakpoint} on a line in the current tab. + * @param lineIdx the line index of the current tab to create the breakpoint + */ + // TODO: remove and replace by {@link #LineBreakpoint(LineID line, Debugger dbg)} + public LineBreakpoint(int lineIdx, Debugger dbg) { + this(dbg.getEditor().getLineIDInCurrentTab(lineIdx), dbg); + } + + + /** + * Get the line id this breakpoint is on. + */ + public LineID lineID() { + return line; + } + + + /** + * Test if this breakpoint is on a certain line. + * + * @param testLine the line id to test + * @return true if this breakpoint is on the given line + */ + public boolean isOnLine(LineID testLine) { + return line.equals(testLine); + } + + + /** + * Attach this breakpoint to the VM. Creates and enables a + * {@link BreakpointRequest}. VM needs to be paused. + * + * @param theClass class to attach to + * @return true on success + */ + protected boolean attach(ReferenceType theClass) { + + if (theClass == null || className == null || + !className.equals(parseTopLevelClassName(theClass.name()))) { + return false; } - /** - * Create a {@link LineBreakpoint} on a line in the current tab. - * - * @param lineIdx the line index of the current tab to create the breakpoint - * on - * @param dbg the {@link Debugger} - */ - // TODO: remove and replace by {@link #LineBreakpoint(LineID line, Debugger dbg)} - public LineBreakpoint(int lineIdx, Debugger dbg) { - this(dbg.getEditor().getLineIDInCurrentTab(lineIdx), dbg); - } + log("trying to attach: " + line.fileName + ":" + line.lineIdx + " to " + theClass.name()); - /** - * Get the line id this breakpoint is on. - * - * @return the line id - */ - public LineID lineID() { - return line; + if (!dbg.isPaused()) { + log("can't attach breakpoint, debugger not paused"); + return false; } - /** - * Test if this breakpoint is on a certain line. - * - * @param testLine the line id to test - * @return true if this breakpoint is on the given line - */ - public boolean isOnLine(LineID testLine) { - return line.equals(testLine); + // find line in java space + LineID javaLine = dbg.sketchToJavaLine(line); + if (javaLine == null) { + log("couldn't find line " + line + " in the java code"); + return false; } - - /** - * Attach this breakpoint to the VM. Creates and enables a - * {@link BreakpointRequest}. VM needs to be paused. - */ - protected void attach() { - if (!dbg.isPaused()) { - Logger.getLogger(LineBreakpoint.class.getName()).log(Level.WARNING, "can't attach breakpoint, debugger not paused"); - return; - } - - if (theClass == null) { - Logger.getLogger(LineBreakpoint.class.getName()).log(Level.WARNING, "can't attach breakpoint, class not loaded: {0}", className()); - return; - } - - // find line in java space - LineID javaLine = dbg.sketchToJavaLine(line); - if (javaLine == null) { - Logger.getLogger(LineBreakpoint.class.getName()).log(Level.WARNING, "couldn't find line {0} in the java code", line); - return; - } - try { - Logger.getLogger(LineBreakpoint.class.getName()).log(Level.WARNING, "BPs of class: {0} , line " + (javaLine.lineIdx() + 1), new Object[]{theClass}); - List locations = theClass.locationsOfLine(javaLine.lineIdx() + 1); - if (locations.isEmpty()) { - Logger.getLogger(LineBreakpoint.class.getName()).log(Level.WARNING, "no location found for line {0} -> {1}", new Object[]{line, javaLine}); - return; - } - // use first found location - bpr = dbg.vm().eventRequestManager().createBreakpointRequest(locations.get(0)); - bpr.enable(); - Logger.getLogger(LineBreakpoint.class.getName()).log(Level.INFO, "attached breakpoint to {0} -> {1}", new Object[]{line, javaLine}); - } catch (AbsentInformationException ex) { - Logger.getLogger(Debugger.class.getName()).log(Level.SEVERE, null, ex); - } + try { + log("BPs of class: " + theClass + ", line " + (javaLine.lineIdx() + 1)); + List locations = theClass.locationsOfLine(javaLine.lineIdx() + 1); + if (locations.isEmpty()) { + log("no location found for line " + line + " -> " + javaLine); + return false; + } + // use first found location + bpr = dbg.vm().eventRequestManager().createBreakpointRequest(locations.get(0)); + bpr.enable(); + log("attached breakpoint to " + line + " -> " + javaLine); + return true; + } catch (AbsentInformationException ex) { + Messages.loge(null, ex); } + return false; + } - /** - * Detach this breakpoint from the VM. Deletes the - * {@link BreakpointRequest}. - */ - protected void detach() { - if (bpr != null) { - dbg.vm().eventRequestManager().deleteEventRequest(bpr); - bpr = null; - } - } - /** - * Set this breakpoint. Adds the line highlight. If Debugger is paused also - * attaches the breakpoint by calling {@link #attach()}. - */ - protected void set() { - dbg.addClassLoadListener(this); // class may not yet be loaded - dbg.getEditor().addBreakpointedLine(line); - if (theClass != null && dbg.isPaused()) { // class is loaded - // immediately activate the breakpoint - attach(); - } - if (dbg.getEditor().isInCurrentTab(line)) { - dbg.getEditor().getSketch().setModified(true); - } - } + protected boolean isAttached() { + return bpr != null; + } + - /** - * Remove this breakpoint. Clears the highlight and detaches the breakpoint - * if the debugger is paused. - */ - public void remove() { - dbg.removeClassLoadListener(this); - //System.out.println("removing " + line.lineIdx()); - dbg.getEditor().removeBreakpointedLine(line.lineIdx()); - if (dbg.isPaused()) { - // immediately remove the breakpoint - detach(); - } - line.stopTracking(); - if (dbg.getEditor().isInCurrentTab(line)) { - dbg.getEditor().getSketch().setModified(true); - } + /** + * Detach this breakpoint from the VM. Deletes the + * {@link BreakpointRequest}. + */ + public void detach() { + if (bpr != null) { + try { + dbg.vm().eventRequestManager().deleteEventRequest(bpr); + } catch (VMDisconnectedException ignore) { } + bpr = null; + } + } + + + /** + * Set this breakpoint. Adds the line highlight. If Debugger is paused + * also attaches the breakpoint by calling {@link #attach()}. + */ + protected void set() { + dbg.addClassLoadListener(this); // class may not yet be loaded + dbg.getEditor().addBreakpointedLine(line); + if (className != null && dbg.isPaused()) { // debugging right now, try to attach + for (ReferenceType rt : dbg.getClasses()) { + // try to attach to all top level or nested classes + if (attach(rt)) break; + } + } + if (dbg.getEditor().isInCurrentTab(line)) { + dbg.getEditor().getSketch().setModified(true); + } + } + + + /** + * Remove this breakpoint. Clears the highlight and detaches + * the breakpoint if the debugger is paused. + */ + public void remove() { + dbg.removeClassLoadListener(this); + //System.out.println("removing " + line.lineIdx()); + dbg.getEditor().removeBreakpointedLine(line.lineIdx()); + if (dbg.isPaused()) { + // immediately remove the breakpoint + detach(); } + line.stopTracking(); + if (dbg.getEditor().isInCurrentTab(line)) { + dbg.getEditor().getSketch().setModified(true); + } + } + + + @Override + public String toString() { + return line.toString(); + } -// public void enable() { -// } -// -// public void disable() { -// } - @Override - public String toString() { - return line.toString(); + + /** + * Get the name of the class this breakpoint belongs to. Needed for + * fetching the right location to create a breakpoint request. + * @return the class name + */ + protected String className() { + if (line.fileName().endsWith(".pde")) { + // standard tab + return dbg.getEditor().getSketch().getName(); } - /** - * Get the name of the class this breakpoint belongs to. Needed for fetching - * the right location to create a breakpoint request. - * - * @return the class name - */ - protected String className() { - if (line.fileName().endsWith(".pde")) { - // standard tab - ReferenceType mainClass = dbg.getMainClass(); - //System.out.println(dbg.getMainClass().name()); - if (mainClass == null) { - return null; - } - return dbg.getMainClass().name(); - } - - if (line.fileName().endsWith(".java")) { - // pure java tab - return line.fileName().substring(0, line.fileName().lastIndexOf(".java")); - } - - return null; + if (line.fileName().endsWith(".java")) { + // pure java tab + return line.fileName().substring(0, line.fileName().lastIndexOf(".java")); + } + return null; + } + + + /** + * Event handler called when a class is loaded in the debugger. Causes the + * breakpoint to be attached, if its class was loaded. + * + * @param theClass the class that was just loaded. + */ + @Override + public void classLoaded(ReferenceType theClass) { + if (!isAttached()) { + // try to attach + attach(theClass); } + } + + + static public String parseTopLevelClassName(String name) { + // Get rid of nested class name + int dollar = name.indexOf('$'); + return (dollar == -1) ? name : name.substring(0, dollar); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + - /** - * Event handler called when a class is loaded in the debugger. Causes the - * breakpoint to be attached, if its class was loaded. - * - * @param theClass the class that was just loaded. - */ - @Override - public void classLoaded(ReferenceType theClass) { - // check if our class is being loaded - Messages.log("Class Loaded: " + theClass.name()); - if (theClass.name().equals(className())) { - this.theClass = theClass; - attach(); - } - for (ReferenceType ct : theClass.nestedTypes()) { - Messages.log("Nested " + ct.name()); - } + private void log(String msg, Object... args) { + if (args != null && args.length != 0) { + Messages.logf(getClass().getName() + " " + msg, args); + } else { + Messages.log(getClass().getName() + " " + msg); } + } } diff --git a/java/src/processing/mode/java/debug/LineHighlight.java b/java/src/processing/mode/java/debug/LineHighlight.java index 13ad3bfbc5..66856f8292 100644 --- a/java/src/processing/mode/java/debug/LineHighlight.java +++ b/java/src/processing/mode/java/debug/LineHighlight.java @@ -1,26 +1,26 @@ /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation + Part of the Processing project - http://processing.org -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. + Copyright (c) 2012-16 The Processing Foundation -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. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + version 2, as published by the Free Software Foundation. -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. + 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.mode.java.debug; -import java.awt.Color; import java.util.HashSet; import java.util.Set; @@ -30,30 +30,20 @@ /** * Model/Controller for a highlighted source code line. Implements a custom * background color and a text based marker placed in the left-hand gutter area. - * - * @author Martin Leopold */ public class LineHighlight { - - protected JavaEditor editor; // the view, used for highlighting lines by setting a background color - protected Color bgColor; // the background color for highlighting lines - protected LineID lineID; // the id of the line + protected final JavaEditor editor; // the view, used for highlighting lines by setting a background color + protected final LineID lineID; // the id of the line protected String marker; // - protected Color markerColor; protected int priority = 0; - protected static Set allHighlights = new HashSet(); + protected static final Set allHighlights = new HashSet<>(); + - /** * Create a {@link LineHighlight}. - * - * @param lineID the line id to highlight - * @param bgColor the background color used for highlighting - * @param editor the {@link JavaEditor} */ - public LineHighlight(LineID lineID, Color bgColor, JavaEditor editor) { + public LineHighlight(LineID lineID, JavaEditor editor) { this.lineID = lineID; - this.bgColor = bgColor; this.editor = editor; lineID.addListener(this); lineID.startTracking(editor.getTab(lineID.fileName()).getDocument()); // TODO: overwrite a previous doc? @@ -61,10 +51,10 @@ public LineHighlight(LineID lineID, Color bgColor, JavaEditor editor) { allHighlights.add(this); } - + protected static boolean isHighestPriority(LineHighlight hl) { for (LineHighlight check : allHighlights) { - if (check.getLineID().equals(hl.getLineID()) && + if (check.getLineID().equals(hl.getLineID()) && check.priority() > hl.priority()) { return false; } @@ -72,136 +62,114 @@ protected static boolean isHighestPriority(LineHighlight hl) { return true; } - + public void setPriority(int p) { this.priority = p; } - + public int priority() { return priority; } - - /** - * Create a {@link LineHighlight} on the current tab. - * - * @param lineIdx the line index on the current tab to highlight - * @param bgColor the background color used for highlighting - * @param editor the {@link JavaEditor} - */ - // TODO: Remove and replace by {@link #LineHighlight(LineID lineID, Color bgColor, JavaEditor editor)} - public LineHighlight(int lineIdx, Color bgColor, JavaEditor editor) { - this(editor.getLineIDInCurrentTab(lineIdx), bgColor, editor); - } - /** - * Set a text based marker displayed in the left hand gutter area of this - * highlighted line. - * - * @param marker the marker text - */ - public void setMarker(String marker) { - this.marker = marker; - paint(); - } + /** + * Create a {@link LineHighlight} on the current tab. + * + * @param lineIdx the line index on the current tab to highlight + * @param editor the {@link JavaEditor} + */ + // TODO: Remove and replace by {@link #LineHighlight(LineID lineID, JavaEditor editor)} + public LineHighlight(int lineIdx, JavaEditor editor) { + this(editor.getLineIDInCurrentTab(lineIdx), editor); + } - /** - * Set a text based marker displayed in the left hand gutter area of this - * highlighted line. Also use a custom text color. - * - * @param marker the marker text - * @param markerColor the text color - */ - public void setMarker(String marker, Color markerColor) { - this.markerColor = markerColor; - setMarker(marker); - } - /** - * Retrieve the line id of this {@link LineHighlight}. - * - * @return the line id - */ - public LineID getLineID() { - return lineID; - } + /** + * Set a text based marker displayed in the left hand gutter area of this + * highlighted line. + * + * @param marker the marker text + */ + public void setMarker(String marker) { + this.marker = marker; + paint(); + } - /** - * Retrieve the color for highlighting this line. - * - * @return the highlight color. - */ - public Color getColor() { - return bgColor; - } - /** - * Test if this highlight is on a certain line. - * - * @param testLine the line to test - * @return true if this highlight is on the given line - */ - public boolean isOnLine(LineID testLine) { - return lineID.equals(testLine); - } + /** + * Retrieve the line id of this {@link LineHighlight}. + * + * @return the line id + */ + public LineID getLineID() { + return lineID; + } + + + /** + * Test if this highlight is on a certain line. + * + * @param testLine the line to test + * @return true if this highlight is on the given line + */ + public boolean isOnLine(LineID testLine) { + return lineID.equals(testLine); + } - /** - * Event handler for line number changes (due to editing). Will remove the - * highlight from the old line number and repaint it at the new location. - * - * @param line the line that has changed - * @param oldLineIdx the old line index (0-based) - * @param newLineIdx the new line index (0-based) - */ - public void lineChanged(LineID line, int oldLineIdx, int newLineIdx) { - // clear old line - if (editor.isInCurrentTab(new LineID(line.fileName(), oldLineIdx))) { - editor.getJavaTextArea().clearLineBgColor(oldLineIdx); - editor.getJavaTextArea().clearGutterText(oldLineIdx); - } - - // paint new line - // but only if it's on top -> fixes current line being hidden by breakpoint moving it down. - // lineChanged events seem to come in inverse order of startTracking the LineID. (and bp is created first...) - if (LineHighlight.isHighestPriority(this)) { - paint(); - } + + /** + * Event handler for line number changes (due to editing). Will remove the + * highlight from the old line number and repaint it at the new location. + * + * @param line the line that has changed + * @param oldLineIdx the old line index (0-based) + * @param newLineIdx the new line index (0-based) + */ + public void lineChanged(LineID line, int oldLineIdx, int newLineIdx) { + // clear old line + if (editor.isInCurrentTab(new LineID(line.fileName(), oldLineIdx))) { + editor.getJavaTextArea().clearGutterText(oldLineIdx); } - /** - * Notify this line highlight that it is no longer used. Call this for - * cleanup before the {@link LineHighlight} is discarded. - */ - public void dispose() { - lineID.removeListener(this); - lineID.stopTracking(); - allHighlights.remove(this); + // paint new line + // but only if it's on top -> fixes current line being hidden by breakpoint moving it down. + // lineChanged events seem to come in inverse order of startTracking the LineID. (and bp is created first...) + if (LineHighlight.isHighestPriority(this)) { + paint(); } + } + - /** - * (Re-)paint this line highlight. - */ - public void paint() { - if (editor.isInCurrentTab(lineID)) { - editor.getJavaTextArea().setLineBgColor(lineID.lineIdx(), bgColor); - if (marker != null) { - if (markerColor != null) { - editor.getJavaTextArea().setGutterText(lineID.lineIdx(), marker, markerColor); - } else { - editor.getJavaTextArea().setGutterText(lineID.lineIdx(), marker); - } - } - } + /** + * Notify this line highlight that it is no longer used. Call this for + * cleanup before the {@link LineHighlight} is discarded. + */ + public void dispose() { + lineID.removeListener(this); + lineID.stopTracking(); + allHighlights.remove(this); + } + + + /** + * (Re-)paint this line highlight. + */ + public void paint() { + if (editor.isInCurrentTab(lineID)) { + if (marker != null) { + editor.getJavaTextArea().setGutterText(lineID.lineIdx(), marker); + } } + } + - /** - * Clear this line highlight. - */ - public void clear() { - if (editor.isInCurrentTab(lineID)) { - editor.getJavaTextArea().clearLineBgColor(lineID.lineIdx()); - editor.getJavaTextArea().clearGutterText(lineID.lineIdx()); - } + /** + * Clear this line highlight. + */ + public void clear() { + if (editor.isInCurrentTab(lineID)) { + editor.getJavaTextArea().clearGutterText(lineID.lineIdx()); } + } } diff --git a/java/src/processing/mode/java/debug/LineID.java b/java/src/processing/mode/java/debug/LineID.java index e7c066110c..251a29ceee 100644 --- a/java/src/processing/mode/java/debug/LineID.java +++ b/java/src/processing/mode/java/debug/LineID.java @@ -1,29 +1,29 @@ /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation + Part of the Processing project - http://processing.org -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. + Copyright (c) 2012-16 The Processing Foundation -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. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + version 2, as published by the Free Software Foundation. -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. + 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.mode.java.debug; import java.util.HashSet; import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; + import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.BadLocationException; @@ -31,251 +31,247 @@ import javax.swing.text.Element; import javax.swing.text.Position; +import processing.app.Messages; + + /** * Describes an ID for a code line. Comprised of a file name and a (0-based) * line number. Can track changes to the line number due to text editing by * attaching a {@link Document}. Registered {@link LineListener}s are notified * of changes to the line number. - * - * @author Martin Leopold */ public class LineID implements DocumentListener { + protected String fileName; // the filename + protected int lineIdx; // the line number, 0-based + protected Document doc; // the Document to use for line number tracking + protected Position pos; // the Position acquired during line number tracking + protected Set listeners = new HashSet(); // listeners for line number changes - protected String fileName; // the filename - protected int lineIdx; // the line number, 0-based - protected Document doc; // the Document to use for line number tracking - protected Position pos; // the Position acquired during line number tracking - protected Set listeners = new HashSet(); // listeners for line number changes - public LineID(String fileName, int lineIdx) { - this.fileName = fileName; - this.lineIdx = lineIdx; - } + public LineID(String fileName, int lineIdx) { + this.fileName = fileName; + this.lineIdx = lineIdx; + } - /** - * Get the file name of this line. - * - * @return the file name - */ - public String fileName() { - return fileName; - } - /** - * Get the (0-based) line number of this line. - * - * @return the line index (i.e. line number, starting at 0) - */ - public synchronized int lineIdx() { - return lineIdx; - } + /** + * Get the file name of this line. + * + * @return the file name + */ + public String fileName() { + return fileName; + } - @Override - public int hashCode() { - return toString().hashCode(); - } - /** - * Test whether this {@link LineID} is equal to another object. Two - * {@link LineID}'s are equal when both their fileName and lineNo are equal. - * - * @param obj the object to test for equality - * @return {@code true} if equal - */ - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final LineID other = (LineID) obj; - if ((this.fileName == null) ? (other.fileName != null) : !this.fileName.equals(other.fileName)) { - return false; - } - if (this.lineIdx != other.lineIdx) { - return false; - } - return true; - } + /** + * Get the (0-based) line number of this line. + * + * @return the line index (i.e. line number, starting at 0) + */ + public synchronized int lineIdx() { + return lineIdx; + } - /** - * Output a string representation in the form fileName:lineIdx+1. Note this - * uses a 1-based line number as is customary for human-readable line - * numbers. - * - * @return the string representation of this line ID - */ - @Override - public String toString() { - return fileName + ":" + (lineIdx + 1); - } -// /** -// * Retrieve a copy of this line ID. -// * -// * @return the copy -// */ -// @Override -// public LineID clone() { -// return new LineID(fileName, lineIdx); -// } - - /** - * Attach a {@link Document} to enable line number tracking when editing. - * The position to track is before the first non-whitespace character on the - * line. Edits happening before that position will cause the line number to - * update accordingly. Multiple {@link #startTracking} calls will replace - * the tracked document. Whoever wants a tracked line should track it and - * add itself as listener if necessary. - * ({@link LineHighlight}, {@link LineBreakpoint}) - * - * @param doc the {@link Document} to use for line number tracking - */ - public synchronized void startTracking(Document doc) { - //System.out.println("tracking: " + this); - if (doc == null) { - return; // null arg - } - if (doc == this.doc) { - return; // already tracking that doc - } - try { - Element line = doc.getDefaultRootElement().getElement(lineIdx); - if (line == null) { - return; // line doesn't exist - } - String lineText = doc.getText(line.getStartOffset(), line.getEndOffset() - line.getStartOffset()); - // set tracking position at (=before) first non-white space character on line, - // or, if the line consists of entirely white spaces, just before the newline - // character - pos = doc.createPosition(line.getStartOffset() + nonWhiteSpaceOffset(lineText)); - this.doc = doc; - doc.addDocumentListener(this); - } catch (BadLocationException ex) { - Logger.getLogger(LineID.class.getName()).log(Level.SEVERE, null, ex); - pos = null; - this.doc = null; - } - } + @Override + public int hashCode() { + return toString().hashCode(); + } - /** - * Notify this {@link LineID} that it is no longer in use. Will stop - * position tracking. Call this when this {@link LineID} is no longer - * needed. - */ - public synchronized void stopTracking() { - if (doc != null) { - doc.removeDocumentListener(this); - doc = null; - } - } - /** - * Update the tracked position. Will notify listeners if line number has - * changed. - */ - protected synchronized void updatePosition() { - if (doc != null && pos != null) { - // track position - int offset = pos.getOffset(); - int oldLineIdx = lineIdx; - lineIdx = doc.getDefaultRootElement().getElementIndex(offset); // offset to lineNo - if (lineIdx != oldLineIdx) { - for (LineHighlight l : listeners) { - if (l != null) { - l.lineChanged(this, oldLineIdx, lineIdx); - } else { - listeners.remove(l); // remove null listener - } - } - } - } + /** + * Test whether this {@link LineID} is equal to another object. Two + * {@link LineID}'s are equal when both their fileName and lineNo are equal. + * + * @param obj the object to test for equality + * @return {@code true} if equal + */ + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; } - - /** - * Add listener to be notified when the line number changes. - * - * @param l the listener to add - */ - public void addListener(LineHighlight l) { - listeners.add(l); + if (getClass() != obj.getClass()) { + return false; + } + final LineID other = (LineID) obj; + if ((this.fileName == null) ? (other.fileName != null) : !this.fileName.equals(other.fileName)) { + return false; } + if (this.lineIdx != other.lineIdx) { + return false; + } + return true; + } + + + /** + * Output a string representation in the form fileName:lineIdx+1. Note this + * uses a 1-based line number as is customary for human-readable line + * numbers. + * + * @return the string representation of this line ID + */ + @Override + public String toString() { + return fileName + ":" + (lineIdx + 1); + } - /** - * Remove a listener for line number changes. - * - * @param l the listener to remove - */ - public void removeListener(LineHighlight l) { - listeners.remove(l); + + /** + * Attach a {@link Document} to enable line number tracking when editing. + * The position to track is before the first non-whitespace character on the + * line. Edits happening before that position will cause the line number to + * update accordingly. Multiple {@link #startTracking} calls will replace + * the tracked document. Whoever wants a tracked line should track it and + * add itself as listener if necessary. + * ({@link LineHighlight}, {@link LineBreakpoint}) + * + * @param doc the {@link Document} to use for line number tracking + */ + public synchronized void startTracking(Document doc) { + //System.out.println("tracking: " + this); + if (doc == null) { + return; // null arg + } + if (doc == this.doc) { + return; // already tracking that doc + } + try { + Element line = doc.getDefaultRootElement().getElement(lineIdx); + if (line == null) { + return; // line doesn't exist + } + String lineText = doc.getText(line.getStartOffset(), line.getEndOffset() - line.getStartOffset()); + // set tracking position at (=before) first non-white space character on line, + // or, if the line consists of entirely white spaces, just before the newline + // character + pos = doc.createPosition(line.getStartOffset() + nonWhiteSpaceOffset(lineText)); + this.doc = doc; + doc.addDocumentListener(this); + } catch (BadLocationException ex) { + Messages.loge(null, ex); + pos = null; + this.doc = null; } + } - /** - * Calculate the offset of the first non-whitespace character in a string. - * - * @param str the string to examine - * @return offset of first non-whitespace character in str - */ - protected static int nonWhiteSpaceOffset(String str) { - for (int i = 0; i < str.length(); i++) { - if (!Character.isWhitespace(str.charAt(i))) { - return i; - } - } - - /* If we've reached here, that implies the line consists of purely white - * space. So return at a position just after the whitespace (i.e., - * just before the newline). - * - * The " - 1" part resolves issue #3552 - */ - return str.length() - 1; + + /** + * Notify this {@link LineID} that it is no longer in use. Will stop + * position tracking. Call this when this {@link LineID} is no longer + * needed. + */ + public synchronized void stopTracking() { + if (doc != null) { + doc.removeDocumentListener(this); + doc = null; } + } + - /** - * Called when the {@link Document} registered using {@link #startTracking} - * is edited. This happens when text is inserted or removed. - * - * @param de - */ - protected void editEvent(DocumentEvent de) { - //System.out.println("document edit @ " + de.getOffset()); - if (de.getOffset() <= pos.getOffset()) { - updatePosition(); - //System.out.println("updating, new line no: " + lineNo); + /** + * Update the tracked position. Will notify listeners if line number has + * changed. + */ + protected synchronized void updatePosition() { + if (doc != null && pos != null) { + // track position + int offset = pos.getOffset(); + int oldLineIdx = lineIdx; + lineIdx = doc.getDefaultRootElement().getElementIndex(offset); // offset to lineNo + if (lineIdx != oldLineIdx) { + for (LineHighlight l : listeners) { + if (l != null) { + l.lineChanged(this, oldLineIdx, lineIdx); + } else { + listeners.remove(l); // remove null listener + } } + } } + } - /** - * {@link DocumentListener} callback. Called when text is inserted. - * - * @param de - */ - @Override - public void insertUpdate(DocumentEvent de) { - editEvent(de); - } - /** - * {@link DocumentListener} callback. Called when text is removed. - * - * @param de - */ - @Override - public void removeUpdate(DocumentEvent de) { - editEvent(de); + /** + * Add listener to be notified when the line number changes. + * + * @param l the listener to add + */ + public void addListener(LineHighlight l) { + listeners.add(l); + } + + + /** + * Remove a listener for line number changes. + * + * @param l the listener to remove + */ + public void removeListener(LineHighlight l) { + listeners.remove(l); + } + + + /** + * Calculate the offset of the first non-whitespace character in a string. + * @param str the string to examine + * @return offset of first non-whitespace character in str + */ + protected static int nonWhiteSpaceOffset(String str) { + for (int i = 0; i < str.length(); i++) { + if (!Character.isWhitespace(str.charAt(i))) { + return i; + } } - /** - * {@link DocumentListener} callback. Called when attributes are changed. - * Not used. - * - * @param de - */ - @Override - public void changedUpdate(DocumentEvent de) { - // not needed. + // If we've reached here, that implies the line consists of purely white + // space. So return at a position just after the whitespace (i.e., + // just before the newline). + // + // The " - 1" part resolves issue #3552 + return str.length() - 1; + } + + + /** + * Called when the {@link Document} registered using {@link #startTracking} + * is edited. This happens when text is inserted or removed. + */ + protected void editEvent(DocumentEvent de) { + //System.out.println("document edit @ " + de.getOffset()); + if (de.getOffset() <= pos.getOffset()) { + updatePosition(); + //System.out.println("updating, new line no: " + lineNo); } + } + + + /** + * {@link DocumentListener} callback. Called when text is inserted. + */ + @Override + public void insertUpdate(DocumentEvent de) { + editEvent(de); + } + + + /** + * {@link DocumentListener} callback. Called when text is removed. + */ + @Override + public void removeUpdate(DocumentEvent de) { + editEvent(de); + } + + + /** + * {@link DocumentListener} callback. Called when attributes are changed. + * Not used. + */ + @Override + public void changedUpdate(DocumentEvent de) { + // not needed. + } } diff --git a/java/src/processing/mode/java/debug/LocalVariableNode.java b/java/src/processing/mode/java/debug/LocalVariableNode.java index 435a230f67..34bb91afc9 100644 --- a/java/src/processing/mode/java/debug/LocalVariableNode.java +++ b/java/src/processing/mode/java/debug/LocalVariableNode.java @@ -1,21 +1,22 @@ /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation + Part of the Processing project - http://processing.org -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. + Copyright (c) 2012-16 The Processing Foundation -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. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + version 2, as published by the Free Software Foundation. -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. + 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.mode.java.debug; @@ -25,45 +26,34 @@ import com.sun.jdi.LocalVariable; import com.sun.jdi.StackFrame; import com.sun.jdi.Value; -import java.util.logging.Level; -import java.util.logging.Logger; + +import processing.app.Messages; + /** - * Specialized {@link VariableNode} for representing local variables. Overrides - * {@link #setValue} to properly change the value of the encapsulated local - * variable. - * - * @author Martin Leopold + * Specialized {@link VariableNode} for representing local variables. + * Overrides {@link #setValue} to properly change the value of the + * encapsulated local variable. */ public class LocalVariableNode extends VariableNode { + protected LocalVariable var; + protected StackFrame frame; - protected LocalVariable var; - protected StackFrame frame; - /** - * Construct a {@link LocalVariableNode}. - * - * @param name the name - * @param type the type - * @param value the value - * @param var the local variable - * @param frame the stack frame containing the local variable - */ - public LocalVariableNode(String name, String type, Value value, LocalVariable var, StackFrame frame) { - super(name, type, value); - this.var = var; - this.frame = frame; - } + public LocalVariableNode(String name, String type, Value value, LocalVariable var, StackFrame frame) { + super(name, type, value); + this.var = var; + this.frame = frame; + } + - @Override - public void setValue(Value value) { - try { - frame.setValue(var, value); - } catch (InvalidTypeException ex) { - Logger.getLogger(LocalVariableNode.class.getName()).log(Level.SEVERE, null, ex); - } catch (ClassNotLoadedException ex) { - Logger.getLogger(LocalVariableNode.class.getName()).log(Level.SEVERE, null, ex); - } - this.value = value; + @Override + public void setValue(Value value) { + try { + frame.setValue(var, value); + } catch (InvalidTypeException | ClassNotLoadedException ex) { + Messages.loge(null, ex); } + this.value = value; + } } diff --git a/java/src/processing/mode/java/debug/VariableNode.java b/java/src/processing/mode/java/debug/VariableNode.java index e370f7da11..b8b2684471 100644 --- a/java/src/processing/mode/java/debug/VariableNode.java +++ b/java/src/processing/mode/java/debug/VariableNode.java @@ -1,21 +1,22 @@ /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation + Part of the Processing project - http://processing.org -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. + Copyright (c) 2012-16 The Processing Foundation -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. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + version 2, as published by the Free Software Foundation. -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. + 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.mode.java.debug; @@ -33,329 +34,350 @@ /** * Model for a variable in the variable inspector. Has a type and name and - * optionally a value. Can have sub-variables (as is the case for objects, and - * arrays). - * - * @author Martin Leopold + * optionally a value. Can have sub-variables (as is the case for objects, + * and arrays). */ public class VariableNode implements MutableTreeNode { - - public static final int TYPE_UNKNOWN = -1; - public static final int TYPE_OBJECT = 0; - public static final int TYPE_ARRAY = 1; - public static final int TYPE_INTEGER = 2; - public static final int TYPE_FLOAT = 3; - public static final int TYPE_BOOLEAN = 4; - public static final int TYPE_CHAR = 5; - public static final int TYPE_STRING = 6; - public static final int TYPE_LONG = 7; - public static final int TYPE_DOUBLE = 8; - public static final int TYPE_BYTE = 9; - public static final int TYPE_SHORT = 10; - public static final int TYPE_VOID = 11; - protected String type; - protected String name; - protected Value value; - protected List children = new ArrayList(); - protected MutableTreeNode parent; - - /** - * Construct a {@link VariableNode}. - * @param name the name - * @param type the type - * @param value the value - */ - public VariableNode(String name, String type, Value value) { - this.name = name; - this.type = type; - this.value = value; + public static final int TYPE_UNKNOWN = -1; + public static final int TYPE_OBJECT = 0; + public static final int TYPE_ARRAY = 1; + public static final int TYPE_INTEGER = 2; + public static final int TYPE_FLOAT = 3; + public static final int TYPE_BOOLEAN = 4; + public static final int TYPE_CHAR = 5; + public static final int TYPE_STRING = 6; + public static final int TYPE_LONG = 7; + public static final int TYPE_DOUBLE = 8; + public static final int TYPE_BYTE = 9; + public static final int TYPE_SHORT = 10; + public static final int TYPE_VOID = 11; + + protected String type; + protected String name; + protected Value value; + protected List children = new ArrayList<>(); + protected MutableTreeNode parent; + + + /** + * Construct a {@link VariableNode}. + * @param name the name + * @param type the type + * @param value the value + */ + public VariableNode(String name, String type, Value value) { + this.name = name; + this.type = type; + this.value = value; + } + + + public void setValue(Value value) { + this.value = value; + } + + + public Value getValue() { + return value; + } + + + /** + * Get a String representation of this variable nodes value. + * + * @return a String representing the value. + */ + public String getStringValue() { + String str; + if (value != null) { + if (getType() == TYPE_OBJECT) { + str = "instance of " + type; + } else if (getType() == TYPE_ARRAY) { + //instance of int[5] (id=998) --> instance of int[5] + str = value.toString().substring(0, value.toString().lastIndexOf(" ")); + } else if (getType() == TYPE_STRING) { + str = ((StringReference) value).value(); // use original string value (without quotes) + } else { + str = value.toString(); + } + } else { + str = "null"; } + return str; + } - public void setValue(Value value) { - this.value = value; - } - public Value getValue() { - return value; - } + public String getTypeName() { + return type; + } - /** - * Get a String representation of this variable nodes value. - * - * @return a String representing the value. - */ - public String getStringValue() { - String str; - if (value != null) { - if (getType() == TYPE_OBJECT) { - str = "instance of " + type; - } else if (getType() == TYPE_ARRAY) { - //instance of int[5] (id=998) --> instance of int[5] - str = value.toString().substring(0, value.toString().lastIndexOf(" ")); - } else if (getType() == TYPE_STRING) { - str = ((StringReference) value).value(); // use original string value (without quotes) - } else { - str = value.toString(); - } - } else { - str = "null"; - } - return str; - } - public String getTypeName() { - return type; + public int getType() { + if (type == null) { + return TYPE_UNKNOWN; } - - public int getType() { - if (type == null) { - return TYPE_UNKNOWN; - } - if (type.endsWith("[]")) { - return TYPE_ARRAY; - } - if (type.equals("int")) { - return TYPE_INTEGER; - } - if (type.equals("long")) { - return TYPE_LONG; - } - if (type.equals("byte")) { - return TYPE_BYTE; - } - if (type.equals("short")) { - return TYPE_SHORT; - } - if (type.equals("float")) { - return TYPE_FLOAT; - } - if (type.equals("double")) { - return TYPE_DOUBLE; - } - if (type.equals("char")) { - return TYPE_CHAR; - } - if (type.equals("java.lang.String")) { - return TYPE_STRING; - } - if (type.equals("boolean")) { - return TYPE_BOOLEAN; - } - if (type.equals("void")) { - return TYPE_VOID; //TODO: check if this is correct - } - return TYPE_OBJECT; + if (type.endsWith("[]")) { + return TYPE_ARRAY; } - - public String getName() { - return name; + if (type.equals("int")) { + return TYPE_INTEGER; } - - public void setName(String name) { - this.name = name; + if (type.equals("long")) { + return TYPE_LONG; } - - /** - * Add a {@link VariableNode} as child. - * - * @param c the {@link VariableNode} to add. - */ - public void addChild(VariableNode c) { - children.add(c); - c.setParent(this); + if (type.equals("byte")) { + return TYPE_BYTE; } - - /** - * Add multiple {@link VariableNode}s as children. - * - * @param children the list of {@link VariableNode}s to add. - */ - public void addChildren(List children) { - for (VariableNode child : children) { - addChild(child); - } + if (type.equals("short")) { + return TYPE_SHORT; } - - @Override - public TreeNode getChildAt(int i) { - return children.get(i); + if (type.equals("float")) { + return TYPE_FLOAT; } - - @Override - public int getChildCount() { - return children.size(); + if (type.equals("double")) { + return TYPE_DOUBLE; } - - @Override - public TreeNode getParent() { - return parent; + if (type.equals("char")) { + return TYPE_CHAR; } - - @Override - public int getIndex(TreeNode tn) { - return children.indexOf(tn); + if (type.equals("java.lang.String")) { + return TYPE_STRING; } - - @Override - public boolean getAllowsChildren() { - if (value == null) { - return false; - } - - // handle strings - if (getType() == TYPE_STRING) { - return false; - } - - // handle arrays - if (getType() == TYPE_ARRAY) { - ArrayReference array = (ArrayReference) value; - return array.length() > 0; - } - // handle objects - if (getType() == TYPE_OBJECT) { // this also rules out null - // check if this object has any fields - ObjectReference obj = (ObjectReference) value; - return !obj.referenceType().visibleFields().isEmpty(); - } - - return false; + if (type.equals("boolean")) { + return TYPE_BOOLEAN; } - - /** - * This controls the default icon and disclosure triangle. - * - * @return true, will show "folder" icon and disclosure triangle. - */ - @Override - public boolean isLeaf() { - //return children.size() == 0; - return !getAllowsChildren(); + if (type.equals("void")) { + return TYPE_VOID; //TODO: check if this is correct } + return TYPE_OBJECT; + } - @Override - public Enumeration children() { - return Collections.enumeration(children); - } - /** - * Get a String representation of this {@link VariableNode}. - * - * @return the name of the variable (for sorting to work). - */ - @Override - public String toString() { - return getName(); // for sorting - } + public String getName() { + return name; + } - /** - * Get a String description of this {@link VariableNode}. Contains the type, - * name and value. - * - * @return the description - */ - public String getDescription() { - String str = ""; - if (type != null) { - str += type + " "; - } - str += name; - str += " = " + getStringValue(); - return str; - } - @Override - public void insert(MutableTreeNode mtn, int i) { - children.add(i, this); + public void setName(String name) { + this.name = name; + } + + + /** + * Add a {@link VariableNode} as child. + * + * @param c the {@link VariableNode} to add. + */ + public void addChild(VariableNode c) { + children.add(c); + c.setParent(this); + } + + + /** + * Add multiple {@link VariableNode}s as children. + * + * @param children the list of {@link VariableNode}s to add. + */ + public void addChildren(List children) { + for (VariableNode child : children) { + addChild(child); } + } + + + @Override + public TreeNode getChildAt(int i) { + return children.get(i); + } - @Override - public void remove(int i) { - MutableTreeNode mtn = children.remove(i); - if (mtn != null) { - mtn.setParent(null); - } + + @Override + public int getChildCount() { + return children.size(); + } + + + @Override + public TreeNode getParent() { + return parent; + } + + + @Override + public int getIndex(TreeNode tn) { + return children.indexOf(tn); + } + + + @Override + public boolean getAllowsChildren() { + if (value == null) { + return false; } - @Override - public void remove(MutableTreeNode mtn) { - children.remove(mtn); - mtn.setParent(null); + // handle strings + if (getType() == TYPE_STRING) { + return false; } - /** - * Remove all children from this {@link VariableNode}. - */ - public void removeAllChildren() { - for (MutableTreeNode mtn : children) { - mtn.setParent(null); - } - children.clear(); + // handle arrays + if (getType() == TYPE_ARRAY) { + ArrayReference array = (ArrayReference) value; + return array.length() > 0; + } + // handle objects + if (getType() == TYPE_OBJECT) { // this also rules out null + // check if this object has any fields + ObjectReference obj = (ObjectReference) value; + return !obj.referenceType().visibleFields().isEmpty(); } - @Override - public void setUserObject(Object o) { - if (o instanceof Value) { - value = (Value) o; - } + return false; + } + + + /** + * This controls the default icon and disclosure triangle. + * + * @return true, will show "folder" icon and disclosure triangle. + */ + @Override + public boolean isLeaf() { + //return children.size() == 0; + return !getAllowsChildren(); + } + + + @Override + public Enumeration children() { + return Collections.enumeration(children); + } + + + /** + * Get a String representation of this {@link VariableNode}. + * + * @return the name of the variable (for sorting to work). + */ + @Override + public String toString() { + return getName(); // for sorting + } + + + /** + * Get a String description of this {@link VariableNode}. Contains the type, + * name and value. + * + * @return the description + */ + public String getDescription() { + String str = ""; + if (type != null) { + str += type + " "; } + str += name; + str += " = " + getStringValue(); + return str; + } + - @Override - public void removeFromParent() { - parent.remove(this); - this.parent = null; + @Override + public void insert(MutableTreeNode mtn, int i) { + children.add(i, this); + } + + + @Override + public void remove(int i) { + MutableTreeNode mtn = children.remove(i); + if (mtn != null) { + mtn.setParent(null); } + } + - @Override - public void setParent(MutableTreeNode mtn) { - parent = mtn; + @Override + public void remove(MutableTreeNode mtn) { + children.remove(mtn); + mtn.setParent(null); + } + + + /** + * Remove all children from this {@link VariableNode}. + */ + public void removeAllChildren() { + for (MutableTreeNode mtn : children) { + mtn.setParent(null); } + children.clear(); + } + - /** - * Test for equality. To be equal, two {@link VariableNode}s need to have - * equal type, name and value. - * - * @param obj the object to test for equality with this {@link VariableNode} - * @return true if the given object is equal to this {@link VariableNode} - */ - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final VariableNode other = (VariableNode) obj; - if ((this.type == null) ? (other.type != null) : !this.type.equals(other.type)) { - //System.out.println("type not equal"); - return false; - } - if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { - //System.out.println("name not equal"); - return false; - } - if (this.value != other.value && (this.value == null || !this.value.equals(other.value))) { - //System.out.println("value not equal"); - return false; - } -// if (this.parent != other.parent && (this.parent == null || !this.parent.equals(other.parent))) { -// System.out.println("parent not equal: " + this.parent + "/" + other.parent); -// return false; -// } - return true; + @Override + public void setUserObject(Object o) { + if (o instanceof Value) { + value = (Value) o; } + } + + + @Override + public void removeFromParent() { + parent.remove(this); + this.parent = null; + } + - /** - * Returns a hash code based on type, name and value. - */ - @Override - public int hashCode() { - int hash = 3; - hash = 97 * hash + (this.type != null ? this.type.hashCode() : 0); - hash = 97 * hash + (this.name != null ? this.name.hashCode() : 0); - hash = 97 * hash + (this.value != null ? this.value.hashCode() : 0); -// hash = 97 * hash + (this.parent != null ? this.parent.hashCode() : 0); - return hash; + @Override + public void setParent(MutableTreeNode mtn) { + parent = mtn; + } + + + /** + * Test for equality. To be equal, two {@link VariableNode}s need to have + * equal type, name and value. + * + * @param obj the object to test for equality with this {@link VariableNode} + * @return true if the given object is equal to this {@link VariableNode} + */ + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final VariableNode other = (VariableNode) obj; + if ((this.type == null) ? (other.type != null) : !this.type.equals(other.type)) { + //System.out.println("type not equal"); + return false; + } + if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { + //System.out.println("name not equal"); + return false; + } + if (this.value != other.value && (this.value == null || !this.value.equals(other.value))) { + //System.out.println("value not equal"); + return false; } + return true; + } + + + /** + * Returns a hash code based on type, name and value. + */ + @Override + public int hashCode() { + int hash = 3; + hash = 97 * hash + (this.type != null ? this.type.hashCode() : 0); + hash = 97 * hash + (this.name != null ? this.name.hashCode() : 0); + hash = 97 * hash + (this.value != null ? this.value.hashCode() : 0); + return hash; + } } diff --git a/java/src/processing/mode/java/pdex/ASTGenerator.java b/java/src/processing/mode/java/pdex/ASTGenerator.java deleted file mode 100644 index 9d476ffd5e..0000000000 --- a/java/src/processing/mode/java/pdex/ASTGenerator.java +++ /dev/null @@ -1,3737 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -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. -*/ - -package processing.mode.java.pdex; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Rectangle; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.io.FileFilter; -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Stack; -import java.util.TreeMap; -import java.util.TreeSet; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.regex.Pattern; - -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.DefaultListModel; -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JEditorPane; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.JTree; -import javax.swing.ListSelectionModel; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.text.BadLocationException; -import javax.swing.text.Element; -import javax.swing.text.PlainDocument; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.MutableTreeNode; - -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.ASTParser; -import org.eclipse.jdt.core.dom.ArrayAccess; -import org.eclipse.jdt.core.dom.ArrayType; -import org.eclipse.jdt.core.dom.Block; -import org.eclipse.jdt.core.dom.Comment; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.ExpressionStatement; -import org.eclipse.jdt.core.dom.FieldAccess; -import org.eclipse.jdt.core.dom.FieldDeclaration; -import org.eclipse.jdt.core.dom.MethodDeclaration; -import org.eclipse.jdt.core.dom.MethodInvocation; -import org.eclipse.jdt.core.dom.Name; -import org.eclipse.jdt.core.dom.ParameterizedType; -import org.eclipse.jdt.core.dom.PrimitiveType; -import org.eclipse.jdt.core.dom.QualifiedName; -import org.eclipse.jdt.core.dom.SimpleName; -import org.eclipse.jdt.core.dom.SimpleType; -import org.eclipse.jdt.core.dom.SingleVariableDeclaration; -import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; -import org.eclipse.jdt.core.dom.Type; -import org.eclipse.jdt.core.dom.TypeDeclaration; -import org.eclipse.jdt.core.dom.VariableDeclarationExpression; -import org.eclipse.jdt.core.dom.VariableDeclarationFragment; -import org.eclipse.jdt.core.dom.VariableDeclarationStatement; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.jsoup.select.Elements; - -import processing.app.Library; -import processing.app.Messages; -import processing.app.Platform; -import processing.app.SketchCode; -import processing.app.Util; -import processing.app.syntax.JEditTextArea; -import processing.app.ui.Toolkit; -import processing.mode.java.JavaEditor; -import processing.mode.java.JavaMode; -import processing.mode.java.preproc.PdePreprocessor; - -import com.google.classpath.ClassPath; -import com.google.classpath.ClassPathFactory; -import com.google.classpath.RegExpResourceFilter; - - -@SuppressWarnings({ "deprecation", "unchecked" }) -public class ASTGenerator { - protected ErrorCheckerService errorCheckerService; - protected JavaEditor editor; - public DefaultMutableTreeNode codeTree = new DefaultMutableTreeNode(); - protected DefaultMutableTreeNode currentParent = null; - - protected JFrame frmASTView; - protected JFrame frameAutoComp; - - /** Swing component wrapper for AST, used for internal testing */ - protected JTree jtree; - - /** JTree used for testing refactoring operations */ - protected JTree refactorTree; - - protected CompilationUnit compilationUnit; - protected JTable tableAuto; - protected JEditorPane javadocPane; - protected JScrollPane scrollPane; - protected JFrame frmRename; - protected JButton btnRename; - protected JButton btnListOccurrence; - protected JTextField txtRenameField; - protected JFrame frmOccurenceList; - protected JLabel lblRefactorOldName; - - - public ASTGenerator(ErrorCheckerService ecs) { - this.errorCheckerService = ecs; - this.editor = ecs.getEditor(); - setupGUI(); - //addCompletionPopupListner(); - addListeners(); - //loadJavaDoc(); - predictionOngoing = new AtomicBoolean(false); - } - - - protected void setupGUI() { - frmASTView = new JFrame(); - - jtree = new JTree(); - frmASTView.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); - frmASTView.setBounds(new Rectangle(680, 100, 460, 620)); - frmASTView.setTitle("AST View - " + editor.getSketch().getName()); - JScrollPane sp = new JScrollPane(); - sp.setViewportView(jtree); - frmASTView.add(sp); - - btnRename = new JButton("Rename"); - btnListOccurrence = new JButton("Show Usage"); - frmRename = new JFrame(); - frmRename.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); - frmRename.setSize(250, 130); - frmRename.setLayout(new BoxLayout(frmRename.getContentPane(), BoxLayout.Y_AXIS)); - Toolkit.setIcon(frmRename); - JPanel panelTop = new JPanel(), panelBottom = new JPanel(); - panelTop.setLayout(new BoxLayout(panelTop, BoxLayout.Y_AXIS)); - panelTop.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - panelBottom.setLayout(new BoxLayout(panelBottom, BoxLayout.X_AXIS)); - panelBottom.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - panelBottom.add(Box.createHorizontalGlue()); - panelBottom.add(btnListOccurrence); - panelBottom.add(Box.createRigidArea(new Dimension(15, 0))); - panelBottom.add(btnRename); - frmRename.setTitle("Enter new name:"); - txtRenameField = new JTextField(); - txtRenameField.setPreferredSize(new Dimension(150, 60)); - panelTop.add(txtRenameField); - //renameWindow.setVisible(true); - lblRefactorOldName = new JLabel(); - lblRefactorOldName.setText("Old Name: "); - panelTop.add(Box.createRigidArea(new Dimension(0, 10))); - panelTop.add(lblRefactorOldName); - frmRename.add(panelTop); - frmRename.add(panelBottom); - frmRename.setMinimumSize(frmRename.getSize()); - frmRename.setLocation(editor.getX() - + (editor.getWidth() - frmRename.getWidth()) / 2, - editor.getY() - + (editor.getHeight() - frmRename.getHeight()) - / 2); - - - frmOccurenceList = new JFrame(); - frmOccurenceList.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); - frmOccurenceList.setSize(300, 400); - Toolkit.setIcon(frmOccurenceList); - JScrollPane sp2 = new JScrollPane(); - refactorTree = new JTree(); - sp2.setViewportView(refactorTree); - frmOccurenceList.add(sp2); - } - - - public static final boolean SHOW_AST = !true; - - protected DefaultMutableTreeNode buildAST(String source, CompilationUnit cu) { - if (cu == null) { - ASTParser parser = ASTParser.newParser(AST.JLS4); - parser.setSource(source.toCharArray()); - parser.setKind(ASTParser.K_COMPILATION_UNIT); - - Map options = JavaCore.getOptions(); - - JavaCore.setComplianceOptions(JavaCore.VERSION_1_6, options); - options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_6); - parser.setCompilerOptions(options); - compilationUnit = (CompilationUnit) parser.createAST(null); - } else { - compilationUnit = cu; - //log("Other cu"); - } -// OutlineVisitor visitor = new OutlineVisitor(); -// compilationUnit.accept(visitor); - getCodeComments(); - codeTree = new DefaultMutableTreeNode(new ASTNodeWrapper((ASTNode) compilationUnit - .types().get(0))); - //log("Total CU " + compilationUnit.types().size()); - if(compilationUnit.types() == null || compilationUnit.types().isEmpty()){ - Messages.loge("No CU found!"); - } - visitRecur((ASTNode) compilationUnit.types().get(0), codeTree); - SwingWorker worker = new SwingWorker() { - - @Override - protected Object doInBackground() throws Exception { - return null; - } - - protected void done() { - if (codeTree != null) { - if(SHOW_AST){ - if (jtree.hasFocus() || frmASTView.hasFocus()) - return; - jtree.setModel(new DefaultTreeModel(codeTree)); - ((DefaultTreeModel) jtree.getModel()).reload(); - jtree.validate(); - if (!frmASTView.isVisible()) { - frmASTView.setVisible(true); - } - } -// if (!frameAutoComp.isVisible()) { -// -// frameAutoComp.setVisible(true); -// -// } -// if (!frmJavaDoc.isVisible()) { -// long t = System.currentTimeMillis(); -// loadJavaDoc(); -// log("Time taken: " -// + (System.currentTimeMillis() - t)); -// frmJavaDoc.setBounds(new Rectangle(errorCheckerService.getEditor() -// .getX() + errorCheckerService.getEditor().getWidth(), -// errorCheckerService.getEditor() -// .getY(), 450, 600)); -// frmJavaDoc.setVisible(true); -// } - } - } - }; - worker.execute(); -// Base.loge("++>" + System.getProperty("java.class.path")); -// log(System.getProperty("java.class.path")); -// log("-------------------------------"); - return codeTree; - } - - protected ClassPathFactory factory; - - /** - * Used for searching for package declaration of a class - */ - protected ClassPath classPath; - - //protected JFrame frmJavaDoc; - - /** - * Loads up .jar files and classes defined in it for completion lookup - */ - protected void loadJars() { - factory = new ClassPathFactory(); - - StringBuilder path = new StringBuilder(); - String modeClassPath = ((JavaMode) editor.getMode()).getSearchPath(); - if (modeClassPath != null) { - path.append(modeClassPath); - } - - if (errorCheckerService.classpathJars != null) { - synchronized (errorCheckerService.classpathJars) { - for (URL jarPath : errorCheckerService.classpathJars) { - //log(jarPath.getPath()); - path.append(jarPath.getPath() + File.pathSeparatorChar); - } - } - } - - classPath = factory.createFromPath(path.toString()); - log("Classpath created " + (classPath != null)); - log("Sketch classpath jars loaded."); - if (Platform.isMacOS()) { - File f = new File(System.getProperty("java.home") + - File.separator + "bundle" + - File.separator + "Classes" + - File.separator + "classes.jar"); - log(f.getAbsolutePath() + " | classes.jar found?" + f.exists()); - } else { - File f = new File(System.getProperty("java.home") + File.separator + - "lib" + File.separator + "rt.jar" + File.separator); - log(f.getAbsolutePath() + " | rt.jar found?" + f.exists()); - } - } - - - protected TreeMap jdocMap; - - protected void loadJavaDoc() { - jdocMap = new TreeMap(); - - // presently loading only p5 reference for PApplet - new Thread(new Runnable() { - public void run() { - try { - loadJavaDoc(jdocMap, editor.getMode().getReferenceFolder()); - } catch (Exception e) { - e.printStackTrace(); - } - } - }).start(); - } - - - static void loadJavaDoc(TreeMap jdocMap, - File referenceFolder) throws IOException, MalformedURLException { - Document doc; - - FileFilter fileFilter = new FileFilter() { - public boolean accept(File file) { - if(!file.getName().endsWith("_.html")) - return false; - int k = 0; - for (int i = 0; i < file.getName().length(); i++) { - if(file.getName().charAt(i)== '_') - k++; - if(k > 1) - return false; - } - return true; - } - }; - - for (File docFile : referenceFolder.listFiles(fileFilter)) { - doc = Jsoup.parse(docFile, null); - Elements elm = doc.getElementsByClass("ref-item"); - String msg = ""; - String methodName = docFile.getName().substring(0, docFile.getName().indexOf('_')); - //System.out.println(methodName); - for (Iterator it = elm.iterator(); it.hasNext();) { - org.jsoup.nodes.Element ele = it.next(); - msg = "
    " - + ele.html() + "
    "; - //mat.replaceAll(""); - msg = msg.replaceAll("img src=\"", "img src=\"" - + referenceFolder.toURI().toURL().toString() + "/"); - //System.out.println(ele.text()); - } - jdocMap.put(methodName, msg); - } - System.out.println("JDoc loaded "+jdocMap.size()); - } - - - public DefaultMutableTreeNode buildAST(CompilationUnit cu) { - return buildAST(errorCheckerService.sourceCode, cu); - } - - public static CompletionCandidate[] checkForTypes(ASTNode node) { - - List vdfs = null; - switch (node.getNodeType()) { - case ASTNode.TYPE_DECLARATION: - return new CompletionCandidate[] { new CompletionCandidate((TypeDeclaration) node) }; - - case ASTNode.METHOD_DECLARATION: - MethodDeclaration md = (MethodDeclaration) node; - log(getNodeAsString(md)); - List params = (List) md - .getStructuralProperty(MethodDeclaration.PARAMETERS_PROPERTY); - CompletionCandidate[] cand = new CompletionCandidate[params.size() + 1]; - cand[0] = new CompletionCandidate(md); - for (int i = 0; i < params.size(); i++) { -// cand[i + 1] = new CompletionCandidate(params.get(i).toString(), "", "", -// CompletionCandidate.LOCAL_VAR); - cand[i + 1] = new CompletionCandidate((SingleVariableDeclaration)params.get(i)); - } - return cand; - - case ASTNode.SINGLE_VARIABLE_DECLARATION: - return new CompletionCandidate[] { new CompletionCandidate((SingleVariableDeclaration)node) }; - - case ASTNode.FIELD_DECLARATION: - vdfs = ((FieldDeclaration) node).fragments(); - break; - case ASTNode.VARIABLE_DECLARATION_STATEMENT: - vdfs = ((VariableDeclarationStatement) node).fragments(); - break; - case ASTNode.VARIABLE_DECLARATION_EXPRESSION: - vdfs = ((VariableDeclarationExpression) node).fragments(); - break; - default: - break; - } - - if (vdfs != null) { - CompletionCandidate ret[] = new CompletionCandidate[vdfs.size()]; - int i = 0; - for (VariableDeclarationFragment vdf : vdfs) { -// ret[i++] = new CompletionCandidate(getNodeAsString2(vdf), "", "", -// CompletionCandidate.LOCAL_VAR); - ret[i++] = new CompletionCandidate(vdf); - } - return ret; - } - - return null; - } - - /** - * Find the parent of the expression in a().b, this would give me the return - * type of a(), so that we can find all children of a() begininng with b - * - * @param nearestNode - * @param expression - * @return - */ - public static ASTNode resolveExpression(ASTNode nearestNode, - ASTNode expression, boolean noCompare) { - log("Resolving " + getNodeAsString(expression) + " noComp " - + noCompare); - if (expression instanceof SimpleName) { - return findDeclaration2(((SimpleName) expression), nearestNode); - } else if (expression instanceof MethodInvocation) { - log("3. Method Invo " - + ((MethodInvocation) expression).getName()); - return findDeclaration2(((MethodInvocation) expression).getName(), - nearestNode); - } else if (expression instanceof FieldAccess) { - log("2. Field access " - + getNodeAsString(((FieldAccess) expression).getExpression()) + "|||" - + getNodeAsString(((FieldAccess) expression).getName())); - if (noCompare) { - /* - * ASTNode ret = findDeclaration2(((FieldAccess) expression).getName(), - * nearestNode); log("Found as ->"+getNodeAsString(ret)); - * return ret; - */ - return findDeclaration2(((FieldAccess) expression).getName(), - nearestNode); - } else { - - /* - * Note how for the next recursion, noCompare is reversed. Let's say - * I've typed getABC().quark.nin where nin is incomplete(ninja being the - * field), when execution first enters here, it calls resolveExpr again - * for "getABC().quark" where we know that quark field must be complete, - * so we toggle noCompare. And kaboom. - */ - return resolveExpression(nearestNode, - ((FieldAccess) expression).getExpression(), - !noCompare); - } - //return findDeclaration2(((FieldAccess) expression).getExpression(), nearestNode); - } else if (expression instanceof QualifiedName) { - log("1. Resolving " - + ((QualifiedName) expression).getQualifier() + " ||| " - + ((QualifiedName) expression).getName()); - if (noCompare) { // no compare, as in "abc.hello." need to resolve hello here - return findDeclaration2(((QualifiedName) expression).getName(), - nearestNode); - } else { - //User typed "abc.hello.by" (bye being complete), so need to resolve "abc.hello." only - return findDeclaration2(((QualifiedName) expression).getQualifier(), - nearestNode); - } - } - - return null; - } - - /** - * Finds the type of the expression in foo.bar().a().b, this would give me the - * type of b if it exists in return type of a(). If noCompare is true, - * it'll return type of a() - * @param nearestNode - * @param astNode - * @return - */ - public ClassMember resolveExpression3rdParty(ASTNode nearestNode, - ASTNode astNode, boolean noCompare) { - log("Resolve 3rdParty expr-- " + getNodeAsString(astNode) - + " nearest node " + getNodeAsString(nearestNode)); - if(astNode == null) return null; - ClassMember scopeParent = null; - SimpleType stp = null; - if(astNode instanceof SimpleName){ - ASTNode decl = findDeclaration2(((SimpleName)astNode),nearestNode); - if(decl != null){ - // see if locally defined - log(getNodeAsString(astNode)+" found decl -> " + getNodeAsString(decl)); - return new ClassMember(extracTypeInfo(decl)); - } - else { - // or in a predefined class? - Class tehClass = findClassIfExists(((SimpleName) astNode).toString()); - if (tehClass != null) { - return new ClassMember(tehClass); - } - } - astNode = astNode.getParent(); - } - switch (astNode.getNodeType()) { - //TODO: Notice the redundancy in the 3 cases, you can simplify things even more. - case ASTNode.FIELD_ACCESS: - FieldAccess fa = (FieldAccess) astNode; - if (fa.getExpression() == null) { - - // TODO: Check for existence of 'new' keyword. Could be a ClassInstanceCreation - - // Local code or belongs to super class - log("FA,Not implemented."); - return null; - } else { - if (fa.getExpression() instanceof SimpleName) { - stp = extracTypeInfo(findDeclaration2((SimpleName) fa.getExpression(), - nearestNode)); - if(stp == null){ - /*The type wasn't found in local code, so it might be something like - * log(), or maybe belonging to super class, etc. - */ - Class tehClass = findClassIfExists(((SimpleName)fa.getExpression()).toString()); - if (tehClass != null) { - // Method Expression is a simple name and wasn't located locally, but found in a class - // so look for method in this class. - return definedIn3rdPartyClass(new ClassMember(tehClass), fa - .getName().toString()); - } - log("FA resolve 3rd par, Can't resolve " + fa.getExpression()); - - return null; - } - log("FA, SN Type " + getNodeAsString(stp)); - scopeParent = definedIn3rdPartyClass(stp.getName().toString(), "THIS"); - - } else { - scopeParent = resolveExpression3rdParty(nearestNode, - fa.getExpression(), noCompare); - } - log("FA, ScopeParent " + scopeParent); - return definedIn3rdPartyClass(scopeParent, fa.getName().toString()); - } - case ASTNode.METHOD_INVOCATION: - MethodInvocation mi = (MethodInvocation) astNode; - ASTNode temp = findDeclaration2(mi.getName(), nearestNode); - if(temp instanceof MethodDeclaration){ - // method is locally defined - log(mi.getName() + " was found locally," + getNodeAsString(extracTypeInfo(temp))); - return new ClassMember(extracTypeInfo(temp)); - } - if (mi.getExpression() == null) { -// if() - //Local code or belongs to super class - log("MI,Not implemented."); - return null; - } else { - if (mi.getExpression() instanceof SimpleName) { - stp = extracTypeInfo(findDeclaration2((SimpleName) mi.getExpression(), - nearestNode)); - if(stp == null){ - /*The type wasn't found in local code, so it might be something like - * System.console()., or maybe belonging to super class, etc. - */ - Class tehClass = findClassIfExists(((SimpleName)mi.getExpression()).toString()); - if (tehClass != null) { - // Method Expression is a simple name and wasn't located locally, but found in a class - // so look for method in this class. - return definedIn3rdPartyClass(new ClassMember(tehClass), mi - .getName().toString()); - } - log("MI resolve 3rd par, Can't resolve " + mi.getExpression()); - return null; - } - log("MI, SN Type " + getNodeAsString(stp)); - ASTNode typeDec = findDeclaration2(stp.getName(),nearestNode); - if(typeDec == null){ - log(stp.getName() + " couldn't be found locally.."); - Class tehClass = findClassIfExists(stp.getName().toString()); - if (tehClass != null) { - // Method Expression is a simple name and wasn't located locally, but found in a class - // so look for method in this class. - return definedIn3rdPartyClass(new ClassMember(tehClass), mi - .getName().toString()); - } - //return new ClassMember(findClassIfExists(stp.getName().toString())); - } - //scopeParent = definedIn3rdPartyClass(stp.getName().toString(), "THIS"); - return definedIn3rdPartyClass(new ClassMember(typeDec), mi - .getName().toString()); - } else { - log("MI EXP.."+getNodeAsString(mi.getExpression())); -// return null; - scopeParent = resolveExpression3rdParty(nearestNode, - mi.getExpression(), noCompare); - log("MI, ScopeParent " + scopeParent); - return definedIn3rdPartyClass(scopeParent, mi.getName().toString()); - } - - } - case ASTNode.QUALIFIED_NAME: - QualifiedName qn = (QualifiedName) astNode; - ASTNode temp2 = findDeclaration2(qn.getName(), nearestNode); - if(temp2 instanceof FieldDeclaration){ - // field is locally defined - log(qn.getName() + " was found locally," + getNodeAsString(extracTypeInfo(temp2))); - return new ClassMember(extracTypeInfo(temp2)); - } - if (qn.getQualifier() == null) { - log("QN,Not implemented."); - return null; - } else { - - if (qn.getQualifier() instanceof SimpleName) { - stp = extracTypeInfo(findDeclaration2(qn.getQualifier(), nearestNode)); - if(stp == null){ - /*The type wasn't found in local code, so it might be something like - * log(), or maybe belonging to super class, etc. - */ - Class tehClass = findClassIfExists(qn.getQualifier().toString()); - if (tehClass != null) { - // note how similar thing is called on line 690. Check check. - return definedIn3rdPartyClass(new ClassMember(tehClass), qn - .getName().toString()); - } - log("QN resolve 3rd par, Can't resolve " + qn.getQualifier()); - return null; - } - log("QN, SN Local Type " + getNodeAsString(stp)); - //scopeParent = definedIn3rdPartyClass(stp.getName().toString(), "THIS"); - ASTNode typeDec = findDeclaration2(stp.getName(),nearestNode); - if(typeDec == null){ - log(stp.getName() + " couldn't be found locally.."); - - Class tehClass = findClassIfExists(stp.getName().toString()); - if (tehClass != null) { - // note how similar thing is called on line 690. Check check. - return definedIn3rdPartyClass(new ClassMember(tehClass), qn - .getName().toString()); - } - log("QN resolve 3rd par, Can't resolve " + qn.getQualifier()); - return null; - } - return definedIn3rdPartyClass(new ClassMember(typeDec), qn - .getName().toString()); - } else { - scopeParent = resolveExpression3rdParty(nearestNode, - qn.getQualifier(), noCompare); - log("QN, ScopeParent " + scopeParent); - return definedIn3rdPartyClass(scopeParent, qn.getName().toString()); - } - - } - case ASTNode.ARRAY_ACCESS: - ArrayAccess arac = (ArrayAccess)astNode; - return resolveExpression3rdParty(nearestNode, arac.getArray(), noCompare); - default: - log("Unaccounted type " + getNodeAsString(astNode)); - break; - } - - return null; - } - - /** - * For a().abc.a123 this would return a123 - * - * @param expression - * @return - */ - public static ASTNode getChildExpression(ASTNode expression) { -// ASTNode anode = null; - if (expression instanceof SimpleName) { - return expression; - } else if (expression instanceof FieldAccess) { - return ((FieldAccess) expression).getName(); - } else if (expression instanceof QualifiedName) { - return ((QualifiedName) expression).getName(); - }else if (expression instanceof MethodInvocation) { - return ((MethodInvocation) expression).getName(); - }else if(expression instanceof ArrayAccess){ - return ((ArrayAccess)expression).getArray(); - } - log(" getChildExpression returning NULL for " - + getNodeAsString(expression)); - return null; - } - - public static ASTNode getParentExpression(ASTNode expression) { -// ASTNode anode = null; - if (expression instanceof SimpleName) { - return expression; - } else if (expression instanceof FieldAccess) { - return ((FieldAccess) expression).getExpression(); - } else if (expression instanceof QualifiedName) { - return ((QualifiedName) expression).getQualifier(); - } else if (expression instanceof MethodInvocation) { - return ((MethodInvocation) expression).getExpression(); - } else if (expression instanceof ArrayAccess) { - return ((ArrayAccess) expression).getArray(); - } - log("getParentExpression returning NULL for " - + getNodeAsString(expression)); - return null; - } - - protected void trimCandidates(String newWord){ - ArrayList newCandidate = new ArrayList(); - newWord = newWord.toLowerCase(); - for (CompletionCandidate comp : candidates) { - if(comp.getNoHtmlLabel().toLowerCase().startsWith(newWord)){ - newCandidate.add(comp); - } - } - candidates = newCandidate; - } - - /** - * List of CompletionCandidates - */ - protected ArrayList candidates; - protected String lastPredictedWord = " "; - //protected AtomicBoolean predictionsEnabled; - protected int predictionMinLength = 2; - - - private AtomicBoolean predictionOngoing; - - /** - * The main function that calculates possible code completion candidates - * - * @param word - * @param line - * @param lineStartNonWSOffset - */ - public void preparePredictions(final String word, final int line, - final int lineStartNonWSOffset) { - if (predictionOngoing.get()) return; - if (!JavaMode.codeCompletionsEnabled) return; - if (word.length() < predictionMinLength) return; - - predictionOngoing.set(true); - // This method is called from TextArea.fetchPhrase, which is called via a SwingWorker instance - // in TextArea.processKeyEvent - if (caretWithinLineComment()) { - log("No predictions."); - predictionOngoing.set(false); - return; - } - -// SwingWorker worker = new SwingWorker() { -// -// @Override -// protected Object doInBackground() throws Exception { -// return null; -// } -// -// protected void done() { - - // If the parsed code contains pde enhancements, take 'em out. - String word2 = ASTNodeWrapper.getJavaCode(word); - - //After typing 'arg.' all members of arg type are to be listed. This one is a flag for it - boolean noCompare = false; - if (word2.endsWith(".")) { - // return all matches - word2 = word2.substring(0, word2.length() - 1); - noCompare = true; - } - - if (word2.length() >= predictionMinLength && !noCompare - && word2.length() > lastPredictedWord.length()) { - if (word2.startsWith(lastPredictedWord)) { - log(word + " starts with " + lastPredictedWord); - log("Don't recalc"); - if (word2.contains(".")) { - int x = word2.lastIndexOf('.'); - trimCandidates(word2.substring(x + 1)); - } else { - trimCandidates(word2); - } - showPredictions(word); - lastPredictedWord = word2; - predictionOngoing.set(false); - return; - } - } - - int lineNumber = line; - // Adjust line number for tabbed sketches - if (errorCheckerService != null) { - editor = errorCheckerService.getEditor(); - int codeIndex = editor.getSketch().getCodeIndex(editor.getCurrentTab()); - if (codeIndex > 0) - for (int i = 0; i < codeIndex; i++) { - SketchCode sc = editor.getSketch().getCode(i); - int len = Util.countLines(sc.getProgram()) + 1; - lineNumber += len; - } - - } - - // Ensure that we're not inside a comment. TODO: Binary search - - /*for (Comment comm : getCodeComments()) { - int commLineNo = PdeToJavaLineNumber(compilationUnit - .getLineNumber(comm.getStartPosition())); - if(commLineNo == lineNumber){ - log("Found a comment line " + comm); - log("Comment LSO " - + javaCodeOffsetToLineStartOffset(compilationUnit - .getLineNumber(comm.getStartPosition()), - comm.getStartPosition())); - break; - } - }*/ - - // Now parse the expression into an ASTNode object - ASTNode nearestNode = null; - ASTParser parser = ASTParser.newParser(AST.JLS4); - parser.setKind(ASTParser.K_EXPRESSION); - parser.setSource(word2.toCharArray()); - ASTNode testnode = parser.createAST(null); - //Base.loge("PREDICTION PARSER PROBLEMS: " + parser); - // Find closest ASTNode of the document to this word - Messages.loge("Typed: " + word2 + "|" + " temp Node type: " + testnode.getClass().getSimpleName()); - if(testnode instanceof MethodInvocation){ - MethodInvocation mi = (MethodInvocation)testnode; - log(mi.getName() + "," + mi.getExpression() + "," + mi.typeArguments().size()); - } - - // find nearest ASTNode - nearestNode = findClosestNode(lineNumber, (ASTNode) errorCheckerService.getLastCorrectCU().types() - .get(0)); - if (nearestNode == null) { - // Make sure nearestNode is not NULL if couldn't find a closeset node - nearestNode = (ASTNode) errorCheckerService.getLastCorrectCU().types().get(0); - } - Messages.loge(lineNumber + " Nearest ASTNode to PRED " - + getNodeAsString(nearestNode)); - - candidates = new ArrayList(); - lastPredictedWord = word2; - // Determine the expression typed - - if (testnode instanceof SimpleName && !noCompare) { - Messages.loge("One word expression " + getNodeAsString(testnode)); - //==> Simple one word exprssion - so is just an identifier - - // Bottom up traversal of the AST to look for possible definitions at - // higher levels. - //nearestNode = nearestNode.getParent(); - while (nearestNode != null) { - // If the current class has a super class, look inside it for - // definitions. - if (nearestNode instanceof TypeDeclaration) { - TypeDeclaration td = (TypeDeclaration) nearestNode; - if (td.getStructuralProperty(TypeDeclaration.SUPERCLASS_TYPE_PROPERTY) != null) { - SimpleType st = (SimpleType) td.getStructuralProperty(TypeDeclaration.SUPERCLASS_TYPE_PROPERTY); - log("Superclass " + st.getName()); - ArrayList tempCandidates = - getMembersForType(st.getName().toString(), word2, noCompare, false); - for (CompletionCandidate can : tempCandidates) { - candidates.add(can); - } - //findDeclaration(st.getName()) - } - } - List sprops = - nearestNode.structuralPropertiesForType(); - for (StructuralPropertyDescriptor sprop : sprops) { - ASTNode cnode = null; - if (!sprop.isChildListProperty()) { - if (nearestNode.getStructuralProperty(sprop) instanceof ASTNode) { - cnode = (ASTNode) nearestNode.getStructuralProperty(sprop); - CompletionCandidate[] types = checkForTypes(cnode); - if (types != null) { - for (int i = 0; i < types.length; i++) { - if (types[i].getElementName().toLowerCase().startsWith(word2.toLowerCase())) - candidates.add(types[i]); - } - } - } - } else { - // Childlist prop - List nodelist = (List) - nearestNode.getStructuralProperty(sprop); - for (ASTNode clnode : nodelist) { - CompletionCandidate[] types = checkForTypes(clnode); - if (types != null) { - for (int i = 0; i < types.length; i++) { - if (types[i].getElementName().toLowerCase().startsWith(word2.toLowerCase())) - candidates.add(types[i]); - } - } - } - } - } - nearestNode = nearestNode.getParent(); - } - // We're seeing a simple name that's not defined locally or in - // the parent class. So most probably a pre-defined type. - log("Empty can. " + word2); - if (classPath != null) { - RegExpResourceFilter regExpResourceFilter; - regExpResourceFilter = new RegExpResourceFilter(Pattern.compile(".*"), - Pattern.compile(word2 + "[a-zA-Z_0-9]*.class", - Pattern.CASE_INSENSITIVE)); - String[] resources = classPath.findResources("", regExpResourceFilter); - - for (String matchedClass2 : resources) { - matchedClass2 = matchedClass2.replace('/', '.'); //package name - String matchedClass = matchedClass2.substring(0, matchedClass2.length() - 6); - int d = matchedClass.lastIndexOf('.'); - if (ignorableImport(matchedClass,matchedClass.substring(d + 1))) { - continue; - } - matchedClass = matchedClass.substring(d + 1); //class name - candidates - .add(new CompletionCandidate(matchedClass, "" - + matchedClass + " : " - + matchedClass2.substring(0, d) + "", - matchedClass, - CompletionCandidate.PREDEF_CLASS)); // display package name in grey - //log("-> " + className); - } - } - } else { - - // ==> Complex expression of type blah.blah2().doIt,etc - // Have to resolve it by carefully traversing AST of testNode - Messages.loge("Complex expression " + getNodeAsString(testnode)); - log("candidates empty"); - ASTNode childExpr = getChildExpression(testnode); - log("Parent expression : " + getParentExpression(testnode)); - log("Child expression : " + childExpr); - if (childExpr != null) { - if (!noCompare) { - log("Original testnode " - + getNodeAsString(testnode)); - testnode = getParentExpression(testnode); - log("Corrected testnode " - + getNodeAsString(testnode)); - } - ClassMember expr = resolveExpression3rdParty(nearestNode, testnode, - noCompare); - if (expr == null) { - log("Expr is null"); - } else { - log("Expr is " + expr.toString()); - candidates = getMembersForType(expr, childExpr.toString(), - noCompare, false); - } - } - else - { - log("ChildExpr is null"); - } - } - - showPredictions(word); - predictionOngoing.set(false); -// } -// }; -// -// worker.execute(); - } - - protected void showPredictions(final String word) { - if (sketchOutline != null && sketchOutline.isVisible()) { - // don't show completions when the outline is visible - return; - } - - Collections.sort(candidates); -// CompletionCandidate[][] candi = new CompletionCandidate[candidates.size()][1]; -// DefaultListModel defListModel = new DefaultListModel(); -// -// for (int i = 0; i < candidates.size(); i++) { -//// candi[i][0] = candidates.get(i); -// defListModel.addElement(candidates.get(i)); -// } -// log("Total preds = " + candidates.size()); - DefaultListModel defListModel = filterPredictions(); -// DefaultTableModel tm = new DefaultTableModel(candi, -// new String[] { "Suggestions" }); -// if (tableAuto.isVisible()) { -// tableAuto.setModel(tm); -// tableAuto.validate(); -// tableAuto.repaint(); -// } - errorCheckerService.getEditor().getJavaTextArea().showSuggestion(defListModel, word); - } - - private DefaultListModel filterPredictions(){ - DefaultListModel defListModel = new DefaultListModel(); - if (candidates.isEmpty()) - return defListModel; - // check if first & last CompCandidate are the same methods, only then show all overloaded methods - if (candidates.get(0).getElementName() - .equals(candidates.get(candidates.size() - 1).getElementName())) { - log("All CC are methods only: " + candidates.get(0).getElementName()); - for (int i = 0; i < candidates.size(); i++) { - candidates.get(i).regenerateCompletionString(); - defListModel.addElement(candidates.get(i)); - } - } - else { - boolean ignoredSome = false; - for (int i = 0; i < candidates.size(); i++) { - if(i > 0 && (candidates.get(i).getElementName() - .equals(candidates.get(i - 1).getElementName()))){ - if (candidates.get(i).getType() == CompletionCandidate.LOCAL_METHOD - || candidates.get(i).getType() == CompletionCandidate.PREDEF_METHOD) { - CompletionCandidate cc = candidates.get(i - 1); - String label = cc.getLabel(); - int x = label.lastIndexOf(')'); - if(candidates.get(i).getType() == CompletionCandidate.PREDEF_METHOD) { - cc.setLabel((cc.getLabel().contains("") ? "" : "") - + cc.getElementName() + "(...)" + label.substring(x + 1)); - } - else { - cc.setLabel(cc.getElementName() + "(...)" + label.substring(x + 1)); - } - cc.setCompletionString(cc.getElementName() + "("); - ignoredSome = true; - continue; - } - } - defListModel.addElement(candidates.get(i)); - } - if (ignoredSome) { - log("Some suggestions hidden"); - } - } - return defListModel; - } - - /** - * Loads classes from .jar files in sketch classpath - * - * @param typeName - * @param child - * @param noCompare - * @return - */ - public ArrayList getMembersForType(String typeName, - String child, - boolean noCompare, - boolean staticOnly) { - - ArrayList candidates = new ArrayList(); - log("In GMFT(), Looking for match " + child.toString() - + " in class " + typeName + " noCompare " + noCompare + " staticOnly " - + staticOnly); - Class probableClass = findClassIfExists(typeName); - if(probableClass == null){ - log("In GMFT(), class not found."); - return candidates; - } - return getMembersForType(new ClassMember(probableClass), child, noCompare, staticOnly); - - } - - public ArrayList getMembersForType(ClassMember tehClass, - String childToLookFor, - boolean noCompare, - boolean staticOnly) { - String child = childToLookFor.toLowerCase(); - ArrayList candidates = new ArrayList(); - log("getMemFoType-> Looking for match " + child.toString() - + " inside " + tehClass + " noCompare " + noCompare + " staticOnly " - + staticOnly); - if(tehClass == null){ - return candidates; - } - // tehClass will either be a TypeDecl defined locally - if(tehClass.getDeclaringNode() instanceof TypeDeclaration){ - - TypeDeclaration td = (TypeDeclaration) tehClass.getDeclaringNode(); - for (int i = 0; i < td.getFields().length; i++) { - List vdfs = td.getFields()[i] - .fragments(); - for (VariableDeclarationFragment vdf : vdfs) { - if (noCompare) { - candidates - .add(new CompletionCandidate(vdf)); - } else if (vdf.getName().toString().toLowerCase() - .startsWith(child)) - candidates - .add(new CompletionCandidate(vdf)); - } - - } - for (int i = 0; i < td.getMethods().length; i++) { - if (noCompare) { - candidates.add(new CompletionCandidate(td.getMethods()[i])); - } else if (td.getMethods()[i].getName().toString().toLowerCase() - .startsWith(child)) - candidates.add(new CompletionCandidate(td.getMethods()[i])); - } - - ArrayList superClassCandidates = new ArrayList(); - if(td.getSuperclassType() != null){ - log(getNodeAsString(td.getSuperclassType()) + " <-Looking into superclass of " + tehClass); - superClassCandidates = getMembersForType(new ClassMember(td - .getSuperclassType()), - childToLookFor, noCompare, staticOnly); - } - else - { - superClassCandidates = getMembersForType(new ClassMember(Object.class), - childToLookFor, noCompare, staticOnly); - } - for (CompletionCandidate cc : superClassCandidates) { - candidates.add(cc); - } - return candidates; - } - - // Or tehClass will be a predefined class - - Class probableClass; - if (tehClass.getClass_() != null) { - probableClass = tehClass.getClass_(); - } else { - probableClass = findClassIfExists(tehClass.getTypeAsString()); - if (probableClass == null) { - log("Couldn't find class " + tehClass.getTypeAsString()); - return candidates; - } - log("Loaded " + probableClass.toString()); - } - for (Method method : probableClass.getMethods()) { - if (!Modifier.isStatic(method.getModifiers()) && staticOnly) { - continue; - } - - StringBuilder label = new StringBuilder(method.getName() + "("); - for (int i = 0; i < method.getParameterTypes().length; i++) { - label.append(method.getParameterTypes()[i].getSimpleName()); - if (i < method.getParameterTypes().length - 1) - label.append(","); - } - label.append(")"); - if (noCompare) { - candidates.add(new CompletionCandidate(method)); - } else if (label.toString().toLowerCase().startsWith(child)) { - candidates.add(new CompletionCandidate(method)); - } - } - for (Field field : probableClass.getFields()) { - if (!Modifier.isStatic(field.getModifiers()) && staticOnly) { - continue; - } - if (noCompare) { - candidates.add(new CompletionCandidate(field)); - } else if (field.getName().toLowerCase().startsWith(child)) { - candidates.add(new CompletionCandidate(field)); - } - } - return candidates; - } - - public String getPDESourceCodeLine(int javaLineNumber) { - int res[] = errorCheckerService - .calculateTabIndexAndLineNumber(javaLineNumber); - if (res != null) { - return errorCheckerService.getPdeCodeAtLine(res[0], res[1]); - } - return null; - } - - /** - * Returns the java source code line at the given line number - * @param javaLineNumber - * @return - */ - public String getJavaSourceCodeLine(int javaLineNumber) { - try { - PlainDocument javaSource = new PlainDocument(); - javaSource.insertString(0, errorCheckerService.sourceCode, null); - Element lineElement = javaSource.getDefaultRootElement() - .getElement(javaLineNumber - 1); - if (lineElement == null) { - log("Couldn't fetch jlinenum " + javaLineNumber); - return null; - } - String javaLine = javaSource.getText(lineElement.getStartOffset(), - lineElement.getEndOffset() - - lineElement.getStartOffset()); - return javaLine; - } catch (BadLocationException e) { - Messages.loge(e + " in getJavaSourceCodeline() for jinenum: " + javaLineNumber); - } - return null; - } - - /** - * Returns the java source code line Element at the given line number. - * The Element object stores the offset data, but not the actual line - * of code. - * @param javaLineNumber - * @return - */ - public Element getJavaSourceCodeElement(int javaLineNumber) { - try { - PlainDocument javaSource = new PlainDocument(); - javaSource.insertString(0, errorCheckerService.sourceCode, null); - Element lineElement = javaSource.getDefaultRootElement() - .getElement(javaLineNumber - 1); - if (lineElement == null) { - log("Couldn't fetch jlinenum " + javaLineNumber); - return null; - } -// String javaLine = javaSource.getText(lineElement.getStartOffset(), -// lineElement.getEndOffset() -// - lineElement.getStartOffset()); - return lineElement; - } catch (BadLocationException e) { - Messages.loge(e + " in getJavaSourceCodeline() for jinenum: " + javaLineNumber); - } - return null; - } - - /** - * Searches for the particular class in the default list of imports as well as - * the Sketch classpath - * @param className - * @return - */ - protected Class findClassIfExists(String className){ - if(className == null){ - return null; - } - Class tehClass = null; - // First, see if the classname is a fully qualified name and loads straightaway - tehClass = loadClass(className); - - if (tehClass != null) { - //log(tehClass.getName() + " located straightaway"); - return tehClass; - } - - log("Looking in the classloader for " + className); - ArrayList imports = errorCheckerService - .getProgramImports(); - - for (ImportStatement impS : imports) { - String temp = impS.getPackageName(); - - if (temp.endsWith("*")) { - temp = temp.substring(0, temp.length() - 1) + className; - } else { - int x = temp.lastIndexOf('.'); - //log("fclife " + temp.substring(x + 1)); - if (!temp.substring(x + 1).equals(className)) { - continue; - } - } - tehClass = loadClass(temp); - if (tehClass != null) { - log(tehClass.getName() + " located."); - return tehClass; - } - - //log("Doesn't exist in package: " + impS.getImportName()); - - } - - PdePreprocessor p = new PdePreprocessor(null); - for (String impS : p.getCoreImports()) { - tehClass = loadClass(impS.substring(0,impS.length()-1) + className); - if (tehClass != null) { - log(tehClass.getName() + " located."); - return tehClass; - } - //log("Doesn't exist in package: " + impS); - } - - for (String impS : p.getDefaultImports()) { - if(className.equals(impS) || impS.endsWith(className)){ - tehClass = loadClass(impS); - if (tehClass != null) { - log(tehClass.getName() + " located."); - return tehClass; - } - // log("Doesn't exist in package: " + impS); - } - } - - // And finally, the daddy - String daddy = "java.lang." + className; - tehClass = loadClass(daddy); - if (tehClass != null) { - log(tehClass.getName() + " located."); - return tehClass; - } - //log("Doesn't exist in java.lang"); - - return tehClass; - } - - protected Class loadClass(String className){ - Class tehClass = null; - if (className != null) { - try { - tehClass = Class.forName(className, false, - errorCheckerService.getSketchClassLoader()); - } catch (ClassNotFoundException e) { - //log("Doesn't exist in package: "); - } - } - return tehClass; - } - - public ClassMember definedIn3rdPartyClass(String className,String memberName){ - Class probableClass = findClassIfExists(className); - if (probableClass == null) { - log("Couldn't load " + className); - return null; - } - if (memberName.equals("THIS")) { - return new ClassMember(probableClass); - } else { - return definedIn3rdPartyClass(new ClassMember(probableClass), memberName); - } - } - - public ClassMember definedIn3rdPartyClass(ClassMember tehClass,String memberName){ - if(tehClass == null) - return null; - log("definedIn3rdPartyClass-> Looking for " + memberName - + " in " + tehClass); - String memberNameL = memberName.toLowerCase(); - if (tehClass.getDeclaringNode() instanceof TypeDeclaration) { - - TypeDeclaration td = (TypeDeclaration) tehClass.getDeclaringNode(); - for (int i = 0; i < td.getFields().length; i++) { - List vdfs = - td.getFields()[i].fragments(); - for (VariableDeclarationFragment vdf : vdfs) { - if (vdf.getName().toString().toLowerCase() - .startsWith(memberNameL)) - return new ClassMember(vdf); - } - - } - for (int i = 0; i < td.getMethods().length; i++) { - if (td.getMethods()[i].getName().toString().toLowerCase() - .startsWith(memberNameL)) - return new ClassMember(td.getMethods()[i]); - } - if (td.getSuperclassType() != null) { - log(getNodeAsString(td.getSuperclassType()) + " <-Looking into superclass of " + tehClass); - return definedIn3rdPartyClass(new ClassMember(td - .getSuperclassType()),memberName); - } else { - return definedIn3rdPartyClass(new ClassMember(Object.class),memberName); - } - } - - Class probableClass = null; - if (tehClass.getClass_() != null) { - probableClass = tehClass.getClass_(); - } else { - probableClass = findClassIfExists(tehClass.getTypeAsString()); - log("Loaded " + probableClass.toString()); - } - for (Method method : probableClass.getMethods()) { - if (method.getName().equalsIgnoreCase(memberName)) { - return new ClassMember(method); - } - } - for (Field field : probableClass.getFields()) { - if (field.getName().equalsIgnoreCase(memberName)) { - return new ClassMember(field); - } - } - return null; - } - - public void updateJavaDoc(final CompletionCandidate candidate) { - //TODO: Work on this later. - return; - /* String methodmatch = candidate.toString(); - if (methodmatch.indexOf('(') != -1) { - methodmatch = methodmatch.substring(0, methodmatch.indexOf('(')); - } - - //log("jdoc match " + methodmatch); - String temp = " "; - for (final String key : jdocMap.keySet()) { - if (key.startsWith(methodmatch) && key.length() > 3) { - log("Matched jdoc " + key); - if (candidate.getWrappedObject() != null) { - String definingClass = ""; - if (candidate.getWrappedObject() instanceof Field) - definingClass = ((Field) candidate.getWrappedObject()) - .getDeclaringClass().getName(); - else if (candidate.getWrappedObject() instanceof Method) - definingClass = ((Method) candidate.getWrappedObject()) - .getDeclaringClass().getName(); - if (definingClass.equals("processing.core.PApplet")) { - temp = (jdocMap.get(key)); - break; - } - } - } - } - - final String jdocString = temp; - SwingUtilities.invokeLater(new Runnable() { - public void run() { - javadocPane.setText(jdocString); - scrollPane.getVerticalScrollBar().setValue(0); - //frmJavaDoc.setVisible(!jdocString.equals(" ")); - editor.toFront(); - editor.ta.requestFocus(); - } - }); -*/ - } - - protected static ASTNode findClosestParentNode(int lineNumber, ASTNode node) { - Iterator it = node - .structuralPropertiesForType().iterator(); - // Base.loge("Props of " + node.getClass().getName()); - while (it.hasNext()) { - StructuralPropertyDescriptor prop = it.next(); - - if (prop.isChildProperty() || prop.isSimpleProperty()) { - if (node.getStructuralProperty(prop) != null) { -// System.out -// .println(node.getStructuralProperty(prop) + " -> " + (prop)); - if (node.getStructuralProperty(prop) instanceof ASTNode) { - ASTNode cnode = (ASTNode) node.getStructuralProperty(prop); -// log("Looking at " + getNodeAsString(cnode)+ " for line num " + lineNumber); - int cLineNum = ((CompilationUnit) cnode.getRoot()) - .getLineNumber(cnode.getStartPosition() + cnode.getLength()); - if (getLineNumber(cnode) <= lineNumber && lineNumber <= cLineNum) { - return findClosestParentNode(lineNumber, cnode); - } - } - } - } - - else if (prop.isChildListProperty()) { - List nodelist = (List) node - .getStructuralProperty(prop); - for (ASTNode cnode : nodelist) { - int cLineNum = ((CompilationUnit) cnode.getRoot()) - .getLineNumber(cnode.getStartPosition() + cnode.getLength()); -// log("Looking at " + getNodeAsString(cnode)+ " for line num " + lineNumber); - if (getLineNumber(cnode) <= lineNumber && lineNumber <= cLineNum) { - return findClosestParentNode(lineNumber, cnode); - } - } - } - } - return node; - } - - protected static ASTNode findClosestNode(int lineNumber, ASTNode node) { - log("findClosestNode to line " + lineNumber); - ASTNode parent = findClosestParentNode(lineNumber, node); - log("findClosestParentNode returned " + getNodeAsString(parent)); - if (parent == null) - return null; - if (getLineNumber(parent) == lineNumber){ - log(parent + "|PNode " + getLineNumber(parent) + ", lfor " + lineNumber ); - return parent; - } - List nodes = null; - if (parent instanceof TypeDeclaration) { - nodes = ((TypeDeclaration) parent).bodyDeclarations(); - } else if (parent instanceof Block) { - nodes = ((Block) parent).statements(); - } else { - System.err.println("THIS CONDITION SHOULD NOT OCCUR - findClosestNode " - + getNodeAsString(parent)); - return null; - } - - if (nodes.size() > 0) { - ASTNode retNode = parent; - for (int i = 0; i < nodes.size(); i++) { - ASTNode cNode = nodes.get(i); - log(cNode + "|cNode " + getLineNumber(cNode) + ", lfor " + lineNumber ); - if (getLineNumber(cNode) <= lineNumber) - retNode = cNode; - } - - return retNode; - } - return parent; - } - - public DefaultMutableTreeNode getAST() { - return codeTree; - } - - public String getLabelForASTNode(int lineNumber, String name, int offset) { - return getASTNodeAt(lineNumber, name, offset, false).getLabel(); - //return ""; - } - - protected String getLabelIfType(ASTNodeWrapper node, SimpleName sn){ - ASTNode current = node.getNode().getParent(); - String type = ""; - StringBuilder fullName = new StringBuilder(); - Stack parents = new Stack(); - String simpleName = (sn == null) ? node.getNode().toString() : sn.toString(); - switch (node.getNodeType()) { - case ASTNode.TYPE_DECLARATION: - case ASTNode.METHOD_DECLARATION: - case ASTNode.FIELD_DECLARATION: - while (current != null) { - if (current instanceof TypeDeclaration) { - parents.push(((TypeDeclaration) current).getName().toString()); - } - current = current.getParent(); - } - while (parents.size() > 0) { - fullName.append(parents.pop() + "."); - } - fullName.append(simpleName); - if (node.getNode() instanceof MethodDeclaration) { - MethodDeclaration md = (MethodDeclaration) node.getNode(); - if (!md.isConstructor()) - type = md.getReturnType2().toString(); - fullName.append('('); - if (!md.parameters().isEmpty()) { - List params = md.parameters(); - for (ASTNode par : params) { - if (par instanceof SingleVariableDeclaration) { - SingleVariableDeclaration svd = (SingleVariableDeclaration) par; - fullName.append(svd.getType() + " " + svd.getName() + ","); - } - } - } - if(fullName.charAt(fullName.length() - 1) == ',') - fullName.deleteCharAt(fullName.length() - 1); - fullName.append(')'); - } - else if(node.getNode() instanceof FieldDeclaration){ - type = ((FieldDeclaration) node.getNode()).getType().toString(); - } - int x = fullName.indexOf("."); - fullName.delete(0, x + 1); - return type + " " + fullName; - - case ASTNode.SINGLE_VARIABLE_DECLARATION: - SingleVariableDeclaration svd = (SingleVariableDeclaration)node.getNode(); - return svd.getType() + " " + svd.getName(); - - case ASTNode.VARIABLE_DECLARATION_STATEMENT: - return ((VariableDeclarationStatement) node.getNode()).getType() + " " - + simpleName; - case ASTNode.VARIABLE_DECLARATION_EXPRESSION: - return ((VariableDeclarationExpression) node.getNode()).getType() + " " - + simpleName; - default: - break; - } - - - return ""; - } - - public void scrollToDeclaration(int lineNumber, String name, int offset) { - getASTNodeAt(lineNumber, name, offset, true); - } - - - /** - * Given a word(identifier) in pde code, finds its location in the ASTNode - * @param lineNumber - * @param name - * @param offset - line start nonwhitespace offset - * @param scrollOnly - * @return - */ - public ASTNodeWrapper getASTNodeAt(int lineNumber, String name, int offset, - boolean scrollOnly) { - - // Convert tab based pde line number to actual line number - int pdeLineNumber = lineNumber + errorCheckerService.mainClassOffset; -// log("----getASTNodeAt---- CU State: " -// + errorCheckerService.compilationUnitState); - if (errorCheckerService != null) { - editor = errorCheckerService.getEditor(); - int codeIndex = editor.getSketch().getCodeIndex(editor.getCurrentTab()); - if (codeIndex > 0) { - for (int i = 0; i < codeIndex; i++) { - SketchCode sc = editor.getSketch().getCode(i); - int len = Util.countLines(sc.getProgram()) + 1; - pdeLineNumber += len; - } - } - - } - - // Find closest ASTNode to the linenumber -// log("getASTNodeAt: Node line number " + pdeLineNumber); - ASTNode lineNode = findLineOfNode(compilationUnit, pdeLineNumber, offset, - name); - -// log("Node text +> " + lineNode); - ASTNode decl = null; - String nodeLabel = null; - String nameOfNode = null; // The node name which is to be scrolled to - - // Obtain correspondin java code at that line, match offsets - if (lineNode != null) { - String pdeCodeLine = errorCheckerService.getPdeCodeAtLine(editor - .getSketch().getCurrentCodeIndex(), lineNumber); - String javaCodeLine = getJavaSourceCodeLine(pdeLineNumber); - -// log(lineNumber + " Original Line num.\nPDE :" + pdeCodeLine); -// log("JAVA:" + javaCodeLine); -// log("Clicked on: " + name + " start offset: " + offset); - // Calculate expected java offset based on the pde line - OffsetMatcher ofm = new OffsetMatcher(pdeCodeLine, javaCodeLine); - int javaOffset = ofm.getJavaOffForPdeOff(offset, name.length()) - + lineNode.getStartPosition(); -// log("JAVA ast offset: " + (javaOffset)); - - // Find the corresponding node in the AST - ASTNode simpName = dfsLookForASTNode(errorCheckerService.getLatestCU(), - name, javaOffset, - javaOffset + name.length()); - - // If node wasn't found in the AST, lineNode may contain something - if (simpName == null && lineNode instanceof SimpleName) { - switch (lineNode.getParent().getNodeType()) { - case ASTNode.TYPE_DECLARATION: - - case ASTNode.METHOD_DECLARATION: - - case ASTNode.FIELD_DECLARATION: - - case ASTNode.VARIABLE_DECLARATION_FRAGMENT: - decl = lineNode.getParent(); - return new ASTNodeWrapper(decl, ""); - default: - break; - } - } - - // SimpleName instance found, now find its declaration in code - if (simpName instanceof SimpleName) { - nameOfNode = simpName.toString(); - // log(getNodeAsString(simpName)); - decl = findDeclaration((SimpleName) simpName); - if (decl != null) { -// Base.loge("DECLA: " + decl.getClass().getName()); - nodeLabel = getLabelIfType(new ASTNodeWrapper(decl), - (SimpleName) simpName); - //retLabelString = getNodeAsString(decl); - } else { -// Base.loge("null"); - if (scrollOnly) { - editor.statusMessage(simpName + " is not defined in this sketch", - JavaEditor.STATUS_ERR); - } - } - -// log(getNodeAsString(decl)); - - /* - // - findDecl3 testing - - ASTNode nearestNode = findClosestNode(lineNumber, - (ASTNode) compilationUnit.types() - .get(0)); - ClassMember cmem = resolveExpression3rdParty(nearestNode, - (SimpleName) simpName, - false); - if (cmem != null) { - log("CMEM-> " + cmem); - } else - log("CMEM-> null"); - */ - } - } - - if (decl != null && scrollOnly) { - /* - * For scrolling, we highlight just the name of the node, i.e., a - * SimpleName instance. But the declared node always points to the - * declared node itself, like TypeDecl, MethodDecl, etc. This is important - * since it contains all the properties. - */ - ASTNode simpName2 = getNodeName(decl, nameOfNode); -// Base.loge("FINAL String decl: " + getNodeAsString(decl)); -// Base.loge("FINAL String label: " + getNodeAsString(simpName2)); - //errorCheckerService.highlightNode(simpName2); - ASTNodeWrapper declWrap = new ASTNodeWrapper(simpName2, nodeLabel); - //errorCheckerService.highlightNode(declWrap); - if (!declWrap.highlightNode(this)) { - Messages.loge("Highlighting failed."); - } - } - - // Return the declaration wrapped as ASTNodeWrapper - return new ASTNodeWrapper(decl, nodeLabel); - } - - /** - * Given a declaration type astnode, returns the SimpleName peroperty - * of that node. - * @param node - * @param name - The name we're looking for. - * @return SimpleName - */ - protected static ASTNode getNodeName(ASTNode node, String name){ - List vdfs = null; - switch (node.getNodeType()) { - case ASTNode.TYPE_DECLARATION: - return ((TypeDeclaration) node).getName(); - case ASTNode.METHOD_DECLARATION: - return ((MethodDeclaration) node).getName(); - case ASTNode.SINGLE_VARIABLE_DECLARATION: - return ((SingleVariableDeclaration) node).getName(); - case ASTNode.FIELD_DECLARATION: - vdfs = ((FieldDeclaration) node).fragments(); - break; - case ASTNode.VARIABLE_DECLARATION_STATEMENT: - vdfs = ((VariableDeclarationStatement) node).fragments(); - break; - case ASTNode.VARIABLE_DECLARATION_EXPRESSION: - vdfs = ((VariableDeclarationExpression) node).fragments(); - break; - default: - break; - } - - if (vdfs != null) { - for (VariableDeclarationFragment vdf : vdfs) { - if (vdf.getName().toString().equals(name)) { - return vdf.getName(); - } - } - - } - return null; - } - - /** - * Fetches line number of the node in its CompilationUnit. - * @param node - * @return - */ - public static int getLineNumber(ASTNode node) { - return ((CompilationUnit) node.getRoot()).getLineNumber(node - .getStartPosition()); - } - - public static int getLineNumber(ASTNode node, int pos) { - return ((CompilationUnit) node.getRoot()).getLineNumber(pos); - } - -// public static void main(String[] args) { -// traversal2(); -// } -// -// public static void traversal2() { -// ASTParser parser = ASTParser.newParser(AST.JLS4); -// String source = readFile("/media/quarkninja/Work/TestStuff/low.java"); -//// String source = "package decl; \npublic class ABC{\n int ret(){\n}\n}"; -// parser.setSource(source.toCharArray()); -// parser.setKind(ASTParser.K_COMPILATION_UNIT); -// -// Map options = JavaCore.getOptions(); -// -// JavaCore.setComplianceOptions(JavaCore.VERSION_1_6, options); -// options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_6); -// parser.setCompilerOptions(options); -// -// CompilationUnit cu = (CompilationUnit) parser.createAST(null); -// log(CompilationUnit.propertyDescriptors(AST.JLS4).size()); -// -// DefaultMutableTreeNode astTree = new DefaultMutableTreeNode("CompilationUnit"); -// Base.loge("Errors: " + cu.getProblems().length); -// visitRecur(cu, astTree); -// Base.log("" + astTree.getChildCount()); -// -// try { -// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); -// JFrame frame2 = new JFrame(); -// JTree jtree = new JTree(astTree); -// frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); -// frame2.setBounds(new Rectangle(100, 100, 460, 620)); -// JScrollPane sp = new JScrollPane(); -// sp.setViewportView(jtree); -// frame2.add(sp); -// frame2.setVisible(true); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// -// ASTNode found = NodeFinder.perform(cu, 468, 5); -// if (found != null) { -// Base.log(found.toString()); -// } -// } - - - final ASTGenerator thisASTGenerator = this; - - protected void addListeners(){ - jtree.addTreeSelectionListener(new TreeSelectionListener() { - - @Override - public void valueChanged(TreeSelectionEvent e) { - Messages.log(e.toString()); - SwingWorker worker = new SwingWorker() { - - @Override - protected Object doInBackground() throws Exception { - return null; - } - - protected void done() { - if(jtree - .getLastSelectedPathComponent() == null){ - return; - } - DefaultMutableTreeNode tnode = (DefaultMutableTreeNode) jtree - .getLastSelectedPathComponent(); - if (tnode.getUserObject() instanceof ASTNodeWrapper) { - ASTNodeWrapper awrap = (ASTNodeWrapper) tnode.getUserObject(); - awrap.highlightNode(thisASTGenerator); - // errorCheckerService.highlightNode(awrap); - - //-- - try { - int javaLineNumber = getLineNumber(awrap.getNode()); - int pdeOffs[] = errorCheckerService - .calculateTabIndexAndLineNumber(javaLineNumber); - PlainDocument javaSource = new PlainDocument(); - javaSource.insertString(0, errorCheckerService.sourceCode, null); - Element lineElement = javaSource.getDefaultRootElement() - .getElement(javaLineNumber-1); - if(lineElement == null) { - return; - } - - String javaLine = javaSource.getText(lineElement.getStartOffset(), - lineElement.getEndOffset() - - lineElement.getStartOffset()); - editor.getSketch().setCurrentCode(pdeOffs[0]); - String pdeLine = editor.getLineText(pdeOffs[1]); - //String lookingFor = nodeName.toString(); - //log(lookingFor + ", " + nodeName.getStartPosition()); - log("JL " + javaLine + " LSO " + lineElement.getStartOffset() + "," - + lineElement.getEndOffset()); - log("PL " + pdeLine); - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - } - }; - worker.execute(); - } - }); - - btnRename.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if(txtRenameField.getText().length() == 0) - return; - SwingWorker worker = new SwingWorker() { - - @Override - protected Object doInBackground() throws Exception { - return null; - } - - protected void done() { - refactorIt(); - } - }; - worker.execute(); - } - }); - - btnListOccurrence.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - SwingWorker worker = new SwingWorker() { - - @Override - protected Object doInBackground() throws Exception { - return null; - } - - protected void done() { - handleShowUsage(); - } - }; - worker.execute(); - } - }); - - refactorTree.addTreeSelectionListener(new TreeSelectionListener() { - - @Override - public void valueChanged(TreeSelectionEvent e) { - log(e); - SwingWorker worker = new SwingWorker() { - - @Override - protected Object doInBackground() throws Exception { - return null; - } - - protected void done() { - if(refactorTree - .getLastSelectedPathComponent() == null){ - return; - } - DefaultMutableTreeNode tnode = (DefaultMutableTreeNode) refactorTree - .getLastSelectedPathComponent(); - - if (tnode.getUserObject() instanceof ASTNodeWrapper) { - ASTNodeWrapper awrap = (ASTNodeWrapper) tnode.getUserObject(); - //errorCheckerService.highlightNode(awrap); - awrap.highlightNode(thisASTGenerator); - } - } - }; - worker.execute(); - } - }); - } - - protected void refactorIt(){ - String newName = txtRenameField.getText().trim(); - String selText = lastClickedWord == null ? getSelectedText() - : lastClickedWord; - // Find all occurrences of last clicked word - DefaultMutableTreeNode defCU = findAllOccurrences(); //TODO: Repetition here - if(defCU == null){ - editor.statusMessage("Can't locate definition of " + selText, - JavaEditor.STATUS_ERR); - return; - } - - // Verify if the new name is a valid java identifier - if(!newName.matches("([a-zA-Z][a-zA-Z0-9_]*)|([_][a-zA-Z0-9_]+)")) - { - JOptionPane.showConfirmDialog(new JFrame(), newName - + " isn't a valid name.", "Uh oh..", JOptionPane.PLAIN_MESSAGE); - return; - } - //else log("New name looks K."); - - errorCheckerService.pauseThread(); - if(refactorTree.isVisible()){ - refactorTree.setModel(new DefaultTreeModel(defCU)); - ((DefaultTreeModel) refactorTree.getModel()).reload(); - } -// frmOccurenceList.setTitle("Usage of \"" + selText + "\" : " -// + defCU.getChildCount() + " time(s)"); -// frmOccurenceList.setLocation(editor.getX() + editor.getWidth(),editor.getY()); -// frmOccurenceList.setVisible(true); - int lineOffsetDisplacementConst = newName.length() - - selText.length(); - HashMap lineOffsetDisplacement = new HashMap(); - - // I need to store the pde and java offsets beforehand because once - // the replace starts, all offsets returned are affected - //int offsetsMap[][][] = new int[defCU.getChildCount()][2][]; - int pdeOffsets[][] = new int[defCU.getChildCount()][3]; - for (int i = 0; i < defCU.getChildCount(); i++) { - ASTNodeWrapper awrap = (ASTNodeWrapper) ((DefaultMutableTreeNode) (defCU - .getChildAt(i))).getUserObject(); - int ans[] = errorCheckerService.calculateTabIndexAndLineNumber(awrap - .getLineNumber()); - pdeOffsets[i][0] = ans[0]; - pdeOffsets[i][1] = ans[1]; - pdeOffsets[i][2] = awrap.getPDECodeOffsetForSN(this); - } - - editor.startCompoundEdit(); - for (int i = 0; i < defCU.getChildCount(); i++) { - ASTNodeWrapper awrap = (ASTNodeWrapper) ((DefaultMutableTreeNode) (defCU - .getChildAt(i))).getUserObject(); - // correction for pde enhancements related displacement on a line - int off = 0; - if (lineOffsetDisplacement.get(awrap.getLineNumber()) != null) { - off = lineOffsetDisplacement.get(awrap.getLineNumber()); - - lineOffsetDisplacement.put(awrap.getLineNumber(), - lineOffsetDisplacementConst + off); - } else { - lineOffsetDisplacement.put(awrap.getLineNumber(), - lineOffsetDisplacementConst); - } -// Base.loge(getNodeAsString(awrap.getNode()) + ", T:" + pdeOffsets[i][0] -// + ", L:" + pdeOffsets[i][1] + ", O:" + pdeOffsets[i][2]); - highlightPDECode(pdeOffsets[i][0], - pdeOffsets[i][1], pdeOffsets[i][2] - + off, awrap.getNode() - .toString().length()); - //int k = JOptionPane.showConfirmDialog(new JFrame(), "Rename?","", JOptionPane.INFORMATION_MESSAGE); - editor.getTextArea().setSelectedText(newName); - } - editor.stopCompoundEdit(); - errorCheckerService.resumeThread(); - editor.getSketch().setModified(true); - errorCheckerService.runManualErrorCheck(); -// frmOccurenceList.setVisible(false); - frmRename.setVisible(false); - lastClickedWord = null; - lastClickedWordNode = null; - } - - /** - * Highlights text in the editor - * @param tab - * @param lineNumber - * @param lineStartWSOffset - line start offset including initial white space - * @param length - */ - public void highlightPDECode(int tab, int lineNumber, int lineStartWSOffset, - int length) { -// log("ASTGen.highlightPDECode: T " + tab + ",L: " + lineNumber + ",LSO: " -// + lineStartWSOffset + ",Len: " + length); - editor.toFront(); - editor.getSketch().setCurrentCode(tab); - lineStartWSOffset += editor.getTextArea().getLineStartOffset(lineNumber); - editor.getTextArea().select(lineStartWSOffset, lineStartWSOffset + length); - } - - public void handleShowUsage() { - if (editor.hasJavaTabs()) return; // show usage disabled if java tabs - - log("Last clicked word:" + lastClickedWord); - if (lastClickedWord == null && - getSelectedText() == null) { - editor.statusMessage("Highlight the class/function/variable name first" - , JavaEditor.STATUS_INFO); - return; - } - - if(errorCheckerService.hasSyntaxErrors()){ - editor.statusMessage("Can't perform action until syntax errors are " + - "fixed :(", JavaEditor.STATUS_WARNING); - return; - } - DefaultMutableTreeNode defCU = findAllOccurrences(); - String selText = lastClickedWord == null ? - getSelectedText() : lastClickedWord; - if (defCU == null) { - editor.statusMessage("Can't locate definition of " + selText, - JavaEditor.STATUS_ERR); - return; - } - if(defCU.getChildCount() == 0) - return; - refactorTree.setModel(new DefaultTreeModel(defCU)); - ((DefaultTreeModel) refactorTree.getModel()).reload(); - refactorTree.setRootVisible(false); - frmOccurenceList.setTitle("Usage of \"" + selText + "\" : " - + defCU.getChildCount() + " time(s)"); - frmOccurenceList.setLocation(editor.getX() + editor.getWidth(),editor.getY()); - frmOccurenceList.setVisible(true); - lastClickedWord = null; - lastClickedWordNode = null; - } - - protected String lastClickedWord = null; - protected ASTNodeWrapper lastClickedWordNode = null; - - public String getLastClickedWord() { - return lastClickedWord; - } - - public void setLastClickedWord(int lineNumber, String lastClickedWord, int offset) { - this.lastClickedWord = lastClickedWord; - lastClickedWordNode = getASTNodeAt(lineNumber, lastClickedWord, offset, false); - log("Last clicked node: " + lastClickedWordNode); - } - - protected DefaultMutableTreeNode findAllOccurrences(){ - final JEditTextArea ta = editor.getTextArea(); - - log("Last clicked word:" + lastClickedWord); - String selText = lastClickedWord == null ? ta.getSelectedText() : - lastClickedWord; - int line = ta.getSelectionStartLine(); - log(selText - + "<- offsets " - + (line) - + ", " - + (ta.getSelectionStart() - ta.getLineStartOffset(line)) - + ", " - + (ta.getSelectionStop() - ta.getLineStartOffset(line))); - int offwhitespace = ta.getLineStartNonWhiteSpaceOffset(line); - ASTNodeWrapper wnode; - if (lastClickedWord == null || lastClickedWordNode.getNode() == null) { - wnode = getASTNodeAt(line + errorCheckerService.mainClassOffset, selText, - ta.getSelectionStart() - offwhitespace, false); - } - else{ - wnode = lastClickedWordNode; - } - if(wnode.getNode() == null){ - return null; - } - Messages.loge("Gonna find all occurrences of " + getNodeAsString(wnode.getNode())); - - //If wnode is a constructor, find the TD instead. - if (wnode.getNodeType() == ASTNode.METHOD_DECLARATION) { - MethodDeclaration md = (MethodDeclaration) wnode.getNode(); - ASTNode node = md.getParent(); - while (node != null) { - if (node instanceof TypeDeclaration) { - // log("Parent class " + getNodeAsString(node)); - break; - } - node = node.getParent(); - } - if(node != null && node instanceof TypeDeclaration){ - TypeDeclaration td = (TypeDeclaration) node; - if(td.getName().toString().equals(md.getName().toString())){ - Messages.loge("Renaming constructor of " + getNodeAsString(td)); - wnode = new ASTNodeWrapper(td); - } - } - } - - DefaultMutableTreeNode defCU = - new DefaultMutableTreeNode(new ASTNodeWrapper(wnode.getNode(), selText)); - dfsNameOnly(defCU, wnode.getNode(), selText); - - // Reverse the list obtained via dfs - Stack tempS = new Stack(); - for (int i = 0; i < defCU.getChildCount(); i++) { - tempS.push(defCU.getChildAt(i)); - } - defCU.removeAllChildren(); - while (!tempS.isEmpty()) { - defCU.add((MutableTreeNode) tempS.pop()); - } - log(wnode); - - return defCU; - } - - - /** - * Generates AST Swing component - * @param node - * @param tnode - */ - public static void visitRecur(ASTNode node, DefaultMutableTreeNode tnode) { - Iterator it = - node.structuralPropertiesForType().iterator(); - //Base.loge("Props of " + node.getClass().getName()); - DefaultMutableTreeNode ctnode = null; - while (it.hasNext()) { - StructuralPropertyDescriptor prop = it.next(); - - if (prop.isChildProperty() || prop.isSimpleProperty()) { - if (node.getStructuralProperty(prop) != null) { -// System.out -// .println(node.getStructuralProperty(prop) + " -> " + (prop)); - if (node.getStructuralProperty(prop) instanceof ASTNode) { - ASTNode cnode = (ASTNode) node.getStructuralProperty(prop); - if (isAddableASTNode(cnode)) { - ctnode = new DefaultMutableTreeNode( - new ASTNodeWrapper((ASTNode) node - .getStructuralProperty(prop))); - tnode.add(ctnode); - visitRecur(cnode, ctnode); - } - } else { - tnode.add(new DefaultMutableTreeNode(node - .getStructuralProperty(prop))); - } - } - } else if (prop.isChildListProperty()) { - List nodelist = (List) - node.getStructuralProperty(prop); - for (ASTNode cnode : nodelist) { - if (isAddableASTNode(cnode)) { - ctnode = new DefaultMutableTreeNode(new ASTNodeWrapper(cnode)); - tnode.add(ctnode); - visitRecur(cnode, ctnode); - } else { - visitRecur(cnode, tnode); - } - } - } - } - } - - - public void dfsNameOnly(DefaultMutableTreeNode tnode,ASTNode decl, String name) { - Stack temp = new Stack(); - temp.push(codeTree); - - while(!temp.isEmpty()){ - DefaultMutableTreeNode cnode = temp.pop(); - for (int i = 0; i < cnode.getChildCount(); i++) { - temp.push((DefaultMutableTreeNode) cnode.getChildAt(i)); - } - - if(!(cnode.getUserObject() instanceof ASTNodeWrapper)) - continue; - ASTNodeWrapper awnode = (ASTNodeWrapper) cnode.getUserObject(); -// log("Visiting: " + getNodeAsString(awnode.getNode())); - if(isInstanceOfType(awnode.getNode(), decl, name)){ - int val[] = errorCheckerService - .JavaToPdeOffsets(awnode.getLineNumber(), 0); - tnode.add(new DefaultMutableTreeNode(new ASTNodeWrapper(awnode - .getNode(), "Line " + (val[1] + 1) + " | Tab: " - + editor.getSketch().getCode(val[0]).getPrettyName()))); - } - - } - } - - public ASTNode dfsLookForASTNode(ASTNode root, String name, int startOffset, - int endOffset) { -// log("dfsLookForASTNode() lookin for " + name + " Offsets: " + startOffset -// + "," + endOffset); - Stack stack = new Stack(); - stack.push(root); - - while (!stack.isEmpty()) { - ASTNode node = stack.pop(); - //log("Popped from stack: " + getNodeAsString(node)); - Iterator it = - node.structuralPropertiesForType().iterator(); - while (it.hasNext()) { - StructuralPropertyDescriptor prop = it.next(); - - if (prop.isChildProperty() || prop.isSimpleProperty()) { - if (node.getStructuralProperty(prop) instanceof ASTNode) { - ASTNode temp = (ASTNode) node.getStructuralProperty(prop); - if (temp.getStartPosition() <= startOffset - && (temp.getStartPosition() + temp.getLength()) >= endOffset) { - if(temp instanceof SimpleName){ - if(name.equals(temp.toString())){ -// log("Found simplename: " + getNodeAsString(temp)); - return temp; - } -// log("Bummer, didn't match"); - } - else - stack.push(temp); - //log("Pushed onto stack: " + getNodeAsString(temp)); - } - } - } - else if (prop.isChildListProperty()) { - List nodelist = - (List) node.getStructuralProperty(prop); - for (ASTNode temp : nodelist) { - if (temp.getStartPosition() <= startOffset - && (temp.getStartPosition() + temp.getLength()) >= endOffset) { - stack.push(temp); -// log("Pushed onto stack: " + getNodeAsString(temp)); - if(temp instanceof SimpleName){ - if(name.equals(temp.toString())){ -// log("Found simplename: " + getNodeAsString(temp)); - return temp; - } -// log("Bummer, didn't match"); - } - else - stack.push(temp); - //log("Pushed onto stack: " + getNodeAsString(temp)); - } - } - } - } - } -// log("dfsLookForASTNode() not found " + name); - return null; - } - - - protected SketchOutline sketchOutline; - - public void showSketchOutline() { - if (editor.hasJavaTabs()) return; - - sketchOutline = new SketchOutline(codeTree, errorCheckerService); - sketchOutline.show(); - } - - - public void showTabOutline() { - new TabOutline(errorCheckerService).show(); - } - - - public int javaCodeOffsetToLineStartOffset(int line, int jOffset){ - // Find the first node with this line number, return its offset - jOffset - line = pdeLineNumToJavaLineNum(line); - log("Looking for line: " + line + ", jOff " + jOffset); - Stack temp = new Stack(); - temp.push(codeTree); - - while (!temp.isEmpty()) { - DefaultMutableTreeNode cnode = temp.pop(); - for (int i = 0; i < cnode.getChildCount(); i++) { - temp.push((DefaultMutableTreeNode) cnode.getChildAt(i)); - } - - if (!(cnode.getUserObject() instanceof ASTNodeWrapper)) - continue; - ASTNodeWrapper awnode = (ASTNodeWrapper) cnode.getUserObject(); -// log("Visiting: " + getNodeAsString(awnode.getNode())); - if (awnode.getLineNumber() == line) { - log("First element with this line no is: " + awnode - + "LSO: " + (jOffset - awnode.getNode().getStartPosition())); - return (jOffset - awnode.getNode().getStartPosition()); - } - } - return -1; - } - - - /** - * Converts pde line number to java line number - * @param pdeLineNum - pde line number - * @return - */ - protected int pdeLineNumToJavaLineNum(int pdeLineNum){ - int javaLineNumber = pdeLineNum + errorCheckerService.getPdeImportsCount(); - // Adjust line number for tabbed sketches - int codeIndex = editor.getSketch().getCodeIndex(editor.getCurrentTab()); - if (codeIndex > 0) - for (int i = 0; i < codeIndex; i++) { - SketchCode sc = editor.getSketch().getCode(i); - int len = Util.countLines(sc.getProgram()) + 1; - javaLineNumber += len; - } - return javaLineNumber; - } - - protected boolean isInstanceOfType(ASTNode node,ASTNode decl, String name){ - if(node instanceof SimpleName){ - SimpleName sn = (SimpleName) node; - - if (sn.toString().equals(name)) { - ArrayList nodesToBeMatched = new ArrayList(); - nodesToBeMatched.add(decl); - if(decl instanceof TypeDeclaration){ - log("decl is a TD"); - TypeDeclaration td = (TypeDeclaration)decl; - MethodDeclaration[] mlist = td.getMethods(); - for (MethodDeclaration md : mlist) { - if(md.getName().toString().equals(name)){ - nodesToBeMatched.add(md); - } - } - } - log("Visiting: " + getNodeAsString(node)); - ASTNode decl2 = findDeclaration(sn); - Messages.loge("It's decl: " + getNodeAsString(decl2)); - log("But we need: "+getNodeAsString(decl)); - for (ASTNode astNode : nodesToBeMatched) { - if(astNode.equals(decl2)){ - return true; - } - } - } - } - return false; - } - - public void handleRefactor() { - if (editor.hasJavaTabs()) return; // refactoring disabled w/ java tabs - - log("Last clicked word:" + lastClickedWord); - if (lastClickedWord == null && - getSelectedText() == null) { - editor.statusMessage("Highlight the class/function/variable name first", - JavaEditor.STATUS_INFO); - return; - } - - if (errorCheckerService.hasSyntaxErrors()) { - editor.statusMessage("Can't perform action until syntax errors are fixed :(", - JavaEditor.STATUS_WARNING); - return; - } - - DefaultMutableTreeNode defCU = findAllOccurrences(); - String selText = lastClickedWord == null ? - getSelectedText() : lastClickedWord; - if (defCU == null) { - editor.statusMessage(selText + " isn't defined in this sketch, so it can't" + - " be renamed", JavaEditor.STATUS_ERR); - return; - } - if (!frmRename.isVisible()){ - frmRename.setLocation(editor.getX() - + (editor.getWidth() - frmRename.getWidth()) / 2, - editor.getY() - + (editor.getHeight() - frmRename.getHeight()) - / 2); - frmRename.setVisible(true); - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - String selText = lastClickedWord == null ? getSelectedText() - : lastClickedWord; - frmOccurenceList.setTitle("All occurrences of " - + selText); - lblRefactorOldName.setText("Current name: " - + selText); - txtRenameField.setText(""); - txtRenameField.requestFocus(); - } - }); - } - frmRename.toFront(); - } - - - public static void printRecur(ASTNode node) { - Iterator it = node - .structuralPropertiesForType().iterator(); - //Base.loge("Props of " + node.getClass().getName()); - while (it.hasNext()) { - StructuralPropertyDescriptor prop = it.next(); - - if (prop.isChildProperty() || prop.isSimpleProperty()) { - if (node.getStructuralProperty(prop) != null) { -// System.out -// .println(node.getStructuralProperty(prop) + " -> " + (prop)); - if (node.getStructuralProperty(prop) instanceof ASTNode) { - ASTNode cnode = (ASTNode) node.getStructuralProperty(prop); - log(getNodeAsString(cnode)); - printRecur(cnode); - } - } - } - - else if (prop.isChildListProperty()) { - List nodelist = (List) node - .getStructuralProperty(prop); - for (ASTNode cnode : nodelist) { - log(getNodeAsString(cnode)); - printRecur(cnode); - } - } - } - } - - - protected static ASTNode findLineOfNode(ASTNode node, int lineNumber, - int offset, String name) { - - CompilationUnit root = (CompilationUnit) node.getRoot(); -// log("Inside "+getNodeAsString(node) + " | " + root.getLineNumber(node.getStartPosition())); - if (root.getLineNumber(node.getStartPosition()) == lineNumber) { - // Base.loge(3 + getNodeAsString(node) + " len " + node.getLength()); - return node; -// if (offset < node.getLength()) -// return node; -// else { -// Base.loge(-11); -// return null; -// } - } - for (Object oprop : node.structuralPropertiesForType()) { - StructuralPropertyDescriptor prop = (StructuralPropertyDescriptor) oprop; - if (prop.isChildProperty() || prop.isSimpleProperty()) { - if (node.getStructuralProperty(prop) != null) { - if (node.getStructuralProperty(prop) instanceof ASTNode) { - ASTNode retNode = findLineOfNode((ASTNode) node - .getStructuralProperty(prop), - lineNumber, offset, name); - if (retNode != null) { -// Base.loge(11 + getNodeAsString(retNode)); - return retNode; - } - } - } - } else if (prop.isChildListProperty()) { - List nodelist = (List) node - .getStructuralProperty(prop); - for (ASTNode retNode : nodelist) { - - ASTNode rr = findLineOfNode(retNode, lineNumber, offset, name); - if (rr != null) { -// Base.loge(12 + getNodeAsString(rr)); - return rr; - } - } - } - } -// Base.loge("-1"); - return null; - } - - /** - * - * @param node - * @param offset - * - from textarea painter - * @param lineStartOffset - * - obtained from findLineOfNode - * @param name - * @param root - * @return - */ - public static ASTNode pinpointOnLine(ASTNode node, int offset, - int lineStartOffset, String name) { - //log("pinpointOnLine node class: " + node.getClass().getSimpleName()); - if (node instanceof SimpleName) { - SimpleName sn = (SimpleName) node; - //log(offset+ "off,pol " + getNodeAsString(sn)); - if ((lineStartOffset + offset) >= sn.getStartPosition() - && (lineStartOffset + offset) <= sn.getStartPosition() - + sn.getLength()) { - if (sn.toString().equals(name)) { - return sn; - } - else { - return null; - } - } else { - return null; - } - } - for (Object oprop : node.structuralPropertiesForType()) { - StructuralPropertyDescriptor prop = (StructuralPropertyDescriptor) oprop; - if (prop.isChildProperty() || prop.isSimpleProperty()) { - if (node.getStructuralProperty(prop) != null) { - if (node.getStructuralProperty(prop) instanceof ASTNode) { - ASTNode retNode = pinpointOnLine((ASTNode) node - .getStructuralProperty(prop), - offset, lineStartOffset, name); - if (retNode != null) { -// Base.loge(11 + getNodeAsString(retNode)); - return retNode; - } - } - } - } else if (prop.isChildListProperty()) { - List nodelist = (List) node - .getStructuralProperty(prop); - for (ASTNode retNode : nodelist) { - - ASTNode rr = pinpointOnLine(retNode, offset, lineStartOffset, name); - if (rr != null) { -// Base.loge(12 + getNodeAsString(rr)); - return rr; - } - } - } - } -// Base.loge("-1"); - return null; - } - - /** - * Give this thing a {@link Name} instance - a {@link SimpleName} from the - * ASTNode for ex, and it tries its level best to locate its declaration in - * the AST. It really does. - * - * @param findMe - * @return - */ - protected static ASTNode findDeclaration(Name findMe) { - - // WARNING: You're entering the Rube Goldberg territory of Experimental Mode. - // To debug this code, thou must take the Recursive Leap of Faith. - - // log("entering --findDeclaration1 -- " + findMe.toString()); - ASTNode declaringClass = null; - ASTNode parent = findMe.getParent(); - ASTNode ret = null; - ArrayList constrains = new ArrayList(); - if (parent.getNodeType() == ASTNode.METHOD_INVOCATION) { - Expression exp = (Expression) ((MethodInvocation) parent) - .getStructuralProperty(MethodInvocation.EXPRESSION_PROPERTY); - //TODO: Note the imbalance of constrains.add(ASTNode.METHOD_DECLARATION); - // Possibly a bug here. Investigate later. - if (((MethodInvocation) parent).getName().toString() - .equals(findMe.toString())) { - constrains.add(ASTNode.METHOD_DECLARATION); - - if (exp != null) { - constrains.add(ASTNode.TYPE_DECLARATION); -// log("MI EXP: " + exp.toString() + " of type " -// + exp.getClass().getName() + " parent: " + exp.getParent()); - if (exp instanceof MethodInvocation) { - SimpleType stp = extracTypeInfo(findDeclaration(((MethodInvocation) exp) - .getName())); - if (stp == null) - return null; - declaringClass = findDeclaration(stp.getName()); - return definedIn(declaringClass, ((MethodInvocation) parent) - .getName().toString(), constrains, declaringClass); - } else if (exp instanceof FieldAccess) { - SimpleType stp = extracTypeInfo(findDeclaration(((FieldAccess) exp) - .getName())); - if (stp == null) - return null; - declaringClass = findDeclaration((stp.getName())); - return definedIn(declaringClass, ((MethodInvocation) parent) - .getName().toString(), constrains, declaringClass); - } - if (exp instanceof SimpleName) { - SimpleType stp = extracTypeInfo(findDeclaration(((SimpleName) exp))); - if (stp == null) - return null; - declaringClass = findDeclaration(stp.getName()); -// log("MI.SN " + getNodeAsString(declaringClass)); - constrains.add(ASTNode.METHOD_DECLARATION); - return definedIn(declaringClass, ((MethodInvocation) parent) - .getName().toString(), constrains, declaringClass); - } - - } - } else { - parent = parent.getParent(); // Move one up the ast. V V IMP!! - } - } else if (parent.getNodeType() == ASTNode.FIELD_ACCESS) { - FieldAccess fa = (FieldAccess) parent; - Expression exp = fa.getExpression(); - if (fa.getName().toString().equals(findMe.toString())) { - constrains.add(ASTNode.FIELD_DECLARATION); - - if (exp != null) { - constrains.add(ASTNode.TYPE_DECLARATION); -// log("FA EXP: " + exp.toString() + " of type " -// + exp.getClass().getName() + " parent: " + exp.getParent()); - if (exp instanceof MethodInvocation) { - SimpleType stp = extracTypeInfo(findDeclaration(((MethodInvocation) exp) - .getName())); - if (stp == null) - return null; - declaringClass = findDeclaration(stp.getName()); - return definedIn(declaringClass, fa.getName().toString(), - constrains, declaringClass); - } else if (exp instanceof FieldAccess) { - SimpleType stp = extracTypeInfo(findDeclaration(((FieldAccess) exp) - .getName())); - if (stp == null) - return null; - declaringClass = findDeclaration((stp.getName())); - constrains.add(ASTNode.TYPE_DECLARATION); - return definedIn(declaringClass, fa.getName().toString(), - constrains, declaringClass); - } - if (exp instanceof SimpleName) { - SimpleType stp = extracTypeInfo(findDeclaration(((SimpleName) exp))); - if (stp == null) - return null; - declaringClass = findDeclaration(stp.getName()); -// log("FA.SN " + getNodeAsString(declaringClass)); - constrains.add(ASTNode.METHOD_DECLARATION); - return definedIn(declaringClass, fa.getName().toString(), - constrains, declaringClass); - } - } - - } else { - parent = parent.getParent(); // Move one up the ast. V V IMP!! - } - } else if (parent.getNodeType() == ASTNode.QUALIFIED_NAME) { - - QualifiedName qn = (QualifiedName) parent; - if (!findMe.toString().equals(qn.getQualifier().toString())) { - - SimpleType stp = extracTypeInfo(findDeclaration((qn.getQualifier()))); -// log(qn.getQualifier() + "->" + qn.getName()); - declaringClass = findDeclaration(stp.getName()); - -// log("QN decl class: " + getNodeAsString(declaringClass)); - constrains.clear(); - constrains.add(ASTNode.TYPE_DECLARATION); - constrains.add(ASTNode.FIELD_DECLARATION); - return definedIn(declaringClass, qn.getName().toString(), constrains, - null); - } - else{ - if(findMe instanceof QualifiedName){ - QualifiedName qnn = (QualifiedName) findMe; -// log("findMe is a QN, " -// + (qnn.getQualifier().toString() + " other " + qnn.getName() -// .toString())); - - SimpleType stp = extracTypeInfo(findDeclaration((qnn.getQualifier()))); -// log(qnn.getQualifier() + "->" + qnn.getName()); - declaringClass = findDeclaration(stp.getName()); - -// log("QN decl class: " -// + getNodeAsString(declaringClass)); - constrains.clear(); - constrains.add(ASTNode.TYPE_DECLARATION); - constrains.add(ASTNode.FIELD_DECLARATION); - return definedIn(declaringClass, qnn.getName().toString(), constrains, - null); - } - } - } else if (parent.getNodeType() == ASTNode.SIMPLE_TYPE) { - constrains.add(ASTNode.TYPE_DECLARATION); - if (parent.getParent().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION) - constrains.add(ASTNode.CLASS_INSTANCE_CREATION); - } else if(parent.getNodeType() == ASTNode.TYPE_DECLARATION){ - // The condition where we look up the name of a class decl - TypeDeclaration td = (TypeDeclaration) parent; - if(findMe.equals(td.getName())) - { - return parent; - } - } - else if (parent instanceof Expression) { -// constrains.add(ASTNode.TYPE_DECLARATION); -// constrains.add(ASTNode.METHOD_DECLARATION); -// constrains.add(ASTNode.FIELD_DECLARATION); - } -// else if(findMe instanceof QualifiedName){ -// QualifiedName qn = (QualifiedName) findMe; -// System.out -// .println("findMe is a QN, " -// + (qn.getQualifier().toString() + " other " + qn.getName() -// .toString())); -// } - while (parent != null) { -// log("findDeclaration1 -> " + getNodeAsString(parent)); - for (Object oprop : parent.structuralPropertiesForType()) { - StructuralPropertyDescriptor prop = (StructuralPropertyDescriptor) oprop; - if (prop.isChildProperty() || prop.isSimpleProperty()) { - if (parent.getStructuralProperty(prop) instanceof ASTNode) { -// log(prop + " C/S Prop of -> " -// + getNodeAsString(parent)); - ret = definedIn((ASTNode) parent.getStructuralProperty(prop), - findMe.toString(), constrains, declaringClass); - if (ret != null) - return ret; - } - } else if (prop.isChildListProperty()) { -// log((prop) + " ChildList props of " -// + getNodeAsString(parent)); - List nodelist = (List) parent - .getStructuralProperty(prop); - for (ASTNode retNode : nodelist) { - ret = definedIn(retNode, findMe.toString(), constrains, - declaringClass); - if (ret != null) - return ret; - } - } - } - parent = parent.getParent(); - } - return null; - } - - /** - * A variation of findDeclaration() but accepts an alternate parent ASTNode - * @param findMe - * @param alternateParent - * @return - */ - protected static ASTNode findDeclaration2(Name findMe, ASTNode alternateParent) { - ASTNode declaringClass = null; - ASTNode parent = findMe.getParent(); - ASTNode ret = null; - ArrayList constrains = new ArrayList(); - if (parent.getNodeType() == ASTNode.METHOD_INVOCATION) { - Expression exp = (Expression) ((MethodInvocation) parent) - .getStructuralProperty(MethodInvocation.EXPRESSION_PROPERTY); - //TODO: Note the imbalance of constrains.add(ASTNode.METHOD_DECLARATION); - // Possibly a bug here. Investigate later. - if (((MethodInvocation) parent).getName().toString() - .equals(findMe.toString())) { - constrains.add(ASTNode.METHOD_DECLARATION); - - if (exp != null) { - constrains.add(ASTNode.TYPE_DECLARATION); -// log("MI EXP: " + exp.toString() + " of type " -// + exp.getClass().getName() + " parent: " + exp.getParent()); - if (exp instanceof MethodInvocation) { - SimpleType stp = extracTypeInfo(findDeclaration2(((MethodInvocation) exp) - .getName(), - alternateParent)); - if (stp == null) - return null; - declaringClass = findDeclaration2(stp.getName(), alternateParent); - return definedIn(declaringClass, ((MethodInvocation) parent) - .getName().toString(), constrains, declaringClass); - } else if (exp instanceof FieldAccess) { - SimpleType stp = extracTypeInfo(findDeclaration2(((FieldAccess) exp) - .getName(), - alternateParent)); - if (stp == null) - return null; - declaringClass = findDeclaration2((stp.getName()), alternateParent); - return definedIn(declaringClass, ((MethodInvocation) parent) - .getName().toString(), constrains, declaringClass); - } - if (exp instanceof SimpleName) { - SimpleType stp = extracTypeInfo(findDeclaration2(((SimpleName) exp), - alternateParent)); - if (stp == null) - return null; - declaringClass = findDeclaration2(stp.getName(), alternateParent); -// log("MI.SN " + getNodeAsString(declaringClass)); - constrains.add(ASTNode.METHOD_DECLARATION); - return definedIn(declaringClass, ((MethodInvocation) parent) - .getName().toString(), constrains, declaringClass); - } - - } - } else { - parent = parent.getParent(); // Move one up the ast. V V IMP!! - alternateParent = alternateParent.getParent(); - } - } else if (parent.getNodeType() == ASTNode.FIELD_ACCESS) { - FieldAccess fa = (FieldAccess) parent; - Expression exp = fa.getExpression(); - if (fa.getName().toString().equals(findMe.toString())) { - constrains.add(ASTNode.FIELD_DECLARATION); - - if (exp != null) { - constrains.add(ASTNode.TYPE_DECLARATION); -// log("FA EXP: " + exp.toString() + " of type " -// + exp.getClass().getName() + " parent: " + exp.getParent()); - if (exp instanceof MethodInvocation) { - SimpleType stp = extracTypeInfo(findDeclaration2(((MethodInvocation) exp) - .getName(), - alternateParent)); - if (stp == null) - return null; - declaringClass = findDeclaration2(stp.getName(), alternateParent); - return definedIn(declaringClass, fa.getName().toString(), - constrains, declaringClass); - } else if (exp instanceof FieldAccess) { - SimpleType stp = extracTypeInfo(findDeclaration2(((FieldAccess) exp) - .getName(), - alternateParent)); - if (stp == null) - return null; - declaringClass = findDeclaration2((stp.getName()), alternateParent); - constrains.add(ASTNode.TYPE_DECLARATION); - return definedIn(declaringClass, fa.getName().toString(), - constrains, declaringClass); - } - if (exp instanceof SimpleName) { - SimpleType stp = extracTypeInfo(findDeclaration2(((SimpleName) exp), - alternateParent)); - if (stp == null) - return null; - declaringClass = findDeclaration2(stp.getName(), alternateParent); -// log("FA.SN " + getNodeAsString(declaringClass)); - constrains.add(ASTNode.METHOD_DECLARATION); - return definedIn(declaringClass, fa.getName().toString(), - constrains, declaringClass); - } - } - - } else { - parent = parent.getParent(); // Move one up the ast. V V IMP!! - alternateParent = alternateParent.getParent(); - } - } else if (parent.getNodeType() == ASTNode.QUALIFIED_NAME) { - - QualifiedName qn = (QualifiedName) parent; - if (!findMe.toString().equals(qn.getQualifier().toString())) { - - SimpleType stp = extracTypeInfo(findDeclaration2((qn.getQualifier()), - alternateParent)); - if(stp == null) - return null; - declaringClass = findDeclaration2(stp.getName(), alternateParent); -// log(qn.getQualifier() + "->" + qn.getName()); -// log("QN decl class: " + getNodeAsString(declaringClass)); - constrains.clear(); - constrains.add(ASTNode.TYPE_DECLARATION); - constrains.add(ASTNode.FIELD_DECLARATION); - return definedIn(declaringClass, qn.getName().toString(), constrains, - null); - } - else{ - if(findMe instanceof QualifiedName){ - QualifiedName qnn = (QualifiedName) findMe; -// log("findMe is a QN, " -// + (qnn.getQualifier().toString() + " other " + qnn.getName() -// .toString())); - - SimpleType stp = extracTypeInfo(findDeclaration2((qnn.getQualifier()), alternateParent)); -// log(qnn.getQualifier() + "->" + qnn.getName()); - declaringClass = findDeclaration2(stp.getName(), alternateParent); - -// log("QN decl class: " -// + getNodeAsString(declaringClass)); - constrains.clear(); - constrains.add(ASTNode.TYPE_DECLARATION); - constrains.add(ASTNode.FIELD_DECLARATION); - return definedIn(declaringClass, qnn.getName().toString(), constrains, - null); - } - } - } else if (parent.getNodeType() == ASTNode.SIMPLE_TYPE) { - constrains.add(ASTNode.TYPE_DECLARATION); - if (parent.getParent().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION) - constrains.add(ASTNode.CLASS_INSTANCE_CREATION); - } else if (parent instanceof Expression) { -// constrains.add(ASTNode.TYPE_DECLARATION); -// constrains.add(ASTNode.METHOD_DECLARATION); -// constrains.add(ASTNode.FIELD_DECLARATION); - } // TODO: in findDec, we also have a case where parent of type TD is handled. - // Figure out if needed here as well. -// log("Alternate parent: " + getNodeAsString(alternateParent)); - while (alternateParent != null) { -// log("findDeclaration2 -> " -// + getNodeAsString(alternateParent)); - for (Object oprop : alternateParent.structuralPropertiesForType()) { - StructuralPropertyDescriptor prop = (StructuralPropertyDescriptor) oprop; - if (prop.isChildProperty() || prop.isSimpleProperty()) { - if (alternateParent.getStructuralProperty(prop) instanceof ASTNode) { -// log(prop + " C/S Prop of -> " -// + getNodeAsString(alternateParent)); - ret = definedIn((ASTNode) alternateParent - .getStructuralProperty(prop), - findMe.toString(), constrains, declaringClass); - if (ret != null) - return ret; - } - } else if (prop.isChildListProperty()) { -// log((prop) + " ChildList props of " -// + getNodeAsString(alternateParent)); - List nodelist = (List) alternateParent - .getStructuralProperty(prop); - for (ASTNode retNode : nodelist) { - ret = definedIn(retNode, findMe.toString(), constrains, - declaringClass); - if (ret != null) - return ret; - } - } - } - alternateParent = alternateParent.getParent(); - } - return null; - } - - - protected List getCodeComments(){ - List commentList = compilationUnit.getCommentList(); -// log("Total comments: " + commentList.size()); -// int i = 0; -// for (Comment comment : commentList) { -// log(++i + ": "+comment + " Line:" -// + compilationUnit.getLineNumber(comment.getStartPosition()) + ", " -// + comment.getLength()); -// } - return commentList; - } - - - protected boolean caretWithinLineComment() { - final JEditTextArea ta = editor.getTextArea(); - String pdeLine = editor.getLineText(ta.getCaretLine()).trim(); - int caretPos = ta.getCaretPosition() - ta.getLineStartNonWhiteSpaceOffset(ta.getCaretLine()); - int x = pdeLine.indexOf("//"); - - if (x >= 0 && caretPos > x) { - return true; - } - return false; - } - - - /** - * A wrapper for java.lang.reflect types. - * Will have to see if the usage turns out to be internal only here or not - * and then accordingly decide where to place this class. - * @author quarkninja - * - */ - public class ClassMember { - private Field field; - - private Method method; - - private Constructor cons; - - private Class thisclass; - - private String stringVal; - - private String classType; - - private ASTNode astNode; - - private ASTNode declaringNode; - - public ClassMember(Class m) { - thisclass = m; - stringVal = "Predefined Class " + m.getName(); - classType = m.getName(); - } - - public ClassMember(Method m) { - method = m; - stringVal = "Method " + m.getReturnType().getName() + " | " + m.getName() - + " defined in " + m.getDeclaringClass().getName(); - classType = m.getReturnType().getName(); - } - - public ClassMember(Field m) { - field = m; - stringVal = "Field " + m.getType().getName() + " | " + m.getName() - + " defined in " + m.getDeclaringClass().getName(); - classType = m.getType().getName(); - } - - public ClassMember(Constructor m) { - cons = m; - stringVal = "Cons " + " " + m.getName() + " defined in " - + m.getDeclaringClass().getName(); - } - - public ClassMember(ASTNode node){ - astNode = node; - stringVal = getNodeAsString(node); - if(node instanceof TypeDeclaration){ - declaringNode = node; - } - if(node instanceof SimpleType){ - classType = ((SimpleType)node).getName().toString(); - } - SimpleType stp = (node instanceof SimpleType) ? (SimpleType) node - : extracTypeInfo(node); - if(stp != null){ - ASTNode decl =findDeclaration(stp.getName()); - // Czech out teh mutation - if(decl == null){ - // a predefined type - classType = stp.getName().toString(); - Class probableClass = findClassIfExists(classType); - thisclass = probableClass; - } - else{ - // a local type - declaringNode = decl; - } - } - } - - public Class getClass_() { - return thisclass; - } - - public ASTNode getDeclaringNode(){ - return declaringNode; - } - - public Field getField() { - return field; - } - - public Method getMethod() { - return method; - } - - public Constructor getCons() { - return cons; - } - - public ASTNode getASTNode(){ - return astNode; - } - - public String toString() { - return stringVal; - } - - public String getTypeAsString(){ - return classType; - } - } - - - /** - * Find the SimpleType from FD, SVD, VDS, etc - * - * @param node - * @return - */ - public static SimpleType extracTypeInfo(ASTNode node) { - if (node == null) { - return null; - } - Type t = extracTypeInfo2(node); - if (t instanceof PrimitiveType) { - return null; - } else if (t instanceof ArrayType) { - ArrayType at = (ArrayType) t; - log(at.getComponentType() + " <-comp type, ele type-> " - + at.getElementType() + ", " - + at.getElementType().getClass().getName()); - if (at.getElementType() instanceof PrimitiveType) { - return null; - } else if (at.getElementType() instanceof SimpleType) { - return (SimpleType) at.getElementType(); - } else - return null; - } else if (t instanceof ParameterizedType) { - ParameterizedType pmt = (ParameterizedType) t; - log(pmt.getType() + ", " + pmt.getType().getClass()); - if (pmt.getType() instanceof SimpleType) { - return (SimpleType) pmt.getType(); - } else - return null; - } - return (SimpleType) t; - } - - - static public Type extracTypeInfo2(ASTNode node) { - if (node == null) - return null; - switch (node.getNodeType()) { - case ASTNode.METHOD_DECLARATION: - return ((MethodDeclaration) node).getReturnType2(); - case ASTNode.FIELD_DECLARATION: - return ((FieldDeclaration) node).getType(); - case ASTNode.VARIABLE_DECLARATION_EXPRESSION: - return ((VariableDeclarationExpression) node).getType(); - case ASTNode.VARIABLE_DECLARATION_STATEMENT: - return ((VariableDeclarationStatement) node).getType(); - case ASTNode.SINGLE_VARIABLE_DECLARATION: - return ((SingleVariableDeclaration) node).getType(); - case ASTNode.VARIABLE_DECLARATION_FRAGMENT: - return extracTypeInfo2(node.getParent()); - } - log("Unknown type info request " + getNodeAsString(node)); - return null; - } - - - static protected ASTNode definedIn(ASTNode node, String name, - ArrayList constrains, - ASTNode declaringClass) { - if (node == null) - return null; - if (constrains != null) { -// log("Looking at " + getNodeAsString(node) + " for " + name -// + " in definedIn"); - if (!constrains.contains(node.getNodeType()) && constrains.size() > 0) { -// System.err.print("definedIn -1 " + " But constrain was "); -// for (Integer integer : constrains) { -// System.out.print(ASTNode.nodeClassForType(integer) + ","); -// } -// log(); - return null; - } - } - - List vdfList = null; - switch (node.getNodeType()) { - - case ASTNode.TYPE_DECLARATION: - //Base.loge(getNodeAsString(node)); - TypeDeclaration td = (TypeDeclaration) node; - if (td.getName().toString().equals(name)) { - if (constrains.contains(ASTNode.CLASS_INSTANCE_CREATION)) { - // look for constructor; - MethodDeclaration[] methods = td.getMethods(); - for (MethodDeclaration md : methods) { - if (md.getName().toString().equalsIgnoreCase(name)) { - log("Found a constructor."); - return md; - } - } - } else { - // it's just the TD we're lookin for - return node; - } - } else { - if (constrains.contains(ASTNode.FIELD_DECLARATION)) { - // look for fields - FieldDeclaration[] fields = td.getFields(); - for (FieldDeclaration fd : fields) { - List fragments = fd.fragments(); - for (VariableDeclarationFragment vdf : fragments) { - if (vdf.getName().toString().equalsIgnoreCase(name)) - return fd; - } - } - } else if (constrains.contains(ASTNode.METHOD_DECLARATION)) { - // look for methods - MethodDeclaration[] methods = td.getMethods(); - for (MethodDeclaration md : methods) { - if (md.getName().toString().equalsIgnoreCase(name)) { - return md; - } - } - } - } - break; - case ASTNode.METHOD_DECLARATION: - //Base.loge(getNodeAsString(node)); - if (((MethodDeclaration) node).getName().toString().equalsIgnoreCase(name)) - return node; - break; - case ASTNode.SINGLE_VARIABLE_DECLARATION: - //Base.loge(getNodeAsString(node)); - if (((SingleVariableDeclaration) node).getName().toString().equalsIgnoreCase(name)) - return node; - break; - case ASTNode.FIELD_DECLARATION: - //Base.loge("FD" + node); - vdfList = ((FieldDeclaration) node).fragments(); - break; - case ASTNode.VARIABLE_DECLARATION_EXPRESSION: - //Base.loge("VDE" + node); - vdfList = ((VariableDeclarationExpression) node).fragments(); - break; - case ASTNode.VARIABLE_DECLARATION_STATEMENT: - //Base.loge("VDS" + node); - vdfList = ((VariableDeclarationStatement) node).fragments(); - break; - - default: - - } - if (vdfList != null) { - for (VariableDeclarationFragment vdf : vdfList) { - if (vdf.getName().toString().equalsIgnoreCase(name)) - return node; - } - } - return null; - } - - public String[] getSuggestImports(final String className){ - if(ignoredImportSuggestions == null) { - ignoredImportSuggestions = new TreeSet(); - } else { - if(ignoredImportSuggestions.contains(className)) { - log("Ignoring import suggestions for " + className); - return null; - } - } - - log("Looking for class " + className); - RegExpResourceFilter regf = - new RegExpResourceFilter(Pattern.compile(".*"), - Pattern.compile(className + ".class", - Pattern.CASE_INSENSITIVE)); - // TODO once saw NPE here...possible for classPath to be null? [fry 150808] - String[] resources = classPath.findResources("", regf); - List candidates = new ArrayList(); - for (String res : resources) { - candidates.add(res); - } - - // log("Couldn't find import for class " + className); - - for (Library lib : editor.getMode().contribLibraries) { - ClassPath cp = factory.createFromPath(lib.getClassPath()); - resources = cp.findResources("", regf); - for (String res : resources) { - candidates.add(res); - log("Res: " + res); - } - } - - if (editor.getSketch().hasCodeFolder()) { - File codeFolder = editor.getSketch().getCodeFolder(); - // get a list of .jar files in the "code" folder - // (class files in subfolders should also be picked up) - ClassPath cp = factory.createFromPath(Util.contentsToClassPath(codeFolder)); - resources = cp.findResources("", regf); - for (String res : resources) { - candidates.add(res); - log("Res: " + res); - } - } - - resources = new String[candidates.size()]; - for (int i = 0; i < resources.length; i++) { - resources[i] = candidates.get(i).replace('/', '.') - .substring(0, candidates.get(i).length() - 6); - } - -// ArrayList ans = new ArrayList(); -// for (int i = 0; i < resources.length; i++) { -// ans.add(resources[i]); -// } - - return resources; - } - protected JFrame frmImportSuggest; - private TreeSet ignoredImportSuggestions; - - public void suggestImports(final String className){ - if(ignoredImportSuggestions == null) { - ignoredImportSuggestions = new TreeSet(); - } else { - if(ignoredImportSuggestions.contains(className)) { - log("Ignoring import suggestions for " + className); - return; - } - } - if(frmImportSuggest != null) - if(frmImportSuggest.isVisible()) - return; - log("Looking for class " + className); - RegExpResourceFilter regf = new RegExpResourceFilter( - Pattern.compile(".*"), - Pattern - .compile(className - + ".class", - Pattern.CASE_INSENSITIVE)); - String[] resources = classPath - .findResources("", regf); - ArrayList candidates = new ArrayList(); - for (String res : resources) { - candidates.add(res); - } - - // log("Couldn't find import for class " + className); - - for (Library lib : editor.getMode().contribLibraries) { - ClassPath cp = factory.createFromPath(lib.getClassPath()); - resources = cp.findResources("", regf); - for (String res : resources) { - candidates.add(res); - log("Res: " + res); - } - } - - if (editor.getSketch().hasCodeFolder()) { - File codeFolder = editor.getSketch().getCodeFolder(); - // get a list of .jar files in the "code" folder - // (class files in subfolders should also be picked up) - ClassPath cp = - factory.createFromPath(Util.contentsToClassPath(codeFolder)); - resources = cp.findResources("", regf); - for (String res : resources) { - candidates.add(res); - log("Res: " + res); - } - } - - resources = new String[candidates.size()]; - for (int i = 0; i < resources.length; i++) { - resources[i] = candidates.get(i).replace('/', '.') - .substring(0, candidates.get(i).length() - 6); - } - if (resources.length >= 1) { - final JList classList = new JList(resources); - classList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - frmImportSuggest = new JFrame(); - frmImportSuggest.setSize(350, 200); - Toolkit.setIcon(frmImportSuggest); - frmImportSuggest.setLayout(new BoxLayout(frmImportSuggest - .getContentPane(), BoxLayout.Y_AXIS)); - ((JComponent) frmImportSuggest.getContentPane()).setBorder(BorderFactory - .createEmptyBorder(5, 5, 5, 5)); - JLabel lbl = new JLabel("The class \"" + className - + "\" couldn't be determined. You are probably missing one of the following imports:"); - JScrollPane jsp = new JScrollPane(); - jsp.setViewportView(classList); - JButton btnInsertImport = new JButton("Insert import"); - btnInsertImport.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { - if (classList.getSelectedValue() != null) { - try { - String impString = "import " + classList.getSelectedValue() - + ";\n"; - int ct = editor.getSketch().getCurrentCodeIndex(); - editor.getSketch().setCurrentCode(0); - editor.getTextArea().getDocument().insertString(0, impString, null); - editor.getSketch().setCurrentCode(ct); - errorCheckerService.runManualErrorCheck(); - frmImportSuggest.setVisible(false); - frmImportSuggest = null; - } catch (BadLocationException e) { - log("Failed to insert import for " + className); - e.printStackTrace(); - } - } - } - }); - - JButton btnCancel = new JButton("Cancel"); - btnCancel.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - frmImportSuggest.setVisible(false); - } - }); - - JPanel panelTop = new JPanel(), panelBottom = new JPanel(), panelLabel = new JPanel(); - panelTop.setLayout(new BoxLayout(panelTop, BoxLayout.Y_AXIS)); - panelTop.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - panelLabel.setLayout(new BorderLayout()); - panelLabel.add(lbl,BorderLayout.CENTER); - panelTop.add(panelLabel); - panelTop.add(Box.createRigidArea(new Dimension(1, 5))); - panelTop.add(jsp); - panelBottom.setLayout(new BoxLayout(panelBottom, BoxLayout.X_AXIS)); - panelBottom.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - panelBottom .setLayout(new BoxLayout(panelBottom, BoxLayout.X_AXIS)); - panelBottom.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - panelBottom.add(Box.createHorizontalGlue()); - panelBottom.add(btnInsertImport); - panelBottom.add(Box.createRigidArea(new Dimension(15, 0))); - panelBottom.add(btnCancel); - JButton btnIgnore = new JButton("Ignore \"" + className + "\""); - btnIgnore.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - ignoredImportSuggestions.add(className); - frmImportSuggest.setVisible(false); - } - }); - panelBottom.add(Box.createRigidArea(new Dimension(15, 0))); - panelBottom.add(btnIgnore); - -// frmImportSuggest.add(lbl); -// frmImportSuggest.add(jsp); -// frmImportSuggest.add(btnInsertImport); - frmImportSuggest.add(panelTop); - frmImportSuggest.add(panelBottom); - frmImportSuggest.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); - frmImportSuggest.setTitle("Import Suggestion"); - frmImportSuggest.setLocation(editor.getX() - + (editor.getWidth() - frmImportSuggest.getWidth()) / 2, - editor.getY() - + (editor.getHeight() - frmImportSuggest.getHeight()) - / 2); - hideSuggestion(); - classList.setSelectedIndex(0); - frmImportSuggest.setVisible(true); - } - - } - - public void disposeAllWindows() { - disposeWindow(frmASTView, frameAutoComp, frmImportSuggest, - frmOccurenceList, frmRename); - } - - public static void disposeWindow(JFrame... f) { - for (JFrame jFrame : f) { - if(jFrame != null) - jFrame.dispose(); - } - } - - protected boolean ignorableImport(String impName, String fullClassName) { - for (ImportStatement impS : errorCheckerService.getProgramImports()) { - if (impName.toLowerCase().startsWith(impS.getPackageName().toLowerCase())) { - return false; - } - } - if (JavaMode.suggestionsMap == null - || JavaMode.suggestionsMap.keySet().size() == 0) { - log("SuggestionsMap is null or empty, won't be able to trim class names"); - return true; - } - final String processingInclude = "include.processing"; - final String processingExclude = "exclude.processing"; - final String jdkInclude = "include.jdk"; - - if (impName.startsWith("processing")) { - if (JavaMode.suggestionsMap.get(processingInclude).contains(impName)) { - return false; - } else if (JavaMode.suggestionsMap.get(processingExclude).contains(impName)) { - return true; - } - } else if (impName.startsWith("java")) { - if (JavaMode.suggestionsMap.get(jdkInclude).contains(impName)) { - return false; - } - } - - return true; - } - - public static boolean isAddableASTNode(ASTNode node) { - switch (node.getNodeType()) { -// case ASTNode.STRING_LITERAL: -// case ASTNode.NUMBER_LITERAL: -// case ASTNode.BOOLEAN_LITERAL: -// case ASTNode.NULL_LITERAL: -// return false; - default: - return true; - } - } - - /** - * For any line or expression, finds the line start offset(java code). - * @param node - * @return - */ - public int getASTNodeLineStartOffset(ASTNode node){ - int nodeLineNo = getLineNumber(node); - while(node.getParent() != null){ - if (getLineNumber(node.getParent()) == nodeLineNo) { - node = node.getParent(); - } else { - break; - } - } - return node.getStartPosition(); - } - - /** - * For any node, finds various offsets (java code). - * - * @param node - * @return int[]{line number, line number start offset, node start offset, - * node length} - */ - public int[] getASTNodeAllOffsets(ASTNode node){ - int nodeLineNo = getLineNumber(node), nodeOffset = node.getStartPosition(), nodeLength = node - .getLength(); - while(node.getParent() != null){ - if (getLineNumber(node.getParent()) == nodeLineNo) { - node = node.getParent(); - } else { - break; - } - } - return new int[]{nodeLineNo, node.getStartPosition(), nodeOffset,nodeLength}; - } - - - - static protected String getNodeAsString(ASTNode node) { - if (node == null) - return "NULL"; - String className = node.getClass().getName(); - int index = className.lastIndexOf("."); - if (index > 0) - className = className.substring(index + 1); - - // if(node instanceof BodyDeclaration) - // return className; - - String value = className; - - if (node instanceof TypeDeclaration) - value = ((TypeDeclaration) node).getName().toString() + " | " + className; - else if (node instanceof MethodDeclaration) - value = ((MethodDeclaration) node).getName().toString() + " | " - + className; - else if (node instanceof MethodInvocation) - value = ((MethodInvocation) node).getName().toString() + " | " - + className; - else if (node instanceof FieldDeclaration) - value = ((FieldDeclaration) node).toString() + " FldDecl| "; - else if (node instanceof SingleVariableDeclaration) - value = ((SingleVariableDeclaration) node).getName() + " - " - + ((SingleVariableDeclaration) node).getType() + " | SVD "; - else if (node instanceof ExpressionStatement) - value = node.toString() + className; - else if (node instanceof SimpleName) - value = ((SimpleName) node).getFullyQualifiedName() + " | " + className; - else if (node instanceof QualifiedName) - value = node.toString() + " | " + className; - else if(node instanceof FieldAccess) - value = node.toString() + " | "; - else if (className.startsWith("Variable")) - value = node.toString() + " | " + className; - else if (className.endsWith("Type")) - value = node.toString() + " |" + className; - value += " [" + node.getStartPosition() + "," - + (node.getStartPosition() + node.getLength()) + "]"; - value += " Line: " - + ((CompilationUnit) node.getRoot()).getLineNumber(node - .getStartPosition()); - return value; - } - - /** - * CompletionPanel name - * - * @param node - * @return - */ - static protected String getNodeAsString2(ASTNode node) { - if (node == null) - return "NULL"; - String className = node.getClass().getName(); - int index = className.lastIndexOf("."); - if (index > 0) - className = className.substring(index + 1); - - // if(node instanceof BodyDeclaration) - // return className; - - String value = className; - - if (node instanceof TypeDeclaration) - value = ((TypeDeclaration) node).getName().toString(); - else if (node instanceof MethodDeclaration) - value = ((MethodDeclaration) node).getName().toString(); - else if (node instanceof MethodInvocation) - value = ((MethodInvocation) node).getName().toString() + " | " - + className; - else if (node instanceof FieldDeclaration) - value = ((FieldDeclaration) node).toString(); - else if (node instanceof SingleVariableDeclaration) - value = ((SingleVariableDeclaration) node).getName().toString(); - else if (node instanceof ExpressionStatement) - value = node.toString() + className; - else if (node instanceof SimpleName) - value = ((SimpleName) node).getFullyQualifiedName() + " | " + className; - else if (node instanceof QualifiedName) - value = node.toString(); - else if (node instanceof VariableDeclarationFragment) - value = ((VariableDeclarationFragment) node).getName().toString(); - else if (className.startsWith("Variable")) - value = node.toString(); - else if (node instanceof VariableDeclarationStatement) - value = ((VariableDeclarationStatement) node).toString(); - else if (className.endsWith("Type")) - value = node.toString(); -// value += " [" + node.getStartPosition() + "," -// + (node.getStartPosition() + node.getLength()) + "]"; -// value += " Line: " -// + ((CompilationUnit) node.getRoot()).getLineNumber(node -// .getStartPosition()); - return value; - } - -// public void jdocWindowVisible(boolean visible) { -// // frmJavaDoc.setVisible(visible); -// } - -// public static String readFile2(String path) { -// BufferedReader reader = null; -// try { -// reader = new BufferedReader( -// new InputStreamReader( -// new FileInputStream( -// new File( -// path)))); -// } catch (FileNotFoundException e) { -// e.printStackTrace(); -// } -// try { -// StringBuilder ret = new StringBuilder(); -// // ret.append("package " + className + ";\n"); -// String line; -// while ((line = reader.readLine()) != null) { -// ret.append(line); -// ret.append("\n"); -// } -// return ret.toString(); -// } catch (IOException e) { -// e.printStackTrace(); -// } finally { -// try { -// reader.close(); -// } catch (IOException e) { -// e.printStackTrace(); -// } -// } -// return null; -// } - - - static private void log(Object object) { - Messages.log(object == null ? "null" : object.toString()); - } - - - private String getSelectedText() { - return editor.getTextArea().getSelectedText(); - } - - - private void hideSuggestion() { - ((JavaTextArea) editor.getTextArea()).hideSuggestion(); - } -} diff --git a/java/src/processing/mode/java/pdex/ASTNodeWrapper.java b/java/src/processing/mode/java/pdex/ASTNodeWrapper.java deleted file mode 100644 index d9d4dec296..0000000000 --- a/java/src/processing/mode/java/pdex/ASTNodeWrapper.java +++ /dev/null @@ -1,824 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -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. -*/ - -package processing.mode.java.pdex; - -import java.util.Iterator; -import java.util.List; -import java.util.TreeMap; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.swing.text.BadLocationException; -import javax.swing.text.Element; -import javax.swing.text.PlainDocument; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.ExpressionStatement; -import org.eclipse.jdt.core.dom.FieldDeclaration; -import org.eclipse.jdt.core.dom.Javadoc; -import org.eclipse.jdt.core.dom.MethodDeclaration; -import org.eclipse.jdt.core.dom.MethodInvocation; -import org.eclipse.jdt.core.dom.QualifiedName; -import org.eclipse.jdt.core.dom.SimpleName; -import org.eclipse.jdt.core.dom.SingleVariableDeclaration; -import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; -import org.eclipse.jdt.core.dom.Type; -import org.eclipse.jdt.core.dom.TypeDeclaration; - -import processing.app.Base; -import processing.app.Messages; - - -/** - * Wrapper class for ASTNode objects - * @author Manindra Moharana - * - */ -public class ASTNodeWrapper { - private ASTNode Node; - private String label; - private int lineNumber; - - - /* - * TODO: Every ASTNode object in ASTGenerator.codetree is stored as a - * ASTNodeWrapper instance. So how resource heavy would it be to store a - * pointer to ECS in every instance of ASTNodeWrapper? Currently I will rather - * pass an ECS pointer in the argument when I need to access a method which - * requires a method defined in ECS, i.e, only on demand. - * Bad design choice for ECS methods? IDK, yet. - */ - - public ASTNodeWrapper(ASTNode node) { - if (node == null){ - return; - } - this.Node = node; - label = getNodeAsString(node); - if (label == null) - label = node.toString(); - lineNumber = getLineNumber(node); - label += " | Line " + lineNumber; - //apiLevel = 0; - } - - public ASTNodeWrapper(ASTNode node, String label){ - if (node == null){ - return; - } - this.Node = node; - if(label != null) - this.label = label; - else{ - label = getNodeAsString(node); - if (label == null) - label = node.toString(); - - label += " | Line " + lineNumber; - } - lineNumber = getLineNumber(node); - } - - /** - * For this node, finds various offsets (java code). - * Note that line start offset for this node is int[2] - int[1] - * @return int[]{line number, line number start offset, node start offset, - * node length} - */ - public int[] getJavaCodeOffsets(ErrorCheckerService ecs) { - int nodeOffset = Node.getStartPosition(), nodeLength = Node - .getLength(); - Messages.log("0.nodeOffset " + nodeOffset); - ASTNode thisNode = Node; - while (thisNode.getParent() != null) { - if (getLineNumber(thisNode.getParent()) == lineNumber) { - thisNode = thisNode.getParent(); - } else { - break; - } - } - /* - * There's an edge case here - multiple statements in a single line. - * After identifying the statement with the line number, I'll have to - * look at previous tree nodes in the same level for same line number. - * The correct line start offset would be the line start offset of - * the first node with this line number. - * - * Using linear search for now. P.S: Eclipse AST iterators are messy. - * TODO: binary search might improve speed by 0.001%? - */ - - int altStartPos = thisNode.getStartPosition(); - Messages.log("1.Altspos " + altStartPos); - thisNode = thisNode.getParent(); - Javadoc jd = null; - - /* - * There's another case that needs to be handled. If a TD, MD or FD - * contains javadoc comments(multi or single line) the starting position - * of the javadoc is treated as the beginning of the declaration by the AST parser. - * But that's clearly not what we need. The true decl begins after the javadoc ends. - * So this offset needs to be found carefully and stored in altStartPos - * - */ - if (thisNode instanceof TypeDeclaration) { - jd = ((TypeDeclaration) thisNode).getJavadoc(); - altStartPos = getJavadocOffset((TypeDeclaration) thisNode); - Messages.log("Has t jdoc " + ((TypeDeclaration) thisNode).getJavadoc()); - } else if (thisNode instanceof MethodDeclaration) { - altStartPos = getJavadocOffset((MethodDeclaration) thisNode); - jd = ((MethodDeclaration) thisNode).getJavadoc(); - Messages.log("Has m jdoc " + jd); - } else if (thisNode instanceof FieldDeclaration) { - FieldDeclaration fd = ((FieldDeclaration) thisNode); - jd = fd.getJavadoc(); - Messages.log("Has f jdoc " + fd.getJavadoc()); - altStartPos = getJavadocOffset(fd); - //nodeOffset = ((VariableDeclarationFragment)(fd.fragments().get(0))).getName().getStartPosition(); - } - - if (jd == null) { - Messages.log("Visiting children of node " + getNodeAsString(thisNode)); - @SuppressWarnings("unchecked") - Iterator it = - thisNode.structuralPropertiesForType().iterator(); - boolean flag = true; - while (it.hasNext()) { - StructuralPropertyDescriptor prop = it.next(); - if (prop.isChildListProperty()) { - @SuppressWarnings("unchecked") - List nodelist = (List) - thisNode.getStructuralProperty(prop); - Messages.log("prop " + prop); - for (ASTNode cnode : nodelist) { - Messages.log("Visiting node " + getNodeAsString(cnode)); - if (getLineNumber(cnode) == lineNumber) { - if (flag) { - altStartPos = cnode.getStartPosition(); - // log("multi..."); - - flag = false; - } else { - if (cnode == Node) { - // loop only till the current node. - break; - } - // We've located the first node in the line. - // Now normalize offsets till Node - //altStartPos += normalizeOffsets(cnode); - - } - - } - } - } - } - Messages.log("Altspos " + altStartPos); - } - - int pdeoffsets[] = getPDECodeOffsets(ecs); - String pdeCode = ecs.getPdeCodeAtLine(pdeoffsets[0],pdeoffsets[1] - 1).trim(); - int vals[] = createOffsetMapping(ecs, pdeCode,nodeOffset - altStartPos,nodeLength); - if (vals != null) - return new int[] { - lineNumber, nodeOffset + vals[0] - altStartPos, vals[1] }; - else {// no offset mapping needed - Messages.log("joff[1] = " + (nodeOffset - altStartPos)); - return new int[] { lineNumber, nodeOffset - altStartPos, nodeLength }; - } - } - - /** - * When FD has javadoc attached, the beginning of FD is marked as the - * start of the javadoc. This kind of screws things when trying to locate - * the exact name of the FD. So, offset compensations... - * - * @param fd - * @return - */ - private int getJavadocOffset(FieldDeclaration fd){ - @SuppressWarnings("unchecked") - List list = fd.modifiers(); - SimpleName sn = (SimpleName) getNode(); - - Type tp = fd.getType(); - int lineNum = getLineNumber(sn); - Messages.log("SN "+sn + ", " + lineNum); - for (ASTNode astNode : list) { - if(getLineNumber(astNode) == lineNum) { - Messages.log("first node in that line " + astNode); - Messages.log("diff " + (sn.getStartPosition() - astNode.getStartPosition())); - return (astNode.getStartPosition()); - } - } - if(getLineNumber(fd.getType()) == lineNum) { - Messages.log("first node in that line " + tp); - Messages.log("diff " + (sn.getStartPosition() - tp.getStartPosition())); - return (tp.getStartPosition()); - } - return 0; - } - - /** - * When MD has javadoc attached, the beginning of FD is marked as the - * start of the javadoc. This kind of screws things when trying to locate - * the exact name of the MD. So, offset compensations... - * - * @param md - * @return - */ - private int getJavadocOffset(MethodDeclaration md) { - @SuppressWarnings("unchecked") - List list = md.modifiers(); - SimpleName sn = (SimpleName) getNode(); - int lineNum = getLineNumber(sn); - Messages.log("SN " + sn + ", " + lineNum); - - for (ASTNode astNode : list) { - if (getLineNumber(astNode) == lineNum) { - Messages.log("first node in that line " + astNode); - Messages.log("diff " + (sn.getStartPosition() - astNode.getStartPosition())); - return (astNode.getStartPosition()); - } - } - - if (!md.isConstructor()) { - Type tp = md.getReturnType2(); - if (getLineNumber(tp) == lineNum) { - Messages.log("first node in that line " + tp); - Messages.log("diff " + (sn.getStartPosition() - tp.getStartPosition())); - return (tp.getStartPosition()); - } - } - - return 0; - } - - /** - * When TD has javadoc attached, the beginning of FD is marked as the - * start of the javadoc. This kind of screws things when trying to locate - * the exact name of the TD. So, offset compensations... - * - * @param td - * @return - */ - private int getJavadocOffset(TypeDeclaration td){ - // TODO: This isn't perfect yet. Class \n \n \n className still breaks it.. :'( - @SuppressWarnings("unchecked") - List list = td.modifiers(); - SimpleName sn = (SimpleName) getNode(); - - int lineNum = getLineNumber(sn); - Messages.log("SN "+sn + ", " + lineNum); - for (ASTNode astNode : list) { - if (getLineNumber(astNode) == lineNum) { - Messages.log("first node in that line " + astNode); - Messages.log("diff " + (sn.getStartPosition() - astNode.getStartPosition())); - return (astNode.getStartPosition()); - } - } - - if (td.getJavadoc() != null){ - Messages.log("diff " - + (td.getJavadoc().getStartPosition() + td.getJavadoc().getLength() + 1)); - return (td.getJavadoc().getStartPosition() + td.getJavadoc().getLength() + 1); - } - Messages.log("getJavadocOffset(TypeDeclaration td) "+sn + ", found nothing. Meh."); - return 0; - } - - /** - * Finds the difference in pde and java code offsets - * @param source - * @param inpOffset - * @param nodeLen - * @return int[0] - difference in start offset, int[1] - node length - */ - private int[] createOffsetMapping(ErrorCheckerService ecs, String source, int inpOffset, int nodeLen) { - - int ret[][] = getOffsetMapping(ecs, source); - if(ret == null){ - // no offset mapping needed - return null; - } - int javaCodeMap[] = ret[0]; - int pdeCodeMap[] = ret[1]; - int pi = 1, pj = 1; - pj = 0; - pi = 0; - int count = 1; - // first find the java code index - pj = inpOffset; - - int startIndex = javaCodeMap[pj]; - - // find beginning - while (pdeCodeMap[pi] != startIndex && pi < pdeCodeMap.length) - pi++; - int startoffDif = pi - pj; - int stopindex = javaCodeMap[pj + nodeLen - 1]; - Messages.log(startIndex + "SI,St" + stopindex + "sod " + startoffDif); - - // count till stopindex - while (pdeCodeMap[pi] < stopindex && pi < pdeCodeMap.length) { - pi++; - count++; - } - -// log("PDE maps from " + pdeeCodeMap[pi]); - - Messages.log("pde len " + count); - return new int[] { startoffDif, count }; - } - - /** - * Generates offset mapping between java and pde code - * - * @param source - * @return int[0] - java code offsets, int[1] = pde code offsets - */ - public int[][] getOffsetMapping(ErrorCheckerService ecs, String source){ - - /* - * This is some tricky shiz. So detailed explanation follows: - * - * The main issue here is that pde enhancements like color vars, # literals - * and int() type casting deviate from standard java. But I need to exact - * index matching for pde and java versions of snippets.For ex: - * "color col = #ffaadd;" <-PDE version - * "int col = 0xffffaadd;" <-Converted to Java - * - * For exact index mapping, I need to know at which indices either is - * deviating from the other and by what amount. Turns out, it isn't quite - * easy.(1) First I take the pde version of the code as an argument(pde - * version fetched from the editor directly). I then find all instances - * which need to be converted to pure java, marking those indices and the - * index correction needed. (2) Now all java conversions are applied after - * marking the offsets. This ensures that the index order isn't disturbed by - * one at a time conversions as done in preprocessCode() in ECS. Took me - * sometime to figure out this was a bug. (3) Next I create a table(two - * separate arrays) which allows me to look it up for matching any index - * between pde or java version of the snippet. This also lets me find out - * any difference in length between both versions. - * - * Keep in mind though, dark magic was involved in creating the final lookup - * table. - * - * TODO: This is a work in progress. There may be more bugs here in hiding. - */ - - Messages.log("Src:" + source); - // Instead of converting pde into java, how can I simply extract the same source - // from the java code? Think. TODO - String sourceAlt = new String(source); - String sourceJava = ecs.astGenerator.getJavaSourceCodeLine(lineNumber); - TreeMap offsetmap = new TreeMap(); - - if(sourceJava.trim().startsWith("public") && !source.startsWith("public")){ - offsetmap.put(0,6); - //TODO: This is a temp fix. You GOTTA rewrite offset matching - } - // Find all #[web color] - // Should be 6 digits only. - final String webColorRegexp = "#{1}[A-F|a-f|0-9]{6}\\W"; - Pattern webPattern = Pattern.compile(webColorRegexp); - Matcher webMatcher = webPattern.matcher(sourceAlt); - while (webMatcher.find()) { - // log("Found at: " + webMatcher.start()); - // log("-> " + found); - offsetmap.put(webMatcher.end() - 1, 3); - } - - // Find all color data types - final String colorTypeRegex = "color(?![a-zA-Z0-9_])(?=\\[*)(?!(\\s*\\())"; - Pattern colorPattern = Pattern.compile(colorTypeRegex); - Matcher colorMatcher = colorPattern.matcher(sourceAlt); - while (colorMatcher.find()) { -// System.out.print("Start index: " + colorMatcher.start()); -// log(" End index: " + colorMatcher.end() + " "); -// log("-->" + colorMatcher.group() + "<--"); - offsetmap.put(colorMatcher.end() - 1, -2); - } - - // Find all int(), char() - String dataTypeFunc[] = { "int", "char", "float", "boolean", "byte" }; - - for (String dataType : dataTypeFunc) { - String dataTypeRegexp = "\\b" + dataType + "\\s*\\("; - Pattern pattern = Pattern.compile(dataTypeRegexp); - Matcher matcher = pattern.matcher(sourceAlt); - - while (matcher.find()) { -// System.out.print("Start index: " + matcher.start()); -// log(" End index: " + matcher.end() + " "); -// log("-->" + matcher.group() + "<--"); - offsetmap.put(matcher.end() - 1, ("PApplet.parse").length()); - } - matcher.reset(); - sourceAlt = matcher.replaceAll("PApplet.parse" - + Character.toUpperCase(dataType.charAt(0)) + dataType.substring(1) - + "("); - - } - if(offsetmap.isEmpty()){ - Messages.log("No offset matching needed."); - return null; - } - // replace with 0xff[webcolor] and others - webMatcher = webPattern.matcher(sourceAlt); - while (webMatcher.find()) { - // log("Found at: " + webMatcher.start()); - String found = sourceAlt.substring(webMatcher.start(), webMatcher.end()); - // log("-> " + found); - sourceAlt = webMatcher.replaceFirst("0xff" + found.substring(1)); - webMatcher = webPattern.matcher(sourceAlt); - } - - colorMatcher = colorPattern.matcher(sourceAlt); - sourceAlt = colorMatcher.replaceAll("int"); - - Messages.log("From direct source: "); -// sourceAlt = sourceJava; - Messages.log(sourceAlt); - - - // Create code map. Beware! Dark magic ahead. - int javaCodeMap[] = new int[source.length() * 2]; - int pdeCodeMap[] = new int[source.length() * 2]; - int pi = 1, pj = 1; - int keySum = 0; - for (Integer key : offsetmap.keySet()) { - for (; pi < key +keySum; pi++) { - javaCodeMap[pi] = javaCodeMap[pi - 1] + 1; - } - for (; pj < key; pj++) { - pdeCodeMap[pj] = pdeCodeMap[pj - 1] + 1; - } - - Messages.log(key + ":" + offsetmap.get(key)); - - int kval = offsetmap.get(key); - if (kval > 0) { - // repeat java offsets - pi--; - pj--; - for (int i = 0; i < kval; i++, pi++, pj++) { - if (pi > 1 && pj > 1) { - javaCodeMap[pi] = javaCodeMap[pi - 1]; - pdeCodeMap[pj] = pdeCodeMap[pj - 1] + 1; - } - } - } else { - // repeat pde offsets - pi--; - pj--; - for (int i = 0; i < -kval; i++, pi++, pj++) { - if (pi > 1 && pj > 1) { - javaCodeMap[pi] = javaCodeMap[pi - 1] + 1; - pdeCodeMap[pj] = pdeCodeMap[pj - 1]; - } - } - } - - // after each adjustment, the key values need to keep - // up with changed offset - keySum += kval; - } - - javaCodeMap[pi] = javaCodeMap[pi - 1] + 1; - pdeCodeMap[pj] = pdeCodeMap[pj - 1] + 1; - - while (pi < sourceAlt.length()) { - javaCodeMap[pi] = javaCodeMap[pi - 1] + 1; - pi++; - } - while (pj < source.length()) { - pdeCodeMap[pj] = pdeCodeMap[pj - 1] + 1; - pj++; - } - - if (Base.DEBUG) { - // debug o/p - for (int i = 0; i < pdeCodeMap.length; i++) { - if (pdeCodeMap[i] > 0 || javaCodeMap[i] > 0 || i == 0) { - if (i < source.length()) - System.out.print(source.charAt(i)); - System.out.print(pdeCodeMap[i] + " - " + javaCodeMap[i]); - if (i < sourceAlt.length()) - System.out.print(sourceAlt.charAt(i)); - System.out.print(" <-[" + i + "]"); - System.out.println(); - } - } - System.out.println(); - } - return new int[][] { javaCodeMap, pdeCodeMap }; - } - - - /** - * Highlight the ASTNode in the editor, if it's of type - * SimpleName - * @param astGenerator - * @return - true if highlighting was successful - */ - public boolean highlightNode(ASTGenerator astGenerator){ - if (!(Node instanceof SimpleName)) { - return false; - } - SimpleName nodeName = (SimpleName) Node; - try { - //TODO: Redundant code. See ASTGenerator.getJavaSourceCodeline() - int javaLineNumber = getLineNumber(nodeName); - int pdeOffs[] = astGenerator.errorCheckerService - .calculateTabIndexAndLineNumber(javaLineNumber); - PlainDocument javaSource = new PlainDocument(); - javaSource.insertString(0, astGenerator.errorCheckerService.sourceCode, null); - Element lineElement = javaSource.getDefaultRootElement() - .getElement(javaLineNumber-1); - if(lineElement == null) { - Messages.log(lineNumber + " line element null while highlighting " + nodeName); - return false; - } - - String javaLine = javaSource.getText(lineElement.getStartOffset(), - lineElement.getEndOffset() - - lineElement.getStartOffset()); - astGenerator.editor.getSketch().setCurrentCode(pdeOffs[0]); - String pdeLine = astGenerator.editor.getLineText(pdeOffs[1]); - String lookingFor = nodeName.toString(); - Messages.log(lookingFor + ", " + nodeName.getStartPosition()); - Messages.log(javaLineNumber +" JL " + javaLine + " LSO " + lineElement.getStartOffset() + "," - + lineElement.getEndOffset()); - Messages.log(pdeOffs[1] + " PL " + pdeLine); - if (!javaLine.contains(lookingFor) || !pdeLine.contains(lookingFor)) { - Messages.loge("Logical error in highLightNode(). Please file a bug report."); - return false; - } - - OffsetMatcher ofm = new OffsetMatcher(pdeLine, javaLine); - int highlightStart = ofm.getPdeOffForJavaOff(nodeName.getStartPosition() - - lineElement.getStartOffset(), - nodeName.getLength()); - if (highlightStart == -1) { - Messages.loge("Logical error in highLightNode() during offset matching. " + - "Please file a bug report."); - return false; - } - int lso = astGenerator.editor.getTextArea().getLineStartOffset(pdeOffs[1]); - highlightStart += lso; - astGenerator.editor.setSelection(highlightStart, highlightStart - + nodeName.getLength()); - /* - // First find the name in the java line, and marks its index - Pattern toFind = Pattern.compile("\\b" + nodeName.toString() + "\\b"); - Matcher matcher = toFind.matcher(javaLine); - int count = 0, index = 0; - int lsto = lineElement.getStartOffset(); - while(matcher.find()){ - count++; - //log(matcher.start() + lsto); - if(lsto + matcher.start() == nodeName.getStartPosition()) - break; - } - log("count=" + count); - index = 0; - // find the same name in the pde line by its index and get its offsets - matcher = toFind.matcher(pdeLine); - while(matcher.find()){ - count--; - if(count == 0){ - log("Found on pde line lso: " + matcher.start()); - index = matcher.end(); - break; - } - } - log("pde lso " + (index - lookingFor.length())); - - int lso = astGenerator.editor.ta.getLineStartOffset(pdeOffs[1]); - astGenerator.editor.setSelection(lso + index - lookingFor.length(), lso - + index); - */ - return true; - - } catch (BadLocationException e) { - Messages.loge("BLE in highLightNode() for " + nodeName); - e.printStackTrace(); - } - return false; - } - - /** - * Gets offset mapping between java and pde code - * int[0][x] stores the java code offset and - * int[1][x] is the corresponding offset in pde code - * @param ecs - * @return int[0] - java code offset, int[1] - pde code offset - */ - public int[][] getOffsetMapping(ErrorCheckerService ecs){ - int pdeoffsets[] = getPDECodeOffsets(ecs); - String pdeCode = ecs.getPdeCodeAtLine(pdeoffsets[0],pdeoffsets[1] - 1).trim(); - return getOffsetMapping(ecs, pdeCode); - } - - /** - * - * @param ecs - * - ErrorCheckerService instance - * @return int[0] - tab number, int[1] - line number in the int[0] tab, int[2] - * - line start offset, int[3] - offset from line start int[2] and - * int[3] are on TODO - */ - public int[] getPDECodeOffsets(ErrorCheckerService ecs) { - return ecs.JavaToPdeOffsets(lineNumber + 1, Node.getStartPosition()); - } - - public int getPDECodeOffsetForSN(ASTGenerator astGen){ - if (Node instanceof SimpleName) { - Element lineElement = astGen.getJavaSourceCodeElement(lineNumber); - Messages.log("Line element off " + lineElement.getStartOffset()); - OffsetMatcher ofm = new OffsetMatcher(astGen.getPDESourceCodeLine(lineNumber), - astGen.getJavaSourceCodeLine(lineNumber)); - //log(""); - int pdeOffset = ofm.getPdeOffForJavaOff(Node.getStartPosition() - - lineElement.getStartOffset(), Node.toString().length()); - return pdeOffset; - } - return -1; - } - - public String toString() { - return label; - } - - public ASTNode getNode() { - return Node; - } - - public String getLabel() { - return label; - } - - public int getNodeType() { - return Node.getNodeType(); - } - - public int getLineNumber() { - return lineNumber; - } - - /** - * Applies pde enhancements to code. - * TODO: Code reuse happening here. :\ - * @param source - * @return - */ - public static String getJavaCode(String source){ - Messages.log("Src:" + source); - String sourceAlt = new String(source); - - // Find all #[web color] - // Should be 6 digits only. - final String webColorRegexp = "#{1}[A-F|a-f|0-9]{6}\\W"; - Pattern webPattern = Pattern.compile(webColorRegexp); - Matcher webMatcher = webPattern.matcher(sourceAlt); - while (webMatcher.find()) { - // log("Found at: " + webMatcher.start()); - // log("-> " + found); - } - - // Find all color data types - final String colorTypeRegex = "color(?![a-zA-Z0-9_])(?=\\[*)(?!(\\s*\\())"; - Pattern colorPattern = Pattern.compile(colorTypeRegex); - Matcher colorMatcher = colorPattern.matcher(sourceAlt); - while (colorMatcher.find()) { -// System.out.print("Start index: " + colorMatcher.start()); -// log(" End index: " + colorMatcher.end() + " "); -// log("-->" + colorMatcher.group() + "<--"); - } - - // Find all int(), char() - String dataTypeFunc[] = { "int", "char", "float", "boolean", "byte" }; - - for (String dataType : dataTypeFunc) { - String dataTypeRegexp = "\\b" + dataType + "\\s*\\("; - Pattern pattern = Pattern.compile(dataTypeRegexp); - Matcher matcher = pattern.matcher(sourceAlt); - - while (matcher.find()) { -// System.out.print("Start index: " + matcher.start()); -// log(" End index: " + matcher.end() + " "); -// log("-->" + matcher.group() + "<--"); - } - matcher.reset(); - sourceAlt = matcher.replaceAll("PApplet.parse" - + Character.toUpperCase(dataType.charAt(0)) + dataType.substring(1) - + "("); - - } - // replace with 0xff[webcolor] and others - webMatcher = webPattern.matcher(sourceAlt); - while (webMatcher.find()) { - // log("Found at: " + webMatcher.start()); - String found = sourceAlt.substring(webMatcher.start(), webMatcher.end()); - // log("-> " + found); - sourceAlt = webMatcher.replaceFirst("0xff" + found.substring(1)); - webMatcher = webPattern.matcher(sourceAlt); - } - - colorMatcher = colorPattern.matcher(sourceAlt); - sourceAlt = colorMatcher.replaceAll("int"); - - Messages.log("Converted:"+sourceAlt); - return sourceAlt; - } - - private static int getLineNumber(ASTNode node) { - return ((CompilationUnit) node.getRoot()).getLineNumber(node - .getStartPosition()); - } - - /*private static int getLineNumber2(ASTNode thisNode) { - int jdocOffset = 0; Javadoc jd = null; - if(thisNode instanceof TypeDeclaration){ - jd = ((TypeDeclaration)thisNode).getJavadoc(); - log("Has t jdoc " + ((TypeDeclaration)thisNode).getJavadoc()); - } else if(thisNode instanceof MethodDeclaration){ - jd = ((MethodDeclaration)thisNode).getJavadoc(); - log("Has m jdoc " + jd); - } else if(thisNode instanceof FieldDeclaration){ - jd = ((FieldDeclaration)thisNode).getJavadoc(); - log("Has f jdoc " + ((FieldDeclaration)thisNode).getJavadoc()); - } - if(jd != null){ - jdocOffset = 1+jd.getLength(); - } - log("ln 2 = " + ((CompilationUnit) thisNode.getRoot()).getLineNumber(thisNode - .getStartPosition() + jdocOffset)); - return ((CompilationUnit) thisNode.getRoot()).getLineNumber(thisNode - .getStartPosition() + jdocOffset); - }*/ - - static private String getNodeAsString(ASTNode node) { - if (node == null) - return "NULL"; - String className = node.getClass().getName(); - int index = className.lastIndexOf("."); - if (index > 0) - className = className.substring(index + 1); - - // if(node instanceof BodyDeclaration) - // return className; - - String value = className; - - if (node instanceof TypeDeclaration) - value = ((TypeDeclaration) node).getName().toString() + " | " + className; - else if (node instanceof MethodDeclaration) - value = ((MethodDeclaration) node).getName().toString() + " | " - + className; - else if (node instanceof MethodInvocation) - value = ((MethodInvocation) node).getName().toString() + " | " - + className; - else if (node instanceof FieldDeclaration) - value = ((FieldDeclaration) node).toString() + " FldDecl| "; - else if (node instanceof SingleVariableDeclaration) - value = ((SingleVariableDeclaration) node).getName() + " - " - + ((SingleVariableDeclaration) node).getType() + " | SVD "; - else if (node instanceof ExpressionStatement) - value = node.toString() + className; - else if (node instanceof SimpleName) - value = ((SimpleName) node).getFullyQualifiedName() + " | " + className; - else if (node instanceof QualifiedName) - value = node.toString() + " | " + className; - else if (className.startsWith("Variable")) - value = node.toString() + " | " + className; - else if (className.endsWith("Type")) - value = node.toString() + " |" + className; - value += " [" + node.getStartPosition() + "," - + (node.getStartPosition() + node.getLength()) + "]"; - value += " Line: " - + ((CompilationUnit) node.getRoot()).getLineNumber(node - .getStartPosition()); - return value; - } -} \ No newline at end of file diff --git a/java/src/processing/mode/java/pdex/ASTUtils.java b/java/src/processing/mode/java/pdex/ASTUtils.java new file mode 100644 index 0000000000..0a8c03e3b3 --- /dev/null +++ b/java/src/processing/mode/java/pdex/ASTUtils.java @@ -0,0 +1,183 @@ +package processing.mode.java.pdex; + +import org.eclipse.jdt.core.dom.ASTNode; +import org.eclipse.jdt.core.dom.ASTVisitor; +import org.eclipse.jdt.core.dom.ClassInstanceCreation; +import org.eclipse.jdt.core.dom.IBinding; +import org.eclipse.jdt.core.dom.IMethodBinding; +import org.eclipse.jdt.core.dom.ITypeBinding; +import org.eclipse.jdt.core.dom.MethodDeclaration; +import org.eclipse.jdt.core.dom.Name; +import org.eclipse.jdt.core.dom.NodeFinder; +import org.eclipse.jdt.core.dom.SimpleName; +import org.eclipse.jdt.core.dom.Type; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.IntStream; + +import processing.app.Messages; + + +public class ASTUtils { + + public static ASTNode getASTNodeAt(ASTNode root, int startJavaOffset, int stopJavaOffset) { + Messages.log("* getASTNodeAt"); + + int length = stopJavaOffset - startJavaOffset; + + NodeFinder f = new NodeFinder(root, startJavaOffset, length); + ASTNode node = f.getCoveredNode(); + if (node == null) { + node = f.getCoveringNode(); + } + if (node == null) { + Messages.log("no node found"); + } else { + Messages.log("found " + node.getClass().getSimpleName()); + } + return node; + } + + + public static SimpleName getSimpleNameAt(ASTNode root, int startJavaOffset, int stopJavaOffset) { + Messages.log("* getSimpleNameAt"); + + // Find node at offset + ASTNode node = getASTNodeAt(root, startJavaOffset, stopJavaOffset); + + SimpleName result = null; + + if (node == null) { + result = null; + } else if (node.getNodeType() == ASTNode.SIMPLE_NAME) { + result = (SimpleName) node; + } else { + // Return SimpleName with highest coverage + List simpleNames = getSimpleNameChildren(node); + if (!simpleNames.isEmpty()) { + // Compute coverage + int[] coverages = simpleNames.stream() + .mapToInt(name -> { + int start = name.getStartPosition(); + int stop = start + name.getLength(); + return Math.min(stop, stopJavaOffset) - + Math.max(startJavaOffset, start); + }) + .toArray(); + // Select node with highest coverage + int maxIndex = IntStream.range(0, simpleNames.size()) + .filter(i -> coverages[i] >= 0) + .reduce((i, j) -> coverages[i] > coverages[j] ? i : j) + .orElse(-1); + if (maxIndex == -1) return null; + result = simpleNames.get(maxIndex); + } + } + + if (result == null) { + Messages.log("no simple name found"); + } else { + Messages.log("found " + node.toString()); + } + return result; + } + + + public static List getSimpleNameChildren(ASTNode node) { + List simpleNames = new ArrayList<>(); + node.accept(new ASTVisitor() { + @Override + public boolean visit(SimpleName simpleName) { + simpleNames.add(simpleName); + return super.visit(simpleName); + } + }); + return simpleNames; + } + + + public static IBinding resolveBinding(SimpleName node) { + IBinding binding = node.resolveBinding(); + if (binding == null) return null; + + // Fix constructor call/declaration being resolved as type + if (binding.getKind() == IBinding.TYPE) { + ASTNode context = node; + + // Go up until we find non Name or Type node + // stop if context is type argument (parent is also Name/Type, but unrelated) + while (isNameOrType(context) && + !context.getLocationInParent().getId().equals("typeArguments")) { + context = context.getParent(); + } + + switch (context.getNodeType()) { + case ASTNode.METHOD_DECLARATION: + MethodDeclaration decl = (MethodDeclaration) context; + if (decl.isConstructor()) { + binding = decl.resolveBinding(); + } + break; + case ASTNode.CLASS_INSTANCE_CREATION: + ClassInstanceCreation cic = (ClassInstanceCreation) context; + binding = cic.resolveConstructorBinding(); + break; + } + } + + if (binding == null) return null; + + // Normalize parametrized and raw bindings into generic bindings + switch (binding.getKind()) { + case IBinding.TYPE: + ITypeBinding type = (ITypeBinding) binding; + if (type.isParameterizedType() || type.isRawType()) { + binding = type.getErasure(); + } + break; + case IBinding.METHOD: + IMethodBinding method = (IMethodBinding) binding; + ITypeBinding declaringClass = method.getDeclaringClass(); + if (declaringClass.isParameterizedType() || + declaringClass.isRawType()) { + IMethodBinding[] methods = declaringClass.getErasure().getDeclaredMethods(); + IMethodBinding generic = Arrays.stream(methods) + .filter(method::overrides) + .findAny().orElse(null); + if (generic != null) method = generic; + } + if (method.isParameterizedMethod() || method.isRawMethod()) { + method = method.getMethodDeclaration(); + } + binding = method; + break; + } + + return binding; + } + + + public static boolean isNameOrType(ASTNode node) { + return node instanceof Name || node instanceof Type; + } + + + protected static List findAllOccurrences(ASTNode root, String bindingKey) { + List occurences = new ArrayList<>(); + root.getRoot().accept(new ASTVisitor() { + @Override + public boolean visit(SimpleName name) { + IBinding binding = resolveBinding(name); + if (binding != null && bindingKey.equals(binding.getKey())) { + occurences.add(name); + } + return super.visit(name); + } + }); + + return occurences; + } + +} diff --git a/java/src/processing/mode/java/pdex/CompilationChecker.java b/java/src/processing/mode/java/pdex/CompilationChecker.java deleted file mode 100644 index 7c97dfa315..0000000000 --- a/java/src/processing/mode/java/pdex/CompilationChecker.java +++ /dev/null @@ -1,501 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -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. -*/ - -package processing.mode.java.pdex; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.StringTokenizer; - -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.compiler.CharOperation; -import org.eclipse.jdt.core.compiler.IProblem; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTParser; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.PackageDeclaration; -import org.eclipse.jdt.core.dom.TypeDeclaration; -import org.eclipse.jdt.internal.compiler.ClassFile; -import org.eclipse.jdt.internal.compiler.CompilationResult; -import org.eclipse.jdt.internal.compiler.Compiler; -import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies; -import org.eclipse.jdt.internal.compiler.ICompilerRequestor; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException; -import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; -import org.eclipse.jdt.internal.compiler.env.INameEnvironment; -import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer; -import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; -import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; -import org.eclipse.jface.text.Document; - - -/** - * Provides compilation checking functionality - * @author Manindra Moharana <me@mkmoharana.com> - */ -public class CompilationChecker { - - private class CompilationUnitImpl implements ICompilationUnit { - private CompilationUnit unit; - - CompilationUnitImpl(CompilationUnit unit) { - this.unit = unit; - } - - public char[] getContents() { - char[] contents = null; - try { - Document doc = new Document(); - doc.set(sourceText); - // TextEdit edits = unit.rewrite(doc, null); - // edits.apply(doc); - String sourceCode = doc.get(); - if (sourceCode != null) - contents = sourceCode.toCharArray(); - } catch (Exception e) { - throw new RuntimeException(e); - } - return contents; - } - - public char[] getMainTypeName() { - TypeDeclaration classType = (TypeDeclaration) unit.types().get(0); - return classType.getName().getFullyQualifiedName().toCharArray(); - } - - public char[][] getPackageName() { - String[] names = getSimpleNames(this.unit.getPackage().getName() - .getFullyQualifiedName()); - char[][] packages = new char[names.length][]; - for (int i = 0; i < names.length; ++i) - packages[i] = names[i].toCharArray(); - - return packages; - } - - public char[] getFileName() { - TypeDeclaration classType = (TypeDeclaration) unit.types().get(0); - String name = classType.getName().getFullyQualifiedName() + ".java"; - return name.toCharArray(); - } - - @Override - public boolean ignoreOptionalProblems() { - return false; - } - } - - /** - * ICompilerRequestor implementation - */ - private class CompileRequestorImpl implements ICompilerRequestor { - - private List problems; - - private List classes; - - public CompileRequestorImpl() { - this.problems = new ArrayList(); - this.classes = new ArrayList(); - } - - public void acceptResult(CompilationResult result) { - boolean errors = false; - if (result.hasProblems()) { - IProblem[] problems = result.getProblems(); - for (int i = 0; i < problems.length; i++) { - if (problems[i].isError()) - errors = true; - - this.problems.add(problems[i]); - } - } - if (!errors) { - ClassFile[] classFiles = result.getClassFiles(); - for (int i = 0; i < classFiles.length; i++) - this.classes.add(classFiles[i]); - } - } - - List getProblems() { - return this.problems; - } - -// List getResults() { -// //System.out.println("Calling get results"); -// return this.classes; -// } - } - - /** - * INameEnvironment implementation - */ - private class NameEnvironmentImpl implements INameEnvironment { - - private ICompilationUnit unit; - - private String fullName; - - NameEnvironmentImpl(ICompilationUnit unit) { - this.unit = unit; - this.fullName = CharOperation.toString(this.unit.getPackageName()) + "." - + new String(this.unit.getMainTypeName()); - } - - public NameEnvironmentAnswer findType(char[][] compoundTypeName) { - return findType(CharOperation.toString(compoundTypeName)); - } - - public NameEnvironmentAnswer findType(char[] typeName, char[][] packageName) { - String fullName = CharOperation.toString(packageName); - if (typeName != null) { - if (fullName.length() > 0) - fullName += "."; - - fullName += new String(typeName); - } - return findType(fullName); - } - - public boolean isPackage(char[][] parentPackageName, char[] packageName) { - String fullName = CharOperation.toString(parentPackageName); - if (packageName != null) { - if (fullName.length() > 0) - fullName += "."; - - fullName += new String(packageName); - } - if (findType(fullName) != null) - return false; - - try { - return (getClassLoader().loadClass(fullName) == null); - } catch (ClassNotFoundException e) { - return true; - } - } - - public void cleanup() { - } - - private NameEnvironmentAnswer findType(String fullName) { - - if (this.fullName.equals(fullName)) - return new NameEnvironmentAnswer(unit, null); - - try { - InputStream is = getClassLoader().getResourceAsStream(fullName - .replace('.', - '/') - + ".class"); - if (is != null) { - // System.out.println("Find type: " + fullName); - byte[] buffer = new byte[8192]; - int bytes = 0; - ByteArrayOutputStream os = new ByteArrayOutputStream(buffer.length); - while ((bytes = is.read(buffer, 0, buffer.length)) > 0) - os.write(buffer, 0, bytes); - - os.flush(); - ClassFileReader classFileReader = new ClassFileReader( - os.toByteArray(), - fullName - .toCharArray(), - true); - return new NameEnvironmentAnswer(classFileReader, null); - } - return null; - } catch (IOException e) { - throw new RuntimeException(e); - } catch (ClassFormatException e) { - throw new RuntimeException(e); - } - } - } - - private URLClassLoader urlClassLoader; - - private ClassLoader getClassLoader() { - if (urlClassLoader != null) { - return urlClassLoader; - } else { - return getClass().getClassLoader(); - } - } - - private void prepareClassLoader(ArrayList jarList) { - URL urls[] = new URL[jarList.size()]; - for (int i = 0; i < urls.length; i++) { - try { - urls[i] = jarList.get(i).toURI().toURL(); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - } - urlClassLoader = new URLClassLoader(urls); - //System.out.println("URL Classloader ready"); - } - - /** - * ClassLoader implementation - */ - /* - private class CustomClassLoader extends ClassLoader { - - private Map classMap; - - CustomClassLoader(ClassLoader parent, List classesList) { - this.classMap = new HashMap(); - for (int i = 0; i < classesList.size(); i++) { - ClassFile classFile = (ClassFile) classesList.get(i); - String className = CharOperation.toString(classFile.getCompoundName()); - this.classMap.put(className, classFile.getBytes()); - } - } - - public Class findClass(String name) throws ClassNotFoundException { - byte[] bytes = (byte[]) this.classMap.get(name); - if (bytes != null) - return defineClass(name, bytes, 0, bytes.length); - - return super.findClass(name); - } - }; - */ - - @SuppressWarnings("unchecked") - private ICompilationUnit generateCompilationUnit() { - ASTParser parser = ASTParser.newParser(AST.JLS8); - try { - parser.setSource("".toCharArray()); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - Map options = JavaCore.getOptions(); - - JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options); - parser.setCompilerOptions(options); - CompilationUnit unit = (CompilationUnit) parser.createAST(null); - unit.recordModifications(); - - AST ast = unit.getAST(); - - // Package statement - // package astexplorer; - - PackageDeclaration packageDeclaration = ast.newPackageDeclaration(); - unit.setPackage(packageDeclaration); - // unit.se - packageDeclaration.setName(ast.newSimpleName(fileName)); - // System.out.println("Filename: " + fileName); - // class declaration - // public class SampleComposite extends Composite { - - TypeDeclaration classType = ast.newTypeDeclaration(); - classType.setInterface(false); - // classType.s - classType.setName(ast.newSimpleName(fileName)); - unit.types().add(classType); - // classType.setSuperclass(ast.newSimpleName("Composite")); - return new CompilationUnitImpl(unit); - } - - static private String fileName = null; //"HelloPeasy"; - - - - private void compileMeQuitely(ICompilationUnit unit, Map compilerSettings) { - - Map settings; - if (compilerSettings == null) { - settings = new HashMap<>(); - - settings.put(CompilerOptions.OPTION_LineNumberAttribute, - CompilerOptions.GENERATE); - settings.put(CompilerOptions.OPTION_SourceFileAttribute, - CompilerOptions.GENERATE); - settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6); - settings.put(CompilerOptions.OPTION_SuppressWarnings, - CompilerOptions.DISABLED); - // settings.put(CompilerOptions.OPTION_ReportUnusedImport, - // CompilerOptions.IGNORE); - // settings.put(CompilerOptions.OPTION_ReportMissingSerialVersion, - // CompilerOptions.IGNORE); - // settings.put(CompilerOptions.OPTION_ReportRawTypeReference, - // CompilerOptions.IGNORE); - // settings.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, - // CompilerOptions.IGNORE); - } else { - settings = compilerSettings; - } - -// CompilerOptions cop = new CompilerOptions(); -// cop.set(settings); - CompileRequestorImpl requestor = new CompileRequestorImpl(); - Compiler compiler = new Compiler(new NameEnvironmentImpl(unit), - DefaultErrorHandlingPolicies - .proceedWithAllProblems(), - new CompilerOptions(settings), requestor, - new DefaultProblemFactory(Locale - .getDefault())); - compiler.compile(new ICompilationUnit[] { unit }); - - List problems = requestor.getProblems(); - prob = new IProblem[problems.size()]; - int count = 0; - for (Iterator it = problems.iterator(); it.hasNext();) { - IProblem problem = it.next(); - prob[count++] = problem; - } - } - - private void compileMeQuitely(ICompilationUnit unit) { - compileMeQuitely(unit, null); - } - - static private String[] getSimpleNames(String qualifiedName) { - StringTokenizer st = new StringTokenizer(qualifiedName, "."); - ArrayList list = new ArrayList(); - while (st.hasMoreTokens()) { - String name = st.nextToken().trim(); - if (!name.equals("*")) - list.add(name); - } - return list.toArray(new String[0]); - } - - public static void main(String[] args) { - ArrayList fl = new ArrayList(); - fl.add(new File( - "/home/quarkninja/Workspaces/processing_workspace/processing/core/library/core.jar")); - CompilationChecker cc = new CompilationChecker(fl); - cc.getErrors("Brightness"); - cc.display(); - } - - public void display() { - boolean error = false; - int errorCount = 0, warningCount = 0, count = 0; - for (int i = 0; i < prob.length; i++) { - IProblem problem = prob[i]; - if (problem == null) - continue; - StringBuilder sb = new StringBuilder(); - sb.append(problem.getMessage()); - sb.append(" | line: "); - sb.append(problem.getSourceLineNumber()); - String msg = sb.toString(); - if (problem.isError()) { - error = true; - msg = "Error: " + msg; - errorCount++; - } else if (problem.isWarning()) { - msg = "Warning: " + msg; - warningCount++; - } - System.out.println(msg); - prob[count++] = problem; - } - - if (!error) { - System.out.println("===================================="); - System.out.println(" Compiled without any errors. "); - System.out.println("===================================="); - } else { - System.out.println("===================================="); - System.out.println(" Compilation failed. You erred man! "); - System.out.println("===================================="); - - } - System.out.print("Total warnings: " + warningCount); - System.out.println(", Total errors: " + errorCount); - } - - IProblem[] prob; - - public IProblem[] getErrors(String name) { - fileName = name; - compileMeQuitely(generateCompilationUnit()); - // System.out.println("getErrors()"); - - return prob; - } - - /** - * Performs compiler error check. - * @param sourceName - name of the class - * @param source - source code - * @param settings - compiler options - * @param classLoader - custom classloader which can load all dependencies - * @return IProblem[] - list of compiler errors and warnings - */ - public IProblem[] getErrors(String sourceName, String source, Map settings, - URLClassLoader classLoader) { - fileName = sourceName; - sourceText = "package " + fileName + ";\n" + source; - if (classLoader != null) - this.urlClassLoader = classLoader; - compileMeQuitely(generateCompilationUnit(), settings); - // System.out.println("getErrors(), Done."); - - return prob; - } - - String sourceText = null; //""; - - - public IProblem[] getErrors(String sourceName, String source) { - return getErrors(sourceName, source, null); - } - - - public IProblem[] getErrors(String sourceName, String source, Map settings) { - fileName = sourceName; - sourceText = "package " + fileName + ";\n" + source; - - compileMeQuitely(generateCompilationUnit(), settings); - // System.out.println("getErrors(), Done."); - return prob; - } - - - public CompilationChecker() { - // System.out.println("Compilation Checker initialized."); - } - - - public CompilationChecker(ArrayList fileList) { - prepareClassLoader(fileList); - // System.out.println("Compilation Checker initialized."); - } -} diff --git a/java/src/processing/mode/java/pdex/CompletionCandidate.java b/java/src/processing/mode/java/pdex/CompletionCandidate.java index 2a9d9f9361..1b7533e822 100644 --- a/java/src/processing/mode/java/pdex/CompletionCandidate.java +++ b/java/src/processing/mode/java/pdex/CompletionCandidate.java @@ -2,7 +2,7 @@ /* Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation +Copyright (c) 2012-18 The Processing Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 @@ -32,12 +32,18 @@ import org.eclipse.jdt.core.dom.VariableDeclarationFragment; -public class CompletionCandidate implements Comparable{ - private String elementName; - private String label; // the toString value - private String completionString; - private Object wrappedObject; - private int type; +// TODO when building the label in some variants in this file, +// getReturnType2() is used instead of getReturnType(). +// need to check whether that's identical in how it performs, +// and if so, use makeLabel() and makeCompletion() more [fry 180326] +// https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjdt%2Fcore%2Fdom%2FMethodDeclaration.html + +public class CompletionCandidate implements Comparable { + private final String elementName; + private final String label; // the toString value + private final String completion; + private final Object wrappedObject; + private final int type; static final int PREDEF_CLASS = 0; static final int PREDEF_FIELD = 1; @@ -48,60 +54,38 @@ public class CompletionCandidate implements Comparable{ static final int LOCAL_VAR = 6; - public CompletionCandidate(Method method) { + CompletionCandidate(Method method) { + // return value ignored? [fry 180326] method.getDeclaringClass().getName(); elementName = method.getName(); - StringBuilder label = new StringBuilder(""+method.getName() + "("); - StringBuilder cstr = new StringBuilder(method.getName() + "("); - for (int i = 0; i < method.getParameterTypes().length; i++) { - label.append(method.getParameterTypes()[i].getSimpleName()); - if (i < method.getParameterTypes().length - 1) { - label.append(","); - cstr.append(","); - } - } - if(method.getParameterTypes().length == 1) { - cstr.append(' '); - } - label.append(")"); - if(method.getReturnType() != null) - label.append(" : " + method.getReturnType().getSimpleName()); - label.append(" - " + method.getDeclaringClass().getSimpleName() + ""); - cstr.append(")"); - this.label = label.toString(); - this.completionString = cstr.toString(); + label = makeLabel(method); + completion = makeCompletion(method); type = PREDEF_METHOD; wrappedObject = method; } - public Object getWrappedObject() { - return wrappedObject; - } - public CompletionCandidate(SingleVariableDeclaration svd) { - completionString = svd.getName().toString(); + CompletionCandidate(SingleVariableDeclaration svd) { + completion = svd.getName().toString(); elementName = svd.getName().toString(); - if(svd.getParent() instanceof FieldDeclaration) - type = LOCAL_FIELD; - else - type = LOCAL_VAR; + type = (svd.getParent() instanceof FieldDeclaration) ? + LOCAL_FIELD : LOCAL_VAR; label = svd.getName() + " : " + svd.getType(); wrappedObject = svd; } - public CompletionCandidate(VariableDeclarationFragment vdf) { - completionString = vdf.getName().toString(); + + CompletionCandidate(VariableDeclarationFragment vdf) { + completion = vdf.getName().toString(); elementName = vdf.getName().toString(); - if(vdf.getParent() instanceof FieldDeclaration) - type = LOCAL_FIELD; - else - type = LOCAL_VAR; - label = vdf.getName() + " : " + ASTGenerator.extracTypeInfo2(vdf); + type = (vdf.getParent() instanceof FieldDeclaration) ? + LOCAL_FIELD : LOCAL_VAR; + label = vdf.getName() + " : " + CompletionGenerator.extracTypeInfo2(vdf); wrappedObject = vdf; } - public CompletionCandidate(MethodDeclaration method) { - // log("ComCan " + method.getName()); + + CompletionCandidate(MethodDeclaration method) { elementName = method.getName().toString(); type = LOCAL_METHOD; @@ -109,183 +93,288 @@ public CompletionCandidate(MethodDeclaration method) { List params = (List) method.getStructuralProperty(MethodDeclaration.PARAMETERS_PROPERTY); - StringBuilder label = new StringBuilder(elementName + "("); - StringBuilder cstr = new StringBuilder(method.getName() + "("); - for (int i = 0; i < params.size(); i++) { - label.append(params.get(i).toString()); - if (i < params.size() - 1) { - label.append(","); - cstr.append(","); + { // label + StringBuilder labelBuilder = new StringBuilder(elementName); + labelBuilder.append('('); + for (int i = 0; i < params.size(); i++) { + labelBuilder.append(params.get(i).toString()); + if (i < params.size() - 1) { + labelBuilder.append(','); + } + } + labelBuilder.append(')'); + if (method.getReturnType2() != null) { + labelBuilder.append(" : "); + labelBuilder.append(method.getReturnType2()); } + label = labelBuilder.toString(); } - if (params.size() == 1) { - cstr.append(' '); + + { // completion + StringBuilder compBuilder = new StringBuilder(elementName); + compBuilder.append('('); + + for (int i = 0; i < params.size(); i++) { + if (i < params.size() - 1) { + compBuilder.append(','); + } + } + if (params.size() == 1) { + compBuilder.append(' '); + } + compBuilder.append(')'); + completion = compBuilder.toString(); } - label.append(")"); - if (method.getReturnType2() != null) - label.append(" : " + method.getReturnType2()); - cstr.append(")"); - this.label = label.toString(); - this.completionString = cstr.toString(); + wrappedObject = method; } - public CompletionCandidate(TypeDeclaration td){ + + CompletionCandidate(TypeDeclaration td) { type = LOCAL_CLASS; elementName = td.getName().toString(); label = elementName; - completionString = elementName; + completion = elementName; wrappedObject = td; } - public CompletionCandidate(Field f) { + + CompletionCandidate(Field f) { f.getDeclaringClass().getName(); elementName = f.getName(); type = PREDEF_FIELD; -// "" -// + matchedClass + " : " + "" -// + matchedClass2.substring(0, d) + "", matchedClass -// + "" - label = "" + f.getName() + " : " + f.getType().getSimpleName() + - " - " + f.getDeclaringClass().getSimpleName() + - ""; - completionString = elementName; + label = "" + + f.getName() + " : " + + f.getType().getSimpleName() + " - " + + "" + + f.getDeclaringClass().getSimpleName() + + ""; + completion = elementName; wrappedObject = f; } - public CompletionCandidate(String name, String labelStr, String completionStr, int type) { - elementName = name; - label = labelStr; - completionString = completionStr; - this.type = type; + + CompletionCandidate(String elementName, String label, + String completion, int type) { + this(elementName, label, completion, type, null); } - public CompletionCandidate(String name, int type) { - elementName = name; - label = name; - completionString = name; + + private CompletionCandidate(String elementName, String label, + String completion, int type, + Object wrappedObject) { + this.elementName = elementName; + this.label = label; + this.completion = completion; this.type = type; + this.wrappedObject = wrappedObject; } + + Object getWrappedObject() { + return wrappedObject; + } + + public String getElementName() { return elementName; } + public String getCompletionString() { - return completionString; + return completion; } - public String toString() { - return label; - } public int getType() { return type; } + public String getLabel() { return label; } - public String getNoHtmlLabel(){ - if(!label.contains("")) { + + // TODO this is gross [fry 180326] + /* + private String getNoHtmlLabel(){ + if (!label.contains("")) { return label; - } - else { + + } else { StringBuilder ans = new StringBuilder(label); - while(ans.indexOf("<") > -1) { + while (ans.indexOf("<") > -1) { int a = ans.indexOf("<"), b = ans.indexOf(">"); - if(a > b) break; + if (a > b) break; ans.replace(a, b+1, ""); -// System.out.println(ans.replace(a, b+1, "")); -// System.out.println(ans + "--"); } return ans.toString(); } } + */ - public void setLabel(String label) { - this.label = label; - } - public void setCompletionString(String completionString) { - this.completionString = completionString; + boolean startsWith(String newWord) { +// System.out.println("checking " + newWord); +// return getNoHtmlLabel().toLowerCase().startsWith(newWord); + // this seems to be elementName in all cases [fry 180326] + return elementName.startsWith(newWord); } - public int compareTo(CompletionCandidate cc) { - if(type != cc.getType()){ - return cc.getType() - type; - } - return (elementName.compareTo(cc.getElementName())); + + CompletionCandidate withLabelAndCompString(String withLabel, + String withCompletion) { + return new CompletionCandidate(elementName, + withLabel, withCompletion, + type, wrappedObject); } - public void regenerateCompletionString(){ + + CompletionCandidate withRegeneratedCompString() { if (wrappedObject instanceof MethodDeclaration) { MethodDeclaration method = (MethodDeclaration)wrappedObject; @SuppressWarnings("unchecked") List params = (List) - method.getStructuralProperty(MethodDeclaration.PARAMETERS_PROPERTY); + method.getStructuralProperty(MethodDeclaration.PARAMETERS_PROPERTY); + + // build the html label + StringBuilder labelBuilder = new StringBuilder(elementName); + labelBuilder.append('('); + for (int i = 0; i < params.size(); i++) { + labelBuilder.append(params.get(i)); + if (i < params.size() - 1) { + labelBuilder.append(','); + } + } + labelBuilder.append(')'); + if (method.getReturnType2() != null) { + labelBuilder.append(" : "); + labelBuilder.append(method.getReturnType2()); + } - StringBuilder label = new StringBuilder(elementName + "("); - StringBuilder cstr = new StringBuilder(method.getName() + "("); + // build the completion str + StringBuilder compBuilder = new StringBuilder(); + compBuilder.append(method.getName()); + compBuilder.append('('); for (int i = 0; i < params.size(); i++) { - label.append(params.get(i).toString()); if (i < params.size() - 1) { - label.append(","); - cstr.append(","); + compBuilder.append(','); } } if (params.size() == 1) { - cstr.append(' '); + compBuilder.append(' '); } - label.append(")"); - if (method.getReturnType2() != null) - label.append(" : " + method.getReturnType2()); - cstr.append(")"); - this.label = label.toString(); - this.completionString = cstr.toString(); + compBuilder.append(')'); + + return withLabelAndCompString(labelBuilder.toString(), compBuilder.toString()); + + } else if (wrappedObject instanceof Method) { + Method method = (Method) wrappedObject; + Class[] types = method.getParameterTypes(); + + // build html label + StringBuilder labelBuilder = new StringBuilder(); + labelBuilder.append(""); + labelBuilder.append(method.getName()); + labelBuilder.append('('); + + for (int i = 0; i < types.length; i++) { + labelBuilder.append(types[i].getSimpleName()); + if (i < types.length - 1) { + labelBuilder.append(','); + } + } + labelBuilder.append(')'); + if (method.getReturnType() != null) { + labelBuilder.append(" : " + method.getReturnType().getSimpleName()); + } + + labelBuilder.append(" - "); + labelBuilder.append(method.getDeclaringClass().getSimpleName()); + labelBuilder.append(""); + labelBuilder.append(""); + + // make completion string + StringBuilder compBuilder = new StringBuilder(method.getName()); + compBuilder.append('('); + for (int i = 0; i < types.length; i++) { + if (i < types.length - 1) { + compBuilder.append(','); + } + } + if (types.length == 1) { + compBuilder.append(' '); + } + compBuilder.append(')'); + + return withLabelAndCompString(labelBuilder.toString(), compBuilder.toString()); } - else if (wrappedObject instanceof Method) { - Method method = (Method)wrappedObject; - StringBuilder label = new StringBuilder("" + method.getName() + "("); - StringBuilder cstr = new StringBuilder(method.getName() + "("); - for (int i = 0; i < method.getParameterTypes().length; i++) { - label.append(method.getParameterTypes()[i].getSimpleName()); - if (i < method.getParameterTypes().length - 1) { - label.append(","); - cstr.append(","); - } - } - if(method.getParameterTypes().length == 1) { - cstr.append(' '); - } - label.append(")"); - if(method.getReturnType() != null) - label.append(" : " + method.getReturnType().getSimpleName()); - label.append(" - " + method.getDeclaringClass().getSimpleName() + ""); - cstr.append(")"); - this.label = label.toString(); - this.completionString = cstr.toString(); - /* - * StringBuilder label = new StringBuilder(""+method.getName() + "("); - StringBuilder cstr = new StringBuilder(method.getName() + "("); - for (int i = 0; i < method.getParameterTypes().length; i++) { - label.append(method.getParameterTypes()[i].getSimpleName()); - if (i < method.getParameterTypes().length - 1) { - label.append(","); - cstr.append(","); + + // fall-through silently does nothing? [fry 180326] + return this; + } + + + static private String makeLabel(Method method) { + Class[] types = method.getParameterTypes(); + + StringBuilder labelBuilder = new StringBuilder(); + labelBuilder.append(""); + labelBuilder.append(method.getName()); + labelBuilder.append('('); + + for (int i = 0; i < types.length; i++) { + labelBuilder.append(types[i].getSimpleName()); + if (i < types.length - 1) { + labelBuilder.append(','); + } + } + labelBuilder.append(")"); + if (method.getReturnType() != null) { + labelBuilder.append(" : "); + labelBuilder.append(method.getReturnType().getSimpleName()); + } + labelBuilder.append(" - "); + labelBuilder.append(method.getDeclaringClass().getSimpleName()); + labelBuilder.append(""); + labelBuilder.append(""); + + return labelBuilder.toString(); + } + + + static private String makeCompletion(Method method) { + Class[] types = method.getParameterTypes(); + + StringBuilder compBuilder = new StringBuilder(); + compBuilder.append(method.getName()); + compBuilder.append('('); + + for (int i = 0; i < types.length; i++) { + if (i < types.length - 1) { + compBuilder.append(','); // wtf? [fry 180326] } } - if(method.getParameterTypes().length == 1) { - cstr.append(' '); + if (types.length == 1) { + compBuilder.append(' '); } - label.append(")"); - if(method.getReturnType() != null) - label.append(" : " + method.getReturnType().getSimpleName()); - label.append(" - " + method.getDeclaringClass().getSimpleName() + ""); - * */ - } + compBuilder.append(')'); + return compBuilder.toString(); } + + @Override + public int compareTo(CompletionCandidate cc) { + if (type != cc.getType()) { + return cc.getType() - type; + } + return elementName.compareTo(cc.getElementName()); + } + + + public String toString() { + return label; + } } diff --git a/java/src/processing/mode/java/pdex/CompletionGenerator.java b/java/src/processing/mode/java/pdex/CompletionGenerator.java new file mode 100644 index 0000000000..67ad944196 --- /dev/null +++ b/java/src/processing/mode/java/pdex/CompletionGenerator.java @@ -0,0 +1,2086 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* +Part of the Processing project - http://processing.org +Copyright (c) 2012-15 The Processing Foundation + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +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. +*/ + +package processing.mode.java.pdex; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.regex.Pattern; +import java.util.stream.Stream; + +import javax.swing.DefaultListModel; + +import org.eclipse.jdt.core.dom.AST; +import org.eclipse.jdt.core.dom.ASTNode; +import org.eclipse.jdt.core.dom.ASTParser; +import org.eclipse.jdt.core.dom.ArrayAccess; +import org.eclipse.jdt.core.dom.ArrayType; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.CompilationUnit; +import org.eclipse.jdt.core.dom.Expression; +import org.eclipse.jdt.core.dom.ExpressionStatement; +import org.eclipse.jdt.core.dom.FieldAccess; +import org.eclipse.jdt.core.dom.FieldDeclaration; +import org.eclipse.jdt.core.dom.MethodDeclaration; +import org.eclipse.jdt.core.dom.MethodInvocation; +import org.eclipse.jdt.core.dom.Name; +import org.eclipse.jdt.core.dom.ParameterizedType; +import org.eclipse.jdt.core.dom.PrimitiveType; +import org.eclipse.jdt.core.dom.QualifiedName; +import org.eclipse.jdt.core.dom.SimpleName; +import org.eclipse.jdt.core.dom.SimpleType; +import org.eclipse.jdt.core.dom.SingleVariableDeclaration; +import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; +import org.eclipse.jdt.core.dom.Type; +import org.eclipse.jdt.core.dom.TypeDeclaration; +import org.eclipse.jdt.core.dom.VariableDeclarationExpression; +import org.eclipse.jdt.core.dom.VariableDeclarationFragment; +import org.eclipse.jdt.core.dom.VariableDeclarationStatement; + +import processing.app.Messages; +import processing.mode.java.JavaMode; + +import com.google.classpath.ClassPath; +import com.google.classpath.RegExpResourceFilter; + +@SuppressWarnings({ "unchecked" }) +public class CompletionGenerator { + + public CompletionGenerator() { + //addCompletionPopupListner(); + //loadJavaDoc(); + } + + + public static CompletionCandidate[] checkForTypes(ASTNode node) { + + List vdfs = null; + switch (node.getNodeType()) { + case ASTNode.TYPE_DECLARATION: + return new CompletionCandidate[]{new CompletionCandidate((TypeDeclaration) node)}; + + case ASTNode.METHOD_DECLARATION: + MethodDeclaration md = (MethodDeclaration) node; + log(getNodeAsString(md)); + List params = (List) md + .getStructuralProperty(MethodDeclaration.PARAMETERS_PROPERTY); + CompletionCandidate[] cand = new CompletionCandidate[params.size() + 1]; + cand[0] = new CompletionCandidate(md); + for (int i = 0; i < params.size(); i++) { +// cand[i + 1] = new CompletionCandidate(params.get(i).toString(), "", "", +// CompletionCandidate.LOCAL_VAR); + cand[i + 1] = new CompletionCandidate((SingleVariableDeclaration) params.get(i)); + } + return cand; + + case ASTNode.SINGLE_VARIABLE_DECLARATION: + return new CompletionCandidate[]{new CompletionCandidate((SingleVariableDeclaration) node)}; + + case ASTNode.FIELD_DECLARATION: + vdfs = ((FieldDeclaration) node).fragments(); + break; + case ASTNode.VARIABLE_DECLARATION_STATEMENT: + vdfs = ((VariableDeclarationStatement) node).fragments(); + break; + case ASTNode.VARIABLE_DECLARATION_EXPRESSION: + vdfs = ((VariableDeclarationExpression) node).fragments(); + break; + default: + break; + } + + if (vdfs != null) { + CompletionCandidate ret[] = new CompletionCandidate[vdfs.size()]; + int i = 0; + for (VariableDeclarationFragment vdf : vdfs) { +// ret[i++] = new CompletionCandidate(getNodeAsString2(vdf), "", "", +// CompletionCandidate.LOCAL_VAR); + ret[i++] = new CompletionCandidate(vdf); + } + return ret; + } + + return null; + } + + /** + * Find the parent of the expression in a().b, this would give me the return + * type of a(), so that we can find all children of a() begininng with b + * + * @param nearestNode + * @param expression + * @return + */ + public static ASTNode resolveExpression(ASTNode nearestNode, + ASTNode expression, boolean noCompare) { + log("Resolving " + getNodeAsString(expression) + " noComp " + + noCompare); + if (expression instanceof SimpleName) { + return findDeclaration2(((SimpleName) expression), nearestNode); + } else if (expression instanceof MethodInvocation) { + log("3. Method Invo " + + ((MethodInvocation) expression).getName()); + return findDeclaration2(((MethodInvocation) expression).getName(), + nearestNode); + } else if (expression instanceof FieldAccess) { + log("2. Field access " + + getNodeAsString(((FieldAccess) expression).getExpression()) + "|||" + + getNodeAsString(((FieldAccess) expression).getName())); + if (noCompare) { + /* + * ASTNode ret = findDeclaration2(((FieldAccess) expression).getName(), + * nearestNode); log("Found as ->"+getNodeAsString(ret)); + * return ret; + */ + return findDeclaration2(((FieldAccess) expression).getName(), + nearestNode); + } else { + + /* + * Note how for the next recursion, noCompare is reversed. Let's say + * I've typed getABC().quark.nin where nin is incomplete(ninja being the + * field), when execution first enters here, it calls resolveExpr again + * for "getABC().quark" where we know that quark field must be complete, + * so we toggle noCompare. And kaboom. + */ + return resolveExpression(nearestNode, + ((FieldAccess) expression).getExpression(), + true); + } + //return findDeclaration2(((FieldAccess) expression).getExpression(), nearestNode); + } else if (expression instanceof QualifiedName) { + log("1. Resolving " + + ((QualifiedName) expression).getQualifier() + " ||| " + + ((QualifiedName) expression).getName()); + if (noCompare) { // no compare, as in "abc.hello." need to resolve hello here + return findDeclaration2(((QualifiedName) expression).getName(), + nearestNode); + } else { + //User typed "abc.hello.by" (bye being complete), so need to resolve "abc.hello." only + return findDeclaration2(((QualifiedName) expression).getQualifier(), + nearestNode); + } + } + + return null; + } + + /** + * Finds the type of the expression in foo.bar().a().b, this would give me the + * type of b if it exists in return type of a(). If noCompare is true, + * it'll return type of a() + * @param nearestNode + * @param astNode + * @return + */ + public static ClassMember resolveExpression3rdParty(PreprocessedSketch ps, ASTNode nearestNode, + ASTNode astNode, boolean noCompare) { + log("Resolve 3rdParty expr-- " + getNodeAsString(astNode) + + " nearest node " + getNodeAsString(nearestNode)); + if(astNode == null) return null; + ClassMember scopeParent; + SimpleType stp; + if(astNode instanceof SimpleName){ + ASTNode decl = findDeclaration2(((SimpleName)astNode),nearestNode); + if(decl != null){ + // see if locally defined + log(getNodeAsString(astNode)+" found decl -> " + getNodeAsString(decl)); + + { + if (decl.getNodeType() == ASTNode.TYPE_DECLARATION) { + TypeDeclaration td = (TypeDeclaration) decl; + return new ClassMember(ps, td); + } + } + + { // Handle "array." x "array[1]." + Type type = extracTypeInfo2(decl); + if (type != null && type.isArrayType() && + astNode.getParent().getNodeType() != ASTNode.ARRAY_ACCESS) { + // No array access, we want members of the array itself + Type elementType = ((ArrayType) type).getElementType(); + + // Get name of the element class + String name = ""; + if (elementType.isSimpleType()) { + Class c = findClassIfExists(ps, elementType.toString()); + if (c != null) name = c.getName(); + } else if (elementType.isPrimitiveType()) { + name = ((PrimitiveType) elementType).getPrimitiveTypeCode().toString(); + } + + // Convert element class to array class + Class arrayClass = getArrayClass(name, ps.classLoader); + + return arrayClass == null ? null : new ClassMember(arrayClass); + } + } + + return new ClassMember(ps, extracTypeInfo(decl)); + } + else { + // or in a predefined class? + Class tehClass = findClassIfExists(ps, astNode.toString()); + if (tehClass != null) { + return new ClassMember(tehClass); + } + } + astNode = astNode.getParent(); + } + switch (astNode.getNodeType()) { + //TODO: Notice the redundancy in the 3 cases, you can simplify things even more. + case ASTNode.FIELD_ACCESS: + FieldAccess fa = (FieldAccess) astNode; + if (fa.getExpression() == null) { + + // TODO: Check for existence of 'new' keyword. Could be a ClassInstanceCreation + + // Local code or belongs to super class + log("FA,Not implemented."); + return null; + } else { + if (fa.getExpression() instanceof SimpleName) { + stp = extracTypeInfo(findDeclaration2((SimpleName) fa.getExpression(), + nearestNode)); + if(stp == null){ + /*The type wasn't found in local code, so it might be something like + * log(), or maybe belonging to super class, etc. + */ + Class tehClass = findClassIfExists(ps, fa.getExpression().toString()); + if (tehClass != null) { + // Method Expression is a simple name and wasn't located locally, but found in a class + // so look for method in this class. + return definedIn3rdPartyClass(ps, new ClassMember(tehClass), fa + .getName().toString()); + } + log("FA resolve 3rd par, Can't resolve " + fa.getExpression()); + + return null; + } + log("FA, SN Type " + getNodeAsString(stp)); + scopeParent = definedIn3rdPartyClass(ps, stp.getName().toString(), "THIS"); + + } else { + scopeParent = resolveExpression3rdParty(ps, nearestNode, + fa.getExpression(), noCompare); + } + log("FA, ScopeParent " + scopeParent); + return definedIn3rdPartyClass(ps, scopeParent, fa.getName().toString()); + } + case ASTNode.METHOD_INVOCATION: + MethodInvocation mi = (MethodInvocation) astNode; + ASTNode temp = findDeclaration2(mi.getName(), nearestNode); + if(temp instanceof MethodDeclaration){ + // method is locally defined + log(mi.getName() + " was found locally," + getNodeAsString(extracTypeInfo(temp))); + + { // Handle "array." x "array[1]." + Type type = extracTypeInfo2(temp); + if (type != null && type.isArrayType() && + astNode.getParent().getNodeType() != ASTNode.ARRAY_ACCESS) { + // No array access, we want members of the array itself + Type elementType = ((ArrayType) type).getElementType(); + + // Get name of the element class + String name = ""; + if (elementType.isSimpleType()) { + Class c = findClassIfExists(ps, elementType.toString()); + if (c != null) name = c.getName(); + } else if (elementType.isPrimitiveType()) { + name = ((PrimitiveType) elementType).getPrimitiveTypeCode().toString(); + } + + // Convert element class to array class + Class arrayClass = getArrayClass(name, ps.classLoader); + + return arrayClass == null ? null : new ClassMember(arrayClass); + } + } + + return new ClassMember(ps, extracTypeInfo(temp)); + } + if (mi.getExpression() == null) { +// if() + //Local code or belongs to super class + log("MI,Not implemented."); + return null; + } else { + if (mi.getExpression() instanceof SimpleName) { + ASTNode decl = findDeclaration2((SimpleName) mi.getExpression(), + nearestNode); + if (decl != null) { + if (decl.getNodeType() == ASTNode.TYPE_DECLARATION) { + TypeDeclaration td = (TypeDeclaration) decl; + return new ClassMember(ps, td); + } + + stp = extracTypeInfo(decl); + if(stp == null){ + /*The type wasn't found in local code, so it might be something like + * System.console()., or maybe belonging to super class, etc. + */ + Class tehClass = findClassIfExists(ps, mi.getExpression().toString()); + if (tehClass != null) { + // Method Expression is a simple name and wasn't located locally, but found in a class + // so look for method in this class. + return definedIn3rdPartyClass(ps, new ClassMember(tehClass), mi + .getName().toString()); + } + log("MI resolve 3rd par, Can't resolve " + mi.getExpression()); + return null; + } + log("MI, SN Type " + getNodeAsString(stp)); + ASTNode typeDec = findDeclaration2(stp.getName(),nearestNode); + if(typeDec == null){ + log(stp.getName() + " couldn't be found locally.."); + Class tehClass = findClassIfExists(ps, stp.getName().toString()); + if (tehClass != null) { + // Method Expression is a simple name and wasn't located locally, but found in a class + // so look for method in this class. + return definedIn3rdPartyClass(ps, new ClassMember(tehClass), mi + .getName().toString()); + } + //return new ClassMember(findClassIfExists(stp.getName().toString())); + } + //scopeParent = definedIn3rdPartyClass(stp.getName().toString(), "THIS"); + return definedIn3rdPartyClass(ps, new ClassMember(ps, typeDec), mi + .getName().toString()); + } + } else { + log("MI EXP.."+getNodeAsString(mi.getExpression())); +// return null; + scopeParent = resolveExpression3rdParty(ps, nearestNode, + mi.getExpression(), noCompare); + log("MI, ScopeParent " + scopeParent); + return definedIn3rdPartyClass(ps, scopeParent, mi.getName().toString()); + } + + } + break; + case ASTNode.QUALIFIED_NAME: + QualifiedName qn = (QualifiedName) astNode; + ASTNode temp2 = findDeclaration2(qn.getName(), nearestNode); + if(temp2 instanceof FieldDeclaration){ + // field is locally defined + log(qn.getName() + " was found locally," + getNodeAsString(extracTypeInfo(temp2))); + return new ClassMember(ps, extracTypeInfo(temp2)); + } + if (qn.getQualifier() == null) { + log("QN,Not implemented."); + return null; + } else { + + if (qn.getQualifier() instanceof SimpleName) { + stp = extracTypeInfo(findDeclaration2(qn.getQualifier(), nearestNode)); + if(stp == null){ + /*The type wasn't found in local code, so it might be something like + * log(), or maybe belonging to super class, etc. + */ + Class tehClass = findClassIfExists(ps, qn.getQualifier().toString()); + if (tehClass != null) { + // note how similar thing is called on line 690. Check check. + return definedIn3rdPartyClass(ps, new ClassMember(tehClass), qn + .getName().toString()); + } + log("QN resolve 3rd par, Can't resolve " + qn.getQualifier()); + return null; + } + log("QN, SN Local Type " + getNodeAsString(stp)); + //scopeParent = definedIn3rdPartyClass(stp.getName().toString(), "THIS"); + ASTNode typeDec = findDeclaration2(stp.getName(),nearestNode); + if(typeDec == null){ + log(stp.getName() + " couldn't be found locally.."); + + Class tehClass = findClassIfExists(ps, stp.getName().toString()); + if (tehClass != null) { + // note how similar thing is called on line 690. Check check. + return definedIn3rdPartyClass(ps, new ClassMember(tehClass), qn + .getName().toString()); + } + log("QN resolve 3rd par, Can't resolve " + qn.getQualifier()); + return null; + } + return definedIn3rdPartyClass(ps, new ClassMember(ps, typeDec), qn + .getName().toString()); + } else { + scopeParent = resolveExpression3rdParty(ps, nearestNode, + qn.getQualifier(), noCompare); + log("QN, ScopeParent " + scopeParent); + return definedIn3rdPartyClass(ps, scopeParent, qn.getName().toString()); + } + + } + case ASTNode.ARRAY_ACCESS: + ArrayAccess arac = (ArrayAccess)astNode; + return resolveExpression3rdParty(ps, nearestNode, arac.getArray(), noCompare); + default: + log("Unaccounted type " + getNodeAsString(astNode)); + break; + } + + return null; + } + + + public static Class getArrayClass(String elementClass, ClassLoader classLoader) { + String name; + if (elementClass.startsWith("[")) { + // just add a leading "[" + name = "[" + elementClass; + } else if (elementClass.equals("boolean")) { + name = "[Z"; + } else if (elementClass.equals("byte")) { + name = "[B"; + } else if (elementClass.equals("char")) { + name = "[C"; + } else if (elementClass.equals("double")) { + name = "[D"; + } else if (elementClass.equals("float")) { + name = "[F"; + } else if (elementClass.equals("int")) { + name = "[I"; + } else if (elementClass.equals("long")) { + name = "[J"; + } else if (elementClass.equals("short")) { + name = "[S"; + } else { + // must be an object non-array class + name = "[L" + elementClass + ";"; + } + return loadClass(name, classLoader); + } + + + /** + * For a().abc.a123 this would return a123 + * + * @param expression + * @return + */ + public static ASTNode getChildExpression(ASTNode expression) { +// ASTNode anode = null; + if (expression instanceof SimpleName) { + return expression; + } else if (expression instanceof FieldAccess) { + return ((FieldAccess) expression).getName(); + } else if (expression instanceof QualifiedName) { + return ((QualifiedName) expression).getName(); + }else if (expression instanceof MethodInvocation) { + return ((MethodInvocation) expression).getName(); + }else if(expression instanceof ArrayAccess){ + return ((ArrayAccess)expression).getArray(); + } + log(" getChildExpression returning NULL for " + + getNodeAsString(expression)); + return null; + } + + public static ASTNode getParentExpression(ASTNode expression) { +// ASTNode anode = null; + if (expression instanceof SimpleName) { + return expression; + } else if (expression instanceof FieldAccess) { + return ((FieldAccess) expression).getExpression(); + } else if (expression instanceof QualifiedName) { + return ((QualifiedName) expression).getQualifier(); + } else if (expression instanceof MethodInvocation) { + return ((MethodInvocation) expression).getExpression(); + } else if (expression instanceof ArrayAccess) { + return ((ArrayAccess) expression).getArray(); + } + log("getParentExpression returning NULL for " + + getNodeAsString(expression)); + return null; + } + + + /** + * Loads classes from .jar files in sketch classpath + * + * @param typeName + * @param child + * @param noCompare + * @return + */ + public static ArrayList getMembersForType(PreprocessedSketch ps, + String typeName, + String child, + boolean noCompare, + boolean staticOnly) { + ArrayList candidates = new ArrayList<>(); + log("In GMFT(), Looking for match " + child + + " in class " + typeName + " noCompare " + noCompare + " staticOnly " + + staticOnly); + Class probableClass = findClassIfExists(ps, typeName); + if(probableClass == null){ + log("In GMFT(), class not found."); + return candidates; + } + return getMembersForType(ps, new ClassMember(probableClass), child, noCompare, staticOnly); + + } + + public static ArrayList getMembersForType(PreprocessedSketch ps, + ClassMember tehClass, + String childToLookFor, + boolean noCompare, + boolean staticOnly) { + String child = childToLookFor.toLowerCase(); + ArrayList candidates = new ArrayList<>(); + log("getMemFoType-> Looking for match " + child + + " inside " + tehClass + " noCompare " + noCompare + " staticOnly " + + staticOnly); + if(tehClass == null){ + return candidates; + } + // tehClass will either be a TypeDecl defined locally + if(tehClass.getDeclaringNode() instanceof TypeDeclaration){ + TypeDeclaration td = (TypeDeclaration) tehClass.getDeclaringNode(); + { + FieldDeclaration[] fields = td.getFields(); + for (FieldDeclaration field : fields) { + if (staticOnly && !isStatic(field.modifiers())) { + continue; + } + List vdfs = field.fragments(); + for (VariableDeclarationFragment vdf : vdfs) { + if (noCompare) { + candidates.add(new CompletionCandidate(vdf)); + } else if (vdf.getName().toString().toLowerCase().startsWith(child)) + candidates.add(new CompletionCandidate(vdf)); + } + } + } + { + MethodDeclaration[] methods = td.getMethods(); + for (MethodDeclaration method : methods) { + if (staticOnly && !isStatic(method.modifiers())) { + continue; + } + if (noCompare) { + candidates.add(new CompletionCandidate(method)); + } else if (method.getName().toString().toLowerCase() + .startsWith(child)) + candidates.add(new CompletionCandidate(method)); + } + } + + ArrayList superClassCandidates; + if(td.getSuperclassType() != null){ + log(getNodeAsString(td.getSuperclassType()) + " <-Looking into superclass of " + tehClass); + superClassCandidates = getMembersForType(ps, new ClassMember(ps, td + .getSuperclassType()), + childToLookFor, noCompare, staticOnly); + } + else + { + superClassCandidates = getMembersForType(ps, new ClassMember(Object.class), + childToLookFor, noCompare, staticOnly); + } + for (CompletionCandidate cc : superClassCandidates) { + candidates.add(cc); + } + return candidates; + } + + // Or tehClass will be a predefined class + + Class probableClass; + if (tehClass.getClass_() != null) { + probableClass = tehClass.getClass_(); + } else { + probableClass = findClassIfExists(ps, tehClass.getTypeAsString()); + if (probableClass == null) { + log("Couldn't find class " + tehClass.getTypeAsString()); + return candidates; + } + log("Loaded " + probableClass.toString()); + } + for (Method method : probableClass.getMethods()) { + if (!Modifier.isStatic(method.getModifiers()) && staticOnly) { + continue; + } + + StringBuilder label = new StringBuilder(method.getName() + "("); + for (int i = 0; i < method.getParameterTypes().length; i++) { + label.append(method.getParameterTypes()[i].getSimpleName()); + if (i < method.getParameterTypes().length - 1) + label.append(","); + } + label.append(")"); + if (noCompare) { + candidates.add(new CompletionCandidate(method)); + } else if (label.toString().toLowerCase().startsWith(child)) { + candidates.add(new CompletionCandidate(method)); + } + } + for (Field field : probableClass.getFields()) { + if (!Modifier.isStatic(field.getModifiers()) && staticOnly) { + continue; + } + if (noCompare) { + candidates.add(new CompletionCandidate(field)); + } else if (field.getName().toLowerCase().startsWith(child)) { + candidates.add(new CompletionCandidate(field)); + } + } + if (probableClass.isArray() && !staticOnly) { + // add array members manually, they can't be fetched through code + + String className = probableClass.getSimpleName(); + + if (noCompare || "clone()".startsWith(child)) { + String methodLabel = "clone() : " + className + + " - " + className + ""; + candidates.add(new CompletionCandidate("clone()", methodLabel, "clone()", + CompletionCandidate.PREDEF_METHOD)); + } + + if ("length".startsWith(child)) { + String fieldLabel = "length : int - " + + className + ""; + candidates.add(new CompletionCandidate("length", fieldLabel, "length", + CompletionCandidate.PREDEF_FIELD)); + } + } + return candidates; + } + + private static boolean isStatic(List modifiers) { + for (org.eclipse.jdt.core.dom.Modifier m : modifiers) { + if (m.isStatic()) return true; + } + return false; + } + + + /** + * Searches for the particular class in the default list of imports as well as + * the Sketch classpath + * @param className + * @return + */ + protected static Class findClassIfExists(PreprocessedSketch ps, String className){ + if (className == null){ + return null; + } + + if (className.indexOf('.') >= 0) { + // Figure out what is package and what is class + String[] parts = className.split("\\."); + String newClassName = parts[0]; + int i = 1; + while (i < parts.length && + ps.classPath.isPackage(newClassName)) { + newClassName = newClassName + "/" + parts[i++]; + } + while (i < parts.length) { + newClassName = newClassName + "$" + parts[i++]; + } + className = newClassName.replace('/', '.'); + } + + // First, see if the classname is a fully qualified name and loads straightaway + Class tehClass = loadClass(className, ps.classLoader); + + if (tehClass != null) { + //log(tehClass.getName() + " located straightaway"); + return tehClass; + } + + // This name is qualified and it already had its chance + if (className.indexOf('.') >= 0) { + return null; + } + + log("Looking in the classloader for " + className); + // Using ClassPath and RegExResourceFilter to find a matching class + // and then loading the thing might be simpler and faster + + // These can be preprocessed during error check for performance + // (collect, split into starred and not starred) + List programImports = ps.programImports; + List codeFolderImports = ps.codeFolderImports; + List coreAndDefaultImports = ps.coreAndDefaultImports; + + ImportStatement javaLang = ImportStatement.wholePackage("java.lang"); + + Stream> importListStream = + Stream.of(Collections.singletonList(javaLang), coreAndDefaultImports, + programImports, codeFolderImports); + + final String finalClassName = className; + + // These streams can be made unordered parallel if it helps performance + return importListStream + .map(list -> list.stream() + .map(is -> { + if (is.getClassName().equals(finalClassName)) { + return is.getFullClassName(); + } else if (is.isStarredImport()) { + return is.getPackageName() + "." + finalClassName; + } + return null; + }) + .filter(name -> name != null) + .map(name -> loadClass(name, ps.classLoader)) + .filter(cls -> cls != null) + .findAny()) + .filter(Optional::isPresent) + .map(Optional::get) + .findAny() + .orElse(null); + } + + protected static Class loadClass(String className, ClassLoader classLoader){ + Class tehClass = null; + if (className != null) { + try { + tehClass = Class.forName(className, false, classLoader); + } catch (ClassNotFoundException e) { + //log("Doesn't exist in package: "); + } + } + return tehClass; + } + + public static ClassMember definedIn3rdPartyClass(PreprocessedSketch ps, String className,String memberName){ + Class probableClass = findClassIfExists(ps, className); + if (probableClass == null) { + log("Couldn't load " + className); + return null; + } + if (memberName.equals("THIS")) { + return new ClassMember(probableClass); + } else { + return definedIn3rdPartyClass(ps, new ClassMember(probableClass), memberName); + } + } + + public static ClassMember definedIn3rdPartyClass(PreprocessedSketch ps, ClassMember tehClass,String memberName){ + if(tehClass == null) + return null; + log("definedIn3rdPartyClass-> Looking for " + memberName + + " in " + tehClass); + String memberNameL = memberName.toLowerCase(); + if (tehClass.getDeclaringNode() instanceof TypeDeclaration) { + + TypeDeclaration td = (TypeDeclaration) tehClass.getDeclaringNode(); + for (int i = 0; i < td.getFields().length; i++) { + List vdfs = + td.getFields()[i].fragments(); + for (VariableDeclarationFragment vdf : vdfs) { + if (vdf.getName().toString().toLowerCase() + .startsWith(memberNameL)) + return new ClassMember(ps, vdf); + } + + } + for (int i = 0; i < td.getMethods().length; i++) { + if (td.getMethods()[i].getName().toString().toLowerCase() + .startsWith(memberNameL)) + return new ClassMember(ps, td.getMethods()[i]); + } + if (td.getSuperclassType() != null) { + log(getNodeAsString(td.getSuperclassType()) + " <-Looking into superclass of " + tehClass); + return definedIn3rdPartyClass(ps, new ClassMember(ps, td + .getSuperclassType()),memberName); + } else { + return definedIn3rdPartyClass(ps, new ClassMember(Object.class),memberName); + } + } + + Class probableClass; + if (tehClass.getClass_() != null) { + probableClass = tehClass.getClass_(); + } else { + probableClass = findClassIfExists(ps, tehClass.getTypeAsString()); + log("Loaded " + probableClass.toString()); + } + for (Method method : probableClass.getMethods()) { + if (method.getName().equalsIgnoreCase(memberName)) { + return new ClassMember(method); + } + } + for (Field field : probableClass.getFields()) { + if (field.getName().equalsIgnoreCase(memberName)) { + return new ClassMember(field); + } + } + return null; + } + + + protected static ASTNode findClosestParentNode(int lineNumber, ASTNode node) { + // Base.loge("Props of " + node.getClass().getName()); + for (StructuralPropertyDescriptor prop : (Iterable) node + .structuralPropertiesForType()) { + if (prop.isChildProperty() || prop.isSimpleProperty()) { + if (node.getStructuralProperty(prop) != null) { +// System.out +// .println(node.getStructuralProperty(prop) + " -> " + (prop)); + if (node.getStructuralProperty(prop) instanceof ASTNode) { + ASTNode cnode = (ASTNode) node.getStructuralProperty(prop); +// log("Looking at " + getNodeAsString(cnode)+ " for line num " + lineNumber); + int cLineNum = ((CompilationUnit) cnode.getRoot()) + .getLineNumber(cnode.getStartPosition() + cnode.getLength()); + if (getLineNumber(cnode) <= lineNumber && lineNumber <= cLineNum) { + return findClosestParentNode(lineNumber, cnode); + } + } + } + } else if (prop.isChildListProperty()) { + List nodelist = (List) node + .getStructuralProperty(prop); + for (ASTNode cnode : nodelist) { + int cLineNum = ((CompilationUnit) cnode.getRoot()) + .getLineNumber(cnode.getStartPosition() + cnode.getLength()); +// log("Looking at " + getNodeAsString(cnode)+ " for line num " + lineNumber); + if (getLineNumber(cnode) <= lineNumber && lineNumber <= cLineNum) { + return findClosestParentNode(lineNumber, cnode); + } + } + } + } + return node; + } + + protected static ASTNode findClosestNode(int lineNumber, ASTNode node) { + log("findClosestNode to line " + lineNumber); + ASTNode parent = findClosestParentNode(lineNumber, node); + log("findClosestParentNode returned " + getNodeAsString(parent)); + if (parent == null) + return null; + if (getLineNumber(parent) == lineNumber){ + log(parent + "|PNode " + getLineNumber(parent) + ", lfor " + lineNumber ); + return parent; + } + List nodes; + if (parent instanceof TypeDeclaration) { + nodes = ((TypeDeclaration) parent).bodyDeclarations(); + } else if (parent instanceof Block) { + nodes = ((Block) parent).statements(); + } else { + log("findClosestNode() found " + getNodeAsString(parent)); + return null; + } + + if (nodes.size() > 0) { + ASTNode retNode = parent; + for (ASTNode cNode : nodes) { + log(cNode + "|cNode " + getLineNumber(cNode) + ", lfor " + lineNumber); + if (getLineNumber(cNode) <= lineNumber) + retNode = cNode; + } + + return retNode; + } + return parent; + } + + + /** + * Fetches line number of the node in its CompilationUnit. + * @param node + * @return + */ + public static int getLineNumber(ASTNode node) { + return ((CompilationUnit) node.getRoot()).getLineNumber(node + .getStartPosition()); + } + + + /* + protected SketchOutline sketchOutline; + + public void showSketchOutline() { + if (editor.hasJavaTabs()) return; + + sketchOutline = new SketchOutline(editor, codeTree); + sketchOutline.show(); + } + + + public void showTabOutline() { + new TabOutline(editor).show(); + } + */ + + + /** + * Give this thing a {@link Name} instance - a {@link SimpleName} from the + * ASTNode for ex, and it tries its level best to locate its declaration in + * the AST. It really does. + * + * @param findMe + * @return + */ + protected static ASTNode findDeclaration(Name findMe) { + + // WARNING: You're entering the Rube Goldberg territory of Experimental Mode. + // To debug this code, thou must take the Recursive Leap of Faith. + + // log("entering --findDeclaration1 -- " + findMe.toString()); + ASTNode declaringClass; + ASTNode parent = findMe.getParent(); + ASTNode ret; + ArrayList constrains = new ArrayList<>(); + if (parent.getNodeType() == ASTNode.METHOD_INVOCATION) { + Expression exp = (Expression) parent.getStructuralProperty(MethodInvocation.EXPRESSION_PROPERTY); + //TODO: Note the imbalance of constrains.add(ASTNode.METHOD_DECLARATION); + // Possibly a bug here. Investigate later. + if (((MethodInvocation) parent).getName().toString() + .equals(findMe.toString())) { + constrains.add(ASTNode.METHOD_DECLARATION); + + if (exp != null) { + constrains.add(ASTNode.TYPE_DECLARATION); +// log("MI EXP: " + exp.toString() + " of type " +// + exp.getClass().getName() + " parent: " + exp.getParent()); + if (exp instanceof MethodInvocation) { + SimpleType stp = extracTypeInfo(findDeclaration(((MethodInvocation) exp) + .getName())); + if (stp == null) + return null; + declaringClass = findDeclaration(stp.getName()); + return definedIn(declaringClass, ((MethodInvocation) parent) + .getName().toString(), constrains); + } else if (exp instanceof FieldAccess) { + SimpleType stp = extracTypeInfo(findDeclaration(((FieldAccess) exp) + .getName())); + if (stp == null) + return null; + declaringClass = findDeclaration((stp.getName())); + return definedIn(declaringClass, ((MethodInvocation) parent) + .getName().toString(), constrains); + } + if (exp instanceof SimpleName) { + SimpleType stp = extracTypeInfo(findDeclaration(((SimpleName) exp))); + if (stp == null) + return null; + declaringClass = findDeclaration(stp.getName()); +// log("MI.SN " + getNodeAsString(declaringClass)); + constrains.add(ASTNode.METHOD_DECLARATION); + return definedIn(declaringClass, ((MethodInvocation) parent) + .getName().toString(), constrains); + } + + } + } else { + parent = parent.getParent(); // Move one up the ast. V V IMP!! + } + } else if (parent.getNodeType() == ASTNode.FIELD_ACCESS) { + FieldAccess fa = (FieldAccess) parent; + Expression exp = fa.getExpression(); + if (fa.getName().toString().equals(findMe.toString())) { + constrains.add(ASTNode.FIELD_DECLARATION); + + if (exp != null) { + constrains.add(ASTNode.TYPE_DECLARATION); +// log("FA EXP: " + exp.toString() + " of type " +// + exp.getClass().getName() + " parent: " + exp.getParent()); + if (exp instanceof MethodInvocation) { + SimpleType stp = extracTypeInfo(findDeclaration(((MethodInvocation) exp) + .getName())); + if (stp == null) + return null; + declaringClass = findDeclaration(stp.getName()); + return definedIn(declaringClass, fa.getName().toString(), + constrains); + } else if (exp instanceof FieldAccess) { + SimpleType stp = extracTypeInfo(findDeclaration(((FieldAccess) exp) + .getName())); + if (stp == null) + return null; + declaringClass = findDeclaration((stp.getName())); + constrains.add(ASTNode.TYPE_DECLARATION); + return definedIn(declaringClass, fa.getName().toString(), + constrains); + } + if (exp instanceof SimpleName) { + SimpleType stp = extracTypeInfo(findDeclaration(((SimpleName) exp))); + if (stp == null) + return null; + declaringClass = findDeclaration(stp.getName()); +// log("FA.SN " + getNodeAsString(declaringClass)); + constrains.add(ASTNode.METHOD_DECLARATION); + return definedIn(declaringClass, fa.getName().toString(), + constrains); + } + } + + } else { + parent = parent.getParent(); // Move one up the ast. V V IMP!! + } + } else if (parent.getNodeType() == ASTNode.QUALIFIED_NAME) { + + QualifiedName qn = (QualifiedName) parent; + if (!findMe.toString().equals(qn.getQualifier().toString())) { + + SimpleType stp = extracTypeInfo(findDeclaration((qn.getQualifier()))); +// log(qn.getQualifier() + "->" + qn.getName()); + if (stp == null) { + return null; + } + + declaringClass = findDeclaration(stp.getName()); + +// log("QN decl class: " + getNodeAsString(declaringClass)); + constrains.clear(); + constrains.add(ASTNode.TYPE_DECLARATION); + constrains.add(ASTNode.FIELD_DECLARATION); + return definedIn(declaringClass, qn.getName().toString(), constrains); + } + else{ + if(findMe instanceof QualifiedName){ + QualifiedName qnn = (QualifiedName) findMe; +// log("findMe is a QN, " +// + (qnn.getQualifier().toString() + " other " + qnn.getName() +// .toString())); + + SimpleType stp = extracTypeInfo(findDeclaration((qnn.getQualifier()))); + if (stp == null) { + return null; + } + declaringClass = findDeclaration(stp.getName()); + constrains.clear(); + constrains.add(ASTNode.TYPE_DECLARATION); + constrains.add(ASTNode.FIELD_DECLARATION); + return definedIn(declaringClass, qnn.getName().toString(), + constrains); + } + } + } else if (parent.getNodeType() == ASTNode.SIMPLE_TYPE) { + constrains.add(ASTNode.TYPE_DECLARATION); + if (parent.getParent().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION) { + constrains.add(ASTNode.CLASS_INSTANCE_CREATION); + } + } else if (parent.getNodeType() == ASTNode.TYPE_DECLARATION) { + // The condition where we look up the name of a class decl + TypeDeclaration td = (TypeDeclaration) parent; + if (findMe.equals(td.getName())) { + return parent; + } + + } else if (parent instanceof Expression) { +// constrains.add(ASTNode.TYPE_DECLARATION); +// constrains.add(ASTNode.METHOD_DECLARATION); +// constrains.add(ASTNode.FIELD_DECLARATION); + } +// else if(findMe instanceof QualifiedName){ +// QualifiedName qn = (QualifiedName) findMe; +// System.out +// .println("findMe is a QN, " +// + (qn.getQualifier().toString() + " other " + qn.getName() +// .toString())); +// } + while (parent != null) { +// log("findDeclaration1 -> " + getNodeAsString(parent)); + for (Object oprop : parent.structuralPropertiesForType()) { + StructuralPropertyDescriptor prop = (StructuralPropertyDescriptor) oprop; + if (prop.isChildProperty() || prop.isSimpleProperty()) { + if (parent.getStructuralProperty(prop) instanceof ASTNode) { +// log(prop + " C/S Prop of -> " +// + getNodeAsString(parent)); + ret = definedIn((ASTNode) parent.getStructuralProperty(prop), + findMe.toString(), constrains); + if (ret != null) + return ret; + } + } else if (prop.isChildListProperty()) { +// log((prop) + " ChildList props of " +// + getNodeAsString(parent)); + List nodelist = (List) parent + .getStructuralProperty(prop); + for (ASTNode retNode : nodelist) { + ret = definedIn(retNode, findMe.toString(), constrains); + if (ret != null) + return ret; + } + } + } + parent = parent.getParent(); + } + return null; + } + + /** + * A variation of findDeclaration() but accepts an alternate parent ASTNode + * @param findMe + * @param alternateParent + * @return + */ + protected static ASTNode findDeclaration2(Name findMe, ASTNode alternateParent) { + ASTNode declaringClass; + ASTNode parent = findMe.getParent(); + ASTNode ret; + ArrayList constrains = new ArrayList<>(); + if (parent.getNodeType() == ASTNode.METHOD_INVOCATION) { + Expression exp = (Expression) parent.getStructuralProperty(MethodInvocation.EXPRESSION_PROPERTY); + //TODO: Note the imbalance of constrains.add(ASTNode.METHOD_DECLARATION); + // Possibly a bug here. Investigate later. + if (((MethodInvocation) parent).getName().toString() + .equals(findMe.toString())) { + constrains.add(ASTNode.METHOD_DECLARATION); + + if (exp != null) { + constrains.add(ASTNode.TYPE_DECLARATION); +// log("MI EXP: " + exp.toString() + " of type " +// + exp.getClass().getName() + " parent: " + exp.getParent()); + if (exp instanceof MethodInvocation) { + SimpleType stp = extracTypeInfo(findDeclaration2(((MethodInvocation) exp) + .getName(), + alternateParent)); + if (stp == null) + return null; + declaringClass = findDeclaration2(stp.getName(), alternateParent); + return definedIn(declaringClass, ((MethodInvocation) parent) + .getName().toString(), constrains); + } else if (exp instanceof FieldAccess) { + SimpleType stp = extracTypeInfo(findDeclaration2(((FieldAccess) exp) + .getName(), + alternateParent)); + if (stp == null) + return null; + declaringClass = findDeclaration2((stp.getName()), alternateParent); + return definedIn(declaringClass, ((MethodInvocation) parent) + .getName().toString(), constrains); + } + if (exp instanceof SimpleName) { + SimpleType stp = extracTypeInfo(findDeclaration2(((SimpleName) exp), + alternateParent)); + if (stp == null) + return null; + declaringClass = findDeclaration2(stp.getName(), alternateParent); +// log("MI.SN " + getNodeAsString(declaringClass)); + constrains.add(ASTNode.METHOD_DECLARATION); + return definedIn(declaringClass, ((MethodInvocation) parent) + .getName().toString(), constrains); + } + + } + } else { + parent = parent.getParent(); // Move one up the ast. V V IMP!! + alternateParent = alternateParent.getParent(); + } + } else if (parent.getNodeType() == ASTNode.FIELD_ACCESS) { + FieldAccess fa = (FieldAccess) parent; + Expression exp = fa.getExpression(); + if (fa.getName().toString().equals(findMe.toString())) { + constrains.add(ASTNode.FIELD_DECLARATION); + + if (exp != null) { + constrains.add(ASTNode.TYPE_DECLARATION); +// log("FA EXP: " + exp.toString() + " of type " +// + exp.getClass().getName() + " parent: " + exp.getParent()); + if (exp instanceof MethodInvocation) { + SimpleType stp = extracTypeInfo(findDeclaration2(((MethodInvocation) exp) + .getName(), + alternateParent)); + if (stp == null) + return null; + declaringClass = findDeclaration2(stp.getName(), alternateParent); + return definedIn(declaringClass, fa.getName().toString(), + constrains); + } else if (exp instanceof FieldAccess) { + SimpleType stp = extracTypeInfo(findDeclaration2(((FieldAccess) exp) + .getName(), + alternateParent)); + if (stp == null) + return null; + declaringClass = findDeclaration2((stp.getName()), alternateParent); + constrains.add(ASTNode.TYPE_DECLARATION); + return definedIn(declaringClass, fa.getName().toString(), + constrains); + } + if (exp instanceof SimpleName) { + SimpleType stp = extracTypeInfo(findDeclaration2(((SimpleName) exp), + alternateParent)); + if (stp == null) + return null; + declaringClass = findDeclaration2(stp.getName(), alternateParent); +// log("FA.SN " + getNodeAsString(declaringClass)); + constrains.add(ASTNode.METHOD_DECLARATION); + return definedIn(declaringClass, fa.getName().toString(), + constrains); + } + } + + } else { + parent = parent.getParent(); // Move one up the ast. V V IMP!! + alternateParent = alternateParent.getParent(); + } + } else if (parent.getNodeType() == ASTNode.QUALIFIED_NAME) { + + QualifiedName qn = (QualifiedName) parent; + if (!findMe.toString().equals(qn.getQualifier().toString())) { + + SimpleType stp = extracTypeInfo(findDeclaration2((qn.getQualifier()), + alternateParent)); + if(stp == null) + return null; + declaringClass = findDeclaration2(stp.getName(), alternateParent); +// log(qn.getQualifier() + "->" + qn.getName()); +// log("QN decl class: " + getNodeAsString(declaringClass)); + constrains.clear(); + constrains.add(ASTNode.TYPE_DECLARATION); + constrains.add(ASTNode.FIELD_DECLARATION); + return definedIn(declaringClass, qn.getName().toString(), constrains); + } + else{ + if(findMe instanceof QualifiedName){ + QualifiedName qnn = (QualifiedName) findMe; +// log("findMe is a QN, " +// + (qnn.getQualifier().toString() + " other " + qnn.getName() +// .toString())); + + SimpleType stp = extracTypeInfo(findDeclaration2((qnn.getQualifier()), alternateParent)); + + if (stp == null) { + return null; + } + +// log(qnn.getQualifier() + "->" + qnn.getName()); + declaringClass = findDeclaration2(stp.getName(), alternateParent); + +// log("QN decl class: " +// + getNodeAsString(declaringClass)); + constrains.clear(); + constrains.add(ASTNode.TYPE_DECLARATION); + constrains.add(ASTNode.FIELD_DECLARATION); + return definedIn(declaringClass, qnn.getName().toString(), constrains); + } + } + } else if (parent.getNodeType() == ASTNode.SIMPLE_TYPE) { + constrains.add(ASTNode.TYPE_DECLARATION); + if (parent.getParent().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION) + constrains.add(ASTNode.CLASS_INSTANCE_CREATION); + } else if (parent instanceof Expression) { +// constrains.add(ASTNode.TYPE_DECLARATION); +// constrains.add(ASTNode.METHOD_DECLARATION); +// constrains.add(ASTNode.FIELD_DECLARATION); + } // TODO: in findDec, we also have a case where parent of type TD is handled. + // Figure out if needed here as well. +// log("Alternate parent: " + getNodeAsString(alternateParent)); + while (alternateParent != null) { +// log("findDeclaration2 -> " +// + getNodeAsString(alternateParent)); + for (Object oprop : alternateParent.structuralPropertiesForType()) { + StructuralPropertyDescriptor prop = (StructuralPropertyDescriptor) oprop; + if (prop.isChildProperty() || prop.isSimpleProperty()) { + if (alternateParent.getStructuralProperty(prop) instanceof ASTNode) { +// log(prop + " C/S Prop of -> " +// + getNodeAsString(alternateParent)); + ret = definedIn((ASTNode) alternateParent + .getStructuralProperty(prop), + findMe.toString(), constrains); + if (ret != null) + return ret; + } + } else if (prop.isChildListProperty()) { +// log((prop) + " ChildList props of " +// + getNodeAsString(alternateParent)); + List nodelist = (List) alternateParent + .getStructuralProperty(prop); + for (ASTNode retNode : nodelist) { + ret = definedIn(retNode, findMe.toString(), constrains); + if (ret != null) + return ret; + } + } + } + alternateParent = alternateParent.getParent(); + } + return null; + } + + + protected static boolean ignorableSuggestionImport(PreprocessedSketch ps, String impName) { + + String impNameLc = impName.toLowerCase(); + + List programImports = ps.programImports; + List codeFolderImports = ps.codeFolderImports; + + boolean isImported = Stream + .concat(programImports.stream(), codeFolderImports.stream()) + .anyMatch(impS -> { + String packageNameLc = impS.getPackageName().toLowerCase(); + return impNameLc.startsWith(packageNameLc); + }); + + if (isImported) return false; + + final String include = "include"; + final String exclude = "exclude"; + + if (impName.startsWith("processing")) { + if (JavaMode.suggestionsMap.containsKey(include) && JavaMode.suggestionsMap.get(include).contains(impName)) { + return false; + } else if (JavaMode.suggestionsMap.containsKey(exclude) && JavaMode.suggestionsMap.get(exclude).contains(impName)) { + return true; + } + } else if (impName.startsWith("java")) { + if (JavaMode.suggestionsMap.containsKey(include) && JavaMode.suggestionsMap.get(include).contains(impName)) { + return false; + } + } + + return true; + } + + + /** + * A wrapper for java.lang.reflect types. + * Will have to see if the usage turns out to be internal only here or not + * and then accordingly decide where to place this class. + * @author quarkninja + * + */ + public static class ClassMember { + private Field field; + + private Method method; + + private Constructor cons; + + private Class thisclass; + + private String stringVal; + + private String classType; + + private ASTNode astNode; + + private ASTNode declaringNode; + + public ClassMember(Class m) { + thisclass = m; + stringVal = "Predefined Class " + m.getName(); + classType = m.getName(); + } + + public ClassMember(Method m) { + method = m; + stringVal = "Method " + m.getReturnType().getName() + " | " + m.getName() + + " defined in " + m.getDeclaringClass().getName(); + classType = m.getReturnType().getName(); + } + + public ClassMember(Field m) { + field = m; + stringVal = "Field " + m.getType().getName() + " | " + m.getName() + + " defined in " + m.getDeclaringClass().getName(); + classType = m.getType().getName(); + } + + public ClassMember(Constructor m) { + cons = m; + stringVal = "Cons " + " " + m.getName() + " defined in " + + m.getDeclaringClass().getName(); + } + + public ClassMember(PreprocessedSketch ps, ASTNode node){ + astNode = node; + stringVal = getNodeAsString(node); + if(node instanceof TypeDeclaration){ + declaringNode = node; + } + if(node instanceof SimpleType){ + classType = ((SimpleType)node).getName().toString(); + } + SimpleType stp = (node instanceof SimpleType) ? (SimpleType) node + : extracTypeInfo(node); + if(stp != null){ + ASTNode decl =findDeclaration(stp.getName()); + // Czech out teh mutation + if(decl == null){ + // a predefined type + classType = stp.getName().toString(); + thisclass = findClassIfExists(ps, classType); + } + else{ + // a local type + declaringNode = decl; + } + } + } + + public Class getClass_() { + return thisclass; + } + + public ASTNode getDeclaringNode(){ + return declaringNode; + } + + public Field getField() { + return field; + } + + public Method getMethod() { + return method; + } + + public Constructor getCons() { + return cons; + } + + public ASTNode getASTNode(){ + return astNode; + } + + public String toString() { + return stringVal; + } + + public String getTypeAsString(){ + return classType; + } + } + + + /** + * Find the SimpleType from FD, SVD, VDS, etc + * + * @param node + * @return + */ + public static SimpleType extracTypeInfo(ASTNode node) { + if (node == null) { + return null; + } + Type t = extracTypeInfo2(node); + if (t instanceof PrimitiveType) { + return null; + } else if (t instanceof ArrayType) { + ArrayType at = (ArrayType) t; + log("ele type " + + at.getElementType() + ", " + + at.getElementType().getClass().getName()); + if (at.getElementType() instanceof PrimitiveType) { + return null; + } else if (at.getElementType() instanceof SimpleType) { + return (SimpleType) at.getElementType(); + } else + return null; + } else if (t instanceof ParameterizedType) { + ParameterizedType pmt = (ParameterizedType) t; + log(pmt.getType() + ", " + pmt.getType().getClass()); + if (pmt.getType() instanceof SimpleType) { + return (SimpleType) pmt.getType(); + } else + return null; + } + return (SimpleType) t; + } + + + static public Type extracTypeInfo2(ASTNode node) { + Messages.log("* extracTypeInfo2"); + if (node == null) + return null; + switch (node.getNodeType()) { + case ASTNode.METHOD_DECLARATION: + return ((MethodDeclaration) node).getReturnType2(); + case ASTNode.FIELD_DECLARATION: + return ((FieldDeclaration) node).getType(); + case ASTNode.VARIABLE_DECLARATION_EXPRESSION: + return ((VariableDeclarationExpression) node).getType(); + case ASTNode.VARIABLE_DECLARATION_STATEMENT: + return ((VariableDeclarationStatement) node).getType(); + case ASTNode.SINGLE_VARIABLE_DECLARATION: + return ((SingleVariableDeclaration) node).getType(); + case ASTNode.VARIABLE_DECLARATION_FRAGMENT: + return extracTypeInfo2(node.getParent()); + } + log("Unknown type info request " + getNodeAsString(node)); + return null; + } + + + static protected ASTNode definedIn(ASTNode node, String name, + ArrayList constrains) { + if (node == null) + return null; + if (constrains != null) { +// log("Looking at " + getNodeAsString(node) + " for " + name +// + " in definedIn"); + if (!constrains.contains(node.getNodeType()) && constrains.size() > 0) { +// System.err.print("definedIn -1 " + " But constrain was "); +// for (Integer integer : constrains) { +// System.out.print(ASTNode.nodeClassForType(integer) + ","); +// } +// log(); + return null; + } + } + + List vdfList = null; + switch (node.getNodeType()) { + + case ASTNode.TYPE_DECLARATION: + //Base.loge(getNodeAsString(node)); + TypeDeclaration td = (TypeDeclaration) node; + if (td.getName().toString().equals(name)) { + if (constrains.contains(ASTNode.CLASS_INSTANCE_CREATION)) { + // look for constructor; + MethodDeclaration[] methods = td.getMethods(); + for (MethodDeclaration md : methods) { + if (md.getName().toString().equalsIgnoreCase(name)) { + log("Found a constructor."); + return md; + } + } + } else { + // it's just the TD we're lookin for + return node; + } + } else { + if (constrains.contains(ASTNode.FIELD_DECLARATION)) { + // look for fields + FieldDeclaration[] fields = td.getFields(); + for (FieldDeclaration fd : fields) { + List fragments = fd.fragments(); + for (VariableDeclarationFragment vdf : fragments) { + if (vdf.getName().toString().equalsIgnoreCase(name)) + return fd; + } + } + } else if (constrains.contains(ASTNode.METHOD_DECLARATION)) { + // look for methods + MethodDeclaration[] methods = td.getMethods(); + for (MethodDeclaration md : methods) { + if (md.getName().toString().equalsIgnoreCase(name)) { + return md; + } + } + } + } + break; + case ASTNode.METHOD_DECLARATION: + //Base.loge(getNodeAsString(node)); + if (((MethodDeclaration) node).getName().toString().equalsIgnoreCase(name)) + return node; + break; + case ASTNode.SINGLE_VARIABLE_DECLARATION: + //Base.loge(getNodeAsString(node)); + if (((SingleVariableDeclaration) node).getName().toString().equalsIgnoreCase(name)) + return node; + break; + case ASTNode.FIELD_DECLARATION: + //Base.loge("FD" + node); + vdfList = ((FieldDeclaration) node).fragments(); + break; + case ASTNode.VARIABLE_DECLARATION_EXPRESSION: + //Base.loge("VDE" + node); + vdfList = ((VariableDeclarationExpression) node).fragments(); + break; + case ASTNode.VARIABLE_DECLARATION_STATEMENT: + //Base.loge("VDS" + node); + vdfList = ((VariableDeclarationStatement) node).fragments(); + break; + + default: + + } + if (vdfList != null) { + for (VariableDeclarationFragment vdf : vdfList) { + if (vdf.getName().toString().equalsIgnoreCase(name)) + return node; + } + } + return null; + } + + + static protected String getNodeAsString(ASTNode node) { + if (node == null) + return "NULL"; + String className = node.getClass().getName(); + int index = className.lastIndexOf("."); + if (index > 0) + className = className.substring(index + 1); + + // if(node instanceof BodyDeclaration) + // return className; + + String value = className; + + if (node instanceof TypeDeclaration) + value = ((TypeDeclaration) node).getName().toString() + " | " + className; + else if (node instanceof MethodDeclaration) + value = ((MethodDeclaration) node).getName().toString() + " | " + + className; + else if (node instanceof MethodInvocation) + value = ((MethodInvocation) node).getName().toString() + " | " + + className; + else if (node instanceof FieldDeclaration) + value = node.toString() + " FldDecl | "; + else if (node instanceof SingleVariableDeclaration) + value = ((SingleVariableDeclaration) node).getName() + " - " + + ((SingleVariableDeclaration) node).getType() + " | SVD "; + else if (node instanceof ExpressionStatement) + value = node.toString() + className; + else if (node instanceof SimpleName) + value = ((SimpleName) node).getFullyQualifiedName() + " | " + className; + else if (node instanceof QualifiedName) + value = node.toString() + " | " + className; + else if(node instanceof FieldAccess) + value = node.toString() + " | "; + else if (className.startsWith("Variable")) + value = node.toString() + " | " + className; + else if (className.endsWith("Type")) + value = node.toString() + " | " + className; + value += " [" + node.getStartPosition() + "," + + (node.getStartPosition() + node.getLength()) + "]"; + value += " Line: " + + ((CompilationUnit) node.getRoot()).getLineNumber(node + .getStartPosition()); + return value; + } + + +// public void jdocWindowVisible(boolean visible) { +// // frmJavaDoc.setVisible(visible); +// } + +// public static String readFile2(String path) { +// BufferedReader reader = null; +// try { +// reader = new BufferedReader( +// new InputStreamReader( +// new FileInputStream( +// new File( +// path)))); +// } catch (FileNotFoundException e) { +// e.printStackTrace(); +// } +// try { +// StringBuilder ret = new StringBuilder(); +// // ret.append("package " + className + ";\n"); +// String line; +// while ((line = reader.readLine()) != null) { +// ret.append(line); +// ret.append("\n"); +// } +// return ret.toString(); +// } catch (IOException e) { +// e.printStackTrace(); +// } finally { +// try { +// reader.close(); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// } +// return null; +// } + + + static private void log(Object object) { + Messages.log(object == null ? "null" : object.toString()); + } + + + /// Predictions -------------------------------------------------------------- + + + protected static List trimCandidates(String newWord, List candidates) { + ArrayList newCandidate = new ArrayList<>(); + newWord = newWord.toLowerCase(); + for (CompletionCandidate comp : candidates) { + //if (comp.getNoHtmlLabel().toLowerCase().startsWith(newWord)) { + if (comp.startsWith(newWord)) { + newCandidate.add(comp); + } + } + return newCandidate; + } + + protected List candidates; + protected String lastPredictedPhrase = " "; + + /** + * The main function that calculates possible code completion candidates + * + * @param pdePhrase + * @param line + * @param lineStartNonWSOffset + */ + public List preparePredictions(final PreprocessedSketch ps, + final String pdePhrase, + final int lineNumber) { + Messages.log("* preparePredictions"); + + ASTNode astRootNode = (ASTNode) ps.compilationUnit.types().get(0); + + // If the parsed code contains pde enhancements, take 'em out. + // TODO: test this + TextTransform transform = new TextTransform(pdePhrase); + transform.addAll(SourceUtils.replaceTypeConstructors(pdePhrase)); + transform.addAll(SourceUtils.replaceHexLiterals(pdePhrase)); + transform.addAll(SourceUtils.replaceColorRegex(pdePhrase)); + transform.addAll(SourceUtils.fixFloatsRegex(pdePhrase)); + String phrase = transform.apply(); + + //After typing 'arg.' all members of arg type are to be listed. This one is a flag for it + boolean noCompare = phrase.endsWith("."); + + if (noCompare) { + phrase = phrase.substring(0, phrase.length() - 1); + } + + boolean incremental = !noCompare && + phrase.length() > lastPredictedPhrase.length() && + phrase.startsWith(lastPredictedPhrase); + + + if (incremental) { + log(pdePhrase + " starts with " + lastPredictedPhrase); + log("Don't recalc"); + + if (phrase.contains(".")) { + int x = phrase.lastIndexOf('.'); + candidates = trimCandidates(phrase.substring(x + 1), candidates); + } else { + candidates = trimCandidates(phrase, candidates); + } + lastPredictedPhrase = phrase; + return candidates; + } + + // Ensure that we're not inside a comment. TODO: Binary search + + /*for (Comment comm : getCodeComments()) { + int commLineNo = PdeToJavaLineNumber(compilationUnit + .getLineNumber(comm.getStartPosition())); + if(commLineNo == lineNumber){ + log("Found a comment line " + comm); + log("Comment LSO " + + javaCodeOffsetToLineStartOffset(compilationUnit + .getLineNumber(comm.getStartPosition()), + comm.getStartPosition())); + break; + } + }*/ + + // Now parse the expression into an ASTNode object + ASTNode nearestNode; + ASTParser parser = ASTParser.newParser(AST.JLS8); + parser.setKind(ASTParser.K_EXPRESSION); + parser.setSource(phrase.toCharArray()); + ASTNode testnode = parser.createAST(null); + //Base.loge("PREDICTION PARSER PROBLEMS: " + parser); + // Find closest ASTNode of the document to this word + Messages.loge("Typed: " + phrase + "|" + " temp Node type: " + testnode.getClass().getSimpleName()); + if(testnode instanceof MethodInvocation){ + MethodInvocation mi = (MethodInvocation)testnode; + log(mi.getName() + "," + mi.getExpression() + "," + mi.typeArguments().size()); + } + + // find nearest ASTNode + nearestNode = findClosestNode(lineNumber, astRootNode); + if (nearestNode == null) { + // Make sure nearestNode is not NULL if couldn't find a closest node + nearestNode = astRootNode; + } + Messages.loge(lineNumber + " Nearest ASTNode to PRED " + + getNodeAsString(nearestNode)); + + candidates = new ArrayList<>(); + lastPredictedPhrase = phrase; + // Determine the expression typed + + if (testnode instanceof SimpleName && !noCompare) { + Messages.loge("One word expression " + getNodeAsString(testnode)); + //==> Simple one word exprssion - so is just an identifier + + // Bottom up traversal of the AST to look for possible definitions at + // higher levels. + //nearestNode = nearestNode.getParent(); + while (nearestNode != null) { + // If the current class has a super class, look inside it for + // definitions. + if (nearestNode instanceof TypeDeclaration) { + TypeDeclaration td = (TypeDeclaration) nearestNode; + if (td.getStructuralProperty(TypeDeclaration.SUPERCLASS_TYPE_PROPERTY) != null) { + SimpleType st = (SimpleType) td.getStructuralProperty(TypeDeclaration.SUPERCLASS_TYPE_PROPERTY); + log("Superclass " + st.getName()); + ArrayList tempCandidates = + getMembersForType(ps, st.getName().toString(), phrase, false, false); + for (CompletionCandidate can : tempCandidates) { + candidates.add(can); + } + //findDeclaration(st.getName()) + } + } + List sprops = + nearestNode.structuralPropertiesForType(); + for (StructuralPropertyDescriptor sprop : sprops) { + ASTNode cnode; + if (!sprop.isChildListProperty()) { + if (nearestNode.getStructuralProperty(sprop) instanceof ASTNode) { + cnode = (ASTNode) nearestNode.getStructuralProperty(sprop); + CompletionCandidate[] types = checkForTypes(cnode); + if (types != null) { + for (CompletionCandidate type : types) { + if (type.getElementName().toLowerCase().startsWith(phrase.toLowerCase())) + candidates.add(type); + } + } + } + } else { + // Childlist prop + List nodelist = + (List) nearestNode.getStructuralProperty(sprop); + for (ASTNode clnode : nodelist) { + CompletionCandidate[] types = checkForTypes(clnode); + if (types != null) { + for (CompletionCandidate type : types) { + if (type.getElementName().toLowerCase().startsWith(phrase.toLowerCase())) + candidates.add(type); + } + } + } + } + } + nearestNode = nearestNode.getParent(); + } + // We're seeing a simple name that's not defined locally or in + // the parent class. So most probably a pre-defined type. + log("Empty can. " + phrase); + ClassPath classPath = ps.classPath; + if (classPath != null) { + RegExpResourceFilter regExpResourceFilter = + new RegExpResourceFilter(Pattern.compile(".*"), + Pattern.compile(phrase + "[a-zA-Z_0-9]*.class", + Pattern.CASE_INSENSITIVE)); + String[] resources = classPath.findResources("", regExpResourceFilter); + + for (String matchedClass2 : resources) { + matchedClass2 = matchedClass2.replace('/', '.'); //package name + String matchedClass = matchedClass2.substring(0, matchedClass2.length() - 6); + int d = matchedClass.lastIndexOf('.'); + if (!ignorableSuggestionImport(ps, matchedClass)) { + matchedClass = matchedClass.substring(d + 1); //class name + // display package name in grey + String html = "" + matchedClass + " : " + + matchedClass2.substring(0, d) + ""; + candidates.add(new CompletionCandidate(matchedClass, html, + matchedClass, + CompletionCandidate.PREDEF_CLASS)); + } + } + } + } else { + // ==> Complex expression of type blah.blah2().doIt,etc + // Have to resolve it by carefully traversing AST of testNode + Messages.loge("Complex expression " + getNodeAsString(testnode)); + log("candidates empty"); + ASTNode childExpr = getChildExpression(testnode); + log("Parent expression : " + getParentExpression(testnode)); + log("Child expression : " + childExpr); + if (!noCompare) { + log("Original testnode " + getNodeAsString(testnode)); + testnode = getParentExpression(testnode); + log("Corrected testnode " + getNodeAsString(testnode)); + } + ClassMember expr = + resolveExpression3rdParty(ps, nearestNode, testnode, noCompare); + if (expr == null) { + log("Expr is null"); + } else { + boolean isArray = expr.thisclass != null && expr.thisclass.isArray(); + boolean isSimpleType = (expr.astNode != null) && + expr.astNode.getNodeType() == ASTNode.SIMPLE_TYPE; + boolean isMethod = expr.method != null; + boolean staticOnly = !isMethod && !isArray && !isSimpleType; + log("Expr is " + expr.toString()); + String lookFor = (noCompare || (childExpr == null)) ? + "" : childExpr.toString(); + candidates = getMembersForType(ps, expr, lookFor, noCompare, staticOnly); + } + } + return candidates; + } + + + protected static DefaultListModel filterPredictions(List candidates) { + Messages.log("* filterPredictions"); + DefaultListModel defListModel = new DefaultListModel<>(); + if (candidates.isEmpty()) + return defListModel; + // check if first & last CompCandidate are the same methods, only then show all overloaded methods + if (candidates.get(0).getElementName() + .equals(candidates.get(candidates.size() - 1).getElementName())) { + log("All CC are methods only: " + candidates.get(0).getElementName()); + for (int i = 0; i < candidates.size(); i++) { + CompletionCandidate cc = candidates.get(i).withRegeneratedCompString(); + candidates.set(i, cc); + defListModel.addElement(cc); + } + } + else { + boolean ignoredSome = false; + for (int i = 0; i < candidates.size(); i++) { + if(i > 0 && (candidates.get(i).getElementName() + .equals(candidates.get(i - 1).getElementName()))){ + if (candidates.get(i).getType() == CompletionCandidate.LOCAL_METHOD + || candidates.get(i).getType() == CompletionCandidate.PREDEF_METHOD) { + CompletionCandidate cc = candidates.get(i - 1); + String label = cc.getLabel(); + int x = label.lastIndexOf(')'); + String newLabel; + if (candidates.get(i).getType() == CompletionCandidate.PREDEF_METHOD) { + newLabel = (cc.getLabel().contains("") ? "" : "") + + cc.getElementName() + "(...)" + label.substring(x + 1); + } else { + newLabel = cc.getElementName() + "(...)" + label.substring(x + 1); + } + String newCompString = cc.getElementName() + "("; + candidates.set(i - 1, cc.withLabelAndCompString(newLabel, newCompString)); + ignoredSome = true; + continue; + } + } + defListModel.addElement(candidates.get(i)); + } + if (ignoredSome) { + log("Some suggestions hidden"); + } + } + return defListModel; + } + + + + /// JavaDocs ----------------------------------------------------------------- + + //TODO: Work on this later. +/* + protected TreeMap jdocMap; + + + protected void loadJavaDoc() { + jdocMap = new TreeMap<>(); + + // presently loading only p5 reference for PApplet + // TODO: use something like ExecutorService here [jv] + new Thread(new Runnable() { + @Override + public void run() { + try { + loadJavaDoc(jdocMap, editor.getMode().getReferenceFolder()); + } catch (Exception e) { + e.printStackTrace(); + } + } + }).start(); + } + + + static void loadJavaDoc(TreeMap jdocMap, + File referenceFolder) throws IOException { + Document doc; + + FileFilter fileFilter = new FileFilter() { + @Override + public boolean accept(File file) { + if(!file.getName().endsWith("_.html")) + return false; + int k = 0; + for (int i = 0; i < file.getName().length(); i++) { + if(file.getName().charAt(i)== '_') + k++; + if(k > 1) + return false; + } + return true; + } + }; + + for (File docFile : referenceFolder.listFiles(fileFilter)) { + doc = Jsoup.parse(docFile, null); + Elements elm = doc.getElementsByClass("ref-item"); + String msg = ""; + String methodName = docFile.getName().substring(0, docFile.getName().indexOf('_')); + //System.out.println(methodName); + for (org.jsoup.nodes.Element ele : elm) { + msg = "
    " + + ele.html() + "
    "; + //mat.replaceAll(""); + msg = msg.replaceAll("img src=\"", "img src=\"" + + referenceFolder.toURI().toURL().toString() + "/"); + //System.out.println(ele.text()); + } + jdocMap.put(methodName, msg); + } + //System.out.println("JDoc loaded " + jdocMap.size()); + } + + + public void updateJavaDoc(final CompletionCandidate candidate) { + String methodmatch = candidate.toString(); + if (methodmatch.indexOf('(') != -1) { + methodmatch = methodmatch.substring(0, methodmatch.indexOf('(')); + } + + //log("jdoc match " + methodmatch); + String temp = " "; + for (final String key : jdocMap.keySet()) { + if (key.startsWith(methodmatch) && key.length() > 3) { + log("Matched jdoc " + key); + if (candidate.getWrappedObject() != null) { + String definingClass = ""; + if (candidate.getWrappedObject() instanceof Field) + definingClass = ((Field) candidate.getWrappedObject()) + .getDeclaringClass().getName(); + else if (candidate.getWrappedObject() instanceof Method) + definingClass = ((Method) candidate.getWrappedObject()) + .getDeclaringClass().getName(); + if (definingClass.equals("processing.core.PApplet")) { + temp = (jdocMap.get(key)); + break; + } + } + } + } + + final String jdocString = temp; + SwingUtilities.invokeLater(new Runnable() { + public void run() { + javadocPane.setText(jdocString); + scrollPane.getVerticalScrollBar().setValue(0); + //frmJavaDoc.setVisible(!jdocString.equals(" ")); + editor.toFront(); + editor.ta.requestFocus(); + } + }); + } +*/ + +} diff --git a/java/src/processing/mode/java/pdex/CompletionPanel.java b/java/src/processing/mode/java/pdex/CompletionPanel.java index e1f0e8cdbc..d28699b3a2 100644 --- a/java/src/processing/mode/java/pdex/CompletionPanel.java +++ b/java/src/processing/mode/java/pdex/CompletionPanel.java @@ -23,36 +23,27 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; -import java.awt.Dimension; +import java.awt.Font; import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Graphics2D; import java.awt.Point; -import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.io.File; import javax.swing.DefaultListModel; import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; -import javax.swing.Painter; -import javax.swing.SwingWorker; -import javax.swing.UIDefaults; -import javax.swing.UIManager; -import javax.swing.plaf.InsetsUIResource; -import javax.swing.plaf.basic.BasicScrollBarUI; import javax.swing.text.BadLocationException; import processing.app.Base; import processing.app.Messages; import processing.app.Mode; import processing.app.syntax.JEditTextArea; +import processing.app.ui.Toolkit; import processing.mode.java.JavaEditor; @@ -73,7 +64,7 @@ public class CompletionPanel { private String subWord; /** - * Postion where the completion has to be inserted + * Position where the completion has to be inserted */ private int insertionPosition; @@ -95,6 +86,9 @@ public class CompletionPanel { static public ImageIcon methodIcon; static public ImageIcon localVarIcon; + static Color selectionBgColor; + static Color textColor; + /** * Triggers the completion popup @@ -112,41 +106,66 @@ public CompletionPanel(final JEditTextArea textarea, this.textarea = (JavaTextArea) textarea; this.editor = editor; this.insertionPosition = position; - if (subWord.indexOf('.') != -1) { + if (subWord.indexOf('.') != -1 && subWord.indexOf('.') != subWord.length()-1) { this.subWord = subWord.substring(subWord.lastIndexOf('.') + 1); } else { this.subWord = subWord; } - loadIcons(); + if (classIcon == null) { + Mode mode = editor.getMode(); + + File dir = new File(mode.getFolder(), "theme/completion"); + classIcon = Toolkit.getIconX(dir, "class_obj"); + methodIcon = Toolkit.getIconX(dir, "methpub_obj"); + fieldIcon = Toolkit.getIconX(dir, "field_protected_obj"); + localVarIcon = Toolkit.getIconX(dir, "field_default_obj"); + + //selectionBgColor = mode.getColor(""); // no theme.txt for Java Mode + selectionBgColor = new Color(0xffF0F0F0); + textColor = new Color(0xff222222); + } + popupMenu = new JPopupMenu(); popupMenu.removeAll(); popupMenu.setOpaque(false); popupMenu.setBorder(null); scrollPane = new JScrollPane(); - styleScrollPane(); - scrollPane.setViewportView(completionList = createSuggestionList(position, items)); +// styleScrollPane(); + //scrollPane.setViewportView(completionList = createSuggestionList(position, items)); + completionList = new JList(items) { + { + setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + setSelectedIndex(0); + addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + if (e.getClickCount() == 2) { + insertSelection(MOUSE_COMPLETION); + setInvisible(); + } + } + }); + setCellRenderer(new CustomListRenderer()); + setFocusable(false); + setFont(Toolkit.getSansFont(12, Font.PLAIN)); + } + }; + scrollPane.setViewportView(completionList); + // remove an ugly multi-line border around it + scrollPane.setBorder(null); + popupMenu.add(scrollPane, BorderLayout.CENTER); popupMenu.setPopupSize(calcWidth(), calcHeight(items.getSize())); //TODO: Eradicate this evil - editor.getErrorChecker().getASTGenerator().updateJavaDoc(completionList.getSelectedValue()); - textarea.requestFocusInWindow(); + popupMenu.setFocusable(false); + // TODO: Update JavaDoc to completionList.getSelectedValue() popupMenu.show(textarea, location.x, textarea.getBaseline(0, 0) + location.y); //log("Suggestion shown: " + System.currentTimeMillis()); } - private void loadIcons() { - if (classIcon == null) { - Mode mode = editor.getMode(); - classIcon = mode.loadIcon("theme/completion/class_obj.png"); - methodIcon = mode.loadIcon("theme/completion/methpub_obj.png"); - fieldIcon = mode.loadIcon("theme/completion/field_protected_obj.png"); - localVarIcon = mode.loadIcon("theme/completion/field_default_obj.png"); - } - } - - + /* private void styleScrollPane() { String laf = UIManager.getLookAndFeel().getID(); if (!laf.equals("Nimbus") && !laf.equals("Windows")) return; @@ -203,6 +222,7 @@ static private JButton createZeroButton() { return jbutton; } } + */ public boolean isVisible() { @@ -242,10 +262,6 @@ private int calcHeight(int itemCount) { } - /** - * Dynamic width of completion panel - * @return - width - */ private int calcWidth() { int maxWidth = 300; float min = 0; @@ -268,7 +284,6 @@ private int calcWidth() { * @param position * @param items * @return - */ private JList createSuggestionList(final int position, final DefaultListModel items) { @@ -289,6 +304,7 @@ public void mouseClicked(MouseEvent e) { list.setFocusable(false); return list; } + */ /* @@ -331,8 +347,8 @@ protected boolean insertSelection(int completionSource) { try { // If user types 'abc.', subword becomes '.' and null is returned String currentSubword = fetchCurrentSubword(); - int currentSubwordLen = currentSubword == null ? 0 : currentSubword - .length(); + int currentSubwordLen = + (currentSubword == null) ? 0 : currentSubword.length(); //logE(currentSubword + " <= subword,len => " + currentSubword.length()); String selectedSuggestion = completionList.getSelectedValue().getCompletionString(); @@ -344,13 +360,12 @@ protected boolean insertSelection(int completionSource) { } String completionString = - completionList.getSelectedValue().getCompletionString(); + completionList.getSelectedValue().getCompletionString(); if (selectedSuggestion.endsWith(" )")) { // the case of single param methods // selectedSuggestion = ")"; if (completionString.endsWith(" )")) { - completionString = completionString.substring(0, completionString - .length() - 2) - + ")"; + completionString = + completionString.substring(0, completionString.length() - 2) + ")"; } } @@ -363,20 +378,19 @@ protected boolean insertSelection(int completionSource) { } } - Messages.loge(subWord + " <= subword, Inserting suggestion=> " - + selectedSuggestion + " Current sub: " + currentSubword); + Messages.loge(subWord + " <= subword, Inserting suggestion=> " + + selectedSuggestion + " Current sub: " + currentSubword); if (currentSubword.length() > 0) { textarea.getDocument().remove(insertionPosition - currentSubwordLen, currentSubwordLen); } - textarea.getDocument() - .insertString(insertionPosition - currentSubwordLen, - completionString, null); + textarea.getDocument().insertString(insertionPosition - currentSubwordLen, + completionString, null); if (selectedSuggestion.endsWith(")") && !selectedSuggestion.endsWith("()")) { // place the caret between '( and first ',' int x = selectedSuggestion.indexOf(','); - if(x == -1) { + if (x == -1) { // the case of single param methods, containing no ',' textarea.setCaretPosition(textarea.getCaretPosition() - 1); // just before ')' } else { @@ -393,18 +407,12 @@ protected boolean insertSelection(int completionSource) { setInvisible(); } - if(mouseClickOnOverloadedMethods) { + if (mouseClickOnOverloadedMethods) { // See #2755 - SwingWorker worker = new SwingWorker() { - protected Object doInBackground() throws Exception { - ((JavaTextArea) editor.getTextArea()).fetchPhrase(null); - return null; - } - }; - worker.execute(); + ((JavaTextArea) editor.getTextArea()).fetchPhrase(); } - return true; + } catch (BadLocationException e1) { e1.printStackTrace(); } catch (Exception e) { @@ -506,7 +514,7 @@ protected void moveUp() { .getVerticalScrollBar() .getValue() - step); - editor.getErrorChecker().getASTGenerator().updateJavaDoc(completionList.getSelectedValue()); + // TODO: update JavaDoc to completionList.getSelectedValue() } } @@ -523,7 +531,7 @@ protected void moveDown() { int index = Math.min(completionList.getSelectedIndex() + 1, completionList.getModel().getSize() - 1); selectIndex(index); - editor.getErrorChecker().getASTGenerator().updateJavaDoc(completionList.getSelectedValue()); + // TODO: update JavaDoc to completionList.getSelectedValue() int step = scrollPane.getVerticalScrollBar().getMaximum() / completionList.getModel().getSize(); scrollPane.getVerticalScrollBar().setValue(scrollPane.getVerticalScrollBar().getValue() + step); } @@ -550,6 +558,11 @@ public Component getListCellRendererComponent(JList list, Object value, index, isSelected, cellHasFocus); + if (isSelected) { + label.setBackground(selectionBgColor); + } + label.setForeground(textColor); + if (value instanceof CompletionCandidate) { CompletionCandidate cc = (CompletionCandidate) value; switch (cc.getType()) { diff --git a/java/src/processing/mode/java/pdex/DebugTree.java b/java/src/processing/mode/java/pdex/DebugTree.java new file mode 100644 index 0000000000..a3ccb48e18 --- /dev/null +++ b/java/src/processing/mode/java/pdex/DebugTree.java @@ -0,0 +1,139 @@ +package processing.mode.java.pdex; + +import java.awt.EventQueue; +import java.awt.Rectangle; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.function.Consumer; + +import javax.swing.JDialog; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.WindowConstants; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; + +import org.eclipse.jdt.core.dom.ASTNode; +import org.eclipse.jdt.core.dom.ASTVisitor; +import org.eclipse.jdt.core.dom.CompilationUnit; + +import processing.app.Messages; +import processing.app.ui.ZoomTreeCellRenderer; +import processing.mode.java.JavaEditor; +import processing.mode.java.pdex.PreprocessedSketch.SketchInterval; + + +class DebugTree { + final JDialog window; + final JTree tree; + final Consumer updateListener; + + + DebugTree(JavaEditor editor, PreprocessingService pps) { + updateListener = this::buildAndUpdateTree; + + window = new JDialog(editor); + + tree = new JTree() { + @Override + public String convertValueToText(Object value, boolean selected, + boolean expanded, boolean leaf, + int row, boolean hasFocus) { + if (value instanceof DefaultMutableTreeNode) { + DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) value; + Object o = treeNode.getUserObject(); + if (o instanceof ASTNode) { + ASTNode node = (ASTNode) o; + return CompletionGenerator.getNodeAsString(node); + } + } + return super.convertValueToText(value, selected, expanded, leaf, row, hasFocus); + } + }; + tree.setCellRenderer(new ZoomTreeCellRenderer(editor.getMode())); + window.addComponentListener(new ComponentAdapter() { + @Override + public void componentHidden(ComponentEvent e) { + pps.unregisterListener(updateListener); + tree.setModel(null); + } + }); + window.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); + window.setBounds(new Rectangle(680, 100, 460, 620)); + window.setTitle("AST View - " + editor.getSketch().getName()); + JScrollPane sp = new JScrollPane(); + sp.setViewportView(tree); + window.add(sp); + pps.whenDone(updateListener); + pps.registerListener(updateListener); + + tree.addTreeSelectionListener(e -> { + if (tree.getLastSelectedPathComponent() != null) { + DefaultMutableTreeNode tnode = + (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); + if (tnode.getUserObject() instanceof ASTNode) { + ASTNode node = (ASTNode) tnode.getUserObject(); + pps.whenDone(ps -> { + SketchInterval si = ps.mapJavaToSketch(node); + if (!ps.inRange(si)) return; + EventQueue.invokeLater(() -> { + editor.highlight(si.tabIndex, si.startTabOffset, si.stopTabOffset); + }); + }); + } + } + }); + } + + + void dispose() { + if (window != null) { + window.dispose(); + } + } + + + // Thread: worker + void buildAndUpdateTree(PreprocessedSketch ps) { + CompilationUnit cu = ps.compilationUnit; + if (cu.types().isEmpty()){ + Messages.loge("No Type found in CU"); + return; + } + + Deque treeNodeStack = new ArrayDeque<>(); + + ASTNode type0 = (ASTNode) cu.types().get(0); + type0.accept(new ASTVisitor() { + @Override + public boolean preVisit2(ASTNode node) { + treeNodeStack.push(new DefaultMutableTreeNode(node)); + return super.preVisit2(node); + } + + @Override + public void postVisit(ASTNode node) { + if (treeNodeStack.size() > 1) { + DefaultMutableTreeNode treeNode = treeNodeStack.pop(); + treeNodeStack.peek().add(treeNode); + } + } + }); + + DefaultMutableTreeNode codeTree = treeNodeStack.pop(); + + EventQueue.invokeLater(() -> { + if (tree.hasFocus() || window.hasFocus()) { + return; + } + tree.setModel(new DefaultTreeModel(codeTree)); + ((DefaultTreeModel) tree.getModel()).reload(); + tree.validate(); + if (!window.isVisible()) { + window.setVisible(true); + } + }); + } +} \ No newline at end of file diff --git a/java/src/processing/mode/java/pdex/ErrorChecker.java b/java/src/processing/mode/java/pdex/ErrorChecker.java new file mode 100644 index 0000000000..4c735bc7f9 --- /dev/null +++ b/java/src/processing/mode/java/pdex/ErrorChecker.java @@ -0,0 +1,327 @@ +package processing.mode.java.pdex; + +import java.awt.EventQueue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import org.eclipse.jdt.core.compiler.IProblem; + +import com.google.classpath.ClassPath; +import com.google.classpath.ClassPathFactory; +import com.google.classpath.RegExpResourceFilter; + +import processing.app.Language; +import processing.app.Problem; +import processing.mode.java.JavaEditor; +import processing.mode.java.JavaMode; +import processing.mode.java.pdex.PreprocessedSketch.SketchInterval; + + +class ErrorChecker { + // Delay delivering error check result after last sketch change #2677 + private final static long DELAY_BEFORE_UPDATE = 650; + + private ScheduledExecutorService scheduler; + private volatile ScheduledFuture scheduledUiUpdate = null; + private volatile long nextUiUpdate = 0; + private volatile boolean enabled = true; + + private final Consumer errorHandlerListener = this::handleSketchProblems; + + private JavaEditor editor; + private PreprocessingService pps; + + + public ErrorChecker(JavaEditor editor, PreprocessingService pps) { + this.editor = editor; + this.pps = pps; + scheduler = Executors.newSingleThreadScheduledExecutor(); + this.enabled = JavaMode.errorCheckEnabled; + if (enabled) { + pps.registerListener(errorHandlerListener); + } + } + + + public void notifySketchChanged() { + nextUiUpdate = System.currentTimeMillis() + DELAY_BEFORE_UPDATE; + } + + + public void preferencesChanged() { + if (enabled != JavaMode.errorCheckEnabled) { + enabled = JavaMode.errorCheckEnabled; + if (enabled) { + pps.registerListener(errorHandlerListener); + } else { + pps.unregisterListener(errorHandlerListener); + editor.setProblemList(Collections.emptyList()); + nextUiUpdate = 0; + } + } + } + + + public void dispose() { + if (scheduler != null) { + scheduler.shutdownNow(); + } + } + + + private void handleSketchProblems(PreprocessedSketch ps) { + Map suggCache = + JavaMode.importSuggestEnabled ? new HashMap<>() : Collections.emptyMap(); + + final List problems = new ArrayList<>(); + + IProblem[] iproblems = ps.compilationUnit.getProblems(); + + { // Check for curly quotes + List curlyQuoteProblems = checkForCurlyQuotes(ps); + problems.addAll(curlyQuoteProblems); + } + + if (problems.isEmpty()) { // Check for missing braces + List missingBraceProblems = checkForMissingBraces(ps); + problems.addAll(missingBraceProblems); + } + + if (problems.isEmpty()) { + AtomicReference searchClassPath = new AtomicReference<>(null); + List cuProblems = Arrays.stream(iproblems) + // Filter Warnings if they are not enabled + .filter(iproblem -> !(iproblem.isWarning() && !JavaMode.warningsEnabled)) + // Hide a useless error which is produced when a line ends with + // an identifier without a semicolon. "Missing a semicolon" is + // also produced and is preferred over this one. + // (Syntax error, insert ":: IdentifierOrNew" to complete Expression) + // See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=405780 + .filter(iproblem -> !iproblem.getMessage() + .contains("Syntax error, insert \":: IdentifierOrNew\"")) + // Transform into our Problems + .map(iproblem -> { + JavaProblem p = convertIProblem(iproblem, ps); + + // Handle import suggestions + if (p != null && JavaMode.importSuggestEnabled && isUndefinedTypeProblem(iproblem)) { + ClassPath cp = searchClassPath.updateAndGet(prev -> prev != null ? + prev : new ClassPathFactory().createFromPaths(ps.searchClassPathArray)); + String[] s = suggCache.computeIfAbsent(iproblem.getArguments()[0], + name -> getImportSuggestions(cp, name)); + p.setImportSuggestions(s); + } + + return p; + }) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + + problems.addAll(cuProblems); + } + + if (scheduledUiUpdate != null) { + scheduledUiUpdate.cancel(true); + } + // Update UI after a delay. See #2677 + long delay = nextUiUpdate - System.currentTimeMillis(); + Runnable uiUpdater = () -> { + if (nextUiUpdate > 0 && System.currentTimeMillis() >= nextUiUpdate) { + EventQueue.invokeLater(() -> editor.setProblemList(problems)); + } + }; + scheduledUiUpdate = + scheduler.schedule(uiUpdater, delay, TimeUnit.MILLISECONDS); + } + + + static private JavaProblem convertIProblem(IProblem iproblem, PreprocessedSketch ps) { + SketchInterval in = ps.mapJavaToSketch(iproblem); + if (in != SketchInterval.BEFORE_START) { + String badCode = ps.getPdeCode(in); + int line = ps.tabOffsetToTabLine(in.tabIndex, in.startTabOffset); + JavaProblem p = JavaProblem.fromIProblem(iproblem, in.tabIndex, line, badCode); + p.setPDEOffsets(in.startTabOffset, in.stopTabOffset); + return p; + } + return null; + } + + + static private boolean isUndefinedTypeProblem(IProblem iproblem) { + int id = iproblem.getID(); + return id == IProblem.UndefinedType || + id == IProblem.UndefinedName || + id == IProblem.UnresolvedVariable; + } + + + static private boolean isMissingBraceProblem(IProblem iproblem) { + if (iproblem.getID() == IProblem.ParsingErrorInsertToComplete) { + char brace = iproblem.getArguments()[0].charAt(0); + return brace == '{' || brace == '}'; + + } else if (iproblem.getID() == IProblem.ParsingErrorInsertTokenAfter) { + char brace = iproblem.getArguments()[1].charAt(0); + return brace == '{' || brace == '}'; + } + return false; + } + + + static private final Pattern CURLY_QUOTE_REGEX = + Pattern.compile("([“”‘’])", Pattern.UNICODE_CHARACTER_CLASS); + + static private List checkForCurlyQuotes(PreprocessedSketch ps) { + List problems = new ArrayList<>(0); + + // Go through the scrubbed code and look for curly quotes (they should not be any) + Matcher matcher = CURLY_QUOTE_REGEX.matcher(ps.scrubbedPdeCode); + while (matcher.find()) { + int pdeOffset = matcher.start(); + String q = matcher.group(); + + int tabIndex = ps.pdeOffsetToTabIndex(pdeOffset); + int tabOffset = ps.pdeOffsetToTabOffset(tabIndex, pdeOffset); + int tabLine = ps.tabOffsetToTabLine(tabIndex, tabOffset); + + String message = Language.interpolate("editor.status.bad_curly_quote", q); + JavaProblem problem = new JavaProblem(message, JavaProblem.ERROR, tabIndex, tabLine); + problem.setPDEOffsets(tabOffset, tabOffset+1); + + problems.add(problem); + } + + + // Go through iproblems and look for problems involving curly quotes + List problems2 = new ArrayList<>(0); + IProblem[] iproblems = ps.compilationUnit.getProblems(); + + for (IProblem iproblem : iproblems) { + switch (iproblem.getID()) { + case IProblem.ParsingErrorDeleteToken: + case IProblem.ParsingErrorDeleteTokens: + case IProblem.ParsingErrorInvalidToken: + case IProblem.ParsingErrorReplaceTokens: + case IProblem.UnterminatedString: + SketchInterval in = ps.mapJavaToSketch(iproblem); + if (in == SketchInterval.BEFORE_START) continue; + String badCode = ps.getPdeCode(in); + matcher.reset(badCode); + while (matcher.find()) { + int offset = matcher.start(); + String q = matcher.group(); + int tabStart = in.startTabOffset + offset; + int tabStop = tabStart + 1; + // Prevent duplicate problems + if (problems.stream().noneMatch(p -> p.getStartOffset() == tabStart)) { + int line = ps.tabOffsetToTabLine(in.tabIndex, tabStart); + String message; + if (iproblem.getID() == IProblem.UnterminatedString) { + message = Language.interpolate("editor.status.unterm_string_curly", q); + } else { + message = Language.interpolate("editor.status.bad_curly_quote", q); + } + JavaProblem p = new JavaProblem(message, JavaProblem.ERROR, in.tabIndex, line); + p.setPDEOffsets(tabStart, tabStop); + problems2.add(p); + } + } + } + } + + problems.addAll(problems2); + + return problems; + } + + + static private List checkForMissingBraces(PreprocessedSketch ps) { + List problems = new ArrayList<>(0); + for (int tabIndex = 0; tabIndex < ps.tabStartOffsets.length; tabIndex++) { + int tabStartOffset = ps.tabStartOffsets[tabIndex]; + int tabEndOffset = (tabIndex < ps.tabStartOffsets.length - 1) ? + ps.tabStartOffsets[tabIndex + 1] : ps.scrubbedPdeCode.length(); + int[] braceResult = SourceUtils.checkForMissingBraces(ps.scrubbedPdeCode, tabStartOffset, tabEndOffset); + if (braceResult[0] != 0) { + JavaProblem problem = + new JavaProblem(braceResult[0] < 0 + ? Language.interpolate("editor.status.missing.left_curly_bracket") + : Language.interpolate("editor.status.missing.right_curly_bracket"), + JavaProblem.ERROR, tabIndex, braceResult[1]); + problem.setPDEOffsets(braceResult[3], braceResult[3] + 1); + problems.add(problem); + } + } + + if (problems.isEmpty()) { + return problems; + } + + int problemTabIndex = problems.get(0).getTabIndex(); + + IProblem missingBraceProblem = Arrays.stream(ps.compilationUnit.getProblems()) + .filter(ErrorChecker::isMissingBraceProblem) + // Ignore if it is at the end of file + .filter(p -> p.getSourceEnd() + 1 < ps.javaCode.length()) + // Ignore if the tab number does not match our detected tab number + .filter(p -> problemTabIndex == ps.mapJavaToSketch(p).tabIndex) + .findFirst() + .orElse(null); + + // Prefer ECJ problem, shows location more accurately + if (missingBraceProblem != null) { + JavaProblem p = convertIProblem(missingBraceProblem, ps); + if (p != null) { + problems.clear(); + problems.add(p); + } + } + + return problems; + } + + + static public String[] getImportSuggestions(ClassPath cp, String className) { + className = className.replace("[", "\\[").replace("]", "\\]"); + RegExpResourceFilter regf = new RegExpResourceFilter( + Pattern.compile(".*"), + Pattern.compile("(.*\\$)?" + className + "\\.class", + Pattern.CASE_INSENSITIVE)); + + String[] resources = cp.findResources("", regf); + return Arrays.stream(resources) + // remove ".class" suffix + .map(res -> res.substring(0, res.length() - 6)) + // replace path separators with dots + .map(res -> res.replace('/', '.')) + // replace inner class separators with dots + .map(res -> res.replace('$', '.')) + // sort, prioritize clases from java. package + .sorted((o1, o2) -> { + // put java.* first, should be prioritized more + boolean o1StartsWithJava = o1.startsWith("java"); + boolean o2StartsWithJava = o2.startsWith("java"); + if (o1StartsWithJava != o2StartsWithJava) { + if (o1StartsWithJava) return -1; + return 1; + } + return o1.compareTo(o2); + }) + .toArray(String[]::new); + } +} \ No newline at end of file diff --git a/java/src/processing/mode/java/pdex/ErrorCheckerService.java b/java/src/processing/mode/java/pdex/ErrorCheckerService.java deleted file mode 100644 index 5fba371b60..0000000000 --- a/java/src/processing/mode/java/pdex/ErrorCheckerService.java +++ /dev/null @@ -1,1641 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -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. -*/ - -package processing.mode.java.pdex; - -import java.io.File; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import javax.swing.table.DefaultTableModel; -import javax.swing.text.BadLocationException; -import javax.swing.text.Document; -import javax.swing.text.Element; -import javax.swing.text.PlainDocument; - -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.compiler.IProblem; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.ASTParser; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; - -import processing.app.Library; -import processing.app.Messages; -import processing.app.Sketch; -import processing.app.SketchCode; -import processing.app.Util; -import processing.app.syntax.SyntaxDocument; -import processing.app.ui.Editor; -import processing.app.ui.EditorStatus; -import processing.core.PApplet; -import processing.mode.java.JavaMode; -import processing.mode.java.JavaEditor; -import processing.mode.java.preproc.PdePreprocessor; - - -/** - * The main error checking service - */ -@SuppressWarnings("unchecked") -public class ErrorCheckerService implements Runnable { - - protected JavaEditor editor; - - /** Error check happens every sleepTime milliseconds */ - public static final int sleepTime = 1000; - - /** The amazing eclipse ast parser */ - protected ASTParser parser; - - /** - * Used to indirectly stop the Error Checker Thread - */ - protected AtomicBoolean stopThread; - - /** - * If true, Error Checking is paused. Calls to checkCode() become useless. - */ - protected AtomicBoolean pauseThread; - - //protected ErrorWindow errorWindow; - - /** - * IProblem[] returned by parser stored in here - */ - protected IProblem[] problems; - - /** - * Class name of current sketch - */ - protected String className; - - /** - * Source code of current sketch - */ - protected String sourceCode; - - /** - * URLs of extra imports jar files stored here. - */ - protected URL[] classPath; - - /** - * Stores all Problems in the sketch - */ - public List problemsList; - - /** - * How many lines are present till the initial class declaration? In static - * mode, this would include imports, class declaration and setup - * declaration. In nomral mode, this would include imports, class - * declaration only. It's fate is decided inside preprocessCode() - */ - public int mainClassOffset; - - /** - * Fixed p5 offsets for all sketches - */ - public int defaultImportsOffset; - - /** - * Is the sketch running in static mode or active mode? - */ - public boolean staticMode = false; - - /** - * Compilation Unit for current sketch - */ - protected CompilationUnit cu; - - /** - * The Compilation Unit generated during compile check - */ - protected CompilationUnit compileCheckCU; - - /** - * This Compilation Unit points to the last error free CU - */ - protected CompilationUnit lastCorrectCU; - - /** - * If true, compilation checker will be reloaded with updated classpath - * items. - */ - protected boolean loadCompClass = true; - - /** - * Compiler Checker class. Note that methods for compilation checking are - * called from the compilationChecker object, not from this - */ - protected Class checkerClass; - - /** - * Compilation Checker object. - */ - protected CompilationChecker compilationChecker; - - - /** - * List of jar files to be present in compilation checker's classpath - */ - protected List classpathJars; - - /** - * Timestamp - for measuring total overhead - */ - protected long lastTimeStamp = System.currentTimeMillis(); - - /** - * Used for displaying the rotating slash on the Problem Window title bar - */ - protected String[] slashAnimation = { "|", "/", "--", "\\", "|", "/", "--", - "\\" }; - protected int slashAnimationIndex = 0; - - /** - * Used to detect if the current tab index has changed and thus repaint the - * textarea. - */ - public int currentTab = 0, lastTab = 0; - - /** - * Stores the current import statements in the program. Used to compare for - * changed import statements and update classpath if needed. - */ - protected ArrayList programImports; - - /** - * List of imports when sketch was last checked. Used for checking for - * changed imports - */ - protected ArrayList previousImports = new ArrayList(); - - /** - * Teh Preprocessor - */ - protected XQPreprocessor xqpreproc; - - /** - * Regexp for import statements. (Used from Processing source) - */ - final public String importRegexp = "(?:^|;)\\s*(import\\s+)((?:static\\s+)?\\S+)(\\s*;)"; - - /** - * Regexp for function declarations. (Used from Processing source) - */ - final Pattern FUNCTION_DECL = Pattern - .compile("(^|;)\\s*((public|private|protected|final|static)\\s+)*" - + "(void|int|float|double|String|char|byte|boolean)" - + "(\\s*\\[\\s*\\])?\\s+[a-zA-Z0-9]+\\s*\\(", Pattern.MULTILINE); - - protected ErrorMessageSimplifier errorMsgSimplifier; - - public ErrorCheckerService(JavaEditor debugEditor) { - this.editor = debugEditor; - stopThread = new AtomicBoolean(false); - pauseThread = new AtomicBoolean(false); - - problemsList = new ArrayList(); - classpathJars = new ArrayList(); - - initParser(); - //initializeErrorWindow(); - xqpreproc = new XQPreprocessor(); - PdePreprocessor pdePrepoc = new PdePreprocessor(null); - defaultImportsOffset = pdePrepoc.getCoreImports().length + - pdePrepoc.getDefaultImports().length + 1; - astGenerator = new ASTGenerator(this); - syntaxErrors = new AtomicBoolean(true); - containsErrors = new AtomicBoolean(true); - errorMsgSimplifier = new ErrorMessageSimplifier(); - tempErrorLog = new TreeMap(); - sketchChangedListener = new SketchChangedListener(); -// for (final SketchCode sc : editor.getSketch().getCode()) { -// sc.getDocument().addDocumentListener(sketchChangedListener); -// } - } - - /** - * Initializes ASTParser - */ - protected void initParser() { - try { - parser = ASTParser.newParser(AST.JLS8); - } catch (Exception e) { - System.err.println("Experimental Mode initialization failed. " - + "Are you running the right version of Processing? "); - pauseThread(); - } catch (Error e) { - System.err.println("Experimental Mode initialization failed. "); - e.printStackTrace(); - pauseThread(); - } - } - - - /** - * Error checking doesn't happen before this interval has ellapsed since the - * last runManualErrorCheck() call. - */ - private final static long errorCheckInterval = 500; - - - /** - * Bypass sleep time - */ - private volatile boolean noSleep = false; - - - /** - * The way the error checking happens is: DocumentListeners are added - * to each SketchCode object. Whenever the document is edited, runManualErrorCheck() - * is called. Internally, an atomic integer counter is incremented. - * The ECS thread checks the value of this counter evey sleepTime seconds. - * If the counter is non zero, error checking is done(in the ECS thread) - * and the counter is reset. - */ - public void run() { - stopThread.set(false); - - checkCode(); - lastErrorCheckCall = System.currentTimeMillis(); - - if (!hasSyntaxErrors()) { -// editor.showProblemListView(Language.text("editor.footer.console")); - editor.showConsole(); - } - // Make sure astGen has at least one CU to start with - // This is when the loaded sketch already has syntax errors. - // Completion wouldn't be complete, but it'd be still something - // better than nothing - astGenerator.buildAST(cu); - handleErrorCheckingToggle(); - while (!stopThread.get()) { - try { - // Take a nap. - if(!noSleep) { - Thread.sleep(sleepTime); - } - else { - noSleep = false; - Messages.log("Didn't sleep!"); - } - } catch (Exception e) { - Messages.log("Oops! [ErrorCheckerThreaded]: " + e); - // e.printStackTrace(); - } - - updatePaintedThingys(); - updateEditorStatus(); - updateSketchCodeListeners(); - if (pauseThread.get()) - continue; - if(textModified.get() == 0) - continue; - // Check if a certain interval has passed after the call. Only then - // begin error check. Helps prevent unnecessary flickering. See #2677 - if (System.currentTimeMillis() - lastErrorCheckCall > errorCheckInterval) { - Messages.log("Interval passed, starting error check"); - checkCode(); - checkForMissingImports(); - } - } - - astGenerator.disposeAllWindows(); - compilationChecker = null; - checkerClass = null; - classLoader = null; - System.gc(); - Messages.loge("Thread stopped: " + editor.getSketch().getName()); - System.gc(); - } - - - protected void updateSketchCodeListeners() { - for (final SketchCode sc : editor.getSketch().getCode()) { - boolean flag = false; - if (sc.getDocument() == null - || ((SyntaxDocument) sc.getDocument()).getDocumentListeners() == null) - continue; - for (DocumentListener dl : ((SyntaxDocument)sc.getDocument()).getDocumentListeners()) { - if(dl.equals(sketchChangedListener)){ - flag = true; - break; - } - } - if(!flag){ - // log("Adding doc listener to " + sc.getPrettyName()); - sc.getDocument().addDocumentListener(sketchChangedListener); - } - } - } - - - protected void checkForMissingImports() { - if (JavaMode.importSuggestEnabled) { - for (Problem p : problemsList) { - if(p.getIProblem().getID() == IProblem.UndefinedType) { - String args[] = p.getIProblem().getArguments(); - if (args.length > 0) { - String missingClass = args[0]; - Messages.log("Will suggest for type:" + missingClass); - //astGenerator.suggestImports(missingClass); - } - } - } - } - } - - - protected ASTGenerator astGenerator; - - public ASTGenerator getASTGenerator() { - return astGenerator; - } - - - /** - * This thing acts as an event queue counter of sort. - * Since error checking happens on demand, anytime this counter - * goes above 0, error check is triggered, and counter reset. - * It's thread safe to avoid any mess. - */ - protected AtomicInteger textModified = new AtomicInteger(); - - - /** - * Time stamp of last runManualErrorCheck() call. - */ - private volatile long lastErrorCheckCall = 0; - - - /** - * Triggers error check - */ - public void runManualErrorCheck() { - // log("Error Check."); - textModified.incrementAndGet(); - lastErrorCheckCall = System.currentTimeMillis(); - } - - - // TODO: Experimental, lookout for threading related issues - public void quickErrorCheck() { - noSleep = true; - } - - - protected SketchChangedListener sketchChangedListener; - protected class SketchChangedListener implements DocumentListener{ - - private SketchChangedListener(){ - } - - @Override - public void insertUpdate(DocumentEvent e) { - if (JavaMode.errorCheckEnabled) { - runManualErrorCheck(); - //log("doc insert update, man error check.."); - } - } - - @Override - public void removeUpdate(DocumentEvent e) { - if (JavaMode.errorCheckEnabled){ - runManualErrorCheck(); - //log("doc remove update, man error check.."); - } - } - - @Override - public void changedUpdate(DocumentEvent e) { - if (JavaMode.errorCheckEnabled){ - runManualErrorCheck(); - //log("doc changed update, man error check.."); - } - } - - } - - /** - * state = 1 > syntax check done
    - * state = 2 > compilation check done - */ - public int compilationUnitState = 0; - - protected boolean checkCode() { - // log("checkCode() " + textModified.get()); - lastTimeStamp = System.currentTimeMillis(); - try { - sourceCode = preprocessCode(editor.getSketch().getMainProgram()); - compilationUnitState = 0; - syntaxCheck(); - // log(editor.getSketch().getName() + "1 MCO " + mainClassOffset); - // No syntax errors, proceed for compilation check, Stage 2. - - //if(hasSyntaxErrors()) astGenerator.buildAST(null); - if (!hasSyntaxErrors()) { - - } - if (problems.length == 0 && !editor.hasJavaTabs()) { - //mainClassOffset++; // just a hack. - - sourceCode = xqpreproc.doYourThing(sourceCode, programImports); - prepareCompilerClasspath(); -// mainClassOffset = xqpreproc.mainClassOffset; // tiny, but -// // significant -// if (staticMode) { -// mainClassOffset++; // Extra line for setup() decl. -// } - // log(sourceCode); - // log("--------------------------"); - compileCheck(); - // log(editor.getSketch().getName() + "2 MCO " + mainClassOffset); - } - - astGenerator.buildAST(cu); - if (!JavaMode.errorCheckEnabled) { - problemsList.clear(); - Messages.log("Error Check disabled, so not updating UI."); - } - calcPdeOffsetsForProbList(); - updateErrorTable(); - editor.updateErrorBar(problemsList); - updateEditorStatus(); - editor.getTextArea().repaint(); - updatePaintedThingys(); - editor.updateErrorToggle(); - - int x = textModified.get(); - //log("TM " + x); - if (x >= 2) { - textModified.set(2); - x = 2; - } - - if (x > 0) - textModified.set(x - 1); - else - textModified.set(0); - return true; - - } catch (Exception e) { - Messages.log("Oops! [ErrorCheckerService.checkCode]: " + e); - e.printStackTrace(); - } - return false; - } - - protected AtomicBoolean syntaxErrors, containsErrors; - - public boolean hasSyntaxErrors(){ - return syntaxErrors.get(); - } - - public boolean hasErrors(){ - return containsErrors.get(); - } - - public TreeMap tempErrorLog; - - protected void syntaxCheck() { - syntaxErrors.set(true); - containsErrors.set(true); - parser.setSource(sourceCode.toCharArray()); - parser.setKind(ASTParser.K_COMPILATION_UNIT); - - Map options = JavaCore.getOptions(); - - JavaCore.setComplianceOptions(JavaCore.VERSION_1_6, options); - options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_6); - options.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED); - parser.setCompilerOptions(options); - - if (cu == null) - cu = (CompilationUnit) parser.createAST(null); - else { - synchronized (cu) { - cu = (CompilationUnit) parser.createAST(null); - } - } - compilationUnitState = 1; - synchronized (problemsList) { - - // Store errors returned by the ast parser - problems = cu.getProblems(); - // log("Problem Count: " + problems.length); - // Populate the probList - problemsList = new ArrayList(); - for (int i = 0; i < problems.length; i++) { - int a[] = calculateTabIndexAndLineNumber(problems[i].getSourceLineNumber()); - Problem p = new Problem(problems[i], a[0], a[1]); - problemsList.add(p); -// log(problems[i].getMessage()); -// for (String j : problems[i].getArguments()) { -// log("arg " + j); -// } - // log(p.toString()); - } - - if (problems.length == 0) { - syntaxErrors.set(false); - containsErrors.set(false); - parser.setSource(sourceCode.toCharArray()); - parser.setKind(ASTParser.K_COMPILATION_UNIT); - parser.setCompilerOptions(options); - lastCorrectCU = (CompilationUnit) parser.createAST(null); - } else { - syntaxErrors.set(true); - containsErrors.set(true); - } - } - } - - protected URLClassLoader classLoader; - - protected void compileCheck() { - // CU needs to be updated coz before compileCheck xqpreprocessor is run on - // the source code which makes some further changes - //TODO Check if this breaks things - - parser.setSource(sourceCode.toCharArray()); - parser.setKind(ASTParser.K_COMPILATION_UNIT); - - Map options = JavaCore.getOptions(); - - JavaCore.setComplianceOptions(JavaCore.VERSION_1_6, options); - options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_6); - options.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED); - parser.setCompilerOptions(options); - - if (compileCheckCU == null) { - compileCheckCU = (CompilationUnit) parser.createAST(null); - } else { - synchronized (compileCheckCU) { - compileCheckCU = (CompilationUnit) parser.createAST(null); - } - } - if (!hasSyntaxErrors()) { - lastCorrectCU = compileCheckCU; - } - cu = compileCheckCU; - - compilationUnitState = 2; - // Currently (Sept, 2012) I'm using Java's reflection api to load the - // CompilationChecker class(from CompilationChecker.jar) that houses the - // Eclispe JDT compiler, and call its getErrorsAsObj method to obtain - // errors. This way, I'm able to add the paths of contributed libraries - // to the classpath of CompilationChecker, dynamically. The eclipse compiler - // needs all referenced libraries in the classpath. Totally a hack. If you find - // a better method, do let me know. - - try { - // NOTE TO SELF: If classpath contains null Strings - // URLClassLoader shoots NPE bullets. - - // If imports have changed, reload classes with new classpath. - if (loadCompClass) { - classPath = new URL[classpathJars.size()]; - classpathJars.toArray(classPath); - - compilationChecker = null; - classLoader = null; - System.gc(); - // log("CP Len -- " + classpath.length); - classLoader = new URLClassLoader(classPath); - compilationChecker = new CompilationChecker(); - loadCompClass = false; - } - - if (compilerSettings == null) { - prepareCompilerSetting(); - } - - synchronized (problemsList) { - problems = compilationChecker.getErrors(className, sourceCode, - compilerSettings, classLoader); - if (problems == null) { - return; - } - - for (IProblem problem : problems) { - // added a -1 to line number because in compile check code - // an extra package statement is added, so all line numbers - // are increased by 1 - int[] a = calculateTabIndexAndLineNumber(problem.getSourceLineNumber() - 1); - - Problem p = new Problem(problem, a[0], a[1]); - if (problem.isError()) { - p.setType(Problem.ERROR); - containsErrors.set(true); // set flag - } - - if (problem.isWarning()) { - p.setType(Problem.WARNING); - } - - // If warnings are disabled, skip 'em - if (p.isWarning() && !JavaMode.warningsEnabled) { - continue; - } - problemsList.add(p); - } - } - - } catch (Exception e) { - System.err.println("compileCheck() problem." + e); - e.printStackTrace(); - pauseThread(); - - } catch (NoClassDefFoundError e) { - e.printStackTrace(); - pauseThread(); - - } catch(OutOfMemoryError e) { - System.err.println("Out of memory while checking for errors."); - System.err.println("Close some sketches and then re-open this sketch."); - pauseThread(); - } - } - - - /** - * Calculates PDE Offsets from Java Offsets for Problems - */ - private void calcPdeOffsetsForProbList() { - try { - PlainDocument javaSource = new PlainDocument(); - - javaSource.insertString(0, sourceCode, null); - // Code in pde tabs stored as PlainDocument - List pdeTabs = new ArrayList<>(); - for (SketchCode sc : editor.getSketch().getCode()) { - PlainDocument tab = new PlainDocument(); - if (editor.getSketch().getCurrentCode().equals(sc)) { - Document doc = sc.getDocument(); - tab.insertString(0, doc.getText(0, doc.getLength()), null); - } else { - tab.insertString(0, sc.getProgram(), null); - } - pdeTabs.add(tab); - } - int pkgNameOffset = ("package " + className + ";\n").length(); - // package name is added only during compile check - if (compilationUnitState != 2) { - pkgNameOffset = 0; - } - - for (Problem p : problemsList) { - int prbStart = p.getIProblem().getSourceStart() - pkgNameOffset; - int prbEnd = p.getIProblem().getSourceEnd() - pkgNameOffset; - int javaLineNumber = p.getSourceLineNumber() - 1; - // not sure if this is necessary [fry 150808] - if (compilationUnitState == 2) { - javaLineNumber--; - } - // errors on the first line were setting this to -1 [fry 150808] - if (javaLineNumber < 0) { - javaLineNumber = 0; - } - Element lineElement = - javaSource.getDefaultRootElement().getElement(javaLineNumber); - if (lineElement == null) { - Messages.log("calcPDEOffsetsForProbList(): " + - "Couldn't fetch Java line number " + - javaLineNumber + "\nProblem: " + p); - p.setPDEOffsets(-1, -1); - continue; - } - int lineStart = lineElement.getStartOffset(); - int lineLength = lineElement.getEndOffset() - lineStart; - String javaLine = javaSource.getText(lineStart, lineLength); - - Document doc = pdeTabs.get(p.getTabIndex()); - Element pdeLineElement = - doc.getDefaultRootElement().getElement(p.getLineNumber()); - if (pdeLineElement == null) { - Messages.log("calcPDEOffsetsForProbList(): " + - "Couldn't fetch pde line number " + - javaLineNumber + "\nProblem: " + p); - p.setPDEOffsets(-1,-1); - continue; - } - int pdeLineStart = pdeLineElement.getStartOffset(); - int pdeLineLength = pdeLineElement.getEndOffset() - pdeLineStart; - String pdeLine = - pdeTabs.get(p.getTabIndex()).getText(pdeLineStart, pdeLineLength); - OffsetMatcher ofm = new OffsetMatcher(pdeLine, javaLine); - int pdeOffset = - ofm.getPdeOffForJavaOff(prbStart - lineStart, prbEnd - prbStart + 1); - p.setPDEOffsets(pdeOffset, pdeOffset + prbEnd - prbStart); - } - } catch (BadLocationException ble) { - ble.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - - public CompilationUnit getLastCorrectCU() { - return lastCorrectCU; - } - - - public CompilationUnit getLatestCU() { - return compileCheckCU; - } - - - private int loadClassCounter = 0; - - public URLClassLoader getSketchClassLoader() { - loadClassCounter++; - if (loadClassCounter > 100) { - loadClassCounter = 0; - classLoader = null; - System.gc(); - classLoader = new URLClassLoader(classPath); - } - return classLoader; - } - - - /** - * Processes import statements to obtain class paths of contributed - * libraries. This would be needed for compilation check. Also, adds - * stuff(jar files, class files, candy) from the code folder. And it looks - * messed up. - */ - protected void prepareCompilerClasspath() { - if (!loadCompClass) { - return; - } - - synchronized (classpathJars) { - // log("1.."); - classpathJars = new ArrayList(); - String entry = ""; - boolean codeFolderChecked = false; - for (ImportStatement impstat : programImports) { - String item = impstat.getImportName(); - int dot = item.lastIndexOf('.'); - entry = (dot == -1) ? item : item.substring(0, dot); - - entry = entry.substring(6).trim(); - // log("Entry--" + entry); - if (ignorableImport(entry)) { - // log("Ignoring: " + entry); - continue; - } - Library library = null; - - // Try to get the library classpath and add it to the list - try { - library = editor.getMode().getLibrary(entry); - String[] libraryPath = - PApplet.split(library.getClassPath().substring(1).trim(), - File.pathSeparatorChar); - for (String pathItem : libraryPath) { - classpathJars.add(new File(pathItem).toURI().toURL()); - } - } catch (Exception e) { - if (library == null && !codeFolderChecked) { - // Look around in the code folder for jar files - if (editor.getSketch().hasCodeFolder()) { - File codeFolder = editor.getSketch().getCodeFolder(); - - // get a list of .jar files in the "code" folder - // (class files in subfolders should also be picked up) - String codeFolderClassPath = Util.contentsToClassPath(codeFolder); - codeFolderChecked = true; - // huh? doesn't this mean .length() == 0? [fry] - if (codeFolderClassPath.equalsIgnoreCase("")) { - System.err.format("Cannot find \"%s\" library. Line %d in tab %s%n", - entry, impstat.getLineNumber(), - editor.getSketch().getCode(impstat.getTab()).getPrettyName()); - System.err.println("Make sure that the library is installed properly."); - - } else { - String codeFolderPath[] = - PApplet.split(codeFolderClassPath.substring(1).trim(), - File.pathSeparatorChar); - try { - for (String pathItem : codeFolderPath) { - classpathJars.add(new File(pathItem).toURI().toURL()); - } - } catch (Exception e2) { - e2.printStackTrace(); - } - } - } else { - System.err.format("Cannot find \"%s\" library. Line %d in tab %s%n", - entry, impstat.getLineNumber(), - editor.getSketch().getCode(impstat.getTab()).getPrettyName()); - } - - } else { - new Exception("Error while handling '" + entry + "'", e).printStackTrace(); - } - } - } - } - - new Thread(new Runnable() { - public void run() { - astGenerator.loadJars(); // update jar file for completion lookup - } - }).start(); - } - - - /** - * Ignore processing packages, java.*.*. etc. - */ - protected boolean ignorableImport(String packageName) { - return (packageName.startsWith("java.") || - packageName.startsWith("javax.")); - } - - - /** Options for the JDT Compiler */ - protected Map compilerSettings; - - - /** Set compiler options for JDT Compiler */ - protected void prepareCompilerSetting() { - compilerSettings = new HashMap(); - - compilerSettings.put(CompilerOptions.OPTION_LineNumberAttribute, - CompilerOptions.GENERATE); - compilerSettings.put(CompilerOptions.OPTION_SourceFileAttribute, - CompilerOptions.GENERATE); - compilerSettings.put(CompilerOptions.OPTION_Source, - CompilerOptions.VERSION_1_8); - compilerSettings.put(CompilerOptions.OPTION_ReportUnusedImport, - CompilerOptions.IGNORE); - compilerSettings.put(CompilerOptions.OPTION_ReportMissingSerialVersion, - CompilerOptions.IGNORE); - compilerSettings.put(CompilerOptions.OPTION_ReportRawTypeReference, - CompilerOptions.IGNORE); - compilerSettings.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, - CompilerOptions.IGNORE); - } - - - /** - * Updates the error table in the Error Window. - */ - public void updateErrorTable() { - try { - String[][] errorData = new String[problemsList.size()][3]; - int index = 0; -// for (int i = 0; i < problemsList.size(); i++) { - for (Problem p : problemsList) { - errorData[index][0] = p.getMessage(); - errorData[index][1] = editor.getSketch().getCode(p.getTabIndex()).getPrettyName(); - errorData[index][2] = Integer.toString(p.getLineNumber() + 1); - // Added +1 because lineNumbers internally are 0-indexed - -// //TODO: This is temporary -// if (tempErrorLog.size() < 200) { -// tempErrorLog.put(p.getMessage(), p.getIProblem()); -// } - - if (JavaMode.importSuggestEnabled) { - if (p.getIProblem().getID() == IProblem.UndefinedType) { - String[] args = p.getIProblem().getArguments(); - if (args.length > 0) { - String missingClass = args[0]; - String[] si = astGenerator.getSuggestImports(missingClass); - if (si != null && si.length > 0) { - p.setImportSuggestions(si); - errorData[index][0] = "" + p.getMessage() + - " (Import Suggestions available)"; - } - } - } - } - index++; - } - - DefaultTableModel tm = - new DefaultTableModel(errorData, XQErrorTable.columnNames); - editor.updateTable(tm); - - } catch (Exception e) { - Messages.loge("Exception at updateErrorTable()", e); - e.printStackTrace(); - pauseThread(); - } - } - - - /** Repaints the textarea if required */ - private void updatePaintedThingys() { -// currentTab = editor.getSketch().getCodeIndex(editor.getSketch().getCurrentCode()); - currentTab = editor.getSketch().getCurrentCodeIndex(); - //log("Tab changed " + currentTab + " LT " + lastTab); - if (currentTab != lastTab) { - textModified.set(5); - lastTab = currentTab; - editor.getTextArea().repaint(); - editor.statusEmpty(); - } - } - - - protected int lastCaretLine = -1; - - /** - * Updates editor status bar, depending on whether the caret is on an error - * line or not - */ - private void updateEditorStatus() { - if (editor.getStatusMode() == EditorStatus.EDIT) return; - - // editor.statusNotice("Position: " + - // editor.getTextArea().getCaretLine()); - if (JavaMode.errorCheckEnabled) { - synchronized (editor.getErrorPoints()) { - for (ErrorMarker emarker : editor.getErrorPoints()) { - if (emarker.getProblem().getLineNumber() == editor.getTextArea().getCaretLine()) { - if (emarker.getType() == ErrorMarker.Warning) { - editor.statusMessage(emarker.getProblem().getMessage(), - JavaEditor.STATUS_INFO); - } else { - editor.statusMessage(emarker.getProblem().getMessage(), - JavaEditor.STATUS_COMPILER_ERR); - } - return; - } - } - } - } - - // This line isn't an error line anymore, so probably just clear it - if (editor.statusMessageType == JavaEditor.STATUS_COMPILER_ERR) { - editor.statusEmpty(); - return; - } -// if (editor.ta.getCaretLine() != lastCaretLine) { -// editor.statusEmpty(); -// lastCaretLine = editor.ta.getCaretLine(); -// } - } - - - /** - * Maps offset from java code to pde code. Returns a bunch of offsets as array - * - * @param line - * - line number in java code - * @param offset - * - offset from the start of the 'line' - * @return int[0] - tab number, int[1] - line number in the int[0] tab, int[2] - * - line start offset, int[3] - offset from line start. int[2] and - * int[3] are on TODO - */ - protected int[] JavaToPdeOffsets(int line, int offset) { - int codeIndex = 0; - - int x = line - mainClassOffset; - if (x < 0) { - // log("Negative line number " - // + problem.getSourceLineNumber() + " , offset " - // + mainClassOffset); - x = line - 2; // Another -1 for 0 index - if (x < programImports.size() && x >= 0) { - ImportStatement is = programImports.get(x); - // log(is.importName + ", " + is.tab + ", " - // + is.lineNumber); - return new int[] { is.getTab(), is.getLineNumber() }; - } else { - - // Some seriously ugly stray error, just can't find the source - // line! Simply return first line for first tab. - return new int[] { 0, 1 }; - } - - } - - try { - for (SketchCode sc : editor.getSketch().getCode()) { - if (sc.isExtension("pde")) { - int len = 0; - if (editor.getSketch().getCurrentCode().equals(sc)) { - len = Util.countLines(sc.getDocument().getText(0, sc.getDocument().getLength())) + 1; - } else { - len = Util.countLines(sc.getProgram()) + 1; - } - - // log("x,len, CI: " + x + "," + len + "," - // + codeIndex); - - if (x >= len) { - - // We're in the last tab and the line count is greater - // than the no. - // of lines in the tab, - if (codeIndex >= editor.getSketch().getCodeCount() - 1) { - // log("Exceeds lc " + x + "," + len - // + problem.toString()); - // x = len - x = editor.getSketch().getCode(codeIndex) - .getLineCount(); - // TODO: Obtain line having last non-white space - // character in the code. - break; - } else { - x -= len; - codeIndex++; - } - } else { - - if (codeIndex >= editor.getSketch().getCodeCount()) { - codeIndex = editor.getSketch().getCodeCount() - 1; - } - break; - } - - } - } - } catch (Exception e) { - System.err.println("Error inside ErrorCheckerService.JavaToPdeOffset()"); - e.printStackTrace(); - } - return new int[] { codeIndex, x }; - } - - - protected String getPdeCodeAtLine(int tab, int linenumber){ - if(linenumber < 0) return null; - editor.getSketch().setCurrentCode(tab); - return editor.getTextArea().getLineText(linenumber); - } - - - /** - * Calculates the tab number and line number of the error in that particular - * tab. Provides mapping between pure java and pde code. - * - * @param problem - * - IProblem - * @return int[0] - tab number, int[1] - line number - */ - protected int[] calculateTabIndexAndLineNumber(int javalineNumber) { - // String[] lines = {};// = PApplet.split(sourceString, '\n'); - int codeIndex = 0; - - int x = javalineNumber - mainClassOffset; - if (x < 0) { - // log("Negative line number " - // + problem.getSourceLineNumber() + " , offset " - // + mainClassOffset); - x = javalineNumber - 2; // Another -1 for 0 index - if (x < programImports.size() && x >= 0) { - ImportStatement is = programImports.get(x); - // log(is.importName + ", " + is.tab + ", " - // + is.lineNumber); - return new int[] { is.getTab(), is.getLineNumber() }; - } else { - - // Some seriously ugly stray error, just can't find the source - // line! Simply return first line for first tab. - return new int[] { 0, 1 }; - } - - } - - try { - for (SketchCode sc : editor.getSketch().getCode()) { - if (sc.isExtension("pde")) { - int len = 0; - if (editor.getSketch().getCurrentCode().equals(sc)) { - len = Util.countLines(sc.getDocument().getText(0, sc.getDocument().getLength())) + 1; - } else { - len = Util.countLines(sc.getProgram()) + 1; - } - - // log("x,len, CI: " + x + "," + len + "," - // + codeIndex); - - if (x >= len) { - - // We're in the last tab and the line count is greater - // than the no. - // of lines in the tab, - if (codeIndex >= editor.getSketch().getCodeCount() - 1) { - // log("Exceeds lc " + x + "," + len - // + problem.toString()); - // x = len - x = editor.getSketch().getCode(codeIndex) - .getLineCount(); - // TODO: Obtain line having last non-white space - // character in the code. - break; - } else { - x -= len; - codeIndex++; - } - } else { - if (codeIndex >= editor.getSketch().getCodeCount()) { - codeIndex = editor.getSketch().getCodeCount() - 1; - } - break; - } - } - } - } catch (Exception e) { - System.err.println("Things got messed up in ErrorCheckerService.calculateTabIndexAndLineNumber()"); - } - return new int[] { codeIndex, x }; - } - - - /** - * Returns line number of corresponding java source - */ - protected int getJavaLineNumFromPDElineNum(int tab, int pdeLineNum){ - int jLineNum = programImports.size() + 1; - for (int i = 0; i < tab; i++) { - SketchCode sc = editor.getSketch().getCode(i); - int len = Util.countLines(sc.getProgram()) + 1; - jLineNum += len; - } - return jLineNum; - } - - - /** - * Fetches code from the editor tabs and pre-processes it into parsable pure - * java source. And there's a difference between parsable and compilable. - * XQPrerocessor.java makes this code compilable.
    - * Handles:
  • Removal of import statements
  • Conversion of int(), - * char(), etc to PApplet.parseInt(), etc.
  • Replacing '#' with 0xff for - * color representation
  • Converts all 'color' datatypes to int - * (experimental)
  • Appends class declaration statement after determining - * the mode the sketch is in - ACTIVE or STATIC - * - * @return String - Pure java representation of PDE code. Note that this - * code is not yet compile ready. - */ - protected String preprocessCode(String pdeCode) { - programImports = new ArrayList(); - StringBuilder rawCode = new StringBuilder(); - final Sketch sketch = editor.getSketch(); - try { - for (SketchCode sc : sketch.getCode()) { - if (sc.isExtension("pde")) { - - try { - if (sketch.getCurrentCode().equals(sc)) { - Document d = sc.getDocument(); - rawCode.append(scrapImportStatements(d.getText(0, d.getLength()), - sketch.getCodeIndex(sc))); - } else { - rawCode.append(scrapImportStatements(sc.getProgram(), - sketch.getCodeIndex(sc))); - } - rawCode.append('\n'); - } catch (Exception e) { - e.printStackTrace(); - } - rawCode.append('\n'); - } - } - - } catch (Exception e) { - Messages.log("Exception in preprocessCode()"); - } - String sourceAlt = rawCode.toString(); - // Replace comments with whitespaces - // sourceAlt = scrubComments(sourceAlt); - - // Find all int(*), replace with PApplet.parseInt(*) - - // \bint\s*\(\s*\b , i.e all exclusive "int(" - - String dataTypeFunc[] = { "int", "char", "float", "boolean", "byte" }; - - for (String dataType : dataTypeFunc) { - String dataTypeRegexp = "\\b" + dataType + "\\s*\\("; - Pattern pattern = Pattern.compile(dataTypeRegexp); - Matcher matcher = pattern.matcher(sourceAlt); - - // while (matcher.find()) { - // System.out.print("Start index: " + matcher.start()); - // log(" End index: " + matcher.end() + " "); - // log("-->" + matcher.group() + "<--"); - // } - sourceAlt = matcher.replaceAll("PApplet.parse" - + Character.toUpperCase(dataType.charAt(0)) - + dataType.substring(1) + "("); - - } - - // Find all #[web color] and replace with 0xff[webcolor] - // Should be 6 digits only. - final String webColorRegexp = "#{1}[A-F|a-f|0-9]{6}\\W"; - Pattern webPattern = Pattern.compile(webColorRegexp); - Matcher webMatcher = webPattern.matcher(sourceAlt); - while (webMatcher.find()) { - // log("Found at: " + webMatcher.start()); - String found = sourceAlt.substring(webMatcher.start(), - webMatcher.end()); - // log("-> " + found); - sourceAlt = webMatcher.replaceFirst("0xff" + found.substring(1)); - webMatcher = webPattern.matcher(sourceAlt); - } - - // Replace all color data types with int - // Regex, Y U SO powerful? - final String colorTypeRegex = "color(?![a-zA-Z0-9_])(?=\\[*)(?!(\\s*\\())"; - Pattern colorPattern = Pattern.compile(colorTypeRegex); - Matcher colorMatcher = colorPattern.matcher(sourceAlt); - sourceAlt = colorMatcher.replaceAll("int"); - - checkForChangedImports(); - - className = (editor == null) ? - "DefaultClass" : editor.getSketch().getName(); - - // Check whether the code is being written in STATIC mode(no function - // declarations) - append class declaration and void setup() declaration - Matcher matcher = FUNCTION_DECL.matcher(sourceAlt); - staticMode = !matcher.find(); - StringBuilder sb = new StringBuilder(); - sb.append(xqpreproc.prepareImports(programImports)); - sb.append("public class " + className + " extends PApplet {\n"); - if (staticMode) { - sb.append("public void setup() {\n"); - } - sb.append(sourceAlt); - if (staticMode) { - sb.append("\nnoLoop();\n}"); - } - sb.append("\n}"); - sourceAlt = sb.toString(); - - int position = sourceAlt.indexOf("{") + 1; - mainClassOffset = 1; - for (int i = 0; i <= position; i++) { - if (sourceAlt.charAt(i) == '\n') { - mainClassOffset++; - } - } - if (staticMode) { - mainClassOffset++; - } - sourceAlt = substituteUnicode(sourceAlt); - sourceCode = sourceAlt; - return sourceAlt; - } - - - /** - * Now defunct. - * The super method that highlights any ASTNode in the pde editor =D - * @param node - * @return true - if highlighting happened correctly. - */ - private boolean highlightNode(ASTNodeWrapper awrap){ - Messages.log("Highlighting: " + awrap); - try { - int pdeoffsets[] = awrap.getPDECodeOffsets(this); - int javaoffsets[] = awrap.getJavaCodeOffsets(this); - Messages.log("offsets: " +pdeoffsets[0] + "," + - pdeoffsets[1]+ "," +javaoffsets[1]+ "," + - javaoffsets[2]); - scrollToErrorLine(editor, pdeoffsets[0], - pdeoffsets[1],javaoffsets[1], - javaoffsets[2]); - return true; - } catch (Exception e) { - Messages.loge("Scrolling failed for " + awrap); - // e.printStackTrace(); - } - return false; - } - - public boolean highlightNode(ASTNode node){ - ASTNodeWrapper awrap = new ASTNodeWrapper(node); - return highlightNode(awrap); - } - - /** - * Scrolls to the error source in code. And selects the line text. Used by - * XQErrorTable and ErrorBar - * - * @param errorIndex - * - index of error - */ - public void scrollToErrorLine(int errorIndex) { - if (editor == null) { - return; - } - - if (errorIndex < problemsList.size() && errorIndex >= 0) { - Problem p = problemsList.get(errorIndex); - scrollToErrorLine(p); - } - } - - public void scrollToErrorLine(Problem p) { - if (editor == null) { - return; - } - if (p == null) - return; - try { - if(p.getPDELineStartOffset() == -1 || p.getPDELineStopOffset() == -1){ - // bad offsets, don't highlight, just scroll. - editor.toFront(); - editor.getSketch().setCurrentCode(p.getTabIndex()); - } - else { - astGenerator.highlightPDECode(p.getTabIndex(), - p.getLineNumber(), - p.getPDELineStartOffset(), - (p.getPDELineStopOffset() - - p.getPDELineStartOffset() + 1)); - } - - // scroll, but within boundaries - // It's also a bit silly that if parameters to scrollTo() are out of range, - // a BadLocation Exception is thrown internally and caught in JTextArea AND - // even the stack trace gets printed! W/o letting me catch it later! SMH - // That's because 1) you can prevent it by not causing the BLE, - // and 2) there are so many JEditSyntax bugs that actually throwing the - // exception all the time would cause the editor to shut down over - // trivial/recoverable quirks. It's the least bad option. [fry] - final Document doc = editor.getTextArea().getDocument(); - final int lineCount = Util.countLines(doc.getText(0, doc.getLength())); - if (p.getLineNumber() < lineCount && p.getLineNumber() >= 0) { - editor.getTextArea().scrollTo(p.getLineNumber(), 0); - } - editor.repaint(); - - } catch (Exception e) { - Messages.loge("Error while selecting text in scrollToErrorLine(), for problem: " + p, e); - } - // log("---"); - } - - /** - * Static method for scroll to a particular line in the PDE. Also highlights - * the length of the text. Requires the editor instance as arguement. - * - * @param edt - * @param tabIndex - * @param lineNoInTab - * - line number in the corresponding tab - * @param lineStartOffset - * - selection start offset(from line start non-whitespace offset) - * @param length - * - length of selection - * @return - true, if scroll was successful - */ - public static boolean scrollToErrorLine(Editor edt, int tabIndex, int lineNoInTab, int lineStartOffset, int length) { - if (edt == null) { - return false; - } - try { - edt.toFront(); - edt.getSketch().setCurrentCode(tabIndex); - int lsno = edt.getTextArea() - .getLineStartNonWhiteSpaceOffset(lineNoInTab - 1) + lineStartOffset; - edt.setSelection(lsno, lsno + length); - edt.getTextArea().scrollTo(lineNoInTab - 1, 0); - edt.repaint(); - Messages.log(lineStartOffset + " LSO,len " + length); - - } catch (Exception e) { - System.err.println(e - + " : Error while selecting text in static scrollToErrorLine()"); - e.printStackTrace(); - return false; - } - return true; - } - - /** - * Checks if import statements in the sketch have changed. If they have, - * compiler classpath needs to be updated. - */ - protected void checkForChangedImports() { -// log("Imports: " + programImports.size() + -// " Prev Imp: " -// + previousImports.size()); - if (programImports.size() != previousImports.size()) { - // log(1); - loadCompClass = true; - previousImports = programImports; - } else { - for (int i = 0; i < programImports.size(); i++) { - if (!programImports.get(i).getImportName().equals(previousImports - .get(i).getImportName())) { - // log(2); - loadCompClass = true; - previousImports = programImports; - break; - } - } - } - // log("load..? " + loadCompClass); - } - - protected int pdeImportsCount; - - public int getPdeImportsCount() { - return pdeImportsCount; - } - - /** - * Removes import statements from tabSource, replaces each with white spaces - * and adds the import to the list of program imports - * - * @param tabProgram - * - Code in a tab - * @param tabNumber - * - index of the tab - * @return String - Tab code with imports replaced with white spaces - */ - protected String scrapImportStatements(String tabProgram, int tabNumber) { - //TODO: Commented out imports are still detected as main imports. - pdeImportsCount = 0; - String tabSource = new String(tabProgram); - do { - // log("-->\n" + sourceAlt + "\n<--"); - String[] pieces = PApplet.match(tabSource, importRegexp); - - // Stop the loop if we've removed all the import lines - if (pieces == null) { - break; - } - - String piece = pieces[1] + pieces[2] + pieces[3]; - int len = piece.length(); // how much to trim out - - // programImports.add(piece); // the package name - - // find index of this import in the program - int idx = tabSource.indexOf(piece); - // System.out.print("Import -> " + piece); - // log(" - " - // + Base.countLines(tabSource.substring(0, idx)) + " tab " - // + tabNumber); - int lineCount = Util.countLines(tabSource.substring(0, idx)); - programImports.add(new ImportStatement(piece, tabNumber, lineCount)); - // Remove the import from the main program - // Substitute with white spaces - String whiteSpace = ""; - for (int j = 0; j < piece.length(); j++) { - whiteSpace += " "; - } - tabSource = tabSource.substring(0, idx) + whiteSpace - + tabSource.substring(idx + len); - pdeImportsCount++; - } while (true); - // log(tabSource); - return tabSource; - } - - /** - * Replaces non-ascii characters with their unicode escape sequences and - * stuff. Used as it is from - * processing.src.processing.mode.java.preproc.PdePreprocessor - * - * @param program - * - Input String containing non ascii characters - * @return String - Converted String - */ - public static String substituteUnicode(String program) { - // 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 (unicodeCount == 0) { - return program; - } - // if non-ascii chars are in there, convert to unicode escapes - // 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; - } - } - return new String(p2, 0, index); - } - - public void handleErrorCheckingToggle(){ - if (!JavaMode.errorCheckEnabled) { - // unticked Menu Item - // pauseThread(); - Messages.log(editor.getSketch().getName() - + " - Error Checker paused."); - editor.getErrorPoints().clear(); - problemsList.clear(); - updateErrorTable(); - updateEditorStatus(); - editor.getTextArea().repaint(); - editor.repaintErrorBar(); - } else { - //resumeThread(); - Messages.log(editor.getSketch().getName() - + " - Error Checker resumed."); - runManualErrorCheck(); - } - } - - /** - * Stops the Error Checker Service thread - */ - public void stopThread() { - Messages.loge("Stopping thread: " + editor.getSketch().getName()); - stopThread.set(true); - } - - /** - * Pauses the Error Checker Service thread - */ - public void pauseThread() { - pauseThread.set(true); - } - - /** - * Resumes the Error Checker Service thread - */ - public void resumeThread() { - pauseThread.set(false); - } - - public JavaEditor getEditor() { - return editor; - } - -// public static void log(String message){ -// if(ExperimentalMode.DEBUG) -// log(message); -// } -// -// public static void log2(String message){ -// if(ExperimentalMode.DEBUG) -// System.out.print(message); -// } - - public ArrayList getProgramImports() { - return programImports; - } -} diff --git a/java/src/processing/mode/java/pdex/ErrorMarker.java b/java/src/processing/mode/java/pdex/ErrorMarker.java deleted file mode 100644 index 56fb1727a7..0000000000 --- a/java/src/processing/mode/java/pdex/ErrorMarker.java +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -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. -*/ - -package processing.mode.java.pdex; - -/** - * Error markers displayed on the Error Bar. - * - * @author Manindra Moharana <me@mkmoharana.com> - * - */ -public class ErrorMarker { - /** - * y co-ordinate of the marker - */ - private int y; - /** - * Type of marker: Error or Warning? - */ - private int type = -1; - /** - * Error Type constant - */ - public static final int Error = 1; - /** - * Warning Type constant - */ - public static final int Warning = 2; - /** - * Problem that the error marker represents - * @see Problem - */ - private Problem problem; - - - public ErrorMarker(Problem problem, int y, int type) { - this.problem = problem; - this.y = y; - this.type = type; - } - - - /** - * y co-ordinate of the marker - */ - public int getY() { - return y; - } - - - /** - * Type of marker: ErrorMarker.Error or ErrorMarker.Warning? - */ - public int getType() { - return type; - } - - - /** - * Problem that the error marker represents - * @see Problem - */ - public Problem getProblem() { - return problem; - } -} \ No newline at end of file diff --git a/java/src/processing/mode/java/pdex/ErrorMessageSimplifier.java b/java/src/processing/mode/java/pdex/ErrorMessageSimplifier.java index 64482276fb..f165798d0b 100644 --- a/java/src/processing/mode/java/pdex/ErrorMessageSimplifier.java +++ b/java/src/processing/mode/java/pdex/ErrorMessageSimplifier.java @@ -23,11 +23,14 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.TreeMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.internal.compiler.problem.DefaultProblem; import processing.app.Language; +import processing.app.Messages; import processing.core.PApplet; import processing.data.StringList; @@ -42,25 +45,20 @@ public class ErrorMessageSimplifier { */ private static TreeMap constantsMap; + private static final boolean DEBUG = false; - public ErrorMessageSimplifier() { - - new Thread() { - public void run() { - prepareConstantsList(); - } - }.start(); - } - + private static final Pattern tokenRegExp = Pattern.compile("\\b token\\b"); private static void prepareConstantsList() { - constantsMap = new TreeMap(); + constantsMap = new TreeMap<>(); Class probClass = DefaultProblem.class; Field f[] = probClass.getFields(); for (Field field : f) { if (Modifier.isStatic(field.getModifiers())) try { - //System.out.println(field.getName() + " :" + field.get(null)); + if (DEBUG) { + Messages.log(field.getName() + " :" + field.get(null)); + } Object val = field.get(null); if (val instanceof Integer) { constantsMap.put((Integer) (val), field.getName()); @@ -70,12 +68,14 @@ private static void prepareConstantsList() { break; } } - //System.out.println("Total items: " + constantsMap.size()); + if (DEBUG) { + Messages.log("Total items: " + constantsMap.size()); + } } public static String getIDName(int id) { - if (constantsMap == null){ + if (constantsMap == null) { prepareConstantsList(); } return constantsMap.get(id); @@ -85,179 +85,223 @@ public static String getIDName(int id) { /** * Tones down the jargon in the ecj reported errors. */ - public static String getSimplifiedErrorMessage(Problem problem) { - if (problem == null) return null; + public static String getSimplifiedErrorMessage(IProblem iprob, String badCode) { + if (iprob == null) return null; - IProblem iprob = problem.getIProblem(); String args[] = iprob.getArguments(); -// Base.log("Simplifying message: " + problem.getMessage() + " ID: " -// + getIDName(iprob.getID())); -// Base.log("Arg count: " + args.length); -// for (int i = 0; i < args.length; i++) { -// Base.log("Arg " + args[i]); -// } + + if (DEBUG) { + Messages.log("Simplifying message: " + iprob.getMessage() + + " ID: " + getIDName(iprob.getID())); + Messages.log("Arg count: " + args.length); + for (String arg : args) { + Messages.log("Arg " + arg); + } + Messages.log("Bad code: " + badCode); + } String result = null; switch (iprob.getID()) { - case IProblem.ParsingError: - if (args.length > 0) { - result = Language.interpolate("editor.status.error_on", args[0]); - } - break; - - case IProblem.ParsingErrorDeleteToken: - if (args.length > 0) { - result = Language.interpolate("editor.status.error_on", args[0]); - } - break; + case IProblem.ParsingError: + if (args.length > 0) { + result = Language.interpolate("editor.status.error_on", args[0]); + } + break; - case IProblem.ParsingErrorInsertToComplete: - if (args.length > 0) { - if (args[0].length() == 1) { - result = getErrorMessageForBracket(args[0].charAt(0)); + case IProblem.ParsingErrorDeleteToken: + if (args.length > 0) { + if (args[0].equalsIgnoreCase("Invalid Character")) { + result = getErrorMessageForCurlyQuote(badCode); + } + } + break; - } else { - if (args[0].equals("AssignmentOperator Expression")) { - result = Language.interpolate("editor.status.missing.add", "="); + case IProblem.ParsingErrorDeleteTokens: + result = getErrorMessageForCurlyQuote(badCode); + if (result == null) { + result = Language.interpolate("editor.status.error_on", args[0]); + } + break; - } else if (args[0].equalsIgnoreCase(") Statement")) { + case IProblem.ParsingErrorInsertToComplete: + if (args.length > 0) { + if (args[0].length() == 1) { result = getErrorMessageForBracket(args[0].charAt(0)); } else { - result = Language.interpolate("editor.status.error_on", args[0]); + if (args[0].equals("AssignmentOperator Expression")) { + result = Language.interpolate("editor.status.missing.add", "="); + + } else if (args[0].equalsIgnoreCase(") Statement")) { + result = getErrorMessageForBracket(args[0].charAt(0)); + + } else { + result = Language.interpolate("editor.status.error_on", args[0]); + } } } - } - break; + break; - case IProblem.ParsingErrorInvalidToken: - if (args.length > 0) { - if (args[1].equals("VariableDeclaratorId")) { + case IProblem.ParsingErrorInvalidToken: + if (args.length > 0) { if (args[0].equals("int")) { - result = Language.text ("editor.status.reserved_words"); - } else { + if (args[1].equals("VariableDeclaratorId")) { + result = Language.text("editor.status.reserved_words"); + } else { + result = Language.interpolate("editor.status.error_on", args[0]); + } + } else if (args[0].equalsIgnoreCase("Invalid Character")) { + result = getErrorMessageForCurlyQuote(badCode); + } + if (result == null) { result = Language.interpolate("editor.status.error_on", args[0]); } - } else { - result = Language.interpolate("editor.status.error_on", args[0]); } - } - break; + break; - case IProblem.ParsingErrorInsertTokenAfter: - if (args.length > 0) { - if (args[1].length() == 1) { - result = getErrorMessageForBracket(args[1].charAt(0)); - } - else { - // https://github.com/processing/processing/issues/3104 - if (args[1].equalsIgnoreCase("Statement")) { - result = Language.interpolate("editor.status.error_on", args[0]); + case IProblem.ParsingErrorInsertTokenAfter: + if (args.length > 0) { + if (args[1].length() == 1) { + result = getErrorMessageForBracket(args[1].charAt(0)); } else { - result = - Language.interpolate("editor.status.error_on", args[0]) + " " + - Language.interpolate("editor.status.missing.add", args[1]); + // https://github.com/processing/processing/issues/3104 + if (args[1].equalsIgnoreCase("Statement")) { + result = Language.interpolate("editor.status.error_on", args[0]); + } else { + result = + Language.interpolate("editor.status.error_on", args[0]) + " " + + Language.interpolate("editor.status.missing.add", args[1]); + } } } - } - break; - - case IProblem.UndefinedConstructor: - if (args.length == 2) { - String constructorName = args[0]; - // For messages such as "contructor sketch_name.ClassXYZ() is undefined", change - // constructor name to "ClassXYZ()". See #3434 - if (constructorName.contains(".")) { - // arg[0] contains sketch name twice: sketch_150705a.sketch_150705a.Thing - constructorName = constructorName.substring(constructorName.indexOf('.') + 1); - constructorName = constructorName.substring(constructorName.indexOf('.') + 1); + break; + + case IProblem.ParsingErrorReplaceTokens: + result = getErrorMessageForCurlyQuote(badCode); + + case IProblem.UndefinedConstructor: + if (args.length == 2) { + String constructorName = args[0]; + // For messages such as "contructor sketch_name.ClassXYZ() is undefined", change + // constructor name to "ClassXYZ()". See #3434 + if (constructorName.contains(".")) { + // arg[0] contains sketch name twice: sketch_150705a.sketch_150705a.Thing + constructorName = constructorName.substring(constructorName.indexOf('.') + 1); + constructorName = constructorName.substring(constructorName.indexOf('.') + 1); + } + String constructorArgs = removePackagePrefixes(args[args.length - 1]); + result = Language.interpolate("editor.status.undefined_constructor", constructorName, constructorArgs); } - String constructorArgs = removePackagePrefixes(args[args.length - 1]); - result = Language.interpolate("editor.status.undefined_constructor", constructorName, constructorArgs); - } - break; + break; - case IProblem.UndefinedMethod: - if (args.length > 2) { - String methodName = args[args.length - 2]; - String methodArgs = removePackagePrefixes(args[args.length - 1]); - result = Language.interpolate("editor.status.undefined_method", methodName, methodArgs); - } - break; - - case IProblem.ParameterMismatch: - if (args.length > 3) { - // 2nd arg is method name, 3rd arg is correct param list - if (args[2].trim().length() == 0) { - // the case where no params are needed. - result = Language.interpolate("editor.status.empty_param", args[1]); - - } else { - result = Language.interpolate("editor.status.wrong_param", - args[1], args[1], removePackagePrefixes(args[2])); + case IProblem.UndefinedMethod: + if (args.length > 2) { + String methodName = args[args.length - 2]; + String methodArgs = removePackagePrefixes(args[args.length - 1]); + result = Language.interpolate("editor.status.undefined_method", methodName, methodArgs); + } + break; + + case IProblem.ParameterMismatch: + if (args.length > 3) { + // 2nd arg is method name, 3rd arg is correct param list + if (args[2].trim().length() == 0) { + // the case where no params are needed. + result = Language.interpolate("editor.status.empty_param", args[1]); + + } else { + result = Language.interpolate("editor.status.wrong_param", + args[1], args[1], removePackagePrefixes(args[2])); // String method = q(args[1]); // String methodDef = " \"" + args[1] + "(" + getSimpleName(args[2]) + ")\""; // result = result.replace("method", method); // result += methodDef; + } } - } - break; + break; - case IProblem.UndefinedField: - if (args.length > 0) { - result = Language.interpolate("editor.status.undef_global_var", args[0]); - } - break; + case IProblem.UndefinedField: + if (args.length > 0) { + result = Language.interpolate("editor.status.undef_global_var", args[0]); + } + break; - case IProblem.UndefinedType: - if (args.length > 0) { - result = Language.interpolate("editor.status.undef_class", args[0]); - } - break; + case IProblem.UndefinedType: + if (args.length > 0) { + result = Language.interpolate("editor.status.undef_class", args[0]); + } + break; - case IProblem.UnresolvedVariable: - if (args.length > 0) { - result = Language.interpolate("editor.status.undef_var", args[0]); - } - break; + case IProblem.UnresolvedVariable: + if (args.length > 0) { + result = Language.interpolate("editor.status.undef_var", args[0]); + } + break; - case IProblem.UndefinedName: - if (args.length > 0) { - result = Language.interpolate("editor.status.undef_name", args[0]); - } - break; + case IProblem.UndefinedName: + if (args.length > 0) { + result = Language.interpolate("editor.status.undef_name", args[0]); + } + break; - case IProblem.TypeMismatch: - if (args.length > 1) { - result = Language.interpolate("editor.status.type_mismatch", args[0], args[1]); + case IProblem.UnterminatedString: + if (badCode.contains("“") || badCode.contains("”")) { + result = Language.interpolate("editor.status.unterm_string_curly", + badCode.replaceAll("[^“”]", "")); + } + break; + + case IProblem.TypeMismatch: + if (args.length > 1) { + result = Language.interpolate("editor.status.type_mismatch", args[0], args[1]); // result = result.replace("typeA", q(args[0])); // result = result.replace("typeB", q(args[1])); - } - break; + } + break; - case IProblem.LocalVariableIsNeverUsed: - if (args.length > 0) { - result = Language.interpolate("editor.status.unused_variable", args[0]); - } - break; + case IProblem.LocalVariableIsNeverUsed: + if (args.length > 0) { + result = Language.interpolate("editor.status.unused_variable", args[0]); + } + break; - case IProblem.UninitializedLocalVariable: - if (args.length > 0) { - result = Language.interpolate("editor.status.uninitialized_variable", args[0]); - } - break; + case IProblem.UninitializedLocalVariable: + if (args.length > 0) { + result = Language.interpolate("editor.status.uninitialized_variable", args[0]); + } + break; + + case IProblem.AssignmentHasNoEffect: + if (args.length > 0) { + result = Language.interpolate("editor.status.no_effect_assignment", args[0]); + } + break; + + case IProblem.HidingEnclosingType: + if (args.length > 0) { + result = Language.interpolate("editor.status.hiding_enclosing_type", args[0]); + } + break; + } - case IProblem.AssignmentHasNoEffect: - if (args.length > 0) { - result = Language.interpolate("editor.status.no_effect_assignment", args[0]); + if (result == null) { + String message = iprob.getMessage(); + if (message != null) { + // Remove all instances of token + // "Syntax error on token 'blah', delete this token" + Matcher matcher = tokenRegExp.matcher(message); + message = matcher.replaceAll(""); + result = message; } - break; } - //log("Simplified Error Msg: " + result); - return (result == null) ? problem.getMessage() : result; + if (DEBUG) { + Messages.log("Simplified Error Msg: " + result); + } + + return result; } @@ -303,6 +347,20 @@ static private String getErrorMessageForBracket(char c) { } + /** + * @param badCode The code which may contain curly quotes + * @return Friendly error message if there is a curly quote in badCode, + * null otherwise. + */ + static private String getErrorMessageForCurlyQuote(String badCode) { + if (badCode.contains("‘") || badCode.contains("’") || + badCode.contains("“") || badCode.contains("”")) { + return Language.interpolate("editor.status.bad_curly_quote", + badCode.replaceAll("[^‘’“”]", "")); + } else return null; + } + + // static private final String q(Object quotable) { // return "\"" + quotable + "\""; // } diff --git a/java/src/processing/mode/java/pdex/ImportStatement.java b/java/src/processing/mode/java/pdex/ImportStatement.java index bb86955f86..89aa233785 100644 --- a/java/src/processing/mode/java/pdex/ImportStatement.java +++ b/java/src/processing/mode/java/pdex/ImportStatement.java @@ -20,60 +20,108 @@ package processing.mode.java.pdex; +import java.util.regex.MatchResult; +import java.util.regex.Matcher; + /** * Wrapper for import statements - * + * * @author Manindra Moharana <me@mkmoharana.com> * */ public class ImportStatement { - /** - * Ex: processing.opengl.*, java.util.* - */ - private String importName; + + private static final String importKw = "import"; + private static final String staticKw = "static"; + +// private boolean isClass; + private boolean isStarred; + private boolean isStatic; /** - * Which tab does it belong to? - */ - private int tab; - - /** - * Line number(pde code) of the import - */ - private int lineNumber; - - /** - * - * @param importName - Ex: processing.opengl.*, java.util.* - * @param tab - Which tab does it belong to? - * @param lineNumber - Line number(pde code) of the import - */ - public ImportStatement(String importName, int tab, int lineNumber) { - this.importName = importName; - this.tab = tab; - this.lineNumber = lineNumber; - } - - public String getImportName() { - return importName; + * Full class name of the import with all packages + * Ends with star for starred imports + */ + private String className; + + /** + * Name of the package e.g. everything before last dot + */ + private String packageName; + + private ImportStatement() { } + + public static ImportStatement wholePackage(String pckg) { + ImportStatement is = new ImportStatement(); + is.packageName = pckg; + is.className = "*"; + is.isStarred = true; + return is; } - - public String getPackageName(){ - String ret = new String(importName.trim()); - if(ret.startsWith("import ")) - ret = ret.substring(7); - if(ret.endsWith(";")) - ret = ret.substring(0, ret.length() - 1).trim(); - if(ret.endsWith(".*")) - ret = ret.substring(0, ret.length() - 2); - return ret; - } - - public int getTab() { - return tab; + + public static ImportStatement singleClass(String cls) { + ImportStatement is = new ImportStatement(); + int lastDot = cls.lastIndexOf('.'); + is.className = lastDot >= 0 ? cls.substring(lastDot+1) : cls; + is.packageName = lastDot >= 0 ? cls.substring(0, lastDot) : ""; +// is.isClass = true; + return is; + } + + + + public static ImportStatement parse(String importString) { + Matcher matcher = SourceUtils.IMPORT_REGEX_NO_KEYWORD.matcher(importString); + if (!matcher.find()) return null; + + return parse(matcher.toMatchResult()); + } + + public static ImportStatement parse(MatchResult match) { + ImportStatement is = new ImportStatement(); + + is.isStatic = match.group(2) != null; + String pckg = match.group(3); + pckg = (pckg == null) ? "" : pckg.replaceAll("\\s",""); + is.packageName = pckg.endsWith(".") ? + pckg.substring(0, pckg.length()-1) : + pckg; + + is.className = match.group(4); + is.isStarred = is.className.equals("*"); + + return is; + } + + + + public String getFullSourceLine() { + return importKw + " " + (isStatic ? (staticKw + " ") : "") + packageName + "." + className + ";"; + } + + public String getFullClassName(){ + return packageName + "." + className; + } + + public String getClassName(){ + return className; + } + + public String getPackageName(){ + return packageName; + } + + public boolean isStarredImport() { + return isStarred; + } + + public boolean isStaticImport() { + return isStatic; } - public int getLineNumber() { - return lineNumber; + public boolean isSameAs(ImportStatement is) { + return packageName.equals(is.packageName) && + className.equals(is.className) && + isStatic == is.isStatic; } } \ No newline at end of file diff --git a/java/src/processing/mode/java/pdex/InspectMode.java b/java/src/processing/mode/java/pdex/InspectMode.java new file mode 100644 index 0000000000..6624f6866d --- /dev/null +++ b/java/src/processing/mode/java/pdex/InspectMode.java @@ -0,0 +1,200 @@ +package processing.mode.java.pdex; + +import java.awt.EventQueue; +import java.awt.event.InputEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseWheelEvent; +import java.util.function.Predicate; + +import javax.swing.JMenuItem; + +import org.eclipse.jdt.core.dom.ASTNode; +import org.eclipse.jdt.core.dom.IBinding; +import org.eclipse.jdt.core.dom.MethodDeclaration; +import org.eclipse.jdt.core.dom.SimpleName; +import org.eclipse.jdt.core.dom.TypeDeclaration; +import org.eclipse.jdt.core.dom.VariableDeclaration; + +import processing.app.Language; +import processing.app.Messages; +import processing.app.Platform; +import processing.mode.java.JavaEditor; +import processing.mode.java.JavaMode; +import processing.mode.java.pdex.PreprocessedSketch.SketchInterval; + +import static processing.mode.java.pdex.ASTUtils.getSimpleNameAt; +import static processing.mode.java.pdex.ASTUtils.resolveBinding; + + +class InspectMode { + final JavaEditor editor; + final PreprocessingService pps; + final ShowUsage usage; + + boolean inspectModeEnabled; + + boolean isMouse1Down; + boolean isMouse2Down; + boolean isHotkeyDown; + + Predicate mouseEventHotkeyTest = Platform.isMacOS() ? + InputEvent::isMetaDown : InputEvent::isControlDown; + Predicate keyEventHotkeyTest = Platform.isMacOS() ? + e -> e.getKeyCode() == KeyEvent.VK_META : + e -> e.getKeyCode() == KeyEvent.VK_CONTROL; + + + InspectMode(JavaEditor editor, PreprocessingService pps, ShowUsage usage) { + this.editor = editor; + this.pps = pps; + this.usage = usage; + + // Add listeners + + JMenuItem showUsageItem = new JMenuItem(Language.text("editor.popup.jump_to_declaration")); + showUsageItem.addActionListener(e -> handleInspect()); + editor.getTextArea().getRightClickPopup().add(showUsageItem); + + editor.getJavaTextArea().getPainter().addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + isMouse1Down = isMouse1Down || (e.getButton() == MouseEvent.BUTTON1); + isMouse2Down = isMouse2Down || (e.getButton() == MouseEvent.BUTTON2); + } + + @Override + public void mouseReleased(MouseEvent e) { + boolean releasingMouse1 = e.getButton() == MouseEvent.BUTTON1; + boolean releasingMouse2 = e.getButton() == MouseEvent.BUTTON2; + if (JavaMode.inspectModeHotkeyEnabled && inspectModeEnabled && + isMouse1Down && releasingMouse1) { + handleInspect(e); + } else if (!inspectModeEnabled && isMouse2Down && releasingMouse2) { + handleInspect(e); + } + isMouse1Down = isMouse1Down && !releasingMouse1; + isMouse2Down = isMouse2Down && !releasingMouse2; + } + }); + + editor.getJavaTextArea().getPainter().addMouseMotionListener(new MouseAdapter() { + @Override + public void mouseDragged(MouseEvent e) { + if (editor.isSelectionActive()) { + // Mouse was dragged too much, disable + inspectModeEnabled = false; + // Cancel possible mouse 2 press + isMouse2Down = false; + } + } + + @Override + public void mouseMoved(MouseEvent e) { + isMouse1Down = false; + isMouse2Down = false; + isHotkeyDown = mouseEventHotkeyTest.test(e); + inspectModeEnabled = isHotkeyDown; + } + }); + + editor.getJavaTextArea().addMouseWheelListener(new MouseAdapter() { + @Override + public void mouseWheelMoved(MouseWheelEvent e) { + // Editor was scrolled while mouse 1 was pressed, disable + if (isMouse1Down) inspectModeEnabled = false; + } + }); + + editor.getJavaTextArea().addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + isHotkeyDown = isHotkeyDown || keyEventHotkeyTest.test(e); + // Enable if hotkey was just pressed and mouse 1 is not down + inspectModeEnabled = inspectModeEnabled || (!isMouse1Down && isHotkeyDown); + } + + @Override + public void keyReleased(KeyEvent e) { + isHotkeyDown = isHotkeyDown && !keyEventHotkeyTest.test(e); + // Disable if hotkey was just released + inspectModeEnabled = inspectModeEnabled && isHotkeyDown; + } + }); + } + + + void handleInspect() { + int off = editor.getSelectionStart(); + int tabIndex = editor.getSketch().getCurrentCodeIndex(); + + pps.whenDoneBlocking(ps -> handleInspect(ps, tabIndex, off)); + } + + + // Thread: EDT + void handleInspect(MouseEvent evt) { + int off = editor.getJavaTextArea().xyToOffset(evt.getX(), evt.getY()); + if (off < 0) return; + int tabIndex = editor.getSketch().getCurrentCodeIndex(); + + pps.whenDoneBlocking(ps -> handleInspect(ps, tabIndex, off)); + } + + + // Thread: worker + private void handleInspect(PreprocessedSketch ps, int tabIndex, int offset) { + ASTNode root = ps.compilationUnit; + int javaOffset = ps.tabOffsetToJavaOffset(tabIndex, offset); + + SimpleName simpleName = getSimpleNameAt(root, javaOffset, javaOffset); + + if (simpleName == null) { + Messages.log("no simple name found at click location"); + return; + } + + IBinding binding = resolveBinding(simpleName); + if (binding == null) { + Messages.log("binding not resolved"); + return; + } + + String key = binding.getKey(); + ASTNode decl = ps.compilationUnit.findDeclaringNode(key); + if (decl == null) { + Messages.log("decl not found, showing usage instead"); + usage.findUsageAndUpdateTree(ps, binding); + return; + } + + SimpleName declName = null; + switch (binding.getKind()) { + case IBinding.TYPE: declName = ((TypeDeclaration) decl).getName(); break; + case IBinding.METHOD: declName = ((MethodDeclaration) decl).getName(); break; + case IBinding.VARIABLE: declName = ((VariableDeclaration) decl).getName(); break; + } + if (declName == null) { + Messages.log("decl name not found " + decl); + return; + } + + if (declName.equals(simpleName)) { + usage.findUsageAndUpdateTree(ps, binding); + } else { + Messages.log("found declaration, offset " + decl.getStartPosition() + ", name: " + declName); + SketchInterval si = ps.mapJavaToSketch(declName); + if (!ps.inRange(si)) return; + EventQueue.invokeLater(() -> { + editor.highlight(si.tabIndex, si.startTabOffset, si.stopTabOffset); + }); + } + } + + + void dispose() { + // Nothing to do + } +} \ No newline at end of file diff --git a/java/src/processing/mode/java/pdex/JavaProblem.java b/java/src/processing/mode/java/pdex/JavaProblem.java new file mode 100644 index 0000000000..b8ef76c0ae --- /dev/null +++ b/java/src/processing/mode/java/pdex/JavaProblem.java @@ -0,0 +1,144 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* +Part of the Processing project - http://processing.org +Copyright (c) 2012-15 The Processing Foundation + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +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. +*/ + +package processing.mode.java.pdex; + +import org.eclipse.jdt.core.compiler.IProblem; + +import processing.app.Problem; + + +/** + * Wrapper class for IProblem that stores the tabIndex and line number + * according to its tab, including the original IProblem object + */ +public class JavaProblem implements Problem { + /** + * The tab number to which the error belongs to + */ + private int tabIndex; + /** + * Line number(pde code) of the error + */ + private int lineNumber; + + private int startOffset; + + private int stopOffset; + + /** + * Error Message. Processed form of IProblem.getMessage() + */ + private String message; + + /** + * The type of error - WARNING or ERROR. + */ + private int type; + + /** + * If the error is a 'cannot find type' contains the list of suggested imports + */ + private String[] importSuggestions; + + public static final int ERROR = 1, WARNING = 2; + + public JavaProblem(String message, int type, int tabIndex, int lineNumber) { + this.message = message; + this.type = type; + this.tabIndex = tabIndex; + this.lineNumber = lineNumber; + } + + /** + * + * @param iProblem - The IProblem which is being wrapped + * @param tabIndex - The tab number to which the error belongs to + * @param lineNumber - Line number(pde code) of the error + * @param badCode - The code iProblem refers to. + */ + public static JavaProblem fromIProblem(IProblem iProblem, + int tabIndex, int lineNumber, String badCode) { + int type = 0; + if(iProblem.isError()) { + type = ERROR; + } else if (iProblem.isWarning()) { + type = WARNING; + } + String message = ErrorMessageSimplifier.getSimplifiedErrorMessage(iProblem, badCode); + return new JavaProblem(message, type, tabIndex, lineNumber); + } + + public void setPDEOffsets(int startOffset, int stopOffset){ + this.startOffset = startOffset; + this.stopOffset = stopOffset; + } + + @Override + public int getStartOffset() { + return startOffset; + } + + @Override + public int getStopOffset() { + return stopOffset; + } + + @Override + public boolean isError() { + return type == ERROR; + } + + @Override + public boolean isWarning() { + return type == WARNING; + } + + @Override + public String getMessage() { + return message; + } + + @Override + public int getTabIndex() { + return tabIndex; + } + + @Override + public int getLineNumber() { + return lineNumber; + } + + public String[] getImportSuggestions() { + return importSuggestions; + } + + public void setImportSuggestions(String[] a) { + importSuggestions = a; + } + + @Override + public String toString() { + return "TAB " + tabIndex + ",LN " + lineNumber + "LN START OFF: " + + startOffset + ",LN STOP OFF: " + stopOffset + ",PROB: " + + message; + } + +} diff --git a/java/src/processing/mode/java/pdex/JavaTextArea.java b/java/src/processing/mode/java/pdex/JavaTextArea.java index 0461e34d19..3a1bcd4152 100644 --- a/java/src/processing/mode/java/pdex/JavaTextArea.java +++ b/java/src/processing/mode/java/pdex/JavaTextArea.java @@ -2,7 +2,7 @@ /* Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation +Copyright (c) 2012-16 The Processing Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 @@ -20,160 +20,76 @@ package processing.mode.java.pdex; -import processing.mode.java.JavaInputHandler; -import processing.mode.java.JavaMode; -import processing.mode.java.JavaEditor; -import processing.mode.java.tweak.ColorControlBox; -import processing.mode.java.tweak.Handle; - -import java.awt.*; -import java.awt.event.*; -import java.util.HashMap; +import java.awt.EventQueue; +import java.awt.Point; +import java.awt.event.ComponentListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.util.BitSet; +import java.util.Collections; import java.util.List; -import java.util.Map; import javax.swing.DefaultListModel; import javax.swing.SwingWorker; import processing.app.Messages; -import processing.app.Mode; import processing.app.Platform; -import processing.app.syntax.JEditTextArea; -import processing.app.syntax.PdeTextAreaDefaults; +import processing.app.syntax.PdeTextArea; import processing.app.syntax.TextAreaDefaults; -import processing.app.ui.Editor; - - -// TODO The way listeners are added/removed here is fragile and -// likely to cause bugs that are very difficult to find. -// We shouldn't be re-inventing the wheel with how listeners are handled. -// TODO We're overriding more things in JEditTextArea than we should, which -// makes it trickier for other Modes (Python, etc) to subclass because -// they'll need to re-implement what's in here, but first wade through it. -// To fix, we need to clean this up and put the appropriate cross-Mode -// changes into JEditTextArea (or a subclass in processing.app) - -public class JavaTextArea extends JEditTextArea { - protected PdeTextAreaDefaults defaults; - protected JavaEditor editor; - -// static final int LEFT_GUTTER = Editor.LEFT_GUTTER; -// static final int RIGHT_GUTTER = Editor.RIGHT_GUTTER; -// static final int GUTTER_MARGIN = 3; - - // cached mouselisteners, these are wrapped by MouseHandler - protected MouseListener[] mouseListeners; - - // contains line background colors - protected Map lineColors = new HashMap(); - - // [px] space added to the left and right of gutter chars - protected int gutterPadding; // = 3; - protected Color gutterBgColor; // = new Color(252, 252, 252); // gutter background color - protected Color gutterLineColor; // = new Color(233, 233, 233); // color of vertical separation line +import processing.mode.java.JavaEditor; +import processing.mode.java.JavaInputHandler; +import processing.mode.java.JavaMode; +import processing.mode.java.tweak.ColorControlBox; +import processing.mode.java.tweak.Handle; - /// the text marker for highlighting breakpoints in the gutter - public String breakpointMarker = "<>"; - /// the text marker for highlighting the current line in the gutter - public String currentLineMarker = "->"; - /// maps line index to gutter text - protected Map gutterText = new HashMap(); +/** + * TextArea implementation for Java Mode. Primary differences from PdeTextArea + * are completions, suggestions, and tweak handling. + */ +public class JavaTextArea extends PdeTextArea { + private CompletionPanel suggestion; - /// maps line index to gutter text color - protected Map gutterTextColors = new HashMap(); -// protected ErrorCheckerService errorCheckerService; - private CompletionPanel suggestion; + public JavaTextArea(TextAreaDefaults defaults, JavaEditor editor) { + super(defaults, new JavaInputHandler(editor), editor); + suggestionGenerator = new CompletionGenerator(); - protected JavaTextAreaPainter getCustomPainter() { - return (JavaTextAreaPainter) painter; + tweakMode = false; } - public JavaTextArea(TextAreaDefaults defaults, JavaEditor editor) { - super(defaults, new JavaInputHandler(editor)); - this.editor = editor; - - // removed all this since we have the createPainter() method and we - // won't have to remove/re-add the custom painter object [fry 150122] - // although there's also something bad happening here, that we're - // re-forwarding all those events to all the other listeners? - // that's making a hacky mess, plus the tweak code is also doing - // something similar? [fry 150512] - -// // replace the painter: -// // first save listeners, these are package-private in JEditTextArea, so not accessible -// ComponentListener[] componentListeners = painter.getComponentListeners(); - mouseListeners = painter.getMouseListeners(); -// MouseMotionListener[] mouseMotionListeners = painter.getMouseMotionListeners(); -// -// remove(painter); -// // set new painter -// customPainter = new TextAreaPainter(this, defaults); -// painter = customPainter; -// -// // set listeners -// for (ComponentListener cl : componentListeners) { -// painter.addComponentListener(cl); -// } -// -// for (MouseMotionListener mml : mouseMotionListeners) { -// painter.addMouseMotionListener(mml); -// } - - // use a custom mouse handler instead of directly using mouseListeners - MouseHandler mouseHandler = new MouseHandler(); - painter.addMouseListener(mouseHandler); - painter.addMouseMotionListener(mouseHandler); - //addCompletionPopupListner(); - add(CENTER, painter); - - // load settings from theme.txt - Mode mode = editor.getMode(); - gutterBgColor = mode.getColor("gutter.bgcolor"); //, gutterBgColor); - gutterLineColor = mode.getColor("gutter.linecolor"); //, gutterLineColor); - gutterPadding = mode.getInteger("gutter.padding"); - breakpointMarker = mode.getString("breakpoint.marker"); //, breakpointMarker); - currentLineMarker = mode.getString("currentline.marker"); //, currentLineMarker); - - // TweakMode code - prevCompListeners = painter.getComponentListeners(); - prevMouseListeners = painter.getMouseListeners(); - prevMMotionListeners = painter.getMouseMotionListeners(); - prevKeyListeners = editor.getKeyListeners(); - - tweakMode = false; - addPrevListeners(); + public JavaEditor getJavaEditor() { + return (JavaEditor) editor; } + @Override protected JavaTextAreaPainter createPainter(final TextAreaDefaults defaults) { return new JavaTextAreaPainter(this, defaults); } - /** - * Sets ErrorCheckerService and loads theme for TextArea(XQMode) - * - * @param ecs - * @param mode - */ - public void setMode(JavaMode mode) { -// errorCheckerService = ecs; - getCustomPainter().setMode(mode); + // used by Tweak Mode + protected JavaTextAreaPainter getJavaPainter() { + return (JavaTextAreaPainter) painter; } /** * Handles KeyEvents for TextArea (code completion begins from here). + * TODO Needs explanation of why this implemented with an override + * of processKeyEvent() instead of using listeners. */ + @Override public void processKeyEvent(KeyEvent evt) { if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) { if (suggestion != null){ if (suggestion.isVisible()){ - Messages.log("esc key"); + Messages.log("ESC key"); hideSuggestion(); evt.consume(); return; @@ -182,18 +98,16 @@ public void processKeyEvent(KeyEvent evt) { } else if (evt.getKeyCode() == KeyEvent.VK_ENTER && evt.getID() == KeyEvent.KEY_PRESSED) { - if (suggestion != null) { + if (suggestion != null && + suggestion.isVisible() && + suggestion.insertSelection(CompletionPanel.KEYBOARD_COMPLETION)) { + evt.consume(); + // Still try to show suggestions after inserting if it's + // the case of overloaded methods. See #2755 if (suggestion.isVisible()) { - if (suggestion.insertSelection(CompletionPanel.KEYBOARD_COMPLETION)) { - //hideSuggestion(); // Kill it! - evt.consume(); - // Still try to show suggestions after inserting if it's - // the case of overloaded methods. See #2755 - if(suggestion.isVisible()) - prepareSuggestions(evt); - return; - } + prepareSuggestions(evt); } + return; } } @@ -231,10 +145,11 @@ public void processKeyEvent(KeyEvent evt) { super.processKeyEvent(evt); // code completion disabled if Java tabs present - if (!editor.hasJavaTabs()) { + if (!getJavaEditor().hasJavaTabs()) { if (evt.getID() == KeyEvent.KEY_TYPED) { processCompletionKeys(evt); - + } else if (!Platform.isMacOS() && evt.getID() == KeyEvent.KEY_RELEASED) { + processCompletionKeys(evt); } else if (Platform.isMacOS() && evt.getID() == KeyEvent.KEY_RELEASED) { processControlSpace(evt); } @@ -246,54 +161,47 @@ public void processKeyEvent(KeyEvent evt) { // https://github.com/processing/processing/issues/2699 private void processControlSpace(final KeyEvent event) { if (event.getKeyCode() == KeyEvent.VK_SPACE && event.isControlDown()) { - SwingWorker worker = new SwingWorker() { - protected Object doInBackground() throws Exception { - // Provide completions only if it's enabled - if (JavaMode.codeCompletionsEnabled) { - Messages.log("[KeyEvent]" + KeyEvent.getKeyText(event.getKeyCode()) + " |Prediction started"); - Messages.log("Typing: " + fetchPhrase(event)); - } - return null; - } - }; - worker.execute(); + // Provide completions only if it's enabled + if (JavaMode.codeCompletionsEnabled) { + Messages.log("[KeyEvent]" + KeyEvent.getKeyText(event.getKeyCode()) + " |Prediction started"); + fetchPhrase(); + } } } private void processCompletionKeys(final KeyEvent event) { char keyChar = event.getKeyChar(); + int keyCode = event.getKeyCode(); if (keyChar == KeyEvent.VK_ENTER || keyChar == KeyEvent.VK_ESCAPE || keyChar == KeyEvent.VK_TAB || - keyChar == KeyEvent.CHAR_UNDEFINED) { - return; - + (event.getID() == KeyEvent.KEY_RELEASED && + keyCode != KeyEvent.VK_LEFT && keyCode != KeyEvent.VK_RIGHT)) { + // ignore } else if (keyChar == ')') { - hideSuggestion(); // See #2741 - return; - } + // https://github.com/processing/processing/issues/2741 + hideSuggestion(); - if (keyChar == '.') { + } else if (keyChar == '.') { if (JavaMode.codeCompletionsEnabled) { Messages.log("[KeyEvent]" + KeyEvent.getKeyText(event.getKeyCode()) + " |Prediction started"); - Messages.log("Typing: " + fetchPhrase(event)); + fetchPhrase(); } } else if (keyChar == ' ') { // Trigger on Ctrl-Space if (!Platform.isMacOS() && JavaMode.codeCompletionsEnabled && (event.isControlDown() || event.isMetaDown())) { - SwingWorker worker = new SwingWorker() { - protected Object doInBackground() throws Exception { - // Provide completions only if it's enabled - if (JavaMode.codeCompletionsEnabled) { - getDocument().remove(getCaretPosition() - 1, 1); // Remove the typed space - Messages.log("[KeyEvent]" + event.getKeyChar() + " |Prediction started"); - Messages.log("Typing: " + fetchPhrase(event)); - } - return null; - } - }; - worker.execute(); + // Provide completions only if it's enabled + if (JavaMode.codeCompletionsEnabled) { + // Removed for https://github.com/processing/processing/issues/3847 + //try { + // getDocument().remove(getCaretPosition() - 1, 1); // Remove the typed space + Messages.log("[KeyEvent]" + event.getKeyChar() + " |Prediction started"); + fetchPhrase(); + //} catch (BadLocationException e) { + // e.printStackTrace(); + //} + } } else { hideSuggestion(); // hide on spacebar } @@ -306,543 +214,328 @@ protected Object doInBackground() throws Exception { /** Kickstart auto-complete suggestions */ - private void prepareSuggestions(final KeyEvent evt){ - SwingWorker worker = new SwingWorker() { - protected Object doInBackground() throws Exception { - // Provide completions only if it's enabled - if (JavaMode.codeCompletionsEnabled && - (JavaMode.ccTriggerEnabled || suggestion.isVisible())) { - Messages.log("[KeyEvent]" + evt.getKeyChar() + " |Prediction started"); - Messages.log("Typing: " + fetchPhrase(evt)); - } - return null; - } - }; - worker.execute(); + private void prepareSuggestions(final KeyEvent evt) { + // Provide completions only if it's enabled + if (JavaMode.codeCompletionsEnabled && + (JavaMode.ccTriggerEnabled || + (suggestion != null && suggestion.isVisible()))) { + Messages.log("[KeyEvent]" + evt.getKeyChar() + " |Prediction started"); + fetchPhrase(); + } } - /** - * Retrieves the word on which the mouse pointer is present - * @param evt - the MouseEvent which triggered this method - */ - private String fetchPhrase(MouseEvent evt) { - Messages.log("--handle Mouse Right Click--"); - int off = xyToOffset(evt.getX(), evt.getY()); - if (off < 0) - return null; - int line = getLineOfOffset(off); - if (line < 0) - return null; - String s = getLineText(line); - if (s == null) - return null; - else if (s.length() == 0) - return null; - else { - int x = xToOffset(line, evt.getX()), x2 = x + 1, x1 = x - 1; - int xLS = off - getLineStartNonWhiteSpaceOffset(line); - Messages.log("x=" + x); - if (x < 0 || x >= s.length()) - return null; - String word = s.charAt(x) + ""; - if (s.charAt(x) == ' ') - return null; - if (!(Character.isLetterOrDigit(s.charAt(x)) || s.charAt(x) == '_' || s - .charAt(x) == '$')) - return null; - int i = 0; - while (true) { - i++; - if (x1 >= 0 && x1 < s.length()) { - if (Character.isLetter(s.charAt(x1)) || s.charAt(x1) == '_') { - word = s.charAt(x1--) + word; - xLS--; - } else - x1 = -1; - } else - x1 = -1; - - if (x2 >= 0 && x2 < s.length()) { - if (Character.isLetterOrDigit(s.charAt(x2)) || s.charAt(x2) == '_' - || s.charAt(x2) == '$') - word = word + s.charAt(x2++); - else - x2 = -1; - } else - x2 = -1; - - if (x1 < 0 && x2 < 0) - break; - if (i > 200) { - // time out! - break; - } - } - if (Character.isDigit(word.charAt(0))) { - return null; - } - Messages.log("Mouse click, word: " + word.trim()); - editor.getErrorChecker().getASTGenerator().setLastClickedWord(line, word, xLS); - return word.trim(); - } - } + CompletionGenerator suggestionGenerator; + + SwingWorker suggestionWorker = null; + volatile boolean suggestionRunning = false; + volatile boolean suggestionRequested = false; /** * Retrieves the current word typed just before the caret. * Then triggers code completion for that word. * @param evt - the KeyEvent which triggered this method */ - public String fetchPhrase(KeyEvent evt) { - int off = getCaretPosition(); - Messages.log("off " + off); - if (off < 0) - return null; - int line = getCaretLine(); - if (line < 0) - return null; - String s = getLineText(line); - Messages.log(" line " + line); - - //log2(s + " len " + s.length()); - - int x = getCaretPosition() - getLineStartOffset(line) - 1, x1 = x - 1; - if(x >= s.length() || x < 0) { - //log("X is " + x + ". Returning null"); - hideSuggestion(); - return null; //TODO: Does this check cause problems? Verify. - } - - Messages.log(" x char: " + s.charAt(x)); - - if (!(Character.isLetterOrDigit(s.charAt(x)) || s.charAt(x) == '_' - || s.charAt(x) == '(' || s.charAt(x) == '.')) { - //log("Char before caret isn't a letter/digit/_(. so no predictions"); - hideSuggestion(); - return null; - } else if (x > 0 && (s.charAt(x - 1) == ' ' || s.charAt(x - 1) == '(') - && Character.isDigit(s.charAt(x))) { - //log("Char before caret isn't a letter, but ' ' or '(', so no predictions"); - hideSuggestion(); // See #2755, Option 2 comment - return null; - } else if (x == 0){ - //log("X is zero"); - hideSuggestion(); - return null; + protected void fetchPhrase() { + if (suggestionRunning) { + suggestionRequested = true; + return; } - //int xLS = off - getLineStartNonWhiteSpaceOffset(line); - - String word = (x < s.length() ? s.charAt(x) : "") + ""; - if (s.trim().length() == 1) { -// word = "" -// + (keyChar == KeyEvent.CHAR_UNDEFINED ? s.charAt(x - 1) : keyChar); - //word = (x < s.length()?s.charAt(x):"") + ""; - word = word.trim(); - if (word.endsWith(".")) - word = word.substring(0, word.length() - 1); - - editor.getErrorChecker().getASTGenerator().preparePredictions(word, line + editor.getErrorChecker().mainClassOffset,0); - return word; - } + suggestionRunning = true; + suggestionRequested = false; - int i = 0; - int closeB = 0; - - while (true) { - i++; - //TODO: currently works on single line only. "a. b()" won't be detected - if (x1 >= 0) { -// if (s.charAt(x1) != ';' && s.charAt(x1) != ',' && s.charAt(x1) != '(') - if (Character.isLetterOrDigit(s.charAt(x1)) || s.charAt(x1) == '_' - || s.charAt(x1) == '.' || s.charAt(x1) == ')' || s.charAt(x1) == ']') { - - if (s.charAt(x1) == ')') { - word = s.charAt(x1--) + word; - closeB++; - while (x1 >= 0 && closeB > 0) { - word = s.charAt(x1) + word; - if (s.charAt(x1) == '(') - closeB--; - if (s.charAt(x1) == ')') - closeB++; - x1--; - } - } - else if (s.charAt(x1) == ']') { - word = s.charAt(x1--) + word; - closeB++; - while (x1 >= 0 && closeB > 0) { - word = s.charAt(x1) + word; - if (s.charAt(x1) == '[') - closeB--; - if (s.charAt(x1) == ']') - closeB++; - x1--; - } - } - else { - word = s.charAt(x1--) + word; - } - } else { - break; - } - } else { - break; + final String text; + final int caretLineIndex; + final int caretLinePosition; + { + // Get caret position + int caretPosition = getCaretPosition(); + if (caretPosition < 0) { + suggestionRunning = false; + return; } - if (i > 200) { - // time out! - break; + // Get line index + caretLineIndex = getCaretLine(); + if (caretLineIndex < 0) { + suggestionRunning = false; + return; } - } - - if (Character.isDigit(word.charAt(0))) - return null; - word = word.trim(); - // if (word.endsWith(".")) - // word = word.substring(0, word.length() - 1); - int lineStartNonWSOffset = 0; - if (word.length() >= JavaMode.codeCompletionTriggerLength) { - editor.getErrorChecker().getASTGenerator() - .preparePredictions(word, line + editor.getErrorChecker().mainClassOffset, - lineStartNonWSOffset); - } - return word; - - } - - -// /** -// * Retrieve the total width of the gutter area. -// * @return gutter width in pixels -// */ -// protected int getGutterWidth() { -// if (!editor.isDebugToolbarEnabled()) { -// return 0; -// } -// -// FontMetrics fm = painter.getFontMetrics(); -// int textWidth = Math.max(fm.stringWidth(breakpointMarker), -// fm.stringWidth(currentLineMarker)); -// return textWidth + 2 * gutterPadding; -// } -// -// -// /** -// * Retrieve the width of margins applied to the left and right of the gutter -// * text. -// * -// * @return margins in pixels -// */ -// protected int getGutterMargins() { -// if (!editor.isDebugToolbarEnabled()) { -// return 0; -// } -// return gutterPadding; -// } - - /** - * Set the gutter text of a specific line. - * - * @param lineIdx - * the line index (0-based) - * @param text - * the text - */ - public void setGutterText(int lineIdx, String text) { - gutterText.put(lineIdx, text); - painter.invalidateLine(lineIdx); - } - - - /** - * Set the gutter text and color of a specific line. - * - * @param lineIdx - * the line index (0-based) - * @param text - * the text - * @param textColor - * the text color - */ - public void setGutterText(int lineIdx, String text, Color textColor) { - gutterTextColors.put(lineIdx, textColor); - setGutterText(lineIdx, text); - } - - - /** - * Clear the gutter text of a specific line. - * - * @param lineIdx - * the line index (0-based) - */ - public void clearGutterText(int lineIdx) { - gutterText.remove(lineIdx); - painter.invalidateLine(lineIdx); - } + // Get text of the line + String lineText = getLineText(caretLineIndex); + if (lineText == null) { + suggestionRunning = false; + return; + } + // Get caret position on the line + caretLinePosition = getCaretPosition() - getLineStartOffset(caretLineIndex); + if (caretLinePosition <= 0) { + suggestionRunning = false; + return; + } - /** - * Clear all gutter text. - */ - public void clearGutterText() { - for (int lineIdx : gutterText.keySet()) { - painter.invalidateLine(lineIdx); + // Get part of the line to the left of the caret + if (caretLinePosition > lineText.length()) { + suggestionRunning = false; + return; + } + text = lineText.substring(0, caretLinePosition); } - gutterText.clear(); - } + // Adjust line number for tabbed sketches + //int codeIndex = editor.getSketch().getCodeIndex(getJavaEditor().getCurrentTab()); + int codeIndex = editor.getSketch().getCurrentCodeIndex(); + int lineStartOffset = editor.getTextArea().getLineStartOffset(caretLineIndex); - /** - * Retrieve the gutter text of a specific line. - * - * @param lineIdx - * the line index (0-based) - * @return the gutter text - */ - public String getGutterText(int lineIdx) { - return gutterText.get(lineIdx); - } + getJavaEditor().getPreprocessingService().whenDone(ps -> { + int lineNumber = ps.tabOffsetToJavaLine(codeIndex, lineStartOffset); + String phrase = null; + DefaultListModel defListModel = null; - /** - * Retrieve the gutter text color for a specific line. - * - * @param lineIdx - * the line index - * @return the gutter text color - */ - public Color getGutterTextColor(int lineIdx) { - return gutterTextColors.get(lineIdx); - } + try { + Messages.log("phrase parse start"); + phrase = parsePhrase(text); + Messages.log("phrase: " + phrase); + if (phrase != null) { + List candidates; + candidates = suggestionGenerator.preparePredictions(ps, phrase, lineNumber); - /** - * Set the background color of a line. - * - * @param lineIdx - * 0-based line number - * @param col - * the background color to set - */ - public void setLineBgColor(int lineIdx, Color col) { - lineColors.put(lineIdx, col); - painter.invalidateLine(lineIdx); - } + if (!suggestionRequested) { + // // don't show completions when the outline is visible + // boolean showSuggestions = + // astGenerator.sketchOutline == null || !astGenerator.sketchOutline.isVisible(); - /** - * Clear the background color of a line. - * - * @param lineIdx - * 0-based line number - */ - public void clearLineBgColor(int lineIdx) { - lineColors.remove(lineIdx); - painter.invalidateLine(lineIdx); - } + // if (showSuggestions && phrase != null && + if (candidates != null && !candidates.isEmpty()) { + Collections.sort(candidates); + defListModel = CompletionGenerator.filterPredictions(candidates); + Messages.log("Got: " + candidates.size() + " candidates, " + defListModel.size() + " filtered"); + } + } + } - /** - * Clear all line background colors. - */ - public void clearLineBgColors() { - for (int lineIdx : lineColors.keySet()) { - painter.invalidateLine(lineIdx); - } - lineColors.clear(); - } + final String finalPhrase = phrase; + final DefaultListModel finalDefListModel = defListModel; + EventQueue.invokeLater(() -> { - /** - * Get a lines background color. - * - * @param lineIdx - * 0-based line number - * @return the color or null if no color was set for the specified line - */ - public Color getLineBgColor(int lineIdx) { - return lineColors.get(lineIdx); - } + suggestionRunning = false; + if (suggestionRequested) { + Messages.log("completion invalidated"); + fetchPhrase(); + return; + } + Messages.log("completion finishing"); - /** - * Convert a character offset to a horizontal pixel position inside the text - * area. Overridden to take gutter width into account. - * - * @param line - * the 0-based line number - * @param offset - * the character offset (0 is the first character on a line) - * @return the horizontal position - */ - @Override - public int _offsetToX(int line, int offset) { - return super._offsetToX(line, offset) + Editor.LEFT_GUTTER; + if (finalDefListModel != null) { + showSuggestion(finalDefListModel, finalPhrase); + } else { + hideSuggestion(); + } + }); + } catch (Exception e) { + Messages.loge("error while preparing suggestions", e); + } + }); } - /** - * Convert a horizontal pixel position to a character offset. Overridden to - * take gutter width into account. - * - * @param line - * the 0-based line number - * @param x - * the horizontal pixel position - * @return he character offset (0 is the first character on a line) - */ - @Override - public int xToOffset(int line, int x) { - return super.xToOffset(line, x - Editor.LEFT_GUTTER); - } + protected static String parsePhrase(final String lineText) { + boolean overloading = false; + { // Check if we can provide suggestions for this phrase ending + String trimmedLineText = lineText.trim(); + if (trimmedLineText.length() == 0) return null; - /** - * Custom mouse handler. Implements double clicking in the gutter area to - * toggle breakpoints, sets default cursor (instead of text cursor) in the - * gutter area. - */ - protected class MouseHandler implements MouseListener, MouseMotionListener { - protected int lastX; // previous horizontal positon of the mouse cursor - - @Override - public void mouseClicked(MouseEvent me) { - // forward to standard listeners - for (MouseListener ml : mouseListeners) { - ml.mouseClicked(me); - } - } - - @Override - public void mousePressed(MouseEvent me) { -// // check if this happened in the gutter area -// if (me.getX() < Editor.LEFT_GUTTER) { -// if (me.getButton() == MouseEvent.BUTTON1) { // && me.getClickCount() == 2) { -// //int line = me.getY() / painter.getFontMetrics().getHeight() + firstLine; -// int offset = xyToOffset(me.getX(), me.getY()); -// if (offset >= 0) { -// int lineIndex = getLineOfOffset(offset); -// editor.toggleBreakpoint(lineIndex); -// } -//// if (line >= 0 && line < getLineCount()) { -//// //editor.gutterDblClicked(line); -//// editor.toggleBreakpoint(line); -//// } -// } -// return; -// } - - if (me.getButton() == MouseEvent.BUTTON3) { - if (!editor.hasJavaTabs()) { // tooltips, etc disabled for java tabs - fetchPhrase(me); + char lastChar = trimmedLineText.charAt(trimmedLineText.length() - 1); + if (lastChar == '.') { + trimmedLineText = trimmedLineText.substring(0, trimmedLineText.length() - 1).trim(); + if (trimmedLineText.length() == 0) return null; + lastChar = trimmedLineText.charAt(trimmedLineText.length() - 1); + switch (lastChar) { + case ')': + case ']': + case '"': + break; // We can suggest for these + default: + if (!Character.isJavaIdentifierPart(lastChar)) { + return null; // Not something we can suggest + } + break; } + } else if (lastChar == '(') { + overloading = true; // We can suggest overloaded methods + } else if (!Character.isJavaIdentifierPart(lastChar)) { + return null; // Not something we can suggest } - - // forward to standard listeners - for (MouseListener ml : mouseListeners) { - ml.mousePressed(me); - } - } - @Override - public void mouseReleased(MouseEvent me) { - // forward to standard listeners - for (MouseListener ml : mouseListeners) { - ml.mouseReleased(me); + final int currentCharIndex = lineText.length() - 1; + + { // Check if the caret is in the comment + int commentStart = lineText.indexOf("//", 0); + if (commentStart >= 0 && currentCharIndex > commentStart) { + return null; } } - @Override - public void mouseEntered(MouseEvent me) { - // forward to standard listeners - for (MouseListener ml : mouseListeners) { - ml.mouseEntered(me); + // Index the line + BitSet isInLiteral = new BitSet(lineText.length()); + BitSet isInBrackets = new BitSet(lineText.length()); + + { // Mark parts in literals + boolean inString = false; + boolean inChar = false; + boolean inEscaped = false; + + for (int i = 0; i < lineText.length(); i++) { + if (!inEscaped) { + switch (lineText.charAt(i)) { + case '\"': + if (!inChar) inString = !inString; + break; + case '\'': + if (!inString) inChar = !inChar; + break; + case '\\': + if (inString || inChar) { + inEscaped = true; + } + break; + } + } else { + inEscaped = false; + } + isInLiteral.set(i, inString || inChar); } } - @Override - public void mouseExited(MouseEvent me) { - // forward to standard listeners - for (MouseListener ml : mouseListeners) { - ml.mouseExited(me); + if (isInLiteral.get(currentCharIndex)) return null; + + { // Mark parts in top level brackets + int depth = overloading ? 1 : 0; + int bracketStart = overloading ? lineText.length() : 0; + int squareDepth = 0; + int squareBracketStart = 0; + + bracketLoop: for (int i = lineText.length() - 1; i >= 0; i--) { + if (!isInLiteral.get(i)) { + switch (lineText.charAt(i)) { + case ')': + if (depth == 0) bracketStart = i; + depth++; + break; + case '(': + depth--; + if (depth == 0) { + isInBrackets.set(i, bracketStart); + } else if (depth < 0) { + break bracketLoop; + } + break; + case ']': + if (squareDepth == 0) squareBracketStart = i; + squareDepth++; + break; + case '[': + squareDepth--; + if (squareDepth == 0) { + isInBrackets.set(i, squareBracketStart); + } else if (squareDepth < 0) { + break bracketLoop; + } + break; + } + } } - } - @Override - public void mouseDragged(MouseEvent me) { - // No need to forward since the standard MouseMotionListeners are called anyway - // nop + if (depth > 0) isInBrackets.set(0, bracketStart); + if (squareDepth > 0) isInBrackets.set(0, squareBracketStart); } - @Override - public void mouseMoved(MouseEvent me) { - // No need to forward since the standard MouseMotionListeners are called anyway - if (me.getX() < Editor.LEFT_GUTTER) { - if (lastX >= Editor.LEFT_GUTTER) { - painter.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - } - } else { - if (lastX < Editor.LEFT_GUTTER) { - painter.setCursor(new Cursor(Cursor.TEXT_CURSOR)); - } + // Walk the line from the end while it makes sense + int position = currentCharIndex; + parseLoop: while (position >= 0) { + int currChar = lineText.charAt(position); + switch (currChar) { + case '.': // Grab it + position--; + break; + case '[': + break parseLoop; // End of scope + case ']': // Grab the whole region in square brackets + position = isInBrackets.previousClearBit(position-1); + break; + case '(': + if (isInBrackets.get(position)) { + position--; // This checks for first bracket while overloading + break; + } + break parseLoop; // End of scope + case ')': // Grab the whole region in brackets + position = isInBrackets.previousClearBit(position-1); + break; + case '"': // Grab the whole literal and quit + position = isInLiteral.previousClearBit(position - 1); + break parseLoop; + default: + if (Character.isJavaIdentifierPart(currChar)) { + position--; // Grab the identifier + } else if (Character.isWhitespace(currChar)) { + position--; // Grab whitespace too + } else { + break parseLoop; // Got a char ending the phrase + } + break; } - lastX = me.getX(); } - } + position++; - // appears unused, removed when looking to change completion trigger [fry 140801] - /* - public void showSuggestionLater(final DefaultListModel defListModel, final String word) { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - showSuggestion(defListModel,word); - } + // Extract phrase + String phrase = lineText.substring(position, lineText.length()).trim(); + Messages.log(phrase); - }); + if (phrase.length() == 0 || Character.isDigit(phrase.charAt(0))) { + return null; // Can't suggest for numbers or empty phrases + } + return phrase; } - */ /** - * Calculates location of caret and displays the suggestion popup at the location. - * - * @param listModel - * @param subWord + * Calculates location of caret and displays the suggestion pop-up. */ protected void showSuggestion(DefaultListModel listModel, String subWord) { + // TODO can this be ListModel instead? why is size() in DefaultListModel + // different from getSize() in ListModel (or are they, really?) hideSuggestion(); - if (listModel.size() == 0) { - Messages.log("TextArea: No suggestions to show."); - - } else { + if (listModel.size() != 0) { int position = getCaretPosition(); - Point location = new Point(); try { - location.x = offsetToX(getCaretLine(), position - - getLineStartOffset(getCaretLine())); - location.y = lineToY(getCaretLine()) - + getPainter().getFontMetrics().getHeight() + getPainter().getFontMetrics().getDescent(); - //log("TA position: " + location); - } catch (Exception e2) { - e2.printStackTrace(); - return; - } - - if (subWord.length() < 2) { - return; + Point location = + new Point(offsetToX(getCaretLine(), + position - getLineStartOffset(getCaretLine())), + lineToY(getCaretLine()) + getPainter().getLineHeight()); + suggestion = new CompletionPanel(this, position, subWord, + listModel, location, getJavaEditor()); + requestFocusInWindow(); + + } catch (Exception e) { + e.printStackTrace(); } - suggestion = new CompletionPanel(this, position, subWord, - listModel, location, editor); - requestFocusInWindow(); + } else { + Messages.log("TextArea: No suggestions to show."); } } @@ -852,7 +545,7 @@ public void hideSuggestion() { if (suggestion != null) { suggestion.setInvisible(); //log("Suggestion hidden."); - suggestion = null; + suggestion = null; // TODO: check if we dispose the window properly } } @@ -863,15 +556,23 @@ public void hideSuggestion() { // save input listeners to stop/start text edit - ComponentListener[] prevCompListeners; - MouseListener[] prevMouseListeners; - MouseMotionListener[] prevMMotionListeners; - KeyListener[] prevKeyListeners; - boolean tweakMode; + protected ComponentListener[] baseCompListeners; + protected MouseListener[] baseMouseListeners; + protected MouseMotionListener[] baseMotionListeners; + protected KeyListener[] baseKeyListeners; + protected boolean tweakMode; /* remove all standard interaction listeners */ - public void removeAllListeners() { + public void tweakRemoveListeners() { + if (baseCompListeners == null) { + // First time in tweak mode, grab the default listeners. Moved from the + // constructor since not all listeners may have been added at that point. + baseCompListeners = painter.getComponentListeners(); + baseMouseListeners = painter.getMouseListeners(); + baseMotionListeners = painter.getMouseMotionListeners(); + baseKeyListeners = editor.getKeyListeners(); + } ComponentListener[] componentListeners = painter.getComponentListeners(); MouseListener[] mouseListeners = painter.getMouseListeners(); MouseMotionListener[] mouseMotionListeners = painter.getMouseMotionListeners(); @@ -895,8 +596,8 @@ public void removeAllListeners() { public void startTweakMode() { // ignore if we are already in interactiveMode if (!tweakMode) { - removeAllListeners(); - getCustomPainter().startTweakMode(); + tweakRemoveListeners(); + getJavaPainter().startTweakMode(); this.editable = false; this.caretBlinks = false; this.setCaretVisible(false); @@ -908,9 +609,9 @@ public void startTweakMode() { public void stopTweakMode() { // ignore if we are not in interactive mode if (tweakMode) { - removeAllListeners(); - addPrevListeners(); - getCustomPainter().stopTweakMode(); + tweakRemoveListeners(); + tweakRestoreBaseListeners(); + getJavaPainter().stopTweakMode(); editable = true; caretBlinks = true; setCaretVisible(true); @@ -919,23 +620,18 @@ public void stopTweakMode() { } - public int getHorizontalScroll() { - return horizontal.getValue(); - } - - - private void addPrevListeners() { + private void tweakRestoreBaseListeners() { // add the original text-edit listeners - for (ComponentListener cl : prevCompListeners) { + for (ComponentListener cl : baseCompListeners) { painter.addComponentListener(cl); } - for (MouseListener ml : prevMouseListeners) { + for (MouseListener ml : baseMouseListeners) { painter.addMouseListener(ml); } - for (MouseMotionListener mml : prevMMotionListeners) { + for (MouseMotionListener mml : baseMotionListeners) { painter.addMouseMotionListener(mml); } - for (KeyListener kl : prevKeyListeners) { + for (KeyListener kl : baseKeyListeners) { editor.addKeyListener(kl); } } @@ -943,6 +639,6 @@ private void addPrevListeners() { public void updateInterface(List> handles, List> colorBoxes) { - getCustomPainter().updateInterface(handles, colorBoxes); + getJavaPainter().updateTweakInterface(handles, colorBoxes); } } diff --git a/java/src/processing/mode/java/pdex/JavaTextAreaPainter.java b/java/src/processing/mode/java/pdex/JavaTextAreaPainter.java index dcfe09ba47..0bd682a155 100644 --- a/java/src/processing/mode/java/pdex/JavaTextAreaPainter.java +++ b/java/src/processing/mode/java/pdex/JavaTextAreaPainter.java @@ -2,7 +2,7 @@ /* Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation +Copyright (c) 2012-16 The Processing Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 @@ -20,567 +20,50 @@ package processing.mode.java.pdex; -import processing.mode.java.JavaMode; -import processing.mode.java.JavaEditor; -import processing.mode.java.tweak.*; - -import java.awt.Color; import java.awt.Cursor; -import java.awt.Font; +import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.RenderingHints; import java.awt.Toolkit; -import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import java.awt.event.MouseMotionAdapter; import java.awt.event.MouseMotionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; -import java.util.ArrayList; import java.util.List; -import javax.swing.text.BadLocationException; -import javax.swing.text.Segment; -import javax.swing.text.Utilities; - -import processing.app.Messages; -import processing.app.Platform; import processing.app.SketchCode; -import processing.app.syntax.SyntaxDocument; +import processing.app.syntax.PdeTextAreaPainter; import processing.app.syntax.TextAreaDefaults; -import processing.app.syntax.TextAreaPainter; -import processing.app.syntax.TokenMarker; -import processing.app.ui.Editor; +import processing.mode.java.JavaEditor; +import processing.mode.java.tweak.ColorControlBox; +import processing.mode.java.tweak.ColorSelector; +import processing.mode.java.tweak.Handle; +import processing.mode.java.tweak.Settings; /** - * Customized line painter. Adds support for background colors, - * left hand gutter area with background color and text. - * TODO Most of this needs to be merged into the main TextAreaPainter, - * since it has nothing to do with Java. [fry] + * Customized line painter to handle tweak mode features. */ -public class JavaTextAreaPainter extends TextAreaPainter - implements MouseListener, MouseMotionListener { - -// protected JavaTextArea ta; // we need the subclassed textarea -// protected ErrorCheckerService errorCheckerService; - - public Color errorColor; // = new Color(0xED2630); - public Color warningColor; // = new Color(0xFFC30E); - public Color errorMarkerColor; // = new Color(0xED2630); - public Color warningMarkerColor; // = new Color(0xFFC30E); - - protected Font gutterTextFont; - protected Color gutterTextColor; - protected Color gutterLineHighlightColor; - - public static class ErrorLineCoord { - public int xStart; - public int xEnd; - public int yStart; - public int yEnd; - public Problem problem; - - public ErrorLineCoord(int xStart, int xEnd, int yStart, int yEnd, Problem problem) { - this.xStart = xStart; - this.xEnd = xEnd; - this.yStart = yStart; - this.yEnd = yEnd; - this.problem = problem; - } - } - public List errorLineCoords = new ArrayList<>(); +public class JavaTextAreaPainter extends PdeTextAreaPainter { - - public JavaTextAreaPainter(JavaTextArea textArea, TextAreaDefaults defaults) { + public JavaTextAreaPainter(final JavaTextArea textArea, TextAreaDefaults defaults) { super(textArea, defaults); - addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent evt) { - if (!getEditor().hasJavaTabs()) { // Ctrl + Click disabled for java tabs - if (evt.getButton() == MouseEvent.BUTTON1) { - if ((evt.isControlDown() && !Platform.isMacOS()) || evt.isMetaDown()) { - handleCtrlClick(evt); - } - } - } - } - }); - - // Handle mouse clicks to toggle breakpoints - addMouseListener(new MouseAdapter() { - long lastTime; // OS X seems to be firing multiple mouse events - - public void mousePressed(MouseEvent event) { - JavaEditor javaEditor = getEditor(); - // Don't toggle breakpoints when the debugger isn't enabled - // https://github.com/processing/processing/issues/3306 - if (javaEditor.isDebuggerEnabled()) { - long thisTime = event.getWhen(); - if (thisTime - lastTime > 100) { - if (event.getX() < Editor.LEFT_GUTTER) { - int offset = getTextArea().xyToOffset(event.getX(), event.getY()); - if (offset >= 0) { - int lineIndex = getTextArea().getLineOfOffset(offset); - javaEditor.toggleBreakpoint(lineIndex); - } - } - lastTime = thisTime; - } - } - } - }); - - addMouseMotionListener(new MouseMotionAdapter() { - @Override - public void mouseMoved(final MouseEvent evt) { - for (ErrorLineCoord coord : errorLineCoords) { - if (evt.getX() >= coord.xStart && evt.getX() <= coord.xEnd && - evt.getY() >= coord.yStart && evt.getY() <= coord.yEnd + 2) { - setToolTipText(coord.problem.getMessage()); - break; - } - } - } - }); - // TweakMode code tweakMode = false; cursorType = Cursor.DEFAULT_CURSOR; } - void handleCtrlClick(MouseEvent evt) { - Messages.log("--handleCtrlClick--"); - int off = textArea.xyToOffset(evt.getX(), evt.getY()); - if (off < 0) - return; - int line = textArea.getLineOfOffset(off); - if (line < 0) - return; - String s = textArea.getLineText(line); - if (s == null) - return; - else if (s.length() == 0) - return; - else { - int x = textArea.xToOffset(line, evt.getX()), x2 = x + 1, x1 = x - 1; - Messages.log("x="+x); - int xLS = off - textArea.getLineStartNonWhiteSpaceOffset(line); - if (x < 0 || x >= s.length()) - return; - String word = s.charAt(x) + ""; - if (s.charAt(x) == ' ') - return; - if (!(Character.isLetterOrDigit(s.charAt(x)) || s.charAt(x) == '_' || s.charAt(x) == '$')) - return; - int i = 0; - while (true) { - i++; - if (x1 >= 0 && x1 < s.length()) { - if (Character.isLetter(s.charAt(x1)) || s.charAt(x1) == '_') { - word = s.charAt(x1--) + word; - xLS--; - } else - x1 = -1; - } else - x1 = -1; - - if (x2 >= 0 && x2 < s.length()) { - if (Character.isLetterOrDigit(s.charAt(x2)) || s.charAt(x2) == '_' - || s.charAt(x2) == '$') - word = word + s.charAt(x2++); - else - x2 = -1; - } else - x2 = -1; - - if (x1 < 0 && x2 < 0) - break; - if (i > 200) { - // time out! - // System.err.println("Whoopsy! :P"); - break; - } - } - if (Character.isDigit(word.charAt(0))) - return; - - Messages.log(getEditor().getErrorChecker().mainClassOffset + line + "|" + line + "| offset " + xLS + word + " <= \n"); - getEditor().getErrorChecker().getASTGenerator().scrollToDeclaration(line, word, xLS); - } - } - - -// private void loadTheme(ExperimentalMode mode) { -// errorColor = mode.getThemeColor("editor.errorcolor", errorColor); -// warningColor = mode.getThemeColor("editor.warningcolor", warningColor); -// errorMarkerColor = mode.getThemeColor("editor.errormarkercolor", errorMarkerColor); -// warningMarkerColor = mode.getThemeColor("editor.warningmarkercolor", warningMarkerColor); -// } - - - /** - * Paint a line. Paints the gutter (with background color and text) then the - * line (background color and text). - * - * @param gfx - * the graphics context - * @param tokenMarker - * @param line - * 0-based line number - * @param x - * horizontal position - */ - @Override - protected void paintLine(Graphics gfx, int line, int x, - TokenMarker tokenMarker) { - try { - // TODO This line is causing NPEs randomly ever since I added the - // toggle for Java Mode/Debugger toolbar. [Manindra] - super.paintLine(gfx, line, x + Editor.LEFT_GUTTER, tokenMarker); - - } catch (Exception e) { - Messages.log(e.getMessage()); - } - - // formerly only when in debug mode - paintLeftGutter(gfx, line, x); -// paintGutterBg(gfx, line, x); -// paintGutterLine(gfx, line, x); -// paintGutterText(gfx, line, x); - - paintErrorLine(gfx, line, x); - } - - - /** - * Paint the gutter: draw the background, draw line numbers, break points. - * @param gfx the graphics context - * @param line 0-based line number - * @param x horizontal position - */ - protected void paintLeftGutter(Graphics gfx, int line, int x) { -// gfx.setColor(Color.ORANGE); - int y = textArea.lineToY(line) + fm.getLeading() + fm.getMaxDescent(); - if (line == textArea.getSelectionStopLine()) { - gfx.setColor(gutterLineHighlightColor); - } else { - gfx.setColor(getTextArea().gutterBgColor); - } - gfx.fillRect(0, y, Editor.LEFT_GUTTER, fm.getHeight()); - - String text = null; - if (getEditor().isDebuggerEnabled()) { - text = getTextArea().getGutterText(line); - } - // if no special text for a breakpoint, just show the line number - if (text == null) { - text = String.valueOf(line + 1); - //text = makeOSF(String.valueOf(line + 1)); - } - char[] txt = text.toCharArray(); - - //gfx.setFont(getFont()); - gfx.setFont(gutterTextFont); - // Right-align the text - int tx = Editor.LEFT_GUTTER - Editor.GUTTER_MARGIN - - gfx.getFontMetrics().charsWidth(txt, 0, txt.length); - gfx.setColor(gutterTextColor); - // Using 'fm' here because it's relative to the editor text size, - // not the numbers in the gutter - int ty = textArea.lineToY(line) + fm.getHeight(); - Utilities.drawTabbedText(new Segment(txt, 0, text.length()), - tx, ty, gfx, this, 0); - } - - - /* - // Failed attempt to switch line numbers to old-style figures - String makeOSF(String what) { - char[] c = what.toCharArray(); - for (int i = 0; i < c.length; i++) { - c[i] += (char) (c[i] - '0' + 0x362); - } - return new String(c); - } - */ - - - /** - * Paint the background color of a line. - * - * @param gfx - * the graphics context - * @param line - * 0-based line number - * @param x - */ - protected void paintLineBgColor(Graphics gfx, int line, int x) { - int y = textArea.lineToY(line); - y += fm.getLeading() + fm.getMaxDescent(); - int height = fm.getHeight(); - - // get the color - Color col = getTextArea().getLineBgColor(line); - //System.out.print("bg line " + line + ": "); - // no need to paint anything - if (col == null) { - //log("none"); - return; - } - // paint line background - gfx.setColor(col); - gfx.fillRect(0, y, getWidth(), height); - } - - - /** - * Paints the underline for an error/warning line - * - * @param gfx - * the graphics context - * @param tokenMarker - * @param line - * 0-based line number: NOTE - * @param x - */ - protected void paintErrorLine(Graphics gfx, int line, int x) { - ErrorCheckerService ecs = getEditor().getErrorChecker(); - if (ecs == null || ecs.problemsList == null) { - return; - } - - boolean notFound = true; - boolean isWarning = false; - Problem problem = null; - - errorLineCoords.clear(); - // Check if current line contains an error. If it does, find if it's an - // error or warning - for (ErrorMarker emarker : getEditor().getErrorPoints()) { - if (emarker.getProblem().getLineNumber() == line) { - notFound = false; - if (emarker.getType() == ErrorMarker.Warning) { - isWarning = true; - } - problem = emarker.getProblem(); - //log(problem.toString()); - break; - } - } - - if (notFound) { - return; - } - - // Determine co-ordinates - // log("Hoff " + ta.getHorizontalOffset() + ", " + - // horizontalAdjustment); - int y = textArea.lineToY(line); - y += fm.getLeading() + fm.getMaxDescent(); -// int height = fm.getHeight(); - int start = textArea.getLineStartOffset(line) + problem.getPDELineStartOffset(); - int pLength = problem.getPDELineStopOffset() + 1 - problem.getPDELineStartOffset(); - - try { - String badCode = null; - String goodCode = null; - try { - SyntaxDocument doc = textArea.getDocument(); - badCode = doc.getText(start, pLength); - goodCode = doc.getText(textArea.getLineStartOffset(line), problem.getPDELineStartOffset()); - //log("paintErrorLine() LineText GC: " + goodCode); - //log("paintErrorLine() LineText BC: " + badCode); - } catch (BadLocationException bl) { - // Error in the import statements or end of code. - // System.out.print("BL caught. " + ta.getLineCount() + " ," - // + line + " ,"); - // log((ta.getLineStopOffset(line) - start - 1)); - return; - } - - // Take care of offsets - int aw = fm.stringWidth(trimRight(badCode)) + textArea.getHorizontalOffset(); // apparent width. Whitespaces - // to the left of line + text - // width - int rw = fm.stringWidth(badCode.trim()); // real width - int x1 = fm.stringWidth(goodCode) + (aw - rw), y1 = y + fm.getHeight() - - 2, x2 = x1 + rw; - // Adding offsets for the gutter - x1 += Editor.LEFT_GUTTER; - x2 += Editor.LEFT_GUTTER; - - errorLineCoords.add(new ErrorLineCoord(x1, x2, y, y1, problem)); - - // gfx.fillRect(x1, y, rw, height); - - // Let the painting begin! - - // Little rect at starting of a line containing errors - disabling it for now -// gfx.setColor(errorMarkerColor); -// if (isWarning) { -// gfx.setColor(warningMarkerColor); -// } -// gfx.fillRect(1, y + 2, 3, height - 2); - - gfx.setColor(errorColor); - if (isWarning) { - gfx.setColor(warningColor); - } - int xx = x1; - - // Draw the jagged lines - while (xx < x2) { - gfx.drawLine(xx, y1, xx + 2, y1 + 1); - xx += 2; - gfx.drawLine(xx, y1 + 1, xx + 2, y1); - xx += 2; - } - } catch (Exception e) { - System.out - .println("Looks like I messed up! XQTextAreaPainter.paintLine() : " - + e); - //e.printStackTrace(); - } - - // Won't highlight the line. Select the text instead. - // gfx.setColor(Color.RED); - // gfx.fillRect(2, y, 3, height); - } - + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - /** - * Trims out trailing whitespaces (to the right) - * - * @param string - * @return - String - */ - static private String trimRight(String string) { - String newString = ""; - for (int i = 0; i < string.length(); i++) { - if (string.charAt(i) != ' ') { - newString = string.substring(0, i) + string.trim(); - break; - } - } - return newString; - } - - - /** - * Sets ErrorCheckerService and loads theme for TextAreaPainter(XQMode) - * - * @param ecs - * @param mode - */ - public void setMode(JavaMode mode) { - //this.errorCheckerService = ecs; - //loadTheme(mode); - - errorColor = mode.getColor("editor.errorcolor"); //, errorColor); - warningColor = mode.getColor("editor.warningcolor"); //, warningColor); - errorMarkerColor = mode.getColor("editor.errormarkercolor"); //, errorMarkerColor); - warningMarkerColor = mode.getColor("editor.warningmarkercolor"); //, warningMarkerColor); - - gutterTextFont = mode.getFont("editor.gutter.text.font"); - gutterTextColor = mode.getColor("editor.gutter.text.color"); - gutterLineHighlightColor = mode.getColor("editor.gutter.linehighlight.color"); - } - - - @Override - public String getToolTipText(MouseEvent event) { - if (!getEditor().hasJavaTabs()) { - int off = textArea.xyToOffset(event.getX(), event.getY()); - if (off < 0) { - setToolTipText(null); - return super.getToolTipText(event); - } - int line = textArea.getLineOfOffset(off); - if (line < 0) { - setToolTipText(null); - return super.getToolTipText(event); - } - String s = textArea.getLineText(line); - if (s == "") { - return event.toString(); - - } else if (s.length() == 0) { - setToolTipText(null); - return super.getToolTipText(event); - - } else { - int x = textArea.xToOffset(line, event.getX()), x2 = x + 1, x1 = x - 1; - int xLS = off - textArea.getLineStartNonWhiteSpaceOffset(line); - if (x < 0 || x >= s.length()) { - setToolTipText(null); - return super.getToolTipText(event); - } - String word = s.charAt(x) + ""; - if (s.charAt(x) == ' ') { - setToolTipText(null); - return super.getToolTipText(event); - } - if (!(Character.isLetterOrDigit(s.charAt(x)) || - s.charAt(x) == '_' || s.charAt(x) == '$')) { - setToolTipText(null); - return super.getToolTipText(event); - } - int i = 0; - while (true) { - i++; - if (x1 >= 0 && x1 < s.length()) { - if (Character.isLetter(s.charAt(x1)) || s.charAt(x1) == '_') { - word = s.charAt(x1--) + word; - xLS--; - } else - x1 = -1; - } else - x1 = -1; - - if (x2 >= 0 && x2 < s.length()) { - if (Character.isLetterOrDigit(s.charAt(x2)) || s.charAt(x2) == '_' - || s.charAt(x2) == '$') - word = word + s.charAt(x2++); - else - x2 = -1; - } else - x2 = -1; - - if (x1 < 0 && x2 < 0) - break; - if (i > 200) { - // time out! - // System.err.println("Whoopsy! :P"); - break; - } - } - if (Character.isDigit(word.charAt(0))) { - setToolTipText(null); - return super.getToolTipText(event); - } - String tooltipText = getEditor().getErrorChecker().getASTGenerator() - .getLabelForASTNode(line, word, xLS); - - // log(errorCheckerService.mainClassOffset + " MCO " - // + "|" + line + "| offset " + xLS + word + " <= offf: "+off+ "\n"); - if (tooltipText != null) { - return tooltipText; - } - } - } - // Used when there are Java tabs, but also the fall-through case from above -// setToolTipText(null); - return super.getToolTipText(event); - } + // TWEAK MODE - // TweakMode code protected int horizontalAdjustment = 0; public boolean tweakMode = false; @@ -592,8 +75,16 @@ public String getToolTipText(MouseEvent event) { int cursorType; BufferedImage cursorImg = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB); - Cursor blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, new Point(0, 0), "blank cursor"); - + Cursor blankCursor; + // this is a temporary workaround for the CHIP, will be removed + { + Dimension cursorSize = Toolkit.getDefaultToolkit().getBestCursorSize(16, 16); + if (cursorSize.width == 0 || cursorSize.height == 0) { + blankCursor = Cursor.getDefaultCursor(); + } else { + blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, new Point(0, 0), "blank cursor"); + } + } @Override synchronized public void paint(Graphics gfx) { @@ -630,8 +121,93 @@ synchronized public void paint(Graphics gfx) { protected void startTweakMode() { - addMouseListener(this); - addMouseMotionListener(this); + addMouseListener(new MouseListener() { + + @Override + public void mouseReleased(MouseEvent e) { + if (mouseHandle != null) { + mouseHandle.resetProgress(); + mouseHandle = null; + + updateCursor(e.getX(), e.getY()); + repaint(); + } + } + + @Override + public void mousePressed(MouseEvent e) { + int currentTab = getCurrentCodeIndex(); + // check for clicks on number handles + for (Handle n : handles.get(currentTab)) { + if (n.pick(e.getX(), e.getY())) { + cursorType = -1; + JavaTextAreaPainter.this.setCursor(blankCursor); + mouseHandle = n; + mouseHandle.setCenterX(e.getX()); + repaint(); + return; + } + } + + // check for clicks on color boxes + for (ColorControlBox box : colorBoxes.get(currentTab)) { + if (box.pick(e.getX(), e.getY())) { + if (colorSelector != null) { + // we already show a color selector, close it + colorSelector.frame.dispatchEvent(new WindowEvent(colorSelector.frame, WindowEvent.WINDOW_CLOSING)); + } + + colorSelector = new ColorSelector(box); + colorSelector.frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + colorSelector.frame.setVisible(false); + colorSelector = null; + } + }); + colorSelector.show(getLocationOnScreen().x + e.getX() + 30, + getLocationOnScreen().y + e.getY() - 130); + } + } + } + + @Override + public void mouseExited(MouseEvent e) { } + + @Override + public void mouseEntered(MouseEvent e) { } + + @Override + public void mouseClicked(MouseEvent e) { } + }); + + addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + updateCursor(e.getX(), e.getY()); + + if (!Settings.alwaysShowColorBoxes) { + showHideColorBoxes(e.getY()); + } + } + + @Override + public void mouseDragged(MouseEvent e) { + if (mouseHandle != null) { + // set the current drag amount of the arrows + mouseHandle.setCurrentX(e.getX()); + + // update code text with the new value + updateCodeText(); + + if (colorSelector != null) { + colorSelector.refreshColor(); + } + + repaint(); + } + } + }); tweakMode = true; setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); repaint(); @@ -653,12 +229,12 @@ protected void stopTweakMode() { } - protected void updateInterface(List> handles, - List> colorBoxes) { + protected void updateTweakInterface(List> handles, + List> colorBoxes) { this.handles = handles; this.colorBoxes = colorBoxes; - initInterfacePositions(); + updateTweakInterfacePositions(); repaint(); } @@ -668,13 +244,13 @@ protected void updateInterface(List> handles, * synchronize this method to prevent the execution of 'paint' in the middle. * (don't paint while we make changes to the text of the editor) */ - private synchronized void initInterfacePositions() { + private synchronized void updateTweakInterfacePositions() { SketchCode[] code = getEditor().getSketch().getCode(); int prevScroll = textArea.getVerticalScrollPosition(); String prevText = textArea.getText(); for (int tab=0; tab - */ -public class OffsetMatcher { - public ArrayList offsetMatch; - String pdeCodeLine, javaCodeLine; - boolean matchingNeeded = false; - - - public OffsetMatcher(String pdeCode, String javaCode) { - this.pdeCodeLine = pdeCode; - this.javaCodeLine = javaCode; - if(pdeCodeLine.trim().equals(javaCodeLine.trim())){ //TODO: trim() needed here? - matchingNeeded = false; - offsetMatch = new ArrayList(); - //log("Offset Matching not needed"); - } else { - matchingNeeded = true; - minDistance(); - } - } - - - public int getPdeOffForJavaOff(int start, int length) { -// log("PDE :" + pdeCodeLine + "\nJAVA:" + javaCodeLine); -// log("getPdeOffForJavaOff() start:" + start + ", len " + length); - if(!matchingNeeded) return start; - int ans = getPdeOffForJavaOff(start); - int end = getPdeOffForJavaOff(start + length - 1); - if(ans == -1 || end == -1){ -// log("ans: " + ans + " end: " + end); - } else { -// log(start + " java start off, pde start off " -// + ans); -// log((start + length - 1) + " java end off, pde end off " -// + end); -// log("J: " + javaCodeLine.substring(start, start + length) + "\nP: " -// + pdeCodeLine.substring(ans, end + 1)); - } - return ans; - } - - - public int getJavaOffForPdeOff(int start, int length) { - if(!matchingNeeded) return start; - int ans = getJavaOffForPdeOff(start); -// log(start + " pde start off, java start off " -// + getJavaOffForPdeOff(start)); -// log((start + length - 1) + " pde end off, java end off " -// + getJavaOffForPdeOff(start + length - 1)); - return ans; - } - - - public int getPdeOffForJavaOff(int javaOff) { - if (!matchingNeeded) - return javaOff; - for (int i = offsetMatch.size() - 1; i >= 0; i--) { - if (offsetMatch.get(i).javaOffset < javaOff) { - continue; - } else if (offsetMatch.get(i).javaOffset == javaOff) { -// int j = i; - - // sometimes there are multiple repeated j offsets for a single pde offset - // so go to the last one, with bound check - while (i > 0 && offsetMatch.get(--i).javaOffset == javaOff) { -// log("MP " + offsetMatch.get(i).javaOffset + " " -// + offsetMatch.get(i).pdeOffset); - } - if (i + 1 < offsetMatch.size()) { // bounds check, see #2664 - int pdeOff = offsetMatch.get(++i).pdeOffset; - while (i > 0 && offsetMatch.get(--i).pdeOffset == pdeOff) { - } - } - int j = i + 1; - if (j > -1 && j < offsetMatch.size()) - return offsetMatch.get(j).pdeOffset; - } - - } - return -1; - } - - - public int getJavaOffForPdeOff(int pdeOff) { - if(!matchingNeeded) return pdeOff; - for (int i = offsetMatch.size() - 1; i >= 0; i--) { - if (offsetMatch.get(i).pdeOffset < pdeOff) { - continue; - } else if (offsetMatch.get(i).pdeOffset == pdeOff) { -// int j = i; - while (i > 0 && offsetMatch.get(--i).pdeOffset == pdeOff) { -// log("MP " + offsetMatch.get(i).javaOffset + " " -// + offsetMatch.get(i).pdeOffset); - } - if (i + 1 < offsetMatch.size()) { // bounds check, see #2664 - int javaOff = offsetMatch.get(++i).javaOffset; - while (i > 0 && offsetMatch.get(--i).javaOffset == javaOff) { - } - } - int j = i + 1; - if (j > -1 && j < offsetMatch.size()) - return offsetMatch.get(j).javaOffset; - } - - } - return -1; - } - - - /** - * Finds 'distance' between two Strings. - * See Edit Distance Problem - * https://secweb.cs.odu.edu/~zeil/cs361/web/website/Lectures/styles/pages/editdistance.html - * http://www.stanford.edu/class/cs124/lec/med.pdf - */ - private int minDistance() { - -// word1 = reverse(word1); -// word2 = reverse(word2); - int len1 = pdeCodeLine.length(); - int len2 = javaCodeLine.length(); - // log(pdeCodeLine + " len: " + len1); - // log(javaCodeLine + " len: " + len2); - // len1+1, len2+1, because finally return dp[len1][len2] - int[][] dp = new int[len1 + 1][len2 + 1]; - - for (int i = 0; i <= len1; i++) { - dp[i][0] = i; - } - - for (int j = 0; j <= len2; j++) { - dp[0][j] = j; - } - - //iterate though, and check last char - for (int i = 0; i < len1; i++) { - char c1 = pdeCodeLine.charAt(i); - for (int j = 0; j < len2; j++) { - char c2 = javaCodeLine.charAt(j); - //System.out.print(c1 + "<->" + c2); - //if last two chars equal - if (c1 == c2) { - //update dp value for +1 length - dp[i + 1][j + 1] = dp[i][j]; -// log(); - } else { - int replace = dp[i][j] + 1; - int insert = dp[i][j + 1] + 1; - int delete = dp[i + 1][j] + 1; -// if (replace < delete) { -// log(" --- D"); -// } else -// log(" --- R"); - int min = replace > insert ? insert : replace; - min = delete > min ? min : delete; - dp[i + 1][j + 1] = min; - } - } - } - - ArrayList alist = new ArrayList(); - offsetMatch = alist; - minDistInGrid(dp, len1, len2, 0, 0, pdeCodeLine.toCharArray(), - javaCodeLine.toCharArray(), alist); - return dp[len1][len2]; - } - - - private void minDistInGrid(int g[][], int i, int j, int fi, int fj, - char s1[], char s2[], ArrayList set) { -// if(i < s1.length)System.out.print(s1[i] + " <->"); -// if(j < s2.length)System.out.print(s2[j]); - if (i < s1.length && j < s2.length) { -// pdeCodeMap[k] = i; -// javaCodeMap[k] = j; - //System.out.print(s1[i] + " " + i + " <-> " + j + " " + s2[j]); - set.add(new OffsetPair(i, j)); -// if (s1[i] != s2[j]) -// System.out.println("--"); - } - //System.out.println(); - if (i == fi && j == fj) { - //System.out.println("Reached end."); - } else { - int a = Integer.MAX_VALUE, b = a, c = a; - if (i > 0) - a = g[i - 1][j]; - if (j > 0) - b = g[i][j - 1]; - if (i > 0 && j > 0) - c = g[i - 1][j - 1]; - int mini = Math.min(a, Math.min(b, c)); - if (mini == a) { - //System.out.println(s1[i + 1] + " " + s2[j]); - minDistInGrid(g, i - 1, j, fi, fj, s1, s2, set); - } else if (mini == b) { - //System.out.println(s1[i] + " " + s2[j + 1]); - minDistInGrid(g, i, j - 1, fi, fj, s1, s2, set); - } else if (mini == c) { - //System.out.println(s1[i + 1] + " " + s2[j + 1]); - minDistInGrid(g, i - 1, j - 1, fi, fj, s1, s2, set); - } - } - } - - - private class OffsetPair { - public final int pdeOffset, javaOffset; - - public OffsetPair(int pde, int java) { - pdeOffset = pde; - javaOffset = java; - } - } - - - /* - public static void main(String[] args) { -// minDistance("c = #qwerty;", "c = 0xffqwerty;"); - OffsetMatcher a; - -// a = new OffsetMatcher("int a = int(can); int ball;", -// "int a = PApplet.parseInt(can); int ball;"); -// a.getPdeOffForJavaOff(25, 3); -// a.getJavaOffForPdeOff(12, 3); -// minDistance("static void main(){;", "public static void main(){;"); -// minDistance("#bb00aa", "0xffbb00aa"); -// a = new OffsetMatcher("void test(ArrayList boids){", -// "public void test(ArrayList boids){"); -// a.getJavaOffForPdeOff(20,4); - a = new OffsetMatcher("}", "\n"); - a.getPdeOffForJavaOff(0,1); - a = new OffsetMatcher("color abc = #qwerty;", "int abc = 0xffqwerty;"); - a.getPdeOffForJavaOff(4, 3); -// a.getJavaOffForPdeOff(6, 3); -// distance("c = #bb00aa;", "c = 0xffbb00aa;"); - } - */ -} - diff --git a/java/src/processing/mode/java/pdex/PDEX.java b/java/src/processing/mode/java/pdex/PDEX.java new file mode 100644 index 0000000000..2a6790a7d2 --- /dev/null +++ b/java/src/processing/mode/java/pdex/PDEX.java @@ -0,0 +1,107 @@ +package processing.mode.java.pdex; + +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import javax.swing.text.Document; + +import processing.app.SketchCode; +import processing.mode.java.JavaEditor; + + +public class PDEX { + static private final boolean SHOW_DEBUG_TREE = false; + + private boolean enabled = true; + + private ErrorChecker errorChecker; + + private InspectMode inspect; + private ShowUsage usage; + private Rename rename; + private DebugTree debugTree; + + private PreprocessingService pps; + + + public PDEX(JavaEditor editor, PreprocessingService pps) { + this.pps = pps; + + this.enabled = !editor.hasJavaTabs(); + + errorChecker = new ErrorChecker(editor, pps); + + usage = new ShowUsage(editor, pps); + inspect = new InspectMode(editor, pps, usage); + rename = new Rename(editor, pps, usage); + + if (SHOW_DEBUG_TREE) { + debugTree = new DebugTree(editor, pps); + } + + for (SketchCode code : editor.getSketch().getCode()) { + Document document = code.getDocument(); + addDocumentListener(document); + } + + sketchChanged(); + } + + + public void addDocumentListener(Document doc) { + if (doc != null) doc.addDocumentListener(sketchChangedListener); + } + + + final DocumentListener sketchChangedListener = new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + sketchChanged(); + } + + @Override + public void removeUpdate(DocumentEvent e) { + sketchChanged(); + } + + @Override + public void changedUpdate(DocumentEvent e) { + sketchChanged(); + } + }; + + + public void sketchChanged() { + errorChecker.notifySketchChanged(); + pps.notifySketchChanged(); + } + + + public void preferencesChanged() { + errorChecker.preferencesChanged(); + sketchChanged(); + } + + + public void hasJavaTabsChanged(boolean hasJavaTabs) { + enabled = !hasJavaTabs; + if (!enabled) { + usage.hide(); + } + } + + + public void dispose() { + inspect.dispose(); + errorChecker.dispose(); + usage.dispose(); + rename.dispose(); + if (debugTree != null) { + debugTree.dispose(); + } + } + + + public void documentChanged(Document newDoc) { + addDocumentListener(newDoc); + } +} diff --git a/java/src/processing/mode/java/pdex/PreprocessedSketch.java b/java/src/processing/mode/java/pdex/PreprocessedSketch.java new file mode 100644 index 0000000000..3dc328967e --- /dev/null +++ b/java/src/processing/mode/java/pdex/PreprocessedSketch.java @@ -0,0 +1,274 @@ +package processing.mode.java.pdex; + +import com.google.classpath.ClassPath; + +import org.eclipse.jdt.core.compiler.IProblem; +import org.eclipse.jdt.core.dom.ASTNode; +import org.eclipse.jdt.core.dom.CompilationUnit; + +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import processing.app.Sketch; +import processing.core.PApplet; +import processing.mode.java.pdex.TextTransform.OffsetMapper; + +public class PreprocessedSketch { + + public final Sketch sketch; + + public final CompilationUnit compilationUnit; + + public final String[] classPathArray; + public final ClassPath classPath; + public final URLClassLoader classLoader; + + public final String[] searchClassPathArray; + + public final int[] tabStartOffsets; + + public final String scrubbedPdeCode; + public final String pdeCode; + public final String javaCode; + + public final OffsetMapper offsetMapper; + + public final boolean hasSyntaxErrors; + public final boolean hasCompilationErrors; + + public final List programImports; + public final List coreAndDefaultImports; + public final List codeFolderImports; + + + + /// JAVA -> SKETCH ----------------------------------------------------------- + + + public static class SketchInterval { + + public static final SketchInterval BEFORE_START = new SketchInterval(-1, -1, -1, -1, -1); + + private SketchInterval(int tabIndex, + int startTabOffset, int stopTabOffset, + int startPdeOffset, int stopPdeOffset) { + this.tabIndex = tabIndex; + this.startTabOffset = startTabOffset; + this.stopTabOffset = stopTabOffset; + this.startPdeOffset = startPdeOffset; + this.stopPdeOffset = stopPdeOffset; + } + + final int tabIndex; + final int startTabOffset; + final int stopTabOffset; + + final int startPdeOffset; + final int stopPdeOffset; + } + + + public boolean inRange(SketchInterval interval) { + return interval != SketchInterval.BEFORE_START && + interval.stopPdeOffset < pdeCode.length(); + } + + + public String getPdeCode(SketchInterval si) { + if (si == SketchInterval.BEFORE_START) return ""; + int stop = Math.min(si.stopPdeOffset, pdeCode.length()); + int start = Math.min(si.startPdeOffset, stop); + return pdeCode.substring(start, stop); + } + + + public SketchInterval mapJavaToSketch(ASTNode node) { + return mapJavaToSketch(node.getStartPosition(), + node.getStartPosition() + node.getLength()); + } + + + public SketchInterval mapJavaToSketch(IProblem iproblem) { + return mapJavaToSketch(iproblem.getSourceStart(), + iproblem.getSourceEnd() + 1); // make it exclusive + } + + + public SketchInterval mapJavaToSketch(int startJavaOffset, int stopJavaOffset) { + int length = stopJavaOffset - startJavaOffset; + int startPdeOffset = javaOffsetToPdeOffset(startJavaOffset); + int stopPdeOffset; + if (length == 0) { + stopPdeOffset = startPdeOffset; + } else { + stopPdeOffset = javaOffsetToPdeOffset(stopJavaOffset-1); + if (stopPdeOffset >= 0 && (stopPdeOffset > startPdeOffset || length == 1)) { + stopPdeOffset += 1; + } + } + + if (startPdeOffset < 0 || stopPdeOffset < 0) { + return SketchInterval.BEFORE_START; + } + + int tabIndex = pdeOffsetToTabIndex(startPdeOffset); + + if (startPdeOffset >= pdeCode.length()) { + startPdeOffset = pdeCode.length() - 1; + stopPdeOffset = startPdeOffset + 1; + } + + return new SketchInterval(tabIndex, + pdeOffsetToTabOffset(tabIndex, startPdeOffset), + pdeOffsetToTabOffset(tabIndex, stopPdeOffset), + startPdeOffset, stopPdeOffset); + } + + + private int javaOffsetToPdeOffset(int javaOffset) { + return offsetMapper.getInputOffset(javaOffset); + } + + + public int pdeOffsetToTabIndex(int pdeOffset) { + pdeOffset = Math.max(0, pdeOffset); + int tab = Arrays.binarySearch(tabStartOffsets, pdeOffset); + if (tab < 0) { + tab = -(tab + 1) - 1; + } + return tab; + } + + + public int pdeOffsetToTabOffset(int tabIndex, int pdeOffset) { + int tabStartOffset = tabStartOffsets[clipTabIndex(tabIndex)]; + return pdeOffset - tabStartOffset; + } + + + + /// SKETCH -> JAVA ----------------------------------------------------------- + + + public int tabOffsetToJavaOffset(int tabIndex, int tabOffset) { + int tabStartOffset = tabStartOffsets[clipTabIndex(tabIndex)]; + int pdeOffset = tabStartOffset + tabOffset; + return offsetMapper.getOutputOffset(pdeOffset); + } + + + + /// LINE NUMBERS ------------------------------------------------------------- + + + public int tabOffsetToJavaLine(int tabIndex, int tabOffset) { + int javaOffset = tabOffsetToJavaOffset(tabIndex, tabOffset); + return offsetToLine(javaCode, javaOffset); + } + + + public int tabOffsetToTabLine(int tabIndex, int tabOffset) { + int tabStartOffset = tabStartOffsets[clipTabIndex(tabIndex)]; + return offsetToLine(pdeCode, tabStartOffset, tabStartOffset + tabOffset); + } + + + // TODO: optimize + private static int offsetToLine(String text, int offset) { + return offsetToLine(text, 0, offset); + } + + + // TODO: optimize + private static int offsetToLine(String text, int start, int offset) { + int line = 0; + while (offset >= start) { + offset = text.lastIndexOf('\n', offset-1); + line++; + } + return line - 1; + } + + + + /// Util --------------------------------------------------------------------- + + private int clipTabIndex(int tabIndex) { + return PApplet.constrain(tabIndex, 0, tabStartOffsets.length - 1); + } + + + + /// BUILDER BUSINESS ///////////////////////////////////////////////////////// + + /** + * There is a lot of fields and having constructor with this many parameters + * is just not practical. Fill stuff into builder and then simply build it. + * Builder also guards against calling methods in the middle of building process. + */ + + public static class Builder { + public Sketch sketch; + + public CompilationUnit compilationUnit; + + public String[] classPathArray; + public ClassPath classPath; + public URLClassLoader classLoader; + + public String[] searchClassPathArray; + + public int[] tabStartOffsets = new int[0]; + + public String scrubbedPdeCode; + public String pdeCode; + public String javaCode; + + public OffsetMapper offsetMapper; + + public boolean hasSyntaxErrors; + public boolean hasCompilationErrors; + + public final List programImports = new ArrayList<>(); + public final List coreAndDefaultImports = new ArrayList<>(); + public final List codeFolderImports = new ArrayList<>(); + + public PreprocessedSketch build() { + return new PreprocessedSketch(this); + } + } + + public static PreprocessedSketch empty() { + return new Builder().build(); + } + + private PreprocessedSketch(Builder b) { + sketch = b.sketch; + + compilationUnit = b.compilationUnit; + + classPathArray = b.classPathArray; + classPath = b.classPath; + classLoader = b.classLoader; + + searchClassPathArray = b.searchClassPathArray; + + tabStartOffsets = b.tabStartOffsets; + + scrubbedPdeCode = b.scrubbedPdeCode; + pdeCode = b.pdeCode; + javaCode = b.javaCode; + + offsetMapper = b.offsetMapper != null ? b.offsetMapper : OffsetMapper.EMPTY_MAPPER; + + hasSyntaxErrors = b.hasSyntaxErrors; + hasCompilationErrors = b.hasCompilationErrors; + + programImports = Collections.unmodifiableList(b.programImports); + coreAndDefaultImports = Collections.unmodifiableList(b.coreAndDefaultImports); + codeFolderImports = Collections.unmodifiableList(b.codeFolderImports); + } +} diff --git a/java/src/processing/mode/java/pdex/PreprocessingService.java b/java/src/processing/mode/java/pdex/PreprocessingService.java new file mode 100644 index 0000000000..b50e117990 --- /dev/null +++ b/java/src/processing/mode/java/pdex/PreprocessingService.java @@ -0,0 +1,725 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* +Part of the Processing project - http://processing.org +Copyright (c) 2012-15 The Processing Foundation + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +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. +*/ + +package processing.mode.java.pdex; + +import com.google.classpath.ClassPathFactory; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CopyOnWriteArraySet; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.stream.StreamSupport; + +import javax.swing.text.BadLocationException; + +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.compiler.IProblem; +import org.eclipse.jdt.core.dom.AST; +import org.eclipse.jdt.core.dom.ASTParser; +import org.eclipse.jdt.core.dom.CompilationUnit; + +import processing.app.Library; +import processing.app.Messages; +import processing.app.Sketch; +import processing.app.SketchCode; +import processing.app.SketchException; +import processing.app.Util; +import processing.data.IntList; +import processing.data.StringList; +import processing.mode.java.JavaEditor; +import processing.mode.java.JavaMode; +import processing.mode.java.pdex.TextTransform.OffsetMapper; +import processing.mode.java.preproc.PdePreprocessor; +import processing.mode.java.preproc.PdePreprocessor.Mode; + + +/** + * The main error checking service + */ +public class PreprocessingService { + + protected final JavaEditor editor; + + protected final ASTParser parser = ASTParser.newParser(AST.JLS8); + + private final ClassPathFactory classPathFactory = new ClassPathFactory(); + + private final Thread preprocessingThread; + private final BlockingQueue requestQueue = new ArrayBlockingQueue<>(1); + + private final Object requestLock = new Object(); + + private final AtomicBoolean codeFolderChanged = new AtomicBoolean(true); + private final AtomicBoolean librariesChanged = new AtomicBoolean(true); + + private volatile boolean running; + private CompletableFuture preprocessingTask = new CompletableFuture<>(); + + private CompletableFuture lastCallback = + new CompletableFuture() {{ + complete(null); // initialization block + }}; + + private volatile boolean isEnabled = true; + + + public PreprocessingService(JavaEditor editor) { + this.editor = editor; + isEnabled = !editor.hasJavaTabs(); + + // Register listeners for first run + whenDone(this::fireListeners); + + preprocessingThread = new Thread(this::mainLoop, "ECS"); + preprocessingThread.start(); + } + + + private void mainLoop() { + running = true; + PreprocessedSketch prevResult = null; + CompletableFuture runningCallbacks = null; + Messages.log("PPS: Hi!"); + while (running) { + try { + try { + requestQueue.take(); // blocking until requested + } catch (InterruptedException e) { + running = false; + break; + } + + Messages.log("PPS: Starting"); + + prevResult = preprocessSketch(prevResult); + + // Wait until callbacks finish before firing new wave + // If new request arrives while waiting, break out and start preprocessing + while (requestQueue.isEmpty() && runningCallbacks != null) { + try { + runningCallbacks.get(10, TimeUnit.MILLISECONDS); + runningCallbacks = null; + } catch (TimeoutException e) { } + } + + synchronized (requestLock) { + if (requestQueue.isEmpty()) { + runningCallbacks = lastCallback; + Messages.log("PPS: Done"); + preprocessingTask.complete(prevResult); + } + } + } catch (Exception e) { + Messages.loge("problem in preprocessor service loop", e); + } + } + Messages.log("PPS: Bye!"); + } + + + public void dispose() { + cancel(); + running = false; + preprocessingThread.interrupt(); + } + + + public void cancel() { + requestQueue.clear(); + } + + + public void notifySketchChanged() { + if (!isEnabled) return; + synchronized (requestLock) { + if (preprocessingTask.isDone()) { + preprocessingTask = new CompletableFuture<>(); + // Register callback which executes all listeners + whenDone(this::fireListeners); + } + requestQueue.offer(Boolean.TRUE); + } + } + + + public void notifyLibrariesChanged() { + Messages.log("PPS: notified libraries changed"); + librariesChanged.set(true); + notifySketchChanged(); + } + + + public void notifyCodeFolderChanged() { + Messages.log("PPS: snotified code folder changed"); + codeFolderChanged.set(true); + notifySketchChanged(); + } + + + private CompletableFuture registerCallback(Consumer callback) { + synchronized (requestLock) { + lastCallback = preprocessingTask + // Run callback after both preprocessing task and previous callback + .thenAcceptBothAsync(lastCallback, (ps, a) -> callback.accept(ps)) + // Make sure exception in callback won't cancel whole callback chain + .handleAsync((res, e) -> { + if (e != null) Messages.loge("PPS: exception in callback", e); + return res; + }); + return lastCallback; + } + } + + + public void whenDone(Consumer callback) { + if (!isEnabled) return; + registerCallback(callback); + } + + + public void whenDoneBlocking(Consumer callback) { + if (!isEnabled) return; + try { + registerCallback(callback).get(3000, TimeUnit.SECONDS); + } catch (InterruptedException | ExecutionException | TimeoutException e) { + // Don't care + } + } + + + + /// LISTENERS ---------------------------------------------------------------- + + + private Set> listeners = new CopyOnWriteArraySet<>(); + + + public void registerListener(Consumer listener) { + if (listener != null) listeners.add(listener); + } + + + public void unregisterListener(Consumer listener) { + listeners.remove(listener); + } + + + private void fireListeners(PreprocessedSketch ps) { + for (Consumer listener : listeners) { + try { + listener.accept(ps); + } catch (Exception e) { + Messages.loge("error when firing preprocessing listener", e); + } + } + } + + + /// -------------------------------------------------------------------------- + + + private PreprocessedSketch preprocessSketch(PreprocessedSketch prevResult) { + + boolean firstCheck = prevResult == null; + + PreprocessedSketch.Builder result = new PreprocessedSketch.Builder(); + + List codeFolderImports = result.codeFolderImports; + List programImports = result.programImports; + + JavaMode javaMode = (JavaMode) editor.getMode(); + Sketch sketch = result.sketch = editor.getSketch(); + String className = sketch.getName(); + + StringBuilder workBuffer = new StringBuilder(); + + // Combine code into one buffer + IntList tabStartsList = new IntList(); + for (SketchCode sc : sketch.getCode()) { + if (sc.isExtension("pde")) { + tabStartsList.append(workBuffer.length()); + if (sc.getDocument() != null) { + try { + workBuffer.append(sc.getDocumentText()); + } catch (BadLocationException e) { + e.printStackTrace(); + } + } else { + workBuffer.append(sc.getProgram()); + } + workBuffer.append('\n'); + } + } + result.tabStartOffsets = tabStartsList.array(); + + String pdeStage = result.pdeCode = workBuffer.toString(); + + + boolean reloadCodeFolder = firstCheck || codeFolderChanged.getAndSet(false); + boolean reloadLibraries = firstCheck || librariesChanged.getAndSet(false); + + // Core and default imports + if (coreAndDefaultImports == null) { + PdePreprocessor p = editor.createPreprocessor(null); + coreAndDefaultImports = buildCoreAndDefaultImports(p); + } + result.coreAndDefaultImports.addAll(coreAndDefaultImports); + + // Prepare code folder imports + if (reloadCodeFolder) { + codeFolderImports.addAll(buildCodeFolderImports(sketch)); + } else { + codeFolderImports.addAll(prevResult.codeFolderImports); + } + + // TODO: convert unicode escapes to chars + + SourceUtils.scrubCommentsAndStrings(workBuffer); + + result.scrubbedPdeCode = workBuffer.toString(); + + Mode sketchMode = PdePreprocessor.parseMode(workBuffer); + + // Prepare transforms to convert pde code into parsable code + TextTransform toParsable = new TextTransform(pdeStage); + toParsable.addAll(SourceUtils.insertImports(coreAndDefaultImports)); + toParsable.addAll(SourceUtils.insertImports(codeFolderImports)); + toParsable.addAll(SourceUtils.parseProgramImports(workBuffer, programImports)); + toParsable.addAll(SourceUtils.replaceTypeConstructors(workBuffer)); + toParsable.addAll(SourceUtils.replaceHexLiterals(workBuffer)); + toParsable.addAll(SourceUtils.wrapSketch(sketchMode, className, workBuffer.length())); + + { // Refresh sketch classloader and classpath if imports changed + if (javaRuntimeClassPath == null) { + javaRuntimeClassPath = buildJavaRuntimeClassPath(); + sketchModeClassPath = buildModeClassPath(javaMode, false); + searchModeClassPath = buildModeClassPath(javaMode, true); + } + + if (reloadLibraries) { + coreLibraryClassPath = buildCoreLibraryClassPath(javaMode); + } + + boolean rebuildLibraryClassPath = reloadLibraries || + checkIfImportsChanged(programImports, prevResult.programImports); + + if (rebuildLibraryClassPath) { + sketchLibraryClassPath = buildSketchLibraryClassPath(javaMode, programImports); + searchLibraryClassPath = buildSearchLibraryClassPath(javaMode); + } + + boolean rebuildClassPath = reloadCodeFolder || rebuildLibraryClassPath || + prevResult.classLoader == null || prevResult.classPath == null || + prevResult.classPathArray == null || prevResult.searchClassPathArray == null; + + if (reloadCodeFolder) { + codeFolderClassPath = buildCodeFolderClassPath(sketch); + } + + if (rebuildClassPath) { + { // Sketch class path + List sketchClassPath = new ArrayList<>(); + sketchClassPath.addAll(javaRuntimeClassPath); + sketchClassPath.addAll(sketchModeClassPath); + sketchClassPath.addAll(sketchLibraryClassPath); + sketchClassPath.addAll(coreLibraryClassPath); + sketchClassPath.addAll(codeFolderClassPath); + + String[] classPathArray = sketchClassPath.stream().toArray(String[]::new); + URL[] urlArray = Arrays.stream(classPathArray) + .map(path -> { + try { + return Paths.get(path).toUri().toURL(); + } catch (MalformedURLException e) { + Messages.loge("malformed URL when preparing sketch classloader", e); + return null; + } + }) + .filter(url -> url != null) + .toArray(URL[]::new); + result.classLoader = new URLClassLoader(urlArray, null); + result.classPath = classPathFactory.createFromPaths(classPathArray); + result.classPathArray = classPathArray; + } + + { // Search class path + List searchClassPath = new ArrayList<>(); + searchClassPath.addAll(javaRuntimeClassPath); + searchClassPath.addAll(searchModeClassPath); + searchClassPath.addAll(searchLibraryClassPath); + searchClassPath.addAll(coreLibraryClassPath); + searchClassPath.addAll(codeFolderClassPath); + + result.searchClassPathArray = searchClassPath.stream().toArray(String[]::new); + } + } else { + result.classLoader = prevResult.classLoader; + result.classPath = prevResult.classPath; + result.searchClassPathArray = prevResult.searchClassPathArray; + result.classPathArray = prevResult.classPathArray; + } + } + + // Transform code to parsable state + String parsableStage = toParsable.apply(); + OffsetMapper parsableMapper = toParsable.getMapper(); + + // Create intermediate AST for advanced preprocessing + CompilationUnit parsableCU = + makeAST(parser, parsableStage.toCharArray(), COMPILER_OPTIONS); + + // Prepare advanced transforms which operate on AST + TextTransform toCompilable = new TextTransform(parsableStage); + toCompilable.addAll(SourceUtils.preprocessAST(parsableCU)); + + // Transform code to compilable state + String compilableStage = toCompilable.apply(); + OffsetMapper compilableMapper = toCompilable.getMapper(); + char[] compilableStageChars = compilableStage.toCharArray(); + + // Create compilable AST to get syntax problems + CompilationUnit compilableCU = + makeAST(parser, compilableStageChars, COMPILER_OPTIONS); + + // Get syntax problems from compilable AST + result.hasSyntaxErrors |= Arrays.stream(compilableCU.getProblems()) + .anyMatch(IProblem::isError); + + // Generate bindings after getting problems - avoids + // 'missing type' errors when there are syntax problems + CompilationUnit bindingsCU = + makeASTWithBindings(parser, compilableStageChars, COMPILER_OPTIONS, + className, result.classPathArray); + + // Get compilation problems + List bindingsProblems = Arrays.asList(bindingsCU.getProblems()); + result.hasCompilationErrors = bindingsProblems.stream() + .anyMatch(IProblem::isError); + + // Update builder + result.offsetMapper = parsableMapper.thenMapping(compilableMapper); + result.javaCode = compilableStage; + result.compilationUnit = bindingsCU; + + // Build it + return result.build(); + } + + + /// IMPORTS ----------------------------------------------------------------- + + private List coreAndDefaultImports; + + + private static List buildCoreAndDefaultImports(PdePreprocessor p) { + List result = new ArrayList<>(); + + for (String imp : p.getCoreImports()) { + result.add(ImportStatement.parse(imp)); + } + for (String imp : p.getDefaultImports()) { + result.add(ImportStatement.parse(imp)); + } + + return result; + } + + + private static List buildCodeFolderImports(Sketch sketch) { + if (sketch.hasCodeFolder()) { + File codeFolder = sketch.getCodeFolder(); + String codeFolderClassPath = Util.contentsToClassPath(codeFolder); + StringList codeFolderPackages = Util.packageListFromClassPath(codeFolderClassPath); + return StreamSupport.stream(codeFolderPackages.spliterator(), false) + .map(ImportStatement::wholePackage) + .collect(Collectors.toList()); + } + return Collections.emptyList(); + } + + + private static boolean checkIfImportsChanged(List prevImports, + List imports) { + if (imports.size() != prevImports.size()) { + return true; + } else { + int count = imports.size(); + for (int i = 0; i < count; i++) { + if (!imports.get(i).isSameAs(prevImports.get(i))) { + return true; + } + } + } + return false; + } + + + + /// CLASSPATHS --------------------------------------------------------------- + + + private List javaRuntimeClassPath; + + private List sketchModeClassPath; + private List searchModeClassPath; + + private List coreLibraryClassPath; + + private List codeFolderClassPath; + + private List sketchLibraryClassPath; + private List searchLibraryClassPath; + + + private static List buildCodeFolderClassPath(Sketch sketch) { + StringBuilder classPath = new StringBuilder(); + + // Code folder + if (sketch.hasCodeFolder()) { + File codeFolder = sketch.getCodeFolder(); + String codeFolderClassPath = Util.contentsToClassPath(codeFolder); + classPath.append(codeFolderClassPath); + } + + return sanitizeClassPath(classPath.toString()); + } + + + private static List buildModeClassPath(JavaMode mode, boolean search) { + StringBuilder classPath = new StringBuilder(); + + if (search) { + String searchClassPath = mode.getSearchPath(); + if (searchClassPath != null) { + classPath.append(File.pathSeparator).append(searchClassPath); + } + } else { + Library coreLibrary = mode.getCoreLibrary(); + String coreClassPath = coreLibrary != null ? + coreLibrary.getClassPath() : mode.getSearchPath(); + if (coreClassPath != null) { + classPath.append(File.pathSeparator).append(coreClassPath); + } + } + + return sanitizeClassPath(classPath.toString()); + } + + + private static List buildCoreLibraryClassPath(JavaMode mode) { + StringBuilder classPath = new StringBuilder(); + + for (Library lib : mode.coreLibraries) { + classPath.append(File.pathSeparator).append(lib.getClassPath()); + } + + return sanitizeClassPath(classPath.toString()); + } + + + private static List buildSearchLibraryClassPath(JavaMode mode) { + StringBuilder classPath = new StringBuilder(); + + for (Library lib : mode.contribLibraries) { + classPath.append(File.pathSeparator).append(lib.getClassPath()); + } + + return sanitizeClassPath(classPath.toString()); + } + + + static private List buildSketchLibraryClassPath(JavaMode mode, + List programImports) { + StringBuilder classPath = new StringBuilder(); + + programImports.stream() + .map(ImportStatement::getPackageName) + .filter(pckg -> !ignorableImport(pckg)) + .map(pckg -> { + try { + return mode.getLibrary(pckg); + } catch (SketchException e) { + return null; + } + }) + .filter(lib -> lib != null) + .map(Library::getClassPath) + .forEach(cp -> classPath.append(File.pathSeparator).append(cp)); + + return sanitizeClassPath(classPath.toString()); + } + + + static private List buildJavaRuntimeClassPath() { + StringBuilder classPath = new StringBuilder(); + + { // Java runtime + String rtPath = System.getProperty("java.home") + + File.separator + "lib" + File.separator + "rt.jar"; + if (new File(rtPath).exists()) { + classPath.append(File.pathSeparator).append(rtPath); + } else { + rtPath = System.getProperty("java.home") + File.separator + "jre" + + File.separator + "lib" + File.separator + "rt.jar"; + if (new File(rtPath).exists()) { + classPath.append(File.pathSeparator).append(rtPath); + } + } + } + + { // JavaFX runtime + String jfxrtPath = System.getProperty("java.home") + + File.separator + "lib" + File.separator + "ext" + File.separator + "jfxrt.jar"; + if (new File(jfxrtPath).exists()) { + classPath.append(File.pathSeparator).append(jfxrtPath); + } else { + jfxrtPath = System.getProperty("java.home") + File.separator + "jre" + + File.separator + "lib" + File.separator + "ext" + File.separator + "jfxrt.jar"; + if (new File(jfxrtPath).exists()) { + classPath.append(File.pathSeparator).append(jfxrtPath); + } + } + } + + return sanitizeClassPath(classPath.toString()); + } + + + private static List sanitizeClassPath(String classPathString) { + // Make sure class path does not contain empty string (home dir) + return Arrays.stream(classPathString.split(File.pathSeparator)) + .filter(p -> p != null && !p.trim().isEmpty()) + .distinct() + .collect(Collectors.toList()); + } + + /// -------------------------------------------------------------------------- + + + + private static CompilationUnit makeAST(ASTParser parser, + char[] source, + Map options) { + parser.setSource(source); + parser.setKind(ASTParser.K_COMPILATION_UNIT); + parser.setCompilerOptions(options); + parser.setStatementsRecovery(true); + + return (CompilationUnit) parser.createAST(null); + } + + + private static CompilationUnit makeASTWithBindings(ASTParser parser, + char[] source, + Map options, + String className, + String[] classPath) { + parser.setSource(source); + parser.setKind(ASTParser.K_COMPILATION_UNIT); + parser.setCompilerOptions(options); + parser.setStatementsRecovery(true); + parser.setUnitName(className); + parser.setEnvironment(classPath, null, null, false); + parser.setResolveBindings(true); + + return (CompilationUnit) parser.createAST(null); + } + + + /** + * Ignore processing packages, java.*.*. etc. + */ + static private boolean ignorableImport(String packageName) { + return (packageName.startsWith("java.") || + packageName.startsWith("javax.")); + } + + + static private final Map COMPILER_OPTIONS; + static { + Map compilerOptions = new HashMap<>(); + + JavaCore.setComplianceOptions(JavaCore.VERSION_1_7, compilerOptions); + + // See http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Fguide%2Fjdt_api_options.htm&anchor=compiler + + final String[] generate = { + JavaCore.COMPILER_LINE_NUMBER_ATTR, + JavaCore.COMPILER_SOURCE_FILE_ATTR + }; + + final String[] ignore = { + JavaCore.COMPILER_PB_UNUSED_IMPORT, + JavaCore.COMPILER_PB_MISSING_SERIAL_VERSION, + JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE, + JavaCore.COMPILER_PB_REDUNDANT_TYPE_ARGUMENTS, + JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION + }; + + final String[] warn = { + JavaCore.COMPILER_PB_NO_EFFECT_ASSIGNMENT, + JavaCore.COMPILER_PB_NULL_REFERENCE, + JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE, + JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK, + JavaCore.COMPILER_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT, + JavaCore.COMPILER_PB_UNUSED_LABEL, + JavaCore.COMPILER_PB_UNUSED_LOCAL, + JavaCore.COMPILER_PB_UNUSED_OBJECT_ALLOCATION, + JavaCore.COMPILER_PB_UNUSED_PARAMETER, + JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER + }; + + for (String s : generate) compilerOptions.put(s, JavaCore.GENERATE); + for (String s : ignore) compilerOptions.put(s, JavaCore.IGNORE); + for (String s : warn) compilerOptions.put(s, JavaCore.WARNING); + + COMPILER_OPTIONS = Collections.unmodifiableMap(compilerOptions); + } + + + public void handleHasJavaTabsChange(boolean hasJavaTabs) { + isEnabled = !hasJavaTabs; + if (isEnabled) { + notifySketchChanged(); + } else { + preprocessingTask.cancel(false); + } + } + +} diff --git a/java/src/processing/mode/java/pdex/Problem.java b/java/src/processing/mode/java/pdex/Problem.java deleted file mode 100644 index 8cae40e90e..0000000000 --- a/java/src/processing/mode/java/pdex/Problem.java +++ /dev/null @@ -1,209 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -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. -*/ - -package processing.mode.java.pdex; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.jdt.core.compiler.IProblem; - -/** - * Wrapper class for IProblem. - * - * Stores the tabIndex and line number according to its tab, including the - * original IProblem object - * - * @author Manindra Moharana <me@mkmoharana.com> - * - */ -public class Problem { - /** - * The IProblem which is being wrapped - */ - private IProblem iProblem; - /** - * The tab number to which the error belongs to - */ - private int tabIndex; - /** - * Line number(pde code) of the error - */ - private int lineNumber; - - private int lineStartOffset; - - private int lineStopOffset; - - /** - * Error Message. Processed form of IProblem.getMessage() - */ - private String message; - - /** - * The type of error - WARNING or ERROR. - */ - private int type; - - /** - * If the error is a 'cannot find type' contains the list of suggested imports - */ - private String[] importSuggestions; - - public static final int ERROR = 1, WARNING = 2; - - /** - * - * @param iProblem - The IProblem which is being wrapped - * @param tabIndex - The tab number to which the error belongs to - * @param lineNumber - Line number(pde code) of the error - */ - public Problem(IProblem iProblem, int tabIndex, int lineNumber) { - this.iProblem = iProblem; - if(iProblem.isError()) { - type = ERROR; - } - else if(iProblem.isWarning()) { - type = WARNING; - } - this.tabIndex = tabIndex; - this.lineNumber = lineNumber; - this.message = process(iProblem); - this.message = ErrorMessageSimplifier.getSimplifiedErrorMessage(this); - //ErrorMessageSimplifier.getSimplifiedErrorMessage(this); - } - - public void setPDEOffsets(int startOffset, int stopOffset){ - lineStartOffset = startOffset; - lineStopOffset = stopOffset; - } - - public int getPDELineStartOffset(){ - return lineStartOffset; - } - - public int getPDELineStopOffset(){ - return lineStopOffset; - } - - public String toString() { - return new String("TAB " + tabIndex + ",LN " + lineNumber + "LN START OFF: " - + lineStartOffset + ",LN STOP OFF: " + lineStopOffset + ",PROB: " - + message); - } - - public boolean isError(){ - return type == ERROR; - } - - public boolean isWarning(){ - return type == WARNING; - } - - public String getMessage(){ - return message; - } - - public IProblem getIProblem(){ - return iProblem; - } - - public int getTabIndex(){ - return tabIndex; - } - - public int getLineNumber(){ - return lineNumber; - } - - /** - * Remember to subtract a -1 to line number because in compile check code an - * extra package statement is added, so all line numbers are increased by 1 - * - * @return - */ - public int getSourceLineNumber(){ - return iProblem.getSourceLineNumber(); - } - - public void setType(int ProblemType){ - if(ProblemType == ERROR) - type = ERROR; - else if(ProblemType == WARNING) - type = WARNING; - else throw new IllegalArgumentException("Illegal Problem type passed to Problem.setType(int)"); - } - - public String[] getImportSuggestions() { - return importSuggestions; - } - - public void setImportSuggestions(String[] a) { - importSuggestions = a; - } - - private static Pattern pattern; - private static Matcher matcher; - - private static final String tokenRegExp = "\\b token\\b"; - - public static String process(IProblem problem) { - return process(problem.getMessage()); - } - - /** - * Processes error messages and attempts to make them a bit more english like. - * Currently performs: - *
  • Remove all instances of token. "Syntax error on token 'blah', delete this token" - * becomes "Syntax error on 'blah', delete this" - * @param message - The message to be processed - * @return String - The processed message - */ - public static String process(String message) { - // Remove all instances of token - // "Syntax error on token 'blah', delete this token" - if(message == null) return null; - pattern = Pattern.compile(tokenRegExp); - matcher = pattern.matcher(message); - message = matcher.replaceAll(""); - - return message; - } - - // Split camel case words into separate words. - // "VaraibleDeclaration" becomes "Variable Declaration" - // But sadly "PApplet" become "P Applet" and so on. - public static String splitCamelCaseWord(String word) { - String newWord = ""; - for (int i = 1; i < word.length(); i++) { - if (Character.isUpperCase(word.charAt(i))) { - // System.out.println(word.substring(0, i) + " " - // + word.substring(i)); - newWord += word.substring(0, i) + " "; - word = word.substring(i); - i = 1; - } - } - newWord += word; - // System.out.println(newWord); - return newWord.trim(); - } - -} diff --git a/java/src/processing/mode/java/pdex/Rename.java b/java/src/processing/mode/java/pdex/Rename.java new file mode 100644 index 0000000000..b143cd721a --- /dev/null +++ b/java/src/processing/mode/java/pdex/Rename.java @@ -0,0 +1,335 @@ +package processing.mode.java.pdex; + +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import javax.swing.Box; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JRootPane; +import javax.swing.JTextField; +import javax.swing.WindowConstants; +import javax.swing.text.BadLocationException; + +import org.eclipse.jdt.core.dom.ASTNode; +import org.eclipse.jdt.core.dom.CompilationUnit; +import org.eclipse.jdt.core.dom.IBinding; +import org.eclipse.jdt.core.dom.IMethodBinding; +import org.eclipse.jdt.core.dom.ITypeBinding; +import org.eclipse.jdt.core.dom.SimpleName; + +import processing.app.Language; +import processing.app.Platform; +import processing.app.Sketch; +import processing.app.SketchCode; +import processing.app.syntax.SyntaxDocument; +import processing.app.ui.EditorStatus; +import processing.app.ui.Toolkit; +import processing.mode.java.JavaEditor; +import processing.mode.java.pdex.PreprocessedSketch.SketchInterval; + +import static processing.mode.java.pdex.ASTUtils.findAllOccurrences; +import static processing.mode.java.pdex.ASTUtils.getSimpleNameAt; +import static processing.mode.java.pdex.ASTUtils.resolveBinding; + + +class Rename { + final JavaEditor editor; + final PreprocessingService pps; + final ShowUsage showUsage; + + final JDialog window; + final JTextField textField; + final JLabel oldNameLabel; + + IBinding binding; + PreprocessedSketch ps; + + + Rename(JavaEditor editor, PreprocessingService pps, ShowUsage showUsage) { + this.editor = editor; + this.pps = pps; + this.showUsage = showUsage; + + // Add rename option + JMenuItem renameItem = new JMenuItem(Language.text("editor.popup.rename")); + renameItem.addActionListener(e -> handleRename()); + editor.getTextArea().getRightClickPopup().add(renameItem); + + window = new JDialog(editor); + JRootPane rootPane = window.getRootPane(); + window.setTitle("Rename"); + window.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); + Toolkit.registerWindowCloseKeys(rootPane, new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + window.setVisible(false); + } + }); + Toolkit.setIcon(window); + + window.setModal(true); + window.setResizable(false); + window.addComponentListener(new ComponentAdapter() { + @Override + public void componentHidden(ComponentEvent e) { + binding = null; + ps = null; + } + }); + //window.setSize(Toolkit.zoom(250, 130)); + //window.setLayout(new BoxLayout(window.getContentPane(), BoxLayout.Y_AXIS)); + Box windowBox = Box.createVerticalBox(); + Toolkit.setBorder(windowBox); + final int GAP = Toolkit.zoom(5); + + { // old name + Box oldBox = Box.createHorizontalBox(); + oldNameLabel = new JLabel("Current Name: "); + oldBox.add(oldNameLabel); + //oldBox.add(Box.createHorizontalStrut(10)); + oldBox.add(Box.createHorizontalGlue()); + windowBox.add(oldBox); + windowBox.add(Box.createVerticalStrut(GAP)); + } + + { // new name + Box newBox = Box.createHorizontalBox(); + JLabel newNameLabel = new JLabel("New Name: "); + newBox.add(newNameLabel); + newBox.add(textField = new JTextField(20)); + newBox.add(Box.createHorizontalGlue()); + windowBox.add(newBox); + windowBox.add(Box.createVerticalStrut(GAP*2)); + } + + { // button panel + JButton showUsageButton = new JButton("Show Usage"); + showUsageButton.addActionListener(e -> { + showUsage.findUsageAndUpdateTree(ps, binding); + window.setVisible(false); + }); + + JButton renameButton = new JButton("Rename"); + renameButton.addActionListener(e -> { + final String newName = textField.getText().trim(); + if (!newName.isEmpty()) { + if (newName.length() >= 1 && + newName.chars().limit(1).allMatch(Character::isJavaIdentifierStart) && + newName.chars().skip(1).allMatch(Character::isJavaIdentifierPart)) { + rename(ps, binding, newName); + window.setVisible(false); + } else { + String msg = String.format("'%s' is not a valid name", newName); + JOptionPane.showMessageDialog(editor, msg, "Naming is Hard", + JOptionPane.PLAIN_MESSAGE); + } + } + }); + rootPane.setDefaultButton(renameButton); + + //JPanel panelBottom = new JPanel(); + //panelBottom.setLayout(new BoxLayout(panelBottom, BoxLayout.X_AXIS)); + Box buttonBox = Box.createHorizontalBox(); + //Toolkit.setBorder(panelBottom, 5, 5, 5, 5); + + buttonBox.add(Box.createHorizontalGlue()); + buttonBox.add(showUsageButton); + if (!Platform.isMacOS()) { + buttonBox.add(Box.createHorizontalStrut(GAP)); + } + buttonBox.add(renameButton); + buttonBox.add(Box.createHorizontalGlue()); + + Dimension showDim = showUsageButton.getPreferredSize(); + Dimension renameDim = renameButton.getPreferredSize(); + final int niceSize = Math.max(showDim.width, renameDim.width) + GAP; + final Dimension buttonDim = new Dimension(niceSize, showDim.height); + showUsageButton.setPreferredSize(buttonDim); + renameButton.setPreferredSize(buttonDim); + + windowBox.add(buttonBox); + + //window.add(panelBottom); + } + window.add(windowBox); + window.pack(); + //window.setMinimumSize(window.getSize()); + } + + + // Thread: EDT + void handleRename() { + int startOffset = editor.getSelectionStart(); + int stopOffset = editor.getSelectionStop(); + int tabIndex = editor.getSketch().getCurrentCodeIndex(); + + pps.whenDoneBlocking(ps -> handleRename(ps, tabIndex, startOffset, stopOffset)); + } + + + // Thread: worker + void handleRename(PreprocessedSketch ps, int tabIndex, int startTabOffset, int stopTabOffset) { + if (ps.hasSyntaxErrors) { + editor.statusMessage("Cannot rename until syntax errors are fixed", + EditorStatus.WARNING); + return; + } + + ASTNode root = ps.compilationUnit; + + // Map offsets + int startJavaOffset = ps.tabOffsetToJavaOffset(tabIndex, startTabOffset); + int stopJavaOffset = ps.tabOffsetToJavaOffset(tabIndex, stopTabOffset); + + // Find the node + SimpleName name = getSimpleNameAt(root, startJavaOffset, stopJavaOffset); + if (name == null) { + editor.statusMessage("Highlight the class/function/variable name first", + EditorStatus.NOTICE); + return; + } + + // Find binding + IBinding binding = resolveBinding(name); + if (binding == null) { + editor.statusMessage(name.getIdentifier() + " isn't defined in this sketch, " + + "so it cannot be renamed", EditorStatus.ERROR); + return; + } + + ASTNode decl = ps.compilationUnit.findDeclaringNode(binding.getKey()); + if (decl == null) { + editor.statusMessage(name.getIdentifier() + " isn't defined in this sketch, " + + "so it cannot be renamed", EditorStatus.ERROR); + return; + } + + // Display the rename dialog + EventQueue.invokeLater(() -> { + if (!window.isVisible()) { + this.ps = ps; + this.binding = binding; + oldNameLabel.setText("Current name: " + binding.getName()); + textField.setText(binding.getName()); + textField.requestFocus(); + textField.selectAll(); + int x = editor.getX() + (editor.getWidth() - window.getWidth()) / 2; + int y = editor.getY() + (editor.getHeight() - window.getHeight()) / 2; + window.setLocation(x, y); + window.setVisible(true); + window.toFront(); + } + }); + } + + + // Thread: EDT (we can't allow user to mess with sketch while renaming) + void rename(PreprocessedSketch ps, IBinding binding, String newName) { + CompilationUnit root = ps.compilationUnit; + + // Renaming constructor should rename class + if (binding.getKind() == IBinding.METHOD) { + IMethodBinding method = (IMethodBinding) binding; + if (method.isConstructor()) { + binding = method.getDeclaringClass(); + } + } + + ASTNode decl = root.findDeclaringNode(binding.getKey()); + if (decl == null) return; + + showUsage.hide(); + + List occurrences = new ArrayList<>(); + occurrences.addAll(findAllOccurrences(root, binding.getKey())); + + // Renaming class should rename all constructors + if (binding.getKind() == IBinding.TYPE) { + ITypeBinding type = (ITypeBinding) binding; + //type = type.getErasure(); + IMethodBinding[] methods = type.getDeclaredMethods(); + Arrays.stream(methods) + .filter(IMethodBinding::isConstructor) + .flatMap(c -> findAllOccurrences(root, c.getKey()).stream()) + .forEach(occurrences::add); + } + + Map> mappedNodes = occurrences.stream() + .map(ps::mapJavaToSketch) + .filter(ps::inRange) + .collect(Collectors.groupingBy(interval -> interval.tabIndex)); + + Sketch sketch = ps.sketch; + + editor.startCompoundEdit(); + + mappedNodes.entrySet().forEach(entry -> { + int tabIndex = entry.getKey(); + SketchCode sketchCode = sketch.getCode(tabIndex); + + SyntaxDocument document = (SyntaxDocument) sketchCode.getDocument(); + + List nodes = entry.getValue(); + nodes.stream() + // Replace from the end so all unprocess offsets stay valid + .sorted(Comparator.comparing((SketchInterval si) -> si.startTabOffset).reversed()) + .forEach(si -> { + // Make sure offsets are in bounds + int documentLength = document.getLength(); + if (si.startTabOffset >= 0 && si.startTabOffset <= documentLength && + si.stopTabOffset >= 0 && si.stopTabOffset <= documentLength) { + // Replace the code + int length = si.stopTabOffset - si.startTabOffset; + try { + document.remove(si.startTabOffset, length); + document.insertString(si.startTabOffset, newName, null); + } catch (BadLocationException e) { /* Whatever */ } + } + }); + + try { + sketchCode.setProgram(document.getText(0, document.getLength())); + } catch (BadLocationException e) { /* Whatever */ } + sketchCode.setModified(true); + }); + + editor.stopCompoundEdit(); + + editor.repaintHeader(); + + int currentTabIndex = sketch.getCurrentCodeIndex(); + final int currentOffset = editor.getCaretOffset(); + + int precedingIntervals = + (int) mappedNodes.getOrDefault(currentTabIndex, Collections.emptyList()) + .stream() + .filter(interval -> interval.stopTabOffset < currentOffset) + .count(); + int intervalLengthDiff = newName.length() - binding.getName().length(); + int offsetDiff = precedingIntervals * intervalLengthDiff; + + editor.getTextArea().setCaretPosition(currentOffset + offsetDiff); + } + + + void dispose() { + if (window != null) { + window.dispose(); + } + } +} diff --git a/java/src/processing/mode/java/pdex/ShowUsage.java b/java/src/processing/mode/java/pdex/ShowUsage.java new file mode 100644 index 0000000000..91bf043839 --- /dev/null +++ b/java/src/processing/mode/java/pdex/ShowUsage.java @@ -0,0 +1,329 @@ +package processing.mode.java.pdex; + +import static processing.mode.java.pdex.ASTUtils.findAllOccurrences; + +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Rectangle; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import javax.swing.JDialog; +import javax.swing.JMenuItem; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.WindowConstants; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeModel; + +import org.eclipse.jdt.core.dom.IBinding; +import org.eclipse.jdt.core.dom.IMethodBinding; +import org.eclipse.jdt.core.dom.IVariableBinding; +import org.eclipse.jdt.core.dom.SimpleName; + +import processing.app.Language; +import processing.app.ui.EditorStatus; +import processing.app.ui.Toolkit; +import processing.app.ui.ZoomTreeCellRenderer; +import processing.mode.java.JavaEditor; +import processing.mode.java.pdex.PreprocessedSketch.SketchInterval; + + +class ShowUsage { + final JDialog window; + final JTree tree; + + final JavaEditor editor; + final PreprocessingService pps; + + final Consumer reloadListener; + + IBinding binding; + + + ShowUsage(JavaEditor editor, PreprocessingService pps) { + this.editor = editor; + this.pps = pps; + + // Add show usage option + JMenuItem showUsageItem = + new JMenuItem(Language.text("editor.popup.show_usage")); + showUsageItem.addActionListener(e -> handleShowUsage()); + editor.getTextArea().getRightClickPopup().add(showUsageItem); + + reloadListener = this::reloadShowUsage; + + { // Show Usage window + window = new JDialog(editor); + window.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); + window.setAutoRequestFocus(false); + window.addComponentListener(new ComponentAdapter() { + @Override + public void componentHidden(ComponentEvent e) { + binding = null; + tree.setModel(null); + pps.unregisterListener(reloadListener); + } + + @Override + public void componentShown(ComponentEvent e) { + pps.registerListener(reloadListener); + } + }); + window.setSize(Toolkit.zoom(300, 400)); + window.setFocusableWindowState(false); + Toolkit.setIcon(window); + JScrollPane sp2 = new JScrollPane(); + tree = new JTree(); + ZoomTreeCellRenderer renderer = + new ZoomTreeCellRenderer(editor.getMode()); + tree.setCellRenderer(renderer); + renderer.setLeafIcon(null); + renderer.setClosedIcon(null); + renderer.setOpenIcon(null); + renderer.setBackgroundSelectionColor(new Color(228, 248, 246)); + renderer.setBorderSelectionColor(new Color(0, 0, 0, 0)); + renderer.setTextSelectionColor(Color.BLACK); + sp2.setViewportView(tree); + window.add(sp2); + } + + tree.addTreeSelectionListener(e -> { + if (tree.getLastSelectedPathComponent() != null) { + DefaultMutableTreeNode tnode = + (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); + + if (tnode.getUserObject() instanceof ShowUsageTreeNode) { + ShowUsageTreeNode node = (ShowUsageTreeNode) tnode.getUserObject(); + editor.highlight(node.tabIndex, node.startTabOffset, node.stopTabOffset); + } + } + }); + } + + + // Thread: EDT + void handleShowUsage() { + int startOffset = editor.getSelectionStart(); + int stopOffset = editor.getSelectionStop(); + int tabIndex = editor.getSketch().getCurrentCodeIndex(); + + pps.whenDoneBlocking(ps -> handleShowUsage(ps, tabIndex, startOffset, stopOffset)); + } + + + // Thread: worker + void handleShowUsage(PreprocessedSketch ps, int tabIndex, + int startTabOffset, int stopTabOffset) { + // Map offsets + int startJavaOffset = ps.tabOffsetToJavaOffset(tabIndex, startTabOffset); + int stopJavaOffset = ps.tabOffsetToJavaOffset(tabIndex, stopTabOffset); + + // Find the node + SimpleName name = ASTUtils.getSimpleNameAt(ps.compilationUnit, startJavaOffset, stopJavaOffset); + if (name == null) { + editor.statusMessage("Cannot find any name under cursor", EditorStatus.NOTICE); + return; + } + + // Find binding + IBinding binding = ASTUtils.resolveBinding(name); + if (binding == null) { + editor.statusMessage("Cannot find usages, try to fix errors in your code first", + EditorStatus.NOTICE); + return; + } + + findUsageAndUpdateTree(ps, binding); + } + + + // Thread: worker + void findUsageAndUpdateTree(PreprocessedSketch ps, IBinding binding) { + + this.binding = binding; + + // Get label + String bindingType = ""; + switch (binding.getKind()) { + case IBinding.METHOD: + IMethodBinding method = (IMethodBinding) binding; + if (method.isConstructor()) bindingType = "Constructor"; + else bindingType = "Method"; + break; + case IBinding.TYPE: + bindingType = "Type"; + break; + case IBinding.VARIABLE: + IVariableBinding variable = (IVariableBinding) binding; + if (variable.isField()) bindingType = "Field"; + else if (variable.isParameter()) bindingType = "Parameter"; + else if (variable.isEnumConstant()) bindingType = "Enum constant"; + else bindingType = "Local variable"; + break; + } + + // Find usages, map to tree nodes, add to root node + String bindingKey = binding.getKey(); + List intervals = + findAllOccurrences(ps.compilationUnit, bindingKey).stream() + .map(ps::mapJavaToSketch) + // remove occurrences which fall into generated header + .filter(ps::inRange) + // remove empty intervals (happens when occurence was inserted) + .filter(in -> in.startPdeOffset < in.stopPdeOffset) + .collect(Collectors.toList()); + + int usageCount = intervals.size(); + + // Get element name from PDE code if possible, otherwise use one from Java + String elementName = intervals.stream() + .findAny() + .map(si -> ps.pdeCode.substring(si.startPdeOffset, si.stopPdeOffset)) + .orElseGet(binding::getName); + + // Create root node + DefaultMutableTreeNode rootNode = + new DefaultMutableTreeNode(bindingType + ": " + elementName); + + intervals.stream() + // Convert to TreeNodes + .map(in -> ShowUsageTreeNode.fromSketchInterval(ps, in)) + // Group by tab index + .collect(Collectors.groupingBy(node -> node.tabIndex)) + // Stream Map Entries of (tab index) <-> (List) + .entrySet().stream() + // Sort by tab index + .sorted(Comparator.comparing(Map.Entry::getKey)) + .map(entry -> { + Integer tabIndex = entry.getKey(); + List nodes = entry.getValue(); + + int count = nodes.size(); + String usageLabel = count == 1 ? "usage" : "usages"; + + // Create new DefaultMutableTreeNode for this tab + String tabLabel = "" + + ps.sketch.getCode(tabIndex).getPrettyName() + + " " + count + " " + usageLabel + ""; + DefaultMutableTreeNode tabNode = new DefaultMutableTreeNode(tabLabel); + + // Stream nodes belonging to this tab + nodes.stream() + // Convert TreeNodes to DefaultMutableTreeNodes + .map(DefaultMutableTreeNode::new) + // Add all as children of tab node + .forEach(tabNode::add); + return tabNode; + }) + // Add all tab nodes as children of root node + .forEach(rootNode::add); + + TreeModel treeModel = new DefaultTreeModel(rootNode); + + // Update tree + EventQueue.invokeLater(() -> { + tree.setModel(treeModel); + + // Expand all nodes + for (int i = 0; i < tree.getRowCount(); i++) { + tree.expandRow(i); + } + + tree.setRootVisible(true); + + if (!window.isVisible()) { + window.setVisible(true); + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice defaultScreen = ge.getDefaultScreenDevice(); + Rectangle rect = defaultScreen.getDefaultConfiguration().getBounds(); + int maxX = (int) rect.getMaxX() - window.getWidth(); + int x = Math.min(editor.getX() + editor.getWidth(), maxX); + int y = (x == maxX) ? 10 : editor.getY(); + window.setLocation(x, y); + } + window.toFront(); + window.setTitle("Usage of \"" + elementName + "\" : " + + usageCount + " time(s)"); + }); + } + + + // Thread: worker + void reloadShowUsage(PreprocessedSketch ps) { + if (binding != null) { + findUsageAndUpdateTree(ps, binding); + } + } + + + void hide() { + window.setVisible(false); + } + + + void dispose() { + if (window != null) { + window.dispose(); + } + } +} + + +class ShowUsageTreeNode { + final int tabIndex; + final int startTabOffset; + final int stopTabOffset; + + final String text; + + + ShowUsageTreeNode(int tabIndex, int startTabOffset, int stopTabOffset, String text) { + this.tabIndex = tabIndex; + this.startTabOffset = startTabOffset; + this.stopTabOffset = stopTabOffset; + this.text = text; + } + + + static ShowUsageTreeNode fromSketchInterval(PreprocessedSketch ps, SketchInterval in) { + int lineStartPdeOffset = ps.pdeCode.lastIndexOf('\n', in.startPdeOffset) + 1; + int lineStopPdeOffset = ps.pdeCode.indexOf('\n', in.stopPdeOffset); + if (lineStopPdeOffset == -1) lineStopPdeOffset = ps.pdeCode.length(); + + int highlightStartOffset = in.startPdeOffset - lineStartPdeOffset; + int highlightStopOffset = in.stopPdeOffset - lineStartPdeOffset; + + int tabLine = ps.tabOffsetToTabLine(in.tabIndex, in.startTabOffset); + + // TODO: what a mess + String line = ps.pdeCode.substring(lineStartPdeOffset, lineStopPdeOffset); + String pre = line.substring(0, highlightStartOffset) + .replace("&", "&").replace(">", ">").replace("<", "<"); + String highlight = line.substring(highlightStartOffset, highlightStopOffset) + .replace("&", "&").replace(">", ">").replace("<", "<"); + String post = line.substring(highlightStopOffset) + .replace("&", "&").replace(">", ">").replace("<", "<"); + line = pre + "" + highlight + "" + post; + line = line.trim(); + + + String text = "" + + (tabLine + 1) + " " + line + ""; + + return new ShowUsageTreeNode(in.tabIndex, in.startTabOffset, in.stopTabOffset, text); + } + + @Override + public String toString() { + return text; + } +} diff --git a/java/src/processing/mode/java/pdex/SketchOutline.java b/java/src/processing/mode/java/pdex/SketchOutline.java deleted file mode 100644 index 4f2f1f4f02..0000000000 --- a/java/src/processing/mode/java/pdex/SketchOutline.java +++ /dev/null @@ -1,409 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -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. -*/ - -package processing.mode.java.pdex; - -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Point; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowEvent; -import java.awt.event.WindowFocusListener; -import java.util.List; - -import javax.swing.BoxLayout; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextField; -import javax.swing.JTree; -import javax.swing.ScrollPaneConstants; -import javax.swing.SwingWorker; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreeSelectionModel; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.FieldDeclaration; -import org.eclipse.jdt.core.dom.MethodDeclaration; -import org.eclipse.jdt.core.dom.TypeDeclaration; -import org.eclipse.jdt.core.dom.VariableDeclarationFragment; - -import processing.app.Mode; -import processing.mode.java.JavaEditor; - - -public class SketchOutline { - protected JFrame frmOutlineView; - protected ErrorCheckerService errorCheckerService; - protected JScrollPane jsp; - protected DefaultMutableTreeNode soNode, tempNode; - protected final JTree soTree; - protected JTextField searchField; - protected JavaEditor editor; - protected boolean internalSelection = false; - - ImageIcon classIcon, fieldIcon, methodIcon; - - - public SketchOutline(DefaultMutableTreeNode codeTree, ErrorCheckerService ecs) { - errorCheckerService = ecs; - editor = ecs.getEditor(); - soNode = new DefaultMutableTreeNode(); - generateSketchOutlineTree(soNode, codeTree); - soNode = (DefaultMutableTreeNode) soNode.getChildAt(0); - tempNode = soNode; - soTree = new JTree(soNode); - - Mode mode = editor.getMode(); - classIcon = mode.loadIcon("theme/icon_class_obj.png"); - methodIcon = mode.loadIcon("theme/icon_methpub_obj.png"); - fieldIcon = mode.loadIcon("theme/icon_field_protected_obj.png"); - - createGUI(); - } - - - private void createGUI(){ - frmOutlineView = new JFrame(); - frmOutlineView.setAlwaysOnTop(true); - frmOutlineView.setUndecorated(true); - Point tp = errorCheckerService.getEditor().getTextArea().getLocationOnScreen(); - - int minWidth = (int) (editor.getMinimumSize().width * 0.7f); - int maxWidth = (int) (editor.getMinimumSize().width * 0.9f); - frmOutlineView.setLayout(new BoxLayout(frmOutlineView.getContentPane(), - BoxLayout.Y_AXIS)); - JPanel panelTop = new JPanel(), panelBottom = new JPanel(); - panelTop.setLayout(new BoxLayout(panelTop, BoxLayout.Y_AXIS)); - panelBottom.setLayout(new BoxLayout(panelBottom, BoxLayout.Y_AXIS)); - searchField = new JTextField(); - searchField.setMinimumSize(new Dimension(minWidth, 25)); - panelTop.add(searchField); - - jsp = new JScrollPane(); - - soTree.getSelectionModel() - .setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); - soTree.setRootVisible(false); - soTree.setCellRenderer(new CustomCellRenderer()); - for (int i = 0; i < soTree.getRowCount(); i++) { - soTree.expandRow(i); - } - soTree.setSelectionRow(0); - - jsp.setViewportView(soTree); - jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); - jsp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jsp.setMinimumSize(new Dimension(minWidth, editor.getTextArea().getHeight() - 10)); - jsp.setMaximumSize(new Dimension(maxWidth, editor.getTextArea().getHeight() - 10)); - - panelBottom.add(jsp); - frmOutlineView.add(panelTop); - frmOutlineView.add(panelBottom); - frmOutlineView.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - frmOutlineView.pack(); - frmOutlineView.setBounds(tp.x + errorCheckerService.getEditor().getTextArea().getWidth() - minWidth, tp.y, minWidth, - Math.min(editor.getTextArea().getHeight(), frmOutlineView.getHeight())); - frmOutlineView.setMinimumSize(new Dimension(minWidth, Math.min(errorCheckerService.getEditor().getTextArea().getHeight(), frmOutlineView.getHeight()))); - frmOutlineView.setLocation(tp.x + errorCheckerService.getEditor().getTextArea().getWidth()/2 - frmOutlineView.getWidth()/2, - frmOutlineView.getY() + (editor.getTextArea().getHeight() - frmOutlineView.getHeight()) / 2); - addListeners(); - } - - - protected void addListeners() { - - searchField.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent evt) { - if (soTree.getRowCount() == 0) - return; - - internalSelection = true; - - if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) { - close(); - - } else if (evt.getKeyCode() == KeyEvent.VK_ENTER) { - if (soTree.getLastSelectedPathComponent() != null) { - DefaultMutableTreeNode tnode = (DefaultMutableTreeNode) soTree - .getLastSelectedPathComponent(); - if (tnode.getUserObject() instanceof ASTNodeWrapper) { - ASTNodeWrapper awrap = (ASTNodeWrapper) tnode.getUserObject(); - awrap.highlightNode(errorCheckerService.astGenerator); - //errorCheckerService.highlightNode(awrap); - close(); - } - } - - } else if (evt.getKeyCode() == KeyEvent.VK_UP) { - if (soTree.getLastSelectedPathComponent() == null) { - soTree.setSelectionRow(0); - return; - } - - int x = soTree.getLeadSelectionRow() - 1; - int step = jsp.getVerticalScrollBar().getMaximum() - / soTree.getRowCount(); - if (x == -1) { - x = soTree.getRowCount() - 1; - jsp.getVerticalScrollBar().setValue(jsp.getVerticalScrollBar().getMaximum()); - } else { - jsp.getVerticalScrollBar().setValue((jsp.getVerticalScrollBar() - .getValue() - step)); - } - soTree.setSelectionRow(x); - - } else if (evt.getKeyCode() == KeyEvent.VK_DOWN) { - if (soTree.getLastSelectedPathComponent() == null) { - soTree.setSelectionRow(0); - return; - } - int x = soTree.getLeadSelectionRow() + 1; - - int step = jsp.getVerticalScrollBar().getMaximum() - / soTree.getRowCount(); - if (x == soTree.getRowCount()) { - x = 0; - jsp.getVerticalScrollBar().setValue(jsp.getVerticalScrollBar().getMinimum()); - } else { - jsp.getVerticalScrollBar().setValue((jsp.getVerticalScrollBar() - .getValue() + step)); - } - soTree.setSelectionRow(x); - } - } - }); - - searchField.getDocument().addDocumentListener(new DocumentListener() { - - public void insertUpdate(DocumentEvent e) { - updateSelection(); - } - - public void removeUpdate(DocumentEvent e) { - updateSelection(); - } - - public void changedUpdate(DocumentEvent e) { - updateSelection(); - } - - private void updateSelection(){ - SwingWorker worker = new SwingWorker() { - protected Object doInBackground() throws Exception { - String text = searchField.getText().toLowerCase(); - tempNode = new DefaultMutableTreeNode(); - filterTree(text, tempNode, soNode); - return null; - } - - protected void done() { - soTree.setModel(new DefaultTreeModel(tempNode)); - ((DefaultTreeModel) soTree.getModel()).reload(); - for (int i = 0; i < soTree.getRowCount(); i++) { - soTree.expandRow(i); - } - internalSelection = true; - soTree.setSelectionRow(0); - } - }; - worker.execute(); - } - }); - - frmOutlineView.addWindowFocusListener(new WindowFocusListener() { - public void windowLostFocus(WindowEvent e) { - close(); - } - - public void windowGainedFocus(WindowEvent e) { - } - }); - - soTree.addTreeSelectionListener(new TreeSelectionListener() { - - public void valueChanged(TreeSelectionEvent e) { - - if (internalSelection) { - internalSelection = (false); - return; - } - // log(e); - scrollToNode(); - } - }); - - soTree.addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent me) { - scrollToNode(); - } - }); - } - - - private void scrollToNode() { - SwingWorker worker = new SwingWorker() { - - protected Object doInBackground() throws Exception { - return null; - } - - protected void done() { - if (soTree.getLastSelectedPathComponent() == null) { - return; - } - DefaultMutableTreeNode tnode = (DefaultMutableTreeNode) soTree - .getLastSelectedPathComponent(); - if (tnode.getUserObject() instanceof ASTNodeWrapper) { - ASTNodeWrapper awrap = (ASTNodeWrapper) tnode.getUserObject(); - awrap.highlightNode(errorCheckerService.astGenerator); - // log(awrap); - //errorCheckerService.highlightNode(awrap); - close(); - } - } - }; - worker.execute(); - } - - - protected boolean filterTree(String prefix, DefaultMutableTreeNode tree, - DefaultMutableTreeNode mainTree) { - if (mainTree.isLeaf()) { - return mainTree.getUserObject().toString().toLowerCase().startsWith(prefix); - } - - boolean found = false; - for (int i = 0; i < mainTree.getChildCount(); i++) { - DefaultMutableTreeNode tNode = new DefaultMutableTreeNode( - ((DefaultMutableTreeNode) mainTree - .getChildAt(i)) - .getUserObject()); - if (filterTree(prefix, tNode, - (DefaultMutableTreeNode) mainTree.getChildAt(i))) { - found = true; - tree.add(tNode); - } - } - return found; - } - - - @SuppressWarnings("unchecked") - protected void generateSketchOutlineTree(DefaultMutableTreeNode node, - DefaultMutableTreeNode codetree) { - if (codetree == null) - return; - //log("Visi " + codetree + codetree.getUserObject().getClass().getSimpleName()); - if (!(codetree.getUserObject() instanceof ASTNodeWrapper)) - return; - ASTNodeWrapper awnode = (ASTNodeWrapper) codetree.getUserObject(), aw2 = null; - - if (awnode.getNode() instanceof TypeDeclaration) { - aw2 = new ASTNodeWrapper( ((TypeDeclaration) awnode.getNode()).getName(), - ((TypeDeclaration) awnode.getNode()).getName() - .toString()); - } else if (awnode.getNode() instanceof MethodDeclaration) { - aw2 = new ASTNodeWrapper( - ((MethodDeclaration) awnode.getNode()).getName(), - new CompletionCandidate( - ((MethodDeclaration) awnode - .getNode())) - .toString()); - } else if (awnode.getNode() instanceof FieldDeclaration) { - FieldDeclaration fd = (FieldDeclaration) awnode.getNode(); - for (VariableDeclarationFragment vdf : (List) fd.fragments()) { - final String text = new CompletionCandidate(vdf).toString(); - DefaultMutableTreeNode newNode = - new DefaultMutableTreeNode(new ASTNodeWrapper(vdf.getName(), text)); - node.add(newNode); - } - return; - } - if (aw2 == null) - return; - DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(aw2); - node.add(newNode); - for (int i = 0; i < codetree.getChildCount(); i++) { - generateSketchOutlineTree(newNode, - (DefaultMutableTreeNode) codetree.getChildAt(i)); - } - } - - - public void show() { - frmOutlineView.setVisible(true); - } - - - public void close(){ - frmOutlineView.setVisible(false); - frmOutlineView.dispose(); - } - - - public boolean isVisible(){ - return frmOutlineView.isVisible(); - } - - - protected class CustomCellRenderer extends DefaultTreeCellRenderer { - - public Component getTreeCellRendererComponent(JTree tree, Object value, - boolean sel, boolean expanded, - boolean leaf, int row, - boolean hasFocus) { - super.getTreeCellRendererComponent(tree, value, sel, expanded, - leaf, row, hasFocus); - if (value instanceof DefaultMutableTreeNode) - setIcon(getTreeIcon(value)); - - return this; - } - - public Icon getTreeIcon(Object o) { - if (((DefaultMutableTreeNode) o).getUserObject() instanceof ASTNodeWrapper) { - ASTNodeWrapper awrap = (ASTNodeWrapper) - ((DefaultMutableTreeNode) o).getUserObject(); - - int type = awrap.getNode().getParent().getNodeType(); - if (type == ASTNode.METHOD_DECLARATION) { - return methodIcon; - } else if (type == ASTNode.TYPE_DECLARATION) { - return classIcon; - } else if (type == ASTNode.VARIABLE_DECLARATION_FRAGMENT) { - return fieldIcon; - } - } - return null; - } - } -} diff --git a/java/src/processing/mode/java/pdex/SourceUtils.java b/java/src/processing/mode/java/pdex/SourceUtils.java new file mode 100644 index 0000000000..ec619fd86e --- /dev/null +++ b/java/src/processing/mode/java/pdex/SourceUtils.java @@ -0,0 +1,371 @@ +package processing.mode.java.pdex; + +import org.eclipse.jdt.core.dom.ASTVisitor; +import org.eclipse.jdt.core.dom.CompilationUnit; +import org.eclipse.jdt.core.dom.MethodDeclaration; +import org.eclipse.jdt.core.dom.NumberLiteral; +import org.eclipse.jdt.core.dom.SimpleType; + +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import processing.mode.java.pdex.TextTransform.Edit; +import processing.mode.java.preproc.PdePreprocessor; + +public class SourceUtils { + + + public static final Pattern IMPORT_REGEX = + Pattern.compile("(?:^|;)\\s*(import\\s+(?:(static)\\s+)?((?:\\w+\\s*\\.)*)\\s*(\\S+)\\s*;)", + Pattern.MULTILINE | Pattern.DOTALL); + + public static final Pattern IMPORT_REGEX_NO_KEYWORD = + Pattern.compile("^\\s*((?:(static)\\s+)?((?:\\w+\\s*\\.)*)\\s*(\\S+))", + Pattern.MULTILINE | Pattern.DOTALL); + + public static List parseProgramImports(CharSequence source) { + List result = new ArrayList<>(); + Matcher matcher = IMPORT_REGEX.matcher(source); + while (matcher.find()) { + ImportStatement is = ImportStatement.parse(matcher.toMatchResult()); + result.add(is); + } + return result; + } + + public static List parseProgramImports(CharSequence source, + List outImports) { + List result = new ArrayList<>(); + Matcher matcher = IMPORT_REGEX.matcher(source); + while (matcher.find()) { + ImportStatement is = ImportStatement.parse(matcher.toMatchResult()); + outImports.add(is); + int idx = matcher.start(1); + int len = matcher.end(1) - idx; + // Remove the import from the main program + // Substitute with white spaces + result.add(Edit.move(idx, len, 0)); + result.add(Edit.insert(0, "\n")); + } + return result; + } + + + + // Positive lookahead and lookbehind are needed to match all type constructors + // in code like `int(byte(245))` where first bracket matches as last + // group in "^int(" but also as a first group in "(byte(". Lookahead and + // lookbehind won't consume the shared character. + public static final Pattern TYPE_CONSTRUCTOR_REGEX = + Pattern.compile("(?<=^|\\W)(int|char|float|boolean|byte)(?=\\s*\\()", + Pattern.MULTILINE); + + public static List replaceTypeConstructors(CharSequence source) { + + List result = new ArrayList<>(); + + Matcher matcher = TYPE_CONSTRUCTOR_REGEX.matcher(source); + while (matcher.find()) { + String match = matcher.group(1); + int offset = matcher.start(1); + int length = match.length(); + result.add(Edit.insert(offset, "PApplet.")); + String replace = "parse" + + Character.toUpperCase(match.charAt(0)) + match.substring(1); + result.add(Edit.replace(offset, length, replace)); + } + + return result; + } + + + + public static final Pattern HEX_LITERAL_REGEX = + Pattern.compile("(?<=^|\\W)(#[A-Fa-f0-9]{6})(?=\\W|$)"); + + public static List replaceHexLiterals(CharSequence source) { + // Find all #[webcolor] and replace with 0xff[webcolor] + // Should be 6 digits only. + List result = new ArrayList<>(); + + Matcher matcher = HEX_LITERAL_REGEX.matcher(source); + while (matcher.find()) { + int offset = matcher.start(1); + result.add(Edit.replace(offset, 1, "0xff")); + } + + return result; + } + + + + public static List insertImports(List imports) { + List result = new ArrayList<>(); + for (ImportStatement imp : imports) { + result.add(Edit.insert(0, imp.getFullSourceLine() + "\n")); + } + return result; + } + + public static List wrapSketch(PdePreprocessor.Mode mode, String className, int sourceLength) { + + List edits = new ArrayList<>(); + + StringBuilder b = new StringBuilder(); + + // Header + if (mode != PdePreprocessor.Mode.JAVA) { + b.append("\npublic class ").append(className).append(" extends PApplet {\n"); + if (mode == PdePreprocessor.Mode.STATIC) { + b.append("public void setup() {\n"); + } + } + + edits.add(Edit.insert(0, b.toString())); + + // Reset builder + b.setLength(0); + + // Footer + if (mode != PdePreprocessor.Mode.JAVA) { + if (mode == PdePreprocessor.Mode.STATIC) { + // no noLoop() here so it does not tell you + // "can't invoke noLoop() on obj" when you type "obj." + b.append("\n}"); + } + b.append("\n}\n"); + } + + edits.add(Edit.insert(sourceLength, b.toString())); + + return edits; + } + + + // Verifies that whole input String is floating point literal. Can't be used for searching. + // https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-DecimalFloatingPointLiteral + public static final Pattern FLOATING_POINT_LITERAL_VERIFIER; + static { + final String DIGITS = "(?:[0-9]|[0-9][0-9_]*[0-9])"; + final String EXPONENT_PART = "(?:[eE][+-]?" + DIGITS + ")"; + FLOATING_POINT_LITERAL_VERIFIER = Pattern.compile( + "(?:^" + DIGITS + "\\." + DIGITS + "?" + EXPONENT_PART + "?[fFdD]?$)|" + + "(?:^\\." + DIGITS + EXPONENT_PART + "?[fFdD]?$)|" + + "(?:^" + DIGITS + EXPONENT_PART + "[fFdD]?$)|" + + "(?:^" + DIGITS + EXPONENT_PART + "?[fFdD]$)"); + } + + // Mask to quickly resolve whether there are any access modifiers present + private static final int ACCESS_MODIFIERS_MASK = + Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED; + + public static List preprocessAST(CompilationUnit cu) { + final List edits = new ArrayList<>(); + + // Walk the tree + cu.accept(new ASTVisitor() { + @Override + public boolean visit(SimpleType node) { + // replace "color" with "int" + if ("color".equals(node.getName().toString())) { + edits.add(Edit.replace(node.getStartPosition(), node.getLength(), "int")); + } + return super.visit(node); + } + + @Override + public boolean visit(NumberLiteral node) { + // add 'f' to floats + String s = node.getToken().toLowerCase(); + if (FLOATING_POINT_LITERAL_VERIFIER.matcher(s).matches() && !s.endsWith("f") && !s.endsWith("d")) { + edits.add(Edit.insert(node.getStartPosition() + node.getLength(), "f")); + } + return super.visit(node); + } + + @Override + public boolean visit(MethodDeclaration node) { + // add 'public' to methods with default visibility + int accessModifiers = node.getModifiers() & ACCESS_MODIFIERS_MASK; + if (accessModifiers == 0) { + edits.add(Edit.insert(node.getStartPosition(), "public ")); + } + return super.visit(node); + } + }); + + return edits; + } + + + public static final Pattern COLOR_TYPE_REGEX = + Pattern.compile("(?:^|^\\p{javaJavaIdentifierPart})(color)\\s(?!\\s*\\()", + Pattern.MULTILINE | Pattern.UNICODE_CHARACTER_CLASS); + + public static List replaceColorRegex(CharSequence source) { + final List edits = new ArrayList<>(); + + Matcher matcher = COLOR_TYPE_REGEX.matcher(source); + while (matcher.find()) { + int offset = matcher.start(1); + edits.add(Edit.replace(offset, 5, "int")); + } + + return edits; + } + + + public static final Pattern NUMBER_LITERAL_REGEX = + Pattern.compile("[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?"); + + public static List fixFloatsRegex(CharSequence source) { + final List edits = new ArrayList<>(); + + Matcher matcher = NUMBER_LITERAL_REGEX.matcher(source); + while (matcher.find()) { + int offset = matcher.start(); + int end = matcher.end(); + String group = matcher.group().toLowerCase(); + boolean isFloatingPoint = group.contains(".") || group.contains("e"); + boolean hasSuffix = end < source.length() && + Character.toLowerCase(source.charAt(end)) != 'f' && + Character.toLowerCase(source.charAt(end)) != 'd'; + if (isFloatingPoint && !hasSuffix) { + edits.add(Edit.insert(offset, "f")); + } + } + + return edits; + } + + + static public String scrubCommentsAndStrings(String p) { + StringBuilder sb = new StringBuilder(p); + scrubCommentsAndStrings(sb); + return sb.toString(); + } + + static public void scrubCommentsAndStrings(StringBuilder p) { + + final int length = p.length(); + + final int OUT = 0; + final int IN_BLOCK_COMMENT = 1; + final int IN_EOL_COMMENT = 2; + final int IN_STRING_LITERAL = 3; + final int IN_CHAR_LITERAL = 4; + + int blockStart = -1; + + int prevState = OUT; + int state = OUT; + + for (int i = 0; i <= length; i++) { + char ch = (i < length) ? p.charAt(i) : 0; + char pch = (i == 0) ? 0 : p.charAt(i-1); + // Get rid of double backslash immediately, otherwise + // the second backslash incorrectly triggers a new escape sequence + if (pch == '\\' && ch == '\\') { + p.setCharAt(i-1, ' '); + p.setCharAt(i, ' '); + pch = ' '; + ch = ' '; + } + switch (state) { + case OUT: + switch (ch) { + case '\'': state = IN_CHAR_LITERAL; break; + case '"': state = IN_STRING_LITERAL; break; + case '*': if (pch == '/') state = IN_BLOCK_COMMENT; break; + case '/': if (pch == '/') state = IN_EOL_COMMENT; break; + } + break; + case IN_BLOCK_COMMENT: + if (pch == '*' && ch == '/' && (i - blockStart) > 0) { + state = OUT; + } + break; + case IN_EOL_COMMENT: + if (ch == '\r' || ch == '\n') { + state = OUT; + } + break; + case IN_STRING_LITERAL: + if ((pch != '\\' && ch == '"') || ch == '\r' || ch == '\n') { + state = OUT; + } + break; + case IN_CHAR_LITERAL: + if ((pch != '\\' && ch == '\'') || ch == '\r' || ch == '\n') { + state = OUT; + } + break; + } + + // Terminate ongoing block at last char + if (i == length) { + state = OUT; + } + + // Handle state changes + if (state != prevState) { + if (state != OUT) { + // Entering block + blockStart = i + 1; + } else { + // Exiting block + int blockEnd = i; + if (prevState == IN_BLOCK_COMMENT && i < length) blockEnd--; // preserve star in '*/' + for (int j = blockStart; j < blockEnd; j++) { + char c = p.charAt(j); + if (c != '\n' && c != '\r') p.setCharAt(j, ' '); + } + } + } + + prevState = state; + } + + } + + + // TODO: move this to a better place when JavaBuild starts using JDT and we + // don't need to check errors at two different places [jv 2017-09-19] + /** + * Checks a single code fragment (such as a tab) for non-matching braces. + * Broken out to allow easy use in JavaBuild. + * @param c Program code scrubbed of comments and string literals. + * @param start Start index, inclusive. + * @param end End index, exclusive. + * @return {@code int[4]} Depth at which the loop stopped, followed by the + * line number, column, and string index (within the range) at which + * an error was found, if any. + */ + static public int[] checkForMissingBraces(CharSequence c, int start, int end) { + int depth = 0; + int lineNumber = 0; + int lineStart = start; + for (int i = start; i < end; i++) { + char ch = c.charAt(i); + switch (ch) { + case '{': + depth++; + break; + case '}': + depth--; + break; + case '\n': + lineNumber++; + lineStart = i; + break; + } + if (depth < 0) { + return new int[] {depth, lineNumber, i - lineStart, i - start}; + } + } + return new int[] {depth, lineNumber - 1, end - lineStart - 2, end - start - 2}; + } +} diff --git a/java/src/processing/mode/java/pdex/TabOutline.java b/java/src/processing/mode/java/pdex/TabOutline.java deleted file mode 100644 index ca57781a65..0000000000 --- a/java/src/processing/mode/java/pdex/TabOutline.java +++ /dev/null @@ -1,349 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -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. -*/ - -package processing.mode.java.pdex; - -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.GridBagLayout; -import java.awt.Point; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowEvent; -import java.awt.event.WindowFocusListener; - -import javax.swing.BoxLayout; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextField; -import javax.swing.JTree; -import javax.swing.ScrollPaneConstants; -import javax.swing.SwingWorker; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreeSelectionModel; - -import processing.app.SketchCode; -import processing.mode.java.JavaEditor; - - -public class TabOutline { - protected JFrame frmOutlineView; - protected JScrollPane jsp; - protected DefaultMutableTreeNode tabNode; - protected DefaultMutableTreeNode tempNode; - protected JTree tabTree; - protected JTextField searchField; - protected JLabel lblCaption; - protected JavaEditor editor; - protected ErrorCheckerService errorCheckerService; - protected boolean internalSelection = false; - - - public TabOutline(ErrorCheckerService ecs) { - errorCheckerService = ecs; - editor = ecs.getEditor(); - createGUI(); - } - - - private void createGUI() { - frmOutlineView = new JFrame(); - frmOutlineView.setAlwaysOnTop(true); - frmOutlineView.setUndecorated(true); - Point tp = errorCheckerService.getEditor().getTextArea().getLocationOnScreen(); - lblCaption = new JLabel("Tabs List (type to filter)"); - int minWidth = estimateFrameWidth(); - int maxWidth = (int) (editor.getMinimumSize().width * 0.9f); - frmOutlineView.setLayout(new BoxLayout(frmOutlineView.getContentPane(), - BoxLayout.Y_AXIS)); - JPanel panelTop = new JPanel(), panelMiddle = new JPanel(), panelBottom = new JPanel(); - panelTop.setLayout(new GridBagLayout()); - panelMiddle.setLayout(new BoxLayout(panelMiddle, BoxLayout.Y_AXIS)); - panelBottom.setLayout(new BoxLayout(panelBottom, BoxLayout.Y_AXIS)); - lblCaption.setAlignmentX(Component.LEFT_ALIGNMENT); - panelTop.add(lblCaption); - searchField = new JTextField(); - searchField.setMinimumSize(new Dimension(minWidth, 25)); - panelMiddle.add(searchField); - - jsp = new JScrollPane(); - populateTabTree(); - jsp.setViewportView(tabTree); - jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); - jsp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jsp.setMinimumSize(new Dimension(minWidth, editor.getTextArea().getHeight() - 10)); - jsp.setMaximumSize(new Dimension(maxWidth, editor.getTextArea().getHeight() - 10)); - - panelBottom.add(jsp); - frmOutlineView.add(panelTop); - frmOutlineView.add(panelMiddle); - frmOutlineView.add(panelBottom); - frmOutlineView.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - frmOutlineView.pack(); - frmOutlineView.setBounds(tp.x + errorCheckerService.getEditor().getTextArea().getWidth() - minWidth, - tp.y, - minWidth, - estimateFrameHeight()); - frmOutlineView.setMinimumSize(new Dimension(minWidth, Math - .min(errorCheckerService.getEditor().getTextArea().getHeight(), - frmOutlineView.getHeight()))); - frmOutlineView.setLocation(tp.x + errorCheckerService.getEditor().getTextArea().getWidth()/2 - frmOutlineView.getWidth()/2, - frmOutlineView.getY() + (editor.getTextArea().getHeight() - frmOutlineView.getHeight()) / 2); - DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) tabTree.getCellRenderer(); - renderer.setLeafIcon(null); - renderer.setClosedIcon(null); - renderer.setOpenIcon(null); - addListeners(); - } - - - private void addListeners() { - searchField.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent evt) { - if (tabTree.getRowCount() == 0) - return; - - internalSelection = true; - - if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) { - close(); - } else if (evt.getKeyCode() == KeyEvent.VK_ENTER) { - if (tabTree.getLastSelectedPathComponent() != null) { - DefaultMutableTreeNode tnode = (DefaultMutableTreeNode) tabTree - .getLastSelectedPathComponent(); - //log("Enter Key, Tab: " + tnode); - switchToTab(tnode.toString()); - close(); - } - } else if (evt.getKeyCode() == KeyEvent.VK_UP) { - if (tabTree.getLastSelectedPathComponent() == null) { - tabTree.setSelectionRow(0); - return; - } - - int x = tabTree.getLeadSelectionRow() - 1; - int step = jsp.getVerticalScrollBar().getMaximum() - / tabTree.getRowCount(); - if (x == -1) { - x = tabTree.getRowCount() - 1; - jsp.getVerticalScrollBar().setValue(jsp.getVerticalScrollBar() - .getMaximum()); - } else { - jsp.getVerticalScrollBar().setValue((jsp.getVerticalScrollBar() - .getValue() - step)); - } - tabTree.setSelectionRow(x); - } else if (evt.getKeyCode() == KeyEvent.VK_DOWN) { - if (tabTree.getLastSelectedPathComponent() == null) { - tabTree.setSelectionRow(0); - return; - } - int x = tabTree.getLeadSelectionRow() + 1; - - int step = jsp.getVerticalScrollBar().getMaximum() - / tabTree.getRowCount(); - if (x == tabTree.getRowCount()) { - x = 0; - jsp.getVerticalScrollBar().setValue(jsp.getVerticalScrollBar() - .getMinimum()); - } else { - jsp.getVerticalScrollBar().setValue((jsp.getVerticalScrollBar() - .getValue() + step)); - } - tabTree.setSelectionRow(x); - } - } - }); - - searchField.getDocument().addDocumentListener(new DocumentListener() { - - public void insertUpdate(DocumentEvent e) { - updateSelection(); - } - - public void removeUpdate(DocumentEvent e) { - updateSelection(); - } - - public void changedUpdate(DocumentEvent e) { - updateSelection(); - } - - private void updateSelection() { - SwingWorker worker = new SwingWorker() { - protected Object doInBackground() throws Exception { - String text = searchField.getText().toLowerCase(); - tempNode = new DefaultMutableTreeNode(); - filterTree(text, tempNode, tabNode); - return null; - } - - protected void done() { - tabTree.setModel(new DefaultTreeModel(tempNode)); - ((DefaultTreeModel) tabTree.getModel()).reload(); -// for (int i = 0; i < tabTree.getRowCount(); i++) { -// tabTree.expandRow(i); -// } - internalSelection = true; - tabTree.setSelectionRow(0); - } - }; - worker.execute(); - } - }); - - tabTree.addTreeSelectionListener(new TreeSelectionListener() { - - public void valueChanged(TreeSelectionEvent e) { - - if (internalSelection) { - //log("Internal selection"); - internalSelection = (false); - return; - } - // log(e); - SwingWorker worker = new SwingWorker() { - - protected Object doInBackground() throws Exception { - return null; - } - - protected void done() { - if (tabTree.getLastSelectedPathComponent() == null) { - return; - } - DefaultMutableTreeNode tnode = (DefaultMutableTreeNode) tabTree - .getLastSelectedPathComponent(); - //log("Clicked " + tnode); - switchToTab(tnode.toString()); - close(); - } - }; - worker.execute(); - } - }); - - tabTree.addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent me) { - if (tabTree.getLastSelectedPathComponent() == null) { - return; - } - DefaultMutableTreeNode tnode = - (DefaultMutableTreeNode) tabTree.getLastSelectedPathComponent(); - //log("Clicked " + tnode); - switchToTab(tnode.toString()); - close(); - } - }); - - frmOutlineView.addWindowFocusListener(new WindowFocusListener() { - public void windowLostFocus(WindowEvent e) { - close(); - } - - public void windowGainedFocus(WindowEvent e) { - } - }); - } - - private void switchToTab(String tabName) { - for (SketchCode sc : editor.getSketch().getCode()) { - if (sc.getPrettyName().equals(tabName)) { - editor.getSketch().setCurrentCode(editor.getSketch().getCodeIndex(sc)); - } - } - } - - private void populateTabTree() { - tabNode = new DefaultMutableTreeNode("Tabs"); - for (SketchCode sc : editor.getSketch().getCode()) { - DefaultMutableTreeNode tab = new DefaultMutableTreeNode( - sc.getPrettyName()); - tabNode.add(tab); - } - tempNode = tabNode; - tabTree = new JTree(tabNode); - tabTree.getSelectionModel() - .setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); - tabTree.setRootVisible(false); - tabTree.setSelectionRow(editor.getSketch().getCurrentCodeIndex()); - } - - protected boolean filterTree(String prefix, DefaultMutableTreeNode tree, - DefaultMutableTreeNode mainTree) { - if (mainTree.isLeaf()) { - return (mainTree.getUserObject().toString().toLowerCase() - .startsWith(prefix)); - } - - boolean found = false; - for (int i = 0; i < mainTree.getChildCount(); i++) { - DefaultMutableTreeNode tNode = new DefaultMutableTreeNode( - ((DefaultMutableTreeNode) mainTree - .getChildAt(i)) - .getUserObject()); - if (filterTree(prefix, tNode, - (DefaultMutableTreeNode) mainTree.getChildAt(i))) { - found = true; - tree.add(tNode); - } - } - return found; - } - - private int estimateFrameWidth() { - FontMetrics fm = editor.getTextArea().getGraphics().getFontMetrics(); - int w = fm.stringWidth(lblCaption.getText()) + 10; - for (int i = 0; i < editor.getSketch().getCodeCount(); i++) { - w = Math.max(w, fm.stringWidth(editor.getSketch().getCode(i).getPrettyName()) + 10); - } - return w; - } - - private int estimateFrameHeight() { - int textHeight = jsp.getGraphics().getFontMetrics().getHeight() + 2; - int t = Math.max(4, editor.getSketch().getCodeCount() + 3); - return Math.min(textHeight * t, frmOutlineView.getHeight()); - } - - public void show() { - frmOutlineView.setVisible(true); - } - - public void close() { - frmOutlineView.setVisible(false); - frmOutlineView.dispose(); - } - - public boolean isVisible() { - return frmOutlineView.isVisible(); - } -} diff --git a/java/src/processing/mode/java/pdex/TextTransform.java b/java/src/processing/mode/java/pdex/TextTransform.java new file mode 100644 index 0000000000..1805464394 --- /dev/null +++ b/java/src/processing/mode/java/pdex/TextTransform.java @@ -0,0 +1,327 @@ +package processing.mode.java.pdex; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.ListIterator; +import java.util.stream.Collectors; + +import processing.core.PApplet; + + +public class TextTransform { + + private static final Comparator INPUT_OFFSET_COMP = + (o1, o2) -> Integer.compare(o1.fromOffset, o2.fromOffset); + + private static final Comparator OUTPUT_OFFSET_COMP = + (o1, o2) -> Integer.compare(o1.toOffset, o2.toOffset); + + + private CharSequence input; + + private List edits = new ArrayList<>(); + + private List inMap = new ArrayList<>(); + private List outMap = new ArrayList<>(); + + private boolean built; + private int builtForLength; + + + TextTransform(CharSequence input) { + this.input = input; + } + + + public void add(Edit edit) { + edits.add(edit); + built = false; + } + + + public void addAll(Collection edits) { + this.edits.addAll(edits); + built = false; + } + + + public String apply() { + final int inLength = input.length(); + final StringBuilder output = new StringBuilder(inLength); + + buildIfNeeded(inLength); + + outMap.stream() + // Filter out Delete edits + .filter(outEdit -> outEdit.toLength > 0) + .forEach(outEdit -> { + if (outEdit.outputText != null) { + // Insert or Replace edit + output.append(outEdit.outputText); + } else { + // Move edit + output.append(input, outEdit.fromOffset, outEdit.fromOffset + outEdit.fromLength); + } + }); + + return output.toString(); + } + + + public OffsetMapper getMapper() { + int inLength = input.length(); + buildIfNeeded(inLength); + return new SimpleOffsetMapper(inMap, outMap); + } + + + private void buildIfNeeded(int inLength) { + if (built && inLength == builtForLength) return; + + // Make copies of Edits to preserve original edits + List inEdits = edits.stream().map(Edit::new).collect(Collectors.toList()); + List outEdits = new ArrayList<>(inEdits); + + // Edits sorted by input offsets + Collections.sort(inEdits, INPUT_OFFSET_COMP); + + // Edits sorted by output offsets + Collections.sort(outEdits, OUTPUT_OFFSET_COMP); + + // TODO: add some validation + + // Input + ListIterator inIt = inEdits.listIterator(); + Edit inEdit = inIt.hasNext() ? inIt.next() : null; + int inEditOff = inEdit == null ? inLength : inEdit.fromOffset; + + // Output + ListIterator outIt = outEdits.listIterator(); + Edit outEdit = outIt.hasNext() ? outIt.next() : null; + int outEditOff = outEdit == null ? inLength : outEdit.toOffset; + + int inOffset = 0; + int outOffset = 0; + + inMap.clear(); + outMap.clear(); + + // Walk through the input, apply changes, create mapping + while (inOffset < inLength || inEdit != null || outEdit != null) { + + { // Create mapping for unmodified portion of the input + int nextEditOffset = Math.min(inEditOff, outEditOff); + + { // Insert move block to have mapping for unmodified portions too + int length = nextEditOffset - inOffset; + if (length > 0) { + Edit ch = Edit.move(inOffset, length, outOffset); + inMap.add(ch); + outMap.add(ch); + } + } + + // Move offsets accordingly + outOffset += nextEditOffset - inOffset; + inOffset = nextEditOffset; + } + + // Process encountered input edits + while (inEdit != null && inOffset >= inEditOff) { + inOffset += inEdit.fromLength; + if (inEdit.fromLength > 0) inMap.add(inEdit); + inEdit = inIt.hasNext() ? inIt.next() : null; + inEditOff = inEdit != null ? inEdit.fromOffset : inLength; + } + + // Process encountered output edits + while (outEdit != null && inOffset >= outEditOff) { + outEdit.toOffset = outOffset; + if (outEdit.toLength > 0) outMap.add(outEdit); + outOffset += outEdit.toLength; + outEdit = outIt.hasNext() ? outIt.next() : null; + outEditOff = outEdit != null ? outEdit.toOffset : inLength; + } + } + + built = true; + builtForLength = inLength; + } + + + @Override + public String toString() { + return "SourceMapping{" + + "edits=" + edits + + '}'; + } + + + protected static class Edit { + + static Edit insert(int offset, String text) { + return new Edit(offset, 0, offset, text.length(), text); + } + + static Edit replace(int offset, int length, String text) { + return new Edit(offset, length, offset, text.length(), text); + } + + static Edit move(int fromOffset, int length, int toOffset) { + Edit result = new Edit(fromOffset, length, toOffset, length, null); + result.toOffset = toOffset; + return result; + } + + static Edit delete(int position, int length) { + return new Edit(position, length, position, 0, null); + } + + Edit(Edit edit) { + this.fromOffset = edit.fromOffset; + this.fromLength = edit.fromLength; + this.toOffset = edit.toOffset; + this.toLength = edit.toLength; + this.outputText = edit.outputText; + } + + Edit(int fromOffset, int fromLength, int toOffset, int toLength, String text) { + this.fromOffset = fromOffset; + this.fromLength = fromLength; + this.toOffset = toOffset; + this.toLength = toLength; + this.outputText = text; + } + + private final int fromOffset; + private final int fromLength; + private int toOffset; + private final int toLength; + private final String outputText; + + @Override + public String toString() { + return "Edit{" + + "from=" + fromOffset + ":" + fromLength + + ", to=" + toOffset + ":" + toLength + + ((outputText != null) ? (", text='" + outputText + '\'') : "") + + '}'; + } + } + + + protected interface OffsetMapper { + int getInputOffset(int outputOffset); + int getOutputOffset(int inputOffset); + OffsetMapper thenMapping(OffsetMapper mapper); + OffsetMapper EMPTY_MAPPER = CompositeOffsetMapper.of(); + } + + + private static class SimpleOffsetMapper implements OffsetMapper { + private List inMap = new ArrayList<>(); + private List outMap = new ArrayList<>(); + + private int outputOffsetOfInputStart; + private int inputOffsetOfOutputStart; + + private SimpleOffsetMapper(List inMap, List outMap) { + this.inMap.addAll(inMap); + this.outMap.addAll(outMap); + + Edit inStart = null; + for (Edit in : this.inMap) { + inStart = in; + if (in.fromLength > 0) break; + } + outputOffsetOfInputStart = inStart == null ? 0 : inStart.toOffset; + + Edit outStart = null; + for (Edit out : this.inMap) { + outStart = out; + if (out.toLength > 0) break; + } + inputOffsetOfOutputStart = outStart == null ? 0 : outStart.fromOffset; + } + + @Override + public int getInputOffset(int outputOffset) { + if (outputOffset < outputOffsetOfInputStart) return -1; + Edit searchKey = new Edit(0, 0, outputOffset, Integer.MAX_VALUE, null); + int i = Collections.binarySearch(outMap, searchKey, OUTPUT_OFFSET_COMP); + if (i < 0) { + i = -(i + 1); + i -= 1; + } + i = PApplet.constrain(i, 0, outMap.size()-1); + Edit edit = outMap.get(i); + int diff = outputOffset - edit.toOffset; + return edit.fromOffset + Math.min(diff, Math.max(0, edit.fromLength - 1)); + } + + @Override + public int getOutputOffset(int inputOffset) { + if (inputOffset < inputOffsetOfOutputStart) return -1; + Edit searchKey = new Edit(inputOffset, Integer.MAX_VALUE, 0, 0, null); + int i = Collections.binarySearch(inMap, searchKey, INPUT_OFFSET_COMP); + if (i < 0) { + i = -(i + 1); + i -= 1; + } + i = PApplet.constrain(i, 0, inMap.size()-1); + Edit edit = inMap.get(i); + int diff = inputOffset - edit.fromOffset; + return edit.toOffset + Math.min(diff, Math.max(0, edit.toLength - 1)); + } + + @Override + public OffsetMapper thenMapping(OffsetMapper mapper) { + return CompositeOffsetMapper.of(this, mapper); + } + } + + + private static class CompositeOffsetMapper implements OffsetMapper { + private List mappers = new ArrayList<>(); + + public static CompositeOffsetMapper of(OffsetMapper... inMappers) { + CompositeOffsetMapper composite = new CompositeOffsetMapper(); + + // Add mappers one by one, unwrap if Composite + for (OffsetMapper mapper : inMappers) { + if (mapper instanceof CompositeOffsetMapper) { + composite.mappers.addAll(((CompositeOffsetMapper) mapper).mappers); + } else { + composite.mappers.add(mapper); + } + } + + return composite; + } + + @Override + public int getInputOffset(int outputOffset) { + for (int i = mappers.size() - 1; i >= 0; i--) { + outputOffset = mappers.get(i).getInputOffset(outputOffset); + } + return outputOffset; + } + + @Override + public int getOutputOffset(int inputOffset) { + for (OffsetMapper mapper : mappers) { + inputOffset = mapper.getOutputOffset(inputOffset); + } + return inputOffset; + } + + @Override + public OffsetMapper thenMapping(OffsetMapper mapper) { + return CompositeOffsetMapper.of(this, mapper); + } + } + +} diff --git a/java/src/processing/mode/java/pdex/VMEventListener.java b/java/src/processing/mode/java/pdex/VMEventListener.java deleted file mode 100644 index 14c6652c56..0000000000 --- a/java/src/processing/mode/java/pdex/VMEventListener.java +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -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. -*/ - -package processing.mode.java.pdex; - -import com.sun.jdi.event.EventSet; - -/** - * Interface for VM callbacks. - * - * @author Martin Leopold - */ -public interface VMEventListener { - - /** - * Receive an event from the VM. Events are sent in batches. See - * documentation of EventSet for more information. - * - * @param es Set of events - */ - void vmEvent(EventSet es); -} diff --git a/java/src/processing/mode/java/pdex/VMEventReader.java b/java/src/processing/mode/java/pdex/VMEventReader.java deleted file mode 100644 index 39322fdc25..0000000000 --- a/java/src/processing/mode/java/pdex/VMEventReader.java +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -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. -*/ - -package processing.mode.java.pdex; - -import com.sun.jdi.VMDisconnectedException; -import com.sun.jdi.event.EventQueue; -import com.sun.jdi.event.EventSet; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Reader Thread for VM Events. Constantly monitors a VMs EventQueue for new - * events and forwards them to an VMEventListener. - * - * @author Martin Leopold - */ -public class VMEventReader extends Thread { - - EventQueue eventQueue; - VMEventListener listener; - - /** - * Construct a VMEventReader. Needs to be kicked off with start() once - * constructed. - * - * @param eventQueue The queue to read events from. Can be obtained from a - * VirtualMachine via eventQueue(). - * @param listener the listener to forward events to. - */ - public VMEventReader(EventQueue eventQueue, VMEventListener listener) { - super("VM Event Thread"); - this.eventQueue = eventQueue; - this.listener = listener; - } - - @Override - public void run() { - try { - while (true) { - EventSet eventSet = eventQueue.remove(); - listener.vmEvent(eventSet); - /* - * for (Event e : eventSet) { System.out.println("VM Event: " + - * e.toString()); } - */ - } - } catch (VMDisconnectedException e) { - Logger.getLogger(VMEventReader.class.getName()).log(Level.INFO, "VMEventReader quit on VM disconnect"); - } catch (Exception e) { - Logger.getLogger(VMEventReader.class.getName()).log(Level.SEVERE, "VMEventReader quit", e); - } - } -} diff --git a/java/src/processing/mode/java/pdex/XQErrorTable.java b/java/src/processing/mode/java/pdex/XQErrorTable.java deleted file mode 100644 index 9b0e248711..0000000000 --- a/java/src/processing/mode/java/pdex/XQErrorTable.java +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* - Part of the Processing project - http://processing.org - Copyright (c) 2012-15 The Processing Foundation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 - as published by the Free Software Foundation. - - 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. -*/ - -package processing.mode.java.pdex; - -import java.awt.Color; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.event.*; -import java.util.List; - -import javax.swing.*; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.table.JTableHeader; -import javax.swing.table.TableColumnModel; -import javax.swing.table.TableModel; -import javax.swing.text.BadLocationException; - -import processing.app.Language; -import processing.app.Messages; -import processing.app.ui.Editor; -import processing.app.ui.Toolkit; -import processing.mode.java.JavaEditor; - - -public class XQErrorTable extends JTable { - Editor editor; - - static final String[] columnNames = { - Language.text("editor.footer.errors.problem"), - Language.text("editor.footer.errors.tab"), - Language.text("editor.footer.errors.line") - }; - - int[] columnWidths = { 400, 100, 50 }; - - /** Is the column being resized? */ - private boolean columnResizing = false; - - - public XQErrorTable(final JavaEditor editor) { - this.editor = editor; - JTableHeader header = getTableHeader(); - - // Try to make things a little less awful until I find time to finish it - Font font = Toolkit.getSansFont(12, Font.PLAIN); - setFont(font); - header.setFont(font); - //setBorder(new EmptyBorder(0, Editor.LEFT_GUTTER, 0, 0)); // no effect - - TableColumnModel columnModel = getColumnModel(); - for (int i = 0; i < columnModel.getColumnCount(); i++) { - columnModel.getColumn(i).setPreferredWidth(columnWidths[i]); - } - - addMouseListener(new MouseAdapter() { - @Override - synchronized public void mouseClicked(MouseEvent e) { - try { - int row = ((XQErrorTable) e.getSource()).getSelectedRow(); - editor.getErrorChecker().scrollToErrorLine(row); - } catch (Exception e1) { - Messages.log("Exception XQErrorTable mouseReleased " + e); - } - } - }); - - addMouseMotionListener(new MouseMotionAdapter() { - @Override - public void mouseMoved(MouseEvent evt) { - int rowIndex = rowAtPoint(evt.getPoint()); - - List problemsList = editor.getErrorChecker().problemsList; - synchronized (problemsList) { - if (rowIndex < problemsList.size()) { - - Problem p = problemsList.get(rowIndex); - if (p.getImportSuggestions() != null - && p.getImportSuggestions().length > 0) { - String t = p.getMessage() + "(Import Suggestions available)"; - FontMetrics fm = getFontMetrics(getFont()); - int x1 = fm.stringWidth(p.getMessage()); - int x2 = fm.stringWidth(t); - if (evt.getX() > x1 && evt.getX() < x2) { - String[] list = p.getImportSuggestions(); - String className = list[0].substring(list[0].lastIndexOf('.') + 1); - String[] temp = new String[list.length]; - for (int i = 0; i < list.length; i++) { - temp[i] = "Import '" + className + "' (" + list[i] + ")"; - } - showImportSuggestion(temp, evt.getXOnScreen(), evt.getYOnScreen() - 3 * getFont().getSize()); - } - } - } - } - } - }); - - header.setReorderingAllowed(false); - - // Handles the resizing of columns. When mouse press is detected on - // table header, Stop updating the table, store new values of column - // widths,and resume updating. Updating is disabled as long as - // columnResizing is true - header.addMouseListener(new MouseAdapter() { - - @Override - public void mousePressed(MouseEvent e) { - columnResizing = true; - } - - @Override - public void mouseReleased(MouseEvent e) { - columnResizing = false; - TableColumnModel columnModel = - ((JTableHeader) e.getSource()).getColumnModel(); - for (int i = 0; i < columnModel.getColumnCount(); i++) { - columnWidths[i] = columnModel.getColumn(i).getWidth(); - } - } - }); - - ToolTipManager.sharedInstance().registerComponent(this); - } - - - @Override - public boolean isCellEditable(int rowIndex, int colIndex) { - return false; // Disallow the editing of any cell - } - - - /** - * Updates table contents with new data - * @param tableModel - TableModel - * @return boolean - If table data was updated - */ - synchronized public boolean updateTable(final TableModel tableModel) { - if (!isVisible()) return false; - - SwingWorker worker = new SwingWorker() { - - protected Object doInBackground() throws Exception { - return null; - } - - protected void done() { - try { - setModel(tableModel); - - // Set column widths to user defined widths - for (int i = 0; i < getColumnModel().getColumnCount(); i++) { - getColumnModel().getColumn(i).setPreferredWidth(columnWidths[i]); - } - getTableHeader().setReorderingAllowed(false); - validate(); - repaint(); - } catch (Exception e) { - System.out.println("Exception at XQErrorTable.updateTable " + e); - // e.printStackTrace(); - } - } - }; - - try { - if (!columnResizing) { - worker.execute(); - } - } catch (Exception e) { - System.out.println("ErrorTable updateTable Worker's slacking." - + e.getMessage()); - // e.printStackTrace(); - } - return true; - } - - - JFrame frmImportSuggest; - - private void showImportSuggestion(String[] list, int x, int y) { - if (frmImportSuggest != null) { -// frmImportSuggest.setVisible(false); -// frmImportSuggest = null; - return; - } - final JList classList = new JList(list); - classList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - frmImportSuggest = new JFrame(); - - frmImportSuggest.setUndecorated(true); - frmImportSuggest.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - JPanel panel = new JPanel(); - panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); - panel.setBackground(Color.WHITE); - frmImportSuggest.setBackground(Color.WHITE); - panel.add(classList); - JLabel label = new JLabel("

    (Click to insert)
    "); - label.setBackground(Color.WHITE); - label.setHorizontalTextPosition(SwingConstants.LEFT); - panel.add(label); - panel.validate(); - frmImportSuggest.getContentPane().add(panel); - frmImportSuggest.pack(); - - classList.addListSelectionListener(new ListSelectionListener() { - public void valueChanged(ListSelectionEvent e) { - if (classList.getSelectedValue() != null) { - try { - String t = classList.getSelectedValue().trim(); - Messages.log(t); - int x = t.indexOf('('); - String impString = "import " + t.substring(x + 1, t.indexOf(')')) + ";\n"; - int ct = editor.getSketch().getCurrentCodeIndex(); - editor.getSketch().setCurrentCode(0); - editor.getTextArea().getDocument().insertString(0, impString, null); - editor.getSketch().setCurrentCode(ct); - } catch (BadLocationException ble) { - Messages.log("Failed to insert import"); - ble.printStackTrace(); - } - } - frmImportSuggest.setVisible(false); - frmImportSuggest.dispose(); - frmImportSuggest = null; - } - }); - - frmImportSuggest.addWindowFocusListener(new WindowFocusListener() { - - @Override - public void windowLostFocus(WindowEvent e) { - if (frmImportSuggest != null) { - frmImportSuggest.dispose(); - frmImportSuggest = null; - } - } - - @Override - public void windowGainedFocus(WindowEvent e) { - - } - }); - - frmImportSuggest.setLocation(x, y); - frmImportSuggest.setBounds(x, y, 250, 100); - frmImportSuggest.pack(); - frmImportSuggest.setVisible(true); - } -} diff --git a/java/src/processing/mode/java/pdex/XQPreprocessor.java b/java/src/processing/mode/java/pdex/XQPreprocessor.java deleted file mode 100644 index 6908bac28b..0000000000 --- a/java/src/processing/mode/java/pdex/XQPreprocessor.java +++ /dev/null @@ -1,245 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* -Part of the Processing project - http://processing.org -Copyright (c) 2012-15 The Processing Foundation - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -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. -*/ - -package processing.mode.java.pdex; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTParser; -import org.eclipse.jdt.core.dom.ASTVisitor; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.MethodDeclaration; -import org.eclipse.jdt.core.dom.Modifier; -import org.eclipse.jdt.core.dom.NumberLiteral; -import org.eclipse.jdt.core.dom.SimpleType; -import org.eclipse.jdt.core.dom.rewrite.ASTRewrite; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.Document; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.TextEdit; - -import processing.mode.java.preproc.PdePreprocessor; - -/** - * My implementation of P5 preprocessor. Uses Eclipse JDT features instead of - * ANTLR. Performance gains mostly and full control over debug output. But needs - * lots and lots of testing. There will always an option to switch back to PDE - * preproc. - * - * @author Manindra Moharana <me@mkmoharana.com> - * - */ -public class XQPreprocessor { - - private ASTRewrite rewrite = null; - private ArrayList imports; - private ArrayList extraImports; - - private String[] coreImports, defaultImports; - - - public XQPreprocessor() { - PdePreprocessor p = new PdePreprocessor(null); - defaultImports = p.getDefaultImports(); - coreImports = p.getCoreImports(); - } - - - /** - * The main method that performs preprocessing. Converts code into compilable java. - * @param source - String - * @param programImports - List of import statements - * @return String - Compile ready java code - */ - public String doYourThing(String source, - ArrayList programImports) { - this.extraImports = programImports; - //source = prepareImports() + source; - Document doc = new Document(source); - - ASTParser parser = ASTParser.newParser(AST.JLS8); - parser.setSource(doc.get().toCharArray()); - parser.setKind(ASTParser.K_COMPILATION_UNIT); - - @SuppressWarnings("unchecked") - Map options = JavaCore.getOptions(); - - JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options); - options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8); - parser.setCompilerOptions(options); - CompilationUnit cu = (CompilationUnit) parser.createAST(null); - cu.recordModifications(); - rewrite = ASTRewrite.create(cu.getAST()); - cu.accept(new XQASTVisitor()); - - TextEdit edits = cu.rewrite(doc, null); - try { - edits.apply(doc); - } catch (MalformedTreeException e) { - e.printStackTrace(); - } catch (BadLocationException e) { - e.printStackTrace(); - } - // System.out.println("------------XQPreProc-----------------"); - // System.out.println(doc.get()); - // System.out.println("------------XQPreProc End-----------------"); - - // Calculate main class offset - // removed unused 'lines' tabulation [fry 140726] -// int position = doc.get().indexOf("{") + 1; -// int lines = 0; -// for (int i = 0; i < position; i++) { -// if (doc.get().charAt(i) == '\n') { -// lines++; -// } -// } -// lines += 2; - // System.out.println("Lines: " + lines); - - return doc.get(); - } - - - /** - * Returns all import statements as lines of code - * @return String - All import statements combined. Each import in a separate line. - */ - public String prepareImports() { - imports = new ArrayList(); - for (int i = 0; i < extraImports.size(); i++) { - imports.add(new String(extraImports.get(i).getImportName())); - } - imports.add(new String("// Default Imports")); - for (int i = 0; i < coreImports.length; i++) { - imports.add(new String("import " + coreImports[i] + ";")); - } - for (int i = 0; i < defaultImports.length; i++) { - imports.add(new String("import " + defaultImports[i] + ";")); - } - String totalImports = ""; - for (int i = 0; i < imports.size(); i++) { - totalImports += imports.get(i) + "\n"; - } - totalImports += "\n"; - return totalImports; - } - - - public String prepareImports(ArrayList programImports) { - this.extraImports = programImports; - return prepareImports(); - } - - - /** - * Visitor implementation that does all the substitution dirty work.
    - *
  • Any function not specified as being protected or private will be made - * 'public'. This means that void setup() becomes - * public void setup(). - * - *
  • Converts doubles into 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. Also, most functions of p5 core deal with floats only. - * - * @author Manindra Moharana - * - */ - private class XQASTVisitor extends ASTVisitor { - @SuppressWarnings({ "unchecked", "rawtypes" }) - public boolean visit(MethodDeclaration node) { - if (node.getReturnType2() != null) { - // if return type is color, make it int - // if (node.getReturnType2().toString().equals("color")) { - // System.err.println("color type detected!"); - // node.setReturnType2(rewrite.getAST().newPrimitiveType( - // PrimitiveType.INT)); - // } - - // The return type is not void, no need to make it public - // if (!node.getReturnType2().toString().equals("void")) - // return true; - } - - // Simple method, make it public - if (node.modifiers().size() == 0 && !node.isConstructor()) { - // rewrite.set(node, node.getModifiersProperty(), - // Modifier.PUBLIC, - // null); - // rewrite.getListRewrite(node, - // node.getModifiersProperty()).insertLast(Modifier., null) - List newMod = rewrite.getAST().newModifiers(Modifier.PUBLIC); - node.modifiers().add(newMod.get(0)); - } - - return true; - } - - - public boolean visit(NumberLiteral node) { - if (!node.getToken().endsWith("f") - && !node.getToken().endsWith("d")) { - for (int i = 0; i < node.getToken().length(); i++) { - if (node.getToken().charAt(i) == '.') { - - String s = node.getToken() + "f"; - node.setToken(s); - break; - } - } - } - return true; - } - - - // public boolean visit(FieldDeclaration node) { - // if (node.getType().toString().equals("color")){ - // System.err.println("color type detected!"); - // node.setType(rewrite.getAST().newPrimitiveType( - // PrimitiveType.INT)); - // } - // return true; - // } - // - // public boolean visit(VariableDeclarationStatement node) { - // if (node.getType().toString().equals("color")){ - // System.err.println("color type detected!"); - // node.setType(rewrite.getAST().newPrimitiveType( - // PrimitiveType.INT)); - // } - // return true; - // } - - /** - * This is added just for debugging purposes - to make sure that all - * instances of color type have been substituded as in by the regex - * search in ErrorCheckerService.preprocessCode(). - */ - public boolean visit(SimpleType node) { - if (node.toString().equals("color")) { - System.err.println("color type detected! \nThis shouldn't be happening! Please report this as an issue."); - } - return true; - } - } -} diff --git a/java/src/processing/mode/java/preproc/PdeEmitter.java b/java/src/processing/mode/java/preproc/PdeEmitter.java index c2b5a4ed15..1f1adca228 100644 --- a/java/src/processing/mode/java/preproc/PdeEmitter.java +++ b/java/src/processing/mode/java/preproc/PdeEmitter.java @@ -8,7 +8,6 @@ import java.util.Stack; import processing.app.Preferences; import processing.app.SketchException; -import processing.mode.java.preproc.PdeTokenTypes; import antlr.CommonASTWithHiddenTokens; import antlr.CommonHiddenStreamToken; import antlr.collections.AST; @@ -35,7 +34,7 @@ public class PdeEmitter implements PdeTokenTypes { private final PrintWriter out; private final PrintStream debug = System.err; - private final Stack stack = new Stack(); + private final Stack stack = new Stack<>(); private final static int ROOT_ID = 0; public PdeEmitter(final PdePreprocessor pdePreprocessor, final PrintWriter out) { diff --git a/java/src/processing/mode/java/preproc/PdePreprocessor.java b/java/src/processing/mode/java/preproc/PdePreprocessor.java index 7b3be09a95..c11b229667 100644 --- a/java/src/processing/mode/java/preproc/PdePreprocessor.java +++ b/java/src/processing/mode/java/preproc/PdePreprocessor.java @@ -4,7 +4,8 @@ PdePreprocessor - wrapper for default ANTLR-generated parser Part of the Processing project - http://processing.org - Copyright (c) 2004-15 Ben Fry and Casey Reas + Copyright (c) 2012-19 The Processing Foundation + Copyright (c) 2004-12 Ben Fry and Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology ANTLR-generated parser and several supporting classes written @@ -27,8 +28,10 @@ package processing.mode.java.preproc; +import java.awt.EventQueue; import java.io.*; import java.util.*; +import java.util.regex.MatchResult; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -37,9 +40,6 @@ import processing.app.SketchException; import processing.core.PApplet; import processing.data.StringList; -import processing.mode.java.preproc.PdeLexer; -import processing.mode.java.preproc.PdeRecognizer; -import processing.mode.java.preproc.PdeTokenTypes; import antlr.*; import antlr.collections.AST; @@ -143,7 +143,7 @@ public class PdePreprocessor { protected final String indent; private final String name; - public static enum Mode { + public enum Mode { STATIC, ACTIVE, JAVA } @@ -154,6 +154,7 @@ public static enum Mode { Set foundMethods; SurfaceInfo sizeInfo; + boolean settingsMethod; /** @@ -173,9 +174,11 @@ public static enum Mode { // static private final String VOID_REGEX = // "(?:^|\\s|;)void\\s"; /** Used to grab the start of setup() so we can mine it for size() */ - static private final String VOID_SETUP_REGEX = - "(?:^|\\s|;)void\\ssetup\\s*\\("; + static private final Pattern VOID_SETUP_REGEX = + Pattern.compile("(?:^|\\s|;)void\\s+setup\\s*\\(", Pattern.MULTILINE); + static private final Pattern VOID_SETTINGS_REGEX = + Pattern.compile("(?:^|\\s|;)void\\s+settings\\s*\\(", Pattern.MULTILINE); // Can't only match any 'public class', needs to be a PApplet // http://code.google.com/p/processing/issues/detail?id=551 @@ -183,12 +186,14 @@ public static enum Mode { Pattern.compile("(^|;)\\s*public\\s+class\\s+\\S+\\s+extends\\s+PApplet", Pattern.MULTILINE); - private static final Pattern FUNCTION_DECL = + static private final Pattern FUNCTION_DECL = Pattern.compile("(^|;)\\s*((public|private|protected|final|static)\\s+)*" + - "(void|int|float|double|String|char|byte)" + + "(void|int|float|double|String|char|byte|boolean)" + "(\\s*\\[\\s*\\])?\\s+[a-zA-Z0-9]+\\s*\\(", Pattern.MULTILINE); + static private final Pattern CLOSING_BRACE = Pattern.compile("\\}"); + public PdePreprocessor(final String sketchName) { this(sketchName, Preferences.getInteger("editor.tabs.size")); @@ -203,8 +208,9 @@ public PdePreprocessor(final String sketchName, final int tabSize) { } + /** Parse the sketch size and set the internal sizeInfo variable */ public SurfaceInfo initSketchSize(String code, - boolean sizeWarning) throws SketchException { + boolean sizeWarning) throws SketchException { sizeInfo = parseSketchSize(code, sizeWarning); return sizeInfo; } @@ -250,6 +256,13 @@ static private StringList breakCommas(String contents) { } + // if there's a settings() method, we do less moving things around + static public boolean hasSettingsMethod(String code) { + final String uncommented = scrubComments(code); + return findInCurrentScope(VOID_SETTINGS_REGEX, uncommented) != null; + } + + /** * Parse a chunk of code and extract the size() command and its contents. * Also goes after fullScreen(), smooth(), and noSmooth(). @@ -258,67 +271,58 @@ static private StringList breakCommas(String contents) { * @return null if there was an error, otherwise an array (might contain some/all nulls) */ static public SurfaceInfo parseSketchSize(String code, - boolean fussy) throws SketchException { + boolean fussy) throws SketchException { // 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 scrubbed = scrubComments(sketch.getCode(0).getProgram()); -// String[] matches = PApplet.match(scrubbed, SIZE_REGEX); -// String[] matches = PApplet.match(scrubComments(code), SIZE_REGEX); - - /* - 1. no size() or fullScreen() method at all - will use the non-overridden settings() method in PApplet - 2. size() or fullScreen() found inside setup() (static mode sketch or otherwise) - make sure that it uses numbers (or displayWidth/Height), copy into settings - 3. size() or fullScreen() already in settings() - don't mess with the sketch, don't insert any defaults + // 1. no size() or fullScreen() method at all + // will use the non-overridden settings() method in PApplet + // 2. size() or fullScreen() found inside setup() (static mode sketch or otherwise) + // make sure that it uses numbers (or displayWidth/Height), copy into settings + // 3. size() or fullScreen() already in settings() + // don't mess with the sketch, don't insert any defaults + // + // really only need to deal with situation #2.. nothing to be done for 1 and 3 - really only need to deal with situation #2.. nothing to be done for 1 and 3 - */ // if static mode sketch, all we need is regex // easy proxy for static in this case is whether [^\s]void\s is present - String searchArea = scrubComments(code); - String[] setupMatch = PApplet.match(searchArea, VOID_SETUP_REGEX); - if (setupMatch != null) { - String found = setupMatch[0]; - int start = searchArea.indexOf(found) + found.length(); - int openBrace = searchArea.indexOf("{", start); - char[] c = searchArea.toCharArray(); - int depth = 0; - int closeBrace = -1; - StringBuilder sb = new StringBuilder(); - for (int i = openBrace; i < c.length; i++) { - if (c[i] == '{') { - depth++; - } else if (c[i] == '\'') { - String quoted = readSingleQuote(c, i); - sb.append(quoted); - i += quoted.length() - 1; - - } else if (c[i] == '\"') { - String quoted = readDoubleQuote(c, i); - sb.append(quoted); - i += quoted.length() - 1; - - } else if (c[i] == '}') { - depth--; - if (depth == 0) { - closeBrace = ++i; - break; + String uncommented = scrubComments(code); + + Mode mode = parseMode(uncommented); + + String searchArea = null; + + if (mode == Mode.JAVA) { + // it's up to the user + searchArea = null; + + } else if (mode == Mode.ACTIVE) { + // active mode, limit scope to setup + + // Find setup() in global scope + MatchResult setupMatch = findInCurrentScope(VOID_SETUP_REGEX, uncommented); + if (setupMatch != null) { + int start = uncommented.indexOf("{", setupMatch.end()); + if (start >= 0) { + // Find a closing brace + MatchResult match = findInCurrentScope(CLOSING_BRACE, uncommented, start); + if (match != null) { + searchArea = uncommented.substring(start + 1, match.end() - 1); + } else { + throw new SketchException("Found a { that's missing a matching }", false); } - } else { - sb.append(c[i]); } } - if (closeBrace == -1) { - throw new SketchException("Found a { that's missing a matching }", false); -// return null; - } - searchArea = sb.toString(); + } else if (mode == Mode.STATIC) { + // static mode, look everywhere + searchArea = uncommented; + } + + if (searchArea == null) { + return new SurfaceInfo(); } StringList extraStatements = new StringList(); @@ -381,7 +385,9 @@ make sure that it uses numbers (or displayWidth/Height), copy into settings "The size of this sketch could not be determined from your code.\n" + "Use only numbers (not variables) for the size() command.\n" + "Read the size() reference for more details."; - Messages.showWarning("Could not find sketch size", message, null); + EventQueue.invokeLater(() -> { + Messages.showWarning("Could not find sketch size", message, null); + }); // new Exception().printStackTrace(System.out); // return null; throw new SketchException("Please fix the size() line to continue.", false); @@ -418,9 +424,6 @@ make sure that it uses numbers (or displayWidth/Height), copy into settings } info.width = "displayWidth"; info.height = "displayHeight"; -// if (extraStatements.size() != 0) { -// info.statement += extraStatements.join(" "); -// } info.addStatements(extraStatements); info.checkEmpty(); return info; @@ -430,71 +433,201 @@ make sure that it uses numbers (or displayWidth/Height), copy into settings // need to pull out the noSmooth() and smooth(N) methods. if (extraStatements.size() != 0) { SurfaceInfo info = new SurfaceInfo(); -// info.statement = extraStatements.join(" "); info.addStatements(extraStatements); return info; } // not an error, just no size() specified - //return new String[] { null, null, null, null, null }; return new SurfaceInfo(); } - static String readSingleQuote(char[] c, int i) { - StringBuilder sb = new StringBuilder(); - try { - sb.append(c[i++]); // add the quote - if (c[i] == '\\') { - sb.append(c[i++]); // add the escape - if (c[i] == 'u') { - // grabs uNNN and the fourth N will be added below - for (int j = 0; j < 4; j++) { - sb.append(c[i++]); - } + /** + * Parses the code and determines the mode of the sketch. + * @param code code without comments + * @return determined mode + */ + static public Mode parseMode(CharSequence code) { + // See if we can find any function in the global scope + if (findInCurrentScope(FUNCTION_DECL, code) != null) { + return Mode.ACTIVE; + } + + // See if we can find any public class extending PApplet + if (findInCurrentScope(PUBLIC_CLASS, code) != null) { + return Mode.JAVA; + } + + return Mode.STATIC; + } + + + /** + * Calls {@link #findInScope(Pattern, String, int, int, int, int) findInScope} + * on the whole string with min and max target scopes set to zero. + */ + static protected MatchResult findInCurrentScope(Pattern pattern, CharSequence code) { + return findInScope(pattern, code, 0, code.length(), 0, 0); + } + + + /** + * Calls {@link #findInScope(Pattern, String, int, int, int, int) findInScope} + * starting at start char with min and max target scopes set to zero. + */ + static protected MatchResult findInCurrentScope(Pattern pattern, CharSequence code, + int start) { + return findInScope(pattern, code, start, code.length(), 0, 0); + } + + + /** + * Looks for the pattern at a specified target scope depth relative + * to the scope depth of the starting position. + * + * Example: Calling this with starting position inside a method body + * and target depth 0 would search only in the method body, while + * using target depth -1 would look only in the body of the enclosing class + * (but not in any methods of the class or outside of the class). + * + * By using a scope range, you can e.g. search in the whole class including + * bodies of methods and inner classes. + * + * @param pattern matching is realized by find() method of this pattern + * @param code Java code without comments + * @param start starting position in the code String (inclusive) + * @param stop ending position in the code Sting (exclusive) + * @param minTargetScopeDepth desired min scope depth of the match relative to the + * scope of the starting position + * @param maxTargetScopeDepth desired max scope depth of the match relative to the + * scope of the starting position + * @return first match at a desired relative scope depth, + * null if there isn't one + */ + static protected MatchResult findInScope(Pattern pattern, CharSequence code, + int start, int stop, + int minTargetScopeDepth, + int maxTargetScopeDepth) { + if (minTargetScopeDepth > maxTargetScopeDepth) { + int temp = minTargetScopeDepth; + minTargetScopeDepth = maxTargetScopeDepth; + maxTargetScopeDepth = temp; + } + + Matcher m = pattern.matcher(code); + m.region(start, stop); + int depth = 0; + int position = start; + + // We should not escape the enclosing scope. It can be either the original + // scope, or the min target scope, whichever is more out there (lower depth) + int minScopeDepth = PApplet.min(depth, minTargetScopeDepth); + + while (m.find()) { + int newPosition = m.end(); + int depthDiff = scopeDepthDiff(code, position, newPosition); + // Process this match only if it is not in string or char literal + if (depthDiff != Integer.MAX_VALUE) { + depth += depthDiff; + if (depth < minScopeDepth) break; // out of scope! + if (depth >= minTargetScopeDepth && + depth <= maxTargetScopeDepth) { + return m.toMatchResult(); // jackpot } + position = newPosition; } - sb.append(c[i++]); // get the char, escapee, or last unicode digit - sb.append(c[i++]); // get the closing quote - - } catch (ArrayIndexOutOfBoundsException ignored) { - // this means they have bigger problems with their code } - return sb.toString(); + return null; } - static String readDoubleQuote(char[] c, int i) { - StringBuilder sb = new StringBuilder(); - try { - sb.append(c[i++]); // add the quote - while (i < c.length) { - if (c[i] == '\\') { - sb.append(c[i++]); // add the escape - sb.append(c[i++]); // add whatever was escaped - } else if (c[i] == '\"') { - sb.append(c[i++]); - break; - } else { - sb.append(c[i++]); + /** + * Walks the specified region (not including stop) and determines difference + * in scope depth. Adds one to depth on opening curly brace, subtracts one + * from depth on closing curly brace. Ignores string and char literals. + * + * @param code code without comments + * @param start start of the region, must not be in string literal, + * char literal or second char of escaped sequence + * @param stop end of the region (exclusive) + * + * @return scope depth difference between start and stop, + * Integer.MAX_VALUE if end is in string literal, + * char literal or second char of escaped sequence + */ + static protected int scopeDepthDiff(CharSequence code, int start, int stop) { + boolean insideString = false; + boolean insideChar = false; + boolean escapedChar = false; + int depth = 0; + for (int i = start; i < stop; i++) { + if (!escapedChar) { + char ch = code.charAt(i); + switch (ch) { + case '\\': + escapedChar = true; + break; + case '{': + if (!insideChar && !insideString) depth++; + break; + case '}': + if (!insideChar && !insideString) depth--; + break; + case '\"': + if (!insideChar) insideString = !insideString; + break; + case '\'': + if (!insideString) insideChar = !insideChar; + break; } + } else { + escapedChar = false; } - } catch (ArrayIndexOutOfBoundsException ignored) { - // this means they have bigger problems with their code } - return sb.toString(); + if (insideChar || insideString || escapedChar) { + return Integer.MAX_VALUE; // signal invalid location + } + return depth; } + /** + * Looks for the specified method in the base scope of the search area. + */ static protected String[] matchMethod(String methodName, String searchArea) { final String left = "(?:^|\\s|;)"; // doesn't match empty pairs of parens - //final String right = "\\s*\\(([^\\)]+)\\)\\s*\\;"; - final String right = "\\s*\\(([^\\)]*)\\)\\s*\\;"; - return PApplet.match(searchArea, left + methodName + right); + //final String right = "\\s*\\(([^\\)]+)\\)\\s*;"; + final String right = "\\s*\\(([^\\)]*)\\)\\s*;"; + String regexp = left + methodName + right; + Pattern p = matchPatterns.get(regexp); + if (p == null) { + p = Pattern.compile(regexp, Pattern.MULTILINE | Pattern.DOTALL); + matchPatterns.put(regexp, p); + } + MatchResult match = findInCurrentScope(p, searchArea); + if (match != null) { + int count = match.groupCount() + 1; + String[] groups = new String[count]; + for (int i = 0; i < count; i++) { + groups[i] = match.group(i); + } + return groups; + } + return null; } + static protected LinkedHashMap matchPatterns = + new LinkedHashMap(16, 0.75f, true) { + @Override + protected boolean removeEldestEntry(Map.Entry eldest) { + // Limit the number of match patterns at 10 most recently used + return size() == 10; + } + }; + + static protected String[] matchDensityMess(String searchArea) { final String regexp = "(?:^|\\s|;)pixelDensity\\s*\\(\\s*displayDensity\\s*\\([^\\)]*\\)\\s*\\)\\s*\\;"; @@ -551,10 +684,16 @@ static public String scrubComments(String what) { throw new RuntimeException("Missing the */ from the end of a " + "/* comment */"); } - } else if (p[index] == '"' && index > 0 && p[index-1] != '\\') { + + // switch in/out of quoted region + } else if (p[index] == '"') { insideQuote = !insideQuote; index++; + // skip the escaped char + } else if (insideQuote && p[index] == '\\') { + index += 2; + } else { // any old character, move along index++; } @@ -573,23 +712,12 @@ public boolean hasMethod(String methodName) { } -// public void setFoundMain(boolean foundMain) { -// this.foundMain = foundMain; -// } - - -// public boolean getFoundMain() { -// return foundMain; -// } - - public void setAdvClassName(final String advClassName) { this.advClassName = advClassName; } public void setMode(final Mode mode) { - //System.err.println("Setting mode to " + mode); this.mode = mode; } @@ -632,7 +760,7 @@ private static void checkForUnterminatedMultilineComment(final String program) boolean terminated = false; while (i < length - 1) { if ((program.charAt(i) == '*') && (program.charAt(i + 1) == '/')) { - i += 2; + i++; // advance to the ending '/' terminated = true; break; } else { @@ -709,7 +837,7 @@ private static void checkForUnterminatedMultilineComment(final String program) } - public PreprocessorResult write(final Writer out, String program) + public PreprocessorResult write(final Writer out, final String program) throws SketchException, RecognitionException, TokenStreamException { return write(out, program, null); } @@ -722,15 +850,15 @@ public PreprocessorResult write(Writer out, String program, // 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. - final ArrayList programImports = new ArrayList(); + final ArrayList programImports = new ArrayList<>(); // imports just from the code folder, treated differently // than the others, since the imports are auto-generated. - final ArrayList codeFolderImports = new ArrayList(); + final ArrayList codeFolderImports = new ArrayList<>(); // need to reset whether or not this has a main() // foundMain = false; - foundMethods = new HashSet(); + foundMethods = new HashSet<>(); // http://processing.org/bugs/bugzilla/5.html if (!program.endsWith("\n")) { @@ -739,10 +867,6 @@ public PreprocessorResult write(Writer out, String program, checkForUnterminatedMultilineComment(program); - if (Preferences.getBoolean("preproc.substitute_unicode")) { - program = substituteUnicode(program); - } - // For 0215, adding } as a legitimate prefix to the import (along with // newline and semicolon) for cases where a tab ends with } and an import // statement starts the next tab. @@ -757,10 +881,8 @@ public PreprocessorResult write(Writer out, String program, m = importPattern.matcher(scrubbed); found = m.find(offset); if (found) { -// System.out.println("found " + m.groupCount() + " groups"); String before = m.group(1); String piece = m.group(2) + m.group(3) + m.group(4); -// int len = piece.length(); // how much to trim out if (!ignoreImport(m.group(3))) { programImports.add(m.group(3)); // the package name @@ -769,9 +891,6 @@ public PreprocessorResult write(Writer out, String program, // find index of this import in the program int start = m.start() + before.length(); int stop = start + piece.length(); -// System.out.println(start + " " + stop + " " + piece); - //System.out.println("found " + m.group(3)); -// System.out.println("removing '" + program.substring(start, stop) + "'"); // Remove the import from the main program program = program.substring(0, start) + program.substring(stop); @@ -781,8 +900,6 @@ public PreprocessorResult write(Writer out, String program, offset = m.start(); } } while (found); -// System.out.println("program now:"); -// System.out.println(program); if (codeFolderPackages != null) { for (String item : codeFolderPackages) { @@ -798,44 +915,6 @@ public PreprocessorResult write(Writer out, String program, } - static String substituteUnicode(String program) { - // 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 (unicodeCount == 0) - return program; - // if non-ascii chars are in there, convert to unicode escapes - // 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; - } - } - return new String(p2, 0, index); - } - - /** * preprocesses a pde file and writes out a java file * @return the class name of the exported Java @@ -847,7 +926,9 @@ private String write(final String program, final PrintWriter stream) // http://code.google.com/p/processing/issues/detail?id=1404 String uncomment = scrubComments(program); PdeRecognizer parser = createParser(program); - if (PUBLIC_CLASS.matcher(uncomment).find()) { + Mode mode = parseMode(uncomment); + + if (mode == Mode.JAVA) { try { final PrintStream saved = System.err; try { @@ -863,15 +944,15 @@ private String write(final String program, final PrintWriter stream) parser = createParser(program); parser.pdeProgram(); } - } else if (FUNCTION_DECL.matcher(uncomment).find()) { + } else if (mode == Mode.ACTIVE) { setMode(Mode.ACTIVE); parser.activeProgram(); - } else { + + } else if (mode == Mode.STATIC) { 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"); @@ -880,7 +961,6 @@ private String write(final String program, final PrintWriter stream) makeSimpleMethodsPublic(rootNode); // 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) @@ -888,7 +968,7 @@ private String write(final String program, final PrintWriter stream) final String className; if (mode == Mode.JAVA) { - // if this is an advanced program, the classname is already defined. + // in this mode, the class name is already defined. className = getFirstClassName(parserAST); } else { className = this.name; @@ -896,7 +976,6 @@ private String write(final String program, final PrintWriter stream) // if 'null' was passed in for the name, but this isn't // a 'java' mode class, then there's a problem, so punt. - // if (className == null) return null; @@ -1098,41 +1177,14 @@ protected void writeFooter(PrintWriter out, String className) { } if ((mode == Mode.STATIC) || (mode == Mode.ACTIVE)) { - // doesn't remove the original size() method, but calling size() - // again in setup() is harmless. + // doesn't remove the original size() method, + // but calling size() again in setup() is harmless. if (!hasMethod("settings") && sizeInfo.hasSettings()) { out.println(indent + "public void settings() { " + sizeInfo.getSettings() + " }"); -// out.println(indent + "public void settings() {"); -// out.println(indent + indent + sizeStatement); -// out.println(indent + "}"); - } - /* - if (sketchWidth != null && !hasMethod("sketchWidth")) { - // Only include if it's a number (a variable will be a problem) - if (PApplet.parseInt(sketchWidth, -1) != -1 || sketchWidth.equals("displayWidth")) { - out.println(indent + "public int sketchWidth() { return " + sketchWidth + "; }"); - } - } - if (sketchHeight != null && !hasMethod("sketchHeight")) { - // Only include if it's a number - if (PApplet.parseInt(sketchHeight, -1) != -1 || sketchHeight.equals("displayHeight")) { - out.println(indent + "public int sketchHeight() { return " + sketchHeight + "; }"); - } - } - if (sketchRenderer != null && !hasMethod("sketchRenderer")) { - // Only include if it's a known renderer (otherwise it might be a variable) - //if (PConstants.rendererList.hasValue(sketchRenderer)) { - out.println(indent + "public String sketchRenderer() { return " + sketchRenderer + "; }"); - //} - } - if (sketchOutputPath != null && !hasMethod("sketchOutputPath")) { - out.println(indent + "public String sketchOutputPath() { return " + sketchOutputPath + "; }"); } - */ if (!hasMethod("main")) { out.println(indent + "static public void main(String[] passedArgs) {"); - //out.print(indent + indent + "PApplet.main(new String[] { "); out.print(indent + indent + "String[] appletArgs = new String[] { "); if (Preferences.getBoolean("export.application.present")) { @@ -1147,11 +1199,6 @@ protected void writeFooter(PrintWriter out, String className) { } else { out.print("\"" + PApplet.ARGS_HIDE_STOP + "\", "); } -// } else { -// // This is set initially based on the system control color, just -// // sets the color for what goes behind the sketch before it's added. -// String farbe = Preferences.get("run.window.bgcolor"); -// out.print("\"" + PApplet.ARGS_BGCOLOR + "=" + farbe + "\", "); } out.println("\"" + className + "\" };"); @@ -1288,4 +1335,4 @@ private String debugHiddenTokens(antlr.CommonHiddenStreamToken t) { } return sb.toString(); } -} \ No newline at end of file +} diff --git a/java/src/processing/mode/java/preproc/SurfaceInfo.java b/java/src/processing/mode/java/preproc/SurfaceInfo.java index 6e5f57f0b8..04834de8b2 100644 --- a/java/src/processing/mode/java/preproc/SurfaceInfo.java +++ b/java/src/processing/mode/java/preproc/SurfaceInfo.java @@ -138,4 +138,15 @@ public boolean hasSettings() { public String getSettings() { return statements.join(" "); } + + + // Added for Android Mode to check whether OpenGL is in use + // https://github.com/processing/processing/issues/4441 + /** + * Return the renderer specified (null if none specified). + * @since 3.2.2 + */ + public String getRenderer() { + return renderer; + } } diff --git a/java/src/processing/mode/java/preproc/TokenUtil.java b/java/src/processing/mode/java/preproc/TokenUtil.java index e6c4721eab..71e418dd9c 100644 --- a/java/src/processing/mode/java/preproc/TokenUtil.java +++ b/java/src/processing/mode/java/preproc/TokenUtil.java @@ -2,10 +2,9 @@ import java.lang.reflect.Field; import antlr.collections.AST; -import processing.mode.java.preproc.PdeTokenTypes; /** - * + * * @author Jonathan Feinberg <jdf@pobox.com> * */ diff --git a/java/src/processing/mode/java/runner/Runner.java b/java/src/processing/mode/java/runner/Runner.java index 6af2aad308..5d2bbe9fef 100644 --- a/java/src/processing/mode/java/runner/Runner.java +++ b/java/src/processing/mode/java/runner/Runner.java @@ -24,15 +24,19 @@ import processing.app.*; import processing.app.exec.StreamRedirectThread; -import processing.app.ui.Editor; +import processing.app.ui.Toolkit; import processing.core.*; import processing.data.StringList; import processing.mode.java.JavaBuild; +import processing.mode.java.JavaEditor; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Point; import java.io.*; +import java.net.ConnectException; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.util.*; import com.sun.jdi.*; @@ -58,7 +62,7 @@ public class Runner implements MessageConsumer { protected RunnerListener listener; // Running remote VM - protected VirtualMachine vm; + protected volatile VirtualMachine vm; protected boolean vmReturnedError; // Thread transferring remote error stream to our error stream @@ -68,21 +72,26 @@ public class Runner implements MessageConsumer { protected Thread outThread = null; protected SketchException exception; - protected Editor editor; + protected JavaEditor editor; protected JavaBuild build; protected Process process; protected PrintStream sketchErr; protected PrintStream sketchOut; + protected volatile boolean cancelled; + protected final Object cancelLock = new Object[0]; + public Runner(JavaBuild build, RunnerListener listener) throws SketchException { this.listener = listener; // this.sketch = sketch; this.build = build; - if (listener instanceof Editor) { - this.editor = (Editor) listener; + checkLocalHost(); + + if (listener instanceof JavaEditor) { + this.editor = (JavaEditor) listener; sketchErr = editor.getConsole().getErr(); sketchOut = editor.getConsole().getOut(); } else { @@ -115,6 +124,29 @@ public Runner(JavaBuild build, RunnerListener listener) throws SketchException { } + /** + * Has the user screwed up their hosts file? + * https://github.com/processing/processing/issues/4738 + */ + static private void checkLocalHost() throws SketchException { + try { + InetAddress address = InetAddress.getByName("localhost"); + if (!address.getHostAddress().equals("127.0.0.1")) { + System.err.println("Your computer is not properly mapping 'localhost' to '127.0.0.1',"); + System.err.println("which prevents sketches from working properly because 'localhost'"); + System.err.println("is needed to connect the PDE to your sketch while it's running."); + System.err.println("If you don't recall making this change, or know how to fix it:"); + System.err.println("https://www.google.com/search?q=add+localhost+to+hosts+file+" + Platform.getName()); + throw new SketchException("Cannot run due to changes in your 'hosts' file. " + + "See the console for details.", false); + } + + } catch (UnknownHostException e) { + e.printStackTrace(); + } + } + + public VirtualMachine launch(String[] args) { if (launchVirtualMachine(false, args)) { generateTrace(); @@ -179,11 +211,9 @@ public boolean launchVirtualMachine(boolean present, String[] args) { int port = 8000 + (int) (Math.random() * 1000); String portStr = String.valueOf(port); - // Older (Java 1.5 and earlier) version, go figure -// String jdwpArg = "-Xrunjdwp:transport=dt_socket,address=" + portStr + ",server=y,suspend=y"; -// String debugArg = "-Xdebug"; - // Newer (Java 1.5+) version that uses JVMTI - String jdwpArg = "-agentlib:jdwp=transport=dt_socket,address=" + portStr + ",server=y,suspend=y"; + // Added 'quiet=y' for 3.0.2 to prevent command line parsing problems + // https://github.com/processing/processing/issues/4098 + String jdwpArg = "-agentlib:jdwp=transport=dt_socket,address=" + portStr + ",server=y,suspend=y,quiet=y"; // Everyone works the same under Java 7 (also on OS X) StringList commandArgs = new StringList(); @@ -192,6 +222,13 @@ public boolean launchVirtualMachine(boolean present, String[] args) { commandArgs.append(vmParams); commandArgs.append(sketchParams); + + // Opportunistically quit if the launch was cancelled, + // the next chance to cancel will be after connecting to the VM + if (cancelled) { + return false; + } + launchJava(commandArgs.array()); AttachingConnector connector = (AttachingConnector) @@ -222,21 +259,37 @@ public boolean launchVirtualMachine(boolean present, String[] args) { // while (!available) { while (true) { try { - vm = connector.attach(arguments); + Messages.log(getClass().getName() + " attempting to attach to VM"); + synchronized (cancelLock) { + vm = connector.attach(arguments); + if (cancelled && vm != null) { + // cancelled and connected to the VM, handle closing now + Messages.log(getClass().getName() + " aborting, launch cancelled"); + close(); + return false; + } + } // vm = connector.attach(arguments); if (vm != null) { + Messages.log(getClass().getName() + " attached to the VM"); // generateTrace(); // available = true; return true; } - } catch (IOException e) { + } catch (ConnectException ce) { + // This will fire ConnectException (socket not available) until + // the VM finishes starting up and opens its socket for us. + Messages.log(getClass().getName() + " socket for VM not ready"); // System.out.println("waiting"); // e.printStackTrace(); try { Thread.sleep(100); - } catch (InterruptedException e1) { - e1.printStackTrace(sketchErr); + } catch (InterruptedException ie) { + Messages.loge(getClass().getName() + " interrupted", ie); +// ie.printStackTrace(sketchErr); } + } catch (IOException e) { + Messages.loge(getClass().getName() + " while attaching to VM", e); } } // } catch (IOException exc) { @@ -268,17 +321,32 @@ protected StringList getMachineParams() { } } -// params.add("-Djava.ext.dirs=nuffing"); - if (Preferences.getBoolean("run.options.memory")) { params.append("-Xms" + Preferences.get("run.options.memory.initial") + "m"); params.append("-Xmx" + Preferences.get("run.options.memory.maximum") + "m"); } + // Surprised this wasn't here before; added for 3.2.1 + params.append("-Djna.nosys=true"); + + // Added for 3.2.1, was still using the default ext.dirs in the PDE + try { + String extPath = + new File(Platform.getJavaHome(), "lib/ext").getCanonicalPath(); + // quoting this on OS X causes it to fail + //params.append("-Djava.ext.dirs=\"" + extPath + "\""); + params.append("-Djava.ext.dirs=" + extPath); + } catch (IOException e) { + e.printStackTrace(); + } + if (Platform.isMacOS()) { + // This successfully sets the application menu name, + // but somehow, not the dock name itself. params.append("-Xdock:name=" + build.getSketchClassName()); -// params.add("-Dcom.apple.mrj.application.apple.menu.about.name=" + -// sketch.getMainClassName()); + // No longer needed / doesn't seem to do anything differently + //params.append("-Dcom.apple.mrj.application.apple.menu.about.name=" + + // build.getSketchClassName()); } // sketch.libraryPath might be "" // librariesClassPath will always have sep char prepended @@ -311,7 +379,9 @@ protected StringList getSketchParams(boolean present, String[] args) { } else { params.append("processing.core.PApplet"); - // get the stored device index (starts at 1) + // Get the stored device index (starts at 1) + // By default, set to -1, meaning 'the default display', + // which is the same display as the one being used by the Editor. int runDisplay = Preferences.getInteger("run.display"); // If there was a saved location (this guy has been run more than once) @@ -331,20 +401,23 @@ protected StringList getSketchParams(boolean present, String[] args) { // Make sure the display set in Preferences actually exists GraphicsDevice runDevice = editorDevice; if (runDisplay > 0 && runDisplay <= devices.length) { - runDevice = devices[runDisplay-1]; + runDevice = devices[runDisplay-1]; } else { - // If a bad display is selected, use the same display as the editor + // If a bad display (or -1 display) is selected, use the same display as the editor if (runDisplay > 0) { // don't complain about -1 or 0 System.err.println("Display " + runDisplay + " not available."); } runDevice = editorDevice; for (int i = 0; i < devices.length; i++) { if (devices[i] == runDevice) { + // Prevent message on the first run + if (runDisplay != -1) { + System.err.println("Setting 'Run Sketches on Display' preference to display " + (i+1)); + } + runDisplay = i + 1; // Wasn't setting the pref to avoid screwing things up with // something temporary. But not setting it makes debugging one's // setup just too damn weird, so changing that behavior. - runDisplay = i + 1; - System.err.println("Setting 'Run Sketches on Display' preference to display " + runDisplay); Preferences.setInteger("run.display", runDisplay); break; } @@ -402,6 +475,10 @@ protected StringList getSketchParams(boolean present, String[] args) { // removed for 3.0a6 because it would break the args passed to sketches. params.append(PApplet.ARGS_SKETCH_FOLDER + "=" + build.getSketchPath()); + if (Toolkit.zoom(100) >= 200) { // Use 100 to bypass possible rounding in zoom() + params.append(PApplet.ARGS_DENSITY + "=2"); + } + params.append(build.getSketchClassName()); } // Add command-line arguments to be given to the sketch itself @@ -477,29 +554,28 @@ protected void generateTrace() { //vm.setDebugTraceMode(debugTraceMode); // vm.setDebugTraceMode(VirtualMachine.TRACE_ALL); // vm.setDebugTraceMode(VirtualMachine.TRACE_NONE); // formerly, seems to have no effect - - // Calling this seems to set something internally to make the - // Eclipse JDI wake up. Without it, an ObjectCollectedException - // is thrown on excReq.enable(). No idea why this works, - // but at least exception handling has returned. (Suspect that it may - // block until all or at least some threads are available, meaning - // that the app has launched and we have legit objects to talk to). - vm.allThreads(); - // The bug may not have been noticed because the test suite waits for - // a thread to be available, and queries it by calling allThreads(). - // See org.eclipse.debug.jdi.tests.AbstractJDITest for the example. - - EventRequestManager mgr = vm.eventRequestManager(); - // get only the uncaught exceptions - ExceptionRequest excReq = mgr.createExceptionRequest(null, false, true); -// System.out.println(excReq); - // this version reports all exceptions, caught or uncaught -// ExceptionRequest excReq = mgr.createExceptionRequest(null, true, true); - // suspend so we can step - excReq.setSuspendPolicy(EventRequest.SUSPEND_ALL); -// excReq.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); -// excReq.setSuspendPolicy(EventRequest.SUSPEND_NONE); // another option? - excReq.enable(); + try { + // Calling this seems to set something internally to make the + // Eclipse JDI wake up. Without it, an ObjectCollectedException + // is thrown on excReq.enable(). No idea why this works, + // but at least exception handling has returned. (Suspect that it may + // block until all or at least some threads are available, meaning + // that the app has launched and we have legit objects to talk to). + vm.allThreads(); + // The bug may not have been noticed because the test suite waits for + // a thread to be available, and queries it by calling allThreads(). + // See org.eclipse.debug.jdi.tests.AbstractJDITest for the example. + + EventRequestManager mgr = vm.eventRequestManager(); + // get only the uncaught exceptions + ExceptionRequest excReq = mgr.createExceptionRequest(null, false, true); + // this version reports all exceptions, caught or uncaught + // suspend so we can step + excReq.setSuspendPolicy(EventRequest.SUSPEND_ALL); + excReq.enable(); + } catch (VMDisconnectedException ignore) { + return; + } Thread eventThread = new Thread() { public void run() { @@ -564,7 +640,9 @@ public void run() { // or the user manually closes the sketch window. // TODO this should be handled better, should it not? if (editor != null) { - editor.deactivateRun(); + java.awt.EventQueue.invokeLater(() -> { + editor.onRunnerExiting(Runner.this); + }); } } catch (InterruptedException exc) { // we don't interrupt @@ -633,7 +711,9 @@ public void exceptionEvent(ExceptionEvent event) { handleCommonErrors(exceptionName, message, listener, sketchErr); if (editor != null) { - editor.deactivateRun(); + java.awt.EventQueue.invokeLater(() -> { + editor.onRunnerExiting(Runner.this); + }); } } @@ -686,9 +766,9 @@ public static boolean handleCommonErrors(final String exceptionClass, } else if (exceptionClass.equals("java.lang.UnsupportedClassVersionError")) { listener.statusError("UnsupportedClassVersionError: A library is using code compiled with an unsupported version of Java."); - err.println("This version of Processing only supports libraries and JAR files compiled for Java 1.6 or earlier."); - err.println("A library used by this sketch was compiled for Java 1.7 or later, "); - err.println("and needs to be recompiled to be compatible with Java 1.6."); + err.println("This version of Processing only supports libraries and JAR files compiled for Java 1.8 or earlier."); + err.println("A library used by this sketch was compiled for Java 1.9 or later, "); + err.println("and needs to be recompiled to be compatible with Java 1.8."); } else if (exceptionClass.equals("java.lang.NoSuchMethodError") || exceptionClass.equals("java.lang.NoSuchFieldError")) { @@ -749,6 +829,12 @@ protected SketchException findException(String message, ObjectReference or, Thre // This shouldn't happen, but if it does, print the exception in case // it's something that needs to be debugged separately. e.printStackTrace(sketchErr); + } catch (Exception e) { + // stack overflows seem to trip in frame.location() above + // ignore this case so that the actual error gets reported to the user + if ("StackOverflowError".equals(message) == false) { + e.printStackTrace(sketchErr); + } } // before giving up, try to extract from the throwable object itself // since sometimes exceptions are re-thrown from a different context @@ -780,7 +866,11 @@ protected SketchException findException(String message, ObjectReference or, Thre or.invokeMethod(thread, method, new ArrayList(), ObjectReference.INVOKE_SINGLE_THREADED); } catch (Exception e) { - e.printStackTrace(sketchErr); + // stack overflows will make the exception handling above trip again + // ignore this case so that the actual error gets reported to the user + if ("StackOverflowError".equals(message) == false) { + e.printStackTrace(sketchErr); + } } // Give up, nothing found inside the pile of stack frames SketchException rex = new SketchException(message); @@ -791,19 +881,22 @@ protected SketchException findException(String message, ObjectReference or, Thre public void close() { - // TODO make sure stop() has already been called to exit the sketch + synchronized (cancelLock) { + cancelled = true; - // TODO actually kill off the vm here - if (vm != null) { - try { - vm.exit(0); + // TODO make sure stop() has already been called to exit the sketch - } 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 + // 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; } } @@ -824,7 +917,9 @@ synchronized public void message(String s) { if (editor != null) { // editor.internalCloseRunner(); // [091124] // editor.handleStop(); // prior to 0192 - editor.internalCloseRunner(); // 0192 + java.awt.EventQueue.invokeLater(() -> { + editor.internalCloseRunner(); // 0192 + }); } return; } diff --git a/java/src/processing/mode/java/tweak/SketchParser.java b/java/src/processing/mode/java/tweak/SketchParser.java index a68b924254..d2a85e0504 100644 --- a/java/src/processing/mode/java/tweak/SketchParser.java +++ b/java/src/processing/mode/java/tweak/SketchParser.java @@ -40,7 +40,7 @@ public class SketchParser { List> scientificNotations; // currently is used to ignore numbers in 'setup' and 'settings' functions - List ignoreFunctions; + List> ignoreFunctions; List> commentBlocks; List curlyScopes; @@ -59,11 +59,15 @@ public SketchParser(String[] codeTabs, boolean requiresComment) { } // add 'settings' and 'setup' to ignore list (to ignore all numbers there) - ignoreFunctions = new ArrayList(); - ignoreFunctions.add(new Range(getVoidFunctionStart(codeTabs[0], "settings"), - getVoidFunctionEnd(codeTabs[0], "settings"))); - ignoreFunctions.add(new Range(getVoidFunctionStart(codeTabs[0], "setup"), - getVoidFunctionEnd(codeTabs[0], "setup"))); + ignoreFunctions = new ArrayList<>(); + Range settingsRange = getVoidFunctionRange(codeTabs[0], "settings"); + Range setupRange = getVoidFunctionRange(codeTabs[0], "setup"); + ignoreFunctions.add(Arrays.asList(settingsRange, setupRange)); + + //Add empty lists for the other tabs so we do not get an index out of bounds error later + for (int i = 0; i < codeTabs.length-1; i++) { + ignoreFunctions.add(new ArrayList()); + } // build curly scope for every character in the code curlyScopes = new ArrayList<>(); @@ -102,7 +106,6 @@ private void addAllNumbers() { } } - /** * Get a list of all the numbers in this sketch * @return @@ -114,7 +117,7 @@ private void addAllDecimalNumbers() { Pattern p = Pattern.compile("[\\[\\{<>(),\\t\\s\\+\\-\\/\\*^%!|&=?:~]\\d+\\.?\\d*"); for (int i = 0; i < codeTabs.length; i++) { - List handles = new ArrayList(); + List handles = new ArrayList<>(); allHandles.add(handles); String c = codeTabs[i]; @@ -130,7 +133,7 @@ private void addAllDecimalNumbers() { continue; } - if (isInRangeList(start, ignoreFunctions)) { + if (isInRangeList(start, ignoreFunctions.get(i))) { // ignore numbers in predefined functions continue; } @@ -222,7 +225,7 @@ private void addAllHexNumbers() { continue; } - if (isInRangeList(start, ignoreFunctions)) { + if (isInRangeList(start, ignoreFunctions.get(i))) { // ignore numbers in predefined functions continue; } @@ -283,7 +286,7 @@ private void addAllWebColorNumbers() { continue; } - if (isInRangeList(start, ignoreFunctions)) { + if (isInRangeList(start, ignoreFunctions.get(i))) { // ignore numbers in predefined functions continue; } @@ -324,7 +327,7 @@ private void addAllWebColorNumbers() { private ArrayList findAllColorModes() { - ArrayList modes = new ArrayList(); + ArrayList modes = new ArrayList<>(); for (int i=0; i colorBox = new ArrayList(); + List colorBox = new ArrayList<>(); colorBoxes.add(colorBox); String tab = codeTabs[i]; Matcher m = p.matcher(tab); while (m.find()) { - ArrayList colorHandles = new ArrayList(); + ArrayList colorHandles = new ArrayList<>(); // look for the '(' and ')' positions int openPar = tab.indexOf("(", m.start()); @@ -387,7 +390,7 @@ private void createColorBoxes() { continue; } - if (isInRangeList(m.start(), ignoreFunctions)) { + if (isInRangeList(m.start(), ignoreFunctions.get(i))) { // ignore numbers in predefined functions continue; } @@ -456,7 +459,7 @@ private void createColorBoxesForLights() { Matcher m = p.matcher(tab); while (m.find()) { - ArrayList colorHandles = new ArrayList(); + ArrayList colorHandles = new ArrayList<>(); // look for the '(' and ')' positions int openPar = tab.indexOf("(", m.start()); @@ -471,7 +474,7 @@ private void createColorBoxesForLights() { continue; } - if (isInRangeList(m.start(), ignoreFunctions)) { + if (isInRangeList(m.start(), ignoreFunctions.get(i))) { // ignore numbers in predefined functions continue; } @@ -555,7 +558,7 @@ private ColorMode getColorModeForContext(String context) { private void handleMultipleColorModes() { // count how many color modes per context - Map modeCount = new HashMap(); + Map modeCount = new HashMap<>(); for (ColorMode cm : colorModes) { Integer prev = modeCount.get(cm.drawContext); if (prev == null) { @@ -565,7 +568,7 @@ private void handleMultipleColorModes() { } // find the contexts that have more than one color mode - ArrayList multipleContexts = new ArrayList(); + ArrayList multipleContexts = new ArrayList<>(); Set allContexts = modeCount.keySet(); for (String context : allContexts) { if (modeCount.get(context) > 1) { @@ -576,7 +579,7 @@ private void handleMultipleColorModes() { // keep only hex and web color boxes in color calls // that belong to 'multipleContexts' contexts for (int i = 0; i < codeTabs.length; i++) { - List toDelete = new ArrayList(); + List toDelete = new ArrayList<>(); for (String context : multipleContexts) { for (ColorControlBox ccb : colorBoxes.get(i)) { if (ccb.drawContext.equals(context) && !ccb.isHex) { @@ -594,7 +597,7 @@ private List> getAllScientificNotations() { Pattern p = Pattern.compile("[+\\-]?(?:0|[1-9]\\d*)(?:\\.\\d*)?[eE][+\\-]?\\d+"); for (String code : codeTabs) { - List notation = new ArrayList(); + List notation = new ArrayList<>(); Matcher m = p.matcher(code); while (m.find()) { notation.add(new Range(m.start(), m.end())); @@ -627,9 +630,13 @@ static private boolean lineHasTweakComment(int pos, String code) { static private boolean hasTweakComment(String code) { + // https://github.com/processing/processing/issues/3742 + return code.contains("/// tweak"); + /* Pattern p = Pattern.compile("\\/\\/.*tweak", Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(code); return m.find(); + */ } @@ -760,7 +767,7 @@ private boolean isGlobal(int pos, int codeTabIndex) { static private List getCommentBlocks(String code) { - List commentBlocks = new ArrayList(); + List commentBlocks = new ArrayList<>(); int lastBlockStart=0; boolean lookForEnd = false; @@ -832,6 +839,11 @@ else if (readObject) { return obj; } + static public Range getVoidFunctionRange(String code, String functionName) { + return new Range(getVoidFunctionStart(code, functionName), + getVoidFunctionEnd(code, functionName)); + } + static public int getVoidFunctionStart(String code, String functionName) { Pattern p = Pattern.compile("void[\\s\\t\\r\\n]*"+functionName+"[\\s\\t]*\\(\\)[\\s\\t\\r\\n]*\\{"); Matcher m = p.matcher(code); diff --git a/java/suggestions.txt b/java/suggestions.txt index ff86167a2c..ae9f8642ea 100644 --- a/java/suggestions.txt +++ b/java/suggestions.txt @@ -1,48 +1,48 @@ #List of suggestions to include/exclude in code completion -#.